@labelbee/lb-components 1.17.0-alpha.8 → 1.17.0

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.
@@ -1 +1 @@
1
- "use strict";var React=require("react"),index$3=require("../audioPlayer/index.js"),dom=require("../../utils/dom.js"),index$4=require("../predictTracking/previewResult/index.js"),es=require("antd/es"),antd=require("antd"),index$5=require("../../constant/index.js"),lbAnnotation=require("@labelbee/lb-annotation"),index_module=require("./index.module.scss.js"),index$2=require("./tagResultShow/index.js"),index$1=require("./audioContext/index.js"),index$6=require("./textInput/index.js"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),index=require("../../utils/index.js"),annotation=require("../../hooks/annotation.js"),index$7=require("../../views/MainView/sidebar/index.js"),index$8=require("./audioSide/labelSidebar/index.js"),index$9=require("./audioSide/clipSidebar/index.js"),tag=require("../../assets/annotation/audio/tag.svg.js"),tagA=require("../../assets/annotation/audio/tagA.svg.js"),clip=require("../../assets/annotation/audio/clip.svg.js"),clipA=require("../../assets/annotation/audio/clipA.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,a)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,__spreadValues=(e,t)=>{for(var a in t||(t={}))__hasOwnProp.call(t,a)&&__defNormalProp(e,a,t[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(t))__propIsEnum.call(t,a)&&__defNormalProp(e,a,t[a]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const{EAudioToolName}=lbAnnotation.cTool,EKeyCode=lbAnnotation.cKeyCode.default,{Sider,Content}=es.Layout,layoutCls=`${index$5.prefix}-layout`,ToggleAudioOption=({setSideTab:e,sideTab:t})=>{const a=[{tab:"tag",commonSvg:tag,selectedSvg:tagA},{tab:"clip",commonSvg:clip,selectedSvg:clipA}];return React__default.default.createElement("div",{className:index_module.toggleAudioOption},a.map((f,b)=>{const{tab:u,selectedSvg:x,commonSvg:S}=f;return React__default.default.createElement("div",{key:b,className:index_module.option},React__default.default.createElement("img",{className:index_module.icon,src:t===u?x:S,onClick:()=>{t!==u&&e(u)}}))}))},AudioTextToolTextarea=({result:e,inputDisabled:t,updateText:a,configList:f,autofocus:b,preContext:u,isCheck:x,clipAttributeConfigurable:S,clipTextConfigurable:A,textConfigurable:v,updateRegion:y,clipAttributeList:d})=>React__default.default.createElement("div",{className:index_module.textareaContainer},React__default.default.createElement("div",{className:index_module.textareaContent},React__default.default.createElement(index$6.default,{isCheck:x,result:e==null?void 0:e.value,textInputDisabled:t,textID:(e==null?void 0:e.id)||0,updateText:a,configList:f,autofocus:!t&&b,preContext:u,regions:e==null?void 0:e.regions,clipAttributeConfigurable:S,clipTextConfigurable:A,textConfigurable:v,updateRegion:y,clipAttributeList:d}))),AudioSideBar=e=>{var t,a;const{sider:f,config:b,result:u,updateTagResult:x,updateRegion:S,isEdit:A,tagConfigurable:v,clipConfigurable:y}=e;let d=(b==null?void 0:b.inputList)||[],E=(t=u==null?void 0:u.tag)!=null?t:{},i=(a=u==null?void 0:u.regions)!=null?a:[];const[D,L]=React.useState([]),[C,g]=React.useState("tag");React.useEffect(()=>{if(!v&&y){g("clip");return}g("tag")},[v,y]),React.useEffect(()=>(window.addEventListener("keydown",O),()=>{window.removeEventListener("keydown",O)}));const O=o=>{if(v&&y)switch(o.keyCode){case EKeyCode.L:g("tag");break;case EKeyCode.X:g("clip");break}if(C==="tag"){if(!lbAnnotation.CommonToolUtils.hotkeyFilter(o))return;lbAnnotation.CommonToolUtils.isMoveKey(o==null?void 0:o.keyCode)&&o.preventDefault();let l=o.keyCode;if(l&&(l<=57&&l>=49||l<=105&&l>=97)){l>57?l=l-97:l=l-49;const s=D.slice();d.length===1?(_(0,l),L([0,l]),setTimeout(()=>{L([])},500)):s.length===1?(_(s[0],l),L([s[0],l]),setTimeout(()=>{L([])},500)):L([l])}}},_=(o,l)=>{if(o<d.length&&d[o].subSelected&&l<d[o].subSelected.length){const s=d[o].value,p=d[o].isMulti;let T=d[o].subSelected[l].value,M=0;const q=E;for(const w in E)if(w===d[o].value){if(M++,p===!0){const j=q[w].split(";").filter(U=>U!==""),$=j.indexOf(T);$===-1?j.push(T):j.splice($,1),T=j.join(";")}T===""?delete q[w]:q[w]=T}M===0&&Object.assign(E,{[s]:T}),x(E)}},P=o=>{delete E[o],x(E)},h=v&&y&&React__default.default.createElement(ToggleAudioOption,{setSideTab:g,sideTab:C}),N=C==="tag"&&React__default.default.createElement(index$8.default,{labelInfoSet:v?d:[],labelSelectedList:D,setLabel:_,tagResult:E,clearResult:P,isEdit:A,withPanelTab:!1}),I=C==="clip"&&React__default.default.createElement(index$9,{regions:i,updateRegion:S,useAudioClipStore:index$1.useAudioClipStore});return f?typeof f=="function"?React__default.default.createElement("div",{className:`${index$7.sidebarCls}`},f({toggleAudioOption:h,labelSidebar:N,clipSidebar:I})):f:React__default.default.createElement("div",{className:`${index$7.sidebarCls}`},React__default.default.createElement("div",{className:`${index$7.sidebarCls}__content`},h,N,I))},AudioAnnotate=e=>{var t,a,f,b,u,x,S,A,v;const y=(a=(t=e.style)==null?void 0:t.sider)==null?void 0:a.width,{step:d,stepList:E,audioContext:i,sider:D,drawLayerSlot:L,imgList:C,imgIndex:g,currentData:O,config:_,stepInfo:P}=e,h=lbAnnotation.CommonToolUtils.getCurrentStepToolAndConfig(d,E),N=index.jsonParser(O.result),{toolInstanceRef:I}=annotation.useCustomToolInstance({basicInfo:N}),[o,l]=React.useState(!0),[s,p]=React.useState(null),[T,M]=React.useState(!1);React.useEffect(()=>{l(!0),M(!0)},[g]),React.useEffect(()=>{o===!1&&Z()},[o]),React.useEffect(()=>{I.current.exportData=()=>[[s],{}],I.current.setResult=ae,I.current.clearResult=ie},[s]);const q=React.useMemo(()=>{const n=N[`step_${P==null?void 0:P.step}`];return(n==null?void 0:n.result)||[]},[_,N,P]),{tagConfigurable:w,textConfigurable:j=!0,clipConfigurable:$=!1,clipAttributeConfigurable:U=!1,clipAttributeList:F=[],clipTextConfigurable:V=!1,inputList:z=[],configList:G=[]}=React.useMemo(()=>{if(h)return lbAnnotation.CommonToolUtils.jsonParser(h==null?void 0:h.config)},[h]),H={clipConfigurable:$,clipAttributeConfigurable:U,clipAttributeList:F,clipTextConfigurable:V},K=i?i==null?void 0:i.valid:!0,J=(b=(f=lbAnnotation.CommonToolUtils.jsonParser(O.result))==null?void 0:f.duration)!=null?b:0,Q=K?J:0,Y=!K||o||![j,V].includes(!0);let W={};if(g!==-1&&(C==null?void 0:C.length)){const n=(u=C[g])==null?void 0:u.preResult,r=(i==null?void 0:i.isEdit)?(x=i==null?void 0:i.stepConfig)==null?void 0:x.loadPreStep:P==null?void 0:P.loadPreStep;if(n&&r){const c=lbAnnotation.CommonToolUtils.jsonParser(n),m=(A=(S=c==null?void 0:c.config)==null?void 0:S.context)!=null?A:{};Object.keys(m).forEach(R=>{R&&m[R]&&(W[R]={visible:!0,content:m[R],type:R})})}}const Z=()=>{(q==null?void 0:q.length)>0?p(q[0]):p({id:lbAnnotation.uuid(),sourceID:"",value:X(),tag:ee(),regions:[]})},X=(n=!0)=>{const r={};let c=_.configList||[];return c.length>0&&c.forEach(m=>{r[m.key]=n&&m.default||""}),r},ee=()=>lbAnnotation.TagUtils.getDefaultResultByConfig(_.inputList||[]),te=({duration:n,hasError:r})=>{l(!1)},ne=n=>{p(r=>__spreadProps(__spreadValues({},r),{regions:((r==null?void 0:r.regions)||[]).filter(c=>c.id!==n)}))},B=n=>{p(r=>{var c;const m=(c=r==null?void 0:r.regions)!=null?c:[],{id:R}=n;return m.find(k=>k.id===R)?__spreadProps(__spreadValues({},r),{regions:m.map(k=>R===k.id?__spreadValues(__spreadValues({},k),n):k)}):__spreadProps(__spreadValues({},r),{regions:[...m,n]})})},oe=(n,r)=>{p(c=>__spreadProps(__spreadValues({},c),{value:__spreadProps(__spreadValues({},c.value),{[r]:n})}))},le=n=>{p(r=>__spreadProps(__spreadValues({},r),{tag:n}))},ae=n=>{p(n)},ie=()=>{p(n=>__spreadProps(__spreadValues({},n),{value:X(),tag:{},regions:[]}))};return React__default.default.createElement(index$1.AudioClipProvider,null,React__default.default.createElement(antd.Spin,{spinning:o,wrapperClassName:"audio-tool-spinner"},React__default.default.createElement(es.Layout,{className:dom.getClassName("layout","container"),style:{height:"100%"}},e==null?void 0:e.leftSider,React__default.default.createElement(Content,{className:`${layoutCls}__content`},React__default.default.createElement("div",{className:index_module.containerWrapper},React__default.default.createElement("div",{className:index_module.audioWrapper},w&&React__default.default.createElement(index$2,{result:s==null?void 0:s.tag,labelInfoSet:z,hasPromptLayer:!!(i==null?void 0:i.promptLayer)}),i==null?void 0:i.promptLayer,React__default.default.createElement(index$3.AudioPlayer,__spreadValues({context:{isEdit:i==null?void 0:i.isEdit,count:Q,toolName:EAudioToolName.AudioTextTool,imgIndex:g},drawLayerSlot:L,fileData:O,onLoaded:te,invalid:!K,updateRegion:B,removeRegion:ne,regions:s==null?void 0:s.regions,activeToolPanel:i==null?void 0:i.activeToolPanel,footer:e.footer},H))),(j||V)&&React__default.default.createElement(AudioTextToolTextarea,{preContext:W,result:s,inputDisabled:Y,updateText:oe,updateRegion:B,configList:G,autofocus:T,textConfigurable:j,clipTextConfigurable:V,clipAttributeList:F,clipAttributeConfigurable:U}))),React__default.default.createElement(Sider,{className:`${layoutCls}__side`,width:y!=null?y:240,style:(v=e.style)==null?void 0:v.sider},React__default.default.createElement(AudioSideBar,{sider:D,config:_,result:s,updateTagResult:le,updateRegion:B,isEdit:i==null?void 0:i.isEdit,tagConfigurable:w,clipConfigurable:$})),React__default.default.createElement(index$4,null))))};var AudioAnnotate$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(AudioAnnotate);module.exports=AudioAnnotate$1;
1
+ "use strict";var React=require("react"),index$3=require("../audioPlayer/index.js"),dom=require("../../utils/dom.js"),index$4=require("../predictTracking/previewResult/index.js"),es=require("antd/es"),antd=require("antd"),index$5=require("../../constant/index.js"),lbAnnotation=require("@labelbee/lb-annotation"),index_module=require("./index.module.scss.js"),index$2=require("./tagResultShow/index.js"),index$1=require("./audioContext/index.js"),index$6=require("./textInput/index.js"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),index=require("../../utils/index.js"),annotation=require("../../hooks/annotation.js"),index$7=require("../../views/MainView/sidebar/index.js"),index$8=require("./audioSide/labelSidebar/index.js"),index$9=require("./audioSide/clipSidebar/index.js"),tag=require("../../assets/annotation/audio/tag.svg.js"),tagA=require("../../assets/annotation/audio/tagA.svg.js"),clip=require("../../assets/annotation/audio/clip.svg.js"),clipA=require("../../assets/annotation/audio/clipA.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,a)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,__spreadValues=(e,t)=>{for(var a in t||(t={}))__hasOwnProp.call(t,a)&&__defNormalProp(e,a,t[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(t))__propIsEnum.call(t,a)&&__defNormalProp(e,a,t[a]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const{EAudioToolName}=lbAnnotation.cTool,EKeyCode=lbAnnotation.cKeyCode.default,{Sider,Content}=es.Layout,layoutCls=`${index$5.prefix}-layout`,ToggleAudioOption=({setSideTab:e,sideTab:t})=>{const a=[{tab:"tag",commonSvg:tag,selectedSvg:tagA},{tab:"clip",commonSvg:clip,selectedSvg:clipA}];return React__default.default.createElement("div",{className:index_module.toggleAudioOption},a.map((f,b)=>{const{tab:u,selectedSvg:x,commonSvg:S}=f;return React__default.default.createElement("div",{key:b,className:index_module.option},React__default.default.createElement("img",{className:index_module.icon,src:t===u?x:S,onClick:()=>{t!==u&&e(u)}}))}))},AudioTextToolTextarea=({result:e,inputDisabled:t,updateText:a,configList:f,autofocus:b,preContext:u,isCheck:x,clipAttributeConfigurable:S,clipTextConfigurable:q,textConfigurable:v,updateRegion:y,clipAttributeList:d})=>React__default.default.createElement("div",{className:index_module.textareaContainer},React__default.default.createElement("div",{className:index_module.textareaContent},React__default.default.createElement(index$6.default,{isCheck:x,result:e==null?void 0:e.value,textInputDisabled:t,textID:(e==null?void 0:e.id)||0,updateText:a,configList:f,autofocus:!t&&b,preContext:u,regions:e==null?void 0:e.regions,clipAttributeConfigurable:S,clipTextConfigurable:q,textConfigurable:v,updateRegion:y,clipAttributeList:d}))),AudioSideBar=e=>{var t,a;const{sider:f,config:b,result:u,updateTagResult:x,updateRegion:S,isEdit:q,tagConfigurable:v,clipConfigurable:y}=e;let d=(b==null?void 0:b.inputList)||[],E=(t=u==null?void 0:u.tag)!=null?t:{},i=(a=u==null?void 0:u.regions)!=null?a:[];const[M,L]=React.useState([]),[C,g]=React.useState("tag");React.useEffect(()=>{if(!v&&y){g("clip");return}g("tag")},[v,y]),React.useEffect(()=>(window.addEventListener("keydown",w),()=>{window.removeEventListener("keydown",w)}));const w=o=>{if(v&&y)switch(o.keyCode){case EKeyCode.L:g("tag");break;case EKeyCode.X:g("clip");break}if(C==="tag"){if(!lbAnnotation.CommonToolUtils.hotkeyFilter(o))return;lbAnnotation.CommonToolUtils.isMoveKey(o==null?void 0:o.keyCode)&&o.preventDefault();let l=o.keyCode;if(l&&(l<=57&&l>=49||l<=105&&l>=97)){l>57?l=l-97:l=l-49;const s=M.slice();d.length===1?(_(0,l),L([0,l]),setTimeout(()=>{L([])},500)):s.length===1?(_(s[0],l),L([s[0],l]),setTimeout(()=>{L([])},500)):L([l])}}},_=(o,l)=>{if(o<d.length&&d[o].subSelected&&l<d[o].subSelected.length){const s=d[o].value,p=d[o].isMulti;let T=d[o].subSelected[l].value,U=0;const I=E;for(const N in E)if(N===d[o].value){if(U++,p===!0){const j=I[N].split(";").filter(k=>k!==""),$=j.indexOf(T);$===-1?j.push(T):j.splice($,1),T=j.join(";")}T===""?delete I[N]:I[N]=T}U===0&&Object.assign(E,{[s]:T}),x(E)}},P=o=>{delete E[o],x(E)},h=v&&y&&React__default.default.createElement(ToggleAudioOption,{setSideTab:g,sideTab:C}),A=C==="tag"&&React__default.default.createElement(index$8.default,{labelInfoSet:v?d:[],labelSelectedList:M,setLabel:_,tagResult:E,clearResult:P,isEdit:q,withPanelTab:!1}),O=C==="clip"&&React__default.default.createElement(index$9,{regions:i,updateRegion:S,useAudioClipStore:index$1.useAudioClipStore});return f?typeof f=="function"?React__default.default.createElement("div",{className:`${index$7.sidebarCls}`},f({toggleAudioOption:h,labelSidebar:A,clipSidebar:O})):f:React__default.default.createElement("div",{className:`${index$7.sidebarCls}`},React__default.default.createElement("div",{className:`${index$7.sidebarCls}__content`},h,A,O))},AudioAnnotate=e=>{var t,a,f,b,u,x,S,q,v;const y=(a=(t=e.style)==null?void 0:t.sider)==null?void 0:a.width,{step:d,stepList:E,audioContext:i,sider:M,drawLayerSlot:L,imgList:C,imgIndex:g,currentData:w,config:_,stepInfo:P}=e,h=lbAnnotation.CommonToolUtils.getCurrentStepToolAndConfig(d,E),A=index.jsonParser(w.result),{toolInstanceRef:O}=annotation.useCustomToolInstance({basicInfo:A}),[o,l]=React.useState(!0),[s,p]=React.useState(null),[T,U]=React.useState(!1),[I,N]=React.useState(0);React.useEffect(()=>{l(!0),U(!0)},[g]),React.useEffect(()=>{o===!1&&te()},[o]),React.useEffect(()=>{O.current.exportData=()=>[[s],{duration:I,valid:K}],O.current.setResult=re,O.current.clearResult=se},[s]);const j=React.useMemo(()=>{const n=A[`step_${P==null?void 0:P.step}`];return(n==null?void 0:n.result)||[]},[_,A,P]),{tagConfigurable:$,textConfigurable:k=!0,clipConfigurable:F=!1,clipAttributeConfigurable:W=!1,clipAttributeList:X=[],clipTextConfigurable:V=!1,inputList:H=[],configList:J=[]}=React.useMemo(()=>{if(h)return lbAnnotation.CommonToolUtils.jsonParser(h==null?void 0:h.config)},[h]),Q={clipConfigurable:F,clipAttributeConfigurable:W,clipAttributeList:X,clipTextConfigurable:V},K=i?i==null?void 0:i.valid:!0,Y=(b=(f=lbAnnotation.CommonToolUtils.jsonParser(w.result))==null?void 0:f.duration)!=null?b:0,Z=K?Y:0,ee=!K||o||![k,V].includes(!0);let z={};if(g!==-1&&(C==null?void 0:C.length)){const n=(u=C[g])==null?void 0:u.preResult,r=(i==null?void 0:i.isEdit)?(x=i==null?void 0:i.stepConfig)==null?void 0:x.loadPreStep:P==null?void 0:P.loadPreStep;if(n&&r){const c=lbAnnotation.CommonToolUtils.jsonParser(n),m=(q=(S=c==null?void 0:c.config)==null?void 0:S.context)!=null?q:{};Object.keys(m).forEach(R=>{R&&m[R]&&(z[R]={visible:!0,content:m[R],type:R})})}}const te=()=>{(j==null?void 0:j.length)>0?p(j[0]):p({id:lbAnnotation.uuid(),sourceID:"",value:G(),tag:ne(),regions:[]})},G=(n=!0)=>{const r={};let c=_.configList||[];return c.length>0&&c.forEach(m=>{r[m.key]=n&&m.default||""}),r},ne=()=>lbAnnotation.TagUtils.getDefaultResultByConfig(_.inputList||[]),oe=({duration:n,hasError:r})=>{l(!1),N(n)},le=n=>{p(r=>__spreadProps(__spreadValues({},r),{regions:((r==null?void 0:r.regions)||[]).filter(c=>c.id!==n)}))},B=n=>{p(r=>{var c;const m=(c=r==null?void 0:r.regions)!=null?c:[],{id:R}=n;return m.find(D=>D.id===R)?__spreadProps(__spreadValues({},r),{regions:m.map(D=>R===D.id?__spreadValues(__spreadValues({},D),n):D)}):__spreadProps(__spreadValues({},r),{regions:[...m,n]})})},ae=(n,r)=>{p(c=>__spreadProps(__spreadValues({},c),{value:__spreadProps(__spreadValues({},c.value),{[r]:n})}))},ie=n=>{p(r=>__spreadProps(__spreadValues({},r),{tag:n}))},re=n=>{p(n)},se=()=>{p(n=>__spreadProps(__spreadValues({},n),{value:G(),tag:{},regions:[]}))};return React__default.default.createElement(index$1.AudioClipProvider,null,React__default.default.createElement(antd.Spin,{spinning:o,wrapperClassName:"audio-tool-spinner"},React__default.default.createElement(es.Layout,{className:dom.getClassName("layout","container"),style:{height:"100%"}},e==null?void 0:e.leftSider,React__default.default.createElement(Content,{className:`${layoutCls}__content`},React__default.default.createElement("div",{className:index_module.containerWrapper},React__default.default.createElement("div",{className:index_module.audioWrapper},$&&React__default.default.createElement(index$2,{result:s==null?void 0:s.tag,labelInfoSet:H,hasPromptLayer:!!(i==null?void 0:i.promptLayer)}),i==null?void 0:i.promptLayer,React__default.default.createElement(index$3.AudioPlayer,__spreadValues({context:{isEdit:i==null?void 0:i.isEdit,count:Z,toolName:EAudioToolName.AudioTextTool,imgIndex:g},drawLayerSlot:L,fileData:w,onLoaded:oe,invalid:!K,updateRegion:B,removeRegion:le,regions:s==null?void 0:s.regions,activeToolPanel:i==null?void 0:i.activeToolPanel,footer:e.footer},Q))),(k||V)&&React__default.default.createElement(AudioTextToolTextarea,{preContext:z,result:s,inputDisabled:ee,updateText:ae,updateRegion:B,configList:J,autofocus:T,textConfigurable:k,clipTextConfigurable:V,clipAttributeList:X,clipAttributeConfigurable:W}))),React__default.default.createElement(Sider,{className:`${layoutCls}__side`,width:y!=null?y:240,style:(v=e.style)==null?void 0:v.sider},React__default.default.createElement(AudioSideBar,{sider:M,config:_,result:s,updateTagResult:ie,updateRegion:B,isEdit:i==null?void 0:i.isEdit,tagConfigurable:$,clipConfigurable:F})),React__default.default.createElement(index$4,null))))};var AudioAnnotate$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(AudioAnnotate);module.exports=AudioAnnotate$1;
@@ -1 +1 @@
1
- "use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),lbUtils=require("@labelbee/lb-utils"),PointCloud2DSingleView=require("./PointCloud2DSingleView.js"),index=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,t)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,__spreadValues=(e,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(e,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(e,t,n[t]);return e},__spreadProps=(e,n)=>__defProps(e,__getOwnPropDescs(n));const EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:n,data:t,setIsEnlarge:v,setCurIndex:u,curIndex:p=0,index:E,annotations2d:c})=>n?React__default.default.createElement(index,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{v(!1),u(void 0)}}),React__default.default.createElement("span",null,t==null?void 0:t.calName),React__default.default.createElement("span",{style:{marginLeft:"8px"}},p+1,"/",c==null?void 0:c.length)):React__default.default.createElement(index,{title:t==null?void 0:t.calName,onClick:()=>{v(!0),u(E)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),PointCloud2DView=({currentData:e,config:n,thumbnailWidth:t,isEnlargeTopView:v,highlightAttribute:u,loadPCDFileLoading:p,checkMode:E})=>{var c;const[s,j]=React.useState([]),{topViewInstance:k,displayPointCloudList:w}=React.useContext(PointCloudContext.PointCloudContext),[_,I]=React.useState(""),[m,b]=React.useState(!1),[a,g]=React.useState(void 0);React.useEffect(()=>{var l;if(!p&&k&&(e==null?void 0:e.mappingImgList)&&((l=e==null?void 0:e.mappingImgList)==null?void 0:l.length)>0){const o={fill:"transparent",color:"green"};let i=[];e==null||e.mappingImgList.forEach(r=>{var d;const V=w.reduce((A,f)=>{var h,L;const T=f.id===_||u===f.attribute,{transferViewData:q,viewRangePointList:y}=(h=lbAnnotation.pointCloudLidar2image(f,r.calib,{createRange:T}))!=null?h:{};if(!q||!y)return[];const O=(L=lbUtils.toolStyleConverter.getColorFromConfig({attribute:f.attribute},__spreadProps(__spreadValues({},n),{attributeConfigurable:!0}),{}))==null?void 0:L.stroke,K=S({viewDataPointList:q,pointCloudBox:f,defaultViewStyle:o,stroke:O}),F=[...A,...K];return(y==null?void 0:y.length)>0&&F.push({type:"polygon",annotation:__spreadProps(__spreadValues({id:_,pointList:y},o),{stroke:O,fill:"rgba(255, 255, 255, 0.6)"})}),F},[]);i.push({annotations:V,url:r==null?void 0:r.url,calName:(d=r==null?void 0:r.calib)==null?void 0:d.calName,calib:r==null?void 0:r.calib,path:r==null?void 0:r.path})}),j(i)}},[w,e==null?void 0:e.mappingImgList,_,u,p]),React.useEffect(()=>(window.addEventListener("keydown",x),()=>{window.removeEventListener("keydown",x)}),[a]);const x=l=>{const{keyCode:o}=l;switch(o){case EKeyCode.Esc:m&&b(!1);break;case EKeyCode.Left:C();break;case EKeyCode.Right:P();break}},C=()=>{a===void 0||!m||Number(a)>0&&g(a-1)},P=()=>{a===void 0||!m||Number(a)<(s==null?void 0:s.length)-1&&g(a+1)},S=({viewDataPointList:l,pointCloudBox:o,defaultViewStyle:i,stroke:r})=>l?l.map(d=>({type:d.type,annotation:__spreadProps(__spreadValues({id:o.id,pointList:d.pointList},i),{stroke:r})})):[],N=!e||!(e==null?void 0:e.mappingImgList)||!(((c=e==null?void 0:e.mappingImgList)==null?void 0:c.length)>0),R=React__default.default.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},React__default.default.createElement("img",{src:icon_left_squareOutlined,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>C()}),React__default.default.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("img",{src:icon_right_squareOutlined,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>P()}),React__default.default.createElement("img",{src:icon_esc,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{b(!1),g(void 0)}}),React__default.default.createElement("span",null,"\u952E\u9000\u51FA"));return(s==null?void 0:s.length)>0?React__default.default.createElement(React__default.default.Fragment,null,s.map((l,o)=>{const i=m&&o===a;return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-2d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:i}),title:React__default.default.createElement(ContainerTitle,{showEnlarge:i,isEnlargeTopView:v,data:l,setIsEnlarge:b,setCurIndex:g,curIndex:a,index:o,annotations2d:s}),titleOnSurface:!i,style:{display:N?"none":"flex",width:i?"100%":t},key:o,toolbar:R},(l==null?void 0:l.annotations)&&(l==null?void 0:l.url)&&React__default.default.createElement(PointCloud2DSingleView,{currentData:e,view2dData:l,setSelectedID:I,showEnlarge:i,checkMode:E}))})):null};var PointCloud2DView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DView);module.exports=PointCloud2DView$1;
1
+ "use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),lbUtils=require("@labelbee/lb-utils"),PointCloud2DSingleView=require("./PointCloud2DSingleView.js"),index=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,t)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,__spreadValues=(e,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(e,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(e,t,n[t]);return e},__spreadProps=(e,n)=>__defProps(e,__getOwnPropDescs(n));const EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:n,data:t,setIsEnlarge:v,setCurIndex:u,curIndex:p=0,index:E,annotations2d:c})=>n?React__default.default.createElement(index,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{v(!1),u(void 0)}}),React__default.default.createElement("span",null,t==null?void 0:t.calName),React__default.default.createElement("span",{style:{marginLeft:"8px"}},p+1,"/",c==null?void 0:c.length)):React__default.default.createElement(index,{title:t==null?void 0:t.calName,onClick:()=>{v(!0),u(E)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),PointCloud2DView=({currentData:e,config:n,thumbnailWidth:t,isEnlargeTopView:v,highlightAttribute:u,loadPCDFileLoading:p,checkMode:E})=>{var c;const[s,j]=React.useState([]),{topViewInstance:k,displayPointCloudList:w}=React.useContext(PointCloudContext.PointCloudContext),[_,I]=React.useState(""),[m,b]=React.useState(!1),[a,g]=React.useState(void 0);React.useEffect(()=>{var l;if(!p&&k&&(e==null?void 0:e.mappingImgList)&&((l=e==null?void 0:e.mappingImgList)==null?void 0:l.length)>0){const o={fill:"transparent",color:"green"};let i=[];e==null||e.mappingImgList.forEach(r=>{var d;const V=w.reduce((A,f)=>{var h,L;const T=f.id===_||u===f.attribute,{transferViewData:q,viewRangePointList:y}=(h=lbAnnotation.pointCloudLidar2image(f,r.calib,{createRange:T}))!=null?h:{};if(!q||!y)return[];const O=(L=lbUtils.toolStyleConverter.getColorFromConfig({attribute:f.attribute},__spreadProps(__spreadValues({},n),{attributeConfigurable:!0}),{}))==null?void 0:L.stroke,K=S({viewDataPointList:q,pointCloudBox:f,defaultViewStyle:o,stroke:O}),F=[...A,...K];return(y==null?void 0:y.length)>0&&F.unshift({type:"polygon",annotation:__spreadProps(__spreadValues({id:_,pointList:y},o),{stroke:O,fill:"rgba(255, 255, 255, 0.6)"})}),F},[]);i.push({annotations:V,url:r==null?void 0:r.url,calName:(d=r==null?void 0:r.calib)==null?void 0:d.calName,calib:r==null?void 0:r.calib,path:r==null?void 0:r.path})}),j(i)}},[w,e==null?void 0:e.mappingImgList,_,u,p]),React.useEffect(()=>(window.addEventListener("keydown",x),()=>{window.removeEventListener("keydown",x)}),[a]);const x=l=>{const{keyCode:o}=l;switch(o){case EKeyCode.Esc:m&&b(!1);break;case EKeyCode.Left:C();break;case EKeyCode.Right:P();break}},C=()=>{a===void 0||!m||Number(a)>0&&g(a-1)},P=()=>{a===void 0||!m||Number(a)<(s==null?void 0:s.length)-1&&g(a+1)},S=({viewDataPointList:l,pointCloudBox:o,defaultViewStyle:i,stroke:r})=>l?l.map(d=>({type:d.type,annotation:__spreadProps(__spreadValues({id:o.id,pointList:d.pointList},i),{stroke:r})})):[],N=!e||!(e==null?void 0:e.mappingImgList)||!(((c=e==null?void 0:e.mappingImgList)==null?void 0:c.length)>0),R=React__default.default.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},React__default.default.createElement("img",{src:icon_left_squareOutlined,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>C()}),React__default.default.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("img",{src:icon_right_squareOutlined,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>P()}),React__default.default.createElement("img",{src:icon_esc,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{b(!1),g(void 0)}}),React__default.default.createElement("span",null,"\u952E\u9000\u51FA"));return(s==null?void 0:s.length)>0?React__default.default.createElement(React__default.default.Fragment,null,s.map((l,o)=>{const i=m&&o===a;return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-2d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:i}),title:React__default.default.createElement(ContainerTitle,{showEnlarge:i,isEnlargeTopView:v,data:l,setIsEnlarge:b,setCurIndex:g,curIndex:a,index:o,annotations2d:s}),titleOnSurface:!i,style:{display:N?"none":"flex",width:i?"100%":t},key:o,toolbar:R},(l==null?void 0:l.annotations)&&(l==null?void 0:l.url)&&React__default.default.createElement(PointCloud2DSingleView,{currentData:e,view2dData:l,setSelectedID:I,showEnlarge:i,checkMode:E}))})):null};var PointCloud2DView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DView);module.exports=PointCloud2DView$1;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useSingleBox=require("./hooks/useSingleBox.js"),reactI18next=require("react-i18next");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,o)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,__spreadValues=(e,t)=>{for(var o in t||(t={}))__hasOwnProp.call(t,o)&&__defNormalProp(e,o,t[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(t))__propIsEnum.call(t,o)&&__defNormalProp(e,o,t[o]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const DECIMAL_PLACES=2,DEFAULT_BOX_INFO_STYLE={color:"white",backgroundColor:"rgba(153, 153, 153, 0.3)",padding:"8px 10px",zIndex:20,fontSize:12},SizeInfoForView=({perspectiveView:e})=>{const{pointCloudBoxList:t,selectedID:o}=React__default.default.useContext(PointCloudContext.PointCloudContext),s=t.find(i=>i.id===o),l=reactI18next.useTranslation(),{t:a}=l;if(o&&s){const{length:i,width:c,height:r}=lbUtils.PointCloudUtils.transferBox2Kitti(s),f=e===lbUtils.EPerspectiveView.Back?[{label:a("Width"),value:c},{label:a("Height"),value:r}]:[{label:a("Length"),value:i},{label:a("Height"),value:r}];return React__default.default.createElement("div",{style:__spreadProps(__spreadValues({position:"absolute"},DEFAULT_BOX_INFO_STYLE),{bottom:"4%",left:"50%",transform:"translate(-50%, 0)"})},f.map((u,n)=>React__default.default.createElement("span",{key:n,style:{marginRight:n===0?16:0}},`${u.label}: ${u.value.toFixed(DECIMAL_PLACES)}`)))}return null},BoxInfos=({checkMode:e,config:t,style:o})=>{const s=React__default.default.useContext(PointCloudContext.PointCloudContext),{selectedBox:l}=useSingleBox.useSingleBox(),[a,i]=React.useState([]),c=reactI18next.useTranslation(),{t:r,i18n:f}=c,u=o;return React.useEffect(()=>{var n;if(!l)return;const{length:b,width:x,height:v,rotation_y:g}=lbUtils.PointCloudUtils.transferBox2Kitti(l.info),{x:h,y:_,z:y}=l.info.center;let d=[{label:"x",value:h.toFixed(DECIMAL_PLACES)},{label:"y",value:_.toFixed(DECIMAL_PLACES)},{label:"z",value:y.toFixed(DECIMAL_PLACES)},{label:r("Length"),value:b.toFixed(DECIMAL_PLACES)},{label:r("Width"),value:x.toFixed(DECIMAL_PLACES)},{label:r("Height"),value:v.toFixed(DECIMAL_PLACES)},{label:r("Rotation_y"),value:lbAnnotation.UnitUtils.rad2deg(g).toFixed(DECIMAL_PLACES)}];(n=s.mainViewInstance)==null||n.filterPointsByBox(l.info).then(p=>{if(!p){i(d);return}d.push({label:r("PointCount"),value:`${p.num}`}),e===!0&&l.info.subAttribute&&t&&lbUtils.PointCloudUtils.getSubAttributeName(l.info.subAttribute,t).forEach(m=>d.push(m)),i(d)})},[l,f.language]),l?React__default.default.createElement("div",{style:o||__spreadProps(__spreadValues({position:"absolute"},DEFAULT_BOX_INFO_STYLE),{right:8,bottom:8})},a.map(n=>u?React__default.default.createElement("div",{key:n.label,style:{margin:"0px 4px"}},`${n.label}: ${n.value}`):React__default.default.createElement("div",{key:n.label},React__default.default.createElement("span",{style:{width:"38px",display:"inline-block",textAlign:"end"}},n.label),": ",React__default.default.createElement("span",null,n.value)))):null},PointCloudValidity=()=>{const e=React__default.default.useContext(PointCloudContext.PointCloudContext),{t}=reactI18next.useTranslation();return e.valid===!1?React__default.default.createElement("div",{style:{position:"absolute",backgroundColor:"rgb(242, 101, 73)",color:"white",opacity:.7,left:0,top:0,fontSize:30,padding:"8px 16px",zIndex:20,width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},t("Invalid")):null};exports.BoxInfos=BoxInfos,exports.PointCloudValidity=PointCloudValidity,exports.SizeInfoForView=SizeInfoForView;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),useSingleBox=require("./hooks/useSingleBox.js"),reactI18next=require("react-i18next");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__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));const DECIMAL_PLACES=2,DEFAULT_BOX_INFO_STYLE={color:"white",backgroundColor:"rgba(153, 153, 153, 0.3)",padding:"8px 10px",zIndex:20,fontSize:12},SizeInfoForView=({perspectiveView:e})=>{const{pointCloudBoxList:t,selectedID:l}=React__default.default.useContext(PointCloudContext.PointCloudContext),u=t.find(a=>a.id===l),n=reactI18next.useTranslation(),{t:i}=n;if(l&&u){const{length:a,width:c,height:r}=lbUtils.PointCloudUtils.transferBox2Kitti(u),f=e===lbUtils.EPerspectiveView.Back?[{label:i("Width"),value:c},{label:i("Height"),value:r}]:[{label:i("Length"),value:a},{label:i("Height"),value:r}];return React__default.default.createElement("div",{style:__spreadProps(__spreadValues({position:"absolute"},DEFAULT_BOX_INFO_STYLE),{bottom:"4%",left:"50%",transform:"translate(-50%, 0)"})},f.map((s,o)=>React__default.default.createElement("span",{key:o,style:{marginRight:o===0?16:0}},`${s.label}: ${s.value.toFixed(DECIMAL_PLACES)}`)))}return null},BoxInfos=({checkMode:e,config:t,style:l})=>{const u=React__default.default.useContext(PointCloudContext.PointCloudContext),{selectedBox:n}=useSingleBox.useSingleBox(),[i,a]=React.useState([]),c=reactI18next.useTranslation(),{t:r,i18n:f}=c,s=l;return React.useEffect(()=>{var o,p;if(!n)return;const{length:b,width:v,height:x,rotation_y:m}=lbUtils.PointCloudUtils.transferBox2Kitti(n.info),{x:g,y:h,z:_}=n.info.center;let d=[{label:"x",value:g==null?void 0:g.toFixed(DECIMAL_PLACES)},{label:"y",value:h==null?void 0:h.toFixed(DECIMAL_PLACES)},{label:"z",value:_==null?void 0:_.toFixed(DECIMAL_PLACES)},{label:r("Length"),value:b==null?void 0:b.toFixed(DECIMAL_PLACES)},{label:r("Width"),value:v==null?void 0:v.toFixed(DECIMAL_PLACES)},{label:r("Height"),value:x==null?void 0:x.toFixed(DECIMAL_PLACES)},{label:r("Rotation_y"),value:(o=lbAnnotation.UnitUtils.rad2deg(m))==null?void 0:o.toFixed(DECIMAL_PLACES)}];(p=u.mainViewInstance)==null||p.filterPointsByBox(n.info).then(y=>{if(!y){a(d);return}d.push({label:r("PointCount"),value:`${y.num}`}),e===!0&&n.info.subAttribute&&t&&lbUtils.PointCloudUtils.getSubAttributeName(n.info.subAttribute,t).forEach(C=>d.push(C)),a(d)})},[n,f.language]),n?React__default.default.createElement("div",{style:l||__spreadProps(__spreadValues({position:"absolute"},DEFAULT_BOX_INFO_STYLE),{right:8,bottom:8})},i.map(o=>s?React__default.default.createElement("div",{key:o.label,style:{margin:"0px 4px"}},`${o.label}: ${o.value}`):React__default.default.createElement("div",{key:o.label},React__default.default.createElement("span",{style:{width:"38px",display:"inline-block",textAlign:"end"}},o.label),": ",React__default.default.createElement("span",null,o.value)))):null},PointCloudValidity=()=>{const e=React__default.default.useContext(PointCloudContext.PointCloudContext),{t}=reactI18next.useTranslation();return e.valid===!1?React__default.default.createElement("div",{style:{position:"absolute",backgroundColor:"rgb(242, 101, 73)",color:"white",opacity:.7,left:0,top:0,fontSize:30,padding:"8px 16px",zIndex:20,width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},t("Invalid")):null};exports.BoxInfos=BoxInfos,exports.PointCloudValidity=PointCloudValidity,exports.SizeInfoForView=SizeInfoForView;
@@ -1 +1 @@
1
- "use strict";var React=require("react"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),PointCloudContext=require("./PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),useAttribute=require("./hooks/useAttribute.js"),actionCreators=require("../../store/annotation/actionCreators.js");const PointCloudSegmentListener=({checkMode:m,currentData:l,imgIndex:v,highlightAttribute:a,config:C,toolInstanceRef:u})=>{const s=ctx.useDispatch(),{updateSegmentAttribute:S,updateSegmentSubAttribute:b}=useAttribute.useAttribute(),n=React.useContext(PointCloudContext.PointCloudContext),{ptSegmentInstance:e,setSegmentation:d}=n;React.useEffect(()=>{var t;if(e&&l.url)return actionCreators.SetPointCloudLoading(s,!0),e.emit("clearStash"),e.emit("clearAllSegmentData"),e.loadPCDFile((t=l==null?void 0:l.url)!=null?t:"").then(()=>{var o,r;const i=lbUtils.PointCloudUtils.getSegmentFromResultList((o=l==null?void 0:l.result)!=null?o:"");(r=e==null?void 0:e.store)==null||r.updateCurrentSegment(i),actionCreators.SetPointCloudLoading(s,!1)}),e.on("syncSegmentData",d),()=>{e.unbind("syncSegmentData",d)}},[v,e]),React.useEffect(()=>{var t;(t=e==null?void 0:e.store)==null||t.highlightPointsByAttribute(a!=null?a:"")},[a,e]);const g=(t,o)=>{var r,i;switch(t){case"h":e==null||e.emit("LassoSelector");break;case"j":e==null||e.emit("RectSelector");break;case"k":e==null||e.emit("CircleSelector");break;case"u":e==null||e.emit("setSegmentMode",lbUtils.EPointCloudSegmentMode.Add);break;case"i":e==null||e.emit("setSegmentMode",lbUtils.EPointCloudSegmentMode.Remove);break;case"enter":e==null||e.emit("updateCheck2Edit");break;case"delete":e==null||e.emit("deleteSelectedSegmentData",(i=(r=e.store)==null?void 0:r.cacheSegData)==null?void 0:i.id);break}},c=t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||m===!0)return;const o=t.key.toLocaleLowerCase();g(o)};return React.useEffect(()=>(window.addEventListener("keydown",c),u.current.setDefaultAttribute=t=>{S(t),e==null||e.emit("updateDefaultAttribute",{newAttribute:t})},u.current.setSubAttribute=(t,o)=>{b(t,o)},()=>{window.removeEventListener("keydown",c)}),[e]),React.useEffect(()=>{u.current.clearResult=()=>{!n.ptSegmentInstance||(n.ptSegmentInstance.emit("clearStash"),n.ptSegmentInstance.emit("clearAllSegmentData"))}},[n.pointCloudBoxList,n.valid,n.polygonList,n.lineList,n.pointCloudSphereList,n.ptSegmentInstance]),null};var PointCloudSegmentListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudSegmentListener);module.exports=PointCloudSegmentListener$1;
1
+ "use strict";var React=require("react"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),PointCloudContext=require("./PointCloudContext.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),useAttribute=require("./hooks/useAttribute.js"),actionCreators=require("../../store/annotation/actionCreators.js"),index=require("../../utils/index.js");const PointCloudSegmentListener=({checkMode:v,currentData:l,imgIndex:S,highlightAttribute:a,config:p,toolInstanceRef:u,configString:s})=>{const d=ctx.useDispatch(),{updateSegmentAttribute:C,updateSegmentSubAttribute:b}=useAttribute.useAttribute(),n=React.useContext(PointCloudContext.PointCloudContext),{ptSegmentInstance:e,setSegmentation:c}=n;React.useEffect(()=>{var t;if(e&&l.url)return actionCreators.SetPointCloudLoading(d,!0),e.emit("clearStash"),e.emit("clearAllSegmentData"),e.loadPCDFile((t=l==null?void 0:l.url)!=null?t:"").then(()=>{var o,r;const i=lbUtils.PointCloudUtils.getSegmentFromResultList((o=l==null?void 0:l.result)!=null?o:"");(r=e==null?void 0:e.store)==null||r.updateCurrentSegment(i),actionCreators.SetPointCloudLoading(d,!1)}),e.on("syncSegmentData",c),()=>{e.unbind("syncSegmentData",c)}},[S,e]),React.useEffect(()=>{var t;(t=e==null?void 0:e.store)==null||t.highlightPointsByAttribute(a!=null?a:"")},[a,e]),React.useEffect(()=>{e==null||e.setConfig(index.jsonParser(s))},[s]);const g=(t,o)=>{var r,i;switch(t){case"h":e==null||e.emit("LassoSelector");break;case"j":e==null||e.emit("RectSelector");break;case"k":e==null||e.emit("CircleSelector");break;case"u":e==null||e.emit("setSegmentMode",lbUtils.EPointCloudSegmentMode.Add);break;case"i":e==null||e.emit("setSegmentMode",lbUtils.EPointCloudSegmentMode.Remove);break;case"enter":e==null||e.emit("updateCheck2Edit");break;case"delete":e==null||e.emit("deleteSelectedSegmentData",(i=(r=e.store)==null?void 0:r.cacheSegData)==null?void 0:i.id);break}},m=t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||v===!0)return;const o=t.key.toLocaleLowerCase();g(o)};return React.useEffect(()=>(window.addEventListener("keydown",m),u.current.setDefaultAttribute=t=>{C(t),e==null||e.emit("updateDefaultAttribute",{newAttribute:t})},u.current.setSubAttribute=(t,o)=>{b(t,o)},()=>{window.removeEventListener("keydown",m)}),[e]),React.useEffect(()=>{u.current.clearResult=()=>{!n.ptSegmentInstance||(n.ptSegmentInstance.emit("clearStash"),n.ptSegmentInstance.emit("clearAllSegmentData"))}},[n.pointCloudBoxList,n.valid,n.polygonList,n.lineList,n.pointCloudSphereList,n.ptSegmentInstance]),null};var PointCloudSegmentListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudSegmentListener);module.exports=PointCloudSegmentListener$1;
@@ -1 +1 @@
1
- import o,{useState as W,useEffect as U,useMemo as te}from"react";import{AudioPlayer as Ee}from"../audioPlayer/index.js";import{getClassName as _e}from"../../utils/dom.js";import Ce from"../predictTracking/previewResult/index.js";import{Layout as oe}from"antd/es";import{Spin as je}from"antd";import{prefix as Re}from"../../constant/index.js";import{cKeyCode as Te,CommonToolUtils as K,uuid as Pe,TagUtils as Le,cTool as he}from"@labelbee/lb-annotation";import N from"./index.module.scss.js";import we from"./tagResultShow/index.js";import{AudioClipProvider as Ae,useAudioClipStore as Oe}from"./audioContext/index.js";import Ie from"./textInput/index.js";import{connect as Ne}from"react-redux";import{a2MapStateToProps as ke}from"../../store/annotation/map.js";import{LabelBeeContext as $e}from"../../store/ctx.js";import{jsonParser as De}from"../../utils/index.js";import{useCustomToolInstance as Me}from"../../hooks/annotation.js";import{sidebarCls as Q}from"../../views/MainView/sidebar/index.js";import Ve from"./audioSide/labelSidebar/index.js";import Ke from"./audioSide/clipSidebar/index.js";import Be from"../../assets/annotation/audio/tag.svg.js";import Fe from"../../assets/annotation/audio/tagA.svg.js";import We from"../../assets/annotation/audio/clip.svg.js";import Ue from"../../assets/annotation/audio/clipA.svg.js";var Xe=Object.defineProperty,qe=Object.defineProperties,ze=Object.getOwnPropertyDescriptors,ne=Object.getOwnPropertySymbols,Ge=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable,ie=(e,t,s)=>t in e?Xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,y=(e,t)=>{for(var s in t||(t={}))Ge.call(t,s)&&ie(e,s,t[s]);if(ne)for(var s of ne(t))He.call(t,s)&&ie(e,s,t[s]);return e},k=(e,t)=>qe(e,ze(t));const{EAudioToolName:Je}=he,le=Te.default,{Sider:Qe,Content:Ye}=oe,se=`${Re}-layout`,Ze=({setSideTab:e,sideTab:t})=>{const s=[{tab:"tag",commonSvg:Be,selectedSvg:Fe},{tab:"clip",commonSvg:We,selectedSvg:Ue}];return o.createElement("div",{className:N.toggleAudioOption},s.map((m,S)=>{const{tab:c,selectedSvg:x,commonSvg:C}=m;return o.createElement("div",{key:S,className:N.option},o.createElement("img",{className:N.icon,src:t===c?x:C,onClick:()=>{t!==c&&e(c)}}))}))},et=({result:e,inputDisabled:t,updateText:s,configList:m,autofocus:S,preContext:c,isCheck:x,clipAttributeConfigurable:C,clipTextConfigurable:$,textConfigurable:p,updateRegion:E,clipAttributeList:d})=>o.createElement("div",{className:N.textareaContainer},o.createElement("div",{className:N.textareaContent},o.createElement(Ie,{isCheck:x,result:e==null?void 0:e.value,textInputDisabled:t,textID:(e==null?void 0:e.id)||0,updateText:s,configList:m,autofocus:!t&&S,preContext:c,regions:e==null?void 0:e.regions,clipAttributeConfigurable:C,clipTextConfigurable:$,textConfigurable:p,updateRegion:E,clipAttributeList:d}))),tt=e=>{var t,s;const{sider:m,config:S,result:c,updateTagResult:x,updateRegion:C,isEdit:$,tagConfigurable:p,clipConfigurable:E}=e;let d=(S==null?void 0:S.inputList)||[],_=(t=c==null?void 0:c.tag)!=null?t:{},r=(s=c==null?void 0:c.regions)!=null?s:[];const[X,h]=W([]),[j,g]=W("tag");U(()=>{if(!p&&E){g("clip");return}g("tag")},[p,E]),U(()=>(window.addEventListener("keydown",D),()=>{window.removeEventListener("keydown",D)}));const D=i=>{if(p&&E)switch(i.keyCode){case le.L:g("tag");break;case le.X:g("clip");break}if(j==="tag"){if(!K.hotkeyFilter(i))return;K.isMoveKey(i==null?void 0:i.keyCode)&&i.preventDefault();let l=i.keyCode;if(l&&(l<=57&&l>=49||l<=105&&l>=97)){l>57?l=l-97:l=l-49;const u=X.slice();d.length===1?(R(0,l),h([0,l]),setTimeout(()=>{h([])},500)):u.length===1?(R(u[0],l),h([u[0],l]),setTimeout(()=>{h([])},500)):h([l])}}},R=(i,l)=>{if(i<d.length&&d[i].subSelected&&l<d[i].subSelected.length){const u=d[i].value,v=d[i].isMulti;let T=d[i].subSelected[l].value,q=0;const O=_;for(const I in _)if(I===d[i].value){if(q++,v===!0){const P=O[I].split(";").filter(z=>z!==""),B=P.indexOf(T);B===-1?P.push(T):P.splice(B,1),T=P.join(";")}T===""?delete O[I]:O[I]=T}q===0&&Object.assign(_,{[u]:T}),x(_)}},w=i=>{delete _[i],x(_)},A=p&&E&&o.createElement(Ze,{setSideTab:g,sideTab:j}),M=j==="tag"&&o.createElement(Ve,{labelInfoSet:p?d:[],labelSelectedList:X,setLabel:R,tagResult:_,clearResult:w,isEdit:$,withPanelTab:!1}),V=j==="clip"&&o.createElement(Ke,{regions:r,updateRegion:C,useAudioClipStore:Oe});return m?typeof m=="function"?o.createElement("div",{className:`${Q}`},m({toggleAudioOption:A,labelSidebar:M,clipSidebar:V})):m:o.createElement("div",{className:`${Q}`},o.createElement("div",{className:`${Q}__content`},A,M,V))},ot=e=>{var t,s,m,S,c,x,C,$,p;const E=(s=(t=e.style)==null?void 0:t.sider)==null?void 0:s.width,{step:d,stepList:_,audioContext:r,sider:X,drawLayerSlot:h,imgList:j,imgIndex:g,currentData:D,config:R,stepInfo:w}=e,A=K.getCurrentStepToolAndConfig(d,_),M=De(D.result),{toolInstanceRef:V}=Me({basicInfo:M}),[i,l]=W(!0),[u,v]=W(null),[T,q]=W(!1);U(()=>{l(!0),q(!0)},[g]),U(()=>{i===!1&&me()},[i]),U(()=>{V.current.exportData=()=>[[u],{}],V.current.setResult=Se,V.current.clearResult=xe},[u]);const O=te(()=>{const n=M[`step_${w==null?void 0:w.step}`];return(n==null?void 0:n.result)||[]},[R,M,w]),{tagConfigurable:I,textConfigurable:P=!0,clipConfigurable:B=!1,clipAttributeConfigurable:z=!1,clipAttributeList:Y=[],clipTextConfigurable:G=!1,inputList:re=[],configList:ae=[]}=te(()=>{if(A)return K.jsonParser(A==null?void 0:A.config)},[A]),ue={clipConfigurable:B,clipAttributeConfigurable:z,clipAttributeList:Y,clipTextConfigurable:G},H=r?r==null?void 0:r.valid:!0,ce=(S=(m=K.jsonParser(D.result))==null?void 0:m.duration)!=null?S:0,de=H?ce:0,fe=!H||i||![P,G].includes(!0);let Z={};if(g!==-1&&(j==null?void 0:j.length)){const n=(c=j[g])==null?void 0:c.preResult,a=(r==null?void 0:r.isEdit)?(x=r==null?void 0:r.stepConfig)==null?void 0:x.loadPreStep:w==null?void 0:w.loadPreStep;if(n&&a){const f=K.jsonParser(n),b=($=(C=f==null?void 0:f.config)==null?void 0:C.context)!=null?$:{};Object.keys(b).forEach(L=>{L&&b[L]&&(Z[L]={visible:!0,content:b[L],type:L})})}}const me=()=>{(O==null?void 0:O.length)>0?v(O[0]):v({id:Pe(),sourceID:"",value:ee(),tag:pe(),regions:[]})},ee=(n=!0)=>{const a={};let f=R.configList||[];return f.length>0&&f.forEach(b=>{a[b.key]=n&&b.default||""}),a},pe=()=>Le.getDefaultResultByConfig(R.inputList||[]),ge=({duration:n,hasError:a})=>{l(!1)},ve=n=>{v(a=>k(y({},a),{regions:((a==null?void 0:a.regions)||[]).filter(f=>f.id!==n)}))},J=n=>{v(a=>{var f;const b=(f=a==null?void 0:a.regions)!=null?f:[],{id:L}=n;return b.find(F=>F.id===L)?k(y({},a),{regions:b.map(F=>L===F.id?y(y({},F),n):F)}):k(y({},a),{regions:[...b,n]})})},be=(n,a)=>{v(f=>k(y({},f),{value:k(y({},f.value),{[a]:n})}))},ye=n=>{v(a=>k(y({},a),{tag:n}))},Se=n=>{v(n)},xe=()=>{v(n=>k(y({},n),{value:ee(),tag:{},regions:[]}))};return o.createElement(Ae,null,o.createElement(je,{spinning:i,wrapperClassName:"audio-tool-spinner"},o.createElement(oe,{className:_e("layout","container"),style:{height:"100%"}},e==null?void 0:e.leftSider,o.createElement(Ye,{className:`${se}__content`},o.createElement("div",{className:N.containerWrapper},o.createElement("div",{className:N.audioWrapper},I&&o.createElement(we,{result:u==null?void 0:u.tag,labelInfoSet:re,hasPromptLayer:!!(r==null?void 0:r.promptLayer)}),r==null?void 0:r.promptLayer,o.createElement(Ee,y({context:{isEdit:r==null?void 0:r.isEdit,count:de,toolName:Je.AudioTextTool,imgIndex:g},drawLayerSlot:h,fileData:D,onLoaded:ge,invalid:!H,updateRegion:J,removeRegion:ve,regions:u==null?void 0:u.regions,activeToolPanel:r==null?void 0:r.activeToolPanel,footer:e.footer},ue))),(P||G)&&o.createElement(et,{preContext:Z,result:u,inputDisabled:fe,updateText:be,updateRegion:J,configList:ae,autofocus:T,textConfigurable:P,clipTextConfigurable:G,clipAttributeList:Y,clipAttributeConfigurable:z}))),o.createElement(Qe,{className:`${se}__side`,width:E!=null?E:240,style:(p=e.style)==null?void 0:p.sider},o.createElement(tt,{sider:X,config:R,result:u,updateTagResult:ye,updateRegion:J,isEdit:r==null?void 0:r.isEdit,tagConfigurable:I,clipConfigurable:B})),o.createElement(Ce,null))))};var nt=Ne(ke,null,null,{context:$e})(ot);export{nt as default};
1
+ import o,{useState as V,useEffect as X,useMemo as ne}from"react";import{AudioPlayer as Ce}from"../audioPlayer/index.js";import{getClassName as je}from"../../utils/dom.js";import Re from"../predictTracking/previewResult/index.js";import{Layout as ie}from"antd/es";import{Spin as Te}from"antd";import{prefix as Pe}from"../../constant/index.js";import{cKeyCode as Le,CommonToolUtils as K,uuid as he,TagUtils as we,cTool as Ae}from"@labelbee/lb-annotation";import O from"./index.module.scss.js";import Oe from"./tagResultShow/index.js";import{AudioClipProvider as Ie,useAudioClipStore as Ne}from"./audioContext/index.js";import ke from"./textInput/index.js";import{connect as De}from"react-redux";import{a2MapStateToProps as $e}from"../../store/annotation/map.js";import{LabelBeeContext as Me}from"../../store/ctx.js";import{jsonParser as Ve}from"../../utils/index.js";import{useCustomToolInstance as Ke}from"../../hooks/annotation.js";import{sidebarCls as Q}from"../../views/MainView/sidebar/index.js";import Be from"./audioSide/labelSidebar/index.js";import Fe from"./audioSide/clipSidebar/index.js";import We from"../../assets/annotation/audio/tag.svg.js";import Ue from"../../assets/annotation/audio/tagA.svg.js";import Xe from"../../assets/annotation/audio/clip.svg.js";import qe from"../../assets/annotation/audio/clipA.svg.js";var ze=Object.defineProperty,Ge=Object.defineProperties,He=Object.getOwnPropertyDescriptors,le=Object.getOwnPropertySymbols,Je=Object.prototype.hasOwnProperty,Qe=Object.prototype.propertyIsEnumerable,se=(e,t,s)=>t in e?ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,y=(e,t)=>{for(var s in t||(t={}))Je.call(t,s)&&se(e,s,t[s]);if(le)for(var s of le(t))Qe.call(t,s)&&se(e,s,t[s]);return e},I=(e,t)=>Ge(e,He(t));const{EAudioToolName:Ye}=Ae,re=Le.default,{Sider:Ze,Content:et}=ie,ae=`${Pe}-layout`,tt=({setSideTab:e,sideTab:t})=>{const s=[{tab:"tag",commonSvg:We,selectedSvg:Ue},{tab:"clip",commonSvg:Xe,selectedSvg:qe}];return o.createElement("div",{className:O.toggleAudioOption},s.map((m,S)=>{const{tab:c,selectedSvg:x,commonSvg:C}=m;return o.createElement("div",{key:S,className:O.option},o.createElement("img",{className:O.icon,src:t===c?x:C,onClick:()=>{t!==c&&e(c)}}))}))},ot=({result:e,inputDisabled:t,updateText:s,configList:m,autofocus:S,preContext:c,isCheck:x,clipAttributeConfigurable:C,clipTextConfigurable:N,textConfigurable:p,updateRegion:E,clipAttributeList:d})=>o.createElement("div",{className:O.textareaContainer},o.createElement("div",{className:O.textareaContent},o.createElement(ke,{isCheck:x,result:e==null?void 0:e.value,textInputDisabled:t,textID:(e==null?void 0:e.id)||0,updateText:s,configList:m,autofocus:!t&&S,preContext:c,regions:e==null?void 0:e.regions,clipAttributeConfigurable:C,clipTextConfigurable:N,textConfigurable:p,updateRegion:E,clipAttributeList:d}))),nt=e=>{var t,s;const{sider:m,config:S,result:c,updateTagResult:x,updateRegion:C,isEdit:N,tagConfigurable:p,clipConfigurable:E}=e;let d=(S==null?void 0:S.inputList)||[],_=(t=c==null?void 0:c.tag)!=null?t:{},r=(s=c==null?void 0:c.regions)!=null?s:[];const[q,h]=V([]),[j,g]=V("tag");X(()=>{if(!p&&E){g("clip");return}g("tag")},[p,E]),X(()=>(window.addEventListener("keydown",k),()=>{window.removeEventListener("keydown",k)}));const k=i=>{if(p&&E)switch(i.keyCode){case re.L:g("tag");break;case re.X:g("clip");break}if(j==="tag"){if(!K.hotkeyFilter(i))return;K.isMoveKey(i==null?void 0:i.keyCode)&&i.preventDefault();let l=i.keyCode;if(l&&(l<=57&&l>=49||l<=105&&l>=97)){l>57?l=l-97:l=l-49;const u=q.slice();d.length===1?(R(0,l),h([0,l]),setTimeout(()=>{h([])},500)):u.length===1?(R(u[0],l),h([u[0],l]),setTimeout(()=>{h([])},500)):h([l])}}},R=(i,l)=>{if(i<d.length&&d[i].subSelected&&l<d[i].subSelected.length){const u=d[i].value,v=d[i].isMulti;let T=d[i].subSelected[l].value,z=0;const B=_;for(const M in _)if(M===d[i].value){if(z++,v===!0){const P=B[M].split(";").filter(W=>W!==""),F=P.indexOf(T);F===-1?P.push(T):P.splice(F,1),T=P.join(";")}T===""?delete B[M]:B[M]=T}z===0&&Object.assign(_,{[u]:T}),x(_)}},w=i=>{delete _[i],x(_)},A=p&&E&&o.createElement(tt,{setSideTab:g,sideTab:j}),D=j==="tag"&&o.createElement(Be,{labelInfoSet:p?d:[],labelSelectedList:q,setLabel:R,tagResult:_,clearResult:w,isEdit:N,withPanelTab:!1}),$=j==="clip"&&o.createElement(Fe,{regions:r,updateRegion:C,useAudioClipStore:Ne});return m?typeof m=="function"?o.createElement("div",{className:`${Q}`},m({toggleAudioOption:A,labelSidebar:D,clipSidebar:$})):m:o.createElement("div",{className:`${Q}`},o.createElement("div",{className:`${Q}__content`},A,D,$))},it=e=>{var t,s,m,S,c,x,C,N,p;const E=(s=(t=e.style)==null?void 0:t.sider)==null?void 0:s.width,{step:d,stepList:_,audioContext:r,sider:q,drawLayerSlot:h,imgList:j,imgIndex:g,currentData:k,config:R,stepInfo:w}=e,A=K.getCurrentStepToolAndConfig(d,_),D=Ve(k.result),{toolInstanceRef:$}=Ke({basicInfo:D}),[i,l]=V(!0),[u,v]=V(null),[T,z]=V(!1),[B,M]=V(0);X(()=>{l(!0),z(!0)},[g]),X(()=>{i===!1&&ge()},[i]),X(()=>{$.current.exportData=()=>[[u],{duration:B,valid:H}],$.current.setResult=Ee,$.current.clearResult=_e},[u]);const P=ne(()=>{const n=D[`step_${w==null?void 0:w.step}`];return(n==null?void 0:n.result)||[]},[R,D,w]),{tagConfigurable:F,textConfigurable:W=!0,clipConfigurable:Y=!1,clipAttributeConfigurable:Z=!1,clipAttributeList:ee=[],clipTextConfigurable:G=!1,inputList:ue=[],configList:ce=[]}=ne(()=>{if(A)return K.jsonParser(A==null?void 0:A.config)},[A]),de={clipConfigurable:Y,clipAttributeConfigurable:Z,clipAttributeList:ee,clipTextConfigurable:G},H=r?r==null?void 0:r.valid:!0,fe=(S=(m=K.jsonParser(k.result))==null?void 0:m.duration)!=null?S:0,me=H?fe:0,pe=!H||i||![W,G].includes(!0);let te={};if(g!==-1&&(j==null?void 0:j.length)){const n=(c=j[g])==null?void 0:c.preResult,a=(r==null?void 0:r.isEdit)?(x=r==null?void 0:r.stepConfig)==null?void 0:x.loadPreStep:w==null?void 0:w.loadPreStep;if(n&&a){const f=K.jsonParser(n),b=(N=(C=f==null?void 0:f.config)==null?void 0:C.context)!=null?N:{};Object.keys(b).forEach(L=>{L&&b[L]&&(te[L]={visible:!0,content:b[L],type:L})})}}const ge=()=>{(P==null?void 0:P.length)>0?v(P[0]):v({id:he(),sourceID:"",value:oe(),tag:ve(),regions:[]})},oe=(n=!0)=>{const a={};let f=R.configList||[];return f.length>0&&f.forEach(b=>{a[b.key]=n&&b.default||""}),a},ve=()=>we.getDefaultResultByConfig(R.inputList||[]),be=({duration:n,hasError:a})=>{l(!1),M(n)},ye=n=>{v(a=>I(y({},a),{regions:((a==null?void 0:a.regions)||[]).filter(f=>f.id!==n)}))},J=n=>{v(a=>{var f;const b=(f=a==null?void 0:a.regions)!=null?f:[],{id:L}=n;return b.find(U=>U.id===L)?I(y({},a),{regions:b.map(U=>L===U.id?y(y({},U),n):U)}):I(y({},a),{regions:[...b,n]})})},Se=(n,a)=>{v(f=>I(y({},f),{value:I(y({},f.value),{[a]:n})}))},xe=n=>{v(a=>I(y({},a),{tag:n}))},Ee=n=>{v(n)},_e=()=>{v(n=>I(y({},n),{value:oe(),tag:{},regions:[]}))};return o.createElement(Ie,null,o.createElement(Te,{spinning:i,wrapperClassName:"audio-tool-spinner"},o.createElement(ie,{className:je("layout","container"),style:{height:"100%"}},e==null?void 0:e.leftSider,o.createElement(et,{className:`${ae}__content`},o.createElement("div",{className:O.containerWrapper},o.createElement("div",{className:O.audioWrapper},F&&o.createElement(Oe,{result:u==null?void 0:u.tag,labelInfoSet:ue,hasPromptLayer:!!(r==null?void 0:r.promptLayer)}),r==null?void 0:r.promptLayer,o.createElement(Ce,y({context:{isEdit:r==null?void 0:r.isEdit,count:me,toolName:Ye.AudioTextTool,imgIndex:g},drawLayerSlot:h,fileData:k,onLoaded:be,invalid:!H,updateRegion:J,removeRegion:ye,regions:u==null?void 0:u.regions,activeToolPanel:r==null?void 0:r.activeToolPanel,footer:e.footer},de))),(W||G)&&o.createElement(ot,{preContext:te,result:u,inputDisabled:pe,updateText:Se,updateRegion:J,configList:ce,autofocus:T,textConfigurable:W,clipTextConfigurable:G,clipAttributeList:ee,clipAttributeConfigurable:Z}))),o.createElement(Ze,{className:`${ae}__side`,width:E!=null?E:240,style:(p=e.style)==null?void 0:p.sider},o.createElement(nt,{sider:q,config:R,result:u,updateTagResult:xe,updateRegion:J,isEdit:r==null?void 0:r.isEdit,tagConfigurable:F,clipConfigurable:Y})),o.createElement(Re,null))))};var lt=De($e,null,null,{context:Me})(it);export{lt as default};
@@ -1 +1 @@
1
- import{getClassName as R}from"../../utils/dom.js";import n,{useState as b,useContext as Y,useEffect as A}from"react";import{PointCloudContainer as Z}from"./PointCloudLayout.js";import{PointCloudContext as B}from"./PointCloudContext.js";import{connect as D}from"react-redux";import{cKeyCode as ee,pointCloudLidar2image as te}from"@labelbee/lb-annotation";import{LabelBeeContext as ne}from"../../store/ctx.js";import{a2MapStateToProps as oe}from"../../store/annotation/map.js";import{toolStyleConverter as ie}from"@labelbee/lb-utils";import le from"./PointCloud2DSingleView.js";import T from"./components/TitleButton/index.js";import{LeftOutlined as re}from"@ant-design/icons";import se from"classnames";import ae from"../../assets/annotation/common/icon_esc.svg.js";import ue from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import ce from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";var me=Object.defineProperty,pe=Object.defineProperties,de=Object.getOwnPropertyDescriptors,K=Object.getOwnPropertySymbols,fe=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable,$=(e,o,t)=>o in e?me(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,h=(e,o)=>{for(var t in o||(o={}))fe.call(o,t)&&$(e,t,o[t]);if(K)for(var t of K(o))ge.call(o,t)&&$(e,t,o[t]);return e},x=(e,o)=>pe(e,de(o));const C=ee.default,ve=({showEnlarge:e,isEnlargeTopView:o,data:t,setIsEnlarge:f,setCurIndex:c,curIndex:g=0,index:w,annotations2d:m})=>o?n.createElement(T,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?n.createElement("div",{style:{display:"flex",alignItems:"center"}},n.createElement(re,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{f(!1),c(void 0)}}),n.createElement("span",null,t==null?void 0:t.calName),n.createElement("span",{style:{marginLeft:"8px"}},g+1,"/",m==null?void 0:m.length)):n.createElement(T,{title:t==null?void 0:t.calName,onClick:()=>{f(!0),c(w)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),ye=({currentData:e,config:o,thumbnailWidth:t,isEnlargeTopView:f,highlightAttribute:c,loadPCDFileLoading:g,checkMode:w})=>{var m;const[u,q]=b([]),{topViewInstance:z,displayPointCloudList:L}=Y(B),[_,M]=b(""),[v,P]=b(!1),[a,y]=b(void 0);A(()=>{var i;if(!g&&z&&(e==null?void 0:e.mappingImgList)&&((i=e==null?void 0:e.mappingImgList)==null?void 0:i.length)>0){const r={fill:"transparent",color:"green"};let s=[];e==null||e.mappingImgList.forEach(l=>{var p;const Q=L.reduce((U,d)=>{var k,I;const W=d.id===_||c===d.attribute,{transferViewData:N,viewRangePointList:E}=(k=te(d,l.calib,{createRange:W}))!=null?k:{};if(!N||!E)return[];const S=(I=ie.getColorFromConfig({attribute:d.attribute},x(h({},o),{attributeConfigurable:!0}),{}))==null?void 0:I.stroke,X=G({viewDataPointList:N,pointCloudBox:d,defaultViewStyle:r,stroke:S}),V=[...U,...X];return(E==null?void 0:E.length)>0&&V.push({type:"polygon",annotation:x(h({id:_,pointList:E},r),{stroke:S,fill:"rgba(255, 255, 255, 0.6)"})}),V},[]);s.push({annotations:Q,url:l==null?void 0:l.url,calName:(p=l==null?void 0:l.calib)==null?void 0:p.calName,calib:l==null?void 0:l.calib,path:l==null?void 0:l.path})}),q(s)}},[L,e==null?void 0:e.mappingImgList,_,c,g]),A(()=>(window.addEventListener("keydown",F),()=>{window.removeEventListener("keydown",F)}),[a]);const F=i=>{const{keyCode:r}=i;switch(r){case C.Esc:v&&P(!1);break;case C.Left:O();break;case C.Right:j();break}},O=()=>{a===void 0||!v||Number(a)>0&&y(a-1)},j=()=>{a===void 0||!v||Number(a)<(u==null?void 0:u.length)-1&&y(a+1)},G=({viewDataPointList:i,pointCloudBox:r,defaultViewStyle:s,stroke:l})=>i?i.map(p=>({type:p.type,annotation:x(h({id:r.id,pointList:p.pointList},s),{stroke:l})})):[],H=!e||!(e==null?void 0:e.mappingImgList)||!(((m=e==null?void 0:e.mappingImgList)==null?void 0:m.length)>0),J=n.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},n.createElement("img",{src:ue,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>O()}),n.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),n.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),n.createElement("img",{src:ce,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>j()}),n.createElement("img",{src:ae,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{P(!1),y(void 0)}}),n.createElement("span",null,"\u952E\u9000\u51FA"));return(u==null?void 0:u.length)>0?n.createElement(n.Fragment,null,u.map((i,r)=>{const s=v&&r===a;return n.createElement(Z,{className:se({[R("point-cloud-2d-container")]:!0,[R("point-cloud-container","zoom")]:s}),title:n.createElement(ve,{showEnlarge:s,isEnlargeTopView:f,data:i,setIsEnlarge:P,setCurIndex:y,curIndex:a,index:r,annotations2d:u}),titleOnSurface:!s,style:{display:H?"none":"flex",width:s?"100%":t},key:r,toolbar:J},(i==null?void 0:i.annotations)&&(i==null?void 0:i.url)&&n.createElement(le,{currentData:e,view2dData:i,setSelectedID:M,showEnlarge:s,checkMode:w}))})):null};var Ee=D(oe,null,null,{context:ne})(ye);export{Ee as default};
1
+ import{getClassName as R}from"../../utils/dom.js";import n,{useState as b,useContext as Y,useEffect as A}from"react";import{PointCloudContainer as Z}from"./PointCloudLayout.js";import{PointCloudContext as B}from"./PointCloudContext.js";import{connect as D}from"react-redux";import{cKeyCode as ee,pointCloudLidar2image as te}from"@labelbee/lb-annotation";import{LabelBeeContext as ne}from"../../store/ctx.js";import{a2MapStateToProps as oe}from"../../store/annotation/map.js";import{toolStyleConverter as ie}from"@labelbee/lb-utils";import le from"./PointCloud2DSingleView.js";import T from"./components/TitleButton/index.js";import{LeftOutlined as re}from"@ant-design/icons";import se from"classnames";import ae from"../../assets/annotation/common/icon_esc.svg.js";import ue from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import ce from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";var me=Object.defineProperty,pe=Object.defineProperties,de=Object.getOwnPropertyDescriptors,K=Object.getOwnPropertySymbols,fe=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable,$=(e,o,t)=>o in e?me(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,h=(e,o)=>{for(var t in o||(o={}))fe.call(o,t)&&$(e,t,o[t]);if(K)for(var t of K(o))ge.call(o,t)&&$(e,t,o[t]);return e},x=(e,o)=>pe(e,de(o));const C=ee.default,ve=({showEnlarge:e,isEnlargeTopView:o,data:t,setIsEnlarge:f,setCurIndex:c,curIndex:g=0,index:w,annotations2d:m})=>o?n.createElement(T,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?n.createElement("div",{style:{display:"flex",alignItems:"center"}},n.createElement(re,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{f(!1),c(void 0)}}),n.createElement("span",null,t==null?void 0:t.calName),n.createElement("span",{style:{marginLeft:"8px"}},g+1,"/",m==null?void 0:m.length)):n.createElement(T,{title:t==null?void 0:t.calName,onClick:()=>{f(!0),c(w)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),ye=({currentData:e,config:o,thumbnailWidth:t,isEnlargeTopView:f,highlightAttribute:c,loadPCDFileLoading:g,checkMode:w})=>{var m;const[u,q]=b([]),{topViewInstance:z,displayPointCloudList:L}=Y(B),[_,M]=b(""),[v,P]=b(!1),[a,y]=b(void 0);A(()=>{var i;if(!g&&z&&(e==null?void 0:e.mappingImgList)&&((i=e==null?void 0:e.mappingImgList)==null?void 0:i.length)>0){const r={fill:"transparent",color:"green"};let s=[];e==null||e.mappingImgList.forEach(l=>{var p;const Q=L.reduce((U,d)=>{var k,I;const W=d.id===_||c===d.attribute,{transferViewData:N,viewRangePointList:E}=(k=te(d,l.calib,{createRange:W}))!=null?k:{};if(!N||!E)return[];const S=(I=ie.getColorFromConfig({attribute:d.attribute},x(h({},o),{attributeConfigurable:!0}),{}))==null?void 0:I.stroke,X=G({viewDataPointList:N,pointCloudBox:d,defaultViewStyle:r,stroke:S}),V=[...U,...X];return(E==null?void 0:E.length)>0&&V.unshift({type:"polygon",annotation:x(h({id:_,pointList:E},r),{stroke:S,fill:"rgba(255, 255, 255, 0.6)"})}),V},[]);s.push({annotations:Q,url:l==null?void 0:l.url,calName:(p=l==null?void 0:l.calib)==null?void 0:p.calName,calib:l==null?void 0:l.calib,path:l==null?void 0:l.path})}),q(s)}},[L,e==null?void 0:e.mappingImgList,_,c,g]),A(()=>(window.addEventListener("keydown",F),()=>{window.removeEventListener("keydown",F)}),[a]);const F=i=>{const{keyCode:r}=i;switch(r){case C.Esc:v&&P(!1);break;case C.Left:O();break;case C.Right:j();break}},O=()=>{a===void 0||!v||Number(a)>0&&y(a-1)},j=()=>{a===void 0||!v||Number(a)<(u==null?void 0:u.length)-1&&y(a+1)},G=({viewDataPointList:i,pointCloudBox:r,defaultViewStyle:s,stroke:l})=>i?i.map(p=>({type:p.type,annotation:x(h({id:r.id,pointList:p.pointList},s),{stroke:l})})):[],H=!e||!(e==null?void 0:e.mappingImgList)||!(((m=e==null?void 0:e.mappingImgList)==null?void 0:m.length)>0),J=n.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},n.createElement("img",{src:ue,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>O()}),n.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),n.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),n.createElement("img",{src:ce,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>j()}),n.createElement("img",{src:ae,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{P(!1),y(void 0)}}),n.createElement("span",null,"\u952E\u9000\u51FA"));return(u==null?void 0:u.length)>0?n.createElement(n.Fragment,null,u.map((i,r)=>{const s=v&&r===a;return n.createElement(Z,{className:se({[R("point-cloud-2d-container")]:!0,[R("point-cloud-container","zoom")]:s}),title:n.createElement(ve,{showEnlarge:s,isEnlargeTopView:f,data:i,setIsEnlarge:P,setCurIndex:y,curIndex:a,index:r,annotations2d:u}),titleOnSurface:!s,style:{display:H?"none":"flex",width:s?"100%":t},key:r,toolbar:J},(i==null?void 0:i.annotations)&&(i==null?void 0:i.url)&&n.createElement(le,{currentData:e,view2dData:i,setSelectedID:M,showEnlarge:s,checkMode:w}))})):null};var Ee=D(oe,null,null,{context:ne})(ye);export{Ee as default};
@@ -1 +1 @@
1
- import{PointCloudUtils as m,EPerspectiveView as L}from"@labelbee/lb-utils";import r,{useState as j,useEffect as z}from"react";import{PointCloudContext as x}from"./PointCloudContext.js";import{UnitUtils as k}from"@labelbee/lb-annotation";import{useSingleBox as D}from"./hooks/useSingleBox.js";import{useTranslation as v}from"react-i18next";var N=Object.defineProperty,V=Object.defineProperties,$=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,H=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable,_=(o,e,t)=>e in o?N(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,y=(o,e)=>{for(var t in e||(e={}))H.call(e,t)&&_(o,t,e[t]);if(h)for(var t of h(e))U.call(e,t)&&_(o,t,e[t]);return o},P=(o,e)=>V(o,$(e));const a=2,C={color:"white",backgroundColor:"rgba(153, 153, 153, 0.3)",padding:"8px 10px",zIndex:20,fontSize:12},R=({perspectiveView:o})=>{const{pointCloudBoxList:e,selectedID:t}=r.useContext(x),c=e.find(u=>u.id===t),l=v(),{t:s}=l;if(t&&c){const{length:u,width:f,height:i}=m.transferBox2Kitti(c),b=o===L.Back?[{label:s("Width"),value:f},{label:s("Height"),value:i}]:[{label:s("Length"),value:u},{label:s("Height"),value:i}];return r.createElement("div",{style:P(y({position:"absolute"},C),{bottom:"4%",left:"50%",transform:"translate(-50%, 0)"})},b.map((p,n)=>r.createElement("span",{key:n,style:{marginRight:n===0?16:0}},`${p.label}: ${p.value.toFixed(a)}`)))}return null},T=({checkMode:o,config:e,style:t})=>{const c=r.useContext(x),{selectedBox:l}=D(),[s,u]=j([]),f=v(),{t:i,i18n:b}=f,p=t;return z(()=>{var n;if(!l)return;const{length:w,width:E,height:O,rotation_y:I}=m.transferBox2Kitti(l.info),{x:S,y:B,z:F}=l.info.center;let d=[{label:"x",value:S.toFixed(a)},{label:"y",value:B.toFixed(a)},{label:"z",value:F.toFixed(a)},{label:i("Length"),value:w.toFixed(a)},{label:i("Width"),value:E.toFixed(a)},{label:i("Height"),value:O.toFixed(a)},{label:i("Rotation_y"),value:k.rad2deg(I).toFixed(a)}];(n=c.mainViewInstance)==null||n.filterPointsByBox(l.info).then(g=>{if(!g){u(d);return}d.push({label:i("PointCount"),value:`${g.num}`}),o===!0&&l.info.subAttribute&&e&&m.getSubAttributeName(l.info.subAttribute,e).forEach(A=>d.push(A)),u(d)})},[l,b.language]),l?r.createElement("div",{style:t||P(y({position:"absolute"},C),{right:8,bottom:8})},s.map(n=>p?r.createElement("div",{key:n.label,style:{margin:"0px 4px"}},`${n.label}: ${n.value}`):r.createElement("div",{key:n.label},r.createElement("span",{style:{width:"38px",display:"inline-block",textAlign:"end"}},n.label),": ",r.createElement("span",null,n.value)))):null},K=()=>{const o=r.useContext(x),{t:e}=v();return o.valid===!1?r.createElement("div",{style:{position:"absolute",backgroundColor:"rgb(242, 101, 73)",color:"white",opacity:.7,left:0,top:0,fontSize:30,padding:"8px 16px",zIndex:20,width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},e("Invalid")):null};export{T as BoxInfos,K as PointCloudValidity,R as SizeInfoForView};
1
+ import{PointCloudUtils as v,EPerspectiveView as j}from"@labelbee/lb-utils";import l,{useState as z,useEffect as k}from"react";import{PointCloudContext as m}from"./PointCloudContext.js";import{UnitUtils as D}from"@labelbee/lb-annotation";import{useSingleBox as N}from"./hooks/useSingleBox.js";import{useTranslation as x}from"react-i18next";var V=Object.defineProperty,$=Object.defineProperties,H=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable,I=(o,e,t)=>e in o?V(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,S=(o,e)=>{for(var t in e||(e={}))U.call(e,t)&&I(o,t,e[t]);if(O)for(var t of O(e))R.call(e,t)&&I(o,t,e[t]);return o},B=(o,e)=>$(o,H(e));const a=2,F={color:"white",backgroundColor:"rgba(153, 153, 153, 0.3)",padding:"8px 10px",zIndex:20,fontSize:12},T=({perspectiveView:o})=>{const{pointCloudBoxList:e,selectedID:t}=l.useContext(m),c=e.find(u=>u.id===t),r=x(),{t:s}=r;if(t&&c){const{length:u,width:b,height:i}=v.transferBox2Kitti(c),f=o===j.Back?[{label:s("Width"),value:b},{label:s("Height"),value:i}]:[{label:s("Length"),value:u},{label:s("Height"),value:i}];return l.createElement("div",{style:B(S({position:"absolute"},F),{bottom:"4%",left:"50%",transform:"translate(-50%, 0)"})},f.map((d,n)=>l.createElement("span",{key:n,style:{marginRight:n===0?16:0}},`${d.label}: ${d.value.toFixed(a)}`)))}return null},K=({checkMode:o,config:e,style:t})=>{const c=l.useContext(m),{selectedBox:r}=N(),[s,u]=z([]),b=x(),{t:i,i18n:f}=b,d=t;return k(()=>{var n,g;if(!r)return;const{length:h,width:_,height:y,rotation_y:A}=v.transferBox2Kitti(r.info),{x:P,y:C,z:w}=r.info.center;let p=[{label:"x",value:P==null?void 0:P.toFixed(a)},{label:"y",value:C==null?void 0:C.toFixed(a)},{label:"z",value:w==null?void 0:w.toFixed(a)},{label:i("Length"),value:h==null?void 0:h.toFixed(a)},{label:i("Width"),value:_==null?void 0:_.toFixed(a)},{label:i("Height"),value:y==null?void 0:y.toFixed(a)},{label:i("Rotation_y"),value:(n=D.rad2deg(A))==null?void 0:n.toFixed(a)}];(g=c.mainViewInstance)==null||g.filterPointsByBox(r.info).then(E=>{if(!E){u(p);return}p.push({label:i("PointCount"),value:`${E.num}`}),o===!0&&r.info.subAttribute&&e&&v.getSubAttributeName(r.info.subAttribute,e).forEach(L=>p.push(L)),u(p)})},[r,f.language]),r?l.createElement("div",{style:t||B(S({position:"absolute"},F),{right:8,bottom:8})},s.map(n=>d?l.createElement("div",{key:n.label,style:{margin:"0px 4px"}},`${n.label}: ${n.value}`):l.createElement("div",{key:n.label},l.createElement("span",{style:{width:"38px",display:"inline-block",textAlign:"end"}},n.label),": ",l.createElement("span",null,n.value)))):null},W=()=>{const o=l.useContext(m),{t:e}=x();return o.valid===!1?l.createElement("div",{style:{position:"absolute",backgroundColor:"rgb(242, 101, 73)",color:"white",opacity:.7,left:0,top:0,fontSize:30,padding:"8px 16px",zIndex:20,width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},e("Invalid")):null};export{K as BoxInfos,W as PointCloudValidity,T as SizeInfoForView};
@@ -1 +1 @@
1
- import{useContext as k,useEffect as a}from"react";import{a2MapStateToProps as L}from"../../store/annotation/map.js";import{connect as y}from"react-redux";import{LabelBeeContext as w,useDispatch as x}from"../../store/ctx.js";import{PointCloudContext as P}from"./PointCloudContext.js";import{CommonToolUtils as h}from"@labelbee/lb-annotation";import{PointCloudUtils as A,EPointCloudSegmentMode as S}from"@labelbee/lb-utils";import{useAttribute as D}from"./hooks/useAttribute.js";import{SetPointCloudLoading as p}from"../../store/annotation/actionCreators.js";const j=({checkMode:v,currentData:l,imgIndex:g,highlightAttribute:s,config:_,toolInstanceRef:u})=>{const m=x(),{updateSegmentAttribute:b,updateSegmentSubAttribute:C}=D(),n=k(P),{ptSegmentInstance:e,setSegmentation:d}=n;a(()=>{var t;if(e&&l.url)return p(m,!0),e.emit("clearStash"),e.emit("clearAllSegmentData"),e.loadPCDFile((t=l==null?void 0:l.url)!=null?t:"").then(()=>{var o,i;const r=A.getSegmentFromResultList((o=l==null?void 0:l.result)!=null?o:"");(i=e==null?void 0:e.store)==null||i.updateCurrentSegment(r),p(m,!1)}),e.on("syncSegmentData",d),()=>{e.unbind("syncSegmentData",d)}},[g,e]),a(()=>{var t;(t=e==null?void 0:e.store)==null||t.highlightPointsByAttribute(s!=null?s:"")},[s,e]);const f=(t,o)=>{var i,r;switch(t){case"h":e==null||e.emit("LassoSelector");break;case"j":e==null||e.emit("RectSelector");break;case"k":e==null||e.emit("CircleSelector");break;case"u":e==null||e.emit("setSegmentMode",S.Add);break;case"i":e==null||e.emit("setSegmentMode",S.Remove);break;case"enter":e==null||e.emit("updateCheck2Edit");break;case"delete":e==null||e.emit("deleteSelectedSegmentData",(r=(i=e.store)==null?void 0:i.cacheSegData)==null?void 0:r.id);break}},c=t=>{if(!h.hotkeyFilter(t)||v===!0)return;const o=t.key.toLocaleLowerCase();f(o)};return a(()=>(window.addEventListener("keydown",c),u.current.setDefaultAttribute=t=>{b(t),e==null||e.emit("updateDefaultAttribute",{newAttribute:t})},u.current.setSubAttribute=(t,o)=>{C(t,o)},()=>{window.removeEventListener("keydown",c)}),[e]),a(()=>{u.current.clearResult=()=>{!n.ptSegmentInstance||(n.ptSegmentInstance.emit("clearStash"),n.ptSegmentInstance.emit("clearAllSegmentData"))}},[n.pointCloudBoxList,n.valid,n.polygonList,n.lineList,n.pointCloudSphereList,n.ptSegmentInstance]),null};var E=y(L,null,null,{context:w})(j);export{E as default};
1
+ import{useContext as L,useEffect as r}from"react";import{a2MapStateToProps as x}from"../../store/annotation/map.js";import{connect as y}from"react-redux";import{LabelBeeContext as P,useDispatch as w}from"../../store/ctx.js";import{PointCloudContext as h}from"./PointCloudContext.js";import{CommonToolUtils as j}from"@labelbee/lb-annotation";import{PointCloudUtils as A,EPointCloudSegmentMode as S}from"@labelbee/lb-utils";import{useAttribute as D}from"./hooks/useAttribute.js";import{SetPointCloudLoading as v}from"../../store/annotation/actionCreators.js";import{jsonParser as E}from"../../utils/index.js";const _=({checkMode:b,currentData:l,imgIndex:g,highlightAttribute:a,config:B,toolInstanceRef:u,configString:m})=>{const d=w(),{updateSegmentAttribute:C,updateSegmentSubAttribute:f}=D(),o=L(h),{ptSegmentInstance:e,setSegmentation:c}=o;r(()=>{var t;if(e&&l.url)return v(d,!0),e.emit("clearStash"),e.emit("clearAllSegmentData"),e.loadPCDFile((t=l==null?void 0:l.url)!=null?t:"").then(()=>{var n,i;const s=A.getSegmentFromResultList((n=l==null?void 0:l.result)!=null?n:"");(i=e==null?void 0:e.store)==null||i.updateCurrentSegment(s),v(d,!1)}),e.on("syncSegmentData",c),()=>{e.unbind("syncSegmentData",c)}},[g,e]),r(()=>{var t;(t=e==null?void 0:e.store)==null||t.highlightPointsByAttribute(a!=null?a:"")},[a,e]),r(()=>{e==null||e.setConfig(E(m))},[m]);const k=(t,n)=>{var i,s;switch(t){case"h":e==null||e.emit("LassoSelector");break;case"j":e==null||e.emit("RectSelector");break;case"k":e==null||e.emit("CircleSelector");break;case"u":e==null||e.emit("setSegmentMode",S.Add);break;case"i":e==null||e.emit("setSegmentMode",S.Remove);break;case"enter":e==null||e.emit("updateCheck2Edit");break;case"delete":e==null||e.emit("deleteSelectedSegmentData",(s=(i=e.store)==null?void 0:i.cacheSegData)==null?void 0:s.id);break}},p=t=>{if(!j.hotkeyFilter(t)||b===!0)return;const n=t.key.toLocaleLowerCase();k(n)};return r(()=>(window.addEventListener("keydown",p),u.current.setDefaultAttribute=t=>{C(t),e==null||e.emit("updateDefaultAttribute",{newAttribute:t})},u.current.setSubAttribute=(t,n)=>{f(t,n)},()=>{window.removeEventListener("keydown",p)}),[e]),r(()=>{u.current.clearResult=()=>{!o.ptSegmentInstance||(o.ptSegmentInstance.emit("clearStash"),o.ptSegmentInstance.emit("clearAllSegmentData"))}},[o.pointCloudBoxList,o.valid,o.polygonList,o.lineList,o.pointCloudSphereList,o.ptSegmentInstance]),null};var M=y(x,null,null,{context:P})(_);export{M as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.17.0-alpha.8",
3
+ "version": "1.17.0",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -43,8 +43,8 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@ant-design/icons": "^4.6.2",
46
- "@labelbee/lb-annotation": "1.20.0-alpha.5",
47
- "@labelbee/lb-utils": "1.13.0-alpha.4",
46
+ "@labelbee/lb-annotation": "1.20.0",
47
+ "@labelbee/lb-utils": "1.13.0",
48
48
  "@labelbee/wavesurfer": "1.0.0",
49
49
  "@types/react-dom": "^18.2.7",
50
50
  "ahooks": "^3.4.0",