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