@labelbee/lb-components 1.23.0-alpha.3 → 1.23.0-alpha.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.js +1 -1
- package/dist/assets/annotation/pointCloudTool/leftArrow.svg.js +1 -1
- package/dist/assets/annotation/pointCloudTool/rightArrow.svg.js +1 -1
- package/dist/components/LLMToolView/index.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
- package/dist/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
- package/dist/components/LLMToolView/sidebar/index.js +1 -1
- package/dist/components/LLMToolView/utils/data.js +1 -1
- package/dist/components/NLPToolView/index.js +1 -1
- package/dist/components/NLPToolView/textContent/index.js +1 -1
- package/dist/components/audioAnnotate/audioContext/index.js +1 -1
- package/dist/components/audioAnnotate/audioSide/clipSidebar/index.js +1 -1
- package/dist/components/audioAnnotate/index.js +1 -1
- package/dist/components/audioAnnotate/textInput/index.js +1 -1
- package/dist/components/audioAnnotate/textInput/index.module.scss.js +1 -1
- package/dist/components/audioAnnotate/utils/dataTransform.js +1 -0
- package/dist/components/audioPlayer/clipRegion/index.js +1 -1
- package/dist/components/audioPlayer/index.js +1 -1
- package/dist/components/audioPlayer/useAudioCombine/index.js +3 -2
- package/dist/components/audioPlayer/useAudioSegment/index.js +1 -1
- package/dist/components/longText/index.js +1 -1
- package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
- package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
- package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
- package/dist/components/pointCloudView/PointCloudContext.js +1 -1
- package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/dist/components/pointCloudView/hooks/useStatus.js +1 -1
- package/dist/components/pointCloudView/index.js +1 -1
- package/dist/components/subAttributeList/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/index.js +1 -1
- package/dist/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
- package/dist/index.css +35 -9
- package/dist/index.js +1 -1
- package/dist/store/Actions.js +1 -1
- package/dist/store/annotation/actionCreators.js +1 -1
- package/dist/store/annotation/reducer.js +1 -1
- package/dist/types/App.d.ts +3 -1
- package/dist/types/components/LLMToolView/utils/data.d.ts +1 -1
- package/dist/types/components/audioAnnotate/audioContext/index.d.ts +10 -2
- package/dist/types/components/audioAnnotate/textInput/index.d.ts +1 -0
- package/dist/types/components/audioAnnotate/utils/dataTransform.d.ts +9 -0
- package/dist/types/components/audioPlayer/index.d.ts +28 -21
- package/dist/types/components/longText/index.d.ts +1 -0
- package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloudContext.d.ts +6 -1
- package/dist/types/components/pointCloudView/hooks/usePointCloudViews.d.ts +5 -0
- package/dist/types/components/subAttributeList/index.d.ts +9 -0
- package/dist/types/components/videoAnnotate/index.d.ts +2 -1
- package/dist/types/components/videoAnnotate/videoClipTool/index.d.ts +2 -1
- package/dist/types/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.d.ts +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/store/Actions.d.ts +1 -0
- package/dist/types/store/annotation/actionCreators.d.ts +3 -2
- package/dist/types/store/annotation/reducer.d.ts +1 -0
- package/dist/types/store/annotation/types.d.ts +9 -2
- package/dist/types/utils/AnnotationDataUtils.d.ts +54 -1
- package/dist/types/utils/index.d.ts +25 -1
- package/dist/types/views/MainView/sidebar/TextToolSidebar/index.d.ts +1 -1
- package/dist/types/views/MainView/toolFooter/index.d.ts +1 -1
- package/dist/types/views/MainView/toolHeader/StepSwitch/index.d.ts +1 -1
- package/dist/types/views/MainView/toolHeader/index.d.ts +1 -1
- package/dist/utils/AnnotationDataUtils.js +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/views/MainView/index.js +1 -1
- package/dist/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
- package/dist/views/MainView/sidebar/NLPSidebar/NLPAnnotatedList.js +1 -1
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/dist/views/MainView/sidebar/TagSidebar/index.js +1 -1
- package/dist/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
- package/es/App.js +1 -1
- package/es/assets/annotation/pointCloudTool/leftArrow.svg.js +1 -1
- package/es/assets/annotation/pointCloudTool/rightArrow.svg.js +1 -1
- package/es/components/LLMToolView/index.js +1 -1
- package/es/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
- package/es/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -1
- package/es/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
- package/es/components/LLMToolView/sidebar/index.js +1 -1
- package/es/components/LLMToolView/utils/data.js +1 -1
- package/es/components/NLPToolView/index.js +1 -1
- package/es/components/NLPToolView/textContent/index.js +1 -1
- package/es/components/audioAnnotate/audioContext/index.js +1 -1
- package/es/components/audioAnnotate/audioSide/clipSidebar/index.js +1 -1
- package/es/components/audioAnnotate/index.js +1 -1
- package/es/components/audioAnnotate/textInput/index.js +1 -1
- package/es/components/audioAnnotate/textInput/index.module.scss.js +1 -1
- package/es/components/audioAnnotate/utils/dataTransform.js +1 -0
- package/es/components/audioPlayer/clipRegion/index.js +1 -1
- package/es/components/audioPlayer/index.js +1 -1
- package/es/components/audioPlayer/useAudioCombine/index.js +3 -2
- package/es/components/audioPlayer/useAudioSegment/index.js +1 -1
- package/es/components/longText/index.js +1 -1
- package/es/components/pointCloud2DRectOperationView/index.js +1 -1
- package/es/components/pointCloudView/PointCloud2DView.js +1 -1
- package/es/components/pointCloudView/PointCloud3DView.js +1 -1
- package/es/components/pointCloudView/PointCloudContext.js +1 -1
- package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/es/components/pointCloudView/hooks/useStatus.js +1 -1
- package/es/components/pointCloudView/index.js +1 -1
- package/es/components/subAttributeList/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/index.js +1 -1
- package/es/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
- package/es/index.css +35 -9
- package/es/index.js +1 -1
- package/es/store/Actions.js +1 -1
- package/es/store/annotation/actionCreators.js +1 -1
- package/es/store/annotation/reducer.js +1 -1
- package/es/utils/AnnotationDataUtils.js +1 -1
- package/es/utils/index.js +1 -1
- package/es/views/MainView/index.js +1 -1
- package/es/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
- package/es/views/MainView/sidebar/NLPSidebar/NLPAnnotatedList.js +1 -1
- package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/es/views/MainView/sidebar/TagSidebar/index.js +1 -1
- package/es/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as n}from"../../utils/dom.js";import t,{useContext as
|
|
1
|
+
import{getClassName as n}from"../../utils/dom.js";import t,{useContext as T,useState as y,useEffect as C}from"react";import _ from"./PointCloud3DView.js";import k from"./PointCloudBackView.js";import B from"./PointCloudTopView.js";import F from"./PointCloudSideView.js";import R from"./PointCloud2DView.js";import M from"./PointCloudListener.js";import G from"./PointCloudSegmentListener.js";import O from"./PointCloudSegment.js";import Z from"./PointCloudSegmentStatus.js";import U from"./PointCloudSegmentToolbar.js";import W from"./PointCloudSegment2DView.js";import{connect as $}from"react-redux";import{LabelBeeContext as q,useDispatch as z}from"../../store/ctx.js";import{AnnotatedAttributesPanelFixedLeft as H,AnnotatedAttributesPanelFixedRight as J}from"../../views/MainView/toolFooter/AnnotatedAttributes/index.js";import{PointCloudContext as K}from"./PointCloudContext.js";import{PointCloudUtils as Q,EPointCloudPattern as X}from"@labelbee/lb-utils";import{useCustomToolInstance as Y}from"../../hooks/annotation.js";import{jsonParser as tt}from"../../utils/index.js";import{a2MapStateToProps as et}from"../../store/annotation/map.js";import L from"classnames";import ot from"./components/sideAndBackOverView/index.js";import{SetLoadPCDFileLoading as nt}from"../../store/annotation/actionCreators.js";const it=E=>{const{currentData:a,imgList:S,drawLayerSlot:d,checkMode:i,intelligentFit:w,imgIndex:x,config:b,measureVisible:j}=E,e=T(K),{globalPattern:p,setGlobalPattern:v,selectedIDs:P}=e,V=z(),[l,f]=y(!1),h=(P==null?void 0:P.length)>0&&l,D=tt(a.result),{toolInstanceRef:r,clearToolInstance:A}=Y({basicInfo:D});if(C(()=>{r.current.setPointCloudGlobalPattern=o=>{o!==p&&(v(o),e.clearAllDetectionInstance(),A())}},[p]),C(()=>{var o;if(nt(V,!0),a){const{boxParamsList:s,polygonList:m,lineList:u,sphereParamsList:c,segmentation:N,rectList:I}=Q.parsePointCloudCurrentResult((o=a==null?void 0:a.result)!=null?o:"");e.setPointCloudResult(s),e.setPolygonList(m),e.setLineList(u),e.setPointCloudSphereList(c),e.setRectList(I),e.setSegmentation(N)}},[x]),C(()=>{r.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],r.current.exportCustomData=()=>{var o,s,m,u,c;return{resultPolygon:(o=e.polygonList)!=null?o:[],resultLine:(s=e.lineList)!=null?s:[],resultPoint:(m=e.pointCloudSphereList)!=null?m:[],resultRect:(u=e.rectList)!=null?u:[],segmentation:(c=e.segmentation)!=null?c:[]}}},[e.pointCloudBoxList,e.rectList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),S.length===0)return null;if(p===X.Segmentation)return t.createElement(t.Fragment,null,t.createElement(G,{checkMode:i,toolInstanceRef:r}),t.createElement(U,null),t.createElement("div",{className:n("point-cloud-layout")},t.createElement(O,{checkMode:i}),t.createElement(W,null)),t.createElement(Z,{config:b}),d==null?void 0:d({direct:!0}));let g=t.createElement("div",{className:n("point-cloud-container","left-bottom")},t.createElement(k,{checkMode:i}),t.createElement(F,{checkMode:i}));return l&&(g=t.createElement(ot,{selectAndEnlarge:h,checkMode:i})),t.createElement(t.Fragment,null,t.createElement(M,{checkMode:i,toolInstanceRef:r}),t.createElement("div",{className:n("point-cloud-layout"),onContextMenu:o=>o.preventDefault()},t.createElement("div",{className:n("point-cloud-wrapper")},t.createElement(H,null),t.createElement("div",{className:n("point-cloud-content")},t.createElement("div",{className:n("point-cloud-container","left")},t.createElement(_,null),g),t.createElement("div",{className:L({[n("point-cloud-container","right")]:!0,[n("point-cloud-container","rightZoom")]:l})},t.createElement(B,{drawLayerSlot:d,checkMode:i,intelligentFit:w,setIsEnlargeTopView:f,onExitZoom:()=>{f(!1)},isEnlargeTopView:l}),t.createElement("div",{className:L({[n("point-cloud-container","right-bottom")]:!l,[n("point-cloud-container","right-bottom-floatLeft")]:l})},t.createElement(R,{isEnlargeTopView:l,thumbnailWidth:l?300:455,checkMode:i,measureVisible:j})))),t.createElement(J,null))))};var lt=$(et,null,null,{context:q})(it);export{lt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import n from"react";import{Checkbox as v,Select as m,Divider as u}from"antd";import{useTranslation as s}from"react-i18next";import x from"../attributeList/index.js";const y={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},g=p=>{const{subAttributeList:c,setSubAttribute:t,getValue:o}=p,{t:r}=s(),i=(e,a)=>{if(Array.isArray(a)){t(e,a.join(";"));return}t(e,a)},d=e=>{const a=o(e);return(e==null?void 0:e.isMulti)?a?a==null?void 0:a.split(";"):[]:a};return n.createElement(n.Fragment,null,c.map(e=>{var a;return(e==null?void 0:e.subSelected)&&n.createElement("div",{style:{marginTop:12},key:e.value},n.createElement("div",{style:y},r("SubAttribute"),"-",e.key),((a=e.subSelected)==null?void 0:a.length)<5?(e==null?void 0:e.isMulti)?n.createElement(v.Group,{style:{padding:"0px 20px 16px 16px"},options:e.subSelected.map(l=>({label:l.key,value:l.value})),value:d(e),onChange:l=>i(e.value,l)}):n.createElement(x,{list:e.subSelected.map(l=>({label:l.key,value:l.value})),selectedAttribute:o(e),num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:l=>t(e.value,l),style:{marginBottom:12}}):n.createElement(m,{style:{margin:"0px 20px 16px 16px",width:"87%"},mode:(e==null?void 0:e.isMulti)?"multiple":void 0,value:d(e),placeholder:r("PleaseSelect"),onChange:l=>i(e.value,l),allowClear:!0},e.subSelected.map(l=>n.createElement(m.Option,{key:l.value,value:l.value},l.key))),n.createElement(u,{style:{margin:0}}))}))};export{g as default};
|
|
@@ -1 +1 @@
|
|
|
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
|
+
import{MathUtils as C,CommonToolUtils as F,uuid as A,AttributeUtils as R}from"@labelbee/lb-annotation";import{jsonParser as P}from"../../../utils/index.js";import{precisionAdd as y,precisionMinus as k,isImageValue as V}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 d,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===d.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(y(u,t),[0,k(a===T.Time?s:l,v)]);this.updateSelectedSliceTimeProperty(n,"start")}},this.updateSelectedSliceTimeEndByPer=t=>{var e,i;if(this.state.clipStatus===d.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(y(u,t),[y(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===d.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!==d.Clipping)return;const s=t.findIndex(l=>l.id===e);s>-1&&(t.splice(s,1),this.setState({result:t,selectedID:"",clipStatus:d.Stop}),this.updateSidebar())},this.toggleClipStatus=t=>{var e,i;if(typeof((e=this.props)==null?void 0:e.annotationBefore)=="function"){(i=this.props)==null||i.annotationBefore(()=>this.setClipResult(t));return}this.setClipResult(t)},this.setClipResult=t=>{var e,i,s;if(this.disabled)return;const{clipStatus:l,selectedAttribute:u}=this.state,a=l!==d.Clipping;let n=a?d.Clipping:d.Stop,{result:o,selectedID:c,textValue:h}=this.state;const p=b.cloneDeep(o),S=t||((e=this.videoPlayer)==null?void 0:e.currentTime),I=(i=this.videoPlayer)==null?void 0:i.duration;if(I===void 0||S===void 0)return;const w=L(S,2);if(a){const f=A();c=f,p.push({start:w,end:null,attribute:u,textAttribute:this.defaultTextAttribute,duration:I,id:f,type:T.Period}),h=this.defaultTextAttribute}else{const f=p.findIndex(E=>E.id===c),D=p[f];D&&(S-D.start<x?(p.splice(f,1),m.info(`\u622A\u53D6\u7247\u6BB5\u4E0D\u80FD\u77ED\u4E8E${x}s`),n=d.Stop,c="",h=""):(p[f].end=L(S,2),(s=this.videoPlayer)==null||s.pause(),m.success(`\u5DF2\u622A\u53D6\u7247\u6BB5${o.length}`)))}this.setState({clipStatus:n,result:p,selectedID:c,textValue:h}),this.updateSidebar()},this.addTime=()=>{var t,e,i,s;if(this.disabled)return;const{result:l,selectedAttribute:u,selectedID:a}=this.state,n=A(),o=b.cloneDeep(l),c=((t=this.videoPlayer)==null?void 0:t.currentTime)||0;o.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 h={result:o,selectedID:n,textValue:this.defaultTextAttribute},p=o.find(S=>S.id===a);this.isClipping&&p?(delete h.selectedID,delete h.textValue,m.success(`\u5DF2\u622A\u53D6\u65F6\u95F4\u70B9${o.length-1}`)):(s=this.videoPlayer)==null||s.pause(),this.setState(h),this.updateSidebar()},this.updateCurrentTime=t=>{this.setState({currentTime:t})},this.contextToCancel=t=>{this.state.clipStatus===d.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,o=e==="left",c=o?"start":"end",h=o?-n*i:n*i,p=o?[0,Math.max(((s=a.end)!=null?s:0)-x,0)]:[a.start+x,n],S=C.withinRange(h+((l=a==null?void 0:a[c])!=null?l:0),p);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:o=>{this.videoPlayer=o},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=V(s[i].result||"[]");this.setState({result:a,loading:t,selectedID:"",textValue:"",selectedAttribute:"",clipStatus:d.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:d.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===d.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 R.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{TagUtils as
|
|
1
|
+
import h from"react";import{TagUtils as m,CommonToolUtils as f,uuid as v}from"@labelbee/lb-annotation";import{jsonParser as g}from"../../../utils/index.js";import{VideoPlayer as y}from"../../videoPlayer/index.js";import{VideoTagLayer as L}from"../../videoPlayer/VideoTagLayer.js";import p,{cloneDeep as R}from"lodash";import{getKeyCodeNumber as b}from"../../videoPlayer/utils.js";class S extends h.Component{constructor(e){super(e);this.fns={},this.labelSelectedList=[],this.clearResult=(t=!0,s)=>{const n=s?this.state.tagResult.map(i=>((i==null?void 0:i.result[s])&&delete i.result[s],i)):[];this.setState({tagResult:n},()=>this.emitEvent("render"))},this.exportData=()=>{var t,s;const n=(s=(t=this.videoPlayer)==null?void 0:t.duration)!=null?s:0;return[this.state.tagResult,{valid:this.state.valid,duration:n}]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.combineResult=(t,s={})=>{var n,i;const l=R(s),{isMulti:a}=t,{key:r,value:d}=t.value;if(a){let o=(i=(n=l[r])==null?void 0:n.split(";"))!=null?i:[];o.includes(d)?o=o.filter(c=>c!==d):o.push(d);const u=new Set(o);return l[r]=Array.from(u).join(";"),p.pickBy(l,c=>c)}return l[r]=l[r]===d?void 0:d,p.pickBy(l,o=>o)},this.setResult=t=>{this.setState({tagResult:t}),this.fns.render&&this.fns.render()},this.setLabel=(t,s)=>{this.setLabelBySelectedList(t,s)},this.keydown=t=>{var s;const n=b(t.keyCode);if(n){const i=n-1;if(((s=this.config.inputList)==null?void 0:s.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:s,imgIndex:n,stepInfo:i}=t;if(!s[n])return;const l=g(s[n].result),a=l[`step_${i.step}`],r=this.getInitResultList();this.setState({tagResult:a?a==null?void 0:a.result:r,valid:(l==null?void 0:l.valid)===void 0?!0:l.valid},()=>this.emitEvent("render"))},this.getInitResultList=()=>{var t;return m.getDefaultTagResult((t=this.config.inputList)!=null?t:[],[])},this.state={tagResult:[],labelSelectedList:[],valid:!0}}get config(){var e;return g((e=this.props.stepInfo)==null?void 0:e.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get currentTagResult(){var e;return(e=this.state.tagResult[0])!=null?e:{}}get valid(){return this.state.valid}singleOn(e,t){this.fns[e]=t}on(e,t){this.singleOn(e,t)}unbindAll(e){delete this.fns[e]}getTagResultByCode(e,t){var s,n,i;try{const l=(n=(s=this.config)==null?void 0:s.inputList)!=null?n:[],a=(l==null?void 0:l.length)>1,r=t!==void 0?e:0,d=t!==void 0?t:e,o=a?l[r]:l[0],u=((i=o.subSelected)!=null?i:[])[d];if(o&&u)return{value:{key:o.value,value:u.value},isMulti:o.isMulti}}catch(l){return}}setLabelBySelectedList(e,t){var s,n,i,l,a,r;const d=this.getTagResultByCode(e,t);if(d){const o=this.combineResult(d,(n=(s=this.state.tagResult[0])==null?void 0:s.result)!=null?n:{}),u=[{sourceID:f.getSourceID(),id:(l=(i=this.currentTagResult)==null?void 0:i.id)!=null?l:v(8,62),result:o}];if(typeof((a=this.props)==null?void 0:a.annotationBefore)=="function"){(r=this.props)==null||r.annotationBefore(()=>this.setState({tagResult:u},()=>this.emitEvent("render")));return}this.setState({tagResult:u},()=>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(e){return e.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(e),!0}render(){var e;const{imgIndex:t,imgList:s,pageForward:n,pageJump:i,pageBackward:l}=this.props,{tagResult:a,valid:r}=this.state;return h.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},h.createElement(y,{imgIndex:t,imgList:s,pageBackward:l,pageForward:n,pageJump:i,valid:r,setVideoRef:d=>{this.videoPlayer=d},dataLoaded:this.props.onVideoLoaded,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer}),h.createElement(L,{result:a,inputList:(e=this.config)==null?void 0:e.inputList,hasPromptLayer:!!this.props.drawLayerSlot}))}}export{S as TagToolInstanceAdaptor};
|
package/es/index.css
CHANGED
|
@@ -132,6 +132,12 @@
|
|
|
132
132
|
.index-module_outputDisplay__5dS48 .index-module_content__Iml6l .markdown-body {
|
|
133
133
|
font-size: 14px;
|
|
134
134
|
}
|
|
135
|
+
|
|
136
|
+
.index-module_tip__NFru6 {
|
|
137
|
+
margin-bottom: 8px;
|
|
138
|
+
color: rgba(0, 0, 0, 0.45);
|
|
139
|
+
font-size: 14px;
|
|
140
|
+
}
|
|
135
141
|
.index-module_tagList__cvWor {
|
|
136
142
|
padding: 0px 16px 16px 16px;
|
|
137
143
|
}
|
|
@@ -720,6 +726,16 @@
|
|
|
720
726
|
font-family: SourceHanSansCN-Medium;
|
|
721
727
|
font-size: 14px;
|
|
722
728
|
}
|
|
729
|
+
.index-module_label__xE6hM .index-module_labelText__Zg1c4 {
|
|
730
|
+
display: flex;
|
|
731
|
+
overflow: hidden;
|
|
732
|
+
width: 60%;
|
|
733
|
+
align-items: center;
|
|
734
|
+
}
|
|
735
|
+
.index-module_label__xE6hM .index-module_labelText__Zg1c4 .index-module_titleText__BRM44 {
|
|
736
|
+
max-width: calc(100% - 20px);
|
|
737
|
+
overflow: hidden;
|
|
738
|
+
}
|
|
723
739
|
.index-module_label__xE6hM .index-module_required__iElYl::before {
|
|
724
740
|
display: inline-block;
|
|
725
741
|
margin-right: 4px;
|
|
@@ -732,6 +748,7 @@
|
|
|
732
748
|
.index-module_label__xE6hM .index-module_extra__PW5Qk {
|
|
733
749
|
float: right;
|
|
734
750
|
margin-right: 5px;
|
|
751
|
+
width: 40%;
|
|
735
752
|
}
|
|
736
753
|
|
|
737
754
|
.index-module_textareaContainer__dTIv4 {
|
|
@@ -862,6 +879,7 @@
|
|
|
862
879
|
flex-wrap: wrap;
|
|
863
880
|
align-items: center;
|
|
864
881
|
justify-content: center;
|
|
882
|
+
overflow: hidden;
|
|
865
883
|
}
|
|
866
884
|
.index-module_placeholderHotkey__0SKPo .text {
|
|
867
885
|
color: #333;
|
|
@@ -878,7 +896,10 @@
|
|
|
878
896
|
|
|
879
897
|
.index-module_attribute__g8Vbl {
|
|
880
898
|
height: 22px;
|
|
881
|
-
padding:
|
|
899
|
+
padding: 0px 8px;
|
|
900
|
+
width: max-content;
|
|
901
|
+
max-width: 100%;
|
|
902
|
+
margin-left: auto;
|
|
882
903
|
}
|
|
883
904
|
|
|
884
905
|
.index-module_clearIcon__ZBZqI {
|
|
@@ -887,10 +908,14 @@
|
|
|
887
908
|
height: 14px;
|
|
888
909
|
margin-left: 4px;
|
|
889
910
|
vertical-align: text-top;
|
|
911
|
+
background-image: url(~@/assets/tool_Icon/icon_clearSmall.svg);
|
|
890
912
|
background-repeat: no-repeat;
|
|
891
913
|
background-position: center;
|
|
892
914
|
cursor: pointer;
|
|
893
915
|
}
|
|
916
|
+
.index-module_clearIcon__ZBZqI:not(.index-module_disabled__zqh8C):hover {
|
|
917
|
+
background-image: url(~@/assets/tool_Icon/icon_clearSmall_a.svg);
|
|
918
|
+
}
|
|
894
919
|
.index-module_clearIcon__ZBZqI.index-module_disabled__zqh8C {
|
|
895
920
|
cursor: not-allowed;
|
|
896
921
|
}
|
|
@@ -1141,7 +1166,8 @@
|
|
|
1141
1166
|
}
|
|
1142
1167
|
.index-module_clipSidebar__z2E8x .index-module_attributeList__2wnCE {
|
|
1143
1168
|
flex: 1;
|
|
1144
|
-
overflow:
|
|
1169
|
+
overflow-x: hidden;
|
|
1170
|
+
overflow-y: auto;
|
|
1145
1171
|
}
|
|
1146
1172
|
.index-module_clipSidebar__z2E8x .index-module_attributeList__2wnCE .sensebee-radio-group,
|
|
1147
1173
|
.index-module_clipSidebar__z2E8x .index-module_attributeList__2wnCE .sensebee-radio-group-no-limit-height .ant-radio-group {
|
|
@@ -1870,11 +1896,14 @@
|
|
|
1870
1896
|
-ms-user-select: none;
|
|
1871
1897
|
user-select: none;
|
|
1872
1898
|
}
|
|
1899
|
+
.generalOperation .generalOperation-col {
|
|
1900
|
+
display: flex;
|
|
1901
|
+
justify-content: center;
|
|
1902
|
+
}
|
|
1873
1903
|
.generalOperation .item {
|
|
1874
1904
|
text-align: center;
|
|
1875
|
-
flex: 1;
|
|
1876
1905
|
box-sizing: border-box;
|
|
1877
|
-
width:
|
|
1906
|
+
width: 100px;
|
|
1878
1907
|
height: 100%;
|
|
1879
1908
|
display: flex;
|
|
1880
1909
|
flex-direction: column;
|
|
@@ -3077,15 +3106,12 @@
|
|
|
3077
3106
|
display: block;
|
|
3078
3107
|
}
|
|
3079
3108
|
.bee-sidebar__content__NLPList__item__text {
|
|
3080
|
-
flex: 1 1;
|
|
3081
|
-
padding: 16px;
|
|
3082
3109
|
font-weight: 400;
|
|
3083
3110
|
font-size: 12px;
|
|
3084
3111
|
line-height: 20px;
|
|
3085
3112
|
color: #666666;
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
white-space: nowrap;
|
|
3113
|
+
padding: 16px;
|
|
3114
|
+
width: 100%;
|
|
3089
3115
|
}
|
|
3090
3116
|
.bee-sidebar__content__NLPList__item__active {
|
|
3091
3117
|
background-color: #eeefff;
|
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";export{default as TextContent}from"./components/NLPToolView/textContent/index.js";import{i18n as l}from"@labelbee/lb-utils";export{i18n}from"@labelbee/lb-utils";import r,{useState as c,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 P,PageForward as v,PageJump as T}from"./store/annotation/actionCreators.js";export{VideoTagTool}from"./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js";import{PointCloudProvider as g}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{default as AnnotatedBox}from"./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js";export{FindTrackIDIndexInCheckMode as FindTrackIDIndex}from"./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js";export{EDataFormatType,ELLMDataType,EStepType,ESubmitType,componentCls,prefix}from"./constant/index.js";var _=Object.defineProperty,I=Object.defineProperties,b=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,
|
|
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";export{default as TextContent}from"./components/NLPToolView/textContent/index.js";import{i18n as l}from"@labelbee/lb-utils";export{i18n}from"@labelbee/lb-utils";import r,{useState as c,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 P,PageForward as v,PageJump as T}from"./store/annotation/actionCreators.js";export{VideoTagTool}from"./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js";import{PointCloudProvider as g}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{default as AnnotatedBox}from"./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js";export{FindTrackIDIndexInCheckMode as FindTrackIDIndex}from"./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js";export{WrapAudioPlayer as AudioPlayer}from"./components/audioPlayer/index.js";export{generatePointCloudBoxRects}from"./utils/index.js";export{EDataFormatType,ELLMDataType,EStepType,ESubmitType,componentCls,prefix}from"./constant/index.js";var _=Object.defineProperty,I=Object.defineProperties,b=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,C=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,p=(o,e,t)=>e in o?_(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,A=(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))V.call(e,t)&&p(o,t,e[t]);return o},y=(o,e)=>I(o,b(e));const n=w(),O=(o,e)=>{const[t,d]=c();return m(e,()=>({toolInstance:t,annotationEngine:n.getState().annotation.annotationEngine,pageBackwardActions:()=>n.dispatch(P()),pageForwardActions:()=>n.dispatch(v()),pageJump:a=>{const i=~~a-1;n.dispatch(T(i))},hello:()=>alert("hello labelBee!!!")}),[t]),r.createElement(u,{store:n,context:j},r.createElement(f,{i18n:l},r.createElement(g,null,r.createElement(x,y(A({},o),{setToolInstance:a=>{var i;d(a),(i=o.onLoad)==null||i.call(o,{toolInstance:a})}})))))};var E=r.forwardRef(O);export{E as default,n as store};
|
package/es/store/Actions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const T={INIT_ALL_STATE:"@@INIT_ALL_STATE",UPDATE_TOOL_INSTANCE:"@@UPDATE_TOOL_INSTANCE",UPDATE_IMG_LIST:"@@UPDATE_IMG_LIST",UPDATE_ANNOTATION_CONFIG:"@@UPDATE_ANNOTATION_CONFIG",LOAD_FILE_DATA:"@@LOAD_FILE_DATA",SUBMIT_FILE_DATA:"@@SUBMIT_FILE_DATA",SET_TASK_CONFIG:"@@SET_TASK_CONFIG",INIT_TOOL:"@@INIT_TOOL",SET_TOOL:"@@SET_TOOL",UPDATE_ON_SUBMIT:"@@UPDATE_ON_SUBMIT",UPDATE_ON_SAVE:"@@UPDATE_ON_SAVE",UPDATE_ON_PAGE_CHANGE:"@@UPDATE_ON_PAGE_CHANGE",UPDATE_ON_STEP_CHANGE:"@@UPDATE_ON_STEP_CHANGE",UPDATE_ROTATE:"@@UPDATE_ROTATE",UPDATE_GET_FILE_DATA:"@@UPDATE_GET_FILE_DATA",UPDATE_PAGE_SIZE:"@@UPDATE_PAGE_SIZE",UPDATE_LOAD_FILE_LIST:"@@UPDATE_LOAD_FILE_LIST",GET_FILE_DATA:"@@GET_FILE_DATA",SET_FILE_DATA:"@@SET_FILE_DATA",COPY_BACKWARD_RESULT:"@@COPY_BACKWARD_RESULT",SET_STEP:"@@SET_STEP",SUBMIT_RESULT:"@@SUBMIT_RESULT",SAVE_RESULT:"@@SAVE_RESULT",SET_BASIC_INDEX:"@@SET_BASIC_INDEX",CALC_STEP_PROGRESS:"@@CALC_STEP_PROGRESS",SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:"@@SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED",SKIP_BEFORE_PAGE_TURNING:"@@SKIP_BEFORE_PAGE_TURNING",UPDATE_BEFORE_ROTATE:"@@UPDATE_BEFORE_ROTATE",SET_LOADING:"@@SET_LOADING",SET_LOADPCDFILE_LOADING:"@@SET_LOADPCDFILE_LOADING",SET_POINT_CLOUD_LOADING:"@@SET_POINT_CLOUD_LOADING",SET_CHECK_MODE:"@@SET_CHECK_MODE",SET_TASK_STEP_LIST:"@@SET_TASK_STEP_LIST",UPDATE_ANNOTATION_VALID:"@@UPDATE_ANNOTATION_VALID",BATCH_UPDATE_TRACK_ID:"@@BATCH_UPDATE_TRACK_ID",BATCH_UPDATE_RESULT_BY_TRACK_ID:"@@BATCH_UPDATE_RESULT_BY_TRACK_ID",BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:"@@BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT",SET_PREDICT_RESULT_VISIBLE:"@@SET_PREDICT_RESULT_VISIBLE",SET_PREDICT_RESULT:"@@SET_PREDICT_RESULT",SET_HIGHLIGHT_ATTRIBUTE:"@@SET_HIGHLIGHT_ATTRIBUTE",UPDATE_PRE_DATA_PROCESS:"@@UPDATE_PRE_DATA_PROCESS"},_={UPDATE_IMG_ATTRIBUTE:"@@UPDATE_IMG_ATTRIBUTE",INIT_IMG_ATTRIBUTE:"@@INIT_IMG_ATTRIBUTE"},E={INIT_TOOL_STYLE_CONFIG:"@@INIT_TOOL_STYLE_CONFIG",UPDATE_TOOL_STYLE_CONFIG:"@@UPDATE_TOOL_STYLE_CONFIG"};export{T as ANNOTATION_ACTIONS,_ as IMAGE_ATTRIBUTE_ACTIONS,E as TOOL_STYLE_ACTIONS};
|
|
1
|
+
const T={INIT_ALL_STATE:"@@INIT_ALL_STATE",UPDATE_TOOL_INSTANCE:"@@UPDATE_TOOL_INSTANCE",UPDATE_IMG_LIST:"@@UPDATE_IMG_LIST",UPDATE_ANNOTATION_CONFIG:"@@UPDATE_ANNOTATION_CONFIG",LOAD_FILE_DATA:"@@LOAD_FILE_DATA",SUBMIT_FILE_DATA:"@@SUBMIT_FILE_DATA",SET_TASK_CONFIG:"@@SET_TASK_CONFIG",INIT_TOOL:"@@INIT_TOOL",SET_TOOL:"@@SET_TOOL",UPDATE_ON_SUBMIT:"@@UPDATE_ON_SUBMIT",UPDATE_ON_SAVE:"@@UPDATE_ON_SAVE",UPDATE_ON_PAGE_CHANGE:"@@UPDATE_ON_PAGE_CHANGE",UPDATE_ON_STEP_CHANGE:"@@UPDATE_ON_STEP_CHANGE",UPDATE_ROTATE:"@@UPDATE_ROTATE",UPDATE_GET_FILE_DATA:"@@UPDATE_GET_FILE_DATA",UPDATE_PAGE_SIZE:"@@UPDATE_PAGE_SIZE",UPDATE_LOAD_FILE_LIST:"@@UPDATE_LOAD_FILE_LIST",GET_FILE_DATA:"@@GET_FILE_DATA",SET_FILE_DATA:"@@SET_FILE_DATA",COPY_BACKWARD_RESULT:"@@COPY_BACKWARD_RESULT",SET_STEP:"@@SET_STEP",SUBMIT_RESULT:"@@SUBMIT_RESULT",SAVE_RESULT:"@@SAVE_RESULT",SET_BASIC_INDEX:"@@SET_BASIC_INDEX",CALC_STEP_PROGRESS:"@@CALC_STEP_PROGRESS",SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:"@@SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED",SKIP_BEFORE_PAGE_TURNING:"@@SKIP_BEFORE_PAGE_TURNING",UPDATE_BEFORE_ROTATE:"@@UPDATE_BEFORE_ROTATE",SET_LOADING:"@@SET_LOADING",SET_LOADPCDFILE_LOADING:"@@SET_LOADPCDFILE_LOADING",SET_POINT_CLOUD_LOADING:"@@SET_POINT_CLOUD_LOADING",SET_CHECK_MODE:"@@SET_CHECK_MODE",SET_TASK_STEP_LIST:"@@SET_TASK_STEP_LIST",UPDATE_ANNOTATION_VALID:"@@UPDATE_ANNOTATION_VALID",BATCH_UPDATE_TRACK_ID:"@@BATCH_UPDATE_TRACK_ID",BATCH_UPDATE_RESULT_BY_TRACK_ID:"@@BATCH_UPDATE_RESULT_BY_TRACK_ID",BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:"@@BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT",SET_PREDICT_RESULT_VISIBLE:"@@SET_PREDICT_RESULT_VISIBLE",SET_PREDICT_RESULT:"@@SET_PREDICT_RESULT",SET_HIGHLIGHT_ATTRIBUTE:"@@SET_HIGHLIGHT_ATTRIBUTE",UPDATE_PRE_DATA_PROCESS:"@@UPDATE_PRE_DATA_PROCESS",UPDATE_IMG_INDEX_BY_EXTERNAL:"@@UPDATE_IMG_INDEX_BY_EXTERNAL"},_={UPDATE_IMG_ATTRIBUTE:"@@UPDATE_IMG_ATTRIBUTE",INIT_IMG_ATTRIBUTE:"@@INIT_IMG_ATTRIBUTE"},E={INIT_TOOL_STYLE_CONFIG:"@@INIT_TOOL_STYLE_CONFIG",UPDATE_TOOL_STYLE_CONFIG:"@@UPDATE_TOOL_STYLE_CONFIG"};export{T as ANNOTATION_ACTIONS,_ as IMAGE_ATTRIBUTE_ACTIONS,E as TOOL_STYLE_ACTIONS};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ANNOTATION_ACTIONS as a}from"../Actions.js";import{LoadFileAndFileData as O,getStepConfig as
|
|
1
|
+
import{ANNOTATION_ACTIONS as a}from"../Actions.js";import{LoadFileAndFileData as O,getStepConfig as K}from"./reducer.js";import{ESubmitType as E}from"../../constant/index.js";import{EPageTurningOperation as y}from"../../data/enums/AnnotationSize.js";import V from"../../utils/PageOperator.js";import{jsonParser as J}from"../../utils/index.js";import{getBoxesByTrackID as X}from"../../components/predictTracking/previewResult/util.js";var x=(t,e,n)=>new Promise((o,r)=>{var u=p=>{try{i(n.next(p))}catch(l){r(l)}},s=p=>{try{i(n.throw(p))}catch(l){r(l)}},i=p=>p.done?o(p.value):Promise.resolve(p.value).then(u,s);i((n=n.apply(t,e)).next())});const N=(t,e)=>e.map(n=>t(n)),Y=t=>t===y.Forward?E.Forward:t===y.Backward?E.Backward:t===y.Jump?E.Jump:E.Forward,W=(t,e)=>{var n,o,r;const{imgList:u,imgIndex:s}=t,{dataSourceStep:i}=K(t.stepList,t.step);return((r=(o=J((n=u[s-1])==null?void 0:n.result)[`step_${i}`])==null?void 0:o.result)==null?void 0:r.length)-1||e};function q(t){return{type:a.UPDATE_TOOL_INSTANCE,payload:{toolInstance:t}}}function G({stepList:t}){return{type:a.SET_TASK_STEP_LIST,payload:{stepList:t}}}function w({stepList:t,step:e}){return{type:a.SET_TASK_CONFIG,payload:{stepList:t,step:e}}}function U(t){return{type:a.UPDATE_ON_SUBMIT,payload:{onSubmit:t}}}function L(t){return{type:a.UPDATE_ON_SAVE,payload:{onSave:t}}}function D(t){return{type:a.UPDATE_ON_PAGE_CHANGE,payload:{onPageChange:t}}}function R(t){return{type:a.UPDATE_ON_STEP_CHANGE,payload:{onStepChange:t}}}function m(t){return{type:a.UPDATE_GET_FILE_DATA,payload:{getFileData:t}}}function g(t){return{type:a.UPDATE_PAGE_SIZE,payload:{pageSize:t}}}function C(t){return{type:a.UPDATE_LOAD_FILE_LIST,payload:{loadFileList:t}}}function z(){return{type:a.UPDATE_ROTATE}}function F(t){return{type:a.SKIP_BEFORE_PAGE_TURNING,payload:{skipBeforePageTurning:t}}}function h(t){return{type:a.UPDATE_BEFORE_ROTATE,payload:{beforeRotate:t}}}function B(t){return{type:a.UPDATE_PRE_DATA_PROCESS,payload:{preDataProcess:t}}}function Z(){return{type:a.COPY_BACKWARD_RESULT}}function k(t){return{type:a.UPDATE_IMG_INDEX_BY_EXTERNAL,payload:{getImgIndexByExternal:t}}}function $({id:t,newID:e,rangeIndex:n,imgList:o}){return{type:a.BATCH_UPDATE_TRACK_ID,payload:{id:t,newID:e,rangeIndex:n,imgList:o}}}function Q(t,e,n){return{type:a.BATCH_UPDATE_RESULT_BY_TRACK_ID,payload:{id:t,newData:e,rangeIndex:n}}}function tt(){return{type:a.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT,payload:{}}}const b=t=>({type:a.SET_CHECK_MODE,payload:{checkMode:t}}),v=t=>({type:a.SET_HIGHLIGHT_ATTRIBUTE,payload:{attribute:t}});function et({onSubmit:t,onSave:e,onPageChange:n,onStepChange:o,getFileData:r,pageSize:u,loadFileList:s,step:i,stepList:p,skipBeforePageTurning:l,beforeRotate:_,checkMode:c,highlightAttribute:T,preDataProcess:f,getImgIndexByExternal:I}){const d=[];return t&&d.push(U(t)),e&&d.push(L(e)),n&&d.push(D(n)),o&&d.push(R(o)),r&&d.push(m(r)),s&&d.push(C(s)),u&&d.push(g(u)),l&&d.push(F(l)),_&&d.push(h(_)),f&&d.push(B(f)),typeof c=="boolean"&&d.push(b(c)),I&&d.push(k(I)),d.push(v(T)),d.push(w({stepList:p,step:i})),d.push({type:a.CALC_STEP_PROGRESS}),d.push({type:a.INIT_TOOL}),j=>N(j,d)}function nt({onSubmit:t,onSave:e,onPageChange:n,onStepChange:o,getFileData:r,pageSize:u,loadFileList:s,stepList:i,beforeRotate:p,highlightAttribute:l,preDataProcess:_}){const c=[];return t&&c.push(U(t)),e&&c.push(L(e)),n&&c.push(D(n)),o&&c.push(R(o)),r&&c.push(m(r)),s&&c.push(C(s)),u&&c.push(g(u)),p&&c.push(h(p)),_&&c.push(B(_)),c.push(v(l)),c.push(G({stepList:i})),T=>N(T,c)}const at=(t,e)=>{var n;const o=e==null?void 0:e.findIndex(r=>(r==null?void 0:r.step)===t);return(n=e[o+1])==null?void 0:n.step},ot=t=>(e,n)=>{const{annotation:o}=n(),{step:r,stepList:u}=o,s=at(r,u);return[e(H(s,t))]},H=(t,e)=>(n,o)=>{var r,u;const{annotation:s}=o();(r=s==null?void 0:s.onStepChange)==null||r.call(s,t);const i=(u=s==null?void 0:s.imgIndex)!=null?u:0;return[n({type:a.SUBMIT_RESULT}),n({type:a.SUBMIT_FILE_DATA,payload:{submitType:E.StepChanged}}),n({type:a.SET_STEP,payload:{toStep:t}}),n({type:a.CALC_STEP_PROGRESS}),n(O(e!=null?e:i,0))]},S=t=>e=>[e({type:a.SUBMIT_RESULT}),e({type:a.SUBMIT_FILE_DATA,payload:{submitType:t}})],rt=(t,e,n,o)=>[t(S(n)),t(O(e,o))],it=(t,e)=>[t({type:a.SUBMIT_RESULT}),t({type:a.SET_BASIC_INDEX,payload:{basicIndex:e}})],ut=(t,e)=>{t({type:a.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED,payload:{triggerEventAfterIndexChanged:e}})},st=(t=!1)=>(e,n)=>A(e,n,y.Backward,t),pt=(t=!1)=>(e,n)=>A(e,n,y.Forward,t),lt=(t,e=!1)=>(n,o)=>{if(t!==o().imgIndex)return A(n,o,y.Jump,e,t)},M=(t,e,n,o)=>x(void 0,null,function*(){var r;const{loadFileList:u,imgList:s,pageSize:i}=e().annotation,p=Math.floor(n/i);P(t,!0);try{const l=yield u(p,i);if(P(t,!1),!((r=l==null?void 0:l.fileList)==null?void 0:r.length)||!(l==null?void 0:l.total))throw new Error("fileList and total are required");const _=o?new Array(l.total):[...s];return _.splice(p*i,i,...l.fileList),t({type:a.UPDATE_IMG_LIST,payload:{imgList:_}}),!0}catch(l){P(t,!1),console.error(l)}}),A=(t,e,n,o=!1,r)=>x(void 0,null,function*(){var u,s;const i=e().annotation,p=Y(n);let{fileIndexChanged:l,fileIndex:_,basicIndexChanged:c,basicIndex:T}=V.getNextPageInfo(n,i,r);const f=(u=i==null?void 0:i.getImgIndexByExternal)==null?void 0:u.call(i,i.imgIndex,p);if(f!==void 0&&(l=!0,_=f),ut(t,o),l){if(i.loading||!i.imgList[_]&&!(yield M(t,e,_)))return;(s=i.onPageChange)==null||s.call(i,_);const I=p===E.Backward?W(e().annotation,T):T;return rt(t,_,p,I)}return c?it(t,T):t(S(p))}),dt=t=>{t(S(E.Save)),t({type:a.SAVE_RESULT})},P=(t,e)=>{t({type:a.SET_LOADING,payload:{loading:e}})},ct=(t,e)=>{t({type:a.SET_LOADING,payload:{loading:e}})},_t=(t,e)=>{t({type:a.SET_LOADPCDFILE_LOADING,payload:{loadPCDFileLoading:e}})},Tt=t=>{t({type:a.INIT_ALL_STATE,payload:{}})},Et=(t,e)=>{t({type:a.SET_PREDICT_RESULT,payload:{result:e}})},yt=(t,e)=>{t({type:a.SET_PREDICT_RESULT_VISIBLE,payload:{visible:e}})},ft=(t,e)=>(n,o)=>{const{imgList:r,step:u}=o().annotation;return X(r,u,t,e)},It=t=>(e,n)=>{var o,r;const{annotation:u}=n();return(r=(o=u==null?void 0:u.preDataProcess)==null?void 0:o.call(u,t))!=null?r:t.dataList};export{tt as BatchUpdateImgListResultByPredictResult,Q as BatchUpdateResultByTrackID,$ as BatchUpdateTrackID,dt as ChangeSave,Z as CopyBackWordResult,A as DispatcherTurning,ft as GetBoxesByID,Tt as InitAnnotationState,et as InitTaskData,st as PageBackward,pt as PageForward,lt as PageJump,It as PreDataProcess,P as SetAnnotationLoading,_t as SetLoadPCDFileLoading,ct as SetPointCloudLoading,Et as SetPredictResult,yt as SetPredictResultVisible,w as SetTaskConfig,G as SetTaskStepList,ot as ToNextStep,S as ToSubmitFileData,h as UpdateBeforeRotate,b as UpdateCheckMode,m as UpdateGetFileData,C as UpdateGetFileList,v as UpdateHighlightAttribute,k as UpdateImgIndexByExternal,nt as UpdateInjectFunc,D as UpdateOnPageChange,L as UpdateOnSave,R as UpdateOnStepChange,U as UpdateOnSubmit,g as UpdatePageSize,B as UpdatePreDataProcess,H as UpdateProcessingStep,z as UpdateRotate,F as UpdateSkipBeforePageTurning,q as UpdateToolInstance,M as loadImgList};
|
|
@@ -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 l}from"../Actions.js";import{jsonParser as w}from"../../utils/index.js";import Y from"../../utils/AnnotationDataUtils.js";import{ConfigUtils as vt}from"../../utils/ConfigUtils.js";import{composeResultWithBasicImgInfo as ut,composeResult as J}from"../../utils/data.js";import O from"../../utils/StepUtils.js";import X from"../../utils/ToolUtils.js";import{MathUtils as at,CommonToolUtils as yt,AnnotationEngine as Pt,ImgUtils as Rt}from"@labelbee/lb-annotation";import{PointCloudUtils as ct,i18n as G}from"@labelbee/lb-utils";import{Modal as dt}from"antd";import{message as pt}from"antd/es";import _t from"lodash";import{SetAnnotationLoading as $}from"./actionCreators.js";import{EToolName as W}from"../../data/enums/ToolType.js";var Ct=Object.defineProperty,Ot=Object.defineProperties,ht=Object.getOwnPropertyDescriptors,gt=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,Nt=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))Nt.call(e,r)&&It(t,r,e[r]);return t},i=(t,e)=>Ot(t,ht(e)),mt=(t,e,r)=>new Promise((S,d)=>{var A=m=>{try{T(r.next(m))}catch(y){d(y)}},f=m=>{try{T(r.throw(m))}catch(y){d(y)}},T=m=>m.done?S(m.value):Promise.resolve(m.value).then(A,f);T((r=r.apply(t,e)).next())});const x=(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:""},Ut=t=>{const{imgList:e,imgPageSize:r}=t;return Math.ceil(e.length/r)},Tt=(t,e)=>t.reduce((r,S)=>{if(S){const d=S.result;if(w(d)[`step_${e}`])return r+1}return r},0)/t.length,Bt=(t,e)=>{const{step:r,stepList:S}=t,d=O.getCurrentStepInfo(r,S),A=vt.jsonParser(d.config);if(X.isVideoTool(d==null?void 0:d.tool)||X.isAudioTool(d==null?void 0:d.tool)||X.isPointCloudTool(d==null?void 0:d.tool)||[W.LLM,W.NLP].includes(d==null?void 0:d.tool))return;const f=document.getElementById("toolContainer");if(!f)throw"Not exist dom named id-toolContainer";const T=At({width:window.innerWidth,height:window.innerHeight}),m=new Pt({container:f,toolName:d.tool,size:T,imgNode:e,config:A,style:JSON.parse(Dt)});return{toolInstance:m==null?void 0:m.toolInstance,annotationEngine:m}},wt=(t,e)=>(r,S)=>mt(void 0,null,function*(){var d,A;const{stepList:f,step:T}=S().annotation,m=O.currentToolIsVideo(T,f),y=O.currentToolIsPointCloud(T,f),h=((d=O.getCurrentStepInfo(T,f))==null?void 0:d.tool)===W.LLM,b=((A=O.getCurrentStepInfo(T,f))==null?void 0:A.tool)===W.NLP,N=O.currentToolIsAudio(T,f);if($(r,!0),yield r(xt(t)),m){r(Ft(t));return}if(y||h||N||b){r(jt(t));return}r(Gt(t,e))}),xt=t=>(e,r)=>mt(void 0,null,function*(){const{getFileData:S,imgList:d}=r().annotation;if(S){const A=yield S(d[t],t);e({type:l.SET_FILE_DATA,payload:{fileData:A,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,S)=>{var d;const{toolInstance:A,imgList:f}=S().annotation,T=(d=f==null?void 0:f[t])==null?void 0:d.url;Rt.load(T).then(m=>{$(r,!1),r({type:l.LOAD_FILE_DATA,payload:{imgNode:m,nextIndex:t,nextBasicIndex:e}})}).catch(()=>{$(r,!1),A==null||A.setErrorImg(),r({type:l.LOAD_FILE_DATA,payload:{nextIndex:t,nextBasicIndex:e}})})},Vt=({toolInstance:t,imgList:e,imgIndex:r,stepList:S,step:d=1})=>{var A,f,T,m;const y=((A=e[r])==null?void 0:A.result)||"",[h,b,N]=(f=t==null?void 0:t.exportData())!=null?f:[],V=(m=(T=t==null?void 0:t.exportCustomData)==null?void 0:T.call(t))!=null?m:{},M=ut(y,b),k=J(M,{step:d,stepList:S},{rect:h},V);return e.map((F,H)=>H===r?n(i(n({},F),{result:k}),N):n({},F))},Mt=(t=n({},ft),e)=>{var r,S,d,A,f,T,m,y,h,b,N,V,M,k,F,H,q,Z,Q,tt,et,ot,nt,st,lt;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:L}=t;if(!p||!o[s])return t;const g=((r=o[s])==null?void 0:r.result)||"",[,_,I]=(S=p==null?void 0:p.exportData())!=null?S:[],E=(A=(d=p==null?void 0:p.exportCustomData)==null?void 0:d.call(p))!=null?A:{},D=ut(g,_),P=J(D,{step:u,stepList:a},{rect:L},E),v=t.imgList.map((C,R)=>{if(R===s){const j=Y.dataCorrection(P,g,u,a);return n(i(n({},C),{result:j}),I)}return C});if(((f=e.payload)==null?void 0:f.submitType)===K.SyncImgList)return i(n({},t),{imgList:v});c&&c([v[s]],(T=e.payload)==null?void 0:T.submitType,s,v);const U=Tt(v,u);return i(n({},t),{stepProgress:U,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 L=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}));L=_t.cloneDeep(u).filter(I=>I.sourceID!==g),L.push(..._)}return i(n({},t),{resultList:L,imgList:o})}case l.SET_BASIC_INDEX:{const{toolInstance:o,step:s,imgList:u,imgIndex:a,stepList:p,annotationEngine:c,resultList:L,basicResultList:g}=t;if(!o||!c)return t;const _=e.payload.basicIndex,I=(h=g[_])==null?void 0:h.id,E=w((b=u[a])==null?void 0:b.result),D=(L||[]).filter(j=>j.sourceID===I),P=x(p,s),{dataSourceStep:v,tool:U}=P,C=x(p,v);let R=[];return v&&U&&(R=(N=E[`step_${v}`])==null?void 0:N.result,(R==null?void 0:R.length)>0?(c==null||c.setBasicInfo(C.tool,R[_]),c==null||c.launchOperation()):(c==null||c.setBasicInfo(C.tool),c==null||c.forbidOperation(),pt.info(G.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=O.getCurrentStepInfo(s,p),{nextIndex:L,imgNode:g,nextBasicIndex:_,imgError:I}=e.payload,E=_!=null?_:0,D=w((V=o[L])==null?void 0:V.result),P=D[`step_${c.step}`],v=!P,U={rotate:(M=D.rotate)!=null?M:0,valid:(k=D.valid)!=null?k:!0};g&&I!==!0?a==null||a.setImgNode(g,U):u==null||u.setValid(U.valid);const C=x(p,c.step),{dataSourceStep:R,tool:j}=C,it=x(p,R),rt=R&&j,B=(H=(F=D[`step_${R}`])==null?void 0:F.result)!=null?H:[],z=Y.getInitialResultList(P==null?void 0:P.result,u,C,B,v);if(a==null||a.launchOperation(),rt&&((B==null?void 0:B.length)>0?a==null||a.setBasicInfo(it.tool,B[E]):(a==null||a.setBasicInfo(it.tool),a==null||a.forbidOperation(),pt.info(G.t("NoDependency")))),c.tool!=="check"){const Lt=(Z=(q=B[E])==null?void 0:q.id)!=null?Z:"",Et=rt?z.filter(St=>yt.isSameSourceID(St.sourceID,Lt)):z;(Q=u==null?void 0:u.history)==null||Q.initRecord(z,!0),u==null||u.setResult(Et)}return i(n({},t),{imgIndex:L,basicIndex:E,basicResultList:B,resultList:z})}case l.UPDATE_ANNOTATION_CONFIG:return i(n({},t),{config:(tt=e.payload.config)!=null?tt:"{}"});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=(et=e.payload)==null?void 0:et.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||(ot=o==null?void 0:o.updateRotate)==null||ot.call(o),t}case l.UPDATE_ANNOTATION_VALID:{const{toolInstance:o}=t,s=(nt=o==null?void 0:o.valid)!=null?nt:!0;return dt.destroyAll(),dt.confirm({content:G.t(s?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{o==null||o.setValid(!s)},okText:G.t("Confirm"),cancelText:G.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=Y.copyResultChange(p,a,(st=u[s].result)!=null?st:"");u[s]=i(n({},u[s]),{result:c});const g=w(c)[`step_${a}`],_=(g==null?void 0:g.result)||[];return o==null||o.setResult(_),o==null||o.history.pushHistory(_),(lt=o==null?void 0:o.asyncData)==null||lt.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=x(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,L=[],g=a.map((_,I)=>{if(at.isInRange(I,u)){const E=i(n({},_),{result:ct.batchUpdateTrackID({id:o,newID:s,result:_.result})});return L.push({imgIndex:I,newInfo:E}),E}return _});return c&&c([g[p]],K.BatchUpdateTrackID,p,g,{updateImgList:L}),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,L=[],g=a.map((_,I)=>{if(at.isInRange(I,u)){const E=i(n({},_),{result:ct.batchUpdateResultByTrackID({id:o,newData:s,result:_.result})});return L.push({imgIndex:I,newInfo:E}),E}return _});return c&&c([g[p]],K.BatchUpdateTrackID,p,g,{updateImgList:L}),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:E}=I;c[E]=_t.pick(I,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const L=`step_${a}`,g=[],_=s.map((I,E)=>{if(c[E]){const D=I.result==="{}"?w(J("",{step:a,stepList:u},{rect:[]},{})):w(I.result);D[L].result.push(c[E]);const P=i(n({},I),{result:JSON.stringify(D)});return g.push({imgIndex:E,newInfo:P}),P}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,x as getStepConfig,Ut as getTotalPage};
|
|
1
|
+
import{getFormatSize as yt}from"../../components/customResizeHook/index.js";import{ESubmitType as K}from"../../constant/index.js";import Rt from"../../constant/styleString.js";import{ANNOTATION_ACTIONS as i}from"../Actions.js";import{jsonParser as x}from"../../utils/index.js";import X from"../../utils/AnnotationDataUtils.js";import{ConfigUtils as Pt}from"../../utils/ConfigUtils.js";import{composeResultWithBasicImgInfo as dt,composeResult as Y}from"../../utils/data.js";import O from"../../utils/StepUtils.js";import J from"../../utils/ToolUtils.js";import{MathUtils as pt,CommonToolUtils as Ct,AnnotationEngine as Ot,ImgUtils as ht}from"@labelbee/lb-annotation";import{PointCloudUtils as gt,i18n as G}from"@labelbee/lb-utils";import{Modal as _t}from"antd";import{message as It}from"antd/es";import mt from"lodash";import{SetAnnotationLoading as $}from"./actionCreators.js";import{EToolName as W}from"../../data/enums/ToolType.js";var bt=Object.defineProperty,Nt=Object.defineProperties,Ut=Object.getOwnPropertyDescriptors,ft=Object.getOwnPropertySymbols,Bt=Object.prototype.hasOwnProperty,xt=Object.prototype.propertyIsEnumerable,Tt=(t,e,u)=>e in t?bt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:u}):t[e]=u,o=(t,e)=>{for(var u in e||(e={}))Bt.call(e,u)&&Tt(t,u,e[u]);if(ft)for(var u of ft(e))xt.call(e,u)&&Tt(t,u,e[u]);return t},l=(t,e)=>Nt(t,Ut(e)),Lt=(t,e,u)=>new Promise((S,d)=>{var A=f=>{try{E(u.next(f))}catch(y){d(y)}},L=f=>{try{E(u.throw(f))}catch(y){d(y)}},E=f=>f.done?S(f.value):Promise.resolve(f.value).then(A,L);E((u=u.apply(t,e)).next())});const w=(t,e)=>t.find(u=>u.step===e),Et={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:""},wt=t=>{const{imgList:e,imgPageSize:u}=t;return Math.ceil(e.length/u)},St=(t,e)=>t.reduce((u,S)=>{if(S){const d=S.result;if(x(d)[`step_${e}`])return u+1}return u},0)/t.length,Ft=(t,e)=>{const{step:u,stepList:S}=t,d=O.getCurrentStepInfo(u,S),A=Pt.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)||[W.LLM,W.NLP].includes(d==null?void 0:d.tool))return;const L=document.getElementById("toolContainer");if(!L)throw"Not exist dom named id-toolContainer";const E=yt({width:window.innerWidth,height:window.innerHeight}),f=new Ot({container:L,toolName:d.tool,size:E,imgNode:e,config:A,style:JSON.parse(Rt)});return{toolInstance:f==null?void 0:f.toolInstance,annotationEngine:f}},jt=(t,e)=>(u,S)=>Lt(void 0,null,function*(){var d,A;const{stepList:L,step:E}=S().annotation,f=O.currentToolIsVideo(E,L),y=O.currentToolIsPointCloud(E,L),h=((d=O.getCurrentStepInfo(E,L))==null?void 0:d.tool)===W.LLM,b=((A=O.getCurrentStepInfo(E,L))==null?void 0:A.tool)===W.NLP,N=O.currentToolIsAudio(E,L);if($(u,!0),yield u(Gt(t)),f){u(Vt(t));return}if(y||h||N||b){u(Mt(t));return}u(kt(t,e))}),Gt=t=>(e,u)=>Lt(void 0,null,function*(){const{getFileData:S,imgList:d}=u().annotation;if(S){const A=yield S(d[t],t);e({type:i.SET_FILE_DATA,payload:{fileData:A,index:t}})}}),Vt=t=>e=>{e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},Mt=t=>e=>{$(e,!1),e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},kt=(t,e)=>(u,S)=>{var d;const{toolInstance:A,imgList:L}=S().annotation,E=(d=L==null?void 0:L[t])==null?void 0:d.url;ht.load(E).then(f=>{$(u,!1),u({type:i.LOAD_FILE_DATA,payload:{imgNode:f,nextIndex:t,nextBasicIndex:e}})}).catch(()=>{$(u,!1),A==null||A.setErrorImg(),u({type:i.LOAD_FILE_DATA,payload:{nextIndex:t,nextBasicIndex:e}})})},Ht=({toolInstance:t,imgList:e,imgIndex:u,stepList:S,step:d=1})=>{var A,L,E,f;const y=((A=e[u])==null?void 0:A.result)||"",[h,b,N]=(L=t==null?void 0:t.exportData())!=null?L:[],V=(f=(E=t==null?void 0:t.exportCustomData)==null?void 0:E.call(t))!=null?f:{},M=dt(y,b),k=Y(M,{step:d,stepList:S},{rect:h},V);return e.map((F,H)=>H===u?o(l(o({},F),{result:k}),N):o({},F))},zt=(t=o({},Et),e)=>{var u,S,d,A,L,E,f,y,h,b,N,V,M,k,F,H,q,Z,Q,tt,et,nt,ot,st,lt,it,rt,ut;switch(e.type){case i.INIT_ALL_STATE:return o(o({},t),Et);case i.UPDATE_TOOL_INSTANCE:return l(o({},t),{toolInstance:e.payload.toolInstance});case i.UPDATE_IMG_LIST:return l(o({},t),{imgList:e.payload.imgList});case i.CALC_STEP_PROGRESS:{const{imgList:n,step:s}=t,r=St(n,s);return l(o({},t),{stepProgress:r})}case i.SUBMIT_FILE_DATA:{const{imgList:n,imgIndex:s,step:r,stepList:a,toolInstance:p,onSubmit:c,resultList:T}=t;if(!p||!n[s])return t;const I=((u=n[s])==null?void 0:u.result)||"",[,g,_]=(S=p==null?void 0:p.exportData())!=null?S:[],m=(A=(d=p==null?void 0:p.exportCustomData)==null?void 0:d.call(p))!=null?A:{},D=dt(I,g),R=Y(D,{step:r,stepList:a},{rect:T},m),v=t.imgList.map((C,P)=>{if(P===s){const j=X.dataCorrection(R,I,r,a);return o(l(o({},C),{result:j}),_)}return C});if(((L=e.payload)==null?void 0:L.submitType)===K.SyncImgList)return l(o({},t),{imgList:v});c&&c([v[s]],(E=e.payload)==null?void 0:E.submitType,s,v);const U=St(v,r);return l(o({},t),{stepProgress:U,imgList:v})}case i.SAVE_RESULT:{const{imgList:n,imgIndex:s,onSave:r}=t;return r==null||r(n[s],s,n),o({},t)}case i.SUBMIT_RESULT:{const{imgList:n,basicIndex:s,resultList:r,toolInstance:a,basicResultList:p}=t;if(!a)return t;const[c]=(f=a==null?void 0:a.exportData())!=null?f:[];let T=c;if((p==null?void 0:p.length)>0){const I=(y=p[s])==null?void 0:y.id,g=c.map(_=>l(o({},_),{sourceID:I}));T=mt.cloneDeep(r).filter(_=>_.sourceID!==I),T.push(...g)}return l(o({},t),{resultList:T,imgList:n})}case i.SET_BASIC_INDEX:{const{toolInstance:n,step:s,imgList:r,imgIndex:a,stepList:p,annotationEngine:c,resultList:T,basicResultList:I}=t;if(!n||!c)return t;const g=e.payload.basicIndex,_=(h=I[g])==null?void 0:h.id,m=x((b=r[a])==null?void 0:b.result),D=(T||[]).filter(j=>j.sourceID===_),R=w(p,s),{dataSourceStep:v,tool:U}=R,C=w(p,v);let P=[];return v&&U&&(P=(N=m[`step_${v}`])==null?void 0:N.result,(P==null?void 0:P.length)>0?(c==null||c.setBasicInfo(C.tool,P[g]),c==null||c.launchOperation()):(c==null||c.setBasicInfo(C.tool),c==null||c.forbidOperation(),It.info(G.t("NoDependency")))),n==null||n.setResult(D),n==null||n.history.initRecord(D,!0),l(o({},t),{basicIndex:g})}case i.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:n}=e.payload;return l(o({},t),{triggerEventAfterIndexChanged:!!n})}case i.LOAD_FILE_DATA:{const{imgList:n,step:s,toolInstance:r,annotationEngine:a,stepList:p}=t;if(!r)return l(o({},t),{imgIndex:e.payload.nextIndex});const c=O.getCurrentStepInfo(s,p),{nextIndex:T,imgNode:I,nextBasicIndex:g,imgError:_}=e.payload,m=g!=null?g:0,D=x((V=n[T])==null?void 0:V.result),R=D[`step_${c.step}`],v=!R,U={rotate:(M=D.rotate)!=null?M:0,valid:(k=D.valid)!=null?k:!0};I&&_!==!0?a==null||a.setImgNode(I,U):r==null||r.setValid(U.valid);const C=w(p,c.step),{dataSourceStep:P,tool:j}=C,at=w(p,P),ct=P&&j,B=(H=(F=D[`step_${P}`])==null?void 0:F.result)!=null?H:[],z=X.getInitialResultList(R==null?void 0:R.result,r,C,B,v);if(a==null||a.launchOperation(),ct&&((B==null?void 0:B.length)>0?a==null||a.setBasicInfo(at.tool,B[m]):(a==null||a.setBasicInfo(at.tool),a==null||a.forbidOperation(),It.info(G.t("NoDependency")))),c.tool!=="check"){const At=(Z=(q=B[m])==null?void 0:q.id)!=null?Z:"",Dt=ct?z.filter(vt=>Ct.isSameSourceID(vt.sourceID,At)):z;(Q=r==null?void 0:r.history)==null||Q.initRecord(z,!0),r==null||r.setResult(Dt)}return l(o({},t),{imgIndex:T,basicIndex:m,basicResultList:B,resultList:z})}case i.UPDATE_ANNOTATION_CONFIG:return l(o({},t),{config:(tt=e.payload.config)!=null?tt:"{}"});case i.SET_TASK_STEP_LIST:{const{stepList:n}=e.payload;return l(o({},t),{stepList:n})}case i.SET_TASK_CONFIG:{const{stepList:n,step:s}=e.payload;return l(o({},t),{stepList:n,step:s})}case i.INIT_TOOL:{const{imgNode:n}=t,s=Ft(t,n);if(s){const{toolInstance:r,annotationEngine:a}=s;return l(o({},t),{toolInstance:r,annotationEngine:a})}return o({},t)}case i.SET_TOOL:{const n=(et=e.payload)==null?void 0:et.instance;return n?l(o({},t),{toolInstance:n}):o({},t)}case i.UPDATE_ON_SUBMIT:return l(o({},t),{onSubmit:e.payload.onSubmit});case i.UPDATE_ON_SAVE:return l(o({},t),{onSave:e.payload.onSave});case i.UPDATE_ON_PAGE_CHANGE:return l(o({},t),{onPageChange:e.payload.onPageChange});case i.SET_PREDICT_RESULT:return l(o({},t),{predictionResult:e.payload.result});case i.SET_PREDICT_RESULT_VISIBLE:return l(o({},t),{predictionResultVisible:e.payload.visible});case i.UPDATE_ON_STEP_CHANGE:return l(o({},t),{onStepChange:e.payload.onStepChange});case i.UPDATE_GET_FILE_DATA:return l(o({},t),{getFileData:e.payload.getFileData});case i.UPDATE_PAGE_SIZE:return l(o({},t),{pageSize:e.payload.pageSize});case i.UPDATE_LOAD_FILE_LIST:return l(o({},t),{loadFileList:e.payload.loadFileList});case i.UPDATE_BEFORE_ROTATE:return l(o({},t),{beforeRotate:e.payload.beforeRotate});case i.UPDATE_PRE_DATA_PROCESS:return l(o({},t),{preDataProcess:e.payload.preDataProcess});case i.UPDATE_IMG_INDEX_BY_EXTERNAL:return l(o({},t),{getImgIndexByExternal:e.payload.getImgIndexByExternal});case i.SKIP_BEFORE_PAGE_TURNING:return l(o({},t),{skipBeforePageTurning:e.payload.skipBeforePageTurning});case i.SET_FILE_DATA:{const{fileData:n,index:s}=e.payload,{imgList:r}=t,a=[...r];return a[s]=o(o({},a[s]),n),l(o({},t),{imgList:a})}case i.UPDATE_ROTATE:{const{toolInstance:n,beforeRotate:s}=t;return s&&s()===!1||(nt=n==null?void 0:n.updateRotate)==null||nt.call(n),t}case i.UPDATE_ANNOTATION_VALID:{const{toolInstance:n}=t,s=(ot=n==null?void 0:n.valid)!=null?ot:!0;return _t.destroyAll(),_t.confirm({content:G.t(s?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{n==null||n.setValid(!s)},okText:G.t("Confirm"),cancelText:G.t("Cancel")}),t}case i.COPY_BACKWARD_RESULT:{const{toolInstance:n,imgIndex:s,imgList:r,step:a,stepList:p}=t;if(!n)return t;if(s===0||s>=r.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),t;const c=r[s-1].result;if(!c)return t;const T=O.getCurrentStepInfo(a,p),I=(st=T==null?void 0:T.step)!=null?st:a,g=X.copyResultChange({copyResult:c,step:I,currentResult:(lt=r[s].result)!=null?lt:"",preMappingImgList:(it=r[s-1].mappingImgList)!=null?it:[],mappingImgList:(rt=r[s].mappingImgList)!=null?rt:[]});r[s]=l(o({},r[s]),{result:g});const m=x(g)[`step_${a}`],D=(m==null?void 0:m.result)||[];return n==null||n.setResult(D),n==null||n.history.pushHistory(D),(ut=n==null?void 0:n.asyncData)==null||ut.call(n,r[s]),l(o({},t),{imgList:[...r]})}case i.SET_STEP:{const{stepList:n,annotationEngine:s}=t,{toStep:r}=e.payload;if(s){const a=w(n,r);return s==null||s.setToolName(a.tool,a.config),l(o({},t),{step:r,toolInstance:s==null?void 0:s.toolInstance})}return l(o({},t),{step:r})}case i.SET_LOADPCDFILE_LOADING:{const{loadPCDFileLoading:n}=e.payload;return l(o({},t),{loadPCDFileLoading:!!n})}case i.SET_LOADING:{const{loading:n}=e.payload;return l(o({},t),{loading:!!n})}case i.SET_POINT_CLOUD_LOADING:{const{pointCloudLoading:n}=e.payload;return l(o({},t),{pointCloudLoading:!!n})}case i.SET_CHECK_MODE:{const{checkMode:n}=e.payload;return l(o({},t),{checkMode:!!n})}case i.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:n}=e.payload;return l(o({},t),{highlightAttribute:n})}case i.BATCH_UPDATE_TRACK_ID:{const{id:n,newID:s,rangeIndex:r,imgList:a}=e.payload,{imgIndex:p,onSubmit:c}=t,T=[],I=a.map((g,_)=>{if(pt.isInRange(_,r)){const m=l(o({},g),{result:gt.batchUpdateTrackID({id:n,newID:s,result:g.result})});return T.push({imgIndex:_,newInfo:m}),m}return g});return c&&c([I[p]],K.BatchUpdateTrackID,p,I,{updateImgList:T}),l(o({},t),{imgList:I})}case i.BATCH_UPDATE_RESULT_BY_TRACK_ID:{const{id:n,newData:s,rangeIndex:r}=e.payload,{imgList:a,imgIndex:p,onSubmit:c}=t,T=[],I=a.map((g,_)=>{if(pt.isInRange(_,r)){const m=l(o({},g),{result:gt.batchUpdateResultByTrackID({id:n,newData:s,result:g.result})});return T.push({imgIndex:_,newInfo:m}),m}return g});return c&&c([I[p]],K.BatchUpdateTrackID,p,I,{updateImgList:T}),l(o({},t),{imgList:I})}case i.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:{const{onSubmit:n,imgList:s,stepList:r,step:a,predictionResult:p}=t,c={};p.forEach(_=>{const{index:m}=_;c[m]=mt.pick(_,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const T=`step_${a}`,I=[],g=s.map((_,m)=>{if(c[m]){const D=_.result==="{}"?x(Y("",{step:a,stepList:r},{rect:[]},{})):x(_.result);D[T].result.push(c[m]);const R=l(o({},_),{result:JSON.stringify(D)});return I.push({imgIndex:m,newInfo:R}),R}return _});return n==null||n(g,K.BatchUpdateImgList,-1,g,{updateImgList:I}),l(o({},t),{imgList:g})}default:return t}};export{jt as LoadFileAndFileData,zt as annotationReducer,Ht as composeResultByToolInstance,w as getStepConfig,wt as getTotalPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{uuid as
|
|
1
|
+
import{uuid as D}from"@labelbee/lb-annotation";import{jsonParser as f}from"./index.js";import{EToolName as m}from"../data/enums/ToolType.js";import I from"lodash";import S from"./StepUtils.js";class y{static traverseDF(t,e,s,i){e(t,s,i),typeof t=="object"&&t!==null&&(Array.isArray(t)?t.forEach((n,r)=>{this.traverseDF(n,e,r,t)}):Object.keys(t).forEach(n=>{this.traverseDF(t[n],e,n,t)}))}static getNextPath(t){var e,s,i;const{prePath:n,preMappingImgList:r,nextMappingImgList:a}=t,c=(s=(e=r==null?void 0:r.find(l=>l.path===n))==null?void 0:e.calib)==null?void 0:s.calName,o=(i=a.find(l=>{var u;return((u=l.calib)==null?void 0:u.calName)===c}))==null?void 0:i.path;return o!=null?o:""}static copyResultItemHandler(t){const{item:e,key:s,parent:i,mappingImgList:n,preMappingImgList:r}=t;s==="id"&&(i.id=D(8,62)),s==="imageName"&&(i.imageName=this.getNextPath({prePath:e,preMappingImgList:r,nextMappingImgList:n}))}static copyResultChange(t){const{copyResult:e,step:s,currentResult:i,mappingImgList:n,preMappingImgList:r}=t;try{const a=f(e),c=f(i),o=`step_${s}`;if(a[o]){const l=a[o];return["result","resultRect"].forEach(d=>{l[d]&&this.traverseDF(l[d],(p,h,g)=>{this.copyResultItemHandler({item:p,key:h,parent:g,mappingImgList:n,preMappingImgList:r})})}),c[o]=l,JSON.stringify(c)}return e}catch(a){return e}}static isResultSourceMatchedDependence(t,e){const s=t==null?void 0:t.map(n=>n.sourceID).sort(),i=e==null?void 0:e.map(n=>n.id).sort();return I.isEqual(s,i)}static deltaUpdateBasicResultList(t,e){const s=t==null?void 0:t.map(i=>i.sourceID).sort();return e.filter(i=>!s.includes(i.id))}static getInitialResultList(t,e,s,i,n){const r=t!=null?t:[];switch(s.tool){case m.Tag:case m.Text:{if(s.dataSourceStep>0){const a=this.deltaUpdateBasicResultList(r,i);if(a.length>0)return r.concat(e.getInitResultList(s.dataSourceStep,a))}return n!==!0?r:e.getInitResultList(s.dataSourceStep,i)}default:return r}}static dataCorrection(t,e,s,i){var n,r;try{const c=`step_${S.getStepInfo(s,i).step}`,o=f(t),l=f(e),u=(n=o[c])==null?void 0:n.result,d=(r=l[c])==null?void 0:r.result;if(!d||I.isEqual(u.sort(this.idCmp),d.sort(this.idCmp)))return t;const p=this.findDeletedIds(u,d);if(p.length===0)return t;const h=s,g=this.getStepKeys(o).sort();return this.deleteRes(o,h,p,g),JSON.stringify(o)}catch(a){return console.error(a),t}}static idCmp(t,e){const s=t.id,i=e.id;return s<i?-1:s>i?1:0}static findDeletedIds(t,e){return this.findDeletedItems(e,t).map(s=>s.id)}static findDeletedItems(t,e){const s=[];return t.forEach(i=>{e.some(r=>r.id===i.id)||s.push(i)}),s}static getStepKeys(t){return Object.keys(t).map(e=>parseInt(e.replace("step_",""),10)).filter(e=>!isNaN(e))}static deleteRes(t,e,s,i){i.forEach(n=>{if(n>e){const r=t[`step_${n}`];if([m.FolderTag,m.Segmentation].includes(r.tool))return;if(r.dataSourceStep===e){const a=[];r.result=r.result.filter(c=>s.includes(c.sourceID)?(a.push(c.id),!1):!0),this.deleteRes(t,n,a,i)}else r.result=r.result.filter(a=>!s.includes(a.sourceID))}})}}export{y as default};
|
package/es/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import g from"lodash";import{pointCloudLidar2image as y}from"@labelbee/lb-annotation";var x=Object.defineProperty,_=Object.defineProperties,O=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,P=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,m=(e,t,n)=>t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))P.call(t,n)&&m(e,n,t[n]);if(h)for(var n of h(t))w.call(t,n)&&m(e,n,t[n]);return e},I=(e,t)=>_(e,O(t));const v=(e,t={})=>{try{return typeof e=="string"?JSON.parse(e):g.isObject(e)?e:t}catch(n){return t}},j=e=>{if(Array.isArray(e))return e.filter(t=>t).join(" ");if(g.isObject(e)){const t=[];return Object.keys(e).forEach(n=>{e[n]&&t.push(n)}),t.join(" ")}return""},l=e=>{let t=Infinity,n=Infinity,r=-Infinity,o=-Infinity;for(const i of e)t=Math.min(t,i.x),n=Math.min(n,i.y),r=Math.max(r,i.x),o=Math.max(o,i.y);return{x:t,y:n,width:r-t,height:o-n}},u=(()=>{const e=(t,n)=>{const r=Math.max(t.x,n.x),o=Math.max(t.y,n.y),i=Math.min(t.x+t.width,n.x+n.width),s=Math.min(t.y+t.height,n.y+n.height),a=i-r,c=s-o;return a>=0&&c>=0?{x:r,y:o,width:a,height:c}:null};return(t,n,r)=>{if(r[n]){const o=r[n].width,i=r[n].height;return e(t,{x:0,y:0,width:o,height:i})!==null}return!1}})(),d=e=>{var t;const{pointCloudBox:n,mappingData:r,imageSizes:o}=e,{transferViewData:i}=(t=y(n,r.calib))!=null?t:{};if(!i)return;const s=i.reduce((p,f)=>f.type==="line"?[...p,...f.pointList]:p,[]),a=I(b({},l(s)),{imageName:r.path});if(u(a,r.path,o))return a},R=e=>{const{pointCloudBox:t,mappingImgList:n,imageSizes:r}=e,i=n.map(s=>d({pointCloudBox:t,mappingData:s,imageSizes:r})).filter(s=>s!==void 0);i.length>0&&Object.assign(t,{rects:i})};export{j as classnames,R as generatePointCloudBoxRects,l as getBoundingRect,d as getRectPointCloudBox,u as isBoundingRectInImage,v as jsonParser};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ViewportProvider as b}from"../../components/customResizeHook/index.js";import{prefix as C}from"../../constant/index.js";import{Spin as A}from"antd";import{Layout as y}from"antd/es";import t,{useState as O}from"react";import V from"./annotationOperation/index.js";import M from"./annotationTips/index.js";import k from"./sidebar/index.js";import h from"./toolFooter/index.js";import F from"./toolHeader/index.js";import{getStepConfig as E}from"../../store/annotation/reducer.js";import I from"../../components/videoAnnotate/index.js";import{connect as
|
|
1
|
+
import{ViewportProvider as b}from"../../components/customResizeHook/index.js";import{prefix as C}from"../../constant/index.js";import{Spin as A}from"antd";import{Layout as y}from"antd/es";import t,{useState as O}from"react";import V from"./annotationOperation/index.js";import M from"./annotationTips/index.js";import k from"./sidebar/index.js";import h from"./toolFooter/index.js";import F from"./toolHeader/index.js";import{getStepConfig as E}from"../../store/annotation/reducer.js";import I from"../../components/videoAnnotate/index.js";import{connect as B}from"react-redux";import g 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 D}from"../../store/ctx.js";import{EToolName as c}from"../../data/enums/ToolType.js";import U from"./LLMLayout/index.js";import z from"./NLPLayout/index.js";import q from"../../components/audioAnnotate/index.js";import{LoadingOutlined as G}from"@ant-design/icons";import{useTranslation as J}from"react-i18next";import{EPointCloudName as K}from"@labelbee/lb-annotation";var Q=Object.defineProperty,T=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,P=(e,o,n)=>o in e?Q(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,i=(e,o)=>{for(var n in o||(o={}))X.call(o,n)&&P(e,n,o[n]);if(T)for(var n of T(o))Y.call(o,n)&&P(e,n,o[n]);return e};const{Sider:Z,Content:p}=y,u=`${C}-layout`,ee=e=>{var o;return t.createElement(t.Fragment,null,e.showTips===!0&&t.createElement(M,{path:e.path,tips:e.tips}),t.createElement(V,i({},e)),t.createElement(h,{style:(o=e.style)==null?void 0:o.footer,mode:e.mode,footer:e==null?void 0:e.footer}))},te=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}))},oe=e=>{var o;const{stepList:n,step:r}=e,a=(o=E(n,r))==null?void 0:o.tool,m=g.isPointCloudTool(a),l=g.isVideoTool(a);return m?t.createElement(te,i({},e)):l?t.createElement(I,{drawLayerSlot:e.drawLayerSlot,footer:e.footer,annotationBefore:e==null?void 0:e.annotationBefore}):t.createElement(ee,i({},e))},f=e=>{var o,n,r;const{t:a}=J(),{stepList:m,step:l}=e,d=(o=E(m,l))==null?void 0:o.tool,s=![c.LLM,c.NLP].includes(d),v=![c.LLM,c.NLP].includes(d),L=[K.PointCloud].includes(d);return t.createElement(b,null,t.createElement(A,{spinning:e.loading,indicator:t.createElement(G,null),tip:t.createElement("span",{style:{marginTop:200}},a("LoadingTips")),delay:500},t.createElement(y,{className:R([u,e.className]),style:(n=e.style)==null?void 0:n.layout},t.createElement("header",{className:`${u}__header`,style:(r=e.style)==null?void 0:r.header},t.createElement(F,{header:e==null?void 0:e.header,headerName:e.headerName,goBack:e.goBack,exportData:e.exportData,hasLangNode:s,hasHeaderOption:v,hasPredictTrackingIcon:L})),e.children)))},ne=e=>{var o,n,r,a,m,l,d;const[s,v]=O(void 0),L=(n=(o=e.style)==null?void 0:o.sider)==null?void 0:n.width,{stepList:x,step:N}=e,_=(r=E(x,N))==null?void 0:r.tool,j=c.LLM===_,w=c.NLP===_,S=g.isAudioTool(_);return j?t.createElement(f,i({},e),t.createElement(U,i({},e))):w?t.createElement(f,i({},e),t.createElement(z,i({},e))):S?t.createElement(f,i({},e),t.createElement(q,i({},e))):t.createElement(f,i({},e),t.createElement(y,{className:H("layout","container")},e==null?void 0:e.leftSider,t.createElement(p,{className:`${u}__content`},t.createElement(oe,i({},e)),t.createElement(W,null)),t.createElement(Z,{className:`${u}__side`,width:(a=s!=null?s:L)!=null?a:240,style:(m=e.style)==null?void 0:m.sider},t.createElement(k,{sider:e==null?void 0:e.sider,enableColorPicker:e==null?void 0:e.enableColorPicker,setSiderWidth:v,propsSiderWidth:(d=(l=e.style)==null?void 0:l.sider)==null?void 0:d.width}))))},le=({annotation:e})=>{var o,n,r;const{imgList:a,loading:m}=e,l=(o=a[e.imgIndex])!=null?o:{};return{path:(r=(n=l==null?void 0:l.path)!=null?n:l==null?void 0:l.url)!=null?r:"",loading:m}};var ie=B(le,null,null,{context:D})(ne);export{ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t,{useRef as d,useState as
|
|
1
|
+
import t,{useRef as d,useState as p}from"react";import{Col as v,Popconfirm as C}from"antd";import{useTranslation as m}from"react-i18next";import{prefix as E}from"../../../../constant/index.js";const y={color:"#CCCCCC"},f=({info:r})=>{const{t:e}=m();return r.key.startsWith("sure")?t.createElement("div",{key:r.key},`${e("ConfirmTo")}${r.name.slice(0)}\uFF1F`):t.createElement("span",null,r.name)},g=({icon:r})=>typeof r=="string"?t.createElement("img",{width:23,height:25,src:r}):r,i=({isHover:r,info:e})=>{const n=!!e.forbidOperation,o=e.key===r&&!n;let a={color:o?"#666fff":""};return n&&(a=y),t.createElement("div",{style:{cursor:n?"not-allowed":"default"},onClick:()=>{var c;return(e==null?void 0:e.forbidConfirm)&&!n&&((c=e==null?void 0:e.onClick)==null?void 0:c.call(e))}},t.createElement("div",{className:"icon"},t.createElement(g,{icon:o?e.hoverSvg:e.imgSvg})),t.createElement("div",{className:"toolName",style:a},e.name))},k=({allOperation:r})=>{const e=d(null),[n,o]=p(null),{t:a}=m(),c=Math.floor(24/r.length);return t.createElement("div",{className:"generalOperation",ref:e},r.map((l,u)=>t.createElement(v,{span:c,key:u,className:"generalOperation-col"},t.createElement("div",{key:l.key,className:"item",onMouseEnter:()=>{o(l.key)},onMouseLeave:()=>{o(null)}},l.forbidConfirm?t.createElement(i,{info:l,isHover:n}):t.createElement(C,{title:t.createElement(f,{info:l}),placement:"topRight",okText:a("Confirm"),cancelText:a("Cancel"),getPopupContainer:()=>{var s;return(s=e.current)!=null?s:document.body},onConfirm:l.onClick,overlayClassName:`${E}-pop-confirm`},t.createElement("div",null,t.createElement(i,{info:l,isHover:n})))))))};export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import i,{useState as P,useRef as A,useEffect as S}from"react";import{connect as w}from"react-redux";import I from"../../../../utils/StepUtils.js";import{useTranslation as R}from"react-i18next";import{LabelBeeContext as D}from"../../../../store/ctx.js";import{prefix as b}from"../../../../constant/index.js";import{jsonParser as B,classnames as H}from"../../../../utils/index.js";import{Row as K,Col as h,Popconfirm as k}from"antd";import{CloseOutlined as F}from"@ant-design/icons";import L from"../../../../components/longText/index.js";var U=Object.defineProperty,M=Object.defineProperties,V=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertySymbols,q=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,T=(n,t,e)=>t in n?U(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,G=(n,t)=>{for(var e in t||(t={}))q.call(t,e)&&T(n,e,t[e]);if(C)for(var e of C(t))z.call(t,e)&&T(n,e,t[e]);return n},J=(n,t)=>M(n,V(t));const c=`${b}-sidebar`,Q=(n,t,e)=>{const l=(n==null?void 0:n.attributeList)||[],m=t.map(a=>{var p,o;const _=((o=(p=l.filter(d=>d.value===a.attribute))==null?void 0:p[0])==null?void 0:o.key)||"";return J(G({},a),{label:_})});return(e==null?void 0:e.length)>0?m.filter(a=>e.includes(a.attribute)):m},W=n=>{var t,e,l;const[m,a]=P(0),p=A(null),{toolInstance:o,checkMode:_,stepInfo:d}=n,{t:u}=R(),y=B(d.config),[g,E]=P("");S(()=>(o&&o.on("changeAttributeSidebar",r=>{a(s=>s+1)}),()=>{o==null||o.unbindAll("changeAttributeSidebar")}),[o,p]);const[x]=o.exportData(),O=(e=(t=x==null?void 0:x[0])==null?void 0:t.textAnnotation)!=null?e:[],f=Q(y,O,(l=o==null?void 0:o.attributeLockList)!=null?l:[]),N=r=>{let s=r===g?"":r;o==null||o.setHighlightKey(s),E(s)},j=r=>{o==null||o.deleteTextAnnotation(r.id)};return(f==null?void 0:f.length)===0?null:i.createElement("div",{className:`${c}__content__NLPList`},f.map((r,s)=>{const $=g===r.id;return i.createElement("div",{key:s,className:H({[`${c}__content__NLPList__item`]:!0,[`${c}__content__NLPList__item__active`]:$}),onClick:()=>N(r.id)},i.createElement(K,{className:`${c}__content__NLPList__item__text`},i.createElement(h,{span:7},i.createElement(L,{text:`${r.label}\uFF0C${u("textTool")}: `,openByText:!0,isToolTips:!0})),i.createElement(h,{span:16,offset:1},i.createElement(L,{text:r.text,openByText:!0,isToolTips:!0}))),!_&&i.createElement(k,{title:u("DeleteCommentConfirm"),placement:"topRight",okText:u("Confirm"),cancelText:u("Cancel"),getPopupContainer:v=>v.parentElement,onConfirm:()=>j(r),overlayClassName:`${b}-pop-confirm`},i.createElement(F,{className:`${c}-pop-remove`,onClick:v=>{v.stopPropagation()}})))}))},X=n=>{var t,e;const l=I.getCurrentStepInfo((t=n.annotation)==null?void 0:t.step,(e=n.annotation)==null?void 0:e.stepList);return{toolInstance:n.annotation.toolInstance,stepInfo:l}};var Y=w(X,null,null,{context:D})(W);export{Y as default,c as sidebarCls};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e,{useState as y,useContext as T,useEffect as j}from"react";import{EditFilled as ot}from"@ant-design/icons";import{ToolIcons as nt}from"../ToolIcons.js";import{EToolName as rt}from"../../../../data/enums/ToolType.js";import{cTool as lt}from"@labelbee/lb-annotation";import{PointCloudContext as D}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as h,Input as it,message as I}from"antd";import st from"../../../../utils/StepUtils.js";import{connect as at}from"react-redux";import{jsonParser as ct,classnames as ut}from"../../../../utils/index.js";import{useStatus as $}from"../../../../components/pointCloudView/hooks/useStatus.js";import{useSingleBox as R}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{useTranslation as k}from"react-i18next";import{LabelBeeContext as dt,useDispatch as mt}from"../../../../store/ctx.js";import pt from"./components/batchUpdateModal/index.js";import ft from"./components/annotatedBox/index.js";import gt from"./components/findTrackIDIndex/index.js";import{EPointCloudSegmentStatus as w,EPointCloudPattern as vt}from"@labelbee/lb-utils";import St from"../../../../components/attributeList/index.js";import{useAttribute as bt}from"../../../../components/pointCloudView/hooks/useAttribute.js";import Ct from"../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js";import _t from"../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js";import Pt from"../../../../assets/annotation/pointCloudTool/circleSelector.svg.js";import xt from"../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js";import Et from"../../../../assets/annotation/rectTool/icon_rect.svg.js";import yt from"../../../../assets/annotation/rectTool/icon_rect_a.svg.js";import{sidebarCls as L}from"../index.js";import{SetTaskStepList as It}from"../../../../store/annotation/actionCreators.js";import{usePointCloudViews as wt}from"../../../../components/pointCloudView/hooks/usePointCloudViews.js";import Lt from"../../../../components/subAttributeList/index.js";var Tt=Object.defineProperty,jt=Object.defineProperties,Dt=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,ht=Object.prototype.hasOwnProperty,kt=Object.prototype.propertyIsEnumerable,z=(o,t,n)=>t in o?Tt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,A=(o,t)=>{for(var n in t||(t={}))ht.call(t,n)&&z(o,n,t[n]);if(U)for(var n of U(t))kt.call(t,n)&&z(o,n,t[n]);return o},V=(o,t)=>jt(o,Dt(t));const At=()=>{const[o,t]=y(!1),n=T(D),{pointCloudBoxList:a}=n,{selectedBox:c,updateSelectedBox:r}=R(),[u,d]=y(""),{t:g}=k(),p=c==null?void 0:c.info.trackID,s=m=>!!a.find(b=>b.trackID===m&&b.id!==(c==null?void 0:c.info.id)),i=(m=!1)=>{const f=parseInt(u,10);if(m&&t(!1),isNaN(f)){I.error(g("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){I.error(g("NotAllowDecimalPointsInTrackID"));return}if(s(f)){I.error(g("DuplicateTrackIDsExist"));return}if(!(f>0)){I.error(g("PositiveIntegerCheck"));return}S(f)};j(()=>{t(!1)},[p]);const S=m=>{var f;const b=r({trackID:m});(f=n==null?void 0:n.topViewInstance)==null||f.updatePolygonList(b!=null?b:[])};return e.createElement("div",{style:{padding:24}},e.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},e.createElement("span",null,g("CurrentBoxTrackIDs")),p&&e.createElement(pt,{id:p,updateCurrentPolygonList:m=>S(m)})),e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"12px"}},o&&p?e.createElement(it,{defaultValue:p,onChange:m=>{d(m.target.value)},disabled:!p,size:"small",onBlur:()=>{i()},onPressEnter:()=>{i(!0)}}):e.createElement("span",null,p),e.createElement(ot,{style:{color:"#999",marginLeft:16,cursor:typeof p!="undefined"?"pointer":"not-allowed"},onClick:()=>{p&&t(!o)}})))},F=({segmentStatus:o,globalPattern:t})=>t===vt.Segmentation&&![w.Edit,w.Ready].includes(o),M=({attributeList:o,subAttributeList:t,toolInstance:n,config:a,stepList:c,stepInfo:r,enableColorPicker:u})=>{const[d,g]=y({segmentStatus:w.Ready}),{selectedBox:p}=R(),s=T(D),{ptSegmentInstance:i}=s,{t:S}=k(),{defaultAttribute:m}=bt(),f=wt(),{isPointCloudSegmentationPattern:b}=$(),J=mt(),W={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};j(()=>{if(!!i)return i.on("syncPointCloudStatus",g),()=>{i.unbind("syncPointCloudStatus",g)}},[i]);const X=(l,C)=>{var _,P,x,B,N;const E=(_=a==null?void 0:a.attributeList)==null?void 0:_.map(v=>v.value===l?V(A({},v),{color:C}):v),O=V(A({},a),{attributeList:E}),tt=JSON.stringify(O),et=c==null?void 0:c.map(v=>(v==null?void 0:v.step)===(r==null?void 0:r.step)?V(A({},v),{config:tt}):v);(P=s==null?void 0:s.topViewInstance)==null||P.updateAttributeList(E),(x=s==null?void 0:s.sideViewInstance)==null||x.updateAttributeList(E),(B=s==null?void 0:s.backViewInstance)==null||B.updateAttributeList(E),(N=s==null?void 0:s.mainViewInstance)==null||N.setConfig(O),J(It({stepList:et}))},Y=l=>{f.updateViewsByDefaultSize&&f.updateViewsByDefaultSize(l)},q=l=>{F({globalPattern:s.globalPattern,segmentStatus:d.segmentStatus})||n.setDefaultAttribute(l)},G=(l,C)=>{F({globalPattern:s.globalPattern,segmentStatus:d.segmentStatus})||n.setSubAttribute(l,C)},K=o.map(l=>({label:l.key,value:l.value,color:l==null?void 0:l.color,limit:l==null?void 0:l.limit,isDefault:l==null?void 0:l.isDefault})),Q=p||d.cacheSegData&&d.segmentStatus===w.Edit,Z=b;return e.createElement("div",{style:{flex:1,overflowX:"hidden",overflowY:"auto"}},e.createElement("div",{style:W},S("Attribute")),e.createElement(St,{list:K,forbidDefault:!0,selectedAttribute:m!=null?m:"",attributeChanged:l=>q(l),updateColorConfig:X,enableColorPicker:u,updateSize:Y,forbidShowLimitPopover:Z}),e.createElement(h,{style:{margin:0}}),Q&&e.createElement(Lt,{subAttributeList:t,setSubAttribute:G,getValue:l=>{var C,_,P,x;return((_=(C=s.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:_[l.value])||((x=(P=d.cacheSegData)==null?void 0:P.subAttribute)==null?void 0:x[l.value])}}))},Vt=[{toolName:"LassoSelector",commonSvg:Ct,selectedSvg:_t},{toolName:"RectSelector",commonSvg:Et,selectedSvg:yt},{toolName:"CircleSelector",commonSvg:Pt,selectedSvg:xt}],H=({toolInstance:o})=>{const{ptSegmentInstance:t}=T(D),[n,a]=y("LassoSelector"),{t:c}=k();return j(()=>{if(!t)return;const r=()=>{a("LassoSelector")},u=()=>{a("RectSelector")},d=()=>{a("CircleSelector")};return t.on("LassoSelector",r),t.on("RectSelector",u),t.on("CircleSelector",d),()=>{t.unbind("LassoSelector",r),t.unbind("RectSelector",u),t.unbind("CircleSelector",d)}},[t]),e.createElement("div",{className:`${L}__level`},Vt.map(r=>{const u=n===r.toolName;return e.createElement("span",{className:`${L}__toolOption`,key:r.toolName,onClick:()=>t==null?void 0:t.emit(r.toolName)},e.createElement("img",{className:`${L}__singleTool`,src:u?r==null?void 0:r.selectedSvg:r==null?void 0:r.commonSvg}),e.createElement("span",{className:ut({[`${L}__toolOption__selected`]:u})},c(r.toolName)))}))},Bt=({stepInfo:o,toolInstance:t,imgList:n,imgIndex:a,stepList:c,enableColorPicker:r})=>{var u,d;const{updatePointCloudPattern:g,pointCloudPattern:p,isPointCloudSegmentationPattern:s}=$(),i=ct(o.config),S=(u=i==null?void 0:i.attributeList)!=null?u:[],m=(i==null?void 0:i.secondaryAttributeConfigurable)===!0?(d=i==null?void 0:i.inputList)!=null?d:[]:[];return s?e.createElement(e.Fragment,null,e.createElement(H,{toolInstance:t}),e.createElement(M,{toolInstance:t,attributeList:S,subAttributeList:m,config:i,stepList:c,stepInfo:o,enableColorPicker:r})):e.createElement(e.Fragment,null,e.createElement(nt,{toolName:lt.EPointCloudName.PointCloud,selectedToolName:p,onChange:f=>g==null?void 0:g(f)}),e.createElement(M,{toolInstance:t,attributeList:S,subAttributeList:m,config:i,stepList:c,stepInfo:o,enableColorPicker:r}),(i==null?void 0:i.trackConfigurable)===!0&&p===rt.Rect&&e.createElement("div",{style:{flexShrink:0,height:280,overflow:"auto"}},e.createElement(At,null),e.createElement(h,{style:{margin:0}}),e.createElement(ft,{imgList:n,imgIndex:a}),e.createElement(h,{style:{margin:0}}),e.createElement(gt,{imgList:n,imgIndex:a})))},Nt=o=>{var t,n,a,c;const r=st.getCurrentStepInfo((t=o.annotation)==null?void 0:t.step,(n=o.annotation)==null?void 0:n.stepList),u=(a=o.annotation)==null?void 0:a.toolInstance,d=(c=o.annotation)==null?void 0:c.stepList;return{stepInfo:r,toolInstance:u,imgList:o.annotation.imgList,imgIndex:o.annotation.imgIndex,stepList:d}};var Ot=at(Nt,null,null,{context:dt})(Bt);export{H as PointCloudSegToolIcon,Ot as default};
|