@labelbee/lb-components 1.11.0-alpha.5 → 1.11.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 dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),index=require("../AnnotationView/index.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),icons=require("@ant-design/icons"),useSize=require("../../hooks/useSize.js"),useSingleBox=require("./hooks/useSingleBox.js"),lbAnnotation=require("@labelbee/lb-annotation"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),lbUtils=require("@labelbee/lb-utils");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,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const Toolbar=({onNext:e,onPrev:t,imgLength:n,imgIndex:u})=>React__default.default.createElement("div",null,React__default.default.createElement(icons.LeftOutlined,{onClick:t}),React__default.default.createElement("span",null," ",u+1," / ",n," "),React__default.default.createElement(icons.RightOutlined,{onClick:e})),PointCloud2DView=({currentData:e,config:t})=>{var n,u,P,y,x;const[p,h]=React.useState([]),{topViewInstance:q,displayPointCloudList:L}=React.useContext(PointCloudContext.PointCloudContext),[f,C]=React.useState(""),[a,v]=React.useState(0),w=React.useRef(null),m=React.useRef(),{selectedBox:d}=useSingleBox.useSingleBox(),j=useSize(w),{t:E}=reactI18next.useTranslation(),r=(n=e==null?void 0:e.mappingImgList)==null?void 0:n[a];React.useEffect(()=>{v(0)},[e]),React.useEffect(()=>{if(q&&r){const o={fill:"transparent",color:"green"},l=L.reduce((c,i)=>{var s;const{transferViewData:b,viewRangePointList:R}=lbAnnotation.pointCloudLidar2image(i,r.calib),I=(s=lbUtils.toolStyleConverter.getColorFromConfig({attribute:i.attribute},__spreadProps(__spreadValues({},t),{attributeConfigurable:!0}),{}))==null?void 0:s.stroke,O=[...c,...b.map(S=>({type:S.type,annotation:__spreadProps(__spreadValues({id:i.id,pointList:S.pointList},o),{stroke:I})}))];return i.id===f&&O.push({type:"polygon",annotation:__spreadProps(__spreadValues({id:f,pointList:R},o),{stroke:I,fill:"rgba(255, 255, 255, 0.6)"})}),O},[]);h(l)}},[L,r,f]);const g=!e||!(e==null?void 0:e.mappingImgList)||!(((u=e==null?void 0:e.mappingImgList)==null?void 0:u.length)>0),_=React.useCallback(()=>{var o,l;const c=(o=m.current)==null?void 0:o.toolInstance;if(C(""),!d||!c)return;const i=p.find(b=>b.annotation.id===d.info.id);let s="";((l=i==null?void 0:i.annotation.pointList)==null?void 0:l.length)>0&&(c.focusPositionByPointList(i==null?void 0:i.annotation.pointList),s=d.info.id,C(s))},[d,m.current,p,a]);return React.useEffect(()=>{_()},[_]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-2d-container"),title:E("2DView"),toolbar:g?void 0:React__default.default.createElement(Toolbar,{imgIndex:a,imgLength:(y=(P=e.mappingImgList)==null?void 0:P.length)!=null?y:0,onNext:()=>{var o;!e||!(e==null?void 0:e.mappingImgList)||a>=((o=e==null?void 0:e.mappingImgList)==null?void 0:o.length)-1||v(l=>l+1)},onPrev:()=>{a<=0||v(o=>o-1)}}),style:g?{display:"none"}:{display:"flex",minHeight:200,maxHeight:500}},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-2d-image"),ref:w},React__default.default.createElement(index,{src:(x=r==null?void 0:r.url)!=null?x:"",annotations:p,size:j,ref:m,globalStyle:{display:g?"none":"block"},afterImgOnLoad:_,zoomInfo:{min:.01,max:1e3,ratio:.4}})))};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"),index=require("../AnnotationView/index.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),icons=require("@ant-design/icons"),useSize=require("../../hooks/useSize.js"),useSingleBox=require("./hooks/useSingleBox.js"),lbAnnotation=require("@labelbee/lb-annotation"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),lbUtils=require("@labelbee/lb-utils");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,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const Toolbar=({onNext:e,onPrev:t,imgLength:n,imgIndex:u})=>React__default.default.createElement("div",null,React__default.default.createElement(icons.LeftOutlined,{onClick:t}),React__default.default.createElement("span",null," ",u+1," / ",n," "),React__default.default.createElement(icons.RightOutlined,{onClick:e})),PointCloud2DView=({currentData:e,config:t})=>{var n,u,P,y,L;const[f,q]=React.useState([]),{topViewInstance:j,displayPointCloudList:x}=React.useContext(PointCloudContext.PointCloudContext),[d,C]=React.useState(""),[a,v]=React.useState(0),w=React.useRef(null),g=React.useRef(),{selectedBox:c}=useSingleBox.useSingleBox(),E=useSize(w),{t:R}=reactI18next.useTranslation(),r=(n=e==null?void 0:e.mappingImgList)==null?void 0:n[a];React.useEffect(()=>{v(0)},[e]),React.useEffect(()=>{if(j&&r){const o={fill:"transparent",color:"green"},l=x.reduce((p,i)=>{var s;const{transferViewData:b,viewRangePointList:I}=lbAnnotation.pointCloudLidar2image(i,r.calib,{createRange:i.id===d}),h=(s=lbUtils.toolStyleConverter.getColorFromConfig({attribute:i.attribute},__spreadProps(__spreadValues({},t),{attributeConfigurable:!0}),{}))==null?void 0:s.stroke,O=[...p,...b.map(S=>({type:S.type,annotation:__spreadProps(__spreadValues({id:i.id,pointList:S.pointList},o),{stroke:h})}))];return i.id===d&&I.length>0&&O.push({type:"polygon",annotation:__spreadProps(__spreadValues({id:d,pointList:I},o),{stroke:h,fill:"rgba(255, 255, 255, 0.6)"})}),O},[]);q(l)}},[x,r,d]);const m=!e||!(e==null?void 0:e.mappingImgList)||!(((u=e==null?void 0:e.mappingImgList)==null?void 0:u.length)>0),_=React.useCallback(()=>{var o,l;const p=(o=g.current)==null?void 0:o.toolInstance;if(C(""),!c||!p)return;const i=f.find(b=>b.annotation.id===c.info.id);let s="";((l=i==null?void 0:i.annotation.pointList)==null?void 0:l.length)>0&&(p.focusPositionByPointList(i==null?void 0:i.annotation.pointList),s=c.info.id,C(s))},[c,g.current,f,a]);return React.useEffect(()=>{_()},[_]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-2d-container"),title:R("2DView"),toolbar:m?void 0:React__default.default.createElement(Toolbar,{imgIndex:a,imgLength:(y=(P=e.mappingImgList)==null?void 0:P.length)!=null?y:0,onNext:()=>{var o;!e||!(e==null?void 0:e.mappingImgList)||a>=((o=e==null?void 0:e.mappingImgList)==null?void 0:o.length)-1||v(l=>l+1)},onPrev:()=>{a<=0||v(o=>o-1)}}),style:m?{display:"none"}:{display:"flex",minHeight:200,maxHeight:500}},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-2d-image"),ref:w},React__default.default.createElement(index,{src:(L=r==null?void 0:r.url)!=null?L:"",annotations:f,size:E,ref:g,globalStyle:{display:m?"none":"block"},afterImgOnLoad:_,zoomInfo:{min:.01,max:1e3,ratio:.4}})))};var PointCloud2DView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DView);module.exports=PointCloud2DView$1;
@@ -1 +1 @@
1
- import{getClassName as A}from"../../utils/dom.js";import l,{useState as y,useContext as $,useRef as N,useEffect as L,useCallback as q}from"react";import{PointCloudContainer as G}from"./PointCloudLayout.js";import J from"../AnnotationView/index.js";import{PointCloudContext as K}from"./PointCloudContext.js";import{connect as Q}from"react-redux";import{LeftOutlined as U,RightOutlined as W}from"@ant-design/icons";import X from"../../hooks/useSize.js";import{useSingleBox as Y}from"./hooks/useSingleBox.js";import{pointCloudLidar2image as Z}from"@labelbee/lb-annotation";import{useTranslation as D}from"react-i18next";import{LabelBeeContext as tt}from"../../store/ctx.js";import{a2MapStateToProps as et}from"../../store/annotation/map.js";import{toolStyleConverter as ot}from"@labelbee/lb-utils";var nt=Object.defineProperty,it=Object.defineProperties,lt=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,rt=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable,z=(t,e,o)=>e in t?nt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,w=(t,e)=>{for(var o in e||(e={}))rt.call(e,o)&&z(t,o,e[o]);if(R)for(var o of R(e))st.call(e,o)&&z(t,o,e[o]);return t},C=(t,e)=>it(t,lt(e));const at=({onNext:t,onPrev:e,imgLength:o,imgIndex:m})=>l.createElement("div",null,l.createElement(U,{onClick:e}),l.createElement("span",null," ",m+1," / ",o," "),l.createElement(W,{onClick:t})),pt=({currentData:t,config:e})=>{var o,m,I,x,O;const[u,T]=y([]),{topViewInstance:B,displayPointCloudList:h}=$(K),[f,j]=y(""),[s,g]=y(0),S=N(null),v=N(),{selectedBox:d}=Y(),H=X(S),{t:M}=D(),a=(o=t==null?void 0:t.mappingImgList)==null?void 0:o[s];L(()=>{g(0)},[t]),L(()=>{if(B&&a){const n={fill:"transparent",color:"green"},r=h.reduce((c,i)=>{var p;const{transferViewData:b,viewRangePointList:F}=Z(i,a.calib),E=(p=ot.getColorFromConfig({attribute:i.attribute},C(w({},e),{attributeConfigurable:!0}),{}))==null?void 0:p.stroke,V=[...c,...b.map(k=>({type:k.type,annotation:C(w({id:i.id,pointList:k.pointList},n),{stroke:E})}))];return i.id===f&&V.push({type:"polygon",annotation:C(w({id:f,pointList:F},n),{stroke:E,fill:"rgba(255, 255, 255, 0.6)"})}),V},[]);T(r)}},[h,a,f]);const _=!t||!(t==null?void 0:t.mappingImgList)||!(((m=t==null?void 0:t.mappingImgList)==null?void 0:m.length)>0),P=q(()=>{var n,r;const c=(n=v.current)==null?void 0:n.toolInstance;if(j(""),!d||!c)return;const i=u.find(b=>b.annotation.id===d.info.id);let p="";((r=i==null?void 0:i.annotation.pointList)==null?void 0:r.length)>0&&(c.focusPositionByPointList(i==null?void 0:i.annotation.pointList),p=d.info.id,j(p))},[d,v.current,u,s]);return L(()=>{P()},[P]),l.createElement(G,{className:A("point-cloud-2d-container"),title:M("2DView"),toolbar:_?void 0:l.createElement(at,{imgIndex:s,imgLength:(x=(I=t.mappingImgList)==null?void 0:I.length)!=null?x:0,onNext:()=>{var n;!t||!(t==null?void 0:t.mappingImgList)||s>=((n=t==null?void 0:t.mappingImgList)==null?void 0:n.length)-1||g(r=>r+1)},onPrev:()=>{s<=0||g(n=>n-1)}}),style:_?{display:"none"}:{display:"flex",minHeight:200,maxHeight:500}},l.createElement("div",{className:A("point-cloud-2d-image"),ref:S},l.createElement(J,{src:(O=a==null?void 0:a.url)!=null?O:"",annotations:u,size:H,ref:v,globalStyle:{display:_?"none":"block"},afterImgOnLoad:P,zoomInfo:{min:.01,max:1e3,ratio:.4}})))};var mt=Q(et,null,null,{context:tt})(pt);export{mt as default};
1
+ import{getClassName as A}from"../../utils/dom.js";import l,{useState as y,useContext as $,useRef as N,useEffect as L,useCallback as q}from"react";import{PointCloudContainer as G}from"./PointCloudLayout.js";import J from"../AnnotationView/index.js";import{PointCloudContext as K}from"./PointCloudContext.js";import{connect as Q}from"react-redux";import{LeftOutlined as U,RightOutlined as W}from"@ant-design/icons";import X from"../../hooks/useSize.js";import{useSingleBox as Y}from"./hooks/useSingleBox.js";import{pointCloudLidar2image as Z}from"@labelbee/lb-annotation";import{useTranslation as D}from"react-i18next";import{LabelBeeContext as tt}from"../../store/ctx.js";import{a2MapStateToProps as et}from"../../store/annotation/map.js";import{toolStyleConverter as ot}from"@labelbee/lb-utils";var nt=Object.defineProperty,it=Object.defineProperties,lt=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertySymbols,rt=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable,T=(t,e,o)=>e in t?nt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,w=(t,e)=>{for(var o in e||(e={}))rt.call(e,o)&&T(t,o,e[o]);if(z)for(var o of z(e))st.call(e,o)&&T(t,o,e[o]);return t},I=(t,e)=>it(t,lt(e));const at=({onNext:t,onPrev:e,imgLength:o,imgIndex:m})=>l.createElement("div",null,l.createElement(U,{onClick:e}),l.createElement("span",null," ",m+1," / ",o," "),l.createElement(W,{onClick:t})),pt=({currentData:t,config:e})=>{var o,m,C,x,h;const[f,H]=y([]),{topViewInstance:M,displayPointCloudList:O}=$(K),[d,j]=y(""),[s,g]=y(0),S=N(null),v=N(),{selectedBox:c}=Y(),B=X(S),{t:F}=D(),a=(o=t==null?void 0:t.mappingImgList)==null?void 0:o[s];L(()=>{g(0)},[t]),L(()=>{if(M&&a){const n={fill:"transparent",color:"green"},r=O.reduce((u,i)=>{var p;const{transferViewData:b,viewRangePointList:E}=Z(i,a.calib,{createRange:i.id===d}),V=(p=ot.getColorFromConfig({attribute:i.attribute},I(w({},e),{attributeConfigurable:!0}),{}))==null?void 0:p.stroke,k=[...u,...b.map(R=>({type:R.type,annotation:I(w({id:i.id,pointList:R.pointList},n),{stroke:V})}))];return i.id===d&&E.length>0&&k.push({type:"polygon",annotation:I(w({id:d,pointList:E},n),{stroke:V,fill:"rgba(255, 255, 255, 0.6)"})}),k},[]);H(r)}},[O,a,d]);const _=!t||!(t==null?void 0:t.mappingImgList)||!(((m=t==null?void 0:t.mappingImgList)==null?void 0:m.length)>0),P=q(()=>{var n,r;const u=(n=v.current)==null?void 0:n.toolInstance;if(j(""),!c||!u)return;const i=f.find(b=>b.annotation.id===c.info.id);let p="";((r=i==null?void 0:i.annotation.pointList)==null?void 0:r.length)>0&&(u.focusPositionByPointList(i==null?void 0:i.annotation.pointList),p=c.info.id,j(p))},[c,v.current,f,s]);return L(()=>{P()},[P]),l.createElement(G,{className:A("point-cloud-2d-container"),title:F("2DView"),toolbar:_?void 0:l.createElement(at,{imgIndex:s,imgLength:(x=(C=t.mappingImgList)==null?void 0:C.length)!=null?x:0,onNext:()=>{var n;!t||!(t==null?void 0:t.mappingImgList)||s>=((n=t==null?void 0:t.mappingImgList)==null?void 0:n.length)-1||g(r=>r+1)},onPrev:()=>{s<=0||g(n=>n-1)}}),style:_?{display:"none"}:{display:"flex",minHeight:200,maxHeight:500}},l.createElement("div",{className:A("point-cloud-2d-image"),ref:S},l.createElement(J,{src:(h=a==null?void 0:a.url)!=null?h:"",annotations:f,size:B,ref:v,globalStyle:{display:_?"none":"block"},afterImgOnLoad:P,zoomInfo:{min:.01,max:1e3,ratio:.4}})))};var mt=Q(et,null,null,{context:tt})(pt);export{mt as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.11.0-alpha.5",
3
+ "version": "1.11.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.15.0-alpha.5",
47
- "@labelbee/lb-utils": "1.7.1-alpha.2",
46
+ "@labelbee/lb-annotation": "1.15.0",
47
+ "@labelbee/lb-utils": "1.7.1",
48
48
  "ahooks": "^3.4.0",
49
49
  "classnames": "^2.3.0",
50
50
  "lodash": "^4.17.21",