@labelbee/lb-components 1.23.0-alpha.2 → 1.23.0-alpha.20
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/App.js +1 -1
- package/dist/assets/annotation/pointCloudTool/leftArrow.svg.js +1 -1
- package/dist/assets/annotation/pointCloudTool/rightArrow.svg.js +1 -1
- package/dist/components/LLMToolView/index.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
- package/dist/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
- package/dist/components/LLMToolView/sidebar/index.js +1 -1
- package/dist/components/LLMToolView/utils/data.js +1 -1
- package/dist/components/NLPToolView/index.js +1 -1
- package/dist/components/NLPToolView/textContent/extraMask.js +1 -1
- package/dist/components/NLPToolView/textContent/index.js +1 -1
- package/dist/components/audioAnnotate/audioSide/clipSidebar/index.js +1 -1
- package/dist/components/audioAnnotate/index.js +1 -1
- package/dist/components/audioPlayer/index.js +1 -1
- package/dist/components/longText/index.js +1 -1
- package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
- package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
- package/dist/components/pointCloudView/PointCloudContext.js +1 -1
- package/dist/components/pointCloudView/hooks/useStatus.js +1 -1
- package/dist/components/pointCloudView/index.js +1 -1
- package/dist/components/subAttributeList/index.js +1 -0
- package/dist/index.css +13 -7
- package/dist/store/Actions.js +1 -1
- package/dist/store/annotation/actionCreators.js +1 -1
- package/dist/store/annotation/reducer.js +1 -1
- package/dist/types/App.d.ts +2 -1
- package/dist/types/components/LLMToolView/utils/data.d.ts +1 -1
- package/dist/types/components/audioAnnotate/audioContext/index.d.ts +1 -1
- package/dist/types/components/audioPlayer/index.d.ts +3 -1
- package/dist/types/components/longText/index.d.ts +1 -0
- package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloudContext.d.ts +6 -1
- package/dist/types/components/subAttributeList/index.d.ts +9 -0
- package/dist/types/store/Actions.d.ts +1 -0
- package/dist/types/store/annotation/actionCreators.d.ts +3 -2
- package/dist/types/store/annotation/reducer.d.ts +1 -0
- package/dist/types/store/annotation/types.d.ts +9 -2
- package/dist/types/utils/index.d.ts +4 -1
- package/dist/utils/index.js +1 -1
- package/dist/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
- package/dist/views/MainView/sidebar/NLPSidebar/NLPAnnotatedList.js +1 -1
- package/dist/views/MainView/sidebar/NLPSidebar/indicatorDetermine.js +1 -1
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/es/App.js +1 -1
- package/es/assets/annotation/pointCloudTool/leftArrow.svg.js +1 -1
- package/es/assets/annotation/pointCloudTool/rightArrow.svg.js +1 -1
- package/es/components/LLMToolView/index.js +1 -1
- package/es/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
- package/es/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -1
- package/es/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
- package/es/components/LLMToolView/sidebar/index.js +1 -1
- package/es/components/LLMToolView/utils/data.js +1 -1
- package/es/components/NLPToolView/index.js +1 -1
- package/es/components/NLPToolView/textContent/extraMask.js +1 -1
- package/es/components/NLPToolView/textContent/index.js +1 -1
- package/es/components/audioAnnotate/audioSide/clipSidebar/index.js +1 -1
- package/es/components/audioAnnotate/index.js +1 -1
- package/es/components/audioPlayer/index.js +1 -1
- package/es/components/longText/index.js +1 -1
- package/es/components/pointCloud2DRectOperationView/index.js +1 -1
- package/es/components/pointCloudView/PointCloud2DView.js +1 -1
- package/es/components/pointCloudView/PointCloudContext.js +1 -1
- package/es/components/pointCloudView/hooks/useStatus.js +1 -1
- package/es/components/pointCloudView/index.js +1 -1
- package/es/components/subAttributeList/index.js +1 -0
- package/es/index.css +13 -7
- package/es/store/Actions.js +1 -1
- package/es/store/annotation/actionCreators.js +1 -1
- package/es/store/annotation/reducer.js +1 -1
- package/es/utils/index.js +1 -1
- package/es/views/MainView/sidebar/GeneralOperation/ActionsConfirm.js +1 -1
- package/es/views/MainView/sidebar/NLPSidebar/NLPAnnotatedList.js +1 -1
- package/es/views/MainView/sidebar/NLPSidebar/indicatorDetermine.js +1 -1
- package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/package.json +3 -3
|
@@ -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$3=require("./components/batchUpdateModal/index.js"),index$1=require("./components/annotatedBox/index.js"),index$2=require("./components/findTrackIDIndex/index.js"),lbUtils=require("@labelbee/lb-utils"),index$4=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$5=require("../index.js"),actionCreators=require("../../../../store/annotation/actionCreators.js"),usePointCloudViews=require("../../../../components/pointCloudView/hooks/usePointCloudViews.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,o)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,__spreadValues=(t,e)=>{for(var o in e||(e={}))__hasOwnProp.call(e,o)&&__defNormalProp(t,o,e[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(e))__propIsEnum.call(e,o)&&__defNormalProp(t,o,e[o]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const BoxTrackIDInput=()=>{const[t,e]=React.useState(!1),o=React.useContext(PointCloudContext.PointCloudContext),{pointCloudBoxList:s}=o,{selectedBox:u,updateSelectedBox:l}=useSingleBox.useSingleBox(),[c,i]=React.useState(""),{t:f}=reactI18next.useTranslation(),v=u==null?void 0:u.info.trackID,r=d=>!!s.find(C=>C.trackID===d&&C.id!==(u==null?void 0:u.info.id)),a=(d=!1)=>{const m=parseInt(c,10);if(d&&e(!1),isNaN(m)){antd.message.error(f("PositiveIntegerCheck"));return}if(c.indexOf(".")>-1){antd.message.error(f("NotAllowDecimalPointsInTrackID"));return}if(r(m)){antd.message.error(f("DuplicateTrackIDsExist"));return}if(!(m>0)){antd.message.error(f("PositiveIntegerCheck"));return}S(m)};React.useEffect(()=>{e(!1)},[v]);const S=d=>{var m;const C=l({trackID:d});(m=o==null?void 0:o.topViewInstance)==null||m.updatePolygonList(C!=null?C:[])};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,f("CurrentBoxTrackIDs")),v&&React__default.default.createElement(index$3,{id:v,updateCurrentPolygonList:d=>S(d)})),React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"12px"}},t&&v?React__default.default.createElement(antd.Input,{defaultValue:v,onChange:d=>{i(d.target.value)},disabled:!v,size:"small",onBlur:()=>{a()},onPressEnter:()=>{a(!0)}}):React__default.default.createElement("span",null,v),React__default.default.createElement(icons.EditFilled,{style:{color:"#999",marginLeft:16,cursor:typeof v!="undefined"?"pointer":"not-allowed"},onClick:()=>{v&&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:o,config:s,stepList:u,stepInfo:l,enableColorPicker:c})=>{const[i,f]=React.useState({segmentStatus:lbUtils.EPointCloudSegmentStatus.Ready}),{selectedBox:v}=useSingleBox.useSingleBox(),r=React.useContext(PointCloudContext.PointCloudContext),{ptSegmentInstance:a}=r,{t:S}=reactI18next.useTranslation(),{defaultAttribute:d}=useAttribute.useAttribute(),m=usePointCloudViews.usePointCloudViews(),{isPointCloudSegmentationPattern:C}=useStatus.useStatus(),h=ctx.useDispatch(),j={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"},L={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"};React.useEffect(()=>{if(!!a)return a.on("syncPointCloudStatus",f),()=>{a.unbind("syncPointCloudStatus",f)}},[a]);const q=(n,_)=>{var b,P,E,y,I;const x=(b=s==null?void 0:s.attributeList)==null?void 0:b.map(g=>g.value===n?__spreadProps(__spreadValues({},g),{color:_}):g),T=__spreadProps(__spreadValues({},s),{attributeList:x}),w=JSON.stringify(T),p=u==null?void 0:u.map(g=>(g==null?void 0:g.step)===(l==null?void 0:l.step)?__spreadProps(__spreadValues({},g),{config:w}):g);(P=r==null?void 0:r.topViewInstance)==null||P.updateAttributeList(x),(E=r==null?void 0:r.sideViewInstance)==null||E.updateAttributeList(x),(y=r==null?void 0:r.backViewInstance)==null||y.updateAttributeList(x),(I=r==null?void 0:r.mainViewInstance)==null||I.setConfig(T),h(actionCreators.SetTaskStepList({stepList:p}))},k=n=>{m.updateViewsByDefaultSize&&m.updateViewsByDefaultSize(n)},B=n=>{isAllowUpdateInSegment({globalPattern:r.globalPattern,segmentStatus:i.segmentStatus})||o.setDefaultAttribute(n)},D=(n,_)=>{isAllowUpdateInSegment({globalPattern:r.globalPattern,segmentStatus:i.segmentStatus})||o.setSubAttribute(n,_)},V=t.map(n=>({label:n.key,value:n.value,color:n==null?void 0:n.color,limit:n==null?void 0:n.limit,isDefault:n==null?void 0:n.isDefault})),N=v||i.cacheSegData&&i.segmentStatus===lbUtils.EPointCloudSegmentStatus.Edit,O=C;return React__default.default.createElement("div",{style:{flex:1,overflowX:"hidden",overflowY:"auto"}},React__default.default.createElement("div",{style:j},S("Attribute")),React__default.default.createElement(index$4.default,{list:V,forbidDefault:!0,selectedAttribute:d!=null?d:"",attributeChanged:n=>B(n),updateColorConfig:q,enableColorPicker:c,updateSize:k,forbidShowLimitPopover:O}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),N&&React__default.default.createElement(React__default.default.Fragment,null,e.map(n=>{var _,b,P,E,y,I,x,T,w;return(n==null?void 0:n.subSelected)&&React__default.default.createElement("div",{style:{marginTop:12},key:n.value},React__default.default.createElement("div",{style:L},S("SubAttribute"),"-",n.key),((_=n.subSelected)==null?void 0:_.length)<5?React__default.default.createElement(index$4.default,{list:n.subSelected.map(p=>({label:p.key,value:p.value})),selectedAttribute:((P=(b=r.selectedPointCloudBox)==null?void 0:b.subAttribute)==null?void 0:P[n.value])||((y=(E=i.cacheSegData)==null?void 0:E.subAttribute)==null?void 0:y[n.value]),num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:p=>D(n.value,p),style:{marginBottom:12}}):React__default.default.createElement(antd.Select,{style:{margin:"0px 21px 17px 16px",width:"87%"},value:((x=(I=r.selectedPointCloudBox)==null?void 0:I.subAttribute)==null?void 0:x[n.value])||((w=(T=i.cacheSegData)==null?void 0:T.subAttribute)==null?void 0:w[n.value]),placeholder:S("PleaseSelect"),onChange:p=>D(n.value,p),allowClear:!0},n.subSelected.map(p=>React__default.default.createElement(antd.Select.Option,{key:p.value,value:p.value},p.key))),React__default.default.createElement(antd.Divider,{style:{margin:0}}))})))},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),[o,s]=React.useState("LassoSelector"),{t:u}=reactI18next.useTranslation();return React.useEffect(()=>{if(!e)return;const l=()=>{s("LassoSelector")},c=()=>{s("RectSelector")},i=()=>{s("CircleSelector")};return e.on("LassoSelector",l),e.on("RectSelector",c),e.on("CircleSelector",i),()=>{e.unbind("LassoSelector",l),e.unbind("RectSelector",c),e.unbind("CircleSelector",i)}},[e]),React__default.default.createElement("div",{className:`${index$5.sidebarCls}__level`},renderSegmentTools.map(l=>{const c=o===l.toolName;return React__default.default.createElement("span",{className:`${index$5.sidebarCls}__toolOption`,key:l.toolName,onClick:()=>e==null?void 0:e.emit(l.toolName)},React__default.default.createElement("img",{className:`${index$5.sidebarCls}__singleTool`,src:c?l==null?void 0:l.selectedSvg:l==null?void 0:l.commonSvg}),React__default.default.createElement("span",{className:index.classnames({[`${index$5.sidebarCls}__toolOption__selected`]:c})},u(l.toolName)))}))},PointCloudToolSidebar=({stepInfo:t,toolInstance:e,imgList:o,imgIndex:s,stepList:u,enableColorPicker:l})=>{var c,i;const{updatePointCloudPattern:f,pointCloudPattern:v,isPointCloudSegmentationPattern:r}=useStatus.useStatus(),a=index.jsonParser(t.config),S=(c=a==null?void 0:a.attributeList)!=null?c:[],d=(a==null?void 0:a.secondaryAttributeConfigurable)===!0?(i=a==null?void 0:a.inputList)!=null?i:[]:[];return r?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:a,stepList:u,stepInfo:t,enableColorPicker:l})):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ToolIcons.ToolIcons,{toolName:lbAnnotation.cTool.EPointCloudName.PointCloud,selectedToolName:v,onChange:m=>f==null?void 0:f(m)}),React__default.default.createElement(AttributeUpdater,{toolInstance:e,attributeList:S,subAttributeList:d,config:a,stepList:u,stepInfo:t,enableColorPicker:l}),(a==null?void 0:a.trackConfigurable)===!0&&v===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:o,imgIndex:s}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),React__default.default.createElement(index$2.default,{imgList:o,imgIndex:s})))},mapStateToProps=t=>{var e,o,s,u;const l=StepUtils.getCurrentStepInfo((e=t.annotation)==null?void 0:e.step,(o=t.annotation)==null?void 0:o.stepList),c=(s=t.annotation)==null?void 0:s.toolInstance,i=(u=t.annotation)==null?void 0:u.stepList;return{stepInfo:l,toolInstance:c,imgList:t.annotation.imgList,imgIndex:t.annotation.imgIndex,stepList:i}};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$3=require("./components/batchUpdateModal/index.js"),index$1=require("./components/annotatedBox/index.js"),index$2=require("./components/findTrackIDIndex/index.js"),lbUtils=require("@labelbee/lb-utils"),index$4=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$6=require("../index.js"),actionCreators=require("../../../../store/annotation/actionCreators.js"),usePointCloudViews=require("../../../../components/pointCloudView/hooks/usePointCloudViews.js"),index$5=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(),p=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 m=parseInt(u,10);if(d&&e(!1),isNaN(m)){antd.message.error(v("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){antd.message.error(v("NotAllowDecimalPointsInTrackID"));return}if(a(m)){antd.message.error(v("DuplicateTrackIDsExist"));return}if(!(m>0)){antd.message.error(v("PositiveIntegerCheck"));return}S(m)};React.useEffect(()=>{e(!1)},[p]);const S=d=>{var m;const g=o({trackID:d});(m=n==null?void 0:n.topViewInstance)==null||m.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")),p&&React__default.default.createElement(index$3,{id:p,updateCurrentPolygonList:d=>S(d)})),React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"12px"}},t&&p?React__default.default.createElement(antd.Input,{defaultValue:p,onChange:d=>{c(d.target.value)},disabled:!p,size:"small",onBlur:()=>{l()},onPressEnter:()=>{l(!0)}}):React__default.default.createElement("span",null,p),React__default.default.createElement(icons.EditFilled,{style:{color:"#999",marginLeft:16,cursor:typeof p!="undefined"?"pointer":"not-allowed"},onClick:()=>{p&&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:p}=useSingleBox.useSingleBox(),a=React.useContext(PointCloudContext.PointCloudContext),{ptSegmentInstance:l}=a,{t:S}=reactI18next.useTranslation(),{defaultAttribute:d}=useAttribute.useAttribute(),m=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}))},L=r=>{m.updateViewsByDefaultSize&&m.updateViewsByDefaultSize(r)},D=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=p||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$4.default,{list:h,forbidDefault:!0,selectedAttribute:d!=null?d:"",attributeChanged:r=>D(r),updateColorConfig:j,enableColorPicker:u,updateSize:L,forbidShowLimitPopover:V}),React__default.default.createElement(antd.Divider,{style:{margin:0}}),k&&React__default.default.createElement(index$5,{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$6.sidebarCls}__level`},renderSegmentTools.map(o=>{const u=n===o.toolName;return React__default.default.createElement("span",{className:`${index$6.sidebarCls}__toolOption`,key:o.toolName,onClick:()=>e==null?void 0:e.emit(o.toolName)},React__default.default.createElement("img",{className:`${index$6.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$6.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:p,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:p,onChange:m=>v==null?void 0:v(m)}),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&&p===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})))},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;
|
package/es/App.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import N from"./views/MainView/index.js";import{i18n as o}from"@labelbee/lb-utils";import O,{useState as M,useEffect as s}from"react";import{connect as U}from"react-redux";import{store as n}from"./index.js";import{LabelBeeContext as z}from"./store/ctx.js";import{ANNOTATION_ACTIONS as j}from"./store/Actions.js";import{InitTaskData as B,InitAnnotationState as R,UpdateInjectFunc as V,loadImgList as k}from"./store/annotation/actionCreators.js";import{LoadFileAndFileData as C}from"./store/annotation/reducer.js";import{ConfigProvider as G}from"antd/es";import $ from"antd/es/locale/zh_CN";import q from"antd/es/locale/en_US";var H=Object.defineProperty,J=Object.defineProperties,K=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,Q=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,w=(e,t,a)=>t in e?H(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,X=(e,t)=>{for(var a in t||(t={}))Q.call(t,a)&&w(e,a,t[a]);if(T)for(var a of T(t))W.call(t,a)&&w(e,a,t[a]);return e},Y=(e,t)=>J(e,K(t));const Z=e=>{const[t,a]=M(0),{imgList:l,step:p=1,stepList:c,onSubmit:d,onSave:g,onPageChange:f,onStepChange:m,initialIndex:u=0,toolInstance:y,setToolInstance:L,getFileData:_,pageSize:h=10,loadFileList:r,defaultLang:P="cn",skipBeforePageTurning:x,beforeRotate:I,checkMode:b=!1,intelligentFit:A=!0,highlightAttribute:S="",preDataProcess:v,getImgIndexByExternal:E}=e;s(()=>{n.dispatch(B({onSubmit:d,stepList:c,step:p,getFileData:_,pageSize:h,loadFileList:r,onSave:g,onPageChange:f,onStepChange:m,skipBeforePageTurning:x,beforeRotate:I,checkMode:b,highlightAttribute:S,preDataProcess:v,getImgIndexByExternal:E})),D(),o.changeLanguage(P);const i=()=>{a(F=>F+1)};return o.on("languageChanged",i),()=>{o.off("languageChanged",i),R(n.dispatch)}},[]),s(()=>{n.dispatch(V({onSubmit:d,stepList:c,getFileData:_,pageSize:h,loadFileList:r,onSave:g,onPageChange:f,onStepChange:m,beforeRotate:I,highlightAttribute:S,preDataProcess:v})),o.changeLanguage(P)},[d,c,_,h,r,g,f,m,P,I,S,v]),s(()=>{L==null||L(y)},[y]),s(()=>{n.dispatch({type:j.SET_STEP,payload:{toStep:p}})},[p]);const D=()=>{r?k(n.dispatch,n.getState,u,!0).then(i=>{i&&n.dispatch(C(u))}):l&&l.length>0&&(n.dispatch({type:j.UPDATE_IMG_LIST,payload:{imgList:l}}),n.dispatch(C(u)))};return O.createElement("div",null,O.createElement(G,{locale:o.language==="en"?q:$},O.createElement(N,Y(X({},e),{intelligentFit:A,checkMode:b}))))},ee=e=>({toolInstance:e.annotation.toolInstance});var te=U(ee,null,null,{context:z})(Z);export{te as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as o from"react";var c;function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a.apply(this,arguments)}var i=function(t){return o.createElement("svg",a({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"
|
|
1
|
+
import*as o from"react";var c;function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a.apply(this,arguments)}var i=function(t){return o.createElement("svg",a({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentcolor","aria-hidden":"true","data-icon":"left",viewBox:"64 64 896 896"},t),c||(c=o.createElement("path",{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 0 0 0 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6"})))};export{i as ReactComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as i from"react";var o;function a(){return a=Object.assign?Object.assign.bind():function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},a.apply(this,arguments)}var c=function(t){return i.createElement("svg",a({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"
|
|
1
|
+
import*as i from"react";var o;function a(){return a=Object.assign?Object.assign.bind():function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},a.apply(this,arguments)}var c=function(t){return i.createElement("svg",a({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentcolor","aria-hidden":"true","data-icon":"right",viewBox:"64 64 896 896"},t),o||(o=i.createElement("path",{d:"M765.7 486.8 314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4"})))};export{c as ReactComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import a,{useContext as N,useState as
|
|
1
|
+
import a,{useContext as N,useState as v,useEffect as u}from"react";import{connect as $}from"react-redux";import{LabelBeeContext as U,LLMContext as B}from"../../store/ctx.js";import{message as K}from"antd";import{ELLMDataType as L,prefix as W}from"../../constant/index.js";import{Layout as z}from"antd/es";import G from"./questionView/index.js";import{useTranslation as H}from"react-i18next";import J from"../../views/MainView/annotationTips/index.js";import{getCurrentResultFromResultList as O}from"./utils/data.js";import{getStepConfig as X}from"../../store/annotation/reducer.js";import{jsonParser as Y}from"../../utils/index.js";import Z from"../messageMaskLayer/index.js";const C=`${W}-LLMView`,ee=g=>{const{annotation:x,checkMode:M=!0,tips:q,showTips:A,drawLayerSlot:T}=g,{imgIndex:n,imgList:l,stepList:w,step:d,toolInstance:s}=x,{hoverKey:E,modelAPIResponse:R,setModelAPIResponse:I,newAnswerList:c}=N(B),[P,V]=v([]),[S,h]=v(""),[t,k]=v(),{t:y}=H(),[,Q]=v(0);return u(()=>{let e;if(!M)return e=setInterval(()=>{K.info(y("EfficientListening"))},1e3*60),()=>{e&&clearInterval(e)}},[]),u(()=>{if(s)return s.on("validUpdated",()=>{Q(e=>e+1)}),()=>{s.unbindAll("validUpdated")}},[s]),u(()=>{var e,o,i,r,_,j;if(!l[n])return;const b=((e=t==null?void 0:t.dataType)==null?void 0:e.prompt)===L.Picture,D=((o=t==null?void 0:t.dataType)==null?void 0:o.response)===L.Picture,m=(i=l[n])==null?void 0:i.questionList,p=(r=l[n])==null?void 0:r.llmFile,F=b?p==null?void 0:p.question:m==null?void 0:m.question;h(F);let f=(m==null?void 0:m.answerList)||[];D&&(f=(p==null?void 0:p.answerList)||[]),((_=t==null?void 0:t.dataType)==null?void 0:_.response)===L.None&&(f=[]),((j=t==null?void 0:t.dataType)==null?void 0:j.response)===L.Text&&(c==null?void 0:c.length)>0&&(f=c),V(f)},[n,c,t]),u(()=>{var e;if(!l[n])return;const o=(e=l[n])!=null?e:{},i=O(o==null?void 0:o.result,d),r=(i==null?void 0:i.length)>0?i[0]:i;I((r==null?void 0:r.modelAPIResponse)||[])},[n]),u(()=>{var e;if(w&&d){const o=(e=X(w,d))==null?void 0:e.config;k(Y(o))}},[w,d]),a.createElement(z,{className:C},!(s==null?void 0:s.valid)&&a.createElement(Z,{message:y("InvalidQuestionAndSkip")}),T==null?void 0:T({}),a.createElement("div",{className:`${C}-question`},A===!0&&a.createElement(J,{tips:q}),a.createElement(G,{hoverKey:E,question:S,answerList:P,modelAPIResponse:R,setModelAPIResponse:I,checkMode:M,annotation:x,LLMConfig:t})))},te=g=>({annotation:g.annotation});var ne=$(te,null,null,{context:U})(ee);export{ne as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,{useEffect as
|
|
2
|
-
`);return e.createElement("div",{className:
|
|
1
|
+
import e,{useEffect as j}from"react";import{Form as m,Popover as C,Input as N,message as S}from"antd";import{useTranslation as A}from"react-i18next";import{InfoCircleOutlined as B}from"@ant-design/icons";import M from"../../../../markdownView/index.js";import O from"../../../../latexEditor/index.js";import c from"./index.module.scss.js";import R from"../../../../longText/index.js";const k=w=>{const{disabeledAll:x,newAnswer:E,textEditObject:b,updateValue:f,answerIndex:g}=w,{max:a,min:u,isLaText:v,tip:h}=b,{TextArea:y}=N,[l]=m.useForm(),{t:o}=A(),T=o("LeastCharacterError",{num:u});j(()=>{l.setFieldsValue({value:E}),x||l.validateFields()},[E]);const V=n=>{var t,d;const I=`inputTextarea_${g}`,r=document.getElementById(I),s=r.value||"",p=(t=r==null?void 0:r.selectionStart)!=null?t:s.length,_=(d=r.selectionEnd)!=null?d:s.length,F=s.substring(0,p),L=s.substring(_,s.length),i=F+n+L;if(a&&(i==null?void 0:i.length)>a){S.error(o("MaximumCharacterError",{num:a}));return}r.value=i,l.setFieldsValue({value:i}),f(i),r.selectionStart=p+n.length,r.selectionEnd=p+n.length,r.focus()};return e.createElement(m,{form:l,onValuesChange:(n,t)=>{const d=t.value;f(d)},className:c.form},e.createElement(m.Item,{name:"title",style:{marginBottom:0},label:e.createElement(e.Fragment,null,o("AnswerTextEdit"),e.createElement(C,{placement:"bottom",content:o("ShowEditingResultDifferencesInTextModeOnly")},e.createElement(B,{style:{margin:"0px 4px",cursor:"pointer"}}))),colon:!1,required:!!u}),e.createElement("div",{className:c.tip},e.createElement(R,{text:h!=null?h:"",overflowMaxLines:3,openByText:!0})),v&&e.createElement(O,{onSelectLatex:V,disabled:x}),e.createElement(m.Item,{name:"value",style:{marginBottom:24},rules:[{validator:(n,t="")=>u&&(t==null?void 0:t.length)<Number(u)?Promise.reject(T):Promise.resolve()}]},e.createElement(y,{maxLength:a,autoSize:{minRows:4,maxRows:10},allowClear:!0,disabled:x,showCount:!!a,style:{width:"100%"},id:`inputTextarea_${g}`})),v&&e.createElement(m.Item,{shouldUpdate:!0,noStyle:!0},()=>{const n=l.getFieldValue("value")||"",t=n.replace(/\n/g,`
|
|
2
|
+
`);return e.createElement("div",{className:c.outputDisplay},e.createElement("div",{className:c.title},o("OutputDisplay")),e.createElement("div",{className:c.content},n?e.createElement(M,{value:t}):""))}))};export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={form:"index-module_form__IypXc",outputDisplay:"index-module_outputDisplay__5dS48",title:"index-module_title__vhMCp",content:"index-module_content__Iml6l"};export{e as default};
|
|
1
|
+
var e={form:"index-module_form__IypXc",outputDisplay:"index-module_outputDisplay__5dS48",title:"index-module_title__vhMCp",content:"index-module_content__Iml6l",tip:"index-module_tip__NFru6"};export{e as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import r,{useEffect as
|
|
2
|
-
`);return r.createElement("div",{className:E.outputDisplay},r.createElement("div",{className:E.title},
|
|
1
|
+
import r,{useEffect as V}from"react";import{Form as g,Input as j,message as F}from"antd";import N from"classnames";import{useTranslation as C}from"react-i18next";import{isArray as S}from"lodash";import A from"../../../../latexEditor/index.js";import E from"./index.module.scss.js";import B from"../../../../markdownView/index.js";import D from"../../../../longText/index.js";var M=Object.defineProperty,R=Object.defineProperties,k=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,$=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable,T=(a,e,t)=>e in a?M(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,z=(a,e)=>{for(var t in e||(e={}))$.call(e,t)&&T(a,t,e[t]);if(P)for(var t of P(e))q.call(e,t)&&T(a,t,e[t]);return a},U=(a,e)=>R(a,k(e));const G=a=>{const{disabeledAll:e,LLMConfig:t,textAttribute:y,setText:I}=a,w=(t==null?void 0:t.text)&&S(t.text)?t==null?void 0:t.text:[],{TextArea:O}=j,[v]=g.useForm(),{t:h}=C();V(()=>{const s=w.map((c,n)=>{var d;const m=(y==null?void 0:y.filter(o=>(o==null?void 0:o.textId)===(c==null?void 0:c.textId)))||[];return U(z({},c),{value:(d=m[0])==null?void 0:d.value})});v.setFieldsValue({text:s})},[w,y]);const L=({newText:s,fieldName:c,max:n})=>{var d,m;const o=`textInput_${c}`,l=document.getElementById(o),u=l.value||"",f=(d=l==null?void 0:l.selectionStart)!=null?d:u.length,p=(m=l.selectionEnd)!=null?m:u.length,_=u.substring(0,f),x=u.substring(p,u.length),i=_+s+x;if(n&&(i==null?void 0:i.length)>n){F.error(h("MaximumCharacterError",{num:n}));return}l.value=i,v.setFields([{name:["text",c,"value"],value:i,errors:[]}]),b(),l.selectionStart=f+s.length,l.selectionEnd=f+s.length,l.focus()},b=()=>{const s=v.getFieldValue("text");I(s)};return r.createElement(g,{form:v},r.createElement(g.List,{name:"text"},(s,c)=>r.createElement(r.Fragment,null,s.map((n,d)=>{const{max:m,min:o,title:l,tip:u,isLaText:f}=w[n.name]||{},p=l,_=h("LeastCharacterError",{num:o});return r.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:"16px"},key:d},p&&r.createElement(g.Item,{name:[n.name,"title"],extra:r.createElement(D,{text:u!=null?u:"",overflowMaxLines:3,openByText:!0}),className:E.textTitle,required:!!o,label:" ",colon:!1},l,p&&r.createElement("span",{className:N({clearText:!0,clearText__disabled:e}),style:{verticalAlign:"initial"},onClick:()=>{e||(v.setFields([{name:["text",n.name,"value"],value:void 0,errors:o?[_]:[]}]),b())}})),f&&p&&r.createElement(A,{onSelectLatex:x=>L({newText:x,fieldName:n.name,max:m}),disabled:e}),p&&r.createElement(g.Item,{name:[n.name,"value"],style:{marginBottom:24},rules:[{validator:(x,i)=>o&&(i==null?void 0:i.length)<Number(o)?Promise.reject(_):Promise.resolve()}],initialValue:void 0},r.createElement(O,{maxLength:m,disabled:e,showCount:!!m,autoSize:{minRows:4,maxRows:10},style:{width:"100%"},id:`textInput_${n.name}`,onChange:()=>b()})),f&&p&&r.createElement(g.Item,{shouldUpdate:!0,noStyle:!0},()=>{const x=v.getFieldValue(["text",n.name,"value"])||"",i=x.replace(/\n/g,`
|
|
2
|
+
`);return r.createElement("div",{className:E.outputDisplay},r.createElement("div",{className:E.title},h("OutputDisplay")),r.createElement("div",{className:E.content},x?r.createElement(B,{value:i}):""))}))}))))};export{G as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import r,{useContext as
|
|
1
|
+
import r,{useContext as q,useState as D,useEffect as C}from"react";import{prefix as ct}from"../../../constant/index.js";import{Empty as dt,Button as ut}from"antd";import pt from"./components/answerSort/index.js";import{connect as mt}from"react-redux";import{isBoolean as ft,isString as gt,isNumber as vt,isObject as Lt}from"lodash";import xt from"./components/answerList/index.js";import{LabelBeeContext as wt,LLMContext as z}from"../../../store/ctx.js";import{jsonParser as F}from"../../../utils/index.js";import{getStepConfig as St}from"../../../store/annotation/reducer.js";import{useCustomToolInstance as bt}from"../../../hooks/annotation.js";import{PageForward as j}from"../../../store/annotation/actionCreators.js";import{cKeyCode as Et,EToolName as _t}from"@labelbee/lb-annotation";import{useTranslation as yt}from"react-i18next";import{getCurrentResultFromResultList as ht,getRenderDataByResult as Ct,formatSort as jt}from"../utils/data.js";import Tt from"../../../assets/annotation/LLMTool/empty.svg.js";import Pt from"./components/textInputBox/index.js";import It from"../../tagList/components/overall/index.js";import Ot from"../../../utils/StepUtils.js";var At=Object.defineProperty,Rt=Object.defineProperties,Dt=Object.getOwnPropertyDescriptors,W=Object.getOwnPropertySymbols,Nt=Object.prototype.hasOwnProperty,Mt=Object.prototype.propertyIsEnumerable,G=(s,i,a)=>i in s?At(s,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[i]=a,d=(s,i)=>{for(var a in i||(i={}))Nt.call(i,a)&&G(s,a,i[a]);if(W)for(var a of W(i))Mt.call(i,a)&&G(s,a,i[a]);return s},p=(s,i)=>Rt(s,Dt(i));const Bt=Et.default,T=`${ct}-sidebar`,$t=s=>{var i,a;const{annotation:J,dispatch:w,checkMode:Q}=s,{imgIndex:S,imgList:P,stepList:b,step:E,skipBeforePageTurning:_}=J,{modelAPIResponse:N,setModelAPIResponse:H}=q(z),{t:y}=yt(),u=(i=P[S])!=null?i:{},M=F(u==null?void 0:u.result),{toolInstanceRef:m}=bt({basicInfo:M}),[f,X]=D(),[I,Y]=D(!0),{setNewAnswerList:Z}=q(z),[n,L]=D({}),x=!m.current.valid||Q;C(()=>{var t;if(b&&E){const e=(t=St(b,E))==null?void 0:t.config;X(F(e))}},[E,JSON.stringify(b)]),C(()=>{!u||S===-1||(m.current.setValid=B,m.current.clearResult=tt,B(),$())},[S,f]);const tt=()=>{$(u==null?void 0:u.questionList)},B=t=>{var e;const o=t!=null?t:M.valid;ft(o)&&(Y(o),m.current.valid=o,(e=m.current)==null||e.emit("validUpdated"))},$=t=>{const e=Ot.getCurrentStepInfo(E,b),o=ht(u==null?void 0:u.result,e.step);let l=u==null?void 0:u.questionList;(o==null?void 0:o.answerList)&&m.current.valid&&(l=o),t&&(l=t,o.sort=[]);const g=Ct(f,l);L(d({},g)),H([])};C(()=>{et(),Z((n==null?void 0:n.answerList)||[])},[n,N,I]),C(()=>(window.addEventListener("keydown",V),()=>{window.removeEventListener("keydown",V)}),[]);const et=()=>{const{newSort:t,answerList:e,textAttribute:o,tagList:l}=n,g=jt(t||[]),c={answerList:e,sort:g,tagList:l,textAttribute:o,id:u==null?void 0:u.id,modelAPIResponse:N};m.current.exportData=()=>[[c],{valid:I}],m.current.currentPageResult=p(d({},c),{toolName:_t.LLM,valid:I})},V=t=>{if(t.ctrlKey&&t.keyCode===Bt.Enter){if(_){_(()=>w(j()));return}w(j())}},nt=({order:t,value:e,key:o})=>{const{answerList:l}=n,g=l==null?void 0:l.map(c=>{var h;if((c==null?void 0:c.order)===t){if(o==="textEdit"&>(e))return p(d({},c),{newAnswer:e});if(vt(e))return p(d({},c),{score:e});if(Lt(e)&&o){const A={[e==null?void 0:e.key]:e.value},R=(h=c[o])!=null?h:{};return p(d({},c),{[o]:d(d({},R),A)})}}return c});L(p(d({},n),{answerList:g||[]}))};if((()=>{var t,e;const{indicatorScore:o=[],indicatorDetermine:l=[],text:g=[],enableSort:c,isTextEdit:h,tagInputListConfigurable:A}=f||{},R=((t=o==null?void 0:o.filter(v=>v.label&&v.value&&v.score))==null?void 0:t.length)>0,at=((e=l==null?void 0:l.filter(v=>v.label&&v.value))==null?void 0:e.length)>0,lt=(g==null?void 0:g.length)>0;return!(R||at||lt||c||h||A)})())return r.createElement("div",{className:`${T}`},r.createElement("div",{className:`${T}__content`,style:{display:"flex",justifyContent:"center",alignItems:"center"}},r.createElement(dt,{description:r.createElement("span",{style:{color:"#ccc"}},y("NoScoringScale")),imageStyle:{width:200,height:200},image:r.createElement("img",{src:Tt})})));const{indicatorScore:k=[],indicatorDetermine:K=[],enableSort:ot,isTextEdit:rt,inputList:O=[],tagInputListConfigurable:U}=f||{},it=U&&((a=O.filter(t=>!t.isOverall))==null?void 0:a.length)>0,st=(K==null?void 0:K.length)>0||(k==null?void 0:k.length)>0||rt||it;return r.createElement("div",{className:`${T}`},r.createElement("div",{className:`${T}__content`},r.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},y("GlobalAnnotation")),ot&&r.createElement(pt,{waitSortList:(n==null?void 0:n.waitSorts)||[],sortList:(n==null?void 0:n.newSort)||[],setSortList:t=>{L(p(d({},n),{newSort:t}))},disabeledAll:x}),U&&O.length&&r.createElement(It,{inputList:O,selectedTags:(n==null?void 0:n.tagList)||{},updateValue:t=>{const{key:e,value:o}=t,l=n==null?void 0:n.tagList;L(p(d({},n),{tagList:p(d({},l),{[e]:o})}))},disabeledAll:x}),(f==null?void 0:f.text)&&r.createElement("div",{style:{padding:"0px 16px",marginTop:"16px"}},r.createElement(Pt,{textAttribute:(n==null?void 0:n.textAttribute)||[],LLMConfig:f,setText:t=>L(p(d({},n),{textAttribute:t})),disabeledAll:x})),r.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},y("QualifiedAnnotation")),r.createElement("div",null,st&&r.createElement(xt,{list:(n==null?void 0:n.answerList)||[],LLMConfig:f,updateValue:nt,disabeledAll:x}))),r.createElement("div",{style:{margin:"24px 16px",display:"flex"}},(P==null?void 0:P.length)-1!==S&&r.createElement(ut,{type:"primary",style:{marginLeft:"auto"},onClick:()=>{if(_){_(()=>w(j()));return}w(j())},disabled:x},y("Save"))))},Vt=s=>({annotation:s.annotation});var kt=mt(Vt,null,null,{context:wt})($t);export{kt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isArray as L}from"lodash";import{jsonParser as O}from"../../../utils/index.js";var P=Object.defineProperty,S=Object.defineProperties,b=Object.getOwnPropertyDescriptors,w=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,g=(l,t,r)=>t in l?P(l,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[t]=r,
|
|
1
|
+
import{isArray as L}from"lodash";import{jsonParser as O}from"../../../utils/index.js";var P=Object.defineProperty,S=Object.defineProperties,b=Object.getOwnPropertyDescriptors,w=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,g=(l,t,r)=>t in l?P(l,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[t]=r,v=(l,t)=>{for(var r in t||(t={}))A.call(t,r)&&g(l,r,t[r]);if(w)for(var r of w(t))E.call(t,r)&&g(l,r,t[r]);return l},c=(l,t)=>S(l,b(t));const x=(l,t=1)=>{var r,n;const i=O(l),o=`step_${t}`;return(n=(r=i==null?void 0:i[o])==null?void 0:r.result[0])!=null?n:{}},j=l=>l.reduce((r,n)=>{var i;let o=n;return n.length>1?o=n.map(e=>e==null?void 0:e.id):o=[(i=n[0])==null?void 0:i.id],[...r,o]},[]),p=(l,t)=>{let r={};return l.forEach(n=>{var i;let o=[];t&&t[n==null?void 0:n.value]?o=t[n.value]:((i=n==null?void 0:n.subSelected)==null?void 0:i.length)>0&&n.subSelected.forEach(e=>{(e==null?void 0:e.isDefault)&&(e==null?void 0:e.value)&&o.push(e.value)}),o.length>0&&(r=c(v({},r),{[n.value]:o}))}),r},f=(l,t)=>{var r;let n=[],i=[];if((l==null?void 0:l.length)>0){const o=L(t)?t[0]:t;((r=o==null?void 0:o.sort)==null?void 0:r.length)>0&&(i=o.sort.reduce((e,s)=>{let a=[{title:s[0],id:s[0]}];return s.length>1&&(a=s.map(u=>({title:u,id:u}))),[...e,a]},[])),l.forEach(e=>{i.some(a=>a.length>1?a.some(u=>u.id===e.order):a[0].id===e.order)||n.push({title:e.order,id:e.order})})}return{newSort:i,waitSorts:n}},m=(l,t)=>{const{isTextEdit:r,textEdit:n=[],inputList:i=[]}=t||{};return l.map(e=>{var s,a;const u=i.filter(d=>!(d==null?void 0:d.isOverall))||[],_=p(u,e==null?void 0:e.tagList);return r&&((s=n.filter(h=>h.title===e.order)[0])==null?void 0:s.isFillAnswer)?c(v({},e),{newAnswer:(a=e==null?void 0:e.newAnswer)!=null?a:e.answer,tagList:_}):c(v({},e),{tagList:_})})},R=(l,t)=>{var r;let n=[],i=[],o=[],e={};(t==null?void 0:t.answerList)&&(n=m(t.answerList,l)||[],i=f(t.answerList,t).newSort,o=f(t.answerList,t).waitSorts);const s=((r=l==null?void 0:l.inputList)==null?void 0:r.filter(a=>a==null?void 0:a.isOverall))||[];return e=p(s,t==null?void 0:t.tagList),{newSort:i,waitSorts:o,answerList:n,tagList:e,textAttribute:t==null?void 0:t.textAttribute}};export{j as formatSort,x as getCurrentResultFromResultList,R as getRenderDataByResult,p as getTagResult,f as getWaitSortList,m as initAnswerList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import x,{useContext as ut,useState as g,useMemo as M,useEffect as C}from"react";import{connect as lt}from"react-redux";import{LabelBeeContext as dt,NLPContext as ft}from"../../store/ctx.js";import{prefix as pt}from"../../constant/index.js";import mt from"./textContent/index.js";import gt from"../../views/MainView/annotationTips/index.js";import{getStepConfig as vt}from"../../store/annotation/reducer.js";import{jsonParser as xt}from"../../utils/index.js";import{getCurrentResultFromResultList as bt}from"../LLMToolView/utils/data.js";import{useCustomToolInstance as At}from"../../hooks/annotation.js";import{uuid as ht}from"@labelbee/lb-annotation";var _t=Object.defineProperty,Lt=Object.defineProperties,wt=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,Pt=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable,K=(i,e,a)=>e in i?_t(i,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[e]=a,b=(i,e)=>{for(var a in e||(e={}))Pt.call(e,a)&&K(i,a,e[a]);if(B)for(var a of B(e))Ct.call(e,a)&&K(i,a,e[a]);return i},A=(i,e)=>Lt(i,wt(e));const $=`${pt}-NLPView`,yt=i=>{const{annotation:e,checkMode:a,tips:H,showTips:q,extraLayer:F,extraData:Q,onChangeAnnotation:y,customAnnotationData:W}=i,{imgIndex:u,imgList:v,stepList:h,step:_}=e,{highlightKey:z,setHighlightKey:G}=ut(ft),{toolInstanceRef:n}=At(),[D,J]=g(""),[L,U]=g([]),[w,X]=g(void 0),[Y,Z]=g([{content:""}]),[o,d]=g({id:1,newText:"",indicatorDetermine:{},textAnnotation:[]}),tt=M(()=>(o==null?void 0:o.textAnnotation)?(w&&(o.textAnnotation=w),o.textAnnotation.filter(t=>L.length===0||L.includes(t.attribute))):[],[o,L,w]),l=M(()=>{var t;if(h&&_){const r=(t=vt(h,_))==null?void 0:t.config;return xt(r)}},[h,_]);C(()=>{var t;if(!v[u])return;const r=(t=v[u])==null?void 0:t.textData;Z(r),(l==null?void 0:l.attributeConfigurable)||f([])},[u,l]),C(()=>{var t;if(!v[u])return;const r=(t=v[u])!=null?t:{},c=bt(r==null?void 0:r.result);d(c),f(c.textAnnotation)},[u]),C(()=>{n.current.exportData=()=>[[o],{}],n.current.setResult=()=>{},n.current.updateResult=t=>{d(t)},n.current.clearResult=ot,n.current.setDefaultAttribute=et,n.current.setHighlightKey=G,n.current.deleteTextAnnotation=rt,n.current.setAttributeLockList=nt,n.current.setVisibleResult=f,P()},[o]);const P=()=>{n.current.emit("changeAttributeSidebar"),n.current.emit("changeIndicatorDetermine")},et=t=>{n.current.defaultAttribute=t,J(t),P()},nt=t=>{U(t),n.current.attributeLockList=t,n.current.emit("changeAttributeSidebar")},f=t=>{X(t)},ot=()=>{d({id:1,newText:"",indicatorDetermine:{},textAnnotation:[]}),f([]),P()},rt=t=>{const r=o.textAnnotation.filter(c=>c.id!==t);d(A(b({},o),{textAnnotation:r})),f(r)},it=(t,r)=>{var c,p;if(r===""||!t)return;const s=window.getSelection(),{anchorOffset:O=0,focusOffset:S=0,anchorNode:st,focusNode:ct}=s||{};if(st===ct){const j=Math.min(O,S),N=Math.max(O,S);let R;if((t==null?void 0:t.current)&&s){const m=(c=t.current)==null?void 0:c.getBoundingClientRect(),E=s.getRangeAt(0).getBoundingClientRect(),k=E.right-m.left,I=E.top-m.top;k&&I&&(R={left:k,top:I})}const T={id:ht(8,62),start:j,end:N,text:r};if(typeof y=="function"){y(A(b({},T),{endPosition:R}));return}if(at(j,N,D,o==null?void 0:o.textAnnotation)||a)return;if(l==null?void 0:l.attributeConfigurable){const m=(o==null?void 0:o.textAnnotation)||[];m.push(A(b({},T),{attribute:D}));const V=A(b({},o),{textAnnotation:m});d(V)}(p=window.getSelection())==null||p.empty()}},at=(t,r,c,p)=>p==null?void 0:p.some(s=>(s==null?void 0:s.start)===t&&(s==null?void 0:s.end)===r&&(s==null?void 0:s.attribute)===c);return x.createElement("div",{className:$,id:"NLPView"},x.createElement("div",{className:`${$}-question`},q===!0&&x.createElement(gt,{tips:H}),x.createElement(mt,{highlightKey:z,textData:Y,NLPConfig:l,textAnnotation:tt,onSelectionChange:it,extraLayer:F,extraData:Q,customAnnotationData:W})))},Dt=i=>({annotation:i.annotation});var Ot=lt(Dt,null,null,{context:dt})(yt);export{Ot as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import s from"lodash";import r from"react";var u=({splitIntervals:
|
|
1
|
+
import s from"lodash";import r from"react";var u=({splitIntervals:a,extraData:t})=>r.createElement("div",{style:{position:"absolute",top:0,left:0,backgroundColor:"transparent",color:"transparent"}},a.map((o,n)=>{var l;const e=s.last(o.extraAnnotations);let i=`2px solid ${((l=o==null?void 0:o.extraAnnotations)==null?void 0:l.find(d=>(d==null?void 0:d.auditID)===(t==null?void 0:t.hoverAuditID)))?"#ff8609":"#fcdf7e"}`;return(t==null?void 0:t.isShowRemark)||(i=""),e?r.createElement("span",{style:{borderBottom:i,padding:"2px 0px"},id:e==null?void 0:e.id,key:n},o.text):r.createElement("span",{key:n},o.text)}));export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r,{useRef as Q,useState as L,useMemo as P,useEffect as E}from"react";import{I18nextProvider as U,useTranslation as W}from"react-i18next";import{i18n as N,toolStyleConverter as z}from"@labelbee/lb-utils";import{prefix as F}from"../../../constant/index.js";import{useTextSelection as G}from"ahooks";import O from"lodash";import{CommonToolUtils as H}from"@labelbee/lb-annotation";import J from"../../../constant/styleString.js";import{getIntervals as T}from"../utils/index.js";import{classnames as X}from"../../../utils/index.js";import Y from"./extraMask.js";var Z=Object.defineProperty,A=Object.getOwnPropertySymbols,tt=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable,B=(n,o,e)=>o in n?Z(n,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[o]=e,nt=(n,o)=>{for(var e in o||(o={}))tt.call(o,e)&&B(n,e,o[e]);if(A)for(var e of A(o))et.call(o,e)&&B(n,e,o[e]);return n};const S=`${F}-NLPView`,ot=({extraLayer:n,extraStyle:o,setExtraStyle:e,setExtraResut:m,extraResut:f})=>{if(typeof n=="function"&&e&&m)return n({style:o,onClose:()=>{var v;e(void 0),m(void 0),(v=window.getSelection())==null||v.empty()},submitData:f})},rt=n=>{const{highlightKey:o,textData:e,lang:m,NLPConfig:f,onSelectionChange:v,textAnnotation:C,extraData:a,customAnnotationData:w}=n,{displayRemarkList:p=[]}=a||{},{t:V}=W(),g=Q(null),D=G(g),[x,R]=L(),[M,y]=L(void 0),_=P(()=>{var t;return y(void 0),(t=e==null?void 0:e[0])==null?void 0:t.content},[e]),$=P(()=>{const t=O.clone(p);return(x==null?void 0:x.start)&&t.push(x),T(_,t!=null?t:[],"extraAnnotations")},[p,x,_]),q=P(()=>T(_,C!=null?C:[],"annotations"),[C,_]);E(()=>{if(w){const{id:t,start:i,end:s,text:d,endPosition:l}=w;R({id:t,start:i,end:s,text:d}),y(l)}},[w]);const j=(t="")=>{if(f==null?void 0:f.attributeConfigurable){const i=H.jsonParser(J);return z.getColorByConfig({attribute:t,config:f,style:i})}};return E(()=>{var t;m&&((t=N)==null||t.changeLanguage(m))},[]),E(()=>{v==null||v(g,D.text)},[D.text]),E(()=>{var t;if(!(a==null?void 0:a.editAuditID))return;const i=document.getElementById("NLPView"),s=p.filter(c=>(c==null?void 0:c.auditID)===a.editAuditID)[0],d=(t=s==null?void 0:s.id)!=null?t:"",l=document.getElementById(d);if(l&&g.current){const c=l.getBoundingClientRect(),h=g.current.getBoundingClientRect(),b=c.right-h.left,u=l.offsetTop;b&&u&&y&&(i&&i.scrollTo({top:u,behavior:"auto"}),y({left:b,top:u}))}},[a==null?void 0:a.editAuditID]),r.createElement("div",null,r.createElement("div",{className:`${S}-question-title`},V("textTool")),r.createElement("div",{className:X({[`${S}-question-content`]:!0}),style:{position:"relative",whiteSpace:"pre-wrap"},onDoubleClick:t=>{t.preventDefault()}},r.createElement("div",{style:{position:"relative"}},q.map((t,i)=>{var s,d,l,c,h;const b=O.last(t.annotations);if(b){let u=j(b.attribute);const k=(s=t==null?void 0:t.annotations)==null?void 0:s.find(I=>I.id===o);if(k){const I=(c=(l=(d=t==null?void 0:t.annotations)==null?void 0:d.filter(K=>K.id===o))==null?void 0:l[0])==null?void 0:c.attribute;u=j(I)}return r.createElement("span",{style:{backgroundColor:(h=u==null?void 0:u.valid)==null?void 0:h.stroke,color:k?"white":void 0,padding:"2px 0px"},key:i},t.text)}else return r.createElement("span",{key:i},t.text)}),(p==null?void 0:p.length)>0&&r.createElement(Y,{splitIntervals:$,extraData:a}),ot({extraLayer:n==null?void 0:n.extraLayer,setExtraStyle:y,extraStyle:M,extraResut:x,setExtraResut:R}),r.createElement("div",{className:`${S}-question-content-mask`,ref:g},_))))},it=n=>r.createElement(U,{i18n:N},r.createElement(rt,nt({},n)));export{it as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"react";import
|
|
1
|
+
import t,{useMemo as k}from"react";import F from"../../../attributeList/index.js";import{EventBus as A}from"@labelbee/lb-annotation";import I from"../../../../assets/annotation/audio/clipSmall.svg.js";import D from"../../../../assets/annotation/audio/clipASmall.svg.js";import B from"../../../../assets/annotation/audio/delete.svg.js";import V from"../../../../assets/annotation/audio/loopA.svg.js";import{getAttributeShowText as M,timeFormat as S}from"../../../../utils/audio.js";import q from"../../../longText/index.js";import{classnames as z}from"../../../../utils/index.js";import s from"./index.module.scss.js";import{useTranslation as G}from"react-i18next";import H from"../../../subAttributeList/index.js";var J=Object.defineProperty,K=Object.defineProperties,Q=Object.getOwnPropertyDescriptors,x=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,y=(a,e,i)=>e in a?J(a,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[e]=i,m=(a,e)=>{for(var i in e||(e={}))U.call(e,i)&&y(a,i,e[i]);if(x)for(var i of x(e))W.call(e,i)&&y(a,i,e[i]);return a},c=(a,e)=>K(a,Q(e));const X=a=>{const{regions:e=[],updateRegion:i,useAudioClipStore:C}=a,{audioClipState:j,setAudioClipState:v}=C(),{t:d}=G(),{selectedAttribute:N,selectedRegion:f,clipTextConfigurable:E,clipAttributeList:p,clipAttributeConfigurable:b,secondaryAttributeConfigurable:L,subAttributeList:O}=j,{id:l}=f,n=k(()=>e.find(r=>r.id===l),[e,l]),P=r=>{e.length&&l&&i(c(m({},n),{attribute:r})),v({selectedAttribute:r})},h=(r,o)=>{var u;if(e.length&&l){const g=(u=n==null?void 0:n.subAttribute)!=null?u:{};i(c(m({},n),{subAttribute:c(m({},g),{[r]:o})}))}},_=[{label:"\u65E0\u5C5E\u6027",value:"",key:"\u65E0\u5C5E\u6027"},...p.map(r=>c(m({},r),{label:r.key}))];return t.createElement("div",{className:s.clipSidebar},t.createElement("div",{className:s.clipResults},t.createElement("div",{className:s.title},d("ClippedAudio")),e.length>0?t.createElement("div",{className:s.regions},e.map(r=>{const{id:o,attribute:u,text:g,start:w,end:$}=r,R=o===l&&f.loop,T=`${b?M(u,_):""}${b&&E?"\uFF0C":""}${E?`${d("textTool")}\uFF1A${g}`:""}`;return t.createElement("div",{className:z({[s.region]:!0,[s.selected]:o===l}),key:o,onClick:()=>{A.emit("setSelectedRegion",{id:o,playImmediately:!0})}},t.createElement("div",{className:s.label},R&&t.createElement("img",{src:V}),t.createElement("div",{className:s.text},t.createElement(q,{text:T}))),t.createElement("div",{className:s.time},t.createElement("img",{src:l===o?D:I}),S(w,"ss.SSS")," -",S($,"ss.SSS")),t.createElement("div",{className:s.delete,onClick:()=>{A.emit("removeRegionById",o)}},t.createElement("img",{src:B})))})):t.createElement("div",{className:s.empty},d("NoClippedData"))),b&&(p==null?void 0:p.length)>0&&t.createElement("div",{className:s.attributeList},t.createElement(F,{list:_,attributeChanged:P,selectedAttribute:N,attributeLockChange:r=>{v({attributeLockList:r})}}),l&&L&&t.createElement(H,{subAttributeList:O,setSubAttribute:h,getValue:r=>{var o;return(o=n==null?void 0:n.subAttribute)==null?void 0:o[r.value]}})))};export{X as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import i,{useState as F,useEffect as B,useMemo as ne}from"react";import{AudioPlayer as
|
|
1
|
+
import i,{useState as F,useEffect as B,useMemo as ne}from"react";import{AudioPlayer as Re}from"../audioPlayer/index.js";import{getClassName as Te}from"../../utils/dom.js";import je from"../predictTracking/previewResult/index.js";import{Layout as oe}from"antd/es";import{Spin as Pe}from"antd";import{prefix as he}from"../../constant/index.js";import{cKeyCode as Le,CommonToolUtils as K,uuid as we,TagUtils as Ae,EventBus as Oe,cTool as Ie}from"@labelbee/lb-annotation";import N from"./index.module.scss.js";import Ne from"./tagResultShow/index.js";import{AudioClipProvider as ke,useAudioClipStore as De}from"./audioContext/index.js";import $e from"./textInput/index.js";import{connect as Me}from"react-redux";import{a2MapStateToProps as Ve}from"../../store/annotation/map.js";import{LabelBeeContext as Be}from"../../store/ctx.js";import{jsonParser as Ke}from"../../utils/index.js";import{useCustomToolInstance as We}from"../../hooks/annotation.js";import{sidebarCls as Q}from"../../views/MainView/sidebar/index.js";import Ue from"./audioSide/labelSidebar/index.js";import Fe from"./audioSide/clipSidebar/index.js";import Xe from"../../assets/annotation/audio/tag.svg.js";import qe from"../../assets/annotation/audio/tagA.svg.js";import ze from"../../assets/annotation/audio/clip.svg.js";import Ge from"../../assets/annotation/audio/clipA.svg.js";var He=Object.defineProperty,Je=Object.defineProperties,Qe=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertySymbols,Ye=Object.prototype.hasOwnProperty,Ze=Object.prototype.propertyIsEnumerable,le=(t,n,s)=>n in t?He(t,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[n]=s,E=(t,n)=>{for(var s in n||(n={}))Ye.call(n,s)&&le(t,s,n[s]);if(ie)for(var s of ie(n))Ze.call(n,s)&&le(t,s,n[s]);return t},k=(t,n)=>Je(t,Qe(n));const{EAudioToolName:et}=Ie,re=Le.default,{Sider:tt,Content:nt}=oe,se=`${he}-layout`,ot=({setSideTab:t,sideTab:n})=>{const s=[{tab:"tag",commonSvg:Xe,selectedSvg:qe},{tab:"clip",commonSvg:ze,selectedSvg:Ge}];return i.createElement("div",{className:N.toggleAudioOption},s.map((p,S)=>{const{tab:f,selectedSvg:x,commonSvg:R}=p;return i.createElement("div",{key:S,className:N.option},i.createElement("img",{className:N.icon,src:n===f?x:R,onClick:()=>{n!==f&&t(f)}}))}))},it=({result:t,inputDisabled:n,updateText:s,configList:p,autofocus:S,preContext:f,isCheck:x,clipAttributeConfigurable:R,clipTextConfigurable:D,textConfigurable:g,updateRegion:_,clipAttributeList:m})=>i.createElement("div",{className:N.textareaContainer},i.createElement("div",{className:N.textareaContent},i.createElement($e,{isCheck:x,result:t==null?void 0:t.value,textInputDisabled:n,textID:(t==null?void 0:t.id)||0,updateText:s,configList:p,autofocus:!n&&S,preContext:f,regions:t==null?void 0:t.regions,clipAttributeConfigurable:R,clipTextConfigurable:D,textConfigurable:g,updateRegion:_,clipAttributeList:m}))),lt=t=>{var n,s;const{sider:p,config:S,result:f,updateTagResult:x,updateRegion:R,isEdit:D,tagConfigurable:g,clipConfigurable:_}=t;let m=(S==null?void 0:S.inputList)||[],C=(n=f==null?void 0:f.tag)!=null?n:{},a=(s=f==null?void 0:f.regions)!=null?s:[];const[X,w]=F([]),[T,v]=F("tag");B(()=>{if(!g&&_){v("clip");return}v("tag")},[g,_]),B(()=>(window.addEventListener("keydown",$),()=>{window.removeEventListener("keydown",$)}));const $=l=>{if(g&&_)switch(l.keyCode){case re.L:v("tag");break;case re.X:v("clip");break}if(T==="tag"){if(!K.hotkeyFilter(l))return;K.isMoveKey(l==null?void 0:l.keyCode)&&l.preventDefault();let r=l.keyCode;if(r&&(r<=57&&r>=49||r<=105&&r>=97)){r>57?r=r-97:r=r-49;const d=X.slice();m.length===1?(j(0,r),w([0,r]),setTimeout(()=>{w([])},500)):d.length===1?(j(d[0],r),w([d[0],r]),setTimeout(()=>{w([])},500)):w([r])}}},j=(l,r)=>{if(l<m.length&&m[l].subSelected&&r<m[l].subSelected.length){const d=m[l].value,b=m[l].isMulti;let P=m[l].subSelected[r].value,q=0;const W=C;for(const h in C)if(h===m[l].value){if(q++,b===!0){const I=W[h].split(";").filter(z=>z!==""),V=I.indexOf(P);V===-1?I.push(P):I.splice(V,1),P=I.join(";")}P===""?delete W[h]:W[h]=P}q===0&&Object.assign(C,{[d]:P}),x(C)}},A=l=>{delete C[l],x(C)},O=g&&_&&i.createElement(ot,{setSideTab:v,sideTab:T}),M=T==="tag"&&i.createElement(Ue,{labelInfoSet:g?m:[],labelSelectedList:X,setLabel:j,tagResult:C,clearResult:A,isEdit:D,withPanelTab:!1}),u=T==="clip"&&i.createElement(Fe,{regions:a,updateRegion:R,useAudioClipStore:De});return p?typeof p=="function"?i.createElement("div",{className:`${Q}`},p({toggleAudioOption:O,labelSidebar:M,clipSidebar:u})):p:i.createElement("div",{className:`${Q}`},i.createElement("div",{className:`${Q}__content`},O,M,u))},rt=t=>{var n,s,p,S,f,x,R,D,g;const _=(s=(n=t.style)==null?void 0:n.sider)==null?void 0:s.width,{step:m,stepList:C,audioContext:a,sider:X,drawLayerSlot:w,imgList:T,imgIndex:v,currentData:$,config:j,stepInfo:A}=t,O=K.getCurrentStepToolAndConfig(m,C),M=Ke($.result),{toolInstanceRef:u}=We({basicInfo:M}),[l,r]=F(!0),[d,b]=F(null),[P,q]=F(0);B(()=>{r(!0)},[v]),B(()=>{l===!1&&ve()},[l]),B(()=>{W()},[]),B(()=>{u.current.exportData=()=>[[d],{duration:P,valid:H}],u.current.setResult=_e,u.current.clearResult=Ce,u.current.currentPageResult=d==null?void 0:d.regions,u.current.emit("updatePageNumber")},[d]);const W=()=>{u.current.emit=e=>{const o=u.current.fns.get(e);o&&o.forEach(c=>{c&&(c==null||c())})},u.current.fns=new Map,u.current.singleOn=(e,o)=>{u.current.fns.set(e,[o])},u.current.on=(e,o)=>{u.current.singleOn(e,o)},u.current.unbindAll=e=>{u.current.fns.delete(e)}},h=ne(()=>{const e=M[`step_${A==null?void 0:A.step}`];return(e==null?void 0:e.result)||[]},[j,M,A]),{tagConfigurable:I,textConfigurable:V=!0,clipConfigurable:z=!1,clipAttributeConfigurable:Y=!1,clipAttributeList:Z=[],clipTextConfigurable:G=!1,subAttributeList:ae=[],secondaryAttributeConfigurable:ue=!1,inputList:ce=[],configList:de=[]}=ne(()=>{if(O)return K.jsonParser(O==null?void 0:O.config)},[O]),fe={clipConfigurable:z,clipAttributeConfigurable:Y,clipAttributeList:Z,clipTextConfigurable:G,subAttributeList:ae,secondaryAttributeConfigurable:ue},H=a?a==null?void 0:a.valid:!0,me=(S=(p=K.jsonParser($.result))==null?void 0:p.duration)!=null?S:0,pe=H?me:0,ge=!H||l||![V,G].includes(!0);let ee={};if(v!==-1&&(T==null?void 0:T.length)){const e=(f=T[v])==null?void 0:f.preResult,o=(a==null?void 0:a.isEdit)?(x=a==null?void 0:a.stepConfig)==null?void 0:x.loadPreStep:A==null?void 0:A.loadPreStep;if(e&&o){const c=K.jsonParser(e),y=(D=(R=c==null?void 0:c.config)==null?void 0:R.context)!=null?D:{};Object.keys(y).forEach(L=>{L&&y[L]&&(ee[L]={visible:!0,content:y[L],type:L})})}}const ve=()=>{(h==null?void 0:h.length)>0?b(h[0]):b({id:we(),sourceID:"",value:te(),tag:be(),regions:[]})},te=(e=!0)=>{const o={};let c=j.configList||[];return c.length>0&&c.forEach(y=>{o[y.key]=e&&y.default||""}),o},be=()=>Ae.getDefaultResultByConfig(j.inputList||[]),ye=({duration:e,hasError:o})=>{r(!1),q(e)},Ee=e=>{b(o=>k(E({},o),{regions:((o==null?void 0:o.regions)||[]).filter(c=>c.id!==e)}))},J=e=>{b(o=>{var c;const y=(c=o==null?void 0:o.regions)!=null?c:[],{id:L}=e;return y.find(U=>U.id===L)?k(E({},o),{regions:y.map(U=>L===U.id?E(E({},U),e):U)}):k(E({},o),{regions:[...y,e]})})},Se=(e,o)=>{b(c=>k(E({},c),{value:k(E({},c.value),{[o]:e})}))},xe=e=>{b(o=>k(E({},o),{tag:e}))},_e=e=>{b(e)},Ce=()=>{b(e=>k(E({},e),{value:te(),tag:{},regions:[]})),Oe.emit("clearRegions")};return i.createElement(ke,null,i.createElement(Pe,{spinning:l,wrapperClassName:"audio-tool-spinner"},i.createElement(oe,{className:Te("layout","container"),style:{height:"100%"}},t==null?void 0:t.leftSider,i.createElement(nt,{className:`${se}__content`},i.createElement("div",{className:N.containerWrapper},i.createElement("div",{className:N.audioWrapper},I&&i.createElement(Ne,{result:d==null?void 0:d.tag,labelInfoSet:ce,hasPromptLayer:!!(a==null?void 0:a.promptLayer)}),a==null?void 0:a.promptLayer,i.createElement(Re,E({context:{isEdit:a==null?void 0:a.isEdit,count:pe,toolName:et.AudioTextTool,imgIndex:v},drawLayerSlot:w,fileData:$,onLoaded:ye,invalid:!H,updateRegion:J,removeRegion:Ee,regions:d==null?void 0:d.regions,activeToolPanel:a==null?void 0:a.activeToolPanel,footer:t.footer},fe))),(V||G)&&i.createElement(it,{preContext:ee,result:d,inputDisabled:ge,updateText:Se,updateRegion:J,configList:de,autofocus:!1,textConfigurable:V,clipTextConfigurable:G,clipAttributeList:Z,clipAttributeConfigurable:Y}))),i.createElement(tt,{className:`${se}__side`,width:_!=null?_:240,style:(g=t.style)==null?void 0:g.sider},i.createElement(lt,{sider:X,config:j,result:d,updateTagResult:xe,updateRegion:J,isEdit:a==null?void 0:a.isEdit,tagConfigurable:I,clipConfigurable:z})),i.createElement(je,null))))};var st=Me(Ve,null,null,{context:Be})(rt);export{st as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import i,{useState as g,useRef as z,useEffect as A}from"react";import{getWebPcm2WavBase64 as Kt}from"../audioAnnotate/utils/getWebPcm2Wac.js";import Vt,{debounce as Gt,sortBy as Yt}from"lodash";import{PauseOutlined as Jt,CaretRightOutlined as Qt}from"@ant-design/icons";import{cKeyCode as er,cTool as tr,EventBus as _}from"@labelbee/lb-annotation";import{Button as rr}from"antd";import or from"../invalidPage/index.js";import nr from"../imageError/index.js";import{classnames as $}from"../../utils/index.js";import ir,{EPlayerType as lr}from"../videoPlayer/components/SpeedController/index.js";import sr from"@labelbee/wavesurfer";import ar from"@labelbee/wavesurfer/dist/plugin/wavesurfer.regions.js";import ur from"@labelbee/wavesurfer/dist/plugin/wavesurfer.cursor.js";import cr,{audioZoomInfo as Xe}from"./zoomSlider/index.js";import dr from"./labelDisplayToggle/index.js";import mr from"./clipRegion/index.js";import{useAudioClipStore as pr}from"../audioAnnotate/audioContext/index.js";import{useLatest as H,useUpdate as fr,useDeepCompareEffect as Ze,useThrottleFn as vr}from"ahooks";import gr from"./useAudioScroll/index.js";import b from"./index.module.scss.js";import{getAttributeColor as br,formatTime as qe,timeFormat as Ke,dispatchResizeEvent as yr,precisionMinus as Ve,isDoubleClick as _r,getCanMoveRange as Er}from"../../utils/audio.js";import hr from"./progressDot/index.js";import Pr from"./clipTip/index.js";import Sr from"./useSwitchHotkey/index.js";import Cr from"./useAudioCombine/index.js";import Rr from"./useAudioSegment/index.js";import wr from"./combineTip/index.js";import Tr from"./segmentTip/index.js";import Ar from"../../views/MainView/toolFooter/index.js";import{decimalReserved as U}from"../videoPlayer/utils.js";var jr=Object.defineProperty,xr=Object.defineProperties,Dr=Object.getOwnPropertyDescriptors,Ge=Object.getOwnPropertySymbols,Mr=Object.prototype.hasOwnProperty,kr=Object.prototype.propertyIsEnumerable,Ye=(f,a,u)=>a in f?jr(f,a,{enumerable:!0,configurable:!0,writable:!0,value:u}):f[a]=u,Je=(f,a)=>{for(var u in a||(a={}))Mr.call(a,u)&&Ye(f,u,a[u]);if(Ge)for(var u of Ge(a))kr.call(a,u)&&Ye(f,u,a[u]);return f},Qe=(f,a)=>xr(f,Dr(a));const{EToolName:et}=tr,X=er.default,tt=.1,rt=i.createContext({count:0,isEdit:!1,toolName:et.Empty,imgIndex:0}),Ir=({fileData:f={},onLoaded:a,context:u,invalid:ot,height:nt,hideError:it,onError:ce,updateRegion:j,removeRegion:L,regions:x=[],activeToolPanel:lt,clipConfigurable:st,clipTextConfigurable:at,clipAttributeList:ut,clipAttributeConfigurable:de,isCheck:S,hoverRegionId:Z,footer:ct,drawLayerSlot:me})=>{var pe,fe;const{url:O,path:ve}=f,[q,K]=g(!1),[ge,be]=g(!1),[C,dt]=g(0),[mt,ye]=g(!1),[N,_e]=g(0),n=z(null),R=z(null),Ee=z(C),V=e=>{Ee.current=e,dt(e)},[he,pt]=g(0),[F,ft]=g(1),G=z(null),[Pe,vt]=g({}),{audioClipState:Y,setAudioClipState:k}=pr(),[J,Q]=g(!1),c=H(Y),Se=H(Pe),gt=H(q),D=H(x),Ce=fr(),[Re,bt]=g([]),[we,yt]=g({}),_t=Gt(()=>{_.emit("audioZoom")},500),Te=e=>{e<Xe.min||e>Xe.max||(ft(e),yr(),_t())};gr({container:G.current,target:document.querySelector(`[data-id=${(fe=(pe=c.current)==null?void 0:pe.selectedRegion)==null?void 0:fe.id}]`),clipping:J,zoom:F,zoomHandler:Te});const W=()=>{let e=D.current;const{attributeLockList:r}=c.current;r.length&&(e=e.filter(t=>r.includes(t.attribute))),te(),e.forEach(t=>{var o;(o=n.current)==null||o.addRegion(Qe(Je({},t),{drag:!S,resize:!S,color:"rgba(0, 0, 0, 0)"}))}),Ce()},m=e=>{var r,t,o,l,s,p,E;const{id:d,loop:v=!0,playImmediately:P=!1}=e;if(d){const M=(o=(t=(r=n.current)==null?void 0:r.regions)==null?void 0:t.list)!=null?o:{};Object.entries(M).forEach(([,y])=>{const{id:T}=y;d===T?y.select():y.cancelSelect()}),k({selectedRegion:{id:d,loop:v},selectedAttribute:(p=(s=(l=D.current)==null?void 0:l.find(y=>y.id===d))==null?void 0:s.attribute)!=null?p:""}),v&&P&&((E=I(d))==null||E.playLoop())}else k({selectedRegion:{}})},{combineInstance:Et}=Cr({waveRef:n,sortByStartRegions:Re,regionMap:we,updateRegion:j,removeRegion:L,generateRegions:W,setSelectedRegion:m}),{segmentInstance:ht,onRegionMouseMove:Pt,segmentTimeTip:St}=Rr({waveRef:n,regionMap:we,updateRegion:j,removeRegion:L,generateRegions:W,setSelectedRegion:m}),Ae={clipTextConfigurable:at,clipAttributeList:ut,clipAttributeConfigurable:de,clipConfigurable:st};A(()=>{k({selectedAttribute:""})},[de]),A(()=>{ee()},[Y.selectedAttribute]),A(()=>{W()},[Y.attributeLockList]),Ze(()=>{k(Ae),setTimeout(()=>{je()})},[Ae]),Ze(()=>{bt(Yt(x,["start"])),yt(x.reduce((e,r)=>{const{id:t}=r;return Qe(Je({},e),{[t]:r})},{}))},[x]),A(()=>{if(Z){const e=gt.current;m({id:Z,loop:e,playImmediately:!0})}else m({})},[Z]);const je=()=>{var e,r;c.current.clipConfigurable?(!S&&n.current&&((e=n.current)==null||e.enableDragSelection({slop:5})),W()):((r=n.current)==null||r.disableDragSelection(),te()),ee()},ee=()=>{var e,r,t,o,l;let s="";c.current.clipConfigurable?s=br(c.current.selectedAttribute,(e=c.current.clipAttributeList)!=null?e:[]):s="transparent",((t=(r=n==null?void 0:n.current)==null?void 0:r.cursor)==null?void 0:t.cursor)&&((l=(o=n==null?void 0:n.current)==null?void 0:o.cursor)==null||l.setStyle({border:`2px dashed ${s}`}))},I=e=>{var r,t,o;return((o=(t=(r=n.current)==null?void 0:r.regions)==null?void 0:t.list)!=null?o:{})[e]},xe=()=>{var e,r;if(O){const t=((r=(e=ve==null?void 0:ve.split("."))==null?void 0:e.pop())==null?void 0:r.toLowerCase())==="pcm";ye(!1),t?Kt(O).then(o=>{De(o)}):De(O)}},De=e=>{var r;e&&(be(!0),V(0),_e(0),(r=n==null?void 0:n.current)==null||r.load(e))},te=()=>{var e;(e=n.current)==null||e.clearRegions()},re=e=>{const r=I(e);r&&(Q(!1),r==null||r.remove(),L==null||L(e),m({}))},{run:Me}=vr(m,{wait:500});Sr({sortByStartRegions:Re,setSelectedRegion:m});const Ct=e=>{const{start:r,end:t}=Se.current;return(r||t)&&e.update(Se.current),e},Rt=({action:e,id:r,eventDownTime:t})=>{var o,l;if(!c.current.clipConfigurable)return;r&&m({id:r});const s=I((r!=null?r:(o=c.current.selectedRegion)==null?void 0:o.id)||""),p=[];(e==="create"?D.current:(l=D.current)==null?void 0:l.filter(v=>v.id!==s.id)).forEach(v=>{const{start:P,end:M,attribute:y}=v;y===c.current.selectedAttribute&&[P,M].forEach(T=>{p.includes(T)||p.push(T)})});const d=Er(p.sort((v,P)=>v-P),t);n.current.range=d},wt=e=>{ee(),setTimeout(()=>{Q(!1)});const r=Ct(e),{id:t,start:o,end:l}=r;m({id:t,playImmediately:!0});const s={id:t,start:U(o,3),end:U(l,3)};j==null||j(s),Ce()},Tt=()=>{const e=sr.create({container:"#waveform",waveColor:"#999",progressColor:"#999",height:nt||245,normalize:!0,cursorWidth:2,cursorColor:"white",responsive:0,hideScrollbar:!0,plugins:[ar.create({regions:x,dragSelection:{slop:5},canMove:!1}),ur.create({opacity:1,customStyle:{border:"2px dashed transparent"}})]}),r=()=>{var t;V(((t=n==null?void 0:n.current)==null?void 0:t.getCurrentTime())||0)};e.on("ready",()=>{var t;const o=((t=n==null?void 0:n.current)==null?void 0:t.getDuration())||0;_e(o),r(),a==null||a({duration:Math.round(o)}),be(!1),B(),_.on("setCurrentTimeByPosition",ne),_.on("clearRegions",te),_.on("removeRegionById",re),_.on("setSelectedRegion",Me),e.on("regions-eventDown",Rt),je()}),e.on("audioprocess",()=>{r()}),e.on("play",()=>{K(!0)}),e.on("pause",()=>{K(!1)}),e.on("finish",()=>{K(!1)}),e.on("seek",()=>{r()}),e.on("error",()=>{ye(!0),a==null||a({hasError:!0}),ce==null||ce()}),e.on("region-created",t=>{const{id:o,start:l,end:s}=t;if(D.current.find(E=>E.id===o))return;const p={id:o,start:U(l,3),end:U(s,3),attribute:c.current.selectedAttribute,text:""};j==null||j(p)}),e.on("region-updated",(t,o)=>{var l,s,p,E,d,v,P,M,y,T;const We=o==null?void 0:o.action;k({combined:!1,segment:!1}),We==="resize"&&((s=(l=n==null?void 0:n.current)==null?void 0:l.cursor)==null||s.setStyle({borderStyle:"solid"})),We==="drag"&&((E=(p=n==null?void 0:n.current)==null?void 0:p.cursor)==null||E.setStyle({borderColor:"transparent"}));const ie={},le=[],se={},Ft=(d=D.current)==null?void 0:d.filter(h=>h.id!==t.id),Wt=(M=(P=(v=n.current)==null?void 0:v.regions)==null?void 0:P.list)!=null?M:{};Ft.forEach(h=>{var $e,He;const{element:ae}=($e=Wt[h.id])!=null?$e:{},{start:Ht,end:Ut}=h;if(ae){const{x:Ue,width:Xt}=((He=ae.getBoundingClientRect)==null?void 0:He.call(ae))||{},Zt=Ue+Xt;[Ue,Zt].forEach((ue,qt)=>{le.includes(ue)||(le.push(ue),se[ue]=qt===0?Ht:Ut)})}});const{x:ze,width:zt}=((T=(y=t.element).getBoundingClientRect)==null?void 0:T.call(y))||{},$t=ze+zt;le.forEach(h=>{Math.abs(Ve(h,ze))<5&&(ie.start=se[h]),Math.abs(Ve(h,$t))<5&&(ie.end=se[h])}),vt(ie),Me({id:t.id}),Q(!0)}),e.on("region-update-end",t=>{wt(t)}),e.on("region-contextmenu",(t,o)=>{if(!S){if(o.preventDefault(),o.stopPropagation(),_r(o)){re(t.id);return}m({id:t.id,playImmediately:!0})}}),e.on("region-click",(t,o,l)=>{if(!S){if(o.preventDefault(),o.stopPropagation(),c.current.combined){Et(t);return}if(c.current.segment){ht(t,l);return}m({id:t.id,playImmediately:!0})}}),e.on("region-mousemove",Pt),n.current=e},At=q?i.createElement(Jt,null):i.createElement(Qt,null),ke=e=>e?`${parseFloat((e/N*100).toFixed(4))}%`:"0%",Ie=ke(C),jt=ke(he),w=()=>{if(!ge)return n==null?void 0:n.current},xt=()=>{var e;(e=w())==null||e.skipForward(tt)},Dt=()=>{var e;(e=w())==null||e.skipBackward(tt)},B=()=>{var e;(e=w())==null||e.playPause(),m({})},Be=e=>{var r;switch(e.keyCode){case X.Right:xt();break;case X.Left:Dt();break;case X.Space:e.preventDefault(),B();break;case X.Delete:if(!S){const{id:t}=((r=c.current)==null?void 0:r.selectedRegion)||{};t&&re(t)}break}},Mt=e=>{ne(e)},Le=Vt.throttle(Mt,50);let oe=!1;const Oe=()=>{oe&&(B(),oe=!1),document.removeEventListener("mousemove",Le),document.removeEventListener("mouseup",Oe)},kt=e=>{ne(e),q&&(oe=!0,B()),document.addEventListener("mousemove",Le),document.addEventListener("mouseup",Oe)},It=()=>{xe()};A(()=>(Tt(),()=>{var e;(e=n==null?void 0:n.current)==null||e.destroy(),n.current=null,_.unbindAll("setCurrentTimeByPosition"),_.unbindAll("clearRegions"),_.unbindAll("removeRegionById"),_.unbindAll("setSelectedRegion")}),[]);const Bt=e=>{var r,t,o;(r=w())==null||r.playPause(),(t=w())==null||t.setPlaybackRate(e),(o=w())==null||o.playPause()};A(()=>(document.addEventListener("keydown",Be),()=>{document.removeEventListener("keydown",Be)})),A(()=>{m({}),xe()},[O]);const Ne=e=>{var r,t,o,l;if((n==null?void 0:n.current)&&(R==null?void 0:R.current)){const s=(t=(r=n==null?void 0:n.current)==null?void 0:r.getDuration())!=null?t:0,p=(o=R==null?void 0:R.current)==null?void 0:o.getBoundingClientRect();let d=(e.clientX-p.left)/(((l=R==null?void 0:R.current)==null?void 0:l.clientWidth)||0)*s;return d>s&&(d=s),d}return 0},ne=e=>{var r;const t=Ne(e);(r=n==null?void 0:n.current)==null||r.skip(t-Ee.current),V(t)},Lt=e=>{pt(Ne(e))},Ot=N?Math.max(N-C,0):0,Nt=(u==null?void 0:u.toolName)!==et.Empty&&(u==null?void 0:u.isEdit)!==!0&&(lt==="remark"||S),Fe=i.createElement("div",{className:b.audioPlayer},mt&&!it&&i.createElement(nr,{fileTypeName:"\u97F3\u9891",ignoreOffsetY:!0,reloadImage:It,backgroundColor:"#ffffffbb"}),i.createElement(Pr,{getRegionInstanceById:I,clipping:J}),i.createElement(wr,{container:G.current}),i.createElement(Tr,{segmentTimeTip:St}),i.createElement("div",{className:b.waveformContainer,ref:G},i.createElement("div",{id:"waveform",style:{width:`${F*100}%`},className:$({[b.waveform]:!0,"bee-audio-combined":c.current.combined,"bee-audio-clip":c.current.clipConfigurable})},ot&&i.createElement(or,{isAudio:!0}),i.createElement("div",{ref:R,className:b.progress,onMouseDown:kt,onMouseMove:Lt},i.createElement("div",{className:$({[b.radioTooltip]:!0}),style:{left:Ie}},qe(C)),i.createElement("div",{className:$({[b.radioTooltip]:!0,[b.mouseTooltip]:!0}),style:{left:jt}},qe(he)),i.createElement(hr,{playPercentage:Ie})),Nt&&(me==null?void 0:me({currentTime:C,remainingTime:Ot,audioPlayer:w()})))),i.createElement("div",{className:b.controlBar},i.createElement(rr,{type:"link",icon:At,onClick:()=>{B()},className:$({[b.playButton]:!0,[b.playButtonDisabled]:ge})}),i.createElement("span",{className:b.time},`${Ke(C,"ss.SSS")} / -${Ke(N-C,"ss.SSS")}`),i.createElement(ir,{playerType:lr.Audio,onChange:e=>{Bt(e)}}),i.createElement(cr,{onChange:e=>{Te(e)},zoom:F}),i.createElement(dr,{EventBus:_})));return u?i.createElement(rt.Provider,{value:u},Fe,x.map(e=>{const{id:r}=e,t=document.querySelector(`[data-id=${r}]`);return t?i.createElement(mr,{el:t,key:r,region:e,edgeAdsorption:Pe,clipping:J,zoom:F,instance:I(r)}):null}),i.createElement(Ar,{footer:ct})):Fe};export{Ir as AudioPlayer,rt as AudioPlayerContext};
|
|
1
|
+
import i,{useState as g,useRef as z,useEffect as A}from"react";import{getWebPcm2WavBase64 as Gt}from"../audioAnnotate/utils/getWebPcm2Wac.js";import Yt,{debounce as Jt,sortBy as Qt}from"lodash";import{PauseOutlined as er,CaretRightOutlined as tr}from"@ant-design/icons";import{cKeyCode as rr,cTool as or,EventBus as E,TagUtils as nr}from"@labelbee/lb-annotation";import{Button as ir}from"antd";import lr from"../invalidPage/index.js";import sr from"../imageError/index.js";import{classnames as $}from"../../utils/index.js";import ar,{EPlayerType as ur}from"../videoPlayer/components/SpeedController/index.js";import cr from"@labelbee/wavesurfer";import dr from"@labelbee/wavesurfer/dist/plugin/wavesurfer.regions.js";import mr from"@labelbee/wavesurfer/dist/plugin/wavesurfer.cursor.js";import pr,{audioZoomInfo as Xe}from"./zoomSlider/index.js";import fr from"./labelDisplayToggle/index.js";import vr from"./clipRegion/index.js";import{useAudioClipStore as gr}from"../audioAnnotate/audioContext/index.js";import{useLatest as H,useUpdate as br,useDeepCompareEffect as Ze,useThrottleFn as yr}from"ahooks";import _r from"./useAudioScroll/index.js";import b from"./index.module.scss.js";import{getAttributeColor as Er,formatTime as qe,timeFormat as Ke,dispatchResizeEvent as hr,precisionMinus as Ve,isDoubleClick as Cr,getCanMoveRange as Sr}from"../../utils/audio.js";import Pr from"./progressDot/index.js";import Rr from"./clipTip/index.js";import wr from"./useSwitchHotkey/index.js";import Tr from"./useAudioCombine/index.js";import Ar from"./useAudioSegment/index.js";import jr from"./combineTip/index.js";import xr from"./segmentTip/index.js";import Dr from"../../views/MainView/toolFooter/index.js";import{decimalReserved as U}from"../videoPlayer/utils.js";var Mr=Object.defineProperty,kr=Object.defineProperties,Ir=Object.getOwnPropertyDescriptors,Ge=Object.getOwnPropertySymbols,Br=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable,Ye=(f,u,c)=>u in f?Mr(f,u,{enumerable:!0,configurable:!0,writable:!0,value:c}):f[u]=c,Je=(f,u)=>{for(var c in u||(u={}))Br.call(u,c)&&Ye(f,c,u[c]);if(Ge)for(var c of Ge(u))Lr.call(u,c)&&Ye(f,c,u[c]);return f},Qe=(f,u)=>kr(f,Ir(u));const{EToolName:et}=or,X=rr.default,tt=.1,rt=i.createContext({count:0,isEdit:!1,toolName:et.Empty,imgIndex:0}),Or=({fileData:f={},onLoaded:u,context:c,invalid:ot,height:nt,hideError:it,onError:ce,updateRegion:j,removeRegion:L,regions:x=[],activeToolPanel:lt,clipConfigurable:st,clipTextConfigurable:at,clipAttributeList:ut,clipAttributeConfigurable:de,secondaryAttributeConfigurable:ct,subAttributeList:dt,isCheck:S,hoverRegionId:Z,footer:mt,drawLayerSlot:me})=>{var pe,fe;const{url:O,path:ve}=f,[q,K]=g(!1),[ge,be]=g(!1),[P,pt]=g(0),[ft,ye]=g(!1),[N,_e]=g(0),n=z(null),R=z(null),Ee=z(P),V=e=>{Ee.current=e,pt(e)},[he,vt]=g(0),[F,gt]=g(1),G=z(null),[Ce,bt]=g({}),{audioClipState:Y,setAudioClipState:k}=gr(),[J,Q]=g(!1),d=H(Y),Se=H(Ce),yt=H(q),D=H(x),Pe=br(),[Re,_t]=g([]),[we,Et]=g({}),ht=Jt(()=>{E.emit("audioZoom")},500),Te=e=>{e<Xe.min||e>Xe.max||(gt(e),hr(),ht())};_r({container:G.current,target:document.querySelector(`[data-id=${(fe=(pe=d.current)==null?void 0:pe.selectedRegion)==null?void 0:fe.id}]`),clipping:J,zoom:F,zoomHandler:Te});const W=()=>{let e=D.current;const{attributeLockList:r}=d.current;r.length&&(e=e.filter(t=>r.includes(t.attribute))),te(),e.forEach(t=>{var o;(o=n.current)==null||o.addRegion(Qe(Je({},t),{drag:!S,resize:!S,color:"rgba(0, 0, 0, 0)"}))}),Pe()},m=e=>{var r,t,o,l,s,p,y;const{id:a,loop:v=!0,playImmediately:C=!1}=e;if(a){const M=(o=(t=(r=n.current)==null?void 0:r.regions)==null?void 0:t.list)!=null?o:{};Object.entries(M).forEach(([,_])=>{const{id:T}=_;a===T?_.select():_.cancelSelect()}),k({selectedRegion:{id:a,loop:v},selectedAttribute:(p=(s=(l=D.current)==null?void 0:l.find(_=>_.id===a))==null?void 0:s.attribute)!=null?p:""}),v&&C&&((y=I(a))==null||y.playLoop())}else k({selectedRegion:{}})},{combineInstance:Ct}=Tr({waveRef:n,sortByStartRegions:Re,regionMap:we,updateRegion:j,removeRegion:L,generateRegions:W,setSelectedRegion:m}),{segmentInstance:St,onRegionMouseMove:Pt,segmentTimeTip:Rt}=Ar({waveRef:n,regionMap:we,updateRegion:j,removeRegion:L,generateRegions:W,setSelectedRegion:m}),Ae={clipTextConfigurable:at,clipAttributeList:ut,clipAttributeConfigurable:de,clipConfigurable:st,secondaryAttributeConfigurable:ct,subAttributeList:dt};A(()=>{k({selectedAttribute:""})},[de]),A(()=>{ee()},[Y.selectedAttribute]),A(()=>{W()},[Y.attributeLockList]),Ze(()=>{k(Ae),setTimeout(()=>{je()})},[Ae]),Ze(()=>{_t(Qt(x,["start"])),Et(x.reduce((e,r)=>{const{id:t}=r;return Qe(Je({},e),{[t]:r})},{}))},[x]),A(()=>{if(Z){const e=yt.current;m({id:Z,loop:e,playImmediately:!0})}else m({})},[Z]);const je=()=>{var e,r;d.current.clipConfigurable?(!S&&n.current&&((e=n.current)==null||e.enableDragSelection({slop:5})),W()):((r=n.current)==null||r.disableDragSelection(),te()),ee()},ee=()=>{var e,r,t,o,l;let s="";d.current.clipConfigurable?s=Er(d.current.selectedAttribute,(e=d.current.clipAttributeList)!=null?e:[]):s="transparent",((t=(r=n==null?void 0:n.current)==null?void 0:r.cursor)==null?void 0:t.cursor)&&((l=(o=n==null?void 0:n.current)==null?void 0:o.cursor)==null||l.setStyle({border:`2px dashed ${s}`}))},I=e=>{var r,t,o;return((o=(t=(r=n.current)==null?void 0:r.regions)==null?void 0:t.list)!=null?o:{})[e]},xe=()=>{var e,r;if(O){const t=((r=(e=ve==null?void 0:ve.split("."))==null?void 0:e.pop())==null?void 0:r.toLowerCase())==="pcm";ye(!1),t?Gt(O).then(o=>{De(o)}):De(O)}},De=e=>{var r;e&&(be(!0),V(0),_e(0),(r=n==null?void 0:n.current)==null||r.load(e))},te=()=>{var e;(e=n.current)==null||e.clearRegions()},re=e=>{const r=I(e);r&&(Q(!1),r==null||r.remove(),L==null||L(e),m({}))},{run:Me}=yr(m,{wait:500});wr({sortByStartRegions:Re,setSelectedRegion:m});const wt=e=>{const{start:r,end:t}=Se.current;return(r||t)&&e.update(Se.current),e},Tt=({action:e,id:r,eventDownTime:t})=>{var o,l;if(!d.current.clipConfigurable)return;r&&m({id:r});const s=I((r!=null?r:(o=d.current.selectedRegion)==null?void 0:o.id)||""),p=[];(e==="create"?D.current:(l=D.current)==null?void 0:l.filter(v=>v.id!==s.id)).forEach(v=>{const{start:C,end:M,attribute:_}=v;_===d.current.selectedAttribute&&[C,M].forEach(T=>{p.includes(T)||p.push(T)})});const a=Sr(p.sort((v,C)=>v-C),t);n.current.range=a},At=e=>{ee(),setTimeout(()=>{Q(!1)});const r=wt(e),{id:t,start:o,end:l}=r;m({id:t,playImmediately:!0});const s={id:t,start:U(o,3),end:U(l,3)};j==null||j(s),Pe()},jt=()=>{const e=cr.create({container:"#waveform",waveColor:"#999",progressColor:"#999",height:nt||245,normalize:!0,cursorWidth:2,cursorColor:"white",responsive:0,hideScrollbar:!0,plugins:[dr.create({regions:x,dragSelection:{slop:5},canMove:!1}),mr.create({opacity:1,customStyle:{border:"2px dashed transparent"}})]}),r=()=>{var t;V(((t=n==null?void 0:n.current)==null?void 0:t.getCurrentTime())||0)};e.on("ready",()=>{var t;const o=((t=n==null?void 0:n.current)==null?void 0:t.getDuration())||0;_e(o),r(),u==null||u({duration:Math.round(o)}),be(!1),B(),E.on("setCurrentTimeByPosition",ne),E.on("clearRegions",te),E.on("removeRegionById",re),E.on("setSelectedRegion",Me),e.on("regions-eventDown",Tt),je()}),e.on("audioprocess",()=>{r()}),e.on("play",()=>{K(!0)}),e.on("pause",()=>{K(!1)}),e.on("finish",()=>{K(!1)}),e.on("seek",()=>{r()}),e.on("error",()=>{ye(!0),u==null||u({hasError:!0}),ce==null||ce()}),e.on("region-created",t=>{var o;const{id:l,start:s,end:p}=t;if(D.current.find(a=>a.id===l))return;const y={id:l,start:U(s,3),end:U(p,3),attribute:d.current.selectedAttribute,text:""};if(d.current.secondaryAttributeConfigurable){const a=nr.getDefaultResultByConfig((o=d.current.subAttributeList)!=null?o:[]);y.subAttribute=a!=null?a:{}}j==null||j(y)}),e.on("region-updated",(t,o)=>{var l,s,p,y,a,v,C,M,_,T;const We=o==null?void 0:o.action;k({combined:!1,segment:!1}),We==="resize"&&((s=(l=n==null?void 0:n.current)==null?void 0:l.cursor)==null||s.setStyle({borderStyle:"solid"})),We==="drag"&&((y=(p=n==null?void 0:n.current)==null?void 0:p.cursor)==null||y.setStyle({borderColor:"transparent"}));const ie={},le=[],se={},zt=(a=D.current)==null?void 0:a.filter(h=>h.id!==t.id),$t=(M=(C=(v=n.current)==null?void 0:v.regions)==null?void 0:C.list)!=null?M:{};zt.forEach(h=>{var $e,He;const{element:ae}=($e=$t[h.id])!=null?$e:{},{start:Xt,end:Zt}=h;if(ae){const{x:Ue,width:qt}=((He=ae.getBoundingClientRect)==null?void 0:He.call(ae))||{},Kt=Ue+qt;[Ue,Kt].forEach((ue,Vt)=>{le.includes(ue)||(le.push(ue),se[ue]=Vt===0?Xt:Zt)})}});const{x:ze,width:Ht}=((T=(_=t.element).getBoundingClientRect)==null?void 0:T.call(_))||{},Ut=ze+Ht;le.forEach(h=>{Math.abs(Ve(h,ze))<5&&(ie.start=se[h]),Math.abs(Ve(h,Ut))<5&&(ie.end=se[h])}),bt(ie),Me({id:t.id}),Q(!0)}),e.on("region-update-end",t=>{At(t)}),e.on("region-contextmenu",(t,o)=>{if(!S){if(o.preventDefault(),o.stopPropagation(),Cr(o)){re(t.id);return}m({id:t.id,playImmediately:!0})}}),e.on("region-click",(t,o,l)=>{if(!S){if(o.preventDefault(),o.stopPropagation(),d.current.combined){Ct(t);return}if(d.current.segment){St(t,l);return}m({id:t.id,playImmediately:!0})}}),e.on("region-mousemove",Pt),n.current=e},xt=q?i.createElement(er,null):i.createElement(tr,null),ke=e=>e?`${parseFloat((e/N*100).toFixed(4))}%`:"0%",Ie=ke(P),Dt=ke(he),w=()=>{if(!ge)return n==null?void 0:n.current},Mt=()=>{var e;(e=w())==null||e.skipForward(tt)},kt=()=>{var e;(e=w())==null||e.skipBackward(tt)},B=()=>{var e;(e=w())==null||e.playPause(),m({})},Be=e=>{var r;switch(e.keyCode){case X.Right:Mt();break;case X.Left:kt();break;case X.Space:e.preventDefault(),B();break;case X.Delete:if(!S){const{id:t}=((r=d.current)==null?void 0:r.selectedRegion)||{};t&&re(t)}break}},It=e=>{ne(e)},Le=Yt.throttle(It,50);let oe=!1;const Oe=()=>{oe&&(B(),oe=!1),document.removeEventListener("mousemove",Le),document.removeEventListener("mouseup",Oe)},Bt=e=>{ne(e),q&&(oe=!0,B()),document.addEventListener("mousemove",Le),document.addEventListener("mouseup",Oe)},Lt=()=>{xe()};A(()=>(jt(),()=>{var e;(e=n==null?void 0:n.current)==null||e.destroy(),n.current=null,E.unbindAll("setCurrentTimeByPosition"),E.unbindAll("clearRegions"),E.unbindAll("removeRegionById"),E.unbindAll("setSelectedRegion")}),[]);const Ot=e=>{var r,t,o;(r=w())==null||r.playPause(),(t=w())==null||t.setPlaybackRate(e),(o=w())==null||o.playPause()};A(()=>(document.addEventListener("keydown",Be),()=>{document.removeEventListener("keydown",Be)})),A(()=>{m({}),xe()},[O]);const Ne=e=>{var r,t,o,l;if((n==null?void 0:n.current)&&(R==null?void 0:R.current)){const s=(t=(r=n==null?void 0:n.current)==null?void 0:r.getDuration())!=null?t:0,p=(o=R==null?void 0:R.current)==null?void 0:o.getBoundingClientRect();let a=(e.clientX-p.left)/(((l=R==null?void 0:R.current)==null?void 0:l.clientWidth)||0)*s;return a>s&&(a=s),a}return 0},ne=e=>{var r;const t=Ne(e);(r=n==null?void 0:n.current)==null||r.skip(t-Ee.current),V(t)},Nt=e=>{vt(Ne(e))},Ft=N?Math.max(N-P,0):0,Wt=(c==null?void 0:c.toolName)!==et.Empty&&(c==null?void 0:c.isEdit)!==!0&&(lt==="remark"||S),Fe=i.createElement("div",{className:b.audioPlayer},ft&&!it&&i.createElement(sr,{fileTypeName:"\u97F3\u9891",ignoreOffsetY:!0,reloadImage:Lt,backgroundColor:"#ffffffbb"}),i.createElement(Rr,{getRegionInstanceById:I,clipping:J}),i.createElement(jr,{container:G.current}),i.createElement(xr,{segmentTimeTip:Rt}),i.createElement("div",{className:b.waveformContainer,ref:G},i.createElement("div",{id:"waveform",style:{width:`${F*100}%`},className:$({[b.waveform]:!0,"bee-audio-combined":d.current.combined,"bee-audio-clip":d.current.clipConfigurable})},ot&&i.createElement(lr,{isAudio:!0}),i.createElement("div",{ref:R,className:b.progress,onMouseDown:Bt,onMouseMove:Nt},i.createElement("div",{className:$({[b.radioTooltip]:!0}),style:{left:Ie}},qe(P)),i.createElement("div",{className:$({[b.radioTooltip]:!0,[b.mouseTooltip]:!0}),style:{left:Dt}},qe(he)),i.createElement(Pr,{playPercentage:Ie})),Wt&&(me==null?void 0:me({currentTime:P,remainingTime:Ft,audioPlayer:w()})))),i.createElement("div",{className:b.controlBar},i.createElement(ir,{type:"link",icon:xt,onClick:()=>{B()},className:$({[b.playButton]:!0,[b.playButtonDisabled]:ge})}),i.createElement("span",{className:b.time},`${Ke(P,"ss.SSS")} / -${Ke(N-P,"ss.SSS")}`),i.createElement(ar,{playerType:ur.Audio,onChange:e=>{Ot(e)}}),i.createElement(pr,{onChange:e=>{Te(e)},zoom:F}),i.createElement(fr,{EventBus:E})));return c?i.createElement(rt.Provider,{value:c},Fe,x.map(e=>{const{id:r}=e,t=document.querySelector(`[data-id=${r}]`);return t?i.createElement(vr,{el:t,key:r,region:e,edgeAdsorption:Ce,clipping:J,zoom:F,instance:I(r)}):null}),i.createElement(Dr,{footer:mt})):Fe};export{Or as AudioPlayer,rt as AudioPlayerContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import l,{forwardRef as h,useRef as E,useMemo as S}from"react";import{Tooltip as T,Popover as x}from"antd";import{useSize as j}from"ahooks";import{prefix as L}from"../../constant/index.js";import{SearchOutlined as C}from"@ant-design/icons";var M=Object.defineProperty,N=Object.defineProperties,R=Object.getOwnPropertyDescriptors,p=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,b=(t,e,r)=>e in t?M(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,c=(t,e)=>{for(var r in e||(e={}))g.call(e,r)&&b(t,r,e[r]);if(p)for(var r of p(e))P.call(e,r)&&b(t,r,e[r]);return t},W=(t,e)=>N(t,R(e)),$=(t,e)=>{var r={};for(var n in t)g.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&p)for(var n of p(t))e.indexOf(n)<0&&P.call(t,n)&&(r[n]=t[n]);return r};const u=`${L}-longText`,_=h((t,e)=>{var r=t,{text:n,overflowMaxLines:f,style:i}=r,v=$(r,["text","overflowMaxLines","style"]);const a={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},o={display:"-webkit-box",WebkitLineClamp:f,WebkitBoxOrient:"vertical",overflow:"hidden"},m=f>1?o:a;return l.createElement("div",c({style:c(c({},m),i),ref:e},v),n)}),k=t=>{const{text:e,placement:r="bottom",icon:n=l.createElement(C,null),openByText:f,style:i,isToolTips:v,overflowMaxLines:a=1}=t,o=E(null),m=j(o),d=S(()=>{var s,y,O,w;return a>1?o.current&&((s=o.current)==null?void 0:s.clientHeight)<((y=o.current)==null?void 0:y.scrollHeight):o.current&&((O=o.current)==null?void 0:O.clientWidth)<((w=o.current)==null?void 0:w.scrollWidth)},[m]);if(f){let s={placement:r,overlayClassName:`${u}-popover`,content:e,key:`${d}`};return d||Object.assign(s,{open:!1}),v?l.createElement(T,W(c({},s),{title:e}),l.createElement(_,{overflowMaxLines:a,style:i,ref:o,text:e})):l.createElement(x,c({},s),l.createElement(_,{overflowMaxLines:a,style:i,ref:o,text:e}))}return l.createElement("div",{className:u,style:i},l.createElement(_,{overflowMaxLines:a,style:i,ref:o,text:e}),d&&l.createElement(x,{placement:r,overlayClassName:`${u}-popover`,content:e},n))};export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useLatest as
|
|
1
|
+
import{useLatest as S}from"ahooks";import{Spin as H,message as K}from"antd/es";import P,{useContext as Q,useRef as j,useState as W,useMemo as X,useCallback as Y,useEffect as u}from"react";import{connect as Z}from"react-redux";import{useTranslation as ee}from"react-i18next";import{usePointCloudViews as te}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as re}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as ne}from"../../store/annotation/map.js";import{LabelBeeContext as oe}from"../../store/ctx.js";import{PointCloud2DRectOperation as ie,ImgUtils as ae}from"@labelbee/lb-annotation";var ce=Object.defineProperty,le=Object.defineProperties,ue=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,se=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable,E=(c,i,r)=>i in c?ce(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,s=(c,i)=>{for(var r in i||(i={}))se.call(i,r)&&E(c,r,i[r]);if(B)for(var r of B(i))de.call(i,r)&&E(c,r,i[r]);return c},d=(c,i)=>le(c,ue(i));const pe=c=>{var i;const{mappingData:r,size:p,config:v,checkMode:A,afterImgOnLoad:N}=c,_=(i=r==null?void 0:r.url)!=null?i:"",{t:U}=ee(),{pointCloudBoxList:f,setPointCloudResult:k,defaultAttribute:R,rectList:g,addRectIn2DView:M,updateRectIn2DView:C,removeRectIn2DView:z}=Q(re),{update2DViewRect:F}=te(),b=P.useRef(null),t=j(null),I=S(F),O=j(null),[T,h]=W(!0),D=X(()=>g==null?void 0:g.filter(e=>e.imageName===(r==null?void 0:r.path)),[r==null?void 0:r.path,g]),m=S(r==null?void 0:r.path),x=e=>{var n;const{boxID:o}=e;if(o){const a=(n=I.current)==null?void 0:n.call(I,e);O.current=a,k(a);return}C(e)},L=e=>{m.current&&M(d(s({},e),{imageName:m.current}))},y=e=>{e.some(o=>o.boxID)&&K.warning(U("ProjectionFrameCannotBeDeleted")),z(e)},J=Y(()=>{let e=[];return f.forEach(n=>{const{rects:o=[],id:a,attribute:l,trackID:$}=n,V=o.find(G=>G.imageName===m.current),q=a+"_"+m.current;V&&(e=[...e,d(s({},V),{boxID:a,id:q,attribute:l,order:$})])}),e},[f]),w=()=>{var e,n,o;const a=J(),l=(e=t.current)==null?void 0:e.selectedRectID;(n=t.current)==null||n.setResult([...a,...D]),l&&((o=t.current)==null||o.setSelectedRectID(l))};return u(()=>{if(b.current){const e=new ie({container:b.current,size:p,config:d(s({},v),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:A});return t.current=e,t.current.init(),t.current.on("updateDragResult",x),t.current.on("afterAddingDrawingRect",L),t.current.on("deleteSelectedRects",y),()=>{var n,o,a,l;(n=t.current)==null||n.unbind("updateDragResult",x),(o=t.current)==null||o.unbind("afterAddingDrawingRect",L),(a=t.current)==null||a.unbind("deleteSelectedRects",y),(l=t.current)==null||l.destroy()}}},[]),u(()=>{h(!0),t.current&&_&&ae.load(_).then(e=>{t.current.setImgNode(e),N(e),h(!1)})},[_]),u(()=>{var e;(e=t.current)==null||e.setSize(p)},[p]),u(()=>{f!==O.current&&w()},[f]),u(()=>{var e,n,o;const a=D.find(l=>l.id===t.current.selectedRectID);(n=(e=t.current)==null?void 0:e.setDefaultAttribute)==null||n.call(e,R),a&&C(d(s({},(o=t.current)==null?void 0:o.selectedRect),{attribute:R})),w()},[R]),u(()=>{w()},[D]),u(()=>{var e,n,o,a;const l=(n=(e=t.current)==null?void 0:e.config)!=null?n:{};(a=t.current)==null||a.setConfig(JSON.stringify(d(s({},l),{attributeList:(o=v.attributeList)!=null?o:[]})))},[v.attributeList]),P.createElement(H,{spinning:T},P.createElement("div",{ref:b,style:s({position:"relative"},p)}))};var fe=Z(ne,null,null,{context:oe})(pe);export{fe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as
|
|
1
|
+
import{getClassName as Q}from"../../utils/dom.js";import i,{useState as L,useContext as ue,useEffect as U}from"react";import{PointCloudContainer as ae}from"./PointCloudLayout.js";import{PointCloudContext as ce}from"./PointCloudContext.js";import{connect as de}from"react-redux";import{cKeyCode as me,pointCloudLidar2image as fe,pointListLidar2Img as pe}from"@labelbee/lb-annotation";import{LabelBeeContext as ge}from"../../store/ctx.js";import{a2MapStateToProps as ve}from"../../store/annotation/map.js";import{toolStyleConverter as W}from"@labelbee/lb-utils";import be from"./PointCloud2DSingleView.js";import X from"./components/TitleButton/index.js";import{LeftOutlined as ye}from"@ant-design/icons";import Ee from"classnames";import he from"../../assets/annotation/common/icon_esc.svg.js";import _e from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import we from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";import{isNumber as Ce}from"lodash";import{getBoundingRect as Pe,isBoundingRectInImage as Le}from"../../utils/index.js";var xe=Object.defineProperty,Ie=Object.defineProperties,Fe=Object.getOwnPropertyDescriptors,Y=Object.getOwnPropertySymbols,ke=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,Z=(e,n,o)=>n in e?xe(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,m=(e,n)=>{for(var o in n||(n={}))ke.call(n,o)&&Z(e,o,n[o]);if(Y)for(var o of Y(n))Oe.call(n,o)&&Z(e,o,n[o]);return e},f=(e,n)=>Ie(e,Fe(n));const j=me.default,je=({showEnlarge:e,isEnlargeTopView:n,data:o,setIsEnlarge:y,setCurIndex:g,curIndex:E=0,index:x,annotations2d:h})=>n?i.createElement(X,{title:o==null?void 0:o.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?i.createElement("div",{style:{display:"flex",alignItems:"center"}},i.createElement(ye,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{y(!1),g(void 0)}}),i.createElement("span",null,o==null?void 0:o.calName),i.createElement("span",{style:{marginLeft:"8px"}},E+1,"/",h==null?void 0:h.length)):i.createElement(X,{title:o==null?void 0:o.calName,onClick:()=>{y(!0),g(x)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),Ne=({currentData:e,config:n,thumbnailWidth:o,isEnlargeTopView:y,highlightAttribute:g,loadPCDFileLoading:E,checkMode:x,measureVisible:h})=>{var N;const[p,D]=L([]),{topViewInstance:ee,displayPointCloudList:R,polygonList:S,imageSizes:I,selectedIDs:V}=ue(ce),[F,te]=L(""),[_,k]=L(!1),[u,w]=L(void 0);U(()=>{var l;if(!E&&ee&&(e==null?void 0:e.mappingImgList)&&((l=e==null?void 0:e.mappingImgList)==null?void 0:l.length)>0){const r={fill:"transparent",color:"green"};let s=[];e==null||e.mappingImgList.forEach(t=>{var v,K,$;const q=R.reduce((c,d)=>{var b,a;const C=d.id===F||g===d.attribute,{transferViewData:O,viewRangePointList:P}=(b=fe(d,t.calib,{createRange:C}))!=null?b:{};if(!O||!P)return[];const le=O.reduce((G,J)=>J.type==="line"?[...G,...J.pointList]:G,[]),re=f(m({},Pe(le)),{imageName:t.path});if(!Le(re,t.path,I))return c;const B=(a=W.getColorFromConfig({attribute:d.attribute},f(m({},n),{attributeConfigurable:!0}),{}))==null?void 0:a.stroke,se=oe({viewDataPointList:O,pointCloudBox:d,defaultViewStyle:r,stroke:B}),M=[...c,...se];return(P==null?void 0:P.length)>0&&M.unshift({type:"polygon",annotation:f(m({id:F,pointList:P},r),{stroke:B,fill:"rgba(255, 255, 255, 0.6)"})}),M},[]),H=I[(v=t==null?void 0:t.path)!=null?v:""];H&&Ce((K=t==null?void 0:t.calib)==null?void 0:K.groundHeight)&&S.forEach(c=>{const d=c.pointList.map(a=>{var C;return f(m({},a),{z:(C=t==null?void 0:t.calib)==null?void 0:C.groundHeight})}),b=pe(d,t==null?void 0:t.calib,H);if(b){const a=W.getColorFromConfig({attribute:c.attribute},f(m({},n),{attributeConfigurable:!0}),{});q.push({type:"polygon",annotation:f(m({id:c.id,pointList:b},r),{stroke:a==null?void 0:a.stroke,fill:V.includes(c.id)?a==null?void 0:a.fill:"rgba(255, 255, 255, 0.6)"})})}}),s.push({annotations:q,url:t==null?void 0:t.url,calName:($=t==null?void 0:t.calib)==null?void 0:$.calName,calib:t==null?void 0:t.calib,path:t==null?void 0:t.path})}),D(s)}},[R,e==null?void 0:e.mappingImgList,F,g,E,S,I,V]),U(()=>(window.addEventListener("keydown",A),()=>{window.removeEventListener("keydown",A)}),[u]);const A=l=>{const{keyCode:r}=l;switch(r){case j.Esc:_&&k(!1);break;case j.Left:z();break;case j.Right:T();break}},z=()=>{u===void 0||!_||Number(u)>0&&w(u-1)},T=()=>{u===void 0||!_||Number(u)<(p==null?void 0:p.length)-1&&w(u+1)},oe=({viewDataPointList:l,pointCloudBox:r,defaultViewStyle:s,stroke:t})=>l?l.map(v=>({type:v.type,annotation:f(m({id:r.id,pointList:v.pointList},s),{stroke:t})})):[],ne=!e||!(e==null?void 0:e.mappingImgList)||!(((N=e==null?void 0:e.mappingImgList)==null?void 0:N.length)>0),ie=i.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},i.createElement("img",{src:_e,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>z()}),i.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),i.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),i.createElement("img",{src:we,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>T()}),i.createElement("img",{src:he,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{k(!1),w(void 0)}}),i.createElement("span",null,"\u952E\u9000\u51FA"));return(p==null?void 0:p.length)>0?i.createElement(i.Fragment,null,p.map((l,r)=>{const s=_&&r===u;return i.createElement(ae,{className:Ee({[Q("point-cloud-2d-container")]:!0,[Q("point-cloud-container","zoom")]:s}),title:i.createElement(je,{showEnlarge:s,isEnlargeTopView:y,data:l,setIsEnlarge:k,setCurIndex:w,curIndex:u,index:r,annotations2d:p}),titleOnSurface:!s,style:{display:ne?"none":"flex",width:s?"100%":o},key:r,toolbar:ie},(l==null?void 0:l.annotations)&&(l==null?void 0:l.url)&&i.createElement(be,{currentData:e,view2dData:l,setSelectedID:te,showEnlarge:s,checkMode:x,measureVisible:h}))})):null};var Re=de(ve,null,null,{context:ge})(Ne);export{Re as default};
|