@labelbee/lb-components 1.23.0-alpha.137 → 1.23.0-alpha.138

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.
@@ -0,0 +1 @@
1
+ "use strict";var React=require("react");const useFilterAnnotations=(t=[],r,n)=>React.useMemo(()=>n&&(r==null?void 0:r.length)?t.filter(u=>r.includes(u.annotation.id)):t,[t,r,n]);module.exports=useFilterAnnotations;
@@ -1 +1 @@
1
- "use strict";var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),es=require("antd/es"),useRefCache=require("../../hooks/useRefCache.js"),index=require("../measureCanvas/index.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,o)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,__spreadValues=(e,r)=>{for(var o in r||(r={}))__hasOwnProp.call(r,o)&&__defNormalProp(e,o,r[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(r))__propIsEnum.call(r,o)&&__defNormalProp(e,o,r[o]);return e},__async=(e,r,o)=>new Promise((g,d)=>{var c=u=>{try{f(o.next(u))}catch(v){d(v)}},s=u=>{try{f(o.throw(u))}catch(v){d(v)}},f=u=>u.done?g(u.value):Promise.resolve(u.value).then(c,s);f((o=o.apply(e,r)).next())});const DEFAULT_SIZE={width:455,height:100},sizeInitialized=e=>{if(!e)return DEFAULT_SIZE;if(e.width&&e.height)return e;const r=__spreadValues({},e);return r.width||(r.width=DEFAULT_SIZE.width),r.height||(r.height=DEFAULT_SIZE.height),r},AnnotationView=(e,r)=>{var o,g;const{src:d,fallbackSrc:c,annotations:s=[],style:f={stroke:"blue",thickness:3},zoomChange:u,backgroundStyle:v={},onChange:C,showLoading:x=!1,globalStyle:L,afterImgOnLoad:k,measureVisible:y,onRightClick:m,pointCloudBoxList:E=[],hiddenText:P=!1,renderToolName:A}=e,_=sizeInitialized(e.size),[j,R]=React.useState(!1),w=React.useRef(null),t=React.useRef(),z=useRefCache(k),h=React.useRef([]),b=React.useRef(!0);React.useContext(PointCloudContext.PointCloudContext),React.useImperativeHandle(r,()=>{const n=t.current;return n?{zoomIn:()=>n.zoomChanged(!0),zoomOut:()=>n.zoomChanged(!1),initImgPos:()=>n.initImgPos(),toolInstance:n}:{}},[t.current]),React.useEffect(()=>(w.current&&(t.current=new lbAnnotation.ViewOperation({container:w.current,size:_,style:f,annotations:s,config:"{}",zoomInfo:e.zoomInfo,staticMode:e.staticMode,renderToolName:A}),t.current.init(),m&&t.current.on("onRightClick",m)),()=>{var n,i;m&&((n=t.current)==null||n.unbind("onRightClick",m)),(i=t.current)==null||i.destroy()}),[y]);const I=React.useCallback(n=>__async(void 0,null,function*(){var i,a;try{const l=yield lbAnnotation.ImgUtils.load(n);return(i=t.current)==null||i.setImgNode(l),(a=z.current)==null||a.call(z,l),null}catch(l){return console.error("Error loading image:",l),l}}),[]),O=React.useCallback(n=>__async(void 0,null,function*(){var i,a;if(R(!0),(i=t.current)==null||i.setLoading(!0),(yield I(n))&&c){const p=yield I(c);p&&console.error("Error loading fallback image:",p)}(a=t.current)==null||a.setLoading(!1),R(!1)}),[I,c]);React.useEffect(()=>{t.current&&O(d)},[d,y,c,O]),React.useEffect(()=>{(t==null?void 0:t.current)&&t.current.setPointCloudBoxList(E)},[E]),React.useEffect(()=>{var n;(t==null?void 0:t.current)&&((n=t.current)==null||n.setHiddenText(P))},[P]),React.useEffect(()=>{if(b.current===!1){h.current.push(s);return}const n=()=>{b.current=!0,h.current=[]},i=()=>{var a;const l=h.current.length;if(l>0){const p=h.current[l-1];h.current=[],(a=t.current)==null||a.updateData(p).then(i).catch(n)}else b.current=!0};t.current&&(b.current=!1,t.current.updateData(s).then(i).catch(n))},[s]),React.useEffect(()=>{const n=t.current;(n==null?void 0:n.setSize)&&(n.setSize(_),n.initPosition())},[(o=e.size)==null?void 0:o.width,(g=e.size)==null?void 0:g.height]),React.useEffect(()=>{var n,i;return t.current&&((n=t.current)==null||n.on("onChange",(...a)=>{C==null||C.apply(null,a)}),(i=t.current)==null||i.on("renderZoom",a=>{u&&u(a)})),()=>{var a,l;(a=t.current)==null||a.unbindAll("onChange"),(l=t.current)==null||l.unbindAll("renderZoom")}},[u,C]);const q=React__default.default.createElement("div",{ref:w,style:__spreadValues(__spreadValues({position:"relative"},_),v)}),{imgNode:S,zoom:V,currentPos:D}=t.current||{};return React__default.default.createElement(es.Spin,{spinning:x||j,delay:300,style:L},y&&S?React__default.default.createElement(index,{size:_,imgNode:S,zoom:V,currentPos:D}):q)};var AnnotationView$1=React__default.default.forwardRef(AnnotationView);module.exports=AnnotationView$1;
1
+ "use strict";var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),es=require("antd/es"),useRefCache=require("../../hooks/useRefCache.js"),index$1=require("../measureCanvas/index.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),useFilterAnnotations=require("./hooks/useFilterAnnotations.js"),index=require("../../store/toolConfig/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,o)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,__spreadValues=(e,r)=>{for(var o in r||(r={}))__hasOwnProp.call(r,o)&&__defNormalProp(e,o,r[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(r))__propIsEnum.call(r,o)&&__defNormalProp(e,o,r[o]);return e},__async=(e,r,o)=>new Promise((h,s)=>{var c=u=>{try{d(o.next(u))}catch(f){s(f)}},p=u=>{try{d(o.throw(u))}catch(f){s(f)}},d=u=>u.done?h(u.value):Promise.resolve(u.value).then(c,p);d((o=o.apply(e,r)).next())});const DEFAULT_SIZE={width:455,height:100},sizeInitialized=e=>{if(!e)return DEFAULT_SIZE;if(e.width&&e.height)return e;const r=__spreadValues({},e);return r.width||(r.width=DEFAULT_SIZE.width),r.height||(r.height=DEFAULT_SIZE.height),r},AnnotationView=(e,r)=>{var o,h;const{src:s,fallbackSrc:c,annotations:p=[],style:d={stroke:"blue",thickness:3},zoomChange:u,backgroundStyle:f={},onChange:y,showLoading:A=!1,globalStyle:k,afterImgOnLoad:L,measureVisible:w,onRightClick:g,pointCloudBoxList:P=[],hiddenText:R=!1,renderToolName:j}=e,m=sizeInitialized(e.size),[q,x]=React.useState(!1),I=React.useRef(null),t=React.useRef(),S=useRefCache(L),v=React.useRef([]),_=React.useRef(!0),{selectedIDs:V}=React.useContext(PointCloudContext.PointCloudContext),{selectBoxVisibleSwitch:D}=index(),b=useFilterAnnotations(p,V,D);React.useImperativeHandle(r,()=>{const n=t.current;return n?{zoomIn:()=>n.zoomChanged(!0),zoomOut:()=>n.zoomChanged(!1),initImgPos:()=>n.initImgPos(),toolInstance:n}:{}},[t.current]),React.useEffect(()=>(I.current&&(t.current=new lbAnnotation.ViewOperation({container:I.current,size:m,style:d,annotations:b,config:"{}",zoomInfo:e.zoomInfo,staticMode:e.staticMode,renderToolName:j}),t.current.init(),g&&t.current.on("onRightClick",g)),()=>{var n,a;g&&((n=t.current)==null||n.unbind("onRightClick",g)),(a=t.current)==null||a.destroy()}),[w]);const E=React.useCallback(n=>__async(void 0,null,function*(){var a,i;try{const l=yield lbAnnotation.ImgUtils.load(n);return(a=t.current)==null||a.setImgNode(l),(i=S.current)==null||i.call(S,l),null}catch(l){return console.error("Error loading image:",l),l}}),[]),z=React.useCallback(n=>__async(void 0,null,function*(){var a,i;if(x(!0),(a=t.current)==null||a.setLoading(!0),(yield E(n))&&c){const C=yield E(c);C&&console.error("Error loading fallback image:",C)}(i=t.current)==null||i.setLoading(!1),x(!1)}),[E,c]);React.useEffect(()=>{t.current&&z(s)},[s,w,c,z]),React.useEffect(()=>{(t==null?void 0:t.current)&&t.current.setPointCloudBoxList(P)},[P]),React.useEffect(()=>{var n;(t==null?void 0:t.current)&&((n=t.current)==null||n.setHiddenText(R))},[R]),React.useEffect(()=>{if(_.current===!1){v.current.push(b);return}const n=()=>{_.current=!0,v.current=[]},a=()=>{var i;const l=v.current.length;if(l>0){const C=v.current[l-1];v.current=[],(i=t.current)==null||i.updateData(C).then(a).catch(n)}else _.current=!0};t.current&&(_.current=!1,t.current.updateData(b).then(a).catch(n))},[b]),React.useEffect(()=>{const n=t.current;(n==null?void 0:n.setSize)&&(n.setSize(m),n.initPosition())},[(o=e.size)==null?void 0:o.width,(h=e.size)==null?void 0:h.height]),React.useEffect(()=>{var n,a;return t.current&&((n=t.current)==null||n.on("onChange",(...i)=>{y==null||y.apply(null,i)}),(a=t.current)==null||a.on("renderZoom",i=>{u&&u(i)})),()=>{var i,l;(i=t.current)==null||i.unbindAll("onChange"),(l=t.current)==null||l.unbindAll("renderZoom")}},[u,y]);const N=React__default.default.createElement("div",{ref:I,style:__spreadValues(__spreadValues({position:"relative"},m),f)}),{imgNode:O,zoom:T,currentPos:B}=t.current||{};return React__default.default.createElement(es.Spin,{spinning:A||q,delay:300,style:k},w&&O?React__default.default.createElement(index$1,{size:m,imgNode:O,zoom:T,currentPos:B}):N)};var AnnotationView$1=React__default.default.forwardRef(AnnotationView);module.exports=AnnotationView$1;
@@ -0,0 +1,2 @@
1
+ declare const useFilterAnnotations: (originAnnotations: any[] | undefined, selectedIDs: string[] | undefined, selectBoxVisibleSwitch: boolean) => any[];
2
+ export default useFilterAnnotations;