@labelbee/lb-components 1.23.0-alpha.119 → 1.23.0-alpha.120

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.
Files changed (24) hide show
  1. package/dist/_virtual/2DViewWorker.js +1 -1
  2. package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
  3. package/dist/index.css +15 -0
  4. package/dist/store/toolConfig/baseToolConfig.js +1 -0
  5. package/dist/store/toolConfig/index.js +1 -1
  6. package/dist/store/toolConfig/pointCloudToolConfig.js +1 -0
  7. package/dist/types/store/toolConfig/baseToolConfig.d.ts +4 -0
  8. package/dist/types/store/toolConfig/index.d.ts +2 -5
  9. package/dist/types/store/toolConfig/pointCloudToolConfig.d.ts +4 -0
  10. package/dist/types/store/toolConfig/types.d.ts +10 -0
  11. package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.d.ts +3 -0
  12. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.js +1 -0
  13. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.module.scss.js +1 -0
  14. package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  15. package/es/_virtual/2DViewWorker.js +1 -1
  16. package/es/components/pointCloud2DRectOperationView/index.js +1 -1
  17. package/es/index.css +15 -0
  18. package/es/store/toolConfig/baseToolConfig.js +1 -0
  19. package/es/store/toolConfig/index.js +1 -1
  20. package/es/store/toolConfig/pointCloudToolConfig.js +1 -0
  21. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.js +1 -0
  22. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/selectBoxVisibleSwitch/index.module.scss.js +1 -0
  23. package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  24. package/package.json +3 -3
