@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
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Actions=require("../Actions.js"),reducer=require("./reducer.js"),index=require("../../constant/index.js"),AnnotationSize=require("../../data/enums/AnnotationSize.js"),PageOperator=require("../../utils/PageOperator.js"),index$1=require("../../utils/index.js"),util=require("../../components/predictTracking/previewResult/util.js"),__async=(t,e,n)=>new Promise((a,r)=>{var o=s=>{try{u(n.next(s))}catch(i){r(i)}},T=s=>{try{u(n.throw(s))}catch(i){r(i)}},u=s=>s.done?a(s.value):Promise.resolve(s.value).then(o,T);u((n=n.apply(t,e)).next())});const dispatchTasks=(t,e)=>e.map(n=>t(n)),getSubmitByPageOperation=t=>t===AnnotationSize.EPageTurningOperation.Forward?index.ESubmitType.Forward:t===AnnotationSize.EPageTurningOperation.Backward?index.ESubmitType.Backward:t===AnnotationSize.EPageTurningOperation.Jump?index.ESubmitType.Jump:index.ESubmitType.Forward,getBasicIndex=(t,e)=>{var n,a;const{imgList:r,imgIndex:o}=t,{dataSourceStep:T}=reducer.getStepConfig(t.stepList,t.step);return((a=(n=index$1.jsonParser(r[o-1].result)[`step_${T}`])==null?void 0:n.result)==null?void 0:a.length)-1||e};function UpdateToolInstance(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_TOOL_INSTANCE,payload:{toolInstance:t}}}function SetTaskStepList({stepList:t}){return{type:Actions.ANNOTATION_ACTIONS.SET_TASK_STEP_LIST,payload:{stepList:t}}}function SetTaskConfig({stepList:t,step:e}){return{type:Actions.ANNOTATION_ACTIONS.SET_TASK_CONFIG,payload:{stepList:t,step:e}}}function UpdateOnSubmit(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_SUBMIT,payload:{onSubmit:t}}}function UpdateOnSave(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_SAVE,payload:{onSave:t}}}function UpdateOnPageChange(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_PAGE_CHANGE,payload:{onPageChange:t}}}function UpdateOnStepChange(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_STEP_CHANGE,payload:{onStepChange:t}}}function UpdateGetFileData(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_GET_FILE_DATA,payload:{getFileData:t}}}function UpdatePageSize(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_PAGE_SIZE,payload:{pageSize:t}}}function UpdateGetFileList(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_LOAD_FILE_LIST,payload:{loadFileList:t}}}function UpdateRotate(){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ROTATE}}function UpdateSkipBeforePageTurning(t){return{type:Actions.ANNOTATION_ACTIONS.SKIP_BEFORE_PAGE_TURNING,payload:{skipBeforePageTurning:t}}}function UpdateBeforeRotate(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_BEFORE_ROTATE,payload:{beforeRotate:t}}}function UpdatePreDataProcess(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_PRE_DATA_PROCESS,payload:{preDataProcess:t}}}function CopyBackWordResult(){return{type:Actions.ANNOTATION_ACTIONS.COPY_BACKWARD_RESULT}}function BatchUpdateTrackID({id:t,newID:e,rangeIndex:n,imgList:a}){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_TRACK_ID,payload:{id:t,newID:e,rangeIndex:n,imgList:a}}}function BatchUpdateResultByTrackID(t,e,n){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_RESULT_BY_TRACK_ID,payload:{id:t,newData:e,rangeIndex:n}}}function BatchUpdateImgListResultByPredictResult(){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT,payload:{}}}const UpdateCheckMode=t=>({type:Actions.ANNOTATION_ACTIONS.SET_CHECK_MODE,payload:{checkMode:t}}),UpdateHighlightAttribute=t=>({type:Actions.ANNOTATION_ACTIONS.SET_HIGHLIGHT_ATTRIBUTE,payload:{attribute:t}});function InitTaskData({onSubmit:t,onSave:e,onPageChange:n,onStepChange:a,getFileData:r,pageSize:o,loadFileList:T,step:u,stepList:s,skipBeforePageTurning:i,beforeRotate:N,checkMode:p,highlightAttribute:I,preDataProcess:O}){const A=[];return t&&A.push(UpdateOnSubmit(t)),e&&A.push(UpdateOnSave(e)),n&&A.push(UpdateOnPageChange(n)),a&&A.push(UpdateOnStepChange(a)),r&&A.push(UpdateGetFileData(r)),T&&A.push(UpdateGetFileList(T)),o&&A.push(UpdatePageSize(o)),i&&A.push(UpdateSkipBeforePageTurning(i)),N&&A.push(UpdateBeforeRotate(N)),O&&A.push(UpdatePreDataProcess(O)),typeof p=="boolean"&&A.push(UpdateCheckMode(p)),A.push(UpdateHighlightAttribute(I)),A.push(SetTaskConfig({stepList:s,step:u})),A.push({type:Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS}),A.push({type:Actions.ANNOTATION_ACTIONS.INIT_TOOL}),d=>dispatchTasks(d,A)}function UpdateInjectFunc({onSubmit:t,onSave:e,onPageChange:n,onStepChange:a,getFileData:r,pageSize:o,loadFileList:T,stepList:u,beforeRotate:s,highlightAttribute:i,preDataProcess:N}){const p=[];return t&&p.push(UpdateOnSubmit(t)),e&&p.push(UpdateOnSave(e)),n&&p.push(UpdateOnPageChange(n)),a&&p.push(UpdateOnStepChange(a)),r&&p.push(UpdateGetFileData(r)),T&&p.push(UpdateGetFileList(T)),o&&p.push(UpdatePageSize(o)),s&&p.push(UpdateBeforeRotate(s)),N&&p.push(UpdatePreDataProcess(N)),p.push(UpdateHighlightAttribute(i)),p.push(SetTaskStepList({stepList:u})),I=>dispatchTasks(I,p)}const getNextStep=(t,e)=>{var n;const a=e==null?void 0:e.findIndex(r=>(r==null?void 0:r.step)===t);return(n=e[a+1])==null?void 0:n.step},ToNextStep=t=>(e,n)=>{const{annotation:a}=n(),{step:r,stepList:o}=a,T=getNextStep(r,o);return[e(UpdateProcessingStep(T,t))]},UpdateProcessingStep=(t,e)=>(n,a)=>{var r,o;const{annotation:T}=a();(r=T==null?void 0:T.onStepChange)==null||r.call(T,t);const u=(o=T==null?void 0:T.imgIndex)!=null?o:0;return[n({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),n({type:Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA,payload:{submitType:index.ESubmitType.StepChanged}}),n({type:Actions.ANNOTATION_ACTIONS.SET_STEP,payload:{toStep:t}}),n({type:Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS}),n(reducer.LoadFileAndFileData(e!=null?e:u,0))]},ToSubmitFileData=t=>e=>[e({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),e({type:Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA,payload:{submitType:t}})],SubmitAndChangeFileIndex=(t,e,n,a)=>[t(ToSubmitFileData(n)),t(reducer.LoadFileAndFileData(e,a))],ChangeBasicIndex=(t,e)=>[t({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),t({type:Actions.ANNOTATION_ACTIONS.SET_BASIC_INDEX,payload:{basicIndex:e}})],ChangeTriggerEventAfterIndexChanged=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED,payload:{triggerEventAfterIndexChanged:e}})},PageBackward=(t=!1)=>(e,n)=>DispatcherTurning(e,n,AnnotationSize.EPageTurningOperation.Backward,t),PageForward=(t=!1)=>(e,n)=>DispatcherTurning(e,n,AnnotationSize.EPageTurningOperation.Forward,t),PageJump=(t,e=!1)=>(n,a)=>{if(t!==a().imgIndex)return DispatcherTurning(n,a,AnnotationSize.EPageTurningOperation.Jump,e,t)},loadImgList=(t,e,n,a)=>__async(void 0,null,function*(){var r;const{loadFileList:o,imgList:T,pageSize:u}=e().annotation,s=Math.floor(n/u);SetAnnotationLoading(t,!0);try{const i=yield o(s,u);if(SetAnnotationLoading(t,!1),!((r=i==null?void 0:i.fileList)==null?void 0:r.length)||!(i==null?void 0:i.total))throw new Error("fileList and total are required");const N=a?new Array(i.total):[...T];return N.splice(s*u,u,...i.fileList),t({type:Actions.ANNOTATION_ACTIONS.UPDATE_IMG_LIST,payload:{imgList:N}}),!0}catch(i){SetAnnotationLoading(t,!1),console.error(i)}}),DispatcherTurning=(t,e,n,a=!1,r)=>__async(void 0,null,function*(){var o;const T=e().annotation,{fileIndexChanged:u,fileIndex:s,basicIndexChanged:i,basicIndex:N}=PageOperator.getNextPageInfo(n,T,r),p=getSubmitByPageOperation(n);if(ChangeTriggerEventAfterIndexChanged(t,a),u){if(T.loading||!T.imgList[s]&&!(yield loadImgList(t,e,s)))return;(o=T.onPageChange)==null||o.call(T,s);const I=p===index.ESubmitType.Backward?getBasicIndex(e().annotation,N):N;return SubmitAndChangeFileIndex(t,s,p,I)}return i?ChangeBasicIndex(t,N):t(ToSubmitFileData(p))}),ChangeSave=t=>{t(ToSubmitFileData(index.ESubmitType.Save)),t({type:Actions.ANNOTATION_ACTIONS.SAVE_RESULT})},SetAnnotationLoading=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_LOADING,payload:{loading:e}})},SetPointCloudLoading=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_LOADING,payload:{loading:e}})},SetLoadPCDFileLoading=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_LOADPCDFILE_LOADING,payload:{loadPCDFileLoading:e}})},InitAnnotationState=t=>{t({type:Actions.ANNOTATION_ACTIONS.INIT_ALL_STATE,payload:{}})},SetPredictResult=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT,payload:{result:e}})},SetPredictResultVisible=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT_VISIBLE,payload:{visible:e}})},GetBoxesByID=(t,e)=>(n,a)=>{const{imgList:r,step:o}=a().annotation;return util.getBoxesByTrackID(r,o,t,e)},PreDataProcess=t=>(e,n)=>{var a,r;const{annotation:o}=n();return(r=(a=o==null?void 0:o.preDataProcess)==null?void 0:a.call(o,t))!=null?r:t.dataList};exports.BatchUpdateImgListResultByPredictResult=BatchUpdateImgListResultByPredictResult,exports.BatchUpdateResultByTrackID=BatchUpdateResultByTrackID,exports.BatchUpdateTrackID=BatchUpdateTrackID,exports.ChangeSave=ChangeSave,exports.CopyBackWordResult=CopyBackWordResult,exports.DispatcherTurning=DispatcherTurning,exports.GetBoxesByID=GetBoxesByID,exports.InitAnnotationState=InitAnnotationState,exports.InitTaskData=InitTaskData,exports.PageBackward=PageBackward,exports.PageForward=PageForward,exports.PageJump=PageJump,exports.PreDataProcess=PreDataProcess,exports.SetAnnotationLoading=SetAnnotationLoading,exports.SetLoadPCDFileLoading=SetLoadPCDFileLoading,exports.SetPointCloudLoading=SetPointCloudLoading,exports.SetPredictResult=SetPredictResult,exports.SetPredictResultVisible=SetPredictResultVisible,exports.SetTaskConfig=SetTaskConfig,exports.SetTaskStepList=SetTaskStepList,exports.ToNextStep=ToNextStep,exports.ToSubmitFileData=ToSubmitFileData,exports.UpdateBeforeRotate=UpdateBeforeRotate,exports.UpdateCheckMode=UpdateCheckMode,exports.UpdateGetFileData=UpdateGetFileData,exports.UpdateGetFileList=UpdateGetFileList,exports.UpdateHighlightAttribute=UpdateHighlightAttribute,exports.UpdateInjectFunc=UpdateInjectFunc,exports.UpdateOnPageChange=UpdateOnPageChange,exports.UpdateOnSave=UpdateOnSave,exports.UpdateOnStepChange=UpdateOnStepChange,exports.UpdateOnSubmit=UpdateOnSubmit,exports.UpdatePageSize=UpdatePageSize,exports.UpdatePreDataProcess=UpdatePreDataProcess,exports.UpdateProcessingStep=UpdateProcessingStep,exports.UpdateRotate=UpdateRotate,exports.UpdateSkipBeforePageTurning=UpdateSkipBeforePageTurning,exports.UpdateToolInstance=UpdateToolInstance,exports.loadImgList=loadImgList;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Actions=require("../Actions.js"),reducer=require("./reducer.js"),index=require("../../constant/index.js"),AnnotationSize=require("../../data/enums/AnnotationSize.js"),PageOperator=require("../../utils/PageOperator.js"),index$1=require("../../utils/index.js"),util=require("../../components/predictTracking/previewResult/util.js"),__async=(t,e,n)=>new Promise((a,r)=>{var T=s=>{try{o(n.next(s))}catch(p){r(p)}},i=s=>{try{o(n.throw(s))}catch(p){r(p)}},o=s=>s.done?a(s.value):Promise.resolve(s.value).then(T,i);o((n=n.apply(t,e)).next())});const dispatchTasks=(t,e)=>e.map(n=>t(n)),getSubmitByPageOperation=t=>t===AnnotationSize.EPageTurningOperation.Forward?index.ESubmitType.Forward:t===AnnotationSize.EPageTurningOperation.Backward?index.ESubmitType.Backward:t===AnnotationSize.EPageTurningOperation.Jump?index.ESubmitType.Jump:index.ESubmitType.Forward,getBasicIndex=(t,e)=>{var n,a,r;const{imgList:T,imgIndex:i}=t,{dataSourceStep:o}=reducer.getStepConfig(t.stepList,t.step);return((r=(a=index$1.jsonParser((n=T[i-1])==null?void 0:n.result)[`step_${o}`])==null?void 0:a.result)==null?void 0:r.length)-1||e};function UpdateToolInstance(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_TOOL_INSTANCE,payload:{toolInstance:t}}}function SetTaskStepList({stepList:t}){return{type:Actions.ANNOTATION_ACTIONS.SET_TASK_STEP_LIST,payload:{stepList:t}}}function SetTaskConfig({stepList:t,step:e}){return{type:Actions.ANNOTATION_ACTIONS.SET_TASK_CONFIG,payload:{stepList:t,step:e}}}function UpdateOnSubmit(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_SUBMIT,payload:{onSubmit:t}}}function UpdateOnSave(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_SAVE,payload:{onSave:t}}}function UpdateOnPageChange(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_PAGE_CHANGE,payload:{onPageChange:t}}}function UpdateOnStepChange(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ON_STEP_CHANGE,payload:{onStepChange:t}}}function UpdateGetFileData(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_GET_FILE_DATA,payload:{getFileData:t}}}function UpdatePageSize(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_PAGE_SIZE,payload:{pageSize:t}}}function UpdateGetFileList(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_LOAD_FILE_LIST,payload:{loadFileList:t}}}function UpdateRotate(){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_ROTATE}}function UpdateSkipBeforePageTurning(t){return{type:Actions.ANNOTATION_ACTIONS.SKIP_BEFORE_PAGE_TURNING,payload:{skipBeforePageTurning:t}}}function UpdateBeforeRotate(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_BEFORE_ROTATE,payload:{beforeRotate:t}}}function UpdatePreDataProcess(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_PRE_DATA_PROCESS,payload:{preDataProcess:t}}}function CopyBackWordResult(){return{type:Actions.ANNOTATION_ACTIONS.COPY_BACKWARD_RESULT}}function UpdateImgIndexByExternal(t){return{type:Actions.ANNOTATION_ACTIONS.UPDATE_IMG_INDEX_BY_EXTERNAL,payload:{getImgIndexByExternal:t}}}function BatchUpdateTrackID({id:t,newID:e,rangeIndex:n,imgList:a}){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_TRACK_ID,payload:{id:t,newID:e,rangeIndex:n,imgList:a}}}function BatchUpdateResultByTrackID(t,e,n){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_RESULT_BY_TRACK_ID,payload:{id:t,newData:e,rangeIndex:n}}}function BatchUpdateImgListResultByPredictResult(){return{type:Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT,payload:{}}}const UpdateCheckMode=t=>({type:Actions.ANNOTATION_ACTIONS.SET_CHECK_MODE,payload:{checkMode:t}}),UpdateHighlightAttribute=t=>({type:Actions.ANNOTATION_ACTIONS.SET_HIGHLIGHT_ATTRIBUTE,payload:{attribute:t}});function InitTaskData({onSubmit:t,onSave:e,onPageChange:n,onStepChange:a,getFileData:r,pageSize:T,loadFileList:i,step:o,stepList:s,skipBeforePageTurning:p,beforeRotate:N,checkMode:A,highlightAttribute:I,preDataProcess:d,getImgIndexByExternal:l}){const u=[];return t&&u.push(UpdateOnSubmit(t)),e&&u.push(UpdateOnSave(e)),n&&u.push(UpdateOnPageChange(n)),a&&u.push(UpdateOnStepChange(a)),r&&u.push(UpdateGetFileData(r)),i&&u.push(UpdateGetFileList(i)),T&&u.push(UpdatePageSize(T)),p&&u.push(UpdateSkipBeforePageTurning(p)),N&&u.push(UpdateBeforeRotate(N)),d&&u.push(UpdatePreDataProcess(d)),typeof A=="boolean"&&u.push(UpdateCheckMode(A)),l&&u.push(UpdateImgIndexByExternal(l)),u.push(UpdateHighlightAttribute(I)),u.push(SetTaskConfig({stepList:s,step:o})),u.push({type:Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS}),u.push({type:Actions.ANNOTATION_ACTIONS.INIT_TOOL}),O=>dispatchTasks(O,u)}function UpdateInjectFunc({onSubmit:t,onSave:e,onPageChange:n,onStepChange:a,getFileData:r,pageSize:T,loadFileList:i,stepList:o,beforeRotate:s,highlightAttribute:p,preDataProcess:N}){const A=[];return t&&A.push(UpdateOnSubmit(t)),e&&A.push(UpdateOnSave(e)),n&&A.push(UpdateOnPageChange(n)),a&&A.push(UpdateOnStepChange(a)),r&&A.push(UpdateGetFileData(r)),i&&A.push(UpdateGetFileList(i)),T&&A.push(UpdatePageSize(T)),s&&A.push(UpdateBeforeRotate(s)),N&&A.push(UpdatePreDataProcess(N)),A.push(UpdateHighlightAttribute(p)),A.push(SetTaskStepList({stepList:o})),I=>dispatchTasks(I,A)}const getNextStep=(t,e)=>{var n;const a=e==null?void 0:e.findIndex(r=>(r==null?void 0:r.step)===t);return(n=e[a+1])==null?void 0:n.step},ToNextStep=t=>(e,n)=>{const{annotation:a}=n(),{step:r,stepList:T}=a,i=getNextStep(r,T);return[e(UpdateProcessingStep(i,t))]},UpdateProcessingStep=(t,e)=>(n,a)=>{var r,T;const{annotation:i}=a();(r=i==null?void 0:i.onStepChange)==null||r.call(i,t);const o=(T=i==null?void 0:i.imgIndex)!=null?T:0;return[n({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),n({type:Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA,payload:{submitType:index.ESubmitType.StepChanged}}),n({type:Actions.ANNOTATION_ACTIONS.SET_STEP,payload:{toStep:t}}),n({type:Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS}),n(reducer.LoadFileAndFileData(e!=null?e:o,0))]},ToSubmitFileData=t=>e=>[e({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),e({type:Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA,payload:{submitType:t}})],SubmitAndChangeFileIndex=(t,e,n,a)=>[t(ToSubmitFileData(n)),t(reducer.LoadFileAndFileData(e,a))],ChangeBasicIndex=(t,e)=>[t({type:Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT}),t({type:Actions.ANNOTATION_ACTIONS.SET_BASIC_INDEX,payload:{basicIndex:e}})],ChangeTriggerEventAfterIndexChanged=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED,payload:{triggerEventAfterIndexChanged:e}})},PageBackward=(t=!1)=>(e,n)=>DispatcherTurning(e,n,AnnotationSize.EPageTurningOperation.Backward,t),PageForward=(t=!1)=>(e,n)=>DispatcherTurning(e,n,AnnotationSize.EPageTurningOperation.Forward,t),PageJump=(t,e=!1)=>(n,a)=>{if(t!==a().imgIndex)return DispatcherTurning(n,a,AnnotationSize.EPageTurningOperation.Jump,e,t)},loadImgList=(t,e,n,a)=>__async(void 0,null,function*(){var r;const{loadFileList:T,imgList:i,pageSize:o}=e().annotation,s=Math.floor(n/o);SetAnnotationLoading(t,!0);try{const p=yield T(s,o);if(SetAnnotationLoading(t,!1),!((r=p==null?void 0:p.fileList)==null?void 0:r.length)||!(p==null?void 0:p.total))throw new Error("fileList and total are required");const N=a?new Array(p.total):[...i];return N.splice(s*o,o,...p.fileList),t({type:Actions.ANNOTATION_ACTIONS.UPDATE_IMG_LIST,payload:{imgList:N}}),!0}catch(p){SetAnnotationLoading(t,!1),console.error(p)}}),DispatcherTurning=(t,e,n,a=!1,r)=>__async(void 0,null,function*(){var T,i;const o=e().annotation,s=getSubmitByPageOperation(n);let{fileIndexChanged:p,fileIndex:N,basicIndexChanged:A,basicIndex:I}=PageOperator.getNextPageInfo(n,o,r);const d=(T=o==null?void 0:o.getImgIndexByExternal)==null?void 0:T.call(o,o.imgIndex,s);if(d!==void 0&&(p=!0,N=d),ChangeTriggerEventAfterIndexChanged(t,a),p){if(o.loading||!o.imgList[N]&&!(yield loadImgList(t,e,N)))return;(i=o.onPageChange)==null||i.call(o,N);const l=s===index.ESubmitType.Backward?getBasicIndex(e().annotation,I):I;return SubmitAndChangeFileIndex(t,N,s,l)}return A?ChangeBasicIndex(t,I):t(ToSubmitFileData(s))}),ChangeSave=t=>{t(ToSubmitFileData(index.ESubmitType.Save)),t({type:Actions.ANNOTATION_ACTIONS.SAVE_RESULT})},SetAnnotationLoading=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_LOADING,payload:{loading:e}})},SetPointCloudLoading=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_LOADING,payload:{loading:e}})},SetLoadPCDFileLoading=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_LOADPCDFILE_LOADING,payload:{loadPCDFileLoading:e}})},InitAnnotationState=t=>{t({type:Actions.ANNOTATION_ACTIONS.INIT_ALL_STATE,payload:{}})},SetPredictResult=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT,payload:{result:e}})},SetPredictResultVisible=(t,e)=>{t({type:Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT_VISIBLE,payload:{visible:e}})},GetBoxesByID=(t,e)=>(n,a)=>{const{imgList:r,step:T}=a().annotation;return util.getBoxesByTrackID(r,T,t,e)},PreDataProcess=t=>(e,n)=>{var a,r;const{annotation:T}=n();return(r=(a=T==null?void 0:T.preDataProcess)==null?void 0:a.call(T,t))!=null?r:t.dataList};exports.BatchUpdateImgListResultByPredictResult=BatchUpdateImgListResultByPredictResult,exports.BatchUpdateResultByTrackID=BatchUpdateResultByTrackID,exports.BatchUpdateTrackID=BatchUpdateTrackID,exports.ChangeSave=ChangeSave,exports.CopyBackWordResult=CopyBackWordResult,exports.DispatcherTurning=DispatcherTurning,exports.GetBoxesByID=GetBoxesByID,exports.InitAnnotationState=InitAnnotationState,exports.InitTaskData=InitTaskData,exports.PageBackward=PageBackward,exports.PageForward=PageForward,exports.PageJump=PageJump,exports.PreDataProcess=PreDataProcess,exports.SetAnnotationLoading=SetAnnotationLoading,exports.SetLoadPCDFileLoading=SetLoadPCDFileLoading,exports.SetPointCloudLoading=SetPointCloudLoading,exports.SetPredictResult=SetPredictResult,exports.SetPredictResultVisible=SetPredictResultVisible,exports.SetTaskConfig=SetTaskConfig,exports.SetTaskStepList=SetTaskStepList,exports.ToNextStep=ToNextStep,exports.ToSubmitFileData=ToSubmitFileData,exports.UpdateBeforeRotate=UpdateBeforeRotate,exports.UpdateCheckMode=UpdateCheckMode,exports.UpdateGetFileData=UpdateGetFileData,exports.UpdateGetFileList=UpdateGetFileList,exports.UpdateHighlightAttribute=UpdateHighlightAttribute,exports.UpdateImgIndexByExternal=UpdateImgIndexByExternal,exports.UpdateInjectFunc=UpdateInjectFunc,exports.UpdateOnPageChange=UpdateOnPageChange,exports.UpdateOnSave=UpdateOnSave,exports.UpdateOnStepChange=UpdateOnStepChange,exports.UpdateOnSubmit=UpdateOnSubmit,exports.UpdatePageSize=UpdatePageSize,exports.UpdatePreDataProcess=UpdatePreDataProcess,exports.UpdateProcessingStep=UpdateProcessingStep,exports.UpdateRotate=UpdateRotate,exports.UpdateSkipBeforePageTurning=UpdateSkipBeforePageTurning,exports.UpdateToolInstance=UpdateToolInstance,exports.loadImgList=loadImgList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$2=require("../../components/customResizeHook/index.js"),index$1=require("../../constant/index.js"),styleString=require("../../constant/styleString.js"),Actions=require("../Actions.js"),index=require("../../utils/index.js"),AnnotationDataUtils=require("../../utils/AnnotationDataUtils.js"),ConfigUtils=require("../../utils/ConfigUtils.js"),data=require("../../utils/data.js"),StepUtils=require("../../utils/StepUtils.js"),ToolUtils=require("../../utils/ToolUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),antd=require("antd"),es=require("antd/es"),_=require("lodash"),actionCreators=require("./actionCreators.js"),ToolType=require("../../data/enums/ToolType.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,s)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,__spreadValues=(e,t)=>{for(var s in t||(t={}))__hasOwnProp.call(t,s)&&__defNormalProp(e,s,t[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(t))__propIsEnum.call(t,s)&&__defNormalProp(e,s,t[s]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,s)=>new Promise((g,u)=>{var S=I=>{try{N(s.next(I))}catch(m){u(m)}},A=I=>{try{N(s.throw(I))}catch(m){u(m)}},N=I=>I.done?g(I.value):Promise.resolve(I.value).then(S,A);N((s=s.apply(e,t)).next())});const getStepConfig=(e,t)=>e.find(s=>s.step===t),initialState={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:""},getTotalPage=e=>{const{imgList:t,imgPageSize:s}=e;return Math.ceil(t.length/s)},calcStepProgress=(e,t)=>e.reduce((s,g)=>{if(g){const u=g.result;if(index.jsonParser(u)[`step_${t}`])return s+1}return s},0)/e.length,updateToolInstance=(e,t)=>{const{step:s,stepList:g}=e,u=StepUtils.getCurrentStepInfo(s,g),S=ConfigUtils.ConfigUtils.jsonParser(u.config);if(ToolUtils.isVideoTool(u==null?void 0:u.tool)||ToolUtils.isAudioTool(u==null?void 0:u.tool)||ToolUtils.isPointCloudTool(u==null?void 0:u.tool)||[ToolType.EToolName.LLM,ToolType.EToolName.NLP].includes(u==null?void 0:u.tool))return;const A=document.getElementById("toolContainer");if(!A)throw"Not exist dom named id-toolContainer";const N=index$2.getFormatSize({width:window.innerWidth,height:window.innerHeight}),I=new lbAnnotation.AnnotationEngine({container:A,toolName:u.tool,size:N,imgNode:t,config:S,style:JSON.parse(styleString)});return{toolInstance:I==null?void 0:I.toolInstance,annotationEngine:I}},LoadFileAndFileData=(e,t)=>(s,g)=>__async(void 0,null,function*(){var u,S;const{stepList:A,step:N}=g().annotation,I=StepUtils.currentToolIsVideo(N,A),m=StepUtils.currentToolIsPointCloud(N,A),D=((u=StepUtils.getCurrentStepInfo(N,A))==null?void 0:u.tool)===ToolType.EToolName.LLM,y=((S=StepUtils.getCurrentStepInfo(N,A))==null?void 0:S.tool)===ToolType.EToolName.NLP,P=StepUtils.currentToolIsAudio(N,A);if(actionCreators.SetAnnotationLoading(s,!0),yield s(TryGetFileDataByAPI(e)),I){s(AfterVideoLoaded(e));return}if(m||D||P||y){s(AfterCommonLoaded(e));return}s(AfterImageLoaded(e,t))}),TryGetFileDataByAPI=e=>(t,s)=>__async(void 0,null,function*(){const{getFileData:g,imgList:u}=s().annotation;if(g){const S=yield g(u[e],e);t({type:Actions.ANNOTATION_ACTIONS.SET_FILE_DATA,payload:{fileData:S,index:e}})}}),AfterVideoLoaded=e=>t=>{t({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{nextIndex:e}})},AfterCommonLoaded=e=>t=>{actionCreators.SetAnnotationLoading(t,!1),t({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{nextIndex:e}})},AfterImageLoaded=(e,t)=>(s,g)=>{var u;const{toolInstance:S,imgList:A}=g().annotation,N=(u=A==null?void 0:A[e])==null?void 0:u.url;lbAnnotation.ImgUtils.load(N).then(I=>{actionCreators.SetAnnotationLoading(s,!1),s({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{imgNode:I,nextIndex:e,nextBasicIndex:t}})}).catch(()=>{actionCreators.SetAnnotationLoading(s,!1),S==null||S.setErrorImg(),s({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{nextIndex:e,nextBasicIndex:t}})})},composeResultByToolInstance=({toolInstance:e,imgList:t,imgIndex:s,stepList:g,step:u=1})=>{var S,A,N,I;const m=((S=t[s])==null?void 0:S.result)||"",[D,y,P]=(A=e==null?void 0:e.exportData())!=null?A:[],x=(I=(N=e==null?void 0:e.exportCustomData)==null?void 0:N.call(e))!=null?I:{},B=data.composeResultWithBasicImgInfo(m,y),w=data.composeResult(B,{step:u,stepList:g},{rect:D},x);return t.map((b,F)=>F===s?__spreadValues(__spreadProps(__spreadValues({},b),{result:w}),P):__spreadValues({},b))},annotationReducer=(e=__spreadValues({},initialState),t)=>{var s,g,u,S,A,N,I,m,D,y,P,x,B,w,b,F,G,V,M,q,k,H,z,K,W;switch(t.type){case Actions.ANNOTATION_ACTIONS.INIT_ALL_STATE:return __spreadValues(__spreadValues({},e),initialState);case Actions.ANNOTATION_ACTIONS.UPDATE_TOOL_INSTANCE:return __spreadProps(__spreadValues({},e),{toolInstance:t.payload.toolInstance});case Actions.ANNOTATION_ACTIONS.UPDATE_IMG_LIST:return __spreadProps(__spreadValues({},e),{imgList:t.payload.imgList});case Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS:{const{imgList:n,step:o}=e,l=calcStepProgress(n,o);return __spreadProps(__spreadValues({},e),{stepProgress:l})}case Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA:{const{imgList:n,imgIndex:o,step:l,stepList:i,toolInstance:a,onSubmit:r,resultList:p}=e;if(!a||!n[o])return e;const d=((s=n[o])==null?void 0:s.result)||"",[,c,T]=(g=a==null?void 0:a.exportData())!=null?g:[],O=(S=(u=a==null?void 0:a.exportCustomData)==null?void 0:u.call(a))!=null?S:{},f=data.composeResultWithBasicImgInfo(d,c),C=data.composeResult(f,{step:l,stepList:i},{rect:p},O),L=e.imgList.map((v,E)=>{if(E===o){const U=AnnotationDataUtils.dataCorrection(C,d,l,i);return __spreadValues(__spreadProps(__spreadValues({},v),{result:U}),T)}return v});if(((A=t.payload)==null?void 0:A.submitType)===index$1.ESubmitType.SyncImgList)return __spreadProps(__spreadValues({},e),{imgList:L});r&&r([L[o]],(N=t.payload)==null?void 0:N.submitType,o,L);const R=calcStepProgress(L,l);return __spreadProps(__spreadValues({},e),{stepProgress:R,imgList:L})}case Actions.ANNOTATION_ACTIONS.SAVE_RESULT:{const{imgList:n,imgIndex:o,onSave:l}=e;return l==null||l(n[o],o,n),__spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT:{const{imgList:n,basicIndex:o,resultList:l,toolInstance:i,basicResultList:a}=e;if(!i)return e;const[r]=(I=i==null?void 0:i.exportData())!=null?I:[];let p=r;if((a==null?void 0:a.length)>0){const d=(m=a[o])==null?void 0:m.id,c=r.map(T=>__spreadProps(__spreadValues({},T),{sourceID:d}));p=___default.default.cloneDeep(l).filter(T=>T.sourceID!==d),p.push(...c)}return __spreadProps(__spreadValues({},e),{resultList:p,imgList:n})}case Actions.ANNOTATION_ACTIONS.SET_BASIC_INDEX:{const{toolInstance:n,step:o,imgList:l,imgIndex:i,stepList:a,annotationEngine:r,resultList:p,basicResultList:d}=e;if(!n||!r)return e;const c=t.payload.basicIndex,T=(D=d[c])==null?void 0:D.id,O=index.jsonParser((y=l[i])==null?void 0:y.result),f=(p||[]).filter(U=>U.sourceID===T),C=getStepConfig(a,o),{dataSourceStep:L,tool:R}=C,v=getStepConfig(a,L);let E=[];return L&&R&&(E=(P=O[`step_${L}`])==null?void 0:P.result,(E==null?void 0:E.length)>0?(r==null||r.setBasicInfo(v.tool,E[c]),r==null||r.launchOperation()):(r==null||r.setBasicInfo(v.tool),r==null||r.forbidOperation(),es.message.info(lbUtils.i18n.t("NoDependency")))),n==null||n.setResult(f),n==null||n.history.initRecord(f,!0),__spreadProps(__spreadValues({},e),{basicIndex:c})}case Actions.ANNOTATION_ACTIONS.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:n}=t.payload;return __spreadProps(__spreadValues({},e),{triggerEventAfterIndexChanged:!!n})}case Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA:{const{imgList:n,step:o,toolInstance:l,annotationEngine:i,stepList:a}=e;if(!l)return __spreadProps(__spreadValues({},e),{imgIndex:t.payload.nextIndex});const r=StepUtils.getCurrentStepInfo(o,a),{nextIndex:p,imgNode:d,nextBasicIndex:c,imgError:T}=t.payload,O=c!=null?c:0,f=index.jsonParser((x=n[p])==null?void 0:x.result),C=f[`step_${r.step}`],L=!C,R={rotate:(B=f.rotate)!=null?B:0,valid:(w=f.valid)!=null?w:!0};d&&T!==!0?i==null||i.setImgNode(d,R):l==null||l.setValid(R.valid);const v=getStepConfig(a,r.step),{dataSourceStep:E,tool:U}=v,$=getStepConfig(a,E),Y=E&&U,h=(F=(b=f[`step_${E}`])==null?void 0:b.result)!=null?F:[],j=AnnotationDataUtils.getInitialResultList(C==null?void 0:C.result,l,v,h,L);if(i==null||i.launchOperation(),Y&&((h==null?void 0:h.length)>0?i==null||i.setBasicInfo($.tool,h[O]):(i==null||i.setBasicInfo($.tool),i==null||i.forbidOperation(),es.message.info(lbUtils.i18n.t("NoDependency")))),r.tool!=="check"){const J=(V=(G=h[O])==null?void 0:G.id)!=null?V:"",X=Y?j.filter(Z=>lbAnnotation.CommonToolUtils.isSameSourceID(Z.sourceID,J)):j;(M=l==null?void 0:l.history)==null||M.initRecord(j,!0),l==null||l.setResult(X)}return __spreadProps(__spreadValues({},e),{imgIndex:p,basicIndex:O,basicResultList:h,resultList:j})}case Actions.ANNOTATION_ACTIONS.UPDATE_ANNOTATION_CONFIG:return __spreadProps(__spreadValues({},e),{config:(q=t.payload.config)!=null?q:"{}"});case Actions.ANNOTATION_ACTIONS.SET_TASK_STEP_LIST:{const{stepList:n}=t.payload;return __spreadProps(__spreadValues({},e),{stepList:n})}case Actions.ANNOTATION_ACTIONS.SET_TASK_CONFIG:{const{stepList:n,step:o}=t.payload;return __spreadProps(__spreadValues({},e),{stepList:n,step:o})}case Actions.ANNOTATION_ACTIONS.INIT_TOOL:{const{imgNode:n}=e,o=updateToolInstance(e,n);if(o){const{toolInstance:l,annotationEngine:i}=o;return __spreadProps(__spreadValues({},e),{toolInstance:l,annotationEngine:i})}return __spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.SET_TOOL:{const n=(k=t.payload)==null?void 0:k.instance;return n?__spreadProps(__spreadValues({},e),{toolInstance:n}):__spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.UPDATE_ON_SUBMIT:return __spreadProps(__spreadValues({},e),{onSubmit:t.payload.onSubmit});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_SAVE:return __spreadProps(__spreadValues({},e),{onSave:t.payload.onSave});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_PAGE_CHANGE:return __spreadProps(__spreadValues({},e),{onPageChange:t.payload.onPageChange});case Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT:return __spreadProps(__spreadValues({},e),{predictionResult:t.payload.result});case Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT_VISIBLE:return __spreadProps(__spreadValues({},e),{predictionResultVisible:t.payload.visible});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_STEP_CHANGE:return __spreadProps(__spreadValues({},e),{onStepChange:t.payload.onStepChange});case Actions.ANNOTATION_ACTIONS.UPDATE_GET_FILE_DATA:return __spreadProps(__spreadValues({},e),{getFileData:t.payload.getFileData});case Actions.ANNOTATION_ACTIONS.UPDATE_PAGE_SIZE:return __spreadProps(__spreadValues({},e),{pageSize:t.payload.pageSize});case Actions.ANNOTATION_ACTIONS.UPDATE_LOAD_FILE_LIST:return __spreadProps(__spreadValues({},e),{loadFileList:t.payload.loadFileList});case Actions.ANNOTATION_ACTIONS.UPDATE_BEFORE_ROTATE:return __spreadProps(__spreadValues({},e),{beforeRotate:t.payload.beforeRotate});case Actions.ANNOTATION_ACTIONS.UPDATE_PRE_DATA_PROCESS:return __spreadProps(__spreadValues({},e),{preDataProcess:t.payload.preDataProcess});case Actions.ANNOTATION_ACTIONS.SKIP_BEFORE_PAGE_TURNING:return __spreadProps(__spreadValues({},e),{skipBeforePageTurning:t.payload.skipBeforePageTurning});case Actions.ANNOTATION_ACTIONS.SET_FILE_DATA:{const{fileData:n,index:o}=t.payload,{imgList:l}=e,i=[...l];return i[o]=__spreadValues(__spreadValues({},i[o]),n),__spreadProps(__spreadValues({},e),{imgList:i})}case Actions.ANNOTATION_ACTIONS.UPDATE_ROTATE:{const{toolInstance:n,beforeRotate:o}=e;return o&&o()===!1||(H=n==null?void 0:n.updateRotate)==null||H.call(n),e}case Actions.ANNOTATION_ACTIONS.UPDATE_ANNOTATION_VALID:{const{toolInstance:n}=e,o=(z=n==null?void 0:n.valid)!=null?z:!0;return antd.Modal.destroyAll(),antd.Modal.confirm({content:lbUtils.i18n.t(o?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{n==null||n.setValid(!o)},okText:lbUtils.i18n.t("Confirm"),cancelText:lbUtils.i18n.t("Cancel")}),e}case Actions.ANNOTATION_ACTIONS.COPY_BACKWARD_RESULT:{const{toolInstance:n,imgIndex:o,imgList:l,step:i}=e;if(!n)return e;if(o===0||o>=l.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),e;const a=l[o-1].result;if(!a)return e;const r=AnnotationDataUtils.copyResultChange(a,i,(K=l[o].result)!=null?K:"");l[o]=__spreadProps(__spreadValues({},l[o]),{result:r});const d=index.jsonParser(r)[`step_${i}`],c=(d==null?void 0:d.result)||[];return n==null||n.setResult(c),n==null||n.history.pushHistory(c),(W=n==null?void 0:n.asyncData)==null||W.call(n,l[o]),__spreadProps(__spreadValues({},e),{imgList:[...l]})}case Actions.ANNOTATION_ACTIONS.SET_STEP:{const{stepList:n,annotationEngine:o}=e,{toStep:l}=t.payload;if(!o)return e;const i=getStepConfig(n,l);return o==null||o.setToolName(i.tool,i.config),__spreadProps(__spreadValues({},e),{step:l,toolInstance:o==null?void 0:o.toolInstance})}case Actions.ANNOTATION_ACTIONS.SET_LOADPCDFILE_LOADING:{const{loadPCDFileLoading:n}=t.payload;return __spreadProps(__spreadValues({},e),{loadPCDFileLoading:!!n})}case Actions.ANNOTATION_ACTIONS.SET_LOADING:{const{loading:n}=t.payload;return __spreadProps(__spreadValues({},e),{loading:!!n})}case Actions.ANNOTATION_ACTIONS.SET_POINT_CLOUD_LOADING:{const{pointCloudLoading:n}=t.payload;return __spreadProps(__spreadValues({},e),{pointCloudLoading:!!n})}case Actions.ANNOTATION_ACTIONS.SET_CHECK_MODE:{const{checkMode:n}=t.payload;return __spreadProps(__spreadValues({},e),{checkMode:!!n})}case Actions.ANNOTATION_ACTIONS.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:n}=t.payload;return __spreadProps(__spreadValues({},e),{highlightAttribute:n})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_TRACK_ID:{const{id:n,newID:o,rangeIndex:l,imgList:i}=t.payload,{imgIndex:a,onSubmit:r}=e,p=[],d=i.map((c,T)=>{if(lbAnnotation.MathUtils.isInRange(T,l)){const O=__spreadProps(__spreadValues({},c),{result:lbUtils.PointCloudUtils.batchUpdateTrackID({id:n,newID:o,result:c.result})});return p.push({imgIndex:T,newInfo:O}),O}return c});return r&&r([d[a]],index$1.ESubmitType.BatchUpdateTrackID,a,d,{updateImgList:p}),__spreadProps(__spreadValues({},e),{imgList:d})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_RESULT_BY_TRACK_ID:{const{id:n,newData:o,rangeIndex:l}=t.payload,{imgList:i,imgIndex:a,onSubmit:r}=e,p=[],d=i.map((c,T)=>{if(lbAnnotation.MathUtils.isInRange(T,l)){const O=__spreadProps(__spreadValues({},c),{result:lbUtils.PointCloudUtils.batchUpdateResultByTrackID({id:n,newData:o,result:c.result})});return p.push({imgIndex:T,newInfo:O}),O}return c});return r&&r([d[a]],index$1.ESubmitType.BatchUpdateTrackID,a,d,{updateImgList:p}),__spreadProps(__spreadValues({},e),{imgList:d})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:{const{onSubmit:n,imgList:o,stepList:l,step:i,predictionResult:a}=e,r={};a.forEach(T=>{const{index:O}=T;r[O]=___default.default.pick(T,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const p=`step_${i}`,d=[],c=o.map((T,O)=>{if(r[O]){const f=T.result==="{}"?index.jsonParser(data.composeResult("",{step:i,stepList:l},{rect:[]},{})):index.jsonParser(T.result);f[p].result.push(r[O]);const C=__spreadProps(__spreadValues({},T),{result:JSON.stringify(f)});return d.push({imgIndex:O,newInfo:C}),C}return T});return n==null||n(c,index$1.ESubmitType.BatchUpdateImgList,-1,c,{updateImgList:d}),__spreadProps(__spreadValues({},e),{imgList:c})}default:return e}};exports.LoadFileAndFileData=LoadFileAndFileData,exports.annotationReducer=annotationReducer,exports.composeResultByToolInstance=composeResultByToolInstance,exports.getStepConfig=getStepConfig,exports.getTotalPage=getTotalPage;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$2=require("../../components/customResizeHook/index.js"),index$1=require("../../constant/index.js"),styleString=require("../../constant/styleString.js"),Actions=require("../Actions.js"),index=require("../../utils/index.js"),AnnotationDataUtils=require("../../utils/AnnotationDataUtils.js"),ConfigUtils=require("../../utils/ConfigUtils.js"),data=require("../../utils/data.js"),StepUtils=require("../../utils/StepUtils.js"),ToolUtils=require("../../utils/ToolUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),antd=require("antd"),es=require("antd/es"),_=require("lodash"),actionCreators=require("./actionCreators.js"),ToolType=require("../../data/enums/ToolType.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,l)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,__spreadValues=(e,t)=>{for(var l in t||(t={}))__hasOwnProp.call(t,l)&&__defNormalProp(e,l,t[l]);if(__getOwnPropSymbols)for(var l of __getOwnPropSymbols(t))__propIsEnum.call(t,l)&&__defNormalProp(e,l,t[l]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,l)=>new Promise((g,u)=>{var S=A=>{try{O(l.next(A))}catch(m){u(m)}},p=A=>{try{O(l.throw(A))}catch(m){u(m)}},O=A=>A.done?g(A.value):Promise.resolve(A.value).then(S,p);O((l=l.apply(e,t)).next())});const getStepConfig=(e,t)=>e.find(l=>l.step===t),initialState={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:""},getTotalPage=e=>{const{imgList:t,imgPageSize:l}=e;return Math.ceil(t.length/l)},calcStepProgress=(e,t)=>e.reduce((l,g)=>{if(g){const u=g.result;if(index.jsonParser(u)[`step_${t}`])return l+1}return l},0)/e.length,updateToolInstance=(e,t)=>{const{step:l,stepList:g}=e,u=StepUtils.getCurrentStepInfo(l,g),S=ConfigUtils.ConfigUtils.jsonParser(u.config);if(ToolUtils.isVideoTool(u==null?void 0:u.tool)||ToolUtils.isAudioTool(u==null?void 0:u.tool)||ToolUtils.isPointCloudTool(u==null?void 0:u.tool)||[ToolType.EToolName.LLM,ToolType.EToolName.NLP].includes(u==null?void 0:u.tool))return;const p=document.getElementById("toolContainer");if(!p)throw"Not exist dom named id-toolContainer";const O=index$2.getFormatSize({width:window.innerWidth,height:window.innerHeight}),A=new lbAnnotation.AnnotationEngine({container:p,toolName:u.tool,size:O,imgNode:t,config:S,style:JSON.parse(styleString)});return{toolInstance:A==null?void 0:A.toolInstance,annotationEngine:A}},LoadFileAndFileData=(e,t)=>(l,g)=>__async(void 0,null,function*(){var u,S;const{stepList:p,step:O}=g().annotation,A=StepUtils.currentToolIsVideo(O,p),m=StepUtils.currentToolIsPointCloud(O,p),D=((u=StepUtils.getCurrentStepInfo(O,p))==null?void 0:u.tool)===ToolType.EToolName.LLM,y=((S=StepUtils.getCurrentStepInfo(O,p))==null?void 0:S.tool)===ToolType.EToolName.NLP,P=StepUtils.currentToolIsAudio(O,p);if(actionCreators.SetAnnotationLoading(l,!0),yield l(TryGetFileDataByAPI(e)),A){l(AfterVideoLoaded(e));return}if(m||D||P||y){l(AfterCommonLoaded(e));return}l(AfterImageLoaded(e,t))}),TryGetFileDataByAPI=e=>(t,l)=>__async(void 0,null,function*(){const{getFileData:g,imgList:u}=l().annotation;if(g){const S=yield g(u[e],e);t({type:Actions.ANNOTATION_ACTIONS.SET_FILE_DATA,payload:{fileData:S,index:e}})}}),AfterVideoLoaded=e=>t=>{t({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{nextIndex:e}})},AfterCommonLoaded=e=>t=>{actionCreators.SetAnnotationLoading(t,!1),t({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{nextIndex:e}})},AfterImageLoaded=(e,t)=>(l,g)=>{var u;const{toolInstance:S,imgList:p}=g().annotation,O=(u=p==null?void 0:p[e])==null?void 0:u.url;lbAnnotation.ImgUtils.load(O).then(A=>{actionCreators.SetAnnotationLoading(l,!1),l({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{imgNode:A,nextIndex:e,nextBasicIndex:t}})}).catch(()=>{actionCreators.SetAnnotationLoading(l,!1),S==null||S.setErrorImg(),l({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{nextIndex:e,nextBasicIndex:t}})})},composeResultByToolInstance=({toolInstance:e,imgList:t,imgIndex:l,stepList:g,step:u=1})=>{var S,p,O,A;const m=((S=t[l])==null?void 0:S.result)||"",[D,y,P]=(p=e==null?void 0:e.exportData())!=null?p:[],x=(A=(O=e==null?void 0:e.exportCustomData)==null?void 0:O.call(e))!=null?A:{},B=data.composeResultWithBasicImgInfo(m,y),w=data.composeResult(B,{step:u,stepList:g},{rect:D},x);return t.map((b,F)=>F===l?__spreadValues(__spreadProps(__spreadValues({},b),{result:w}),P):__spreadValues({},b))},annotationReducer=(e=__spreadValues({},initialState),t)=>{var l,g,u,S,p,O,A,m,D,y,P,x,B,w,b,F,G,M,V,q,k,H,z,K,W,$,X,Y;switch(t.type){case Actions.ANNOTATION_ACTIONS.INIT_ALL_STATE:return __spreadValues(__spreadValues({},e),initialState);case Actions.ANNOTATION_ACTIONS.UPDATE_TOOL_INSTANCE:return __spreadProps(__spreadValues({},e),{toolInstance:t.payload.toolInstance});case Actions.ANNOTATION_ACTIONS.UPDATE_IMG_LIST:return __spreadProps(__spreadValues({},e),{imgList:t.payload.imgList});case Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS:{const{imgList:n,step:o}=e,s=calcStepProgress(n,o);return __spreadProps(__spreadValues({},e),{stepProgress:s})}case Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA:{const{imgList:n,imgIndex:o,step:s,stepList:i,toolInstance:a,onSubmit:r,resultList:N}=e;if(!a||!n[o])return e;const T=((l=n[o])==null?void 0:l.result)||"",[,c,d]=(g=a==null?void 0:a.exportData())!=null?g:[],I=(S=(u=a==null?void 0:a.exportCustomData)==null?void 0:u.call(a))!=null?S:{},f=data.composeResultWithBasicImgInfo(T,c),E=data.composeResult(f,{step:s,stepList:i},{rect:N},I),L=e.imgList.map((v,C)=>{if(C===o){const U=AnnotationDataUtils.dataCorrection(E,T,s,i);return __spreadValues(__spreadProps(__spreadValues({},v),{result:U}),d)}return v});if(((p=t.payload)==null?void 0:p.submitType)===index$1.ESubmitType.SyncImgList)return __spreadProps(__spreadValues({},e),{imgList:L});r&&r([L[o]],(O=t.payload)==null?void 0:O.submitType,o,L);const R=calcStepProgress(L,s);return __spreadProps(__spreadValues({},e),{stepProgress:R,imgList:L})}case Actions.ANNOTATION_ACTIONS.SAVE_RESULT:{const{imgList:n,imgIndex:o,onSave:s}=e;return s==null||s(n[o],o,n),__spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT:{const{imgList:n,basicIndex:o,resultList:s,toolInstance:i,basicResultList:a}=e;if(!i)return e;const[r]=(A=i==null?void 0:i.exportData())!=null?A:[];let N=r;if((a==null?void 0:a.length)>0){const T=(m=a[o])==null?void 0:m.id,c=r.map(d=>__spreadProps(__spreadValues({},d),{sourceID:T}));N=___default.default.cloneDeep(s).filter(d=>d.sourceID!==T),N.push(...c)}return __spreadProps(__spreadValues({},e),{resultList:N,imgList:n})}case Actions.ANNOTATION_ACTIONS.SET_BASIC_INDEX:{const{toolInstance:n,step:o,imgList:s,imgIndex:i,stepList:a,annotationEngine:r,resultList:N,basicResultList:T}=e;if(!n||!r)return e;const c=t.payload.basicIndex,d=(D=T[c])==null?void 0:D.id,I=index.jsonParser((y=s[i])==null?void 0:y.result),f=(N||[]).filter(U=>U.sourceID===d),E=getStepConfig(a,o),{dataSourceStep:L,tool:R}=E,v=getStepConfig(a,L);let C=[];return L&&R&&(C=(P=I[`step_${L}`])==null?void 0:P.result,(C==null?void 0:C.length)>0?(r==null||r.setBasicInfo(v.tool,C[c]),r==null||r.launchOperation()):(r==null||r.setBasicInfo(v.tool),r==null||r.forbidOperation(),es.message.info(lbUtils.i18n.t("NoDependency")))),n==null||n.setResult(f),n==null||n.history.initRecord(f,!0),__spreadProps(__spreadValues({},e),{basicIndex:c})}case Actions.ANNOTATION_ACTIONS.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:n}=t.payload;return __spreadProps(__spreadValues({},e),{triggerEventAfterIndexChanged:!!n})}case Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA:{const{imgList:n,step:o,toolInstance:s,annotationEngine:i,stepList:a}=e;if(!s)return __spreadProps(__spreadValues({},e),{imgIndex:t.payload.nextIndex});const r=StepUtils.getCurrentStepInfo(o,a),{nextIndex:N,imgNode:T,nextBasicIndex:c,imgError:d}=t.payload,I=c!=null?c:0,f=index.jsonParser((x=n[N])==null?void 0:x.result),E=f[`step_${r.step}`],L=!E,R={rotate:(B=f.rotate)!=null?B:0,valid:(w=f.valid)!=null?w:!0};T&&d!==!0?i==null||i.setImgNode(T,R):s==null||s.setValid(R.valid);const v=getStepConfig(a,r.step),{dataSourceStep:C,tool:U}=v,J=getStepConfig(a,C),Z=C&&U,h=(F=(b=f[`step_${C}`])==null?void 0:b.result)!=null?F:[],j=AnnotationDataUtils.getInitialResultList(E==null?void 0:E.result,s,v,h,L);if(i==null||i.launchOperation(),Z&&((h==null?void 0:h.length)>0?i==null||i.setBasicInfo(J.tool,h[I]):(i==null||i.setBasicInfo(J.tool),i==null||i.forbidOperation(),es.message.info(lbUtils.i18n.t("NoDependency")))),r.tool!=="check"){const Q=(M=(G=h[I])==null?void 0:G.id)!=null?M:"",ee=Z?j.filter(te=>lbAnnotation.CommonToolUtils.isSameSourceID(te.sourceID,Q)):j;(V=s==null?void 0:s.history)==null||V.initRecord(j,!0),s==null||s.setResult(ee)}return __spreadProps(__spreadValues({},e),{imgIndex:N,basicIndex:I,basicResultList:h,resultList:j})}case Actions.ANNOTATION_ACTIONS.UPDATE_ANNOTATION_CONFIG:return __spreadProps(__spreadValues({},e),{config:(q=t.payload.config)!=null?q:"{}"});case Actions.ANNOTATION_ACTIONS.SET_TASK_STEP_LIST:{const{stepList:n}=t.payload;return __spreadProps(__spreadValues({},e),{stepList:n})}case Actions.ANNOTATION_ACTIONS.SET_TASK_CONFIG:{const{stepList:n,step:o}=t.payload;return __spreadProps(__spreadValues({},e),{stepList:n,step:o})}case Actions.ANNOTATION_ACTIONS.INIT_TOOL:{const{imgNode:n}=e,o=updateToolInstance(e,n);if(o){const{toolInstance:s,annotationEngine:i}=o;return __spreadProps(__spreadValues({},e),{toolInstance:s,annotationEngine:i})}return __spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.SET_TOOL:{const n=(k=t.payload)==null?void 0:k.instance;return n?__spreadProps(__spreadValues({},e),{toolInstance:n}):__spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.UPDATE_ON_SUBMIT:return __spreadProps(__spreadValues({},e),{onSubmit:t.payload.onSubmit});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_SAVE:return __spreadProps(__spreadValues({},e),{onSave:t.payload.onSave});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_PAGE_CHANGE:return __spreadProps(__spreadValues({},e),{onPageChange:t.payload.onPageChange});case Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT:return __spreadProps(__spreadValues({},e),{predictionResult:t.payload.result});case Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT_VISIBLE:return __spreadProps(__spreadValues({},e),{predictionResultVisible:t.payload.visible});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_STEP_CHANGE:return __spreadProps(__spreadValues({},e),{onStepChange:t.payload.onStepChange});case Actions.ANNOTATION_ACTIONS.UPDATE_GET_FILE_DATA:return __spreadProps(__spreadValues({},e),{getFileData:t.payload.getFileData});case Actions.ANNOTATION_ACTIONS.UPDATE_PAGE_SIZE:return __spreadProps(__spreadValues({},e),{pageSize:t.payload.pageSize});case Actions.ANNOTATION_ACTIONS.UPDATE_LOAD_FILE_LIST:return __spreadProps(__spreadValues({},e),{loadFileList:t.payload.loadFileList});case Actions.ANNOTATION_ACTIONS.UPDATE_BEFORE_ROTATE:return __spreadProps(__spreadValues({},e),{beforeRotate:t.payload.beforeRotate});case Actions.ANNOTATION_ACTIONS.UPDATE_PRE_DATA_PROCESS:return __spreadProps(__spreadValues({},e),{preDataProcess:t.payload.preDataProcess});case Actions.ANNOTATION_ACTIONS.UPDATE_IMG_INDEX_BY_EXTERNAL:return __spreadProps(__spreadValues({},e),{getImgIndexByExternal:t.payload.getImgIndexByExternal});case Actions.ANNOTATION_ACTIONS.SKIP_BEFORE_PAGE_TURNING:return __spreadProps(__spreadValues({},e),{skipBeforePageTurning:t.payload.skipBeforePageTurning});case Actions.ANNOTATION_ACTIONS.SET_FILE_DATA:{const{fileData:n,index:o}=t.payload,{imgList:s}=e,i=[...s];return i[o]=__spreadValues(__spreadValues({},i[o]),n),__spreadProps(__spreadValues({},e),{imgList:i})}case Actions.ANNOTATION_ACTIONS.UPDATE_ROTATE:{const{toolInstance:n,beforeRotate:o}=e;return o&&o()===!1||(H=n==null?void 0:n.updateRotate)==null||H.call(n),e}case Actions.ANNOTATION_ACTIONS.UPDATE_ANNOTATION_VALID:{const{toolInstance:n}=e,o=(z=n==null?void 0:n.valid)!=null?z:!0;return antd.Modal.destroyAll(),antd.Modal.confirm({content:lbUtils.i18n.t(o?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{n==null||n.setValid(!o)},okText:lbUtils.i18n.t("Confirm"),cancelText:lbUtils.i18n.t("Cancel")}),e}case Actions.ANNOTATION_ACTIONS.COPY_BACKWARD_RESULT:{const{toolInstance:n,imgIndex:o,imgList:s,step:i,stepList:a}=e;if(!n)return e;if(o===0||o>=s.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),e;const r=s[o-1].result;if(!r)return e;const N=StepUtils.getCurrentStepInfo(i,a),T=(K=N==null?void 0:N.step)!=null?K:i,c=AnnotationDataUtils.copyResultChange({copyResult:r,step:T,currentResult:(W=s[o].result)!=null?W:"",preMappingImgList:($=s[o-1].mappingImgList)!=null?$:[],mappingImgList:(X=s[o].mappingImgList)!=null?X:[]});s[o]=__spreadProps(__spreadValues({},s[o]),{result:c});const I=index.jsonParser(c)[`step_${i}`],f=(I==null?void 0:I.result)||[];return n==null||n.setResult(f),n==null||n.history.pushHistory(f),(Y=n==null?void 0:n.asyncData)==null||Y.call(n,s[o]),__spreadProps(__spreadValues({},e),{imgList:[...s]})}case Actions.ANNOTATION_ACTIONS.SET_STEP:{const{stepList:n,annotationEngine:o}=e,{toStep:s}=t.payload;if(o){const i=getStepConfig(n,s);return o==null||o.setToolName(i.tool,i.config),__spreadProps(__spreadValues({},e),{step:s,toolInstance:o==null?void 0:o.toolInstance})}return __spreadProps(__spreadValues({},e),{step:s})}case Actions.ANNOTATION_ACTIONS.SET_LOADPCDFILE_LOADING:{const{loadPCDFileLoading:n}=t.payload;return __spreadProps(__spreadValues({},e),{loadPCDFileLoading:!!n})}case Actions.ANNOTATION_ACTIONS.SET_LOADING:{const{loading:n}=t.payload;return __spreadProps(__spreadValues({},e),{loading:!!n})}case Actions.ANNOTATION_ACTIONS.SET_POINT_CLOUD_LOADING:{const{pointCloudLoading:n}=t.payload;return __spreadProps(__spreadValues({},e),{pointCloudLoading:!!n})}case Actions.ANNOTATION_ACTIONS.SET_CHECK_MODE:{const{checkMode:n}=t.payload;return __spreadProps(__spreadValues({},e),{checkMode:!!n})}case Actions.ANNOTATION_ACTIONS.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:n}=t.payload;return __spreadProps(__spreadValues({},e),{highlightAttribute:n})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_TRACK_ID:{const{id:n,newID:o,rangeIndex:s,imgList:i}=t.payload,{imgIndex:a,onSubmit:r}=e,N=[],T=i.map((c,d)=>{if(lbAnnotation.MathUtils.isInRange(d,s)){const I=__spreadProps(__spreadValues({},c),{result:lbUtils.PointCloudUtils.batchUpdateTrackID({id:n,newID:o,result:c.result})});return N.push({imgIndex:d,newInfo:I}),I}return c});return r&&r([T[a]],index$1.ESubmitType.BatchUpdateTrackID,a,T,{updateImgList:N}),__spreadProps(__spreadValues({},e),{imgList:T})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_RESULT_BY_TRACK_ID:{const{id:n,newData:o,rangeIndex:s}=t.payload,{imgList:i,imgIndex:a,onSubmit:r}=e,N=[],T=i.map((c,d)=>{if(lbAnnotation.MathUtils.isInRange(d,s)){const I=__spreadProps(__spreadValues({},c),{result:lbUtils.PointCloudUtils.batchUpdateResultByTrackID({id:n,newData:o,result:c.result})});return N.push({imgIndex:d,newInfo:I}),I}return c});return r&&r([T[a]],index$1.ESubmitType.BatchUpdateTrackID,a,T,{updateImgList:N}),__spreadProps(__spreadValues({},e),{imgList:T})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:{const{onSubmit:n,imgList:o,stepList:s,step:i,predictionResult:a}=e,r={};a.forEach(d=>{const{index:I}=d;r[I]=___default.default.pick(d,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const N=`step_${i}`,T=[],c=o.map((d,I)=>{if(r[I]){const f=d.result==="{}"?index.jsonParser(data.composeResult("",{step:i,stepList:s},{rect:[]},{})):index.jsonParser(d.result);f[N].result.push(r[I]);const E=__spreadProps(__spreadValues({},d),{result:JSON.stringify(f)});return T.push({imgIndex:I,newInfo:E}),E}return d});return n==null||n(c,index$1.ESubmitType.BatchUpdateImgList,-1,c,{updateImgList:T}),__spreadProps(__spreadValues({},e),{imgList:c})}default:return e}};exports.LoadFileAndFileData=LoadFileAndFileData,exports.annotationReducer=annotationReducer,exports.composeResultByToolInstance=composeResultByToolInstance,exports.getStepConfig=getStepConfig,exports.getTotalPage=getTotalPage;
|
package/dist/types/App.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IPointCloudBox } from '@labelbee/lb-utils';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ToolInstance } from './store/annotation/types';
|
|
4
|
-
import { GetFileData, IFileItem, LoadFileList, OnPageChange, OnSave, OnStepChange, OnSubmit } from './types/data';
|
|
4
|
+
import { GetFileData, GetImgIndexByExternal, IFileItem, LoadFileList, OnPageChange, OnSave, OnStepChange, OnSubmit } from './types/data';
|
|
5
5
|
import { Header, RenderFooter, Sider, DrawLayerSlot } from './types/main';
|
|
6
6
|
import { IStepInfo } from './types/step';
|
|
7
7
|
import { EPointCloudName } from '@labelbee/lb-annotation';
|
|
@@ -77,6 +77,8 @@ export interface AppProps {
|
|
|
77
77
|
}) => void;
|
|
78
78
|
preDataProcess?: (params: IPreDataProcessParams) => IPointCloudBox[];
|
|
79
79
|
auditContext?: any;
|
|
80
|
+
getImgIndexByExternal: GetImgIndexByExternal;
|
|
81
|
+
annotationBefore?: (setAnnotationData: Function) => void;
|
|
80
82
|
}
|
|
81
83
|
declare const _default: import("react-redux").ConnectedComponent<React.FC<AppProps>, import("react-redux").Omit<AppProps & {
|
|
82
84
|
children?: React.ReactNode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAnswerList, IAnswerSort, ILLMBoxResult, ILLMToolConfig, IWaitAnswerSort, IInputList, ISelectedTags } from '../types';
|
|
2
|
-
export declare const getCurrentResultFromResultList: (result: string) => any;
|
|
2
|
+
export declare const getCurrentResultFromResultList: (result: string, step?: number) => any;
|
|
3
3
|
export declare const formatSort: (sortList: any) => any;
|
|
4
4
|
export declare const getTagResult: (inputList: IInputList[], result?: ISelectedTags) => {};
|
|
5
5
|
export declare const getWaitSortList: (answerList: IAnswerList[], result?: ILLMBoxResult) => {
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SetState } from 'ahooks/lib/useSetState';
|
|
3
|
-
import { IAudioTextToolConfig } from '@labelbee/lb-utils';
|
|
3
|
+
import { IAudioTextToolConfig, ITextConfigItem } from '@labelbee/lb-utils';
|
|
4
4
|
export declare enum EContextType {
|
|
5
5
|
before = "\u524D\u6587",
|
|
6
6
|
after = "\u540E\u6587"
|
|
7
7
|
}
|
|
8
|
+
export declare const DEFAULT_CLIP_TEXT_CONFIG_ITEM: {
|
|
9
|
+
label: string;
|
|
10
|
+
key: string;
|
|
11
|
+
required: boolean;
|
|
12
|
+
default: string;
|
|
13
|
+
maxLength: number;
|
|
14
|
+
}[];
|
|
8
15
|
interface IAudioContextProps {
|
|
9
16
|
audioContext: {
|
|
10
17
|
visible?: boolean;
|
|
@@ -19,7 +26,7 @@ export interface ISelectedRegion {
|
|
|
19
26
|
id?: string;
|
|
20
27
|
loop?: boolean;
|
|
21
28
|
}
|
|
22
|
-
type IAudioClipConfig = Pick<IAudioTextToolConfig, 'clipConfigurable' | 'clipAttributeConfigurable' | 'clipAttributeList' | 'clipTextConfigurable'>;
|
|
29
|
+
type IAudioClipConfig = Pick<IAudioTextToolConfig, 'clipConfigurable' | 'clipAttributeConfigurable' | 'clipAttributeList' | 'clipTextConfigurable' | 'secondaryAttributeConfigurable' | 'subAttributeList'>;
|
|
23
30
|
interface IAudioClipState extends IAudioClipConfig {
|
|
24
31
|
/** 选中的截取属性,新建截取片段的默认属性 */
|
|
25
32
|
selectedAttribute: string;
|
|
@@ -31,6 +38,7 @@ interface IAudioClipState extends IAudioClipConfig {
|
|
|
31
38
|
combined: boolean;
|
|
32
39
|
/** 是否按下分割键 */
|
|
33
40
|
segment: boolean;
|
|
41
|
+
clipTextList: ITextConfigItem[];
|
|
34
42
|
}
|
|
35
43
|
interface IAudioClipContext {
|
|
36
44
|
audioClipState: IAudioClipState;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Process audio tool data
|
|
3
|
+
* @author lixinghua <lixinghua_vendor@sensetime.com>
|
|
4
|
+
* @date 2024.05.14
|
|
5
|
+
*/
|
|
6
|
+
import { IAudioTimeSlice, ITextConfigItem } from '@labelbee/lb-utils';
|
|
7
|
+
export default class DataTransform {
|
|
8
|
+
static getClipTextByConfig: (region: IAudioTimeSlice, clipTextList: ITextConfigItem[], isDefault?: boolean) => IAudioTimeSlice;
|
|
9
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { IAudioTimeSlice } from '@labelbee/lb-utils';
|
|
2
|
+
import { IAudioTimeSlice, ITextConfigItem } from '@labelbee/lb-utils';
|
|
3
3
|
import { ISelectedRegion } from '@/components/audioAnnotate/audioContext';
|
|
4
4
|
import { IInputList, RenderFooter } from '@/types/main';
|
|
5
5
|
export interface ISetSelectedRegionParams extends ISelectedRegion {
|
|
6
6
|
/** 是否立即播放截取片段 */
|
|
7
7
|
playImmediately?: boolean;
|
|
8
|
+
isLoopStatus?: boolean;
|
|
8
9
|
}
|
|
9
10
|
interface IAudioPlayerContext {
|
|
10
11
|
count?: number;
|
|
@@ -12,32 +13,38 @@ interface IAudioPlayerContext {
|
|
|
12
13
|
toolName: string;
|
|
13
14
|
imgIndex: number;
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
-
export declare const AudioPlayer: ({ fileData, onLoaded, context, invalid, height, hideError, onError, updateRegion, removeRegion, regions, activeToolPanel, clipConfigurable, clipTextConfigurable, clipAttributeList, clipAttributeConfigurable, isCheck, hoverRegionId, footer, drawLayerSlot, }: {
|
|
16
|
+
interface IProps {
|
|
17
17
|
fileData: any;
|
|
18
|
-
height?: number
|
|
18
|
+
height?: number;
|
|
19
19
|
invalid: boolean;
|
|
20
20
|
onLoaded?: any;
|
|
21
|
-
onError?: (
|
|
22
|
-
context?: IAudioPlayerContext
|
|
23
|
-
hideError?: boolean
|
|
24
|
-
/**
|
|
25
|
-
regions?: IAudioTimeSlice[]
|
|
26
|
-
/**
|
|
27
|
-
updateRegion?: (
|
|
28
|
-
/**
|
|
29
|
-
removeRegion?: (
|
|
30
|
-
/**
|
|
31
|
-
activeToolPanel?: string
|
|
21
|
+
onError?: () => void;
|
|
22
|
+
context?: IAudioPlayerContext;
|
|
23
|
+
hideError?: boolean;
|
|
24
|
+
/** Intercepting fragment data: area changes do not trigger updates */
|
|
25
|
+
regions?: IAudioTimeSlice[];
|
|
26
|
+
/** Update the intercepted fragment. If the passed id does not exist, a new data will be created. */
|
|
27
|
+
updateRegion?: (region: IAudioTimeSlice) => void;
|
|
28
|
+
/** Delete intercepted data based on ID */
|
|
29
|
+
removeRegion?: (id: string) => void;
|
|
30
|
+
/** The currently used tool panel is used to determine whether to display the annotation layer */
|
|
31
|
+
activeToolPanel?: string;
|
|
32
32
|
clipConfigurable: boolean;
|
|
33
33
|
clipTextConfigurable: boolean;
|
|
34
34
|
clipAttributeConfigurable: boolean;
|
|
35
|
+
secondaryAttributeConfigurable: boolean;
|
|
36
|
+
subAttributeList: IInputList[];
|
|
35
37
|
clipAttributeList: IInputList[];
|
|
36
|
-
/**
|
|
37
|
-
isCheck?: boolean
|
|
38
|
-
/**
|
|
39
|
-
hoverRegionId?: string
|
|
40
|
-
footer?: RenderFooter
|
|
38
|
+
/** Whether it is in view mode: In view mode, the new and adjustment functions of interception need to be disabled */
|
|
39
|
+
isCheck?: boolean;
|
|
40
|
+
/** View the hoverId used in the pattern */
|
|
41
|
+
hoverRegionId?: string;
|
|
42
|
+
footer?: RenderFooter;
|
|
41
43
|
drawLayerSlot?: any;
|
|
42
|
-
|
|
44
|
+
clipTextList: ITextConfigItem[];
|
|
45
|
+
lang?: string;
|
|
46
|
+
}
|
|
47
|
+
export declare const AudioPlayerContext: React.Context<IAudioPlayerContext>;
|
|
48
|
+
export declare const AudioPlayer: ({ fileData, onLoaded, context, invalid, height, hideError, onError, updateRegion, removeRegion, regions, activeToolPanel, clipConfigurable, clipTextConfigurable, clipAttributeList, clipAttributeConfigurable, secondaryAttributeConfigurable, subAttributeList, isCheck, hoverRegionId, footer, drawLayerSlot, clipTextList, lang, }: IProps) => React.JSX.Element;
|
|
49
|
+
export declare const WrapAudioPlayer: (props: IProps) => React.JSX.Element;
|
|
43
50
|
export {};
|
|
@@ -24,5 +24,5 @@ interface IProps extends IA2MapStateProps {
|
|
|
24
24
|
checkMode?: boolean;
|
|
25
25
|
measureVisible?: boolean;
|
|
26
26
|
}
|
|
27
|
-
declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, thumbnailWidth, isEnlargeTopView, highlightAttribute, loadPCDFileLoading, checkMode, measureVisible }: IProps) => React.JSX.Element | null, import("react-redux").Omit<IProps, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileLoading" | "stepInfo" | "currentData" | "configString">>;
|
|
27
|
+
declare const _default: import("react-redux").ConnectedComponent<({ currentData, config, thumbnailWidth, isEnlargeTopView, highlightAttribute, loadPCDFileLoading, checkMode, measureVisible, }: IProps) => React.JSX.Element | null, import("react-redux").Omit<IProps, "imgIndex" | "imgList" | "config" | "highlightAttribute" | "loadPCDFileLoading" | "stepInfo" | "currentData" | "configString">>;
|
|
28
28
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPointCloudBox, IPointCloudBoxList, IPolygonData, IPointCloudSphereList, IPointCloudSphere, ILine, EPointCloudPattern, IPointCloudSegmentation, ICalib, ISize } from '@labelbee/lb-utils';
|
|
1
|
+
import { IPointCloudBox, IPointCloudBoxList, IPolygonData, IPointCloudSphereList, IPointCloudSphere, ILine, EPointCloudPattern, IPointCloudSegmentation, ICalib, ISize, IPointCloudBoxRect, IPointCloud2DRectOperationViewRect } from '@labelbee/lb-utils';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { PointCloud, PointCloudAnnotation, ActionsHistory, EToolName } from '@labelbee/lb-annotation';
|
|
4
4
|
interface IPointCloudContextInstances {
|
|
@@ -26,6 +26,7 @@ interface IHighlight2DData {
|
|
|
26
26
|
}
|
|
27
27
|
export interface IPointCloudContext extends IPointCloudContextInstances, IPointCloudStatus, IPointCloudSegment {
|
|
28
28
|
pointCloudBoxList: IPointCloudBoxList;
|
|
29
|
+
rectList: IPointCloudBoxRect[];
|
|
29
30
|
pointCloudSphereList: IPointCloudSphereList;
|
|
30
31
|
displayPointCloudList: IPointCloudBoxList;
|
|
31
32
|
displaySphereList: IPointCloudSphereList;
|
|
@@ -47,6 +48,10 @@ export interface IPointCloudContext extends IPointCloudContextInstances, IPointC
|
|
|
47
48
|
addPointCloudSphere: (sphereParams: IPointCloudSphere) => IPointCloudSphere[];
|
|
48
49
|
polygonList: IPolygonData[];
|
|
49
50
|
setPolygonList: (polygonList: IPolygonData[]) => void;
|
|
51
|
+
setRectList: (rectList: IPointCloudBoxRect[]) => void;
|
|
52
|
+
addRectIn2DView: (rect: IPointCloud2DRectOperationViewRect) => void;
|
|
53
|
+
removeRectIn2DView: (rects: IPointCloud2DRectOperationViewRect[]) => void;
|
|
54
|
+
updateRectIn2DView: (rect: IPointCloud2DRectOperationViewRect) => void;
|
|
50
55
|
lineList: ILine[];
|
|
51
56
|
setLineList: (lineList: ILine[]) => void;
|
|
52
57
|
zoom: number;
|
|
@@ -69,6 +69,7 @@ export declare const usePointCloudViews: () => {
|
|
|
69
69
|
updateViewsByDefaultSize?: undefined;
|
|
70
70
|
generateRects?: undefined;
|
|
71
71
|
update2DViewRect?: undefined;
|
|
72
|
+
remove2DViewRect?: undefined;
|
|
72
73
|
} | {
|
|
73
74
|
topViewAddSphere: ({ newPoint, size, zoom, trackConfigurable, }: {
|
|
74
75
|
newPoint: IPointUnit;
|
|
@@ -105,4 +106,8 @@ export declare const usePointCloudViews: () => {
|
|
|
105
106
|
boxID: string;
|
|
106
107
|
imageName: string;
|
|
107
108
|
}) => IPointCloudBox[] | undefined;
|
|
109
|
+
remove2DViewRect: (params: {
|
|
110
|
+
boxID: string;
|
|
111
|
+
imageName: string;
|
|
112
|
+
}) => IPointCloudBox[] | undefined;
|
|
108
113
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IInputList } from '@labelbee/lb-utils';
|
|
3
|
+
interface IProps {
|
|
4
|
+
subAttributeList: IInputList[];
|
|
5
|
+
setSubAttribute: (value: string, subAttribute: string) => void;
|
|
6
|
+
getValue: (subAttribute: IInputList) => undefined | string;
|
|
7
|
+
}
|
|
8
|
+
declare const SubAttributeList: (props: IProps) => React.JSX.Element;
|
|
9
|
+
export default SubAttributeList;
|
|
@@ -20,8 +20,9 @@ export interface IVideoAnnotateProps {
|
|
|
20
20
|
drawLayerSlot?: DrawLayerSlot;
|
|
21
21
|
footer?: any;
|
|
22
22
|
skipBeforePageTurning?: (pageTurning: Function) => void;
|
|
23
|
+
annotationBefore?: (setAnnotationData: Function) => void;
|
|
23
24
|
}
|
|
24
25
|
declare const _default: import("react-redux").ConnectedComponent<React.FC<IVideoAnnotateProps>, import("react-redux").Omit<IVideoAnnotateProps & {
|
|
25
26
|
children?: React.ReactNode;
|
|
26
|
-
}, "
|
|
27
|
+
}, "step" | "stepList" | "imgIndex" | "imgList" | "config" | "skipBeforePageTurning" | "loading" | "path" | "stepInfo">>;
|
|
27
28
|
export default _default;
|
|
@@ -49,7 +49,7 @@ declare class VideoClipTool extends React.Component<IVideoClipProps, IState> {
|
|
|
49
49
|
videoPlayer?: any;
|
|
50
50
|
videoNode?: HTMLVideoElement;
|
|
51
51
|
videoRef?: HTMLVideoElement;
|
|
52
|
-
throttledUpdateTime: _.
|
|
52
|
+
throttledUpdateTime: _.DebouncedFuncLeading<(newValue: number) => void>;
|
|
53
53
|
constructor(props: IVideoClipProps);
|
|
54
54
|
get valid(): boolean;
|
|
55
55
|
get config(): any;
|
|
@@ -91,6 +91,7 @@ declare class VideoClipTool extends React.Component<IVideoClipProps, IState> {
|
|
|
91
91
|
* @returns
|
|
92
92
|
*/
|
|
93
93
|
toggleClipStatus: (curTime?: number) => void;
|
|
94
|
+
setClipResult: (curTime?: number) => void;
|
|
94
95
|
/** 添加时间点 */
|
|
95
96
|
addTime: () => void;
|
|
96
97
|
/** 更新当前时间 */
|
|
@@ -65,7 +65,7 @@ export declare class TagToolInstanceAdaptor extends React.Component<IVideoTagIns
|
|
|
65
65
|
value: string;
|
|
66
66
|
};
|
|
67
67
|
isMulti: boolean;
|
|
68
|
-
},
|
|
68
|
+
}, existData?: ObjectString) => _.Dictionary<string | undefined>;
|
|
69
69
|
setResult: (tagResult: any[]) => void;
|
|
70
70
|
setLabel: (num1: number, num2: number) => void;
|
|
71
71
|
/**
|
package/dist/types/index.d.ts
CHANGED
|
@@ -13,11 +13,13 @@ import SwitchCuboidBoxIn2DView from '@/views/MainView/toolFooter/SwitchCuboidBox
|
|
|
13
13
|
import MeasureCanvas from './components/measureCanvas';
|
|
14
14
|
import AnnotatedBox from './views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox';
|
|
15
15
|
import { FindTrackIDIndexInCheckMode as FindTrackIDIndex } from './views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex';
|
|
16
|
+
import { WrapAudioPlayer as AudioPlayer } from './components/audioPlayer';
|
|
17
|
+
import { generatePointCloudBoxRects } from './utils';
|
|
16
18
|
export declare const store: import("redux").Store<{}, import("redux").Action<any>> & {
|
|
17
19
|
dispatch: unknown;
|
|
18
20
|
};
|
|
19
21
|
declare const _default: React.ForwardRefExoticComponent<AppProps & React.RefAttributes<unknown>>;
|
|
20
22
|
export default _default;
|
|
21
|
-
export { AnnotationView, PointCloudAnnotationView, QuestionView, TextContent, LLMToolView, i18n, VideoTagTool, PredictTracking, SwitchCuboidBoxIn2DView, MeasureCanvas, AnnotatedBox, FindTrackIDIndex, };
|
|
23
|
+
export { AnnotationView, PointCloudAnnotationView, QuestionView, TextContent, LLMToolView, i18n, VideoTagTool, PredictTracking, SwitchCuboidBoxIn2DView, MeasureCanvas, AnnotatedBox, FindTrackIDIndex, AudioPlayer, generatePointCloudBoxRects, };
|
|
22
24
|
export * from './constant';
|
|
23
25
|
export * from './typeTem';
|
|
@@ -40,6 +40,7 @@ export declare const ANNOTATION_ACTIONS: {
|
|
|
40
40
|
SET_PREDICT_RESULT: string;
|
|
41
41
|
SET_HIGHLIGHT_ATTRIBUTE: string;
|
|
42
42
|
UPDATE_PRE_DATA_PROCESS: string;
|
|
43
|
+
UPDATE_IMG_INDEX_BY_EXTERNAL: string;
|
|
43
44
|
};
|
|
44
45
|
export declare const IMAGE_ATTRIBUTE_ACTIONS: {
|
|
45
46
|
UPDATE_IMG_ATTRIBUTE: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IStepInfo } from '@/types/step';
|
|
2
|
-
import { GetFileData, LoadFileList, IFileItem, OnPageChange, OnSave, OnStepChange, OnSubmit } from '@/types/data';
|
|
2
|
+
import { GetFileData, LoadFileList, IFileItem, OnPageChange, OnSave, OnStepChange, OnSubmit, GetImgIndexByExternal } from '@/types/data';
|
|
3
3
|
import { AnnotationActionTypes, ToolInstance } from './types';
|
|
4
4
|
import { ESubmitType } from '@/constant';
|
|
5
5
|
import { EPageTurningOperation } from '@/data/enums/AnnotationSize';
|
|
@@ -28,6 +28,7 @@ export declare function UpdateSkipBeforePageTurning(skipBeforePageTurning: (page
|
|
|
28
28
|
export declare function UpdateBeforeRotate(beforeRotate: () => {}): AnnotationActionTypes;
|
|
29
29
|
export declare function UpdatePreDataProcess(preDataProcess: () => {}): AnnotationActionTypes;
|
|
30
30
|
export declare function CopyBackWordResult(): AnnotationActionTypes;
|
|
31
|
+
export declare function UpdateImgIndexByExternal(getImgIndexByExternal: GetImgIndexByExternal): AnnotationActionTypes;
|
|
31
32
|
export declare function BatchUpdateTrackID({ id, newID, rangeIndex, imgList, }: {
|
|
32
33
|
id: number;
|
|
33
34
|
newID: number;
|
|
@@ -43,7 +44,7 @@ export declare const UpdateHighlightAttribute: (attribute: string) => Annotation
|
|
|
43
44
|
* 初始化任务数据
|
|
44
45
|
* @param param0
|
|
45
46
|
*/
|
|
46
|
-
export declare function InitTaskData({ onSubmit, onSave, onPageChange, onStepChange, getFileData, pageSize, loadFileList, step, stepList, skipBeforePageTurning, beforeRotate, checkMode, highlightAttribute, preDataProcess, }: any): any;
|
|
47
|
+
export declare function InitTaskData({ onSubmit, onSave, onPageChange, onStepChange, getFileData, pageSize, loadFileList, step, stepList, skipBeforePageTurning, beforeRotate, checkMode, highlightAttribute, preDataProcess, getImgIndexByExternal, }: any): any;
|
|
47
48
|
/**
|
|
48
49
|
* 初始化任务数据
|
|
49
50
|
* @param param0
|
|
@@ -54,4 +54,5 @@ export declare const annotationReducer: (state: {
|
|
|
54
54
|
predictionResultVisible: boolean;
|
|
55
55
|
highlightAttribute: string;
|
|
56
56
|
preDataProcess?: ((params: import("../../App").IPreDataProcessParams) => IPointCloudBox[]) | undefined;
|
|
57
|
+
getImgIndexByExternal?: import("@/types/data").GetImgIndexByExternal | undefined;
|
|
57
58
|
} | undefined, action: AnnotationActionTypes) => AnnotationState;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnnotationEngine, RectOperation, TagOperation, TextToolOperation, PointOperation, PolygonOperation, LineToolOperation } from '@labelbee/lb-annotation';
|
|
2
2
|
import { ANNOTATION_ACTIONS } from '@/store/Actions';
|
|
3
3
|
import { IStepInfo } from '@/types/step';
|
|
4
|
-
import { OnSubmit, IFileItem, GetFileData, OnSave, OnPageChange, OnStepChange, LoadFileList } from '@/types/data';
|
|
4
|
+
import { OnSubmit, IFileItem, GetFileData, OnSave, OnPageChange, OnStepChange, LoadFileList, GetImgIndexByExternal } from '@/types/data';
|
|
5
5
|
import { ESubmitType } from '@/constant';
|
|
6
6
|
import { IPointCloudBox } from '@labelbee/lb-utils';
|
|
7
7
|
import { IPreDataProcessParams } from '@/App';
|
|
@@ -47,6 +47,7 @@ export interface AnnotationState {
|
|
|
47
47
|
predictionResultVisible: boolean;
|
|
48
48
|
highlightAttribute: string;
|
|
49
49
|
preDataProcess?: (params: IPreDataProcessParams) => IPointCloudBox[];
|
|
50
|
+
getImgIndexByExternal?: GetImgIndexByExternal;
|
|
50
51
|
}
|
|
51
52
|
interface UpdateToolInstance {
|
|
52
53
|
type: typeof ANNOTATION_ACTIONS.UPDATE_TOOL_INSTANCE;
|
|
@@ -135,6 +136,12 @@ interface UpdateGetFileList {
|
|
|
135
136
|
getFileData: LoadFileList;
|
|
136
137
|
};
|
|
137
138
|
}
|
|
139
|
+
interface UpdataImgIndexByExternal {
|
|
140
|
+
type: typeof ANNOTATION_ACTIONS.UPDATE_IMG_INDEX_BY_EXTERNAL;
|
|
141
|
+
payload: {
|
|
142
|
+
getImgIndexByExternal: GetImgIndexByExternal;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
138
145
|
interface CopyBackWordResult extends CommonActions {
|
|
139
146
|
type: typeof ANNOTATION_ACTIONS.COPY_BACKWARD_RESULT;
|
|
140
147
|
}
|
|
@@ -158,5 +165,5 @@ interface BatchUpdateResultByTrackID {
|
|
|
158
165
|
range: [number, number];
|
|
159
166
|
};
|
|
160
167
|
}
|
|
161
|
-
export type AnnotationActionTypes = UpdateToolInstance | UpdateImgList | UpdateAnnotationConfig | SubmitFileData | LoadFileData | SetTaskConfig | InitTool | UpdateOnSubmit | UpdateOnPageChange | UpdateOnStepChange | UpdateGetFileData | UpdatePageSize | UpdateGetFileList | CopyBackWordResult | UpdateOnSave | BatchUpdateTrackID | BatchUpdateResultByTrackID | InitAnnotationState;
|
|
168
|
+
export type AnnotationActionTypes = UpdateToolInstance | UpdateImgList | UpdateAnnotationConfig | SubmitFileData | LoadFileData | SetTaskConfig | InitTool | UpdateOnSubmit | UpdateOnPageChange | UpdateOnStepChange | UpdateGetFileData | UpdatePageSize | UpdateGetFileList | CopyBackWordResult | UpdateOnSave | BatchUpdateTrackID | BatchUpdateResultByTrackID | UpdataImgIndexByExternal | InitAnnotationState;
|
|
162
169
|
export {};
|
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
import { IStepInfo } from '@/types/step';
|
|
2
|
+
import { IMappingImg } from '@/types/data';
|
|
3
|
+
interface ICopyResultChangeParams {
|
|
4
|
+
copyResult: string;
|
|
5
|
+
step: number;
|
|
6
|
+
currentResult: string;
|
|
7
|
+
mappingImgList: IMappingImg[];
|
|
8
|
+
preMappingImgList: IMappingImg[];
|
|
9
|
+
}
|
|
10
|
+
interface IGetNextPath {
|
|
11
|
+
prePath: string;
|
|
12
|
+
preMappingImgList: IMappingImg[];
|
|
13
|
+
nextMappingImgList: IMappingImg[];
|
|
14
|
+
}
|
|
15
|
+
interface ICopyResultItemHandlerParams {
|
|
16
|
+
item: any;
|
|
17
|
+
key?: string | number;
|
|
18
|
+
parent: any;
|
|
19
|
+
mappingImgList: IMappingImg[];
|
|
20
|
+
preMappingImgList: IMappingImg[];
|
|
21
|
+
}
|
|
2
22
|
export default class AnnotationDataUtils {
|
|
23
|
+
/**
|
|
24
|
+
* Performs a depth-first traversal of an object or array, executing a callback function on each element.
|
|
25
|
+
*
|
|
26
|
+
* @param {any} objOrArr - The object or array to be traversed.
|
|
27
|
+
* @param {Function} callback - The callback function to be executed on each element.
|
|
28
|
+
* The callback function takes three parameters: element, key, and parent.
|
|
29
|
+
* @param {string | number} [key] - The key or index of the current element in its parent (optional).
|
|
30
|
+
* @param {any} [parent] - The parent of the current element (optional).
|
|
31
|
+
*/
|
|
32
|
+
static traverseDF(objOrArr: any, callback: (element: any, key?: string | number, parent?: any) => void, key?: string | number, parent?: any): void;
|
|
33
|
+
/**
|
|
34
|
+
* Calculates the next path based on the provided parameters.
|
|
35
|
+
*
|
|
36
|
+
* @param {IGetNextPath} params - The object containing necessary information.
|
|
37
|
+
* @param {string} params.prePath - The current path.
|
|
38
|
+
* @param {IImgList} params.preMappingImgList - The list of current mapping images.
|
|
39
|
+
* @param {IImgList} params.nextMappingImgList - The list of next mapping images.
|
|
40
|
+
* @returns {string} The next path, returns an empty string if not found.
|
|
41
|
+
*/
|
|
42
|
+
static getNextPath(params: IGetNextPath): string;
|
|
43
|
+
/**
|
|
44
|
+
* Handles the processing of individual items during the traversal of results or resultRect.
|
|
45
|
+
* This function updates specific properties of the parent object based on the key of the current item.
|
|
46
|
+
*
|
|
47
|
+
* @param {ICopyResultItemHandlerParams} params - Parameters containing the current item, its key, parent object, and image lists.
|
|
48
|
+
* @param {ICopyResultItemHandlerParams.item} item - The current item being processed.
|
|
49
|
+
* @param {ICopyResultItemHandlerParams.key} key - The key associated with the current item.
|
|
50
|
+
* @param {ICopyResultItemHandlerParams.parent} parent - The parent object of the current item.
|
|
51
|
+
* @param {ICopyResultItemHandlerParams.mappingImgList} mappingImgList - The list of images for mapping.
|
|
52
|
+
* @param {ICopyResultItemHandlerParams.preMappingImgList} preMappingImgList - The list of images before mapping.
|
|
53
|
+
*/
|
|
54
|
+
static copyResultItemHandler(params: ICopyResultItemHandlerParams): void;
|
|
3
55
|
/**
|
|
4
56
|
* 复制上一张图片结果
|
|
5
57
|
* @param copyResult 复制的结果
|
|
@@ -7,7 +59,7 @@ export default class AnnotationDataUtils {
|
|
|
7
59
|
* @param currentResult 当前的步骤
|
|
8
60
|
* @returns
|
|
9
61
|
*/
|
|
10
|
-
static copyResultChange(
|
|
62
|
+
static copyResultChange(params: ICopyResultChangeParams): string;
|
|
11
63
|
/**
|
|
12
64
|
* 判断结果sourceID与依赖数据的id是否能对应
|
|
13
65
|
* @param result
|
|
@@ -75,3 +127,4 @@ export default class AnnotationDataUtils {
|
|
|
75
127
|
*/
|
|
76
128
|
static deleteRes(resData: any, dataSourceStep: number, deletedIds: string[], stepKeys: number[]): void;
|
|
77
129
|
}
|
|
130
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICoordinate, IPointCloudBox, ISize } from '@labelbee/lb-utils';
|
|
1
|
+
import { IBasicRect, ICoordinate, IPointCloudBox, ISize } from '@labelbee/lb-utils';
|
|
2
2
|
import { IMappingImg } from '@/types/data';
|
|
3
3
|
export declare const jsonParser: (content: any, defaultValue?: any) => any;
|
|
4
4
|
export declare const getNewNode: <T>(newNode: T, oldNode: T) => T;
|
|
@@ -11,6 +11,9 @@ export declare const getBoundingRect: (points: ICoordinate[]) => {
|
|
|
11
11
|
width: number;
|
|
12
12
|
height: number;
|
|
13
13
|
};
|
|
14
|
+
export declare const isBoundingRectInImage: (boundingRect: Omit<IBasicRect, "id">, path: string, imageSizes: {
|
|
15
|
+
[key: string]: ISize;
|
|
16
|
+
}) => boolean;
|
|
14
17
|
interface IGetRectPointCloudBoxParams {
|
|
15
18
|
pointCloudBox: IPointCloudBox;
|
|
16
19
|
mappingData: IMappingImg;
|
|
@@ -25,4 +28,25 @@ export declare const getRectPointCloudBox: (params: IGetRectPointCloudBoxParams)
|
|
|
25
28
|
width: number;
|
|
26
29
|
height: number;
|
|
27
30
|
} | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Updates the given point cloud box with rectangles derived from the mapping image list and image sizes.
|
|
33
|
+
*
|
|
34
|
+
* @param {Object} params - The parameters for the function.
|
|
35
|
+
* @param {IPointCloudBox} params.pointCloudBox - The point cloud box object to be updated.
|
|
36
|
+
* @param {IMappingImg[]} params.mappingImgList - The list of mapping images to process.
|
|
37
|
+
* @param {Object.<string, ISize>} params.imageSizes - An object containing image sizes keyed by image paths.
|
|
38
|
+
*
|
|
39
|
+
* @returns {void}
|
|
40
|
+
*
|
|
41
|
+
* @description This function processes a list of mapping images to generate rectangles for the provided point cloud box.
|
|
42
|
+
* It filters out undefined rectangles and updates the point cloud box with the valid rectangles. Note that this function
|
|
43
|
+
* modifies the `pointCloudBox` parameter by adding a `rects` property.
|
|
44
|
+
*/
|
|
45
|
+
export declare const generatePointCloudBoxRects: (params: {
|
|
46
|
+
pointCloudBox: IPointCloudBox;
|
|
47
|
+
mappingImgList: IMappingImg[];
|
|
48
|
+
imageSizes: {
|
|
49
|
+
[key: string]: ISize;
|
|
50
|
+
};
|
|
51
|
+
}) => void;
|
|
28
52
|
export {};
|
|
@@ -20,5 +20,5 @@ interface IProps {
|
|
|
20
20
|
export declare const SingleTextInput: (props: any) => React.JSX.Element;
|
|
21
21
|
declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
|
|
22
22
|
children?: React.ReactNode;
|
|
23
|
-
}, "
|
|
23
|
+
}, "step" | "stepList" | "imgIndex" | "basicResultList" | "toolInstance" | "triggerEventAfterIndexChanged" | "dispatch">>;
|
|
24
24
|
export default _default;
|