@labelbee/lb-components 1.21.0 → 1.22.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/components/AnnotationView/index.js +1 -1
  2. package/dist/components/LLMToolView/questionView/components/imgView/index.js +1 -1
  3. package/dist/components/LLMToolView/questionView/index.js +1 -1
  4. package/dist/components/measureCanvas/index.js +1 -0
  5. package/dist/components/pointCloudView/PointCloud2DSingleView.js +1 -1
  6. package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
  7. package/dist/components/pointCloudView/index.js +1 -1
  8. package/dist/components/videoAnnotate/index.js +1 -1
  9. package/dist/components/videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.js +1 -1
  10. package/dist/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.module.scss.js +1 -1
  11. package/dist/components/videoAnnotate/videoClipTool/index.js +1 -1
  12. package/dist/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
  13. package/dist/components/videoAnnotate/videoTextTool/index.js +1 -1
  14. package/dist/components/videoPlayer/components/controller/index.js +1 -1
  15. package/dist/components/videoPlayer/index.js +1 -1
  16. package/dist/index.css +8 -9
  17. package/dist/index.js +1 -1
  18. package/dist/store/annotation/reducer.js +1 -1
  19. package/dist/types/components/AnnotationView/index.d.ts +1 -0
  20. package/dist/types/components/measureCanvas/index.d.ts +18 -0
  21. package/dist/types/components/pointCloudView/PointCloud2DSingleView.d.ts +2 -1
  22. package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +2 -1
  23. package/dist/types/components/pointCloudView/hooks/useRotate.d.ts +1 -0
  24. package/dist/types/components/pointCloudView/index.d.ts +1 -0
  25. package/dist/types/components/videoAnnotate/index.d.ts +2 -1
  26. package/dist/types/components/videoAnnotate/videoClipTool/index.d.ts +7 -2
  27. package/dist/types/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.d.ts +9 -3
  28. package/dist/types/components/videoAnnotate/videoTextTool/index.d.ts +10 -7
  29. package/dist/types/components/videoPlayer/index.d.ts +2 -1
  30. package/dist/types/index.d.ts +2 -1
  31. package/dist/types/views/MainView/index.d.ts +1 -0
  32. package/dist/types/views/MainView/sidebar/TextToolSidebar/index.d.ts +1 -0
  33. package/dist/views/MainView/index.js +1 -1
  34. package/dist/views/MainView/sidebar/AnnotationText/index.js +1 -1
  35. package/dist/views/MainView/sidebar/SwitchAttributeList/index.js +1 -1
  36. package/dist/views/MainView/sidebar/TagSidebar/index.js +1 -1
  37. package/dist/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
  38. package/dist/views/MainView/sidebar/index.js +1 -1
  39. package/es/components/AnnotationView/index.js +1 -1
  40. package/es/components/LLMToolView/questionView/components/imgView/index.js +1 -1
  41. package/es/components/LLMToolView/questionView/index.js +1 -1
  42. package/es/components/measureCanvas/index.js +1 -0
  43. package/es/components/pointCloudView/PointCloud2DSingleView.js +1 -1
  44. package/es/components/pointCloudView/PointCloud2DView.js +1 -1
  45. package/es/components/pointCloudView/index.js +1 -1
  46. package/es/components/videoAnnotate/index.js +1 -1
  47. package/es/components/videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.js +1 -1
  48. package/es/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.module.scss.js +1 -1
  49. package/es/components/videoAnnotate/videoClipTool/index.js +1 -1
  50. package/es/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
  51. package/es/components/videoAnnotate/videoTextTool/index.js +1 -1
  52. package/es/components/videoPlayer/components/controller/index.js +1 -1
  53. package/es/components/videoPlayer/index.js +1 -1
  54. package/es/index.css +8 -9
  55. package/es/index.js +1 -1
  56. package/es/store/annotation/reducer.js +1 -1
  57. package/es/views/MainView/index.js +1 -1
  58. package/es/views/MainView/sidebar/AnnotationText/index.js +1 -1
  59. package/es/views/MainView/sidebar/SwitchAttributeList/index.js +1 -1
  60. package/es/views/MainView/sidebar/TagSidebar/index.js +1 -1
  61. package/es/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
  62. package/es/views/MainView/sidebar/index.js +1 -1
  63. package/package.json +2 -2
