@labelbee/lb-components 1.23.0-alpha.93 → 1.23.0-alpha.94
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";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),antd=require("antd"),usePointCloudViews=require("./usePointCloudViews.js"),PointCloudContext=require("../PointCloudContext.js"),reactI18next=require("react-i18next"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js"),AnnotationDataUtils=require("../../../utils/AnnotationDataUtils.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,o)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,__spreadValues=(t,e)=>{for(var o in e||(e={}))__hasOwnProp.call(e,o)&&__defNormalProp(t,o,e[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(e))__propIsEnum.call(e,o)&&__defNormalProp(t,o,e[o]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const useBoxes=({config:t,currentData:e})=>{const{selectedIDs:o,pointCloudBoxList:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),_=require("lodash"),antd=require("antd"),usePointCloudViews=require("./usePointCloudViews.js"),PointCloudContext=require("../PointCloudContext.js"),reactI18next=require("react-i18next"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js"),AnnotationDataUtils=require("../../../utils/AnnotationDataUtils.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,o)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,__spreadValues=(t,e)=>{for(var o in e||(e={}))__hasOwnProp.call(e,o)&&__defNormalProp(t,o,e[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(e))__propIsEnum.call(e,o)&&__defNormalProp(t,o,e[o]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const updateBoxRects=(t,e=[],o=[])=>{const{rects:u=[]}=t,n=u.map(i=>{var p;return __spreadProps(__spreadValues({},i),{imageName:(p=AnnotationDataUtils.getNextPath({prePath:i.imageName,preMappingImgList:o,nextMappingImgList:e}))!=null?p:""})}).filter(i=>i.imageName!=="");return __spreadProps(__spreadValues({},t),{rects:n})},useBoxes=({config:t,currentData:e})=>{const{selectedIDs:o,pointCloudBoxList:u,displayPointCloudList:n,setPointCloudResult:i,syncAllViewPointCloudColor:p}=React.useContext(PointCloudContext.PointCloudContext),[d,g]=React.useState({copiedBoxes:[],copiedMappingImgList:[]}),{copiedBoxes:l}=d,{pointCloudBoxListUpdated:v}=usePointCloudViews.usePointCloudViews(),{t:c,i18n:C}=reactI18next.useTranslation(),I=r=>t.trackConfigurable!==!0?!1:u.some(a=>r.some(P=>P.trackID===a.trackID)),m=React.useMemo(()=>n.filter(r=>o.includes(r.id)),[o,n]),y=React.useCallback(()=>{var r;if(m.length>0){const a=(r=e==null?void 0:e.mappingImgList)!=null?r:[];g({copiedBoxes:___default.default.cloneDeep(m),copiedMappingImgList:a})}else g({copiedBoxes:[],copiedMappingImgList:[]}),antd.message.error(c("CopyEmptyInPointCloud"))},[o,n,C.language,e]),B=React.useCallback(()=>{var r,a;if(l.length===0){antd.message.error(c("PasteEmptyInPointCloud"));return}const P=I(l),O=(r=e==null?void 0:e.mappingImgList)!=null?r:[],D=(a=d==null?void 0:d.copiedMappingImgList)!=null?a:[],f=l.map(s=>updateBoxRects(s,O,D)),x=s=>{i(s),v==null||v(s),g({copiedBoxes:[],copiedMappingImgList:[]}),p(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MultiPaste,s)};if(P)antd.Modal.confirm({title:c("HasDuplicateIDHeader"),content:c("HasDuplicateIDMsg"),onOk:()=>{const s=u.filter(L=>!f.find(w=>w.trackID===L.trackID)).concat(f);x(s)}});else{const s=[...n,...f];x(s)}},[l,n,C.language,e]);return{copySelectedBoxes:y,pasteSelectedBoxes:B,copiedBoxes:l,selectedBoxes:m}};exports.useBoxes=useBoxes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as
|
|
1
|
+
import{useContext as k,useState as E,useMemo as N,useCallback as x}from"react";import S from"lodash";import{message as v,Modal as H}from"antd";import{usePointCloudViews as V}from"./usePointCloudViews.js";import{PointCloudContext as A}from"../PointCloudContext.js";import{useTranslation as T}from"react-i18next";import{EPointCloudBoxRenderTrigger as U}from"../../../utils/ToolPointCloudBoxRenderHelper.js";import q from"../../../utils/AnnotationDataUtils.js";var z=Object.defineProperty,F=Object.defineProperties,G=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,J=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,B=(o,e,t)=>e in o?z(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,O=(o,e)=>{for(var t in e||(e={}))J.call(e,t)&&B(o,t,e[t]);if(y)for(var t of y(e))K.call(e,t)&&B(o,t,e[t]);return o},D=(o,e)=>F(o,G(e));const Q=(o,e=[],t=[])=>{const{rects:l=[]}=o,n=l.map(i=>{var c;return D(O({},i),{imageName:(c=q.getNextPath({prePath:i.imageName,preMappingImgList:t,nextMappingImgList:e}))!=null?c:""})}).filter(i=>i.imageName!=="");return D(O({},o),{rects:n})},W=({config:o,currentData:e})=>{const{selectedIDs:t,pointCloudBoxList:l,displayPointCloudList:n,setPointCloudResult:i,syncAllViewPointCloudColor:c}=k(A),[d,m]=E({copiedBoxes:[],copiedMappingImgList:[]}),{copiedBoxes:p}=d,{pointCloudBoxListUpdated:I}=V(),{t:u,i18n:_}=T(),L=s=>o.trackConfigurable!==!0?!1:l.some(a=>s.some(f=>f.trackID===a.trackID)),g=N(()=>n.filter(s=>t.includes(s.id)),[t,n]),w=x(()=>{var s;if(g.length>0){const a=(s=e==null?void 0:e.mappingImgList)!=null?s:[];m({copiedBoxes:S.cloneDeep(g),copiedMappingImgList:a})}else m({copiedBoxes:[],copiedMappingImgList:[]}),v.error(u("CopyEmptyInPointCloud"))},[t,n,_.language,e]),M=x(()=>{var s,a;if(p.length===0){v.error(u("PasteEmptyInPointCloud"));return}const f=L(p),h=(s=e==null?void 0:e.mappingImgList)!=null?s:[],j=(a=d==null?void 0:d.copiedMappingImgList)!=null?a:[],P=p.map(r=>Q(r,h,j)),C=r=>{i(r),I==null||I(r),m({copiedBoxes:[],copiedMappingImgList:[]}),c(U.MultiPaste,r)};if(f)H.confirm({title:u("HasDuplicateIDHeader"),content:u("HasDuplicateIDMsg"),onOk:()=>{const r=l.filter(R=>!P.find(b=>b.trackID===R.trackID)).concat(P);C(r)}});else{const r=[...n,...P];C(r)}},[p,n,_.language,e]);return{copySelectedBoxes:w,pasteSelectedBoxes:M,copiedBoxes:p,selectedBoxes:g}};export{W as useBoxes};
|