@labelbee/lb-components 1.23.0-alpha.71 → 1.23.0-alpha.72
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.
- package/dist/components/DynamicResizer/DynamicResizer.js +1 -0
- package/dist/components/DynamicResizer/assets/bottomToZero.svg.js +1 -0
- package/dist/components/DynamicResizer/assets/topToZero.svg.js +1 -0
- package/dist/components/DynamicResizer/hooks/useDrag.js +1 -0
- package/dist/components/DynamicResizer/hooks/useUpdateHeight.js +1 -0
- package/dist/components/DynamicResizer/index.js +1 -0
- package/dist/index.css +71 -0
- package/dist/types/components/DynamicResizer/DynamicResizer.d.ts +5 -0
- package/dist/types/components/DynamicResizer/hooks/useDrag.d.ts +12 -0
- package/dist/types/components/DynamicResizer/hooks/useUpdateHeight.d.ts +23 -0
- package/dist/types/components/DynamicResizer/index.d.ts +2 -0
- package/dist/types/components/DynamicResizer/types/interface.d.ts +16 -0
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/es/components/DynamicResizer/DynamicResizer.js +1 -0
- package/es/components/DynamicResizer/assets/bottomToZero.svg.js +1 -0
- package/es/components/DynamicResizer/assets/topToZero.svg.js +1 -0
- package/es/components/DynamicResizer/hooks/useDrag.js +1 -0
- package/es/components/DynamicResizer/hooks/useUpdateHeight.js +1 -0
- package/es/components/DynamicResizer/index.js +1 -0
- package/es/index.css +71 -0
- package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var React=require("react"),useDrag=require("./hooks/useDrag.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const DynamicResizer=e=>{const{minTopHeight:r=0,minBottomHeight:i=0,defaultHeight:s=50,axis:c="y",children:t,localKey:n="dynamicResizerHeights",customDivider:o}=e,a=React.useRef(null),{rendered:l,topStyle:u,bottomStyle:d}=useDrag({containerRef:a,minTopHeight:r,minBottomHeight:i,defaultHeight:s,axis:c,localKey:n,customDivider:o});return React__default.default.createElement("div",{className:"dynamic-resizer-content",ref:a},React__default.default.createElement("div",{className:"dynamic-resizer-top",style:u},t[0]),l,React__default.default.createElement("div",{className:"dynamic-resizer-bottom",style:d},t[1]))};module.exports=DynamicResizer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("react");var img="data:image/svg+xml,%3csvg t='1720421473527' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='5364' width='200' height='200'%3e %3cpath d='M94.8 304.5L512 721.8l416-416-833.2-1.3z m0 0' p-id='5365'%3e%3c/path%3e%3c/svg%3e";module.exports=img;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("react");var img="data:image/svg+xml,%3csvg t='1720421409111' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='5202' width='200' height='200'%3e %3cpath d='M928 721.8L510.8 304.5l-416 416 833.2 1.3z m0 0' p-id='5203'%3e%3c/path%3e%3c/svg%3e";module.exports=img;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var React=require("react"),Draggable1=require("react-draggable"),ahooks=require("ahooks"),useUpdateHeight=require("./useUpdateHeight.js"),topToZero=require("../assets/topToZero.svg.js"),bottomToZero=require("../assets/bottomToZero.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),Draggable1__default=_interopDefaultLegacy(Draggable1);const Draggable=Draggable1__default.default,useDrag=({containerRef:e,minTopHeight:g=0,minBottomHeight:n=0,defaultHeight:p=50,axis:a,localKey:m})=>{const r=m||"dynamicResizerHeights",{topHeight:o,position:s,bounds:l,topStyle:v,bottomStyle:b,updateELHeight:c,setTopHeightToZero:h,setBottomHeightToZero:f}=useUpdateHeight(e,g,n,p,r),[D,d]=ahooks.useLocalStorageState(r),H=React.useCallback(()=>{e.current&&e.current.classList.add("hide-scrollbar")},[e]),i=React.useCallback((t,T)=>{t.stopPropagation(),c(T.y)},[c]),u=React.useCallback(t=>{t.stopPropagation(),e.current&&e.current.classList.remove("hide-scrollbar"),d(o)},[e,d,o]);return{rendered:React.useMemo(()=>{const t=React__default.default.createElement("div",{className:"divider"},React__default.default.createElement("img",{src:topToZero,className:"divider-top",draggable:"false",onClick:h}),React__default.default.createElement("div",{className:"divider-icon",draggable:"false"}),React__default.default.createElement("img",{src:bottomToZero,className:"divider-bottom",draggable:"false",onClick:f}));return React__default.default.createElement(Draggable,{axis:a,position:s,handle:".divider",onStart:H,onDrag:i,onStop:u,bounds:l},t)},[a,s,i,u,l]),topStyle:v,bottomStyle:b}};module.exports=useDrag;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var React=require("react"),ahooks=require("ahooks");const useUpdateHeight=(e,r,H,p,v)=>{const[i,d]=React.useState(0),[g,f]=React.useState(0),[u,M]=React.useState(0),[h,T]=React.useState(0),[b,a]=ahooks.useLocalStorageState(v);React.useEffect(()=>{L();const t=b;let o=0;t!=null?o=isNaN(Number(t))?0:Number(t):o=i||p,l(o)},[]);const S=React.useMemo(()=>({x:0,y:i}),[i]),_=React.useMemo(()=>{var t;return{top:u,bottom:(((t=e.current)==null?void 0:t.offsetHeight)||0)-h}},[i,e]),x=React.useMemo(()=>({height:i+"px"}),[i]),B=React.useMemo(()=>({height:g+"px"}),[g]),L=()=>{var t,o,s,c;if(e){let n=r,m=H;r>=(((t=e.current)==null?void 0:t.offsetHeight)||0)/2&&(n=(((o=e.current)==null?void 0:o.offsetHeight)||0)/2),H>=(((s=e.current)==null?void 0:s.offsetHeight)||0)/2&&(m=(((c=e.current)==null?void 0:c.offsetHeight)||0)/2),M(n||1e-5),T(m)}},l=React.useCallback(t=>{var o;if(e){const s=((o=e==null?void 0:e.current)==null?void 0:o.offsetHeight)||0,c=s-h;t>=u&&t<=c&&(d(t),f(s-t))}},[e,u,h]);return{topHeight:i,bottomHeight:g,position:S,bounds:_,topStyle:x,bottomStyle:B,updateELHeight:l,setBottomHeightToZero:()=>{var t;if(e){const o=((t=e==null?void 0:e.current)==null?void 0:t.offsetHeight)||0;l(o-h||0),a(o-h||0)}},setTopHeightToZero:()=>{e&&(l(u||0),a(u||0))}}};module.exports=useUpdateHeight;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var DynamicResizer=require("./DynamicResizer.js");module.exports=DynamicResizer;
|
package/dist/index.css
CHANGED
|
@@ -63,6 +63,77 @@
|
|
|
63
63
|
justify-content: space-between;
|
|
64
64
|
margin-top: 16px;
|
|
65
65
|
}
|
|
66
|
+
.dynamic-resizer-content {
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 100%;
|
|
69
|
+
flex-shrink: 0;
|
|
70
|
+
flex-grow: 0;
|
|
71
|
+
position: relative;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.divider {
|
|
75
|
+
height: 10px;
|
|
76
|
+
width: 100%;
|
|
77
|
+
position: absolute;
|
|
78
|
+
top: -5px;
|
|
79
|
+
left: 0;
|
|
80
|
+
cursor: row-resize;
|
|
81
|
+
user-select: none;
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.divider:hover .divider-top, .divider:hover .divider-bottom {
|
|
89
|
+
display: block;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.divider-top,
|
|
93
|
+
.divider-bottom {
|
|
94
|
+
width: 20px;
|
|
95
|
+
height: 20px;
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
display: none;
|
|
98
|
+
user-select: none;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.divider-icon {
|
|
102
|
+
width: 100%;
|
|
103
|
+
height: 20px;
|
|
104
|
+
position: relative;
|
|
105
|
+
}
|
|
106
|
+
.divider-icon::after {
|
|
107
|
+
content: "";
|
|
108
|
+
display: block;
|
|
109
|
+
position: absolute;
|
|
110
|
+
top: 50%;
|
|
111
|
+
left: 0;
|
|
112
|
+
right: 0;
|
|
113
|
+
width: 90%;
|
|
114
|
+
height: 1px;
|
|
115
|
+
background: #ccc;
|
|
116
|
+
margin: 0 auto;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.dynamic-resizer-top {
|
|
120
|
+
width: 100%;
|
|
121
|
+
overflow-y: auto;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.dynamic-resizer-bottom {
|
|
125
|
+
width: 100%;
|
|
126
|
+
overflow-y: auto;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.hide-scrollbar * {
|
|
130
|
+
scrollbar-width: none; /* Firefox */
|
|
131
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.hide-scrollbar *::-webkit-scrollbar {
|
|
135
|
+
display: none; /* Chrome, Safari, Opera */
|
|
136
|
+
}
|
|
66
137
|
.index-module_latexEditor__0fK8G {
|
|
67
138
|
line-height: 32px;
|
|
68
139
|
background-color: #ededed;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DragProps } from '../types/interface';
|
|
3
|
+
declare const useDrag: ({ containerRef, minTopHeight, minBottomHeight, defaultHeight, axis, localKey, }: DragProps) => {
|
|
4
|
+
rendered: React.JSX.Element;
|
|
5
|
+
topStyle: {
|
|
6
|
+
height: string;
|
|
7
|
+
};
|
|
8
|
+
bottomStyle: {
|
|
9
|
+
height: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export default useDrag;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
declare const useUpdateHeight: (containerRef: RefObject<HTMLDivElement>, minTopHeight: number, minBottomHeight: number, defaultHeight: number, cacheKey: string) => {
|
|
3
|
+
topHeight: number;
|
|
4
|
+
bottomHeight: number;
|
|
5
|
+
position: {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
};
|
|
9
|
+
bounds: {
|
|
10
|
+
top: number;
|
|
11
|
+
bottom: number;
|
|
12
|
+
};
|
|
13
|
+
topStyle: {
|
|
14
|
+
height: string;
|
|
15
|
+
};
|
|
16
|
+
bottomStyle: {
|
|
17
|
+
height: string;
|
|
18
|
+
};
|
|
19
|
+
updateELHeight: (newTopHeight: number) => void;
|
|
20
|
+
setBottomHeightToZero: () => void;
|
|
21
|
+
setTopHeightToZero: () => void;
|
|
22
|
+
};
|
|
23
|
+
export default useUpdateHeight;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactElement, RefObject } from 'react';
|
|
2
|
+
interface Common {
|
|
3
|
+
defaultHeight?: number;
|
|
4
|
+
minTopHeight?: number;
|
|
5
|
+
minBottomHeight?: number;
|
|
6
|
+
axis?: 'x' | 'y';
|
|
7
|
+
localKey?: string;
|
|
8
|
+
customDivider?: ReactElement;
|
|
9
|
+
}
|
|
10
|
+
export interface DynamicResizerProps extends Common {
|
|
11
|
+
children: ReactElement[] | Element[] | Boolean[];
|
|
12
|
+
}
|
|
13
|
+
export interface DragProps extends Common {
|
|
14
|
+
containerRef: RefObject<HTMLDivElement>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),icons=require("@ant-design/icons"),ToolIcons=require("../ToolIcons.js"),ToolType=require("../../../../data/enums/ToolType.js"),lbAnnotation=require("@labelbee/lb-annotation"),PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),antd=require("antd"),StepUtils=require("../../../../utils/StepUtils.js"),reactRedux=require("react-redux"),index=require("../../../../utils/index.js"),useStatus=require("../../../../components/pointCloudView/hooks/useStatus.js"),useSingleBox=require("../../../../components/pointCloudView/hooks/useSingleBox.js"),reactI18next=require("react-i18next"),ctx=require("../../../../store/ctx.js"),index$4=require("./components/batchUpdateModal/index.js"),index$1=require("./components/annotatedBox/index.js"),index$3=require("./components/rectRotateSensitivitySlider/index.js"),index$2=require("./components/findTrackIDIndex/index.js"),lbUtils=require("@labelbee/lb-utils"),index$5=require("../../../../components/attributeList/index.js"),useAttribute=require("../../../../components/pointCloudView/hooks/useAttribute.js"),lassoSelector=require("../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js"),lassoSelector_a=require("../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js"),circleSelector=require("../../../../assets/annotation/pointCloudTool/circleSelector.svg.js"),circleSelector_a=require("../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js"),icon_rect=require("../../../../assets/annotation/rectTool/icon_rect.svg.js"),icon_rect_a=require("../../../../assets/annotation/rectTool/icon_rect_a.svg.js"),index$7=require("../index.js"),actionCreators=require("../../../../store/annotation/actionCreators.js"),usePointCloudViews=require("../../../../components/pointCloudView/hooks/usePointCloudViews.js"),index$6=require("../../../../components/subAttributeList/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}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=(t,e,n)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,__spreadValues=(t,e)=>{for(var n in e||(e={}))__hasOwnProp.call(e,n)&&__defNormalProp(t,n,e[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(e))__propIsEnum.call(e,n)&&__defNormalProp(t,n,e[n]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const BoxTrackIDInput=()=>{const[t,e]=React.useState(!1),n=React.useContext(PointCloudContext.PointCloudContext),{pointCloudBoxList:s}=n,{selectedBox:i,updateSelectedBox:o}=useSingleBox.useSingleBox(),[u,c]=React.useState(""),{t:v}=reactI18next.useTranslation(),m=i==null?void 0:i.info.trackID,a=d=>!!s.find(g=>g.trackID===d&&g.id!==(i==null?void 0:i.info.id)),l=(d=!1)=>{const p=parseInt(u,10);if(d&&e(!1),isNaN(p)){antd.message.error(v("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){antd.message.error(v("NotAllowDecimalPointsInTrackID"));return}if(a(p)){antd.message.error(v("DuplicateTrackIDsExist"));return}if(!(p>0)){antd.message.error(v("PositiveIntegerCheck"));return}S(p)};React.useEffect(()=>{e(!1)},[m]);const S=d=>{var p;const g=o({trackID:d});(p=n==null?void 0:n.topViewInstance)==null||p.updatePolygonList(g!=null?g:[])};return React__default.default.createElement("div",{style:{padding:24}},React__default.default.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},React__default.default.createElement("span",null,v("CurrentBoxTrackIDs")),m&&React__default.default.createElement(index$4,{id:m,updateCurrentPolygonList:d=>S(d)})),React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"12px"}},t&&m?React__default.default.createElement(antd.Input,{defaultValue:m,onChange:d=>{c(d.target.value)},disabled:!m,size:"small",onBlur:()=>{l()},onPressEnter:()=>{l(!0)}}):React__default.default.createElement("span",null,m),React__default.default.createElement(icons.EditFilled,{style:{color:"#999",marginLeft:16,cursor:typeof m!="undefined"?"pointer":"not-allowed"},onClick:()=>{m&&e(!t)}})))},isAllowUpdateInSegment=({segmentStatus:t,globalPattern:e})=>e===lbUtils.EPointCloudPattern.Segmentation&&![lbUtils.EPointCloudSegmentStatus.Edit,lbUtils.EPointCloudSegmentStatus.Ready].includes(t),AttributeUpdater=({attributeList:t,subAttributeList:e,toolInstance:n,config:s,stepList:i,stepInfo:o,enableColorPicker:u})=>{const[c,v]=React.useState({segmentStatus:lbUtils.EPointCloudSegmentStatus.Ready}),{selectedBox:m}=useSingleBox.useSingleBox(),a=React.useContext(PointCloudContext.PointCloudContext),{ptSegmentInstance:l}=a,{t:S}=reactI18next.useTranslation(),{defaultAttribute:d}=useAttribute.useAttribute(),p=usePointCloudViews.usePointCloudViews(),{isPointCloudSegmentationPattern:g}=useStatus.useStatus(),T=ctx.useDispatch(),w={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};React.useEffect(()=>{if(!!l)return l.on("syncPointCloudStatus",v),()=>{l.unbind("syncPointCloudStatus",v)}},[l]);const j=(r,C)=>{var b,x,_,E,y;const P=(b=s==null?void 0:s.attributeList)==null?void 0:b.map(f=>f.value===r?__spreadProps(__spreadValues({},f),{color:C}):f),I=__spreadProps(__spreadValues({},s),{attributeList:P}),A=JSON.stringify(I),B=i==null?void 0:i.map(f=>(f==null?void 0:f.step)===(o==null?void 0:o.step)?__spreadProps(__spreadValues({},f),{config:A}):f);(x=a==null?void 0:a.topViewInstance)==null||x.updateAttributeList(P),(_=a==null?void 0:a.sideViewInstance)==null||_.updateAttributeList(P),(E=a==null?void 0:a.backViewInstance)==null||E.updateAttributeList(P),(y=a==null?void 0:a.mainViewInstance)==null||y.setConfig(I),T(actionCreators.SetTaskStepList({stepList:B}))},D=r=>{p.updateViewsByDefaultSize&&p.updateViewsByDefaultSize(r)},L=r=>{isAllowUpdateInSegment({globalPattern:a.globalPattern,segmentStatus:c.segmentStatus})||n.setDefaultAttribute(r)},q=(r,C)=>{isAllowUpdateInSegment({globalPattern:a.globalPattern,segmentStatus:c.segmentStatus})||n.setSubAttribute(r,C)},h=t.map(r=>({label:r.key,value:r.value,color:r==null?void 0:r.color,limit:r==null?void 0:r.limit,isDefault:r==null?void 0:r.isDefault})),k=m||c.cacheSegData&&c.segmentStatus===lbUtils.EPointCloudSegmentStatus.Edit,V=g;return React__default.default.createElement("div",{style:{flex:1,overflowX:"hidden",overflowY:"auto"}},React__default.default.createElement("div",{style:w},S("Attribute")),React__default.default.createElement(index$5.default,{list:h,forbidDefault:!0,selectedAttribute:d!=null?d:"",attributeChanged:r=>L(r),updateColorConfig:j,enableColorPicker:u,updateSize:D,forbidShowLimitPopover:V}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),k&&React__default.default.createElement(index$6,{subAttributeList:e,setSubAttribute:q,getValue:r=>{var C,b,x,_;return((b=(C=a.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:b[r.value])||((_=(x=c.cacheSegData)==null?void 0:x.subAttribute)==null?void 0:_[r.value])}}))},renderSegmentTools=[{toolName:"LassoSelector",commonSvg:lassoSelector,selectedSvg:lassoSelector_a},{toolName:"RectSelector",commonSvg:icon_rect,selectedSvg:icon_rect_a},{toolName:"CircleSelector",commonSvg:circleSelector,selectedSvg:circleSelector_a}],PointCloudSegToolIcon=({toolInstance:t})=>{const{ptSegmentInstance:e}=React.useContext(PointCloudContext.PointCloudContext),[n,s]=React.useState("LassoSelector"),{t:i}=reactI18next.useTranslation();return React.useEffect(()=>{if(!e)return;const o=()=>{s("LassoSelector")},u=()=>{s("RectSelector")},c=()=>{s("CircleSelector")};return e.on("LassoSelector",o),e.on("RectSelector",u),e.on("CircleSelector",c),()=>{e.unbind("LassoSelector",o),e.unbind("RectSelector",u),e.unbind("CircleSelector",c)}},[e]),React__default.default.createElement("div",{className:`${index$7.sidebarCls}__level`},renderSegmentTools.map(o=>{const u=n===o.toolName;return React__default.default.createElement("span",{className:`${index$7.sidebarCls}__toolOption`,key:o.toolName,onClick:()=>e==null?void 0:e.emit(o.toolName)},React__default.default.createElement("img",{className:`${index$7.sidebarCls}__singleTool`,src:u?o==null?void 0:o.selectedSvg:o==null?void 0:o.commonSvg}),React__default.default.createElement("span",{className:index.classnames({[`${index$7.sidebarCls}__toolOption__selected`]:u})},i(o.toolName)))}))},PointCloudToolSidebar=({stepInfo:t,toolInstance:e,imgList:n,imgIndex:s,stepList:i,enableColorPicker:o})=>{var u,c;const{updatePointCloudPattern:v,pointCloudPattern:m,isPointCloudSegmentationPattern:a}=useStatus.useStatus(),l=index.jsonParser(t.config),S=(u=l==null?void 0:l.attributeList)!=null?u:[],d=(l==null?void 0:l.secondaryAttributeConfigurable)===!0?(c=l==null?void 0:l.inputList)!=null?c:[]:[];return a?React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegToolIcon,{toolInstance:e}),React__default.default.createElement(AttributeUpdater,{toolInstance:e,attributeList:S,subAttributeList:d,config:l,stepList:i,stepInfo:t,enableColorPicker:o})):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ToolIcons.ToolIcons,{toolName:lbAnnotation.cTool.EPointCloudName.PointCloud,selectedToolName:m,onChange:p=>v==null?void 0:v(p)}),React__default.default.createElement(AttributeUpdater,{toolInstance:e,attributeList:S,subAttributeList:d,config:l,stepList:i,stepInfo:t,enableColorPicker:o}),(l==null?void 0:l.trackConfigurable)===!0&&m===ToolType.EToolName.Rect&&React__default.default.createElement("div",{style:{flexShrink:0,height:280,overflow:"auto"}},React__default.default.createElement(BoxTrackIDInput,null),React__default.default.createElement(antd.Divider,{style:{margin:0}}),React__default.default.createElement(index$1,{imgList:n,imgIndex:s}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),React__default.default.createElement(index$2.default,{imgList:n,imgIndex:s}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),React__default.default.createElement(index$3,null)))},mapStateToProps=t=>{var e,n,s,i;const o=StepUtils.getCurrentStepInfo((e=t.annotation)==null?void 0:e.step,(n=t.annotation)==null?void 0:n.stepList),u=(s=t.annotation)==null?void 0:s.toolInstance,c=(i=t.annotation)==null?void 0:i.stepList;return{stepInfo:o,toolInstance:u,imgList:t.annotation.imgList,imgIndex:t.annotation.imgIndex,stepList:c}};var PointCloudToolSidebar$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudToolSidebar);exports.PointCloudSegToolIcon=PointCloudSegToolIcon,exports.default=PointCloudToolSidebar$1;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),icons=require("@ant-design/icons"),ToolIcons=require("../ToolIcons.js"),ToolType=require("../../../../data/enums/ToolType.js"),lbAnnotation=require("@labelbee/lb-annotation"),PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),antd=require("antd"),StepUtils=require("../../../../utils/StepUtils.js"),reactRedux=require("react-redux"),index=require("../../../../utils/index.js"),useStatus=require("../../../../components/pointCloudView/hooks/useStatus.js"),useSingleBox=require("../../../../components/pointCloudView/hooks/useSingleBox.js"),reactI18next=require("react-i18next"),ctx=require("../../../../store/ctx.js"),index$4=require("./components/batchUpdateModal/index.js"),index$1=require("./components/annotatedBox/index.js"),index$3=require("./components/rectRotateSensitivitySlider/index.js"),index$2=require("./components/findTrackIDIndex/index.js"),lbUtils=require("@labelbee/lb-utils"),index$5=require("../../../../components/attributeList/index.js"),useAttribute=require("../../../../components/pointCloudView/hooks/useAttribute.js"),lassoSelector=require("../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js"),lassoSelector_a=require("../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js"),circleSelector=require("../../../../assets/annotation/pointCloudTool/circleSelector.svg.js"),circleSelector_a=require("../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js"),icon_rect=require("../../../../assets/annotation/rectTool/icon_rect.svg.js"),icon_rect_a=require("../../../../assets/annotation/rectTool/icon_rect_a.svg.js"),index$7=require("../index.js"),actionCreators=require("../../../../store/annotation/actionCreators.js"),usePointCloudViews=require("../../../../components/pointCloudView/hooks/usePointCloudViews.js"),index$6=require("../../../../components/subAttributeList/index.js"),DynamicResizer=require("../../../../components/DynamicResizer/DynamicResizer.js");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 BoxTrackIDInput=()=>{const[e,t]=React.useState(!1),n=React.useContext(PointCloudContext.PointCloudContext),{pointCloudBoxList:i}=n,{selectedBox:s,updateSelectedBox:o}=useSingleBox.useSingleBox(),[u,c]=React.useState(""),{t:p}=reactI18next.useTranslation(),m=s==null?void 0:s.info.trackID,a=d=>!!i.find(S=>S.trackID===d&&S.id!==(s==null?void 0:s.info.id)),r=(d=!1)=>{const v=parseInt(u,10);if(d&&t(!1),isNaN(v)){antd.message.error(p("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){antd.message.error(p("NotAllowDecimalPointsInTrackID"));return}if(a(v)){antd.message.error(p("DuplicateTrackIDsExist"));return}if(!(v>0)){antd.message.error(p("PositiveIntegerCheck"));return}g(v)};React.useEffect(()=>{t(!1)},[m]);const g=d=>{var v;const S=o({trackID:d});(v=n==null?void 0:n.topViewInstance)==null||v.updatePolygonList(S!=null?S:[])};return React__default.default.createElement("div",{style:{padding:24}},React__default.default.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},React__default.default.createElement("span",null,p("CurrentBoxTrackIDs")),m&&React__default.default.createElement(index$4,{id:m,updateCurrentPolygonList:d=>g(d)})),React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"12px"}},e&&m?React__default.default.createElement(antd.Input,{defaultValue:m,onChange:d=>{c(d.target.value)},disabled:!m,size:"small",onBlur:()=>{r()},onPressEnter:()=>{r(!0)}}):React__default.default.createElement("span",null,m),React__default.default.createElement(icons.EditFilled,{style:{color:"#999",marginLeft:16,cursor:typeof m!="undefined"?"pointer":"not-allowed"},onClick:()=>{m&&t(!e)}})))},isAllowUpdateInSegment=({segmentStatus:e,globalPattern:t})=>t===lbUtils.EPointCloudPattern.Segmentation&&![lbUtils.EPointCloudSegmentStatus.Edit,lbUtils.EPointCloudSegmentStatus.Ready].includes(e),AttributeUpdater=({attributeList:e,subAttributeList:t,toolInstance:n,config:i,stepList:s,stepInfo:o,enableColorPicker:u})=>{const[c,p]=React.useState({segmentStatus:lbUtils.EPointCloudSegmentStatus.Ready}),{selectedBox:m}=useSingleBox.useSingleBox(),a=React.useContext(PointCloudContext.PointCloudContext),{ptSegmentInstance:r}=a,{t:g}=reactI18next.useTranslation(),{defaultAttribute:d}=useAttribute.useAttribute(),v=usePointCloudViews.usePointCloudViews(),{isPointCloudSegmentationPattern:S}=useStatus.useStatus(),T=ctx.useDispatch(),w={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};React.useEffect(()=>{if(!!r)return r.on("syncPointCloudStatus",p),()=>{r.unbind("syncPointCloudStatus",p)}},[r]);const j=(l,C)=>{var b,x,_,E,y;const P=(b=i==null?void 0:i.attributeList)==null?void 0:b.map(f=>f.value===l?__spreadProps(__spreadValues({},f),{color:C}):f),D=__spreadProps(__spreadValues({},i),{attributeList:P}),A=JSON.stringify(D),B=s==null?void 0:s.map(f=>(f==null?void 0:f.step)===(o==null?void 0:o.step)?__spreadProps(__spreadValues({},f),{config:A}):f);(x=a==null?void 0:a.topViewInstance)==null||x.updateAttributeList(P),(_=a==null?void 0:a.sideViewInstance)==null||_.updateAttributeList(P),(E=a==null?void 0:a.backViewInstance)==null||E.updateAttributeList(P),(y=a==null?void 0:a.mainViewInstance)==null||y.setConfig(D),T(actionCreators.SetTaskStepList({stepList:B}))},I=l=>{v.updateViewsByDefaultSize&&v.updateViewsByDefaultSize(l)},q=l=>{isAllowUpdateInSegment({globalPattern:a.globalPattern,segmentStatus:c.segmentStatus})||n.setDefaultAttribute(l)},L=(l,C)=>{isAllowUpdateInSegment({globalPattern:a.globalPattern,segmentStatus:c.segmentStatus})||n.setSubAttribute(l,C)},h=e.map(l=>({label:l.key,value:l.value,color:l==null?void 0:l.color,limit:l==null?void 0:l.limit,isDefault:l==null?void 0:l.isDefault})),k=m||c.cacheSegData&&c.segmentStatus===lbUtils.EPointCloudSegmentStatus.Edit,V=S;return React__default.default.createElement("div",{style:{height:"100%",overflow:"auto",display:"flex",flexDirection:"column"}},React__default.default.createElement("div",{style:w},g("Attribute")),React__default.default.createElement("div",{style:{height:0,flex:1,overflowY:"auto",overflowX:"hidden"}},React__default.default.createElement(index$5.default,{list:h,forbidDefault:!0,selectedAttribute:d!=null?d:"",attributeChanged:l=>q(l),updateColorConfig:j,enableColorPicker:u,updateSize:I,forbidShowLimitPopover:V}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),k&&React__default.default.createElement(index$6,{subAttributeList:t,setSubAttribute:L,getValue:l=>{var C,b,x,_;return((b=(C=a.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:b[l.value])||((_=(x=c.cacheSegData)==null?void 0:x.subAttribute)==null?void 0:_[l.value])}})))},renderSegmentTools=[{toolName:"LassoSelector",commonSvg:lassoSelector,selectedSvg:lassoSelector_a},{toolName:"RectSelector",commonSvg:icon_rect,selectedSvg:icon_rect_a},{toolName:"CircleSelector",commonSvg:circleSelector,selectedSvg:circleSelector_a}],PointCloudSegToolIcon=({toolInstance:e})=>{const{ptSegmentInstance:t}=React.useContext(PointCloudContext.PointCloudContext),[n,i]=React.useState("LassoSelector"),{t:s}=reactI18next.useTranslation();return React.useEffect(()=>{if(!t)return;const o=()=>{i("LassoSelector")},u=()=>{i("RectSelector")},c=()=>{i("CircleSelector")};return t.on("LassoSelector",o),t.on("RectSelector",u),t.on("CircleSelector",c),()=>{t.unbind("LassoSelector",o),t.unbind("RectSelector",u),t.unbind("CircleSelector",c)}},[t]),React__default.default.createElement("div",{className:`${index$7.sidebarCls}__level`},renderSegmentTools.map(o=>{const u=n===o.toolName;return React__default.default.createElement("span",{className:`${index$7.sidebarCls}__toolOption`,key:o.toolName,onClick:()=>t==null?void 0:t.emit(o.toolName)},React__default.default.createElement("img",{className:`${index$7.sidebarCls}__singleTool`,src:u?o==null?void 0:o.selectedSvg:o==null?void 0:o.commonSvg}),React__default.default.createElement("span",{className:index.classnames({[`${index$7.sidebarCls}__toolOption__selected`]:u})},s(o.toolName)))}))},PointCloudToolSidebar=({stepInfo:e,toolInstance:t,imgList:n,imgIndex:i,stepList:s,enableColorPicker:o})=>{var u,c;const{updatePointCloudPattern:p,pointCloudPattern:m,isPointCloudSegmentationPattern:a}=useStatus.useStatus(),r=index.jsonParser(e.config),g=(u=r==null?void 0:r.attributeList)!=null?u:[],d=(r==null?void 0:r.secondaryAttributeConfigurable)===!0?(c=r==null?void 0:r.inputList)!=null?c:[]:[];return a?React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegToolIcon,{toolInstance:t}),React__default.default.createElement(AttributeUpdater,{toolInstance:t,attributeList:g,subAttributeList:d,config:r,stepList:s,stepInfo:e,enableColorPicker:o})):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ToolIcons.ToolIcons,{toolName:lbAnnotation.cTool.EPointCloudName.PointCloud,selectedToolName:m,onChange:v=>p==null?void 0:p(v)}),React__default.default.createElement("div",{style:{flex:1,overflow:"hidden"}},React__default.default.createElement(DynamicResizer,{minTopHeight:42,defaultHeight:100,localKey:"id:"+(e==null?void 0:e.id)+"taskID:"+(e==null?void 0:e.taskID)+"step:"+(e==null?void 0:e.step)+"type:"+(e==null?void 0:e.type)},React__default.default.createElement(AttributeUpdater,{toolInstance:t,attributeList:g,subAttributeList:d,config:r,stepList:s,stepInfo:e,enableColorPicker:o}),(r==null?void 0:r.trackConfigurable)===!0&&m===ToolType.EToolName.Rect?React__default.default.createElement("div",{style:{height:"100%",overflow:"auto"}},React__default.default.createElement(BoxTrackIDInput,null),React__default.default.createElement(antd.Divider,{style:{margin:0}}),React__default.default.createElement(index$1,{imgList:n,imgIndex:i}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),React__default.default.createElement(index$2.default,{imgList:n,imgIndex:i}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),React__default.default.createElement(index$3,null)):React__default.default.createElement("div",null))))},mapStateToProps=e=>{var t,n,i,s;const o=StepUtils.getCurrentStepInfo((t=e.annotation)==null?void 0:t.step,(n=e.annotation)==null?void 0:n.stepList),u=(i=e.annotation)==null?void 0:i.toolInstance,c=(s=e.annotation)==null?void 0:s.stepList;return{stepInfo:o,toolInstance:u,imgList:e.annotation.imgList,imgIndex:e.annotation.imgIndex,stepList:c}};var PointCloudToolSidebar$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudToolSidebar);exports.PointCloudSegToolIcon=PointCloudSegToolIcon,exports.default=PointCloudToolSidebar$1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e,{useRef as u}from"react";import f from"./hooks/useDrag.js";const g=i=>{const{minTopHeight:s=0,minBottomHeight:a=0,defaultHeight:o=50,axis:c="y",children:t,localKey:n="dynamicResizerHeights",customDivider:m}=i,r=u(null),{rendered:l,topStyle:d,bottomStyle:y}=f({containerRef:r,minTopHeight:s,minBottomHeight:a,defaultHeight:o,axis:c,localKey:n,customDivider:m});return e.createElement("div",{className:"dynamic-resizer-content",ref:r},e.createElement("div",{className:"dynamic-resizer-top",style:d},t[0]),l,e.createElement("div",{className:"dynamic-resizer-bottom",style:y},t[1]))};export{g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"react";var t="data:image/svg+xml,%3csvg t='1720421473527' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='5364' width='200' height='200'%3e %3cpath d='M94.8 304.5L512 721.8l416-416-833.2-1.3z m0 0' p-id='5365'%3e%3c/path%3e%3c/svg%3e";export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"react";var t="data:image/svg+xml,%3csvg t='1720421409111' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='5202' width='200' height='200'%3e %3cpath d='M928 721.8L510.8 304.5l-416 416 833.2 1.3z m0 0' p-id='5203'%3e%3c/path%3e%3c/svg%3e";export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o,{useCallback as r,useMemo as E}from"react";import y from"react-draggable";import{useLocalStorageState as L}from"ahooks";import k from"./useUpdateHeight.js";import N from"../assets/topToZero.svg.js";import Z from"../assets/bottomToZero.svg.js";const j=y,C=({containerRef:e,minTopHeight:p=0,minBottomHeight:u=0,defaultHeight:h=50,axis:a,localKey:b})=>{const s=b||"dynamicResizerHeights",{topHeight:i,position:l,bounds:c,topStyle:v,bottomStyle:H,updateELHeight:d,setTopHeightToZero:S,setBottomHeightToZero:f}=k(e,p,u,h,s),[P,g]=L(s),T=r(()=>{e.current&&e.current.classList.add("hide-scrollbar")},[e]),m=r((t,D)=>{t.stopPropagation(),d(D.y)},[d]),n=r(t=>{t.stopPropagation(),e.current&&e.current.classList.remove("hide-scrollbar"),g(i)},[e,g,i]);return{rendered:E(()=>{const t=o.createElement("div",{className:"divider"},o.createElement("img",{src:N,className:"divider-top",draggable:"false",onClick:S}),o.createElement("div",{className:"divider-icon",draggable:"false"}),o.createElement("img",{src:Z,className:"divider-bottom",draggable:"false",onClick:f}));return o.createElement(j,{axis:a,position:l,handle:".divider",onStart:T,onDrag:m,onStop:n,bounds:c},t)},[a,l,m,n,c]),topStyle:v,bottomStyle:H}};export{C as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useState as g,useEffect as y,useMemo as r,useCallback as k}from"react";import{useLocalStorageState as E}from"ahooks";const z=(o,n,m,v,f)=>{const[i,T]=g(0),[H,b]=g(0),[l,M]=g(0),[h,_]=g(0),[x,p]=E(f);y(()=>{Z();const t=x;let e=0;t!=null?e=isNaN(Number(t))?0:Number(t):e=i||v,u(e)},[]);const B=r(()=>({x:0,y:i}),[i]),L=r(()=>{var t;return{top:l,bottom:(((t=o.current)==null?void 0:t.offsetHeight)||0)-h}},[i,o]),S=r(()=>({height:i+"px"}),[i]),N=r(()=>({height:H+"px"}),[H]),Z=()=>{var t,e,s,c;if(o){let a=n,d=m;n>=(((t=o.current)==null?void 0:t.offsetHeight)||0)/2&&(a=(((e=o.current)==null?void 0:e.offsetHeight)||0)/2),m>=(((s=o.current)==null?void 0:s.offsetHeight)||0)/2&&(d=(((c=o.current)==null?void 0:c.offsetHeight)||0)/2),M(a||1e-5),_(d)}},u=k(t=>{var e;if(o){const s=((e=o==null?void 0:o.current)==null?void 0:e.offsetHeight)||0,c=s-h;t>=l&&t<=c&&(T(t),b(s-t))}},[o,l,h]);return{topHeight:i,bottomHeight:H,position:B,bounds:L,topStyle:S,bottomStyle:N,updateELHeight:u,setBottomHeightToZero:()=>{var t;if(o){const e=((t=o==null?void 0:o.current)==null?void 0:t.offsetHeight)||0;u(e-h||0),p(e-h||0)}},setTopHeightToZero:()=>{o&&(u(l||0),p(l||0))}}};export{z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./DynamicResizer.js";export{default}from"./DynamicResizer.js";
|
package/es/index.css
CHANGED
|
@@ -63,6 +63,77 @@
|
|
|
63
63
|
justify-content: space-between;
|
|
64
64
|
margin-top: 16px;
|
|
65
65
|
}
|
|
66
|
+
.dynamic-resizer-content {
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 100%;
|
|
69
|
+
flex-shrink: 0;
|
|
70
|
+
flex-grow: 0;
|
|
71
|
+
position: relative;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.divider {
|
|
75
|
+
height: 10px;
|
|
76
|
+
width: 100%;
|
|
77
|
+
position: absolute;
|
|
78
|
+
top: -5px;
|
|
79
|
+
left: 0;
|
|
80
|
+
cursor: row-resize;
|
|
81
|
+
user-select: none;
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.divider:hover .divider-top, .divider:hover .divider-bottom {
|
|
89
|
+
display: block;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.divider-top,
|
|
93
|
+
.divider-bottom {
|
|
94
|
+
width: 20px;
|
|
95
|
+
height: 20px;
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
display: none;
|
|
98
|
+
user-select: none;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.divider-icon {
|
|
102
|
+
width: 100%;
|
|
103
|
+
height: 20px;
|
|
104
|
+
position: relative;
|
|
105
|
+
}
|
|
106
|
+
.divider-icon::after {
|
|
107
|
+
content: "";
|
|
108
|
+
display: block;
|
|
109
|
+
position: absolute;
|
|
110
|
+
top: 50%;
|
|
111
|
+
left: 0;
|
|
112
|
+
right: 0;
|
|
113
|
+
width: 90%;
|
|
114
|
+
height: 1px;
|
|
115
|
+
background: #ccc;
|
|
116
|
+
margin: 0 auto;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.dynamic-resizer-top {
|
|
120
|
+
width: 100%;
|
|
121
|
+
overflow-y: auto;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.dynamic-resizer-bottom {
|
|
125
|
+
width: 100%;
|
|
126
|
+
overflow-y: auto;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.hide-scrollbar * {
|
|
130
|
+
scrollbar-width: none; /* Firefox */
|
|
131
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.hide-scrollbar *::-webkit-scrollbar {
|
|
135
|
+
display: none; /* Chrome, Safari, Opera */
|
|
136
|
+
}
|
|
66
137
|
.index-module_latexEditor__0fK8G {
|
|
67
138
|
line-height: 32px;
|
|
68
139
|
background-color: #ededed;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useState as
|
|
1
|
+
import e,{useState as P,useContext as j,useEffect as I}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 rt}from"@labelbee/lb-annotation";import{PointCloudContext as h}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as w,Input as it,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{EPointCloudSegmentStatus as L,EPointCloudPattern as St}from"@labelbee/lb-utils";import bt from"../../../../components/attributeList/index.js";import{useAttribute as Ct}from"../../../../components/pointCloudView/hooks/useAttribute.js";import _t from"../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js";import yt from"../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js";import Et from"../../../../assets/annotation/pointCloudTool/circleSelector.svg.js";import xt from"../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js";import Pt from"../../../../assets/annotation/rectTool/icon_rect.svg.js";import wt from"../../../../assets/annotation/rectTool/icon_rect_a.svg.js";import{sidebarCls as T}from"../index.js";import{SetTaskStepList as Dt}from"../../../../store/annotation/actionCreators.js";import{usePointCloudViews as Lt}from"../../../../components/pointCloudView/hooks/usePointCloudViews.js";import Tt from"../../../../components/subAttributeList/index.js";import jt from"../../../../components/DynamicResizer/DynamicResizer.js";var It=Object.defineProperty,ht=Object.defineProperties,kt=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,Vt=Object.prototype.propertyIsEnumerable,U=(o,t,n)=>t in o?It(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,A=(o,t)=>{for(var n in t||(t={}))At.call(t,n)&&U(o,n,t[n]);if(z)for(var n of z(t))Vt.call(t,n)&&U(o,n,t[n]);return o},V=(o,t)=>ht(o,kt(t));const Bt=()=>{const[o,t]=P(!1),n=j(h),{pointCloudBoxList:a}=n,{selectedBox:c,updateSelectedBox:l}=$(),[u,m]=P(""),{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)),i=(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)};I(()=>{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:[])};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(it,{defaultValue:p,onChange:d=>{m(d.target.value)},disabled:!p,size:"small",onBlur:()=>{i()},onPressEnter:()=>{i(!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)}})))},F=({segmentStatus:o,globalPattern:t})=>t===St.Segmentation&&![L.Edit,L.Ready].includes(o),H=({attributeList:o,subAttributeList:t,toolInstance:n,config:a,stepList:c,stepInfo:l,enableColorPicker:u})=>{const[m,v]=P({segmentStatus:L.Ready}),{selectedBox:p}=$(),s=j(h),{ptSegmentInstance:i}=s,{t:S}=k(),{defaultAttribute:d}=Ct(),f=Lt(),{isPointCloudSegmentationPattern:b}=R(),W=dt(),J={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};I(()=>{if(!!i)return i.on("syncPointCloudStatus",v),()=>{i.unbind("syncPointCloudStatus",v)}},[i]);const K=(r,C)=>{var _,y,E,B,N;const x=(_=a==null?void 0:a.attributeList)==null?void 0:_.map(g=>g.value===r?V(A({},g),{color:C}):g),O=V(A({},a),{attributeList:x}),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(A({},g),{config:tt}):g);(y=s==null?void 0:s.topViewInstance)==null||y.updateAttributeList(x),(E=s==null?void 0:s.sideViewInstance)==null||E.updateAttributeList(x),(B=s==null?void 0:s.backViewInstance)==null||B.updateAttributeList(x),(N=s==null?void 0:s.mainViewInstance)==null||N.setConfig(O),W(Dt({stepList:et}))},X=r=>{f.updateViewsByDefaultSize&&f.updateViewsByDefaultSize(r)},Y=r=>{F({globalPattern:s.globalPattern,segmentStatus:m.segmentStatus})||n.setDefaultAttribute(r)},q=(r,C)=>{F({globalPattern:s.globalPattern,segmentStatus:m.segmentStatus})||n.setSubAttribute(r,C)},G=o.map(r=>({label:r.key,value:r.value,color:r==null?void 0:r.color,limit:r==null?void 0:r.limit,isDefault:r==null?void 0:r.isDefault})),Q=p||m.cacheSegData&&m.segmentStatus===L.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(bt,{list:G,forbidDefault:!0,selectedAttribute:d!=null?d:"",attributeChanged:r=>Y(r),updateColorConfig:K,enableColorPicker:u,updateSize:X,forbidShowLimitPopover:Z}),e.createElement(w,{style:{margin:0}}),Q&&e.createElement(Tt,{subAttributeList:t,setSubAttribute:q,getValue:r=>{var C,_,y,E;return((_=(C=s.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:_[r.value])||((E=(y=m.cacheSegData)==null?void 0:y.subAttribute)==null?void 0:E[r.value])}})))},Nt=[{toolName:"LassoSelector",commonSvg:_t,selectedSvg:yt},{toolName:"RectSelector",commonSvg:Pt,selectedSvg:wt},{toolName:"CircleSelector",commonSvg:Et,selectedSvg:xt}],M=({toolInstance:o})=>{const{ptSegmentInstance:t}=j(h),[n,a]=P("LassoSelector"),{t:c}=k();return I(()=>{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:`${T}__level`},Nt.map(l=>{const u=n===l.toolName;return e.createElement("span",{className:`${T}__toolOption`,key:l.toolName,onClick:()=>t==null?void 0:t.emit(l.toolName)},e.createElement("img",{className:`${T}__singleTool`,src:u?l==null?void 0:l.selectedSvg:l==null?void 0:l.commonSvg}),e.createElement("span",{className:ut({[`${T}__toolOption__selected`]:u})},c(l.toolName)))}))},Ot=({stepInfo:o,toolInstance:t,imgList:n,imgIndex:a,stepList:c,enableColorPicker:l})=>{var u,m;const{updatePointCloudPattern:v,pointCloudPattern:p,isPointCloudSegmentationPattern:s}=R(),i=ct(o.config),S=(u=i==null?void 0:i.attributeList)!=null?u:[],d=(i==null?void 0:i.secondaryAttributeConfigurable)===!0?(m=i==null?void 0:i.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:i,stepList:c,stepInfo:o,enableColorPicker:l})):e.createElement(e.Fragment,null,e.createElement(nt,{toolName:rt.EPointCloudName.PointCloud,selectedToolName:p,onChange:f=>v==null?void 0:v(f)}),e.createElement("div",{style:{flex:1,overflow:"hidden"}},e.createElement(jt,{minTopHeight:42,defaultHeight:100,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:i,stepList:c,stepInfo:o,enableColorPicker:l}),(i==null?void 0:i.trackConfigurable)===!0&&p===lt.Rect?e.createElement("div",{style:{height:"100%",overflow:"auto"}},e.createElement(Bt,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)):e.createElement("div",null))))},Rt=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 $t=at(Rt,null,null,{context:mt})(Ot);export{M as PointCloudSegToolIcon,$t 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.72",
|
|
4
4
|
"description": "Provide a complete library of annotation components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"es": "./es/index.js",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"postcss-url": "^10.1.3",
|
|
58
58
|
"re-resizable": "^6.9.9",
|
|
59
59
|
"react-colorful": "^5.6.1",
|
|
60
|
+
"react-draggable": "^4.4.6",
|
|
60
61
|
"react-i18next": "^11.12.0",
|
|
61
62
|
"react-markdown": "^8.0.7",
|
|
62
63
|
"react-redux": "^7.2.3",
|