@@ -1 +1 @@
1
- import{MathUtils as I,CommonToolUtils as V,uuid as w,AttributeUtils as k}from"@labelbee/lb-annotation";import{jsonParser as C}from"../../../utils/index.js";import{precisionAdd as D,precisionMinus as j,isImageValue as B}from"../../../utils/audio.js";import{message as m}from"antd";import y from"lodash";import v from"react";import A from"./index.module.scss.js";import{VideoClipToolContextProvider as M}from"./VideoClipToolContext.js";import{EClipStatus as u,ETimeSliceType as x,PER_SLICE_CHANGE as b,SLICE_MIN_TIME as T}from"./constant.js";import{VideoPlayer as N}from"../../videoPlayer/index.js";import U from"./components/videoTimeSlicesOverVideo/index.js";import J from"../../../assets/annotation/video/icon_videoCutting.svg.js";import{decimalReserved as F}from"../../videoPlayer/utils.js";var $=Object.defineProperty,z=Object.defineProperties,G=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,H=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,O=(c,r,t)=>r in c?$(c,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[r]=t,q=(c,r)=>{for(var t in r||(r={}))H.call(r,t)&&O(c,t,r[t]);if(L)for(var t of L(r))W.call(r,t)&&O(c,t,r[t]);return c},K=(c,r)=>z(c,G(r));class Q extends v.Component{constructor(r){super(r);this.fns=new Map,this.throttledUpdateTime=y.throttle(t=>{this.videoPlayer.currentTime=t},100,{trailing:!0}),this.stepInfo=()=>this.props.stepInfo,this.emitEvent=t=>{const e=this.fns.get(t);e&&e.forEach(i=>{i&&i()})},this.setValid=t=>{this.setState({valid:t}),t===!1&&(this.clearResult(),this.updateSidebar())},this.updateSidebar=()=>{this.emitEvent("changeClipSidebar")},this.exportData=()=>{var t,e;const i=(e=(t=this.videoRef)==null?void 0:t.duration)!=null?e:0;return[this.state.result.filter(s=>s.end!==null),{valid:this.state.valid,duration:i}]},this.updateSelectedSliceTimeStartByPer=t=>{var e,i;if(this.state.clipStatus===u.Clipping){m.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0,{end:a,start:o,type:l}=this.state.result[this.selectedSliceIndex],n=I.withinRange(D(o,t),[0,j(l===x.Time?s:a,b)]);this.updateSelectedSliceTimeProperty(n,"start")}},this.updateSelectedSliceTimeEndByPer=t=>{var e,i;if(this.state.clipStatus===u.Clipping){m.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u7ED3\u675F\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=this.state.result[this.selectedSliceIndex],a=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0;if(s.type===x.Time){m.info("\u65F6\u95F4\u70B9\u4EC5\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}const{end:o,start:l}=s,n=I.withinRange(D(o,t),[D(l,b),a]);this.updateSelectedSliceTimeProperty(n,"end")}},this.updateSelectedSliceTimeProperty=(t,e)=>{if(this.selectedSliceIndex>-1){const{result:i}=this.state;i[this.selectedSliceIndex][e]=t,this.setState({result:y.cloneDeep(i)}),this.updateSidebar()}},this.keyDownEvents=t=>{if(!V.hotkeyFilter(t))return;const e=t.target;switch(e&&(e==null?void 0:e.tag)==="INPUT"&&(e==null?void 0:e.type)==="radio"&&t.preventDefault(),t.key.toLocaleLowerCase()){case"x":this.toggleClipStatus();break;case"e":this.addTime();break;case"escape":this.cancelClipped();break;case"-":this.updateSelectedSliceTimeStartByPer(-b);break;case"=":this.updateSelectedSliceTimeStartByPer(b);break;case"[":this.updateSelectedSliceTimeEndByPer(-b);break;case"]":this.updateSelectedSliceTimeEndByPer(b);break}},this.videoLoaded=t=>{var e;const i=this.resultJSON,s=i&&!["","{}"].includes(i),a=t?parseFloat(t.toFixed(2)):0,o={loading:!1};((e=C(i))==null?void 0:e.duration)||Object.assign(o,{result:JSON.stringify(K(q({},C(i)),{duration:a}))}),s||Object.assign(o,{result:JSON.stringify({width:0,height:0,rotate:0,valid:!0,duration:a})}),this.setState({loading:!1})},this.setVideoError=(t,e,i)=>{if(t){const{clipStatus:s}=this.state;s===u.Clipping&&this.toggleClipStatus(i)}this.setState({videoError:t,loading:!1})},this.clearResult=()=>{this.setState({result:[],selectedID:"",textValue:""}),this.updateSidebar()},this.cancelClipped=()=>{const{result:t,selectedID:e,clipStatus:i}=this.state;if(i!==u.Clipping)return;const s=t.findIndex(a=>a.id===e);s>-1&&(t.splice(s,1),this.setState({result:t,selectedID:"",clipStatus:u.Stop}),this.updateSidebar())},this.toggleClipStatus=t=>{var e,i,s;if(this.disabled)return;const{clipStatus:a,selectedAttribute:o}=this.state,l=a!==u.Clipping;let n=l?u.Clipping:u.Stop,{result:d,selectedID:p,textValue:S}=this.state;const h=y.cloneDeep(d),f=t||((e=this.videoPlayer)==null?void 0:e.currentTime),E=(i=this.videoPlayer)==null?void 0:i.duration;if(E===void 0||f===void 0)return;const R=F(f,2);if(l){const g=w();p=g,h.push({start:R,end:null,attribute:o,textAttribute:this.defaultTextAttribute,duration:E,id:g,type:x.Period}),S=this.defaultTextAttribute}else{const g=h.findIndex(_=>_.id===p),P=h[g];P&&(f-P.start<T?(h.splice(g,1),m.info(`\u622A\u53D6\u7247\u6BB5\u4E0D\u80FD\u77ED\u4E8E${T}s`),n=u.Stop,p="",S=""):(h[g].end=F(f,2),(s=this.videoPlayer)==null||s.pause(),m.success(`\u5DF2\u622A\u53D6\u7247\u6BB5${d.length}`)))}this.setState({clipStatus:n,result:h,selectedID:p,textValue:S}),this.updateSidebar()},this.addTime=()=>{var t,e,i,s;if(this.disabled)return;const{result:a,selectedAttribute:o,selectedID:l}=this.state,n=w(),d=y.cloneDeep(a),p=((t=this.videoPlayer)==null?void 0:t.currentTime)||0;d.push({start:p,end:p,attribute:o,textAttribute:this.defaultTextAttribute,id:n,type:x.Time,duration:(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0});const S={result:d,selectedID:n,textValue:this.defaultTextAttribute},h=d.find(f=>f.id===l);this.isClipping&&h?(delete S.selectedID,delete S.textValue,m.success(`\u5DF2\u622A\u53D6\u65F6\u95F4\u70B9${d.length-1}`)):(s=this.videoPlayer)==null||s.pause(),this.setState(S),this.updateSidebar()},this.contextToCancel=t=>{this.state.clipStatus===u.Stop&&(t.preventDefault(),this.setState({selectedID:""}),this.updateSidebar())},this.onTrackResize=(t,e,i)=>{var s,a;const{result:o}=this.state,l=o.find(n=>n.id===t);if(l){const n=l.duration,d=e==="left",p=d?"start":"end",S=d?-n*i:n*i,h=d?[0,Math.max(((s=l.end)!=null?s:0)-T,0)]:[l.start+T,n],f=I.withinRange(S+((a=l==null?void 0:l[p])!=null?a:0),h);l[p]=f,this.throttledUpdateTime(f)}this.setState({result:[...o]}),this.updateSidebar()},this.renderMediaContent=()=>{const{pageForward:t,pageJump:e,pageBackward:i}=this.props,{result:s,currentTime:a,videoError:o,valid:l}=this.state;return v.createElement("div",{className:A.clipContainer},v.createElement(N,{imgIndex:this.props.imgIndex,imgList:this.props.imgList,pageBackward:i,pageForward:t,pageJump:e,valid:l,setVideoRef:n=>{this.videoPlayer=n},showVideoTrack:!o,onTrackResize:this.onTrackResize,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer,dataLoaded:this.videoLoaded}),v.createElement(U,{result:s,currentTime:a,attributeList:this.props.config.attributeList,extraStyle:{top:this.props.drawLayerSlot?40:0}}),this.isClipping&&v.createElement("i",{className:A.clipping,style:{backgroundImage:J}}))},this.onSelectedTimeSlice=t=>{var e;this.isClipping||(this.setState({selectedID:t.id,selectedAttribute:t.attribute,textValue:t.textAttribute}),this.updateSidebar(),(e=this.videoPlayer)==null||e.pause(),this.videoPlayer.currentTime=t.start)},this.removeTimeSlice=t=>{const{result:e}=this.state,i=this.state.selectedID===t.id?"":this.state.selectedID,s=e.findIndex(a=>a.id===t.id);s>-1&&(e.splice(s,1),this.setState({result:[...e],selectedID:i}),this.updateSidebar())},this.setResult=(t=!0,e=this.props)=>{try{const{imgIndex:i,imgList:s}=e;if(!s[i])return;const o=C(s[i].result)[`step_${this.stepInfo().step}`],l=(o==null?void 0:o.result)||[],n=B(s[i].result||"[]");this.setState({result:l,loading:t,selectedID:"",textValue:"",selectedAttribute:"",clipStatus:u.Stop,valid:n},()=>{this.updateSidebar(),n||m.info("\u65E0\u6548\u89C6\u9891\uFF0C\u8BF7\u8DF3\u8FC7")})}catch(i){console.error("\u6570\u636E\u89E3\u6790\u5931\u8D25"),this.setState({result:[],loading:!1,selectedID:"",textValue:"",selectedAttribute:"",valid:!0},()=>{this.updateSidebar()})}},this.setDefaultAttribute=t=>{const{result:e,selectedID:i}=this.state,s=e.find(a=>a.id===i);s&&i&&(s.attribute=t),this.setState({selectedAttribute:t,result:[...e]}),this.updateSidebar()},this.setTextAttribute=t=>{const{result:e,selectedID:i}=this.state;if(this.setState({textValue:t}),i){const s=e.find(a=>a.id===i);s&&(s.textAttribute=t,this.setState({result:[...e]}),this.updateSidebar())}},this.state={result:[],selectedAttribute:"",textValue:"",clipStatus:u.Stop,selectedID:"",loading:!1,videoError:!1,remainingTime:0,currentTime:0,configLoading:!1,valid:!0}}get videoUrl(){var r;const{imgIndex:t,imgList:e}=this.props;return((r=e[t])==null?void 0:r.url)||""}get isClipping(){return this.state.clipStatus===u.Clipping}get resultJSON(){const{imgIndex:r,imgList:t}=this.props;return t.length===0||!t[r]?"[]":t[r].result}get disabled(){return!this.state.valid||this.state.videoError}get loading(){return this.state.loading||this.state.configLoading}get defaultTextAttribute(){return k.getTextAttribute(this.state.result,this.props.config.textCheckType)}get defaultAttribute(){return this.state.selectedAttribute}get selectedSliceIndex(){return this.state.result.findIndex(r=>r.id===this.state.selectedID)}get exportContext(){return{selectedID:this.state.selectedID,result:this.state.result,clipStatus:this.state.clipStatus,videoPlayer:this.videoPlayer,attributeList:this.props.config.attributeList,onSelectedTimeSlice:this.onSelectedTimeSlice,removeTimeSlice:this.removeTimeSlice,updateSelectedSliceTimeProperty:this.updateSelectedSliceTimeProperty}}get valid(){return this.state.valid}componentDidMount(){this.setState({loading:!1}),this.setResult(!1),this.props.onMounted(this),window.addEventListener("keydown",this.keyDownEvents)}componentWillUnmount(){this.props.onUnmounted(),window.removeEventListener("keydown",this.keyDownEvents)}shouldComponentUpdate(r,t){const e=r.imgIndex-this.props.imgIndex,i=r.step-this.props.step;return(e!==0||i!==0)&&(this.setResult(!0,r),i!==0&&this.setState({loading:!1})),!0}singleOn(r,t){this.fns.set(r,[t])}on(r,t){this.singleOn(r,t)}unbindAll(r){this.fns.delete(r)}render(){const{selectedID:r,result:t,clipStatus:e,selectedAttribute:i}=this.state;return v.createElement(M,{value:{videoPlayer:this.videoPlayer,result:t,selectedID:r,attributeList:this.props.config.attributeList,clipStatus:e,selectedAttribute:i,contextToCancel:this.contextToCancel}},this.renderMediaContent())}}export{Q as default};
1
+ import{MathUtils as C,CommonToolUtils as F,uuid as A,AttributeUtils as k}from"@labelbee/lb-annotation";import{jsonParser as P}from"../../../utils/index.js";import{precisionAdd as I,precisionMinus as V,isImageValue as R}from"../../../utils/audio.js";import{message as m}from"antd";import b from"lodash";import g from"react";import _ from"./index.module.scss.js";import{VideoClipToolContextProvider as B}from"./VideoClipToolContext.js";import{EClipStatus as o,ETimeSliceType as T,PER_SLICE_CHANGE as v,SLICE_MIN_TIME as x}from"./constant.js";import{VideoPlayer as j}from"../../videoPlayer/index.js";import M from"./components/videoTimeSlicesOverVideo/index.js";import U from"../../../assets/annotation/video/icon_videoCutting.svg.js";import{decimalReserved as L}from"../../videoPlayer/utils.js";class N extends g.Component{constructor(r){super(r);this.fns=new Map,this.throttledUpdateTime=b.throttle(t=>{this.videoPlayer.currentTime=t},100,{trailing:!0}),this.stepInfo=()=>this.props.stepInfo,this.emitEvent=t=>{const e=this.fns.get(t);e&&e.forEach(i=>{i&&i()})},this.setValid=t=>{this.setState({valid:t}),t===!1&&(this.clearResult(),this.updateSidebar())},this.updateSidebar=()=>{this.emitEvent("changeClipSidebar"),this.emitEvent("updateTextAttribute"),this.emitEvent("changeAttributeSidebar")},this.exportData=()=>{var t,e;const i=(e=(t=this.videoRef)==null?void 0:t.duration)!=null?e:0;return[this.state.result.filter(s=>s.end!==null),{valid:this.state.valid,duration:i}]},this.updateSelectedSliceTimeStartByPer=t=>{var e,i;if(this.state.clipStatus===o.Clipping){m.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0,{end:l,start:u,type:a}=this.state.result[this.selectedSliceIndex],n=C.withinRange(I(u,t),[0,V(a===T.Time?s:l,v)]);this.updateSelectedSliceTimeProperty(n,"start")}},this.updateSelectedSliceTimeEndByPer=t=>{var e,i;if(this.state.clipStatus===o.Clipping){m.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u7ED3\u675F\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=this.state.result[this.selectedSliceIndex],l=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0;if(s.type===T.Time){m.info("\u65F6\u95F4\u70B9\u4EC5\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}const{end:u,start:a}=s,n=C.withinRange(I(u,t),[I(a,v),l]);this.updateSelectedSliceTimeProperty(n,"end")}},this.updateSelectedSliceTimeProperty=(t,e)=>{if(this.selectedSliceIndex>-1){const{result:i}=this.state;i[this.selectedSliceIndex][e]=t,this.setState({result:b.cloneDeep(i)}),this.updateSidebar()}},this.keyDownEvents=t=>{if(!F.hotkeyFilter(t))return;const e=t.target;switch(e&&(e==null?void 0:e.tag)==="INPUT"&&(e==null?void 0:e.type)==="radio"&&t.preventDefault(),t.key.toLocaleLowerCase()){case"x":this.toggleClipStatus();break;case"e":this.addTime();break;case"escape":this.cancelClipped();break;case"-":this.updateSelectedSliceTimeStartByPer(-v);break;case"=":this.updateSelectedSliceTimeStartByPer(v);break;case"[":this.updateSelectedSliceTimeEndByPer(-v);break;case"]":this.updateSelectedSliceTimeEndByPer(v);break}},this.setVideoError=(t,e,i)=>{if(t){const{clipStatus:s}=this.state;s===o.Clipping&&this.toggleClipStatus(i)}this.setState({videoError:t,loading:!1})},this.clearResult=()=>{this.setState({result:[],selectedID:"",textValue:""}),this.updateSidebar()},this.cancelClipped=()=>{const{result:t,selectedID:e,clipStatus:i}=this.state;if(i!==o.Clipping)return;const s=t.findIndex(l=>l.id===e);s>-1&&(t.splice(s,1),this.setState({result:t,selectedID:"",clipStatus:o.Stop}),this.updateSidebar())},this.toggleClipStatus=t=>{var e,i,s;if(this.disabled)return;const{clipStatus:l,selectedAttribute:u}=this.state,a=l!==o.Clipping;let n=a?o.Clipping:o.Stop,{result:d,selectedID:c,textValue:p}=this.state;const h=b.cloneDeep(d),S=t||((e=this.videoPlayer)==null?void 0:e.currentTime),y=(i=this.videoPlayer)==null?void 0:i.duration;if(y===void 0||S===void 0)return;const w=L(S,2);if(a){const f=A();c=f,h.push({start:w,end:null,attribute:u,textAttribute:this.defaultTextAttribute,duration:y,id:f,type:T.Period}),p=this.defaultTextAttribute}else{const f=h.findIndex(E=>E.id===c),D=h[f];D&&(S-D.start<x?(h.splice(f,1),m.info(`\u622A\u53D6\u7247\u6BB5\u4E0D\u80FD\u77ED\u4E8E${x}s`),n=o.Stop,c="",p=""):(h[f].end=L(S,2),(s=this.videoPlayer)==null||s.pause(),m.success(`\u5DF2\u622A\u53D6\u7247\u6BB5${d.length}`)))}this.setState({clipStatus:n,result:h,selectedID:c,textValue:p}),this.updateSidebar()},this.addTime=()=>{var t,e,i,s;if(this.disabled)return;const{result:l,selectedAttribute:u,selectedID:a}=this.state,n=A(),d=b.cloneDeep(l),c=((t=this.videoPlayer)==null?void 0:t.currentTime)||0;d.push({start:c,end:c,attribute:u,textAttribute:this.defaultTextAttribute,id:n,type:T.Time,duration:(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0});const p={result:d,selectedID:n,textValue:this.defaultTextAttribute},h=d.find(S=>S.id===a);this.isClipping&&h?(delete p.selectedID,delete p.textValue,m.success(`\u5DF2\u622A\u53D6\u65F6\u95F4\u70B9${d.length-1}`)):(s=this.videoPlayer)==null||s.pause(),this.setState(p),this.updateSidebar()},this.updateCurrentTime=t=>{this.setState({currentTime:t})},this.contextToCancel=t=>{this.state.clipStatus===o.Stop&&(t.preventDefault(),this.setState({selectedID:""}),this.updateSidebar())},this.onTrackResize=(t,e,i)=>{var s,l;const{result:u}=this.state,a=u.find(n=>n.id===t);if(a){const n=a.duration,d=e==="left",c=d?"start":"end",p=d?-n*i:n*i,h=d?[0,Math.max(((s=a.end)!=null?s:0)-x,0)]:[a.start+x,n],S=C.withinRange(p+((l=a==null?void 0:a[c])!=null?l:0),h);a[c]=S,this.throttledUpdateTime(S)}this.setState({result:[...u]}),this.updateSidebar()},this.renderMediaContent=()=>{var t;const{pageForward:e,pageJump:i,pageBackward:s}=this.props,{result:l,videoError:u,valid:a,currentTime:n}=this.state;return g.createElement("div",{className:_.clipContainer},g.createElement(j,{imgIndex:this.props.imgIndex,imgList:this.props.imgList,pageBackward:s,pageForward:e,pageJump:i,valid:a,setVideoRef:d=>{this.videoPlayer=d},showVideoTrack:!u,onTrackResize:this.onTrackResize,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer,dataLoaded:this.props.onVideoLoaded,toggleClipStatus:this.toggleClipStatus,addTime:this.addTime,updateCurrentTime:this.updateCurrentTime}),g.createElement(M,{key:(t=this.videoPlayer)==null?void 0:t.currentTime,result:l,currentTime:n,attributeList:this.props.config.attributeList,extraStyle:{top:this.props.drawLayerSlot?40:0}}),this.isClipping&&g.createElement("i",{className:_.clipping,style:{backgroundImage:U}}))},this.onSelectedTimeSlice=t=>{var e;this.isClipping||(this.setState({selectedID:t.id,selectedAttribute:t.attribute,textValue:t.textAttribute,currentTime:t.start}),this.updateSidebar(),(e=this.videoPlayer)==null||e.pause(),this.videoPlayer.currentTime=t.start)},this.removeTimeSlice=t=>{const{result:e}=this.state,i=this.state.selectedID===t.id?"":this.state.selectedID,s=e.findIndex(l=>l.id===t.id);s>-1&&(e.splice(s,1),this.setState({result:[...e],selectedID:i}),this.updateSidebar())},this.setResult=(t=!0,e=this.props)=>{try{const{imgIndex:i,imgList:s}=e;if(!s[i])return;const u=P(s[i].result)[`step_${this.stepInfo().step}`],a=(u==null?void 0:u.result)||[],n=R(s[i].result||"[]");this.setState({result:a,loading:t,selectedID:"",textValue:"",selectedAttribute:"",clipStatus:o.Stop,valid:n},()=>{this.updateSidebar(),n||m.info("\u65E0\u6548\u89C6\u9891\uFF0C\u8BF7\u8DF3\u8FC7")})}catch(i){console.error("\u6570\u636E\u89E3\u6790\u5931\u8D25"),this.setState({result:[],loading:!1,selectedID:"",textValue:"",selectedAttribute:"",valid:!0},()=>{this.updateSidebar()})}},this.setDefaultAttribute=t=>{const{result:e,selectedID:i}=this.state,s=e.find(l=>l.id===i);s&&i&&(s.attribute=t),this.setState({selectedAttribute:t,result:[...e]}),this.updateSidebar()},this.textChange=t=>{const{result:e,selectedID:i}=this.state;if(this.setState({textValue:t}),i){const s=e.find(l=>l.id===i);s&&(s.textAttribute=t,this.setState({result:[...e]}),this.updateSidebar())}},this.state={result:[],selectedAttribute:"",textValue:"",clipStatus:o.Stop,selectedID:"",loading:!1,videoError:!1,remainingTime:0,currentTime:0,configLoading:!1,valid:!0}}get videoUrl(){var r;const{imgIndex:t,imgList:e}=this.props;return((r=e[t])==null?void 0:r.url)||""}get isClipping(){return this.state.clipStatus===o.Clipping}get resultJSON(){const{imgIndex:r,imgList:t}=this.props;return t.length===0||!t[r]?"[]":t[r].result}get disabled(){return!this.state.valid||this.state.videoError}get loading(){return this.state.loading||this.state.configLoading}get defaultTextAttribute(){return k.getTextAttribute(this.state.result,this.props.config.textCheckType)}get defaultAttribute(){return this.state.selectedAttribute}get selectedID(){return this.state.selectedID}get selectedSliceIndex(){return this.state.result.findIndex(r=>r.id===this.state.selectedID)}get exportContext(){return{selectedID:this.state.selectedID,result:this.state.result,clipStatus:this.state.clipStatus,videoPlayer:this.videoPlayer,attributeList:this.props.config.attributeList,onSelectedTimeSlice:this.onSelectedTimeSlice,removeTimeSlice:this.removeTimeSlice,updateSelectedSliceTimeProperty:this.updateSelectedSliceTimeProperty}}get valid(){return this.state.valid}get config(){var r;return P((r=this.props.stepInfo)==null?void 0:r.config)}get selectedText(){var r,t;return(t=(r=this.state.result)==null?void 0:r[this.selectedSliceIndex])==null?void 0:t.textAttribute}componentDidMount(){this.setState({loading:!1}),this.setResult(!1),this.props.onMounted(this),window.addEventListener("keydown",this.keyDownEvents)}componentWillUnmount(){this.props.onUnmounted(),window.removeEventListener("keydown",this.keyDownEvents)}shouldComponentUpdate(r,t){const e=r.imgIndex-this.props.imgIndex,i=r.step-this.props.step;return(e!==0||i!==0)&&(this.setResult(!0,r),i!==0&&this.setState({loading:!1})),!0}singleOn(r,t){this.fns.set(r,[t])}on(r,t){this.singleOn(r,t)}unbindAll(r){this.fns.delete(r)}render(){const{selectedID:r,result:t,clipStatus:e,selectedAttribute:i}=this.state;return g.createElement(B,{value:{videoPlayer:this.videoPlayer,result:t,selectedID:r,attributeList:this.props.config.attributeList,clipStatus:e,selectedAttribute:i,contextToCancel:this.contextToCancel}},this.renderMediaContent())}}export{N as default};
@@ -1 +1 @@
1
- import h from"react";import{CommonToolUtils as p,uuid as f}from"@labelbee/lb-annotation";import{jsonParser as c}from"../../../utils/index.js";import{VideoPlayer as y}from"../../videoPlayer/index.js";import{VideoTagLayer as L}from"../../videoPlayer/VideoTagLayer.js";import g from"lodash";import{getKeyCodeNumber as b}from"../../videoPlayer/utils.js";class R extends h.Component{constructor(s){super(s);this.fns={},this.labelSelectedList=[],this.clearResult=(t=!0,e)=>{const i=e?this.state.tagResult.map(l=>((l==null?void 0:l.result[e])&&delete l.result[e],l)):[];this.setState({tagResult:i},()=>this.emitEvent("render"))},this.exportData=()=>{var t,e,i,l,r,o,n;const a=(e=(t=this.videoPlayer)==null?void 0:t.duration)!=null?e:0,d=(i=this.videoPlayer)==null?void 0:i.getVideoPlaybackQuality(),u=d==null?void 0:d.totalVideoFrames,v=(r=(l=this.videoPlayer)==null?void 0:l.videoWidth)!=null?r:0,m=(n=(o=this.videoPlayer)==null?void 0:o.videoHeight)!=null?n:0;return[this.state.tagResult,{valid:this.state.valid,duration:a,frames:u,videoWidth:v,videoHeight:m}]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.combineResult=(t,e={})=>{var i,l;const{isMulti:r}=t,{key:o,value:n}=t.value;if(r){let a=(l=(i=e[o])==null?void 0:i.split(";"))!=null?l:[];a.includes(n)?a=a.filter(u=>u!==n):a.push(n);const d=new Set(a);return e[o]=Array.from(d).join(";"),g.pickBy(e,u=>u)}return e[o]=e[o]===n?void 0:n,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 i=e-1;if(this.config.inputList.length===1){this.labelSelectedList=[0,i],this.setLabel(0,i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500);return}this.labelSelectedList.length===1?(this.labelSelectedList=[this.labelSelectedList[0],i],this.setLabel(this.labelSelectedList[0],i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500)):(this.labelSelectedList=[i],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:i,imgIndex:l,step:r}=t;if(!i[l])return;const o=c(i[l].result),n=o[`step_${r}`];this.setState({tagResult:(e=n==null?void 0:n.result)!=null?e:[],valid:(o==null?void 0:o.valid)===void 0?!0:o.valid})},this.state={tagResult:[],labelSelectedList:[],valid:!0}}get config(){var s;return c((s=this.props.stepInfo)==null?void 0:s.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get currentTagResult(){var s;return(s=this.state.tagResult[0])!=null?s:{}}get valid(){return this.state.valid}singleOn(s,t){this.fns[s]=t}on(s,t){this.singleOn(s,t)}unbindAll(s){delete this.fns[s]}getTagResultByCode(s,t){var e,i,l;try{const r=(i=(e=this.config)==null?void 0:e.inputList)!=null?i:[],o=r.length>1,n=t!==void 0?s:0,a=t!==void 0?t:s,d=o?r[n]: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(s,t){var e,i,l,r;const o=this.getTagResultByCode(s,t);if(o){const n=this.combineResult(o,(i=(e=this.state.tagResult[0])==null?void 0:e.result)!=null?i:{}),a=[{sourceID:p.getSourceID(),id:(r=(l=this.currentTagResult)==null?void 0:l.id)!=null?r:f(8,62),result:n}];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(s){return s.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(s),!0}render(){var s;const{imgIndex:t,imgList:e,pageForward:i,pageJump:l,pageBackward:r}=this.props,{tagResult:o,valid:n}=this.state;return h.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},h.createElement(y,{imgIndex:t,imgList:e,pageBackward:r,pageForward:i,pageJump:l,valid:n,setVideoRef:a=>{this.videoPlayer=a},drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer}),h.createElement(L,{result:o,inputList:(s=this.config)==null?void 0:s.inputList,hasPromptLayer:!!this.props.drawLayerSlot}))}}export{R as TagToolInstanceAdaptor};
1
+ import h from"react";import{TagUtils as p,CommonToolUtils as m,uuid as v}from"@labelbee/lb-annotation";import{jsonParser as c}from"../../../utils/index.js";import{VideoPlayer as f}from"../../videoPlayer/index.js";import{VideoTagLayer as y}from"../../videoPlayer/VideoTagLayer.js";import g from"lodash";import{getKeyCodeNumber as L}from"../../videoPlayer/utils.js";class R extends h.Component{constructor(s){super(s);this.fns={},this.labelSelectedList=[],this.clearResult=(t=!0,e)=>{const l=e?this.state.tagResult.map(i=>((i==null?void 0:i.result[e])&&delete i.result[e],i)):[];this.setState({tagResult:l},()=>this.emitEvent("render"))},this.exportData=()=>{var t,e;const l=(e=(t=this.videoPlayer)==null?void 0:t.duration)!=null?e:0;return[this.state.tagResult,{valid:this.state.valid,duration:l}]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.combineResult=(t,e={})=>{var l,i;const{isMulti:n}=t,{key:o,value:r}=t.value;if(n){let a=(i=(l=e[o])==null?void 0:l.split(";"))!=null?i:[];a.includes(r)?a=a.filter(u=>u!==r):a.push(r);const d=new Set(a);return e[o]=Array.from(d).join(";"),g.pickBy(e,u=>u)}return e[o]=e[o]===r?void 0:r,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=>{var e;const l=L(t.keyCode);if(l){const i=l-1;if(((e=this.config.inputList)==null?void 0:e.length)===1){this.labelSelectedList=[0,i],this.setLabel(0,i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500);return}this.labelSelectedList.length===1?(this.labelSelectedList=[this.labelSelectedList[0],i],this.setLabel(this.labelSelectedList[0],i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500)):(this.labelSelectedList=[i],this.emitEvent("expend"))}},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({tagResult:[]}),this.emitEvent("render")},this.setResultFromImgList=t=>{const{imgList:e,imgIndex:l,stepInfo:i}=t;if(!e[l])return;const n=c(e[l].result),o=n[`step_${i.step}`],r=this.getInitResultList();this.setState({tagResult:o?o==null?void 0:o.result:r,valid:(n==null?void 0:n.valid)===void 0?!0:n.valid},()=>this.emitEvent("render"))},this.getInitResultList=()=>{var t;return p.getDefaultTagResult((t=this.config.inputList)!=null?t:[],[])},this.state={tagResult:[],labelSelectedList:[],valid:!0}}get config(){var s;return c((s=this.props.stepInfo)==null?void 0:s.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get currentTagResult(){var s;return(s=this.state.tagResult[0])!=null?s:{}}get valid(){return this.state.valid}singleOn(s,t){this.fns[s]=t}on(s,t){this.singleOn(s,t)}unbindAll(s){delete this.fns[s]}getTagResultByCode(s,t){var e,l,i;try{const n=(l=(e=this.config)==null?void 0:e.inputList)!=null?l:[],o=(n==null?void 0:n.length)>1,r=t!==void 0?s:0,a=t!==void 0?t:s,d=o?n[r]:n[0],u=((i=d.subSelected)!=null?i:[])[a];if(d&&u)return{value:{key:d.value,value:u.value},isMulti:d.isMulti}}catch(n){return}}setLabelBySelectedList(s,t){var e,l,i,n;const o=this.getTagResultByCode(s,t);if(o){const r=this.combineResult(o,(l=(e=this.state.tagResult[0])==null?void 0:e.result)!=null?l:{}),a=[{sourceID:m.getSourceID(),id:(n=(i=this.currentTagResult)==null?void 0:i.id)!=null?n:v(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(s){return s.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(s),!0}render(){var s;const{imgIndex:t,imgList:e,pageForward:l,pageJump:i,pageBackward:n}=this.props,{tagResult:o,valid:r}=this.state;return h.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},h.createElement(f,{imgIndex:t,imgList:e,pageBackward:n,pageForward:l,pageJump:i,valid:r,setVideoRef:a=>{this.videoPlayer=a},dataLoaded:this.props.onVideoLoaded,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer}),h.createElement(y,{result:o,inputList:(s=this.config)==null?void 0:s.inputList,hasPromptLayer:!!this.props.drawLayerSlot}))}}export{R as TagToolInstanceAdaptor};
@@ -1 +1 @@
1
- import u from"react";import{jsonParser as p}from"../../../utils/index.js";import{VideoPlayer as g}from"../../videoPlayer/index.js";import c from"lodash";import{VideoTextLayer as f}from"../../videoPlayer/VideoTextLayer.js";import{toolStyleConverter as y}from"@labelbee/lb-utils";class x extends u.Component{constructor(e){super(e);this.fns={},this.clearResult=(t=!0)=>{this.setState({result:{}},()=>this.updateSidebar())},this.exportData=()=>{var t,l,s,o,i,n,r;const a=(l=(t=this.videoPlayer)==null?void 0:t.duration)!=null?l:0,d=(s=this.videoPlayer)==null?void 0:s.getVideoPlaybackQuality(),h=d==null?void 0:d.totalVideoFrames,v=(i=(o=this.videoPlayer)==null?void 0:o.videoWidth)!=null?i:0,m=(r=(n=this.videoPlayer)==null?void 0:n.videoHeight)!=null?r:0;return[[this.state.result],{valid:this.state.valid,duration:a,frames:h,videoWidth:v,videoHeight:m}]},this.toggleShowText=t=>{this.setState({showText:t})},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.updateSidebar=()=>{this.emitEvent("valueUpdated")},this.updateTextValue=(t,l,s)=>{var o;const i=c.cloneDeep(s!=null?s:{});i.value=Object.assign((o=i.value)!=null?o:{},{[t]:l}),this.setState({result:i},()=>this.updateSidebar())},this.setResult=t=>{this.setState({result:t}),this.fns.render&&this.fns.render()},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({result:{}}),this.emitEvent("render")},this.setResultFromImgList=t=>{var l,s;const{imgList:o,imgIndex:i,step:n}=t;if(!o[i])return;const r=p(o[i].result),a=r[`step_${n}`];this.setState({result:(s=(l=a==null?void 0:a.result)==null?void 0:l[0])!=null?s:{},valid:(r==null?void 0:r.valid)===void 0?!0:r.valid},()=>this.updateSidebar())},this.state={result:{},valid:!0,showText:!0}}get config(){var e;return p((e=this.props.stepInfo)==null?void 0:e.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get valid(){return this.state.valid}get textList(){return[this.state.result]}getColor(e=this.config,t=""){return y.getColorByConfig({attribute:t,config:e})}singleOn(e,t){this.fns[e]=t}on(e,t){this.singleOn(e,t)}unbindAll(e){delete this.fns[e]}componentDidMount(){this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){this.props.onUnmounted()}shouldComponentUpdate(e){return e.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(e),!0}render(){var e,t;const{imgIndex:l,imgList:s,pageForward:o,pageJump:i,pageBackward:n}=this.props,{result:r,valid:a,showText:d}=this.state;return u.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},d&&r.value&&u.createElement(f,{value:r.value,toolColor:(t=(e=this.getColor(this.config))==null?void 0:e.valid)==null?void 0:t.fill,configList:this.config.configList,hasPromptLayer:!!this.props.drawLayerSlot}),u.createElement(g,{imgIndex:l,imgList:s,pageBackward:n,pageForward:o,pageJump:i,valid:a,setVideoRef:h=>{this.videoPlayer=h},drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer}))}}export{x as VideoTextTool};
1
+ import u from"react";import{jsonParser as h}from"../../../utils/index.js";import{VideoPlayer as v}from"../../videoPlayer/index.js";import f from"lodash";import{VideoTextLayer as g}from"../../videoPlayer/VideoTextLayer.js";import{toolStyleConverter as m}from"@labelbee/lb-utils";class c extends u.Component{constructor(s){super(s);this.fns={},this.clearResult=(t=!0)=>{this.setState({result:{}},()=>this.updateSidebar())},this.exportData=()=>{var t,e;const i=(e=(t=this.videoPlayer)==null?void 0:t.duration)!=null?e:0;return[[this.state.result],{valid:this.state.valid,duration:i}]},this.toggleShowText=t=>{this.setState({showText:t})},this.singleOn=(t,e)=>{this.fns[t]=e},this.on=(t,e)=>{this.singleOn(t,e)},this.unbindAll=t=>{delete this.fns[t]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.updateSidebar=()=>{this.emitEvent("valueUpdated")},this.updateTextValue=(t,e,i,o)=>{var r;const l=f.cloneDeep(o!=null?o:{});l.value=Object.assign((r=l.value)!=null?r:{},{[t]:e}),this.setState({result:l},()=>i&&this.updateSidebar())},this.setResult=t=>{this.setState({result:t}),this.fns.render&&this.fns.render()},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({result:{}}),this.emitEvent("render")},this.setResultFromImgList=t=>{var e,i;const{imgList:o,imgIndex:r,stepInfo:l}=t;if(!o[r])return;const n=h(o[r].result),a=n[`step_${l.step}`],d={value:this.getInitTextValue()};this.setState({result:a?(i=(e=a==null?void 0:a.result)==null?void 0:e[0])!=null?i:{}:d,valid:(n==null?void 0:n.valid)===void 0?!0:n.valid},()=>this.updateSidebar())},this.getInitTextValue=()=>{let t={};return this.config.configList.forEach(e=>{var i;t[e.key]=(i=e.default)!=null?i:""}),t},this.state={result:{},valid:!0,showText:!0}}get config(){var s;return h((s=this.props.stepInfo)==null?void 0:s.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get valid(){return this.state.valid}get needConfirm(){var s;const{result:t}=this.state;return(s=this.config.configList)==null?void 0:s.some(e=>{var i;return e.required&&!((i=t==null?void 0:t.value)==null?void 0:i[e.key])})}get textList(){return[this.state.result]}getColor(s=this.config,t=""){return m.getColorByConfig({attribute:t,config:s})}componentDidMount(){this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){this.props.onUnmounted()}shouldComponentUpdate(s){return s.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(s),!0}render(){var s,t;const{imgIndex:e,imgList:i,pageForward:o,pageJump:r,pageBackward:l}=this.props,{result:n,valid:a,showText:d}=this.state;return u.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},d&&n.value&&u.createElement(g,{value:n.value,toolColor:(t=(s=this.getColor(this.config))==null?void 0:s.valid)==null?void 0:t.fill,configList:this.config.configList,hasPromptLayer:!!this.props.drawLayerSlot}),u.createElement(v,{imgIndex:e,imgList:i,pageBackward:l,pageForward:o,pageJump:r,valid:a,setVideoRef:p=>{this.videoPlayer=p},drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer,dataLoaded:this.props.onVideoLoaded}))}}export{c as VideoTextTool};
@@ -1 +1 @@
1
- import e,{useContext as $,useMemo as h}from"react";import{getClassName as l}from"../../../../utils/dom.js";import{CaretUpOutlined as b,CaretDownOutlined as j,PauseOutlined as H,CaretRightOutlined as R}from"@ant-design/icons";import{VideoPlayerCtx as d}from"../../index.js";import{Pagination as S}from"../../../../views/MainView/toolFooter/Pagination.js";import F from"../../../../assets/annotation/video/icon_keyboard_h.svg.js";import K from"../../../../views/MainView/toolFooter/FooterTips/ToolHotKey/index.js";import{useTranslation as f}from"react-i18next";import{decimalReserved as g}from"../../utils.js";import{cTool as O}from"@labelbee/lb-annotation";import A from"../../../videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.js";import{VideoClipToolContext as B}from"../../../videoAnnotate/videoClipTool/VideoClipToolContext.js";const{EVideoToolName:I}=O,C=t=>{const o=Math.floor(t/60),n=~~(t%60).toFixed(),i=(t*10).toString().split("").pop(),r=a=>a<10?`0${a}`:a;return`${r(o)}:${r(n)}:${i}`};var E;(function(t){t[t.Video=0]="Video",t[t.Audio=1]="Audio"})(E||(E={}));const M=()=>{const{currentTime:t,duration:o,buffered:n,setCurrentTime:i}=e.useContext(d),r=e.useRef(null),a=h(()=>`${g(n/o*100,1)}%`,[n,o]),c=h(()=>`${g(t/o*100,1)}%`,[t,o]),u=s=>{if(r.current){const p=s.clientX,v=r.current.clientWidth,m=g(p/v*o,1);i(m)}};return e.createElement("div",{className:l("video-progress"),ref:r,onClick:s=>{s.stopPropagation(),s.nativeEvent.stopImmediatePropagation(),u(s)}},e.createElement("div",{className:l("video-slider")},e.createElement("div",{className:l("video-slider","played"),style:{width:c}}),e.createElement("div",{className:l("video-slider","loaded"),style:{width:a}}),e.createElement("div",{className:l("video-slider","played"),style:{width:c}})),e.createElement("div",{className:l("video-slider-bar"),style:{left:c}}))},_=()=>{const{updateNextPlaybackRate:t,playbackRate:o}=e.useContext(d),{t:n}=f();return e.createElement("span",{className:l("video-controller","speed")},e.createElement("span",null,n("Speed")),e.createElement("span",{className:l("video-controller","speedNum")},`${o}x`),e.createElement("span",{className:l("video-controller","speedButton")},e.createElement(b,{onClick:()=>{t()}}),e.createElement(j,{onClick:()=>{t(!1)}})))},L=()=>{const{t}=f();return e.createElement(K,{title:e.createElement("span",{className:l("video-controller","hotkey")},e.createElement("img",{src:F}),t("Hotkeys")),style:{},toolName:I.VideoTagTool})},X=()=>{const{imgIndex:t,imgList:o,pageBackward:n,pageJump:i,pageForward:r}=e.useContext(d);return e.createElement(S,{isVideo:!0,pageBackward:n,imgIndex:t,pageJump:i,totalPage:o.length,pageForward:r,footerCls:l("video-controller")})},z=()=>{const{currentTime:t,duration:o}=e.useContext(d),n=o*10-t*10,i=(n>0?n:0)/10;return e.createElement("div",{className:l("video-controller","time")},`${C(t)} / -${C(i)}`)},D=t=>{const{playPause:o,isPlay:n}=t;return e.createElement("span",{onClick:()=>{o()},className:l("video-controller","playButton")},n?e.createElement(H,null):e.createElement(R,null))},J=t=>{var o,n;const{footer:i}=t,{playPause:r,isPlay:a,addTime:c,toggleClipStatus:u}=e.useContext(d),{result:s}=$(B),p=(n=(o=s==null?void 0:s.filter(w=>w.end!==null))==null?void 0:o.length)!=null?n:0,{t:v}=f(),m=e.createElement(M,null),y=e.createElement(D,{playPause:r,isPlay:a}),T=e.createElement(z,null),x=e.createElement(_,null),N=e.createElement(X,null),P=e.createElement(L,null),k=e.createElement(A,{addTime:c,toggleClipStatus:u}),V=e.createElement("span",{style:{margin:"0px 8px",fontSize:12}},`${v("ItemsOfThisPage")}: ${p}`);return i?typeof i=="function"?i({videoProgress:m,videoPlayIcon:y,videoTime:T,videoSpeed:x,videoPageChange:N,videoHotKeys:P,videoClipHotKey:k,videoResultCount:V}):i:e.createElement("div",{className:l("video-controller","wrapper")},m,e.createElement("div",{className:l("video-controller")},y,T,x,e.createElement("div",{className:l("video-controller","holder")}),V,N,P))};export{E as EPlayerType,J as default,C as videoTimeFormat};
1
+ import e,{useContext as $,useMemo as w}from"react";import{getClassName as l}from"../../../../utils/dom.js";import{CaretUpOutlined as b,CaretDownOutlined as j,PauseOutlined as H,CaretRightOutlined as R}from"@ant-design/icons";import{VideoPlayerCtx as d}from"../../index.js";import{Pagination as S}from"../../../../views/MainView/toolFooter/Pagination.js";import M from"../../../../assets/annotation/video/icon_keyboard_h.svg.js";import F from"../../../../views/MainView/toolFooter/FooterTips/ToolHotKey/index.js";import{useTranslation as f}from"react-i18next";import{decimalReserved as g}from"../../utils.js";import{cTool as K}from"@labelbee/lb-annotation";import O from"../../../videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.js";import{VideoClipToolContext as A}from"../../../videoAnnotate/videoClipTool/VideoClipToolContext.js";const{EVideoToolName:B}=K,C=t=>{const o=Math.floor(t/60),n=~~Math.floor(t%60),r=(t*10).toString().split("").pop(),i=a=>a<10?`0${a}`:a;return`${i(o)}:${i(n)}:${r}`};var E;(function(t){t[t.Video=0]="Video",t[t.Audio=1]="Audio"})(E||(E={}));const I=()=>{const{currentTime:t,duration:o,buffered:n,setCurrentTime:r}=e.useContext(d),i=e.useRef(null),a=w(()=>`${g(n/o*100,1)}%`,[n,o]),c=w(()=>`${g(t/o*100,1)}%`,[t,o]),u=s=>{if(i.current){const p=s.clientX,v=i.current.clientWidth,m=g(p/v*o,1);r(m)}};return e.createElement("div",{className:l("video-progress"),ref:i,onMouseUp:s=>{s.stopPropagation(),s.nativeEvent.stopImmediatePropagation(),u(s)}},e.createElement("div",{className:l("video-slider")},e.createElement("div",{className:l("video-slider","played"),style:{width:c}}),e.createElement("div",{className:l("video-slider","loaded"),style:{width:a}}),e.createElement("div",{className:l("video-slider","played"),style:{width:c}})),e.createElement("div",{className:l("video-slider-bar"),style:{left:c}}))},_=()=>{const{updateNextPlaybackRate:t,playbackRate:o}=e.useContext(d),{t:n}=f();return e.createElement("span",{className:l("video-controller","speed")},e.createElement("span",null,n("Speed")),e.createElement("span",{className:l("video-controller","speedNum")},`${o}x`),e.createElement("span",{className:l("video-controller","speedButton")},e.createElement(b,{onClick:()=>{t()}}),e.createElement(j,{onClick:()=>{t(!1)}})))},L=()=>{const{t}=f();return e.createElement(F,{title:e.createElement("span",{className:l("video-controller","hotkey")},e.createElement("img",{src:M}),t("Hotkeys")),style:{},toolName:B.VideoTagTool})},U=()=>{const{imgIndex:t,imgList:o,pageBackward:n,pageJump:r,pageForward:i}=e.useContext(d);return e.createElement(S,{isVideo:!0,pageBackward:n,imgIndex:t,pageJump:r,totalPage:o.length,pageForward:i,footerCls:l("video-controller")})},X=()=>{const{currentTime:t,duration:o}=e.useContext(d),n=o*10-t*10,r=(n>0?n:0)/10;return e.createElement("div",{className:l("video-controller","time")},`${C(t)} / -${C(r)}`)},z=t=>{const{playPause:o,isPlay:n}=t;return e.createElement("span",{onClick:()=>{o()},className:l("video-controller","playButton")},n?e.createElement(H,null):e.createElement(R,null))},D=t=>{var o,n;const{footer:r}=t,{playPause:i,isPlay:a,addTime:c,toggleClipStatus:u}=e.useContext(d),{result:s}=$(A),p=(n=(o=s==null?void 0:s.filter(k=>k.end!==null))==null?void 0:o.length)!=null?n:0,{t:v}=f(),m=e.createElement(I,null),y=e.createElement(z,{playPause:i,isPlay:a}),T=e.createElement(X,null),x=e.createElement(_,null),N=e.createElement(U,null),P=e.createElement(L,null),V=e.createElement(O,{addTime:c,toggleClipStatus:u}),h=e.createElement("span",{style:{margin:"0px 8px",fontSize:12}},`${v("ItemsOfThisPage")}: ${p}`);return r?typeof r=="function"?r({videoProgress:m,videoPlayIcon:y,videoTime:T,videoSpeed:x,videoPageChange:N,videoHotKeys:P,videoClipHotKey:V,videoResultCount:h}):r:e.createElement("div",{className:l("video-controller","wrapper")},m,e.createElement("div",{className:l("video-controller")},y,T,x,V,e.createElement("div",{className:l("video-controller","holder")}),h,N,P))};export{E as EPlayerType,D as default,C as videoTimeFormat};
@@ -1 +1 @@
1
- import o from"react";import A from"./components/controller/index.js";import j from"../videoAnnotate/videoClipTool/components/videoTrack/index.js";import{getClassName as l}from"../../utils/dom.js";import{cKeyCode as M}from"@labelbee/lb-annotation";import{decimalReserved as d}from"./utils.js";import z from"../fileException/index.js";const s=M.default,c=o.createContext({isPlay:!1,playPause:()=>{},updateNextPlaybackRate:()=>{},playbackRate:1,currentTime:0,duration:0,buffered:0,setCurrentTime:()=>{},imgList:[],imgIndex:-1,pageBackward:()=>{},pageJump:f=>{},pageForward:()=>{},addTime:()=>{},toggleClipStatus:()=>{}}),U=50,p=.1,n=[.5,1,1.5,2,4,6,8,16];class v extends o.Component{constructor(a){super(a);this.changePlaybackPate=e=>{this.videoElm&&(this.videoElm.playbackRate=e,this.setState({playbackRate:e}))},this.playPause=()=>{var e,t,i;((e=this.videoElm)==null?void 0:e.paused)?(t=this.videoElm)==null||t.play():(i=this.videoElm)==null||i.pause()},this.updateNextPlaybackRate=(e=!0)=>{const t=n.findIndex(r=>r===this.state.playbackRate);let i=e?Math.min(t+1,n.length-1):Math.max(t-1,0);this.changePlaybackPate(n[i])},this.fastForward=()=>{this.videoElm&&this.setCurrentTime(this.videoElm.currentTime+p)},this.rewind=()=>{this.videoElm&&this.setCurrentTime(this.videoElm.currentTime-p)},this.keydown=e=>{e.keyCode===s.Space&&(e.preventDefault(),this.playPause()),e.keyCode===s.Up&&(e.preventDefault(),this.updateNextPlaybackRate()),e.keyCode===s.Down&&(e.preventDefault(),this.updateNextPlaybackRate(!1)),e.keyCode===s.Left&&(e.preventDefault(),this.rewind()),e.keyCode===s.Right&&(e.preventDefault(),this.fastForward())},this.onPlay=()=>{this.setState({isPlay:!0},this.onVideoStart)},this.onPause=()=>{this.onVideoStopped()},this.onTimeUpdate=()=>{var e;this.videoElm&&this.setState({currentTime:d((e=this.videoElm)==null?void 0:e.currentTime,1)})},this.onVideoStopped=()=>{this.setState({isPlay:!1}),this.timeInterval&&(clearInterval(this.timeInterval),this.timeInterval=void 0),this.videoElm&&this.setCurrentTime(this.videoElm.currentTime)},this.onVideoStart=()=>{this.timeInterval=window.setInterval(()=>{var e,t,i;if(this.videoElm)try{if(((e=this.videoElm)==null?void 0:e.buffered.length)>0){const r=(t=this.videoElm)==null?void 0:t.buffered.end(0);this.setState({currentTime:d((i=this.videoElm)==null?void 0:i.currentTime,1),buffered:r})}}catch(r){console.error(r)}},U)},this.resetVideoData=()=>{this.setState({currentTime:0,buffered:0,error:!1,isPlay:!1}),this.videoElm&&(this.videoElm.playbackRate=this.state.playbackRate),this.onVideoStopped()},this.setDuration=()=>{var e,t,i;if(this.videoElm){const r=d((e=this.videoElm)==null?void 0:e.duration,1);(i=(t=this.props).dataLoaded)==null||i.call(t,r),this.setState({duration:r})}},this.setCurrentTime=e=>{this.videoElm&&(this.videoElm.currentTime=e,this.setState({currentTime:e}))},this.reload=()=>{var e;(e=this.videoElm)==null||e.load()},this.onError=()=>{this.resetVideoData(),this.setState({error:!0})},this.state={playbackRate:1,currentTime:0,isPlay:!1,duration:0,buffered:0,error:!1},this.videoRef=o.createRef()}get videoElm(){var a;return(a=this.videoRef)==null?void 0:a.current}get videoSrc(){var a,e;const{imgIndex:t,imgList:i}=this.props;return t>-1&&(e=(a=i[t])==null?void 0:a.url)!=null?e:""}componentDidMount(){var a,e;window.addEventListener("keydown",this.keydown),((a=this.videoRef)==null?void 0:a.current)&&this.props.setVideoRef&&this.props.setVideoRef((e=this.videoRef)==null?void 0:e.current)}componentWillUnmount(){window.removeEventListener("keydown",this.keydown)}render(){const{isPlay:a,playbackRate:e,currentTime:t,duration:i,buffered:r,error:E}=this.state,{imgList:y,imgIndex:k,pageBackward:g,pageJump:T,pageForward:R,valid:P,footer:b,drawLayerSlot:h}=this.props,C=isNaN(i)?0:Math.max(d(i,1)-t,0),{playPause:m,updateNextPlaybackRate:w,onPause:x,onPlay:S,onTimeUpdate:_,resetVideoData:V,setDuration:D,setCurrentTime:I,onError:N,videoRef:L,videoSrc:F}=this;return o.createElement(c.Provider,{value:{videoRef:this.videoRef,addTime:this.props.addTime,toggleClipStatus:this.props.toggleClipStatus,isPlay:a,playPause:m,updateNextPlaybackRate:w,playbackRate:e,currentTime:t,duration:i,buffered:r,setCurrentTime:I,imgIndex:k,imgList:y,pageBackward:g,pageJump:T,pageForward:R}},o.createElement(o.Fragment,null,h==null?void 0:h({currentTime:t,remainingTime:C,zoom:1,currentPos:{x:0,y:0}}),o.createElement("div",{className:l("video-wrapper")},o.createElement("div",{className:l("video-container")},o.createElement("video",{ref:L,className:l(this.props.showVideoTrack?"video-track":"video"),src:F,onPause:x,onPlay:S,onTimeUpdate:_,onLoadedMetadata:V,onError:N,onDurationChange:D,width:"100%",height:"100%",onClick:m}),this.props.showVideoTrack&&o.createElement(j,{currentTime:t,onTrackResize:this.props.onTrackResize,onTrackResizeStart:()=>{var u;(u=this.videoElm)==null||u.pause()},readonly:!1}),o.createElement(z,{fileType:"video",errorProps:{reloadImage:this.reload,backgroundColor:"#e2e2e2",ignoreOffsetY:!0,isError:E},invalidProps:{isValid:P}})),o.createElement(A,{footer:b}))))}}export{v as VideoPlayer,c as VideoPlayerCtx,v as default};
1
+ import o from"react";import A from"./components/controller/index.js";import j from"../videoAnnotate/videoClipTool/components/videoTrack/index.js";import{getClassName as l}from"../../utils/dom.js";import{cKeyCode as M}from"@labelbee/lb-annotation";import{decimalReserved as d}from"./utils.js";import z from"../fileException/index.js";const s=M.default,c=o.createContext({isPlay:!1,playPause:()=>{},updateNextPlaybackRate:()=>{},playbackRate:1,currentTime:0,duration:0,buffered:0,setCurrentTime:()=>{},imgList:[],imgIndex:-1,pageBackward:()=>{},pageJump:f=>{},pageForward:()=>{},addTime:()=>{},toggleClipStatus:()=>{}}),U=50,p=.1,n=[.5,1,1.5,2,4,6,8,16];class v extends o.Component{constructor(a){super(a);this.changePlaybackPate=e=>{this.videoElm&&(this.videoElm.playbackRate=e,this.setState({playbackRate:e}))},this.playPause=()=>{var e,t,i;((e=this.videoElm)==null?void 0:e.paused)?(t=this.videoElm)==null||t.play():(i=this.videoElm)==null||i.pause()},this.updateNextPlaybackRate=(e=!0)=>{const t=n.findIndex(r=>r===this.state.playbackRate);let i=e?Math.min(t+1,n.length-1):Math.max(t-1,0);this.changePlaybackPate(n[i])},this.fastForward=()=>{this.videoElm&&this.setCurrentTime(this.videoElm.currentTime+p)},this.rewind=()=>{this.videoElm&&this.setCurrentTime(this.videoElm.currentTime-p)},this.keydown=e=>{e.keyCode===s.Space&&(e.preventDefault(),this.playPause()),e.keyCode===s.Up&&(e.preventDefault(),this.updateNextPlaybackRate()),e.keyCode===s.Down&&(e.preventDefault(),this.updateNextPlaybackRate(!1)),e.keyCode===s.Left&&(e.preventDefault(),this.rewind()),e.keyCode===s.Right&&(e.preventDefault(),this.fastForward())},this.onPlay=()=>{this.setState({isPlay:!0},this.onVideoStart)},this.onPause=()=>{this.onVideoStopped()},this.onTimeUpdate=()=>{var e;this.videoElm&&this.setState({currentTime:d((e=this.videoElm)==null?void 0:e.currentTime,1)})},this.onVideoStopped=()=>{this.setState({isPlay:!1}),this.timeInterval&&(clearInterval(this.timeInterval),this.timeInterval=void 0),this.videoElm&&this.setCurrentTime(this.videoElm.currentTime)},this.onVideoStart=()=>{this.timeInterval=window.setInterval(()=>{var e,t,i;if(this.videoElm)try{if(((e=this.videoElm)==null?void 0:e.buffered.length)>0){const r=(t=this.videoElm)==null?void 0:t.buffered.end(0);this.setState({currentTime:d((i=this.videoElm)==null?void 0:i.currentTime,1),buffered:r})}}catch(r){console.error(r)}},U)},this.resetVideoData=()=>{this.setState({currentTime:0,buffered:0,error:!1,isPlay:!1}),this.videoElm&&(this.videoElm.playbackRate=this.state.playbackRate),this.onVideoStopped()},this.setDuration=()=>{var e,t,i;if(this.videoElm){const r=d((e=this.videoElm)==null?void 0:e.duration,1);(i=(t=this.props).dataLoaded)==null||i.call(t),this.setState({duration:r})}},this.setCurrentTime=e=>{var t,i;this.videoElm&&(this.videoElm.currentTime=e,this.setState({currentTime:e}),(i=(t=this.props).updateCurrentTime)==null||i.call(t,e))},this.reload=()=>{var e;(e=this.videoElm)==null||e.load()},this.onError=()=>{this.resetVideoData(),this.setState({error:!0})},this.state={playbackRate:1,currentTime:0,isPlay:!1,duration:0,buffered:0,error:!1},this.videoRef=o.createRef()}get videoElm(){var a;return(a=this.videoRef)==null?void 0:a.current}get videoSrc(){var a,e;const{imgIndex:t,imgList:i}=this.props;return t>-1&&(e=(a=i[t])==null?void 0:a.url)!=null?e:""}componentDidMount(){var a,e;window.addEventListener("keydown",this.keydown),((a=this.videoRef)==null?void 0:a.current)&&this.props.setVideoRef&&this.props.setVideoRef((e=this.videoRef)==null?void 0:e.current)}componentWillUnmount(){window.removeEventListener("keydown",this.keydown)}render(){const{isPlay:a,playbackRate:e,currentTime:t,duration:i,buffered:r,error:E}=this.state,{imgList:y,imgIndex:k,pageBackward:g,pageJump:T,pageForward:R,valid:P,footer:b,drawLayerSlot:h}=this.props,C=isNaN(i)?0:Math.max(d(i,1)-t,0),{playPause:m,updateNextPlaybackRate:w,onPause:x,onPlay:S,onTimeUpdate:_,resetVideoData:V,setDuration:D,setCurrentTime:I,onError:N,videoRef:L,videoSrc:F}=this;return o.createElement(c.Provider,{value:{videoRef:this.videoRef,addTime:this.props.addTime,toggleClipStatus:this.props.toggleClipStatus,isPlay:a,playPause:m,updateNextPlaybackRate:w,playbackRate:e,currentTime:t,duration:i,buffered:r,setCurrentTime:I,imgIndex:k,imgList:y,pageBackward:g,pageJump:T,pageForward:R}},o.createElement(o.Fragment,null,h==null?void 0:h({currentTime:t,remainingTime:C,zoom:1,currentPos:{x:0,y:0}}),o.createElement("div",{className:l("video-wrapper")},o.createElement("div",{className:l("video-container")},o.createElement("video",{ref:L,className:l(this.props.showVideoTrack?"video-track":"video"),src:F,onPause:x,onPlay:S,onTimeUpdate:_,onLoadedMetadata:V,onError:N,onDurationChange:D,width:"100%",height:"100%",onClick:m}),this.props.showVideoTrack&&o.createElement(j,{currentTime:t,onTrackResize:this.props.onTrackResize,onTrackResizeStart:()=>{var u;(u=this.videoElm)==null||u.pause()},readonly:!1}),o.createElement(z,{fileType:"video",errorProps:{reloadImage:this.reload,backgroundColor:"#e2e2e2",ignoreOffsetY:!0,isError:E},invalidProps:{isValid:P}})),o.createElement(A,{footer:b}))))}}export{v as VideoPlayer,c as VideoPlayerCtx,v as default};
package/es/index.css CHANGED
@@ -337,26 +337,25 @@
337
337
  position: absolute;
338
338
  top: 0;
339
339
  right: 0;
340
- max-height: calc(100% - 80px - 90px - 24px);
340
+ max-width: 416px;
341
+ max-height: 80%;
341
342
  padding-right: 4px;
342
343
  overflow: auto;
343
344
  z-index: 22;
344
345
  }
345
346
 
346
347
  .index-module_timeSliceWrapper__kebC3 {
347
- height: 80px;
348
+ min-height: 80px;
348
349
  margin-bottom: 8px;
349
350
  transition: opacity 0.4s ease-in-out;
350
- opacity: 0.3;
351
- }
352
- .index-module_timeSliceWrapper__kebC3.index-module_active__cIGVq {
353
- opacity: 1;
351
+ opacity: 0.9;
354
352
  }
355
353
  .index-module_timeSliceWrapper__kebC3 .index-module_timeSliceItemText__FJFwH,
356
354
  .index-module_timeSliceWrapper__kebC3 .index-module_timeSliceItemAttribute__--3E1 {
357
- height: 40px;
355
+ min-height: 40px;
358
356
  font-size: 16px;
359
357
  color: white;
358
+ word-break: break-all;
360
359
  }
361
360
  .index-module_timeSliceWrapper__kebC3 .index-module_timeSliceItemText__FJFwH {
362
361
  background-color: #CCC;
@@ -1964,7 +1963,7 @@
1964
1963
 
1965
1964
  .textInputContainer {
1966
1965
  padding: 20px;
1967
- height: 100%;
1966
+ height: auto;
1968
1967
  overflow-y: scroll;
1969
1968
  }
1970
1969
 
@@ -2827,7 +2826,7 @@
2827
2826
  margin-bottom: 24px;
2828
2827
  width: 100%;
2829
2828
  }
2830
- .bee-LLMView__tag {
2829
+ .bee-LLMView .bee-LLMView-tag {
2831
2830
  color: #666FFF;
2832
2831
  background: #eeefff;
2833
2832
  height: 20px;
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 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
+ 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 x from"./App.js";import w from"./configureStore.js";import{PageBackward as g,PageForward as v,PageJump as P}from"./store/annotation/actionCreators.js";export{VideoTagTool}from"./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js";import{PointCloudProvider as _}from"./components/pointCloudView/PointCloudContext.js";import{LabelBeeContext as j}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{default as MeasureCanvas}from"./components/measureCanvas/index.js";export{EDataFormatType,ELLMDataType,EStepType,ESubmitType,componentCls,prefix}from"./constant/index.js";var T=Object.defineProperty,V=Object.defineProperties,b=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,C=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,p=(o,e,t)=>e in o?T(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,O=(o,e)=>{for(var t in e||(e={}))C.call(e,t)&&p(o,t,e[t]);if(s)for(var t of s(e))I.call(e,t)&&p(o,t,e[t]);return o},A=(o,e)=>V(o,b(e));const r=w(),E=(o,e)=>{const[t,l]=d();return m(e,()=>({toolInstance:t,annotationEngine:r.getState().annotation.annotationEngine,pageBackwardActions:()=>r.dispatch(g()),pageForwardActions:()=>r.dispatch(v()),pageJump:a=>{const i=~~a-1;r.dispatch(P(i))},hello:()=>alert("hello labelBee!!!")}),[t]),n.createElement(u,{store:r,context:j},n.createElement(f,{i18n:c},n.createElement(_,null,n.createElement(x,A(O({},o),{setToolInstance:a=>{var i;l(a),(i=o.onLoad)==null||i.call(o,{toolInstance:a})}})))))};var y=n.forwardRef(E);export{y as default,r as store};
@@ -1 +1 @@
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};
1
+ import{getFormatSize as St}from"../../components/customResizeHook/index.js";import{ESubmitType as K}from"../../constant/index.js";import Dt from"../../constant/styleString.js";import{ANNOTATION_ACTIONS as l}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,Ot=Object.defineProperties,ht=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},i=(t,e)=>Ot(t,ht(e)),mt=(t,e,r)=>new Promise((E,d)=>{var f=m=>{try{S(r.next(m))}catch(y){d(y)}},A=m=>{try{S(r.throw(m))}catch(y){d(y)}},S=m=>m.done?E(m.value):Promise.resolve(m.value).then(f,A);S((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 A=document.getElementById("toolContainer");if(!A)throw"Not exist dom named id-toolContainer";const S=St({width:window.innerWidth,height:window.innerHeight}),m=new Rt({container:A,toolName:d.tool,size:S,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:A}=E().annotation,S=N.currentToolIsVideo(A,f),m=N.currentToolIsPointCloud(A,f),y=((d=N.getCurrentStepInfo(A,f))==null?void 0:d.tool)===_t.LLM,O=N.currentToolIsAudio(A,f);if($(r,!0),yield r(xt(t)),S){r(Ft(t));return}if(m||y||O){r(jt(t));return}r(Gt(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:l.SET_FILE_DATA,payload:{fileData:f,index:t}})}}),Ft=t=>e=>{e({type:l.LOAD_FILE_DATA,payload:{nextIndex:t}})},jt=t=>e=>{$(e,!1),e({type:l.LOAD_FILE_DATA,payload:{nextIndex:t}})},Gt=(t,e)=>(r,E)=>{var d;const{toolInstance:f,imgList:A}=E().annotation,S=(d=A==null?void 0:A[t])==null?void 0:d.url;Pt.load(S).then(m=>{$(r,!1),r({type:l.LOAD_FILE_DATA,payload:{imgNode:m,nextIndex:t,nextBasicIndex:e}})}).catch(()=>{$(r,!1),f==null||f.setErrorImg(),r({type:l.LOAD_FILE_DATA,payload:{nextIndex:t,nextBasicIndex:e}})})},Vt=({toolInstance:t,imgList:e,imgIndex:r,stepList:E,step:d=1})=>{var f,A,S,m;const y=((f=e[r])==null?void 0:f.result)||"",[O,j,G]=(A=t==null?void 0:t.exportData())!=null?A:[],V=(m=(S=t==null?void 0:t.exportCustomData)==null?void 0:S.call(t))!=null?m:{},M=rt(y,j),k=Y(M,{step:d,stepList:E},{rect:O},V);return e.map((w,H)=>H===r?n(i(n({},w),{result:k}),G):n({},w))},Mt=(t=n({},ft),e)=>{var r,E,d,f,A,S,m,y,O,j,G,V,M,k,w,H,X,q,Z,Q,tt,et,ot,nt,st;switch(e.type){case l.INIT_ALL_STATE:return n(n({},t),ft);case l.UPDATE_TOOL_INSTANCE:return i(n({},t),{toolInstance:e.payload.toolInstance});case l.UPDATE_IMG_LIST:return i(n({},t),{imgList:e.payload.imgList});case l.CALC_STEP_PROGRESS:{const{imgList:o,step:s}=t,u=Tt(o,s);return i(n({},t),{stepProgress:u})}case l.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(i(n({},C),{result:x}),I)}return C});if(((A=e.payload)==null?void 0:A.submitType)===K.SyncImgList)return i(n({},t),{imgList:v});c&&c([v[s]],(S=e.payload)==null?void 0:S.submitType,s,v);const h=Tt(v,u);return i(n({},t),{stepProgress:h,imgList:v})}case l.SAVE_RESULT:{const{imgList:o,imgIndex:s,onSave:u}=t;return u==null||u(o[s],s,o),n({},t)}case l.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=>i(n({},I),{sourceID:g}));T=pt.cloneDeep(u).filter(I=>I.sourceID!==g),T.push(..._)}return i(n({},t),{resultList:T,imgList:o})}case l.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=(O=g[_])==null?void 0:O.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:h}=R,C=B(p,v);let P=[];return v&&h&&(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),i(n({},t),{basicIndex:_})}case l.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:o}=e.payload;return i(n({},t),{triggerEventAfterIndexChanged:!!o})}case l.LOAD_FILE_DATA:{const{imgList:o,step:s,toolInstance:u,annotationEngine:a,stepList:p}=t;if(!u)return i(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,h={rotate:(M=D.rotate)!=null?M:0,valid:(k=D.valid)!=null?k:!0};g&&I!==!0?a==null||a.setImgNode(g,h):u==null||u.setValid(h.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(At=>yt.isSameSourceID(At.sourceID,Lt)):z;(Z=u==null?void 0:u.history)==null||Z.initRecord(z,!0),u==null||u.setResult(Et)}return i(n({},t),{imgIndex:T,basicIndex:L,basicResultList:b,resultList:z})}case l.UPDATE_ANNOTATION_CONFIG:return i(n({},t),{config:(Q=e.payload.config)!=null?Q:"{}"});case l.SET_TASK_STEP_LIST:{const{stepList:o}=e.payload;return i(n({},t),{stepList:o})}case l.SET_TASK_CONFIG:{const{stepList:o,step:s}=e.payload;return i(n({},t),{stepList:o,step:s})}case l.INIT_TOOL:{const{imgNode:o}=t,s=Bt(t,o);if(s){const{toolInstance:u,annotationEngine:a}=s;return i(n({},t),{toolInstance:u,annotationEngine:a})}return n({},t)}case l.SET_TOOL:{const o=(tt=e.payload)==null?void 0:tt.instance;return o?i(n({},t),{toolInstance:o}):n({},t)}case l.UPDATE_ON_SUBMIT:return i(n({},t),{onSubmit:e.payload.onSubmit});case l.UPDATE_ON_SAVE:return i(n({},t),{onSave:e.payload.onSave});case l.UPDATE_ON_PAGE_CHANGE:return i(n({},t),{onPageChange:e.payload.onPageChange});case l.SET_PREDICT_RESULT:return i(n({},t),{predictionResult:e.payload.result});case l.SET_PREDICT_RESULT_VISIBLE:return i(n({},t),{predictionResultVisible:e.payload.visible});case l.UPDATE_ON_STEP_CHANGE:return i(n({},t),{onStepChange:e.payload.onStepChange});case l.UPDATE_GET_FILE_DATA:return i(n({},t),{getFileData:e.payload.getFileData});case l.UPDATE_PAGE_SIZE:return i(n({},t),{pageSize:e.payload.pageSize});case l.UPDATE_LOAD_FILE_LIST:return i(n({},t),{loadFileList:e.payload.loadFileList});case l.UPDATE_BEFORE_ROTATE:return i(n({},t),{beforeRotate:e.payload.beforeRotate});case l.UPDATE_PRE_DATA_PROCESS:return i(n({},t),{preDataProcess:e.payload.preDataProcess});case l.SKIP_BEFORE_PAGE_TURNING:return i(n({},t),{skipBeforePageTurning:e.payload.skipBeforePageTurning});case l.SET_FILE_DATA:{const{fileData:o,index:s}=e.payload,{imgList:u}=t,a=[...u];return a[s]=n(n({},a[s]),o),i(n({},t),{imgList:a})}case l.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 l.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 l.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]=i(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]),i(n({},t),{imgList:[...u]})}case l.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),i(n({},t),{step:u,toolInstance:s==null?void 0:s.toolInstance})}case l.SET_LOADPCDFILE_LOADING:{const{loadPCDFileLoading:o}=e.payload;return i(n({},t),{loadPCDFileLoading:!!o})}case l.SET_LOADING:{const{loading:o}=e.payload;return i(n({},t),{loading:!!o})}case l.SET_POINT_CLOUD_LOADING:{const{pointCloudLoading:o}=e.payload;return i(n({},t),{pointCloudLoading:!!o})}case l.SET_CHECK_MODE:{const{checkMode:o}=e.payload;return i(n({},t),{checkMode:!!o})}case l.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:o}=e.payload;return i(n({},t),{highlightAttribute:o})}case l.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=i(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}),i(n({},t),{imgList:g})}case l.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=i(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}),i(n({},t),{imgList:g})}case l.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=i(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}),i(n({},t),{imgList:_})}default:return t}};export{wt as LoadFileAndFileData,Mt as annotationReducer,Vt as composeResultByToolInstance,B as getStepConfig,Nt as getTotalPage};
@@ -1 +1 @@
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
+ import{ViewportProvider as S}from"../../components/customResizeHook/index.js";import{prefix as b}from"../../constant/index.js";import{Spin as C}from"antd";import{Layout as v}from"antd/es";import t,{useState as A}from"react";import O from"./annotationOperation/index.js";import V from"./annotationTips/index.js";import M 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 z}from"@ant-design/icons";import{useTranslation as q}from"react-i18next";import{EPointCloudName as G}from"@labelbee/lb-annotation";var J=Object.defineProperty,T=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,x=(e,o,n)=>o in e?J(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,a=(e,o)=>{for(var n in o||(o={}))K.call(o,n)&&x(e,n,o[n]);if(T)for(var n of T(o))Q.call(o,n)&&x(e,n,o[n]);return e};const{Sider:X,Content:Y}=v,c=`${b}-layout`,Z=e=>{var o;return t.createElement(t.Fragment,null,e.showTips===!0&&t.createElement(V,{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}))},p=e=>{var o;return t.createElement(t.Fragment,null,t.createElement($,{drawLayerSlot:e.drawLayerSlot,checkMode:e.checkMode,intelligentFit:e.intelligentFit,measureVisible:e.measureVisible}),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(p,a({},e)):l?t.createElement(F,{drawLayerSlot:e.drawLayerSlot,footer:e.footer}):t.createElement(Z,a({},e))},L=e=>{var o,n,i;const{t:r}=q(),{stepList:d,step:l}=e,m=(o=_(d,l))==null?void 0:o.tool,s=![E.LLM].includes(m),u=![E.LLM].includes(m),f=[G.PointCloud].includes(m);return t.createElement(S,null,t.createElement(C,{spinning:e.loading,indicator:t.createElement(z,null),tip:t.createElement("span",{style:{marginTop:200}},r("LoadingTips")),delay:500},t.createElement(v,{className:R([c,e.className]),style:(n=e.style)==null?void 0:n.layout},t.createElement("header",{className:`${c}__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:s,hasHeaderOption:u,hasPredictTrackingIcon:f})),e.children)))},te=e=>{var o,n,i,r,d,l,m;const[s,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(Y,{className:`${c}__content`},t.createElement(ee,a({},e)),t.createElement(W,null)),t.createElement(X,{className:`${c}__side`,width:(r=s!=null?s:f)!=null?r:240,style:(d=e.style)==null?void 0:d.sider},t.createElement(M,{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 o,{useState as a,useEffect as l}from"react";import{message as u}from"antd/es";import m from"../TextAreaFormat/index.js";import{TextUtils as x}from"../../../../utils/TextUtils.js";import{connect as c}from"react-redux";import{LabelBeeContext as s}from"../../../../store/ctx.js";const f=({toolInstance:e})=>{var n;const[,i]=a(0);if(l(()=>{e&&(e.singleOn("selectedChange",()=>{i(r=>r+1)}),e.singleOn("updateTextAttribute",()=>{i(r=>r+1)}),e.singleOn("messageError",r=>{u.error(r)}))},[e]),!e)return null;const{config:t}=e;return o.createElement("div",null,((n=e==null?void 0:e.config)==null?void 0:n.textConfigurable)&&e.selectedID&&o.createElement(m,{onChange:e.textChange,textValue:e.selectedText,checkString:x.checkString(t==null?void 0:t.textCheckType,t==null?void 0:t.customFormat),textCheckType:t.textCheckType}))};function d(e){return{toolInstance:e.annotation.toolInstance}}var g=c(d,null,null,{context:s})(f);export{g as default};
1
+ import o,{useState as a,useEffect as u}from"react";import{message as m}from"antd/es";import x from"../TextAreaFormat/index.js";import{TextUtils as l}from"../../../../utils/TextUtils.js";import{connect as c}from"react-redux";import{LabelBeeContext as s}from"../../../../store/ctx.js";const f=({toolInstance:e})=>{var i;const[,n]=a(0);if(u(()=>{e&&(e.singleOn("selectedChange",()=>{n(r=>r+1)}),e.singleOn("updateTextAttribute",()=>{n(r=>r+1)}),e.singleOn("messageError",r=>{m.error(r)}))},[e]),!e)return null;const{config:t}=e;return((i=e==null?void 0:e.config)==null?void 0:i.textConfigurable)&&e.selectedID&&o.createElement(x,{onChange:e.textChange,textValue:e.selectedText,checkString:l.checkString(t==null?void 0:t.textCheckType,t==null?void 0:t.customFormat),textCheckType:t.textCheckType})};function d(e){return{toolInstance:e.annotation.toolInstance}}var g=c(d,null,null,{context:s})(f);export{g as default};
@@ -1 +1 @@
1
- import f,{useState as d,useRef as p,useEffect as v}from"react";import{connect as S}from"react-redux";import A from"../../../../components/attributeList/index.js";import g from"../../../../utils/StepUtils.js";import{jsonParser as I}from"../../../../utils/index.js";import{useTranslation as x}from"react-i18next";import{EToolName as L}from"../../../../data/enums/ToolType.js";import{LabelBeeContext as h}from"../../../../store/ctx.js";const T=t=>{var o;const[c,l]=d(0),i=p(null),{toolInstance:e}=t,{t:b}=x();if(v(()=>(e&&e.singleOn("changeAttributeSidebar",a=>{var s;l(n=>n+1),!!i.current&&((s=i.current.children[a])==null||s.scrollIntoView({block:"center"}))}),()=>{e==null||e.unbindAll("changeAttributeSidebar")}),[e,i]),!t.stepInfo)return null;const r=I(t.stepInfo.config),u=t.stepInfo.tool===L.ScribbleTool;if(r.attributeConfigurable!==!0&&!u)return null;if((r.attributeConfigurable===!0||u)&&(r==null?void 0:r.attributeList)){const a=r.attributeList.map(n=>({label:n.key,value:n.value,color:n==null?void 0:n.color}));u||a.unshift({label:b("NoAttribute"),value:""});const s=n=>{e.setDefaultAttribute(n),l(m=>m+1)};return f.createElement("div",null,f.createElement(A,{list:a,attributeChanged:s,selectedAttribute:(o=e==null?void 0:e.defaultAttribute)!=null?o:"",ref:i,forbidDefault:u}))}return null},j=t=>{var o,c;const l=g.getCurrentStepInfo((o=t.annotation)==null?void 0:o.step,(c=t.annotation)==null?void 0:c.stepList);return{toolInstance:t.annotation.toolInstance,stepInfo:l}};var C=S(j,null,null,{context:h})(T);export{C as default};
1
+ import m,{useState as d,useRef as p,useEffect as v}from"react";import{connect as S}from"react-redux";import A from"../../../../components/attributeList/index.js";import g from"../../../../utils/StepUtils.js";import{jsonParser as I}from"../../../../utils/index.js";import{useTranslation as x}from"react-i18next";import{EToolName as L}from"../../../../data/enums/ToolType.js";import{LabelBeeContext as h}from"../../../../store/ctx.js";const T=t=>{var o;const[c,i]=d(0),l=p(null),{toolInstance:e}=t,{t:f}=x();if(v(()=>(e&&e.singleOn("changeAttributeSidebar",a=>{var s;i(n=>n+1),!!l.current&&((s=l.current.children[a])==null||s.scrollIntoView({block:"center"}))}),()=>{e==null||e.unbindAll("changeAttributeSidebar")}),[e,l]),!t.stepInfo)return null;const r=I(t.stepInfo.config),u=t.stepInfo.tool===L.ScribbleTool;if(r.attributeConfigurable!==!0&&!u)return null;if((r.attributeConfigurable===!0||u)&&(r==null?void 0:r.attributeList)){const a=r.attributeList.map(n=>({label:n.key,value:n.value,color:n==null?void 0:n.color}));u||a.unshift({label:f("NoAttribute"),value:""});const s=n=>{e.setDefaultAttribute(n),i(b=>b+1)};return m.createElement(A,{list:a,attributeChanged:s,selectedAttribute:(o=e==null?void 0:e.defaultAttribute)!=null?o:"",ref:l,forbidDefault:u})}return null},j=t=>{var o,c;const i=g.getCurrentStepInfo((o=t.annotation)==null?void 0:o.step,(c=t.annotation)==null?void 0:c.stepList);return{toolInstance:t.annotation.toolInstance,stepInfo:i}};var C=S(j,null,null,{context:h})(T);export{C as default};
@@ -1 +1 @@
1
- import K from"../../../../components/attributeList/index.js";import M from"../../../../components/checkboxList/index.js";import{CaretRightOutlined as P}from"@ant-design/icons";import{Collapse as T,Tooltip as H,Badge as x}from"antd/es";import{cloneDeep as F}from"lodash";import n,{useState as p,useRef as U,useEffect as v,useCallback as q}from"react";import z from"../../../../assets/annotation/common/icon_clearSmall.svg.js";import G from"../../../../assets/annotation/common/icon_clearSmall_a.svg.js";import{TagUtils as J}from"@labelbee/lb-annotation";import{connect as Q}from"react-redux";import{useTranslation as V}from"react-i18next";import{LabelBeeContext as W}from"../../../../store/ctx.js";const{Panel:X}=T,$=({isActive:a})=>n.createElement(P,{rotate:a?90:0}),Y=({toolInstance:a,imgIndex:N})=>{const[o,g]=p([]),i=U(null),[,j]=p(0),[w,f]=p(-1),{t:b}=V();v(()=>{a&&(g(a.config.inputList.map(e=>e.value)),a.singleOn("render",()=>{j(e=>e+1)}))},[a]),v(()=>{if(a&&(a.singleOn("expend",O),a.labelSelectedList.length===1)){let e=0;for(let l=0;l<a.labelSelectedList[0];l++)e+=46,s[l]&&o[l]!==""&&s[l].subSelected.forEach(r=>{e+=40});i.current&&(i.current.children[0].scrollTop=e)}}),v(()=>{i.current&&(i.current.children[0].scrollTop=0)},[N]);const O=()=>{var e;const l=a.labelSelectedList[0],r=(e=s.filter((t,m)=>m===l)[0])==null?void 0:e.value;h(l,r,!0)},h=q((e,l,r)=>{const t=F(o);t[e]===""||r===!0?t[e]=l:t[e]="",g(t)},[o]);if(!a)return null;const{labelSelectedList:c,config:{inputList:s},currentTagResult:u,setLabel:E}=a,A=e=>c.length>0&&c[0]===e?n.createElement("span",{className:"keyDownIconActive"},e+1):n.createElement("span",{className:"keyDownIcon"},e+1),y=(e,l=-1)=>e?e.map((r,t)=>{var m,L,k,_,C;if(r.subSelected){const R=J.judgeResultIsInInputList(r.value,(m=u==null?void 0:u.result)==null?void 0:m[r.value],s);return n.createElement(T,{bordered:!1,expandIcon:$,key:`collapse_${t}_${l+1}`,onChange:()=>h(t,r.value),activeKey:[o[t]]},n.createElement(X,{header:n.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",flex:1}},n.createElement("span",null,r.key,n.createElement(H,{placement:"bottom",title:b("ClearThisOption")},n.createElement("img",{style:{marginLeft:5,cursor:"pointer"},onClick:D=>{D.stopPropagation(),a.clearResult(!0,r.value)},src:w===t||R?G:z,onMouseEnter:()=>{f(t)},onMouseLeave:()=>{f(-1)}})),R&&o[t]===""&&n.createElement(x,{color:"#87d068"})),(s==null?void 0:s.length)>1&&A(t)),key:r.value},n.createElement("div",{className:"level",style:{backgroundColor:c.length>0&&c[0]===t?"rgba(158, 158, 158, 0.18)":""}},y(r.subSelected,t))))}const d=(s==null?void 0:s[l])?s==null?void 0:s[l].value:0,S=((_=(k=(L=u==null?void 0:u.result)==null?void 0:L[d])==null?void 0:k.split(";"))==null?void 0:_.indexOf(r.value))>-1?r.value:"";return((C=s==null?void 0:s[l])==null?void 0:C.isMulti)===!0?n.createElement("div",{className:"singleBar",key:`${d}_${l}_${t}`},n.createElement(M,{attributeChanged:()=>E(l,t),selectedAttribute:[S],list:[{value:r.value,label:r.key}],num:t+1})):n.createElement("div",{className:"singleBar",key:`${d}_${l}_${t}`},n.createElement(K,{forbidColor:!0,attributeChanged:()=>E(l,t),selectedAttribute:S,list:[{value:r.value,label:r.key}],num:t+1}))}):null,B=window.innerHeight-61-80;return n.createElement("div",{className:"tagOperationMenu",ref:i},(s==null?void 0:s.length)===0?n.createElement("div",{style:{padding:20,textAlign:"center"}},b("NoConfiguration")):n.createElement("div",{className:"main",style:{height:B}},y(s)))};function Z(a){return{toolInstance:a.annotation.toolInstance,imgIndex:a.annotation.imgIndex}}var I=Q(Z,null,null,{context:W})(Y);export{I as default,$ as expandIconFuc};
1
+ import K from"../../../../components/attributeList/index.js";import M from"../../../../components/checkboxList/index.js";import{CaretRightOutlined as P}from"@ant-design/icons";import{Collapse as T,Tooltip as H,Badge as x}from"antd/es";import{cloneDeep as F}from"lodash";import n,{useState as v,useRef as U,useEffect as p,useCallback as q}from"react";import z from"../../../../assets/annotation/common/icon_clearSmall.svg.js";import G from"../../../../assets/annotation/common/icon_clearSmall_a.svg.js";import{TagUtils as J}from"@labelbee/lb-annotation";import{connect as Q}from"react-redux";import{useTranslation as V}from"react-i18next";import{LabelBeeContext as W}from"../../../../store/ctx.js";const{Panel:X}=T,$=({isActive:a})=>n.createElement(P,{rotate:a?90:0}),Y=({toolInstance:a,imgIndex:N})=>{const[s,g]=v([]),i=U(null),[,j]=v(0),[w,f]=v(-1),{t:b}=V();p(()=>{var r,t;a&&(g((t=(r=a.config)==null?void 0:r.inputList)==null?void 0:t.map(e=>e.value)),a.singleOn("render",()=>{j(e=>e+1)}))},[a]),p(()=>{if(a&&(a.singleOn("expend",O),a.labelSelectedList.length===1)){let r=0;for(let t=0;t<a.labelSelectedList[0];t++)r+=46,o[t]&&s[t]!==""&&o[t].subSelected.forEach(e=>{r+=40});i.current&&(i.current.children[0].scrollTop=r)}}),p(()=>{i.current&&(i.current.children[0].scrollTop=0)},[N]);const O=()=>{var r;const t=a.labelSelectedList[0],e=(r=o.filter((l,m)=>m===t)[0])==null?void 0:r.value;h(t,e,!0)},h=q((r,t,e)=>{const l=F(s);l[r]===""||e===!0?l[r]=t:l[r]="",g(l)},[s]);if(!a)return null;const{labelSelectedList:u,config:{inputList:o},currentTagResult:c,setLabel:E}=a,A=r=>u.length>0&&u[0]===r?n.createElement("span",{className:"keyDownIconActive"},r+1):n.createElement("span",{className:"keyDownIcon"},r+1),y=(r,t=-1)=>r?r.map((e,l)=>{var m,L,_,k,C;if(e.subSelected){const R=J.judgeResultIsInInputList(e.value,(m=c==null?void 0:c.result)==null?void 0:m[e.value],o);return n.createElement(T,{bordered:!1,expandIcon:$,key:`collapse_${l}_${t+1}`,onChange:()=>h(l,e.value),activeKey:[s[l]]},n.createElement(X,{header:n.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",flex:1}},n.createElement("span",null,e.key,n.createElement(H,{placement:"bottom",title:b("ClearThisOption")},n.createElement("img",{style:{marginLeft:5,cursor:"pointer"},onClick:D=>{D.stopPropagation(),a.clearResult(!0,e.value)},src:w===l||R?G:z,onMouseEnter:()=>{f(l)},onMouseLeave:()=>{f(-1)}})),R&&s[l]===""&&n.createElement(x,{color:"#87d068"})),(o==null?void 0:o.length)>1&&A(l)),key:e.value},n.createElement("div",{className:"level",style:{backgroundColor:u.length>0&&u[0]===l?"rgba(158, 158, 158, 0.18)":""}},y(e.subSelected,l))))}const d=(o==null?void 0:o[t])?o==null?void 0:o[t].value:0,S=((k=(_=(L=c==null?void 0:c.result)==null?void 0:L[d])==null?void 0:_.split(";"))==null?void 0:k.indexOf(e.value))>-1?e.value:"";return((C=o==null?void 0:o[t])==null?void 0:C.isMulti)===!0?n.createElement("div",{className:"singleBar",key:`${d}_${t}_${l}`},n.createElement(M,{attributeChanged:()=>E(t,l),selectedAttribute:[S],list:[{value:e.value,label:e.key}],num:l+1})):n.createElement("div",{className:"singleBar",key:`${d}_${t}_${l}`},n.createElement(K,{forbidColor:!0,attributeChanged:()=>E(t,l),selectedAttribute:S,list:[{value:e.value,label:e.key}],num:l+1}))}):null,B=window.innerHeight-61-80;return n.createElement("div",{className:"tagOperationMenu",ref:i},(o==null?void 0:o.length)===0?n.createElement("div",{style:{padding:20,textAlign:"center"}},b("NoConfiguration")):n.createElement("div",{className:"main",style:{height:B}},y(o)))};function Z(a){return{toolInstance:a.annotation.toolInstance,imgIndex:a.annotation.imgIndex}}var I=Q(Z,null,null,{context:W})(Y);export{I as default,$ as expandIconFuc};
@@ -1 +1 @@
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
+ import o,{useState as u,useEffect as h,useRef as I}from"react";import{connect as M}from"react-redux";import{cloneDeep as z}from"lodash";import{classnames as S}from"../../../../utils/index.js";import{Switch as W,Input as J}from"antd/es";import{cKeyCode as G,cTool as H}from"@labelbee/lb-annotation";import{PageForward as Q}from"../../../../store/annotation/actionCreators.js";import{ConfigUtils as X}from"../../../../utils/ConfigUtils.js";import{useTranslation as A}from"react-i18next";import{LabelBeeContext as Y}from"../../../../store/ctx.js";var Z=Object.defineProperty,K=Object.getOwnPropertySymbols,ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable,$=(e,t,r)=>t in e?Z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ne=(e,t)=>{for(var r in t||(t={}))ee.call(t,r)&&$(e,r,t[r]);if(K)for(var r of K(t))te.call(t,r)&&$(e,r,t[r]);return e};const j=G.default,{EVideoToolName:oe}=H,V=e=>{e.stopPropagation(),e.nativeEvent.stopPropagation(),e.nativeEvent.stopImmediatePropagation()},D=e=>{const{textareaProps:t,footer:r}=e;return o.createElement(o.Fragment,null,o.createElement(J.TextArea,ne({key:`${t.id}-${t.defaultValue}`,bordered:!1,rows:6,onKeyDown:V,onKeyUp:V},t)),o.createElement("div",{className:S({textAreaLength:!0})},r))},q=e=>{var t;const r=I(null),[E,m]=u(!1),[N,P]=u(!1),{t:w}=A(),{disabled:s,config:i,result:f,updateText:p,index:d,switchToNextTextarea:y,hasMultiple:L,onNext:b}=e,{maxLength:g}=i,c=f?f[i.key]:"",[C,_]=u((t=c==null?void 0:c.length)!=null?t:0);h(()=>{var n;_((n=c==null?void 0:c.length)!=null?n:0)},[c]);const v=(n,T)=>{p&&(p(n,i.key,T),i.required&&P(!n))},x=L&&y,k={id:`textInput-${d}`,ref:r,disabled:s,defaultValue:c,maxLength:g,autoSize:{minRows:2,maxRows:6},onChange:n=>{const T=n.target.value;_(n.target.value.length),v(T,!1)},onFocus:()=>{m(!0)},onBlur:n=>{m(!1),v(n.target.value,!0),i.required&&P(!n.target.value)},style:{resize:"none",wordBreak:"break-all"},onKeyDownCapture:n=>{n.ctrlKey&&n.keyCode===j.Enter&&(b&&b(),n.preventDefault()),n.keyCode===j.Tab&&x&&(n.preventDefault(),n.nativeEvent.stopImmediatePropagation(),y(d)),n.nativeEvent.stopPropagation()}},F=o.createElement("div",{className:"textAreaFooter"},o.createElement("div",{className:"hotkeyTip"},x&&o.createElement("span",null,`[${w("Switch")}]Tab`),o.createElement("span",null,`[${w("TurnPage")}]Ctrl+Enter`)),o.createElement("div",{className:"wordCount"},o.createElement("span",{className:C>=g?"warning":""},C),"/",o.createElement("span",null,g)));return h(()=>{s&&m(!1)},[s]),o.createElement("div",{className:"textField"},o.createElement("div",{className:"label"},o.createElement("span",{className:S({required:i.required})},i.label),o.createElement("i",{className:S({clearText:!0,disabled:s}),onClick:()=>{s||v("",!0)}})),o.createElement("div",{className:S({disabled:s,"textarea-outline":!0,"ant-input-focused":E,textareaContainer:!0,focus:E,invalid:N})},o.createElement(D,{footer:F,textareaProps:k})))},ae=({toolInstance:e,imgIndex:t,dispatch:r,triggerEventAfterIndexChanged:E,step:m,stepList:N,basicResultList:P,disabled:w})=>{var s,i,f,p;const[d,y]=u([]),[L,b]=u(0),[g,c]=u(!0),[,C]=u(0),{t:_}=A(),v=a=>{const l=(a+1)%d.length;x(l)},x=a=>{setTimeout(()=>{const l=document.getElementById(`textInput-${a}`);l&&(b(a),l.focus(),l.select(),l.scrollIntoView({behavior:"smooth",block:"center"}))})};h(()=>{e&&e.singleOn("valueUpdated",()=>{C(a=>a+1)})},[e]),h(()=>{var a;e&&y(z((a=e==null?void 0:e.config)==null?void 0:a.configList))},[JSON.stringify((s=e==null?void 0:e.config)==null?void 0:s.configList)]);const k=(p=(f=(i=e==null?void 0:e.textList)==null?void 0:i[0])==null?void 0:f.value)!=null?p:{},F=(a,l,U=!1)=>{var O,R;(R=e==null?void 0:e.updateTextValue)==null||R.call(e,l,a,U,(O=e==null?void 0:e.textList)==null?void 0:O[0])};h(()=>{t>-1&&E&&x(0)},[t]);const n=()=>{r(Q(!0))},T=a=>{c(a),e==null||e.toggleShowText(a)},B=X.getStepConfig(N,m).tool===oe.VideoTextTool;return e&&o.createElement("div",{className:"textToolOperationMenu"},d.map((a,l)=>o.createElement(q,{config:a,key:a.key,index:l,result:k,updateText:F,switchToNextTextarea:v,hasMultiple:d.length>1,focus:L===l,onNext:n,disabled:w})),B&&o.createElement("div",{className:"textToolSwitchItem"},_("toggleShowText"),o.createElement(W,{style:{alignSelf:"center"},checked:g,onChange:a=>{T(a)}})))};function re(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 le=M(re,null,null,{context:Y})(ae);export{q as SingleTextInput,D as TextareaWithFooter,le as default};
@@ -1 +1 @@
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};
1
+ import{prefix as F}from"../../../constant/index.js";import{EToolName as r}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(o=>K.getCurrentStepInfo(o.annotation.step,o.annotation.stepList)),[s,w]=R(!0),n=b==null?void 0:b.tool,{t:x}=z();if(!n)return null;const V=o=>{const c=e.createElement(J,null);return e.createElement(L,{header:x("Style"),className:"panel",key:o},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=o=>e.createElement(p,{disabled:o}),v=e.createElement(W,{onChange:(o,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([r.Rect,r.Point,r.Line,r.Rect,r.Polygon,r.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===r.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===r.Text)return e.createElement("div",{className:`${t}`},"s",e.createElement(p,null));if(n===ne.PointCloud){const o=()=>{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:()=>o()},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:()=>o(),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===r.ScribbleTool?e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},v,a),l):n===r.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.21.0",
3
+ "version": "1.22.0-alpha.1",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@ant-design/icons": "^4.6.2",
46
- "@labelbee/lb-annotation": "1.25.0",
46
+ "@labelbee/lb-annotation": "1.26.0-alpha.1",
47
47
  "@labelbee/lb-utils": "1.17.0",
48
48
  "@labelbee/wavesurfer": "1.0.0",
49
49
  "@types/react-dom": "^18.2.7",