@labelbee/lb-components 1.23.0-alpha.117 → 1.23.0-alpha.119
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
|
-
import{useLatest as
|
|
1
|
+
import{useLatest as K,useMemoizedFn as U}from"ahooks";import{Spin as se}from"antd/es";import A,{useContext as ae,useRef as Q,useState as W,useMemo as de,useCallback as fe,useEffect as f}from"react";import{connect as pe}from"react-redux";import{usePointCloudViews as me}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as ve}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as ge}from"../../store/annotation/map.js";import{LabelBeeContext as Re}from"../../store/ctx.js";import{PointCloud2DRectOperation as _e,ImgUtils as he}from"@labelbee/lb-annotation";import{selectSpecifiedRectsFromTopViewSelectedIds as Ie}from"./util.js";import{useUpdateRectList as De}from"./useUpdateRectList.js";import{useToolStyleContext as be}from"../../hooks/useToolStyle.js";var we=Object.defineProperty,ye=Object.defineProperties,Ce=Object.getOwnPropertyDescriptors,X=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable,Y=(u,l,i)=>l in u?we(u,l,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[l]=i,p=(u,l)=>{for(var i in l||(l={}))Pe.call(l,i)&&Y(u,i,l[i]);if(X)for(var i of X(l))xe.call(l,i)&&Y(u,i,l[i]);return u},D=(u,l)=>ye(u,Ce(l)),T=(u,l,i)=>new Promise((a,m)=>{var _=d=>{try{h(i.next(d))}catch(v){m(v)}},x=d=>{try{h(i.throw(d))}catch(v){m(v)}},h=d=>d.done?a(d.value):Promise.resolve(d.value).then(_,x);h((i=i.apply(u,l)).next())});const Se=u=>{var l,i;const{mappingData:a,size:m,config:_,checkMode:x,afterImgOnLoad:h,shouldExcludePointCloudBoxListUpdate:d}=u,v=(l=a==null?void 0:a.url)!=null?l:"",b=(i=a==null?void 0:a.fallbackUrl)!=null?i:"",{pointCloudBoxList:S,setPointCloudResult:O,defaultAttribute:L,rectList:V,addRectIn2DView:Z,updateRectIn2DView:ee,removeRectIn2DView:te,updateRectListByReducer:ne,selectedIDs:w,setSelectedIDs:j}=ae(ve),{value:k}=be(),re=K(w),{update2DViewRect:oe,remove2DViewRect:le}=me(),E=A.useRef(null),o=Q(null),F=U(oe),y=U(le),C=Q(null),[ie,M]=W(!0),[z,J]=W(""),N=de(()=>V==null?void 0:V.filter(e=>e.imageName===(a==null?void 0:a.path)),[a==null?void 0:a.path,V]),P=K(a==null?void 0:a.path),B=fe(e=>T(void 0,null,function*(){try{const r=re.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(r.length){const n=new Set(r),c=t.filter(s=>n.has(s.id)).map(s=>s.id);j(c)}return t}catch(r){}}),[j]),$=e=>{const{boxID:r}=e;if(!d&&r){B(()=>{const t=F==null?void 0:F(e);return t?(C.current=t,O(t),t):null});return}ee(e,!0)},q=e=>{P.current&&Z(D(p({},e),{imageName:P.current}))},G=e=>{if(e.length===0)return;if(!d){const t=e.find(n=>n.boxID);if(t){B(()=>{const n=y==null?void 0:y(t);return n?(C.current=n,O(n),g(),n):null});return}}const r=e.find(t=>t.extId);r&&B(()=>{const{imageName:t,extId:n}=r,c=y==null?void 0:y({boxID:n,imageName:t});return c?(C.current=c,O(c),c):null}),te(e)},ce=U(()=>{let e=[];return S.forEach(r=>{const{rects:t=[],id:n,attribute:c,trackID:s}=r,R=t.find(ue=>ue.imageName===P.current),I=n+"_"+P.current;R&&(e=[...e,D(p({},R),{boxID:n,id:I,attribute:c,order:s})])}),e}),g=De(()=>{var e,r;const t=d?[]:ce(),n=w.slice(0),c=Ie(n,t,N);(e=o.current)==null||e.setResult(c),z&&((r=o.current)==null||r.setSelectedRectID(z),J(""))}),H=({targetId:e,id:r})=>{j(e),J(r)};return f(()=>{if(E.current){const e=new _e({container:E.current,size:m,config:D(p({},_),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:x});return o.current=e,o.current.init(),o.current.on("updateDragResult",$),o.current.on("afterAddingDrawingRect",q),o.current.on("deleteSelectedRects",G),o.current.on("onRightClick",H),()=>{var r,t,n,c,s;(r=o.current)==null||r.unbind("updateDragResult",$),(t=o.current)==null||t.unbind("afterAddingDrawingRect",q),(n=o.current)==null||n.unbind("deleteSelectedRects",G),(c=o.current)==null||c.unbind("onRightClick",H),(s=o.current)==null||s.destroy()}}},[]),f(()=>{const e=t=>T(void 0,null,function*(){try{return yield he.load(t)}catch(n){return console.error("Error loading image:",n),null}}),r=()=>T(void 0,null,function*(){var t;M(!0);let n=yield e(v);!n&&b&&(n=yield e(b)),n&&((t=o.current)==null||t.setImgNode(n),h(n)),M(!1)});o.current&&(v||b)&&r()},[v,b]),f(()=>{var e;(e=o.current)==null||e.setSize(m)},[m]),f(()=>{S!==C.current&&g()},[S]),f(()=>{var e,r;const t=N.find(n=>n.id===o.current.selectedRectID);(r=(e=o.current)==null?void 0:e.setDefaultAttribute)==null||r.call(e,L),t&&ne(n=>{var c;const s=[];let R=null;return n.forEach(I=>{I.id!==o.current.selectedRectID?s.push(I):R=I}),t.extId===void 0&&(R=(c=o.current)==null?void 0:c.selectedRect),[...s,D(p({},R||{}),{attribute:L})]}),g()},[L]),f(()=>{g()},[N]),f(()=>{g()},[d]),f(()=>{var e,r,t,n;const c=(r=(e=o.current)==null?void 0:e.config)!=null?r:{},s=D(p({},c),{attributeList:(t=_.attributeList)!=null?t:[]});(n=o.current)==null||n.setConfig(JSON.stringify(s))},[_.attributeList]),f(()=>{var e;(e=o.current)==null||e.setEnableAddRect(w.length===0),g()},[w]),f(()=>{const{hiddenText:e}=k||{};if(e===void 0)return;const r=o.current;if(!r)return;const t=p(p({},r.style),k);r.setStyle(t)},[k]),A.createElement(se,{spinning:ie},A.createElement("div",{ref:E,style:p({position:"relative"},m)}))};var Oe=pe(ge,null,null,{context:Re})(Se);export{Oe as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labelbee/lb-components",
|
|
3
|
-
"version": "1.23.0-alpha.
|
|
3
|
+
"version": "1.23.0-alpha.119",
|
|
4
4
|
"description": "Provide a complete library of annotation components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"es": "./es/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@ant-design/icons": "^4.6.2",
|
|
46
|
-
"@labelbee/lb-annotation": "1.27.0-alpha.
|
|
46
|
+
"@labelbee/lb-annotation": "1.27.0-alpha.60",
|
|
47
47
|
"@labelbee/lb-utils": "1.19.0-alpha.22",
|
|
48
48
|
"@labelbee/wavesurfer": "1.1.0-alpha.1",
|
|
49
49
|
"@types/react-dom": "^18.2.7",
|