@@ -1 +1 @@
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};
1
+ import{useLatest as X,useMemoizedFn as F}from"ahooks";import{Spin as ae}from"antd/es";import M,{useContext as fe,useRef as Y,useState as Z,useMemo as pe,useCallback as me,useEffect as f}from"react";import{connect as ve}from"react-redux";import{usePointCloudViews as ge}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as Re}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as he}from"../../store/annotation/map.js";import{LabelBeeContext as _e}from"../../store/ctx.js";import{PointCloud2DRectOperation as Ie,ImgUtils as De}from"@labelbee/lb-annotation";import{selectSpecifiedRectsFromTopViewSelectedIds as be}from"./util.js";import{useUpdateRectList as we}from"./useUpdateRectList.js";import{useToolStyleContext as Ce}from"../../hooks/useToolStyle.js";import xe from"../../store/toolConfig/index.js";var ye=Object.defineProperty,Pe=Object.defineProperties,Se=Object.getOwnPropertyDescriptors,ee=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,te=(s,i,c)=>i in s?ye(s,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):s[i]=c,v=(s,i)=>{for(var c in i||(i={}))Le.call(i,c)&&te(s,c,i[c]);if(ee)for(var c of ee(i))Oe.call(i,c)&&te(s,c,i[c]);return s},b=(s,i)=>Pe(s,Se(i)),z=(s,i,c)=>new Promise((d,g)=>{var I=a=>{try{D(c.next(a))}catch(R){g(R)}},L=a=>{try{D(c.throw(a))}catch(R){g(R)}},D=a=>a.done?d(a.value):Promise.resolve(a.value).then(I,L);D((c=c.apply(s,i)).next())});const Ve=s=>{var i,c;const{mappingData:d,size:g,config:I,checkMode:L,afterImgOnLoad:D,shouldExcludePointCloudBoxListUpdate:a}=s,{selectBoxVisibleSwitch:R}=xe(),O=(i=d==null?void 0:d.url)!=null?i:"",w=(c=d==null?void 0:d.fallbackUrl)!=null?c:"",{pointCloudBoxList:V,setPointCloudResult:j,defaultAttribute:k,rectList:E,addRectIn2DView:ne,updateRectIn2DView:re,removeRectIn2DView:oe,updateRectListByReducer:le,selectedIDs:p,setSelectedIDs:B}=fe(Re),{value:N}=Ce(),ie=X(p),{update2DViewRect:ce,remove2DViewRect:ue}=ge(),U=M.useRef(null),o=Y(null),H=F(ce),C=F(ue),x=Y(null),[se,J]=Z(!0),[$,q]=Z(""),y=pe(()=>E==null?void 0:E.filter(e=>e.imageName===(d==null?void 0:d.path)),[d==null?void 0:d.path,E]),P=X(d==null?void 0:d.path),A=me(e=>z(void 0,null,function*(){try{const r=ie.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(r.length){const n=new Set(r),l=t.filter(u=>n.has(u.id)).map(u=>u.id);B(l)}return t}catch(r){}}),[B]),G=e=>{const{boxID:r}=e;if(!a&&r){A(()=>{const t=H==null?void 0:H(e);return t?(x.current=t,j(t),t):null});return}re(e,!0)},K=e=>{P.current&&ne(b(v({},e),{imageName:P.current}))},Q=e=>{if(e.length===0)return;if(!a){const t=e.find(n=>n.boxID);if(t){A(()=>{const n=C==null?void 0:C(t);return n?(x.current=n,j(n),h(),n):null});return}}const r=e.find(t=>t.extId);r&&A(()=>{const{imageName:t,extId:n}=r,l=C==null?void 0:C({boxID:n,imageName:t});return l?(x.current=l,j(l),l):null}),oe(e)},de=F(()=>{let e=[];return V.forEach(r=>{const{rects:t=[],id:n,attribute:l,trackID:u}=r,m=t.find(S=>S.imageName===P.current),_=n+"_"+P.current;m&&(e=[...e,b(v({},m),{boxID:n,id:_,attribute:l,order:u})])}),e}),h=we(()=>{var e,r,t,n;const l=a?[]:de(),u=(e=o.current)==null?void 0:e.selectedRectID,m=p.slice(0),_=R?be(m,l,y):[...l,...y];let S=[];!R&&(p==null?void 0:p.length)&&(S=l.filter(T=>u?p.includes(T.boxID)&&!u.includes(T.boxID):p.includes(T.boxID))),(r=o.current)==null||r.setHighLightRectList(S),(t=o.current)==null||t.setResult(_),$&&((n=o.current)==null||n.setSelectedRectID($),q(""))}),W=({targetId:e,id:r})=>{B(e),q(r)};return f(()=>{if(U.current){const e=new Ie({container:U.current,size:g,config:b(v({},I),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:L});return o.current=e,o.current.init(),o.current.on("updateDragResult",G),o.current.on("afterAddingDrawingRect",K),o.current.on("deleteSelectedRects",Q),o.current.on("onRightClick",W),()=>{var r,t,n,l,u;(r=o.current)==null||r.unbind("updateDragResult",G),(t=o.current)==null||t.unbind("afterAddingDrawingRect",K),(n=o.current)==null||n.unbind("deleteSelectedRects",Q),(l=o.current)==null||l.unbind("onRightClick",W),(u=o.current)==null||u.destroy()}}},[]),f(()=>{const e=t=>z(void 0,null,function*(){try{return yield De.load(t)}catch(n){return console.error("Error loading image:",n),null}}),r=()=>z(void 0,null,function*(){var t;J(!0);let n=yield e(O);!n&&w&&(n=yield e(w)),n&&((t=o.current)==null||t.setImgNode(n),D(n)),J(!1)});o.current&&(O||w)&&r()},[O,w]),f(()=>{var e;(e=o.current)==null||e.setSize(g)},[g]),f(()=>{V!==x.current&&h()},[V]),f(()=>{var e,r;const t=y.find(n=>n.id===o.current.selectedRectID);(r=(e=o.current)==null?void 0:e.setDefaultAttribute)==null||r.call(e,k),t&&le(n=>{var l;const u=[];let m=null;return n.forEach(_=>{_.id!==o.current.selectedRectID?u.push(_):m=_}),t.extId===void 0&&(m=(l=o.current)==null?void 0:l.selectedRect),[...u,b(v({},m||{}),{attribute:k})]}),h()},[k]),f(()=>{h()},[y]),f(()=>{h()},[a]),f(()=>{var e,r,t,n;const l=(r=(e=o.current)==null?void 0:e.config)!=null?r:{},u=b(v({},l),{attributeList:(t=I.attributeList)!=null?t:[]});(n=o.current)==null||n.setConfig(JSON.stringify(u))},[I.attributeList]),f(()=>{var e;(e=o.current)==null||e.setEnableAddRect(p.length===0),h()},[p]),f(()=>{const{hiddenText:e}=N||{};if(e===void 0)return;const r=o.current;if(!r)return;const t=v(v({},r.style),N);r.setStyle(t)},[N]),f(()=>{h()},[R]),M.createElement(ae,{spinning:se},M.createElement("div",{ref:U,style:v({position:"relative"},g)}))};var je=ve(he,null,null,{context:_e})(Ve);export{je as default};
package/es/index.css CHANGED
@@ -69,6 +69,21 @@
69
69
  justify-content: space-between;
70
70
  padding: 12px 20px;
71
71
  }
72
+ .index-module_switchBox__mLSzh {
73
+ display: flex;
74
+ justify-content: space-between;
75
+ align-items: center;
76
+ padding: 12px 20px;
77
+ }
78
+
79
+ .index-module_switchLeft__7qd-2 {
80
+ display: flex;
81
+ align-items: center;
82
+ }
83
+
84
+ .index-module_switchTitle__de9li {
85
+ margin-right: 8px;
86
+ }
72
87
  .dynamic-resizer-content {
73
88
  width: 100%;
74
89
  height: 100%;
@@ -0,0 +1 @@
1
+ const e=(t,o)=>({onlyLoadFirstData:!1,setOnlyLoadFirstData:a=>t(s=>({onlyLoadFirstData:a}))});export{e as default};
@@ -1 +1 @@
1
- import{create as o}from"zustand";const e=o(t=>({onlyLoadFirstData:!1,setOnlyLoadFirstData:a=>t(s=>({onlyLoadFirstData:a}))}));export{e as default};
1
+ import{create as l}from"zustand";import n from"./baseToolConfig.js";import f from"./pointCloudToolConfig.js";var i=Object.defineProperty,t=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,a=(e,r,o)=>r in e?i(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,p=(e,r)=>{for(var o in r||(r={}))s.call(r,o)&&a(e,o,r[o]);if(t)for(var o of t(r))u.call(r,o)&&a(e,o,r[o]);return e};const m=l((e,r,o)=>p(p({},n(e)),f(e)));export{m as default};
@@ -0,0 +1 @@
1
+ const o=(e,l)=>({selectBoxVisibleSwitch:!1,setSelectBoxVisibleSwitch:t=>e(()=>({selectBoxVisibleSwitch:t}))});export{o as default};
@@ -0,0 +1 @@
1
+ import e,{useEffect as n}from"react";import{Tooltip as a,Switch as r}from"antd";import m from"../../../../../../store/toolConfig/index.js";import{useTranslation as d}from"react-i18next";import{QuestionCircleOutlined as f}from"@ant-design/icons";import t from"./index.module.scss.js";const p=()=>{const{t:i}=d(),{selectBoxVisibleSwitch:l,setSelectBoxVisibleSwitch:s}=m();n(()=>{s(!1)},[]);const o=c=>{s(c)};return e.createElement("div",{className:t.switchBox},e.createElement("div",{className:t.switchLeft},e.createElement("div",{className:t.switchTitle},i("SelectBoxToDisplayIndependently")),e.createElement(a,{placement:"top",title:e.createElement("div",{style:{width:"210px"}},i("SelectBoxSwitchTips"))},e.createElement(f,null))),e.createElement(r,{defaultChecked:!1,checked:l,onChange:o}))};export{p as default};
@@ -0,0 +1 @@
1
+ var e={switchBox:"index-module_switchBox__mLSzh",switchLeft:"index-module_switchLeft__7qd-2",switchTitle:"index-module_switchTitle__de9li"};export{e as default};
@@ -1 +1 @@
1
- import e,{useState as E,useContext as I,useEffect as L}from"react";import{EditFilled as ot}from"@ant-design/icons";import{ToolIcons as nt}from"../ToolIcons.js";import{EToolName as lt}from"../../../../data/enums/ToolType.js";import{cTool as it}from"@labelbee/lb-annotation";import{PointCloudContext as T}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as w,Input as rt,message as D}from"antd";import st from"../../../../utils/StepUtils.js";import{connect as at}from"react-redux";import{jsonParser as ct,classnames as ut}from"../../../../utils/index.js";import{useStatus as R}from"../../../../components/pointCloudView/hooks/useStatus.js";import{useSingleBox as $}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{useTranslation as k}from"react-i18next";import{LabelBeeContext as mt,useDispatch as dt}from"../../../../store/ctx.js";import pt from"./components/batchUpdateModal/index.js";import ft from"./components/annotatedBox/index.js";import vt from"./components/rectRotateSensitivitySlider/index.js";import gt from"./components/findTrackIDIndex/index.js";import St from"./components/firstFrameDataSwitch/index.js";import{EPointCloudSegmentStatus as h,EPointCloudPattern as bt}from"@labelbee/lb-utils";import Ct from"../../../../components/attributeList/index.js";import{useAttribute as xt}from"../../../../components/pointCloudView/hooks/useAttribute.js";import Pt from"../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js";import _t from"../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js";import yt from"../../../../assets/annotation/pointCloudTool/circleSelector.svg.js";import Et from"../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js";import wt from"../../../../assets/annotation/rectTool/icon_rect.svg.js";import Dt from"../../../../assets/annotation/rectTool/icon_rect_a.svg.js";import{sidebarCls as j}from"../index.js";import{SetTaskStepList as ht}from"../../../../store/annotation/actionCreators.js";import{usePointCloudViews as jt}from"../../../../components/pointCloudView/hooks/usePointCloudViews.js";import It from"../../../../components/subAttributeList/index.js";import Lt from"../../../../components/DynamicResizer/DynamicResizer.js";var Tt=Object.defineProperty,kt=Object.defineProperties,Bt=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertySymbols,Vt=Object.prototype.hasOwnProperty,At=Object.prototype.propertyIsEnumerable,F=(o,t,n)=>t in o?Tt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,B=(o,t)=>{for(var n in t||(t={}))Vt.call(t,n)&&F(o,n,t[n]);if(z)for(var n of z(t))At.call(t,n)&&F(o,n,t[n]);return o},V=(o,t)=>kt(o,Bt(t));const Nt=()=>{const[o,t]=E(!1),n=I(T),{pointCloudBoxList:a}=n,{selectedBox:c,updateSelectedBox:l}=$(),[u,m]=E(""),{t:v}=k(),p=c==null?void 0:c.info.trackID,s=d=>!!a.find(b=>b.trackID===d&&b.id!==(c==null?void 0:c.info.id)),r=(d=!1)=>{const f=parseInt(u,10);if(d&&t(!1),isNaN(f)){D.error(v("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){D.error(v("NotAllowDecimalPointsInTrackID"));return}if(s(f)){D.error(v("DuplicateTrackIDsExist"));return}if(!(f>0)){D.error(v("PositiveIntegerCheck"));return}S(f)};L(()=>{t(!1)},[p]);const S=d=>{var f;const b=l({trackID:d});(f=n==null?void 0:n.topViewInstance)==null||f.updatePolygonList(b!=null?b:[]),n.mainViewInstance&&n.selectedPointCloudBox&&(n==null||n.mainViewInstance.generateBox(n==null?void 0:n.selectedPointCloudBox))};return e.createElement("div",{style:{padding:24}},e.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},e.createElement("span",null,v("CurrentBoxTrackIDs")),p&&e.createElement(pt,{id:p,updateCurrentPolygonList:d=>S(d)})),e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"12px"}},o&&p?e.createElement(rt,{defaultValue:p,onChange:d=>{m(d.target.value)},disabled:!p,size:"small",onBlur:()=>{r()},onPressEnter:()=>{r(!0)}}):e.createElement("span",null,p),e.createElement(ot,{style:{color:"#999",marginLeft:16,cursor:typeof p!="undefined"?"pointer":"not-allowed"},onClick:()=>{p&&t(!o)}})))},U=({segmentStatus:o,globalPattern:t})=>t===bt.Segmentation&&![h.Edit,h.Ready].includes(o),H=({attributeList:o,subAttributeList:t,toolInstance:n,config:a,stepList:c,stepInfo:l,enableColorPicker:u})=>{const[m,v]=E({segmentStatus:h.Ready}),{selectedBox:p}=$(),s=I(T),{ptSegmentInstance:r}=s,{t:S}=k(),{defaultAttribute:d}=xt(),f=jt(),{isPointCloudSegmentationPattern:b}=R(),W=dt(),J={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};L(()=>{if(!!r)return r.on("syncPointCloudStatus",v),()=>{r.unbind("syncPointCloudStatus",v)}},[r]);const K=(i,C)=>{var x,P,_,A,N;const y=(x=a==null?void 0:a.attributeList)==null?void 0:x.map(g=>g.value===i?V(B({},g),{color:C}):g),O=V(B({},a),{attributeList:y}),tt=JSON.stringify(O),et=c==null?void 0:c.map(g=>(g==null?void 0:g.step)===(l==null?void 0:l.step)?V(B({},g),{config:tt}):g);(P=s==null?void 0:s.topViewInstance)==null||P.updateAttributeList(y),(_=s==null?void 0:s.sideViewInstance)==null||_.updateAttributeList(y),(A=s==null?void 0:s.backViewInstance)==null||A.updateAttributeList(y),(N=s==null?void 0:s.mainViewInstance)==null||N.setConfig(O),W(ht({stepList:et}))},X=i=>{f.updateViewsByDefaultSize&&f.updateViewsByDefaultSize(i)},Y=i=>{U({globalPattern:s.globalPattern,segmentStatus:m.segmentStatus})||n.setDefaultAttribute(i)},q=(i,C)=>{U({globalPattern:s.globalPattern,segmentStatus:m.segmentStatus})||n.setSubAttribute(i,C)},G=o.map(i=>({label:i.key,value:i.value,color:i==null?void 0:i.color,limit:i==null?void 0:i.limit,isDefault:i==null?void 0:i.isDefault})),Q=p||m.cacheSegData&&m.segmentStatus===h.Edit,Z=b;return e.createElement("div",{style:{height:"100%",overflow:"auto",display:"flex",flexDirection:"column"}},e.createElement("div",{style:J},S("Attribute")),e.createElement("div",{style:{height:0,flex:1,overflowY:"auto",overflowX:"hidden"}},e.createElement(Ct,{list:G,forbidDefault:!0,selectedAttribute:d!=null?d:"",attributeChanged:i=>Y(i),updateColorConfig:K,enableColorPicker:u,updateSize:X,forbidShowLimitPopover:Z}),e.createElement(w,{style:{margin:0}}),Q&&e.createElement(It,{subAttributeList:t,setSubAttribute:q,getValue:i=>{var C,x,P,_;return((x=(C=s.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:x[i.value])||((_=(P=m.cacheSegData)==null?void 0:P.subAttribute)==null?void 0:_[i.value])}})))},Ot=[{toolName:"LassoSelector",commonSvg:Pt,selectedSvg:_t},{toolName:"RectSelector",commonSvg:wt,selectedSvg:Dt},{toolName:"CircleSelector",commonSvg:yt,selectedSvg:Et}],M=({toolInstance:o})=>{const{ptSegmentInstance:t}=I(T),[n,a]=E("LassoSelector"),{t:c}=k();return L(()=>{if(!t)return;const l=()=>{a("LassoSelector")},u=()=>{a("RectSelector")},m=()=>{a("CircleSelector")};return t.on("LassoSelector",l),t.on("RectSelector",u),t.on("CircleSelector",m),()=>{t.unbind("LassoSelector",l),t.unbind("RectSelector",u),t.unbind("CircleSelector",m)}},[t]),e.createElement("div",{className:`${j}__level`},Ot.map(l=>{const u=n===l.toolName;return e.createElement("span",{className:`${j}__toolOption`,key:l.toolName,onClick:()=>t==null?void 0:t.emit(l.toolName)},e.createElement("img",{className:`${j}__singleTool`,src:u?l==null?void 0:l.selectedSvg:l==null?void 0:l.commonSvg}),e.createElement("span",{className:ut({[`${j}__toolOption__selected`]:u})},c(l.toolName)))}))},Rt=({stepInfo:o,toolInstance:t,imgList:n,imgIndex:a,stepList:c,enableColorPicker:l})=>{var u,m;const{updatePointCloudPattern:v,pointCloudPattern:p,isPointCloudSegmentationPattern:s}=R(),r=ct(o.config),S=(u=r==null?void 0:r.attributeList)!=null?u:[],d=(r==null?void 0:r.secondaryAttributeConfigurable)===!0?(m=r==null?void 0:r.inputList)!=null?m:[]:[];return s?e.createElement(e.Fragment,null,e.createElement(M,{toolInstance:t}),e.createElement(H,{toolInstance:t,attributeList:S,subAttributeList:d,config:r,stepList:c,stepInfo:o,enableColorPicker:l})):e.createElement(e.Fragment,null,e.createElement(nt,{toolName:it.EPointCloudName.PointCloud,selectedToolName:p,onChange:f=>v==null?void 0:v(f)}),e.createElement("div",{style:{flex:1,overflow:"hidden"}},e.createElement(Lt,{minTopHeight:42,defaultHeight:400,localKey:"id:"+(o==null?void 0:o.id)+"taskID:"+(o==null?void 0:o.taskID)+"step:"+(o==null?void 0:o.step)+"type:"+(o==null?void 0:o.type)},e.createElement(H,{toolInstance:t,attributeList:S,subAttributeList:d,config:r,stepList:c,stepInfo:o,enableColorPicker:l}),(r==null?void 0:r.trackConfigurable)===!0&&p===lt.Rect?e.createElement("div",{style:{height:"100%",overflow:"auto"}},e.createElement(Nt,null),e.createElement(w,{style:{margin:0}}),e.createElement(ft,{imgList:n,imgIndex:a}),e.createElement(w,{style:{margin:0}}),e.createElement(gt,{imgList:n,imgIndex:a}),e.createElement(w,{style:{margin:0}}),e.createElement(vt,null),o.loadPreStep>0&&e.createElement(St,null)):e.createElement("div",null))))},$t=o=>{var t,n,a,c;const l=st.getCurrentStepInfo((t=o.annotation)==null?void 0:t.step,(n=o.annotation)==null?void 0:n.stepList),u=(a=o.annotation)==null?void 0:a.toolInstance,m=(c=o.annotation)==null?void 0:c.stepList;return{stepInfo:l,toolInstance:u,imgList:o.annotation.imgList,imgIndex:o.annotation.imgIndex,stepList:m}};var zt=at($t,null,null,{context:mt})(Rt);export{M as PointCloudSegToolIcon,zt as default};
1
+ import e,{useState as y,useContext as I,useEffect as L}from"react";import{EditFilled as ot}from"@ant-design/icons";import{ToolIcons as nt}from"../ToolIcons.js";import{EToolName as lt}from"../../../../data/enums/ToolType.js";import{cTool as it}from"@labelbee/lb-annotation";import{PointCloudContext as T}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as w,Input as rt,message as D}from"antd";import st from"../../../../utils/StepUtils.js";import{connect as at}from"react-redux";import{jsonParser as ct,classnames as ut}from"../../../../utils/index.js";import{useStatus as R}from"../../../../components/pointCloudView/hooks/useStatus.js";import{useSingleBox as $}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{useTranslation as B}from"react-i18next";import{LabelBeeContext as mt,useDispatch as dt}from"../../../../store/ctx.js";import pt from"./components/batchUpdateModal/index.js";import ft from"./components/annotatedBox/index.js";import vt from"./components/rectRotateSensitivitySlider/index.js";import gt from"./components/findTrackIDIndex/index.js";import St from"./components/firstFrameDataSwitch/index.js";import bt from"./components/selectBoxVisibleSwitch/index.js";import{EPointCloudSegmentStatus as h,EPointCloudPattern as Ct}from"@labelbee/lb-utils";import xt from"../../../../components/attributeList/index.js";import{useAttribute as Et}from"../../../../components/pointCloudView/hooks/useAttribute.js";import Pt from"../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js";import _t from"../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js";import yt from"../../../../assets/annotation/pointCloudTool/circleSelector.svg.js";import wt from"../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js";import Dt from"../../../../assets/annotation/rectTool/icon_rect.svg.js";import ht from"../../../../assets/annotation/rectTool/icon_rect_a.svg.js";import{sidebarCls as j}from"../index.js";import{SetTaskStepList as jt}from"../../../../store/annotation/actionCreators.js";import{usePointCloudViews as It}from"../../../../components/pointCloudView/hooks/usePointCloudViews.js";import Lt from"../../../../components/subAttributeList/index.js";import Tt from"../../../../components/DynamicResizer/DynamicResizer.js";var Bt=Object.defineProperty,Vt=Object.defineProperties,kt=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,Nt=Object.prototype.propertyIsEnumerable,F=(o,t,n)=>t in o?Bt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,V=(o,t)=>{for(var n in t||(t={}))At.call(t,n)&&F(o,n,t[n]);if(z)for(var n of z(t))Nt.call(t,n)&&F(o,n,t[n]);return o},k=(o,t)=>Vt(o,kt(t));const Ot=()=>{const[o,t]=y(!1),n=I(T),{pointCloudBoxList:a}=n,{selectedBox:c,updateSelectedBox:l}=$(),[u,m]=y(""),{t:v}=B(),p=c==null?void 0:c.info.trackID,s=d=>!!a.find(b=>b.trackID===d&&b.id!==(c==null?void 0:c.info.id)),r=(d=!1)=>{const f=parseInt(u,10);if(d&&t(!1),isNaN(f)){D.error(v("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){D.error(v("NotAllowDecimalPointsInTrackID"));return}if(s(f)){D.error(v("DuplicateTrackIDsExist"));return}if(!(f>0)){D.error(v("PositiveIntegerCheck"));return}S(f)};L(()=>{t(!1)},[p]);const S=d=>{var f;const b=l({trackID:d});(f=n==null?void 0:n.topViewInstance)==null||f.updatePolygonList(b!=null?b:[]),n.mainViewInstance&&n.selectedPointCloudBox&&(n==null||n.mainViewInstance.generateBox(n==null?void 0:n.selectedPointCloudBox))};return e.createElement("div",{style:{padding:24}},e.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},e.createElement("span",null,v("CurrentBoxTrackIDs")),p&&e.createElement(pt,{id:p,updateCurrentPolygonList:d=>S(d)})),e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"12px"}},o&&p?e.createElement(rt,{defaultValue:p,onChange:d=>{m(d.target.value)},disabled:!p,size:"small",onBlur:()=>{r()},onPressEnter:()=>{r(!0)}}):e.createElement("span",null,p),e.createElement(ot,{style:{color:"#999",marginLeft:16,cursor:typeof p!="undefined"?"pointer":"not-allowed"},onClick:()=>{p&&t(!o)}})))},U=({segmentStatus:o,globalPattern:t})=>t===Ct.Segmentation&&![h.Edit,h.Ready].includes(o),H=({attributeList:o,subAttributeList:t,toolInstance:n,config:a,stepList:c,stepInfo:l,enableColorPicker:u})=>{const[m,v]=y({segmentStatus:h.Ready}),{selectedBox:p}=$(),s=I(T),{ptSegmentInstance:r}=s,{t:S}=B(),{defaultAttribute:d}=Et(),f=It(),{isPointCloudSegmentationPattern:b}=R(),W=dt(),J={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};L(()=>{if(!!r)return r.on("syncPointCloudStatus",v),()=>{r.unbind("syncPointCloudStatus",v)}},[r]);const K=(i,C)=>{var x,E,P,A,N;const _=(x=a==null?void 0:a.attributeList)==null?void 0:x.map(g=>g.value===i?k(V({},g),{color:C}):g),O=k(V({},a),{attributeList:_}),tt=JSON.stringify(O),et=c==null?void 0:c.map(g=>(g==null?void 0:g.step)===(l==null?void 0:l.step)?k(V({},g),{config:tt}):g);(E=s==null?void 0:s.topViewInstance)==null||E.updateAttributeList(_),(P=s==null?void 0:s.sideViewInstance)==null||P.updateAttributeList(_),(A=s==null?void 0:s.backViewInstance)==null||A.updateAttributeList(_),(N=s==null?void 0:s.mainViewInstance)==null||N.setConfig(O),W(jt({stepList:et}))},X=i=>{f.updateViewsByDefaultSize&&f.updateViewsByDefaultSize(i)},Y=i=>{U({globalPattern:s.globalPattern,segmentStatus:m.segmentStatus})||n.setDefaultAttribute(i)},q=(i,C)=>{U({globalPattern:s.globalPattern,segmentStatus:m.segmentStatus})||n.setSubAttribute(i,C)},G=o.map(i=>({label:i.key,value:i.value,color:i==null?void 0:i.color,limit:i==null?void 0:i.limit,isDefault:i==null?void 0:i.isDefault})),Q=p||m.cacheSegData&&m.segmentStatus===h.Edit,Z=b;return e.createElement("div",{style:{height:"100%",overflow:"auto",display:"flex",flexDirection:"column"}},e.createElement("div",{style:J},S("Attribute")),e.createElement("div",{style:{height:0,flex:1,overflowY:"auto",overflowX:"hidden"}},e.createElement(xt,{list:G,forbidDefault:!0,selectedAttribute:d!=null?d:"",attributeChanged:i=>Y(i),updateColorConfig:K,enableColorPicker:u,updateSize:X,forbidShowLimitPopover:Z}),e.createElement(w,{style:{margin:0}}),Q&&e.createElement(Lt,{subAttributeList:t,setSubAttribute:q,getValue:i=>{var C,x,E,P;return((x=(C=s.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:x[i.value])||((P=(E=m.cacheSegData)==null?void 0:E.subAttribute)==null?void 0:P[i.value])}})))},Rt=[{toolName:"LassoSelector",commonSvg:Pt,selectedSvg:_t},{toolName:"RectSelector",commonSvg:Dt,selectedSvg:ht},{toolName:"CircleSelector",commonSvg:yt,selectedSvg:wt}],M=({toolInstance:o})=>{const{ptSegmentInstance:t}=I(T),[n,a]=y("LassoSelector"),{t:c}=B();return L(()=>{if(!t)return;const l=()=>{a("LassoSelector")},u=()=>{a("RectSelector")},m=()=>{a("CircleSelector")};return t.on("LassoSelector",l),t.on("RectSelector",u),t.on("CircleSelector",m),()=>{t.unbind("LassoSelector",l),t.unbind("RectSelector",u),t.unbind("CircleSelector",m)}},[t]),e.createElement("div",{className:`${j}__level`},Rt.map(l=>{const u=n===l.toolName;return e.createElement("span",{className:`${j}__toolOption`,key:l.toolName,onClick:()=>t==null?void 0:t.emit(l.toolName)},e.createElement("img",{className:`${j}__singleTool`,src:u?l==null?void 0:l.selectedSvg:l==null?void 0:l.commonSvg}),e.createElement("span",{className:ut({[`${j}__toolOption__selected`]:u})},c(l.toolName)))}))},$t=({stepInfo:o,toolInstance:t,imgList:n,imgIndex:a,stepList:c,enableColorPicker:l})=>{var u,m;const{updatePointCloudPattern:v,pointCloudPattern:p,isPointCloudSegmentationPattern:s}=R(),r=ct(o.config),S=(u=r==null?void 0:r.attributeList)!=null?u:[],d=(r==null?void 0:r.secondaryAttributeConfigurable)===!0?(m=r==null?void 0:r.inputList)!=null?m:[]:[];return s?e.createElement(e.Fragment,null,e.createElement(M,{toolInstance:t}),e.createElement(H,{toolInstance:t,attributeList:S,subAttributeList:d,config:r,stepList:c,stepInfo:o,enableColorPicker:l})):e.createElement(e.Fragment,null,e.createElement(nt,{toolName:it.EPointCloudName.PointCloud,selectedToolName:p,onChange:f=>v==null?void 0:v(f)}),e.createElement("div",{style:{flex:1,overflow:"hidden"}},e.createElement(Tt,{minTopHeight:42,defaultHeight:400,localKey:"id:"+(o==null?void 0:o.id)+"taskID:"+(o==null?void 0:o.taskID)+"step:"+(o==null?void 0:o.step)+"type:"+(o==null?void 0:o.type)},e.createElement(H,{toolInstance:t,attributeList:S,subAttributeList:d,config:r,stepList:c,stepInfo:o,enableColorPicker:l}),(r==null?void 0:r.trackConfigurable)===!0&&p===lt.Rect?e.createElement("div",{style:{height:"100%",overflow:"auto"}},e.createElement(Ot,null),e.createElement(w,{style:{margin:0}}),e.createElement(ft,{imgList:n,imgIndex:a}),e.createElement(w,{style:{margin:0}}),e.createElement(gt,{imgList:n,imgIndex:a}),e.createElement(w,{style:{margin:0}}),e.createElement(vt,null),o.loadPreStep>0&&e.createElement(St,null),e.createElement(bt,null)):e.createElement("div",null))))},zt=o=>{var t,n,a,c;const l=st.getCurrentStepInfo((t=o.annotation)==null?void 0:t.step,(n=o.annotation)==null?void 0:n.stepList),u=(a=o.annotation)==null?void 0:a.toolInstance,m=(c=o.annotation)==null?void 0:c.stepList;return{stepInfo:l,toolInstance:u,imgList:o.annotation.imgList,imgIndex:o.annotation.imgIndex,stepList:m}};var Ft=at(zt,null,null,{context:mt})($t);export{M as PointCloudSegToolIcon,Ft as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.23.0-alpha.119",
3
+ "version": "1.23.0-alpha.120",
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.27.0-alpha.60",
47
- "@labelbee/lb-utils": "1.19.0-alpha.22",
46
+ "@labelbee/lb-annotation": "1.27.0-alpha.61",
47
+ "@labelbee/lb-utils": "1.19.0-alpha.23",
48
48
  "@labelbee/wavesurfer": "1.1.0-alpha.1",
49
49
  "@types/react-dom": "^18.2.7",
50
50
  "@types/react-transition-group": "^4.4.9",