@labelbee/lb-components 1.24.0-alpha.1 → 1.24.0-alpha.10
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/_virtual/2DViewWorker.js +1 -1
- package/dist/assets/annotation/rectTool/three_points_rect.svg.js +1 -0
- package/dist/assets/annotation/rectTool/two_points_rect.svg.js +1 -0
- package/dist/components/LLMMultiWheelView/index.js +1 -1
- package/dist/components/LLMMultiWheelView/sidebar/index.js +1 -1
- package/dist/components/attributeList/index.js +1 -1
- package/dist/components/audioAnnotate/index.js +1 -1
- package/dist/components/audioAnnotate/textInput/index.js +1 -1
- package/dist/components/audioAnnotate/textInput/index.module.scss.js +1 -1
- package/dist/components/audioPlayer/index.js +1 -1
- package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
- package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
- package/dist/components/pointCloudView/PointCloudListener.js +1 -1
- package/dist/components/pointCloudView/components/UnifyParamsModal/index.js +1 -1
- package/dist/components/pointCloudView/hooks/usePointCloudAttribute.js +1 -0
- package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/dist/components/pointCloudView/hooks/useUpdatePointCloudColor.js +1 -1
- package/dist/components/pointCloudView/index.js +1 -1
- package/dist/index.css +18 -0
- package/dist/store/annotation/actionCreators.js +1 -1
- package/dist/store/annotation/reducer.js +1 -1
- package/dist/types/components/pointCloudView/hooks/usePointCloudAttribute.d.ts +3 -0
- package/dist/types/store/annotation/actionCreators.d.ts +1 -1
- package/dist/types/store/annotation/map.d.ts +1 -0
- package/dist/types/store/annotation/reducer.d.ts +4 -0
- package/dist/types/store/annotation/types.d.ts +3 -2
- package/dist/views/MainView/LLMMultiWheelLayout/index.js +1 -1
- package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/dist/views/MainView/sidebar/ToolIcons.js +1 -1
- package/es/_virtual/2DViewWorker.js +1 -1
- package/es/assets/annotation/rectTool/three_points_rect.svg.js +1 -0
- package/es/assets/annotation/rectTool/two_points_rect.svg.js +1 -0
- package/es/components/LLMMultiWheelView/index.js +1 -1
- package/es/components/LLMMultiWheelView/sidebar/index.js +1 -1
- package/es/components/attributeList/index.js +1 -1
- package/es/components/audioAnnotate/index.js +1 -1
- package/es/components/audioAnnotate/textInput/index.js +1 -1
- package/es/components/audioAnnotate/textInput/index.module.scss.js +1 -1
- package/es/components/audioPlayer/index.js +1 -1
- package/es/components/pointCloud2DRectOperationView/index.js +1 -1
- package/es/components/pointCloudView/PointCloud3DView.js +1 -1
- package/es/components/pointCloudView/PointCloudListener.js +1 -1
- package/es/components/pointCloudView/components/UnifyParamsModal/index.js +1 -1
- package/es/components/pointCloudView/hooks/usePointCloudAttribute.js +1 -0
- package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/es/components/pointCloudView/hooks/useUpdatePointCloudColor.js +1 -1
- package/es/components/pointCloudView/index.js +1 -1
- package/es/index.css +18 -0
- package/es/store/annotation/actionCreators.js +1 -1
- package/es/store/annotation/reducer.js +1 -1
- package/es/views/MainView/LLMMultiWheelLayout/index.js +1 -1
- package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
- package/es/views/MainView/sidebar/ToolIcons.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as t from"react";var l,o,v,c,m,z;function a(){return a=Object.assign?Object.assign.bind():function(h){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(h[n]=r[n])}return h},a.apply(null,arguments)}var i=function(e){return t.createElement("svg",a({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none"},e),l||(l=t.createElement("path",{fill:"currentColor",d:"M17 5h-1.571V3H17zm-3.143 0h-1.571V3h1.571zm-3.143 0H9.143V3h1.571zM7.571 5H6V3h1.571z"})),o||(o=t.createElement("path",{fill:"currentColor",d:"M17 17h-2v-2h2zm0-4h-2v-2h2zm0-4h-2V7h2zm0-4h-2V3h2z"})),v||(v=t.createElement("path",{fill:"currentColor",d:"M17 17h-1.571v-2H17zm-3.143 0h-1.571v-2h1.571zm-3.143 0H9.143v-2h1.571zm-3.143 0H6v-2h1.571zM6 2H2v4h4zM18 2h-4v4h4zM6 14H2v4h4z"})),c||(c=t.createElement("path",{fill:"currentColor",d:"M18 14h-4v4h4z"})),m||(m=t.createElement("path",{fill:"#fff",d:"M5 6H3v9h2z"})),z||(z=t.createElement("path",{fill:"currentColor",d:"M3 6h2v9H3zM15 3v2H5V3zM15 15v2H5v-2zM15 6h2v9h-2z"})))};export{i as ReactComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as t from"react";var l,o,v,c;function a(){return a=Object.assign?Object.assign.bind():function(h){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(h[n]=r[n])}return h},a.apply(null,arguments)}var m=function(e){return t.createElement("svg",a({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none"},e),l||(l=t.createElement("path",{fill:"currentColor",d:"M17 5h-1.571V3H17zm-3.143 0h-1.571V3h1.571zm-3.143 0H9.143V3h1.571zM7.571 5H6V3h1.571z"})),o||(o=t.createElement("path",{fill:"currentColor",d:"M17 17h-2v-2h2zm0-4h-2v-2h2zm0-4h-2V7h2zm0-4h-2V3h2z"})),v||(v=t.createElement("path",{fill:"currentColor",d:"M17 17h-1.571v-2H17zm-3.143 0h-1.571v-2h1.571zm-3.143 0H9.143v-2h1.571zm-3.143 0H6v-2h1.571z"})),c||(c=t.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M6 2H2v4h1v11h11v1h4v-4h-1V3H6zm9 3H6v1H5v9h9v-1h1z",clipRule:"evenodd"})))};export{m as ReactComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import i,{useEffect as M,useState as E}from"react";import{ELLMDataType as W}from"../../constant/index.js";import{getStepConfig as Y}from"../../store/annotation/reducer.js";import{LabelBeeContext as Z}from"../../store/ctx.js";import{jsonParser as ee}from"../../utils/index.js";import{connect as te}from"react-redux";import A from"../../store/LLMMultiWheel/index.js";import{LLMMultiWheelViewCls as $}from"../../views/MainView/LLMMultiWheelLayout/index.js";import{ToggleDataFormatType as ne}from"../LLMToolView/questionView/components/header/index.js";import oe from"./dialogView/index.js";import re from"../messageMaskLayer/index.js";import ie from"../../views/MainView/annotationTips/index.js";import{I18nextProvider as ae,useTranslation as se}from"react-i18next";import{LLMViewCls as le}from"../LLMToolView/questionView/index.js";import{Layout as ue}from"antd";import{i18n as F}from"@labelbee/lb-utils";var ce=Object.defineProperty,de=Object.defineProperties,pe=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable,k=(t,e,n)=>e in t?ce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,y=(t,e)=>{for(var n in e||(e={}))me.call(e,n)&&k(t,n,e[n]);if(N)for(var n of N(e))Le.call(e,n)&&k(t,n,e[n]);return t},h=(t,e)=>de(t,pe(e));const R=t=>{const{questionIsImg:e,answerIsImg:n,LLMConfig:l,dialogList:p,lang:u="cn"}=t,{dataFormatType:c,setDataFormatType:a}=A();return M(()=>{var o;u&&((o=F)==null||o.changeLanguage(u))},[u]),i.createElement(ae,{i18n:F},i.createElement("div",{className:`${$}`},i.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},i.createElement(ne,{dataFormatType:c,setDataFormatType:a})),i.createElement("div",{className:`${$}-container`},p==null?void 0:p.map((o,d)=>i.createElement(oe,h(y({},o),{key:d,index:d,questionIsImg:e,answerIsImg:n,LLMConfig:l}))))))},U=({type:t,questionIndex:e,answerIndex:n,llmFile:l})=>{if(t==="question")return l==null?void 0:l.find((u,c)=>e===c);let p=null;return l==null||l.forEach((u,c)=>{var a;(a=u.answerList)==null||a.forEach((o,d)=>{c===e&&n===d&&(p=o)})}),p},fe=t=>{var e,n;const{annotation:l,tips:p,showTips:u,drawLayerSlot:c}=t,{imgIndex:a,imgList:o,stepList:d,step:x,toolInstance:v}=l,[
|
|
1
|
+
import i,{useEffect as M,useState as E}from"react";import{ELLMDataType as W}from"../../constant/index.js";import{getStepConfig as Y}from"../../store/annotation/reducer.js";import{LabelBeeContext as Z}from"../../store/ctx.js";import{jsonParser as ee}from"../../utils/index.js";import{connect as te}from"react-redux";import A from"../../store/LLMMultiWheel/index.js";import{LLMMultiWheelViewCls as $}from"../../views/MainView/LLMMultiWheelLayout/index.js";import{ToggleDataFormatType as ne}from"../LLMToolView/questionView/components/header/index.js";import oe from"./dialogView/index.js";import re from"../messageMaskLayer/index.js";import ie from"../../views/MainView/annotationTips/index.js";import{I18nextProvider as ae,useTranslation as se}from"react-i18next";import{LLMViewCls as le}from"../LLMToolView/questionView/index.js";import{Layout as ue}from"antd";import{i18n as F}from"@labelbee/lb-utils";var ce=Object.defineProperty,de=Object.defineProperties,pe=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable,k=(t,e,n)=>e in t?ce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,y=(t,e)=>{for(var n in e||(e={}))me.call(e,n)&&k(t,n,e[n]);if(N)for(var n of N(e))Le.call(e,n)&&k(t,n,e[n]);return t},h=(t,e)=>de(t,pe(e));const R=t=>{const{questionIsImg:e,answerIsImg:n,LLMConfig:l,dialogList:p,lang:u="cn"}=t,{dataFormatType:c,setDataFormatType:a}=A();return M(()=>{var o;u&&((o=F)==null||o.changeLanguage(u))},[u]),i.createElement(ae,{i18n:F},i.createElement("div",{className:`${$}`},i.createElement("div",{style:{display:"flex",justifyContent:"flex-end",margin:"10px"}},i.createElement(ne,{dataFormatType:c,setDataFormatType:a})),i.createElement("div",{className:`${$}-container`},p==null?void 0:p.map((o,d)=>i.createElement(oe,h(y({},o),{key:d,index:d,questionIsImg:e,answerIsImg:n,LLMConfig:l}))))))},U=({type:t,questionIndex:e,answerIndex:n,llmFile:l})=>{if(t==="question")return l==null?void 0:l.find((u,c)=>e===c);let p=null;return l==null||l.forEach((u,c)=>{var a;(a=u.answerList)==null||a.forEach((o,d)=>{c===e&&n===d&&(p=o)})}),p},fe=t=>{var e,n;const{annotation:l,tips:p,showTips:u,drawLayerSlot:c}=t,{imgIndex:a,imgList:o,stepList:d,step:x,toolInstance:v}=l,[g,B]=E(),{setSelectedID:Q,newAnswerListMap:I}=A(),[z,T]=E([]),j=((e=g==null?void 0:g.dataType)==null?void 0:e.prompt)===W.Picture,P=((n=g==null?void 0:g.dataType)==null?void 0:n.response)===W.Picture,{t:G}=se(),[,H]=E(0);return M(()=>{var r,m,L;if(!o[a])return;const w=(r=o[a])!=null?r:{},f=(L=(m=w==null?void 0:w.questionList)==null?void 0:m.textList)!=null?L:[];T(f),(f==null?void 0:f.length)&&Q(f[0].id)},[a]),M(()=>{var r,m;const L=(r=o[a])!=null?r:{},w=L==null?void 0:L.questionList,f=(m=L==null?void 0:L.llmFile)==null?void 0:m.textList,V=w==null?void 0:w.textList,J=V==null?void 0:V.map((s,b)=>{var D;return h(y({},s),{question:j&&U({type:"question",questionIndex:b,llmFile:f})||(s==null?void 0:s.question),answerList:(D=s==null?void 0:s.answerList)==null?void 0:D.map((_,O)=>{var S,q,C;const K=`${(S=s==null?void 0:s.id)!=null?S:""}-${(q=_==null?void 0:_.id)!=null?q:""}`,X=P?U({type:"answer",questionIndex:b,answerIndex:O,llmFile:f})||{}:{};return y(h(y({},_),{answer:_.answer,newAnswer:(C=I[K])!=null?C:_.answer,order:O+1}),X)})})});T(J)},[I,j,P]),M(()=>{var r;if(d&&x){const m=(r=Y(d,x))==null?void 0:r.config;B(ee(m))}},[d,x]),M(()=>{if(v)return v.on("validUpdated",()=>{H(r=>r+1)}),()=>{v.unbindAll("validUpdated")}},[v]),i.createElement(ue,{className:le},!(v==null?void 0:v.valid)&&i.createElement(re,{message:G("InvalidQuestionAndSkip")}),c==null?void 0:c({}),u===!0&&i.createElement(ie,{tips:p}),i.createElement(R,{questionIsImg:j,answerIsImg:P,LLMConfig:g,dialogList:z}))},ve=t=>({annotation:t.annotation});var ge=te(ve,null,null,{context:Z})(fe);export{R as LLMMultiWheelSourceView,ge as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import r,{useState as
|
|
1
|
+
import r,{useState as C,useRef as It,useMemo as N,useEffect as $}from"react";import{LabelBeeContext as Vt}from"../../../store/ctx.js";import{connect as Nt}from"react-redux";import{prefix as $t}from"../../../constant/index.js";import{getStepConfig as Bt}from"../../../store/annotation/reducer.js";import{jsonParser as ct}from"../../../utils/index.js";import Wt,{getSorts as pt}from"../../LLMToolView/sidebar/components/modelAnswerSort/index.js";import{useTranslation as Ft}from"react-i18next";import{useCustomToolInstance as kt}from"../../../hooks/annotation.js";import{isBoolean as qt,isString as Gt,isNumber as Kt,isObject as zt,isArray as Ut}from"lodash";import{PageForward as B}from"../../../store/annotation/actionCreators.js";import{cKeyCode as Qt,EToolName as Jt}from"@labelbee/lb-annotation";import{getLLMIsNoConfig as Ht,EmptyConfig as Xt}from"../../LLMToolView/sidebar/index.js";import Yt from"../../LLMToolView/sidebar/components/textInputBox/index.js";import{Button as mt}from"antd";import Zt from"../../LLMToolView/sidebar/components/answerList/index.js";import te from"../../../store/LLMMultiWheel/index.js";import ee from"../../../utils/StepUtils.js";import{getRenderDataByResult as ne,getTagResult as oe,getCurrentResultFromResultList as re}from"../../LLMToolView/utils/data.js";import{useMemoizedFn as z}from"ahooks";import le from"../../LLMToolView/sidebar/components/answerSort/index.js";import ie from"../../tagList/components/overall/index.js";var se=Object.defineProperty,ae=Object.defineProperties,ue=Object.getOwnPropertyDescriptors,ft=Object.getOwnPropertySymbols,de=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable,vt=(p,c,m)=>c in p?se(p,c,{enumerable:!0,configurable:!0,writable:!0,value:m}):p[c]=m,l=(p,c)=>{for(var m in c||(c={}))de.call(c,m)&&vt(p,m,c[m]);if(ft)for(var m of ft(c))ce.call(c,m)&&vt(p,m,c[m]);return p},d=(p,c)=>ae(p,ue(c));const pe=Qt.default,Lt=`${$t}-sidebar`,me={sort:[],answerSort:{},textAttribute:[],tagList:{}},fe=p=>{var c,m,U,Q,J,H;const{annotation:gt,dispatch:R,checkMode:xt}=p,{imgIndex:M,imgList:W,stepList:A,step:T,skipBeforePageTurning:D}=gt,[i,wt]=C(),{t:S}=Ft(),o=(c=W[M])!=null?c:{},X=ct(o==null?void 0:o.result),{toolInstanceRef:L}=kt({basicInfo:X}),[F,St]=C(!0),[O,Y]=C({}),[g,Z]=C(me),k=It(),[_,q]=C({}),{selectedID:P,setNewAnswerListMap:tt,newAnswerListMap:et}=te(),b=N(()=>O[P],[P,O]),y=!L.current.valid||xt;$(()=>{var t;if(A&&T){const e=(t=Bt(A,T))==null?void 0:t.config;wt(ct(e))}},[T,JSON.stringify(A)]),$(()=>{!o||M===-1||(L.current.setValid=nt,L.current.clearResult=_t,nt(),ot())},[M,i,o==null?void 0:o.id]);const _t=()=>{var t,e,n,s;ot((t=o==null?void 0:o.questionList)==null?void 0:t.textList),((e=k.current)==null?void 0:e.clearValue)&&((n=k.current)==null||n.clearValue());const{waitSorts:f}=pt({selectedSort:(s=x==null?void 0:x.sort)!=null?s:[],initSelected:[],modelList:h?V!=null?V:[]:[]});q(d(l({},_),{waitSorts:f,newSort:[]}))},nt=t=>{var e;const n=t!=null?t:X.valid;qt(n)&&(St(n),L.current.valid=n,(e=L.current)==null||e.emit("validUpdated"))},bt=()=>{const t=ee.getCurrentStepInfo(T,A);return re(o==null?void 0:o.result,t.step)},x=N(()=>bt(),[T,A,o]),ot=z(t=>{var e,n,s,f,a,w,j;const u=x;let E=(e=o==null?void 0:o.questionList)==null?void 0:e.textList;((n=u==null?void 0:u.modelData)==null?void 0:n.length)&&L.current.valid&&(E=u==null?void 0:u.modelData),t&&(E=t,u.sort=[],u.textAttribute=[],u.answerSort=[]);let ut={};E==null||E.forEach((v,Dt)=>{var dt;const Ot=ne(i,d(l({},v),{answerList:(dt=v==null?void 0:v.answerList)==null?void 0:dt.map((K,Pt)=>((i==null?void 0:i.isTextEdit)&&tt(d(l({},et),{[`${v.id}-${K.id}`]:K.answer})),d(l({},K),{order:Pt+1})))}));ut[v.id]=d(l({},Ot),{order:Dt+1,id:v.id})});const{waitSorts:ht,newSort:jt}=pt({selectedSort:(s=x==null?void 0:x.sort)!=null?s:[],modelList:h?V!=null?V:[]:[]});q({waitSorts:ht,newSort:jt});const Ct=((f=i==null?void 0:i.inputList)==null?void 0:f.filter(v=>v==null?void 0:v.isOverall))||[],Rt=oe(Ct,u==null?void 0:u.tagList);Z({sort:(a=u==null?void 0:u.sort)!=null?a:[],textAttribute:(w=u==null?void 0:u.textAttribute)!=null?w:[],answerSort:(j=u==null?void 0:u.answerSort)!=null?j:{},tagList:Rt}),Y(ut)});$(()=>{yt()},[O,F,g]),$(()=>(window.addEventListener("keydown",rt),()=>{window.removeEventListener("keydown",rt)}),[]);const yt=z(()=>{var t,e;const n=(e=(t=o==null?void 0:o.questionList)==null?void 0:t.textList)==null?void 0:e.map(f=>{var a;const w=(a=O[f.id])!=null?a:{};return{id:f.id,answerList:w.answerList}}),s=d(l({},g),{modelData:n});L.current.exportData=()=>[[s],{valid:F}],L.current.currentPageResult=d(l({},s),{toolName:Jt.LLMMultiWheel,valid:F})}),rt=t=>{if(t.ctrlKey&&t.keyCode===pe.Enter){if(D){D(()=>R(B()));return}R(B())}},Et=z(({order:t,value:e,key:n})=>{const{answerList:s}=b,f=s==null?void 0:s.map(a=>{var w,j;if((a==null?void 0:a.order)===t){if(n==="textEdit"&&Gt(e)&&st)return tt(d(l({},et),{[`${P}-${(w=a==null?void 0:a.id)!=null?w:""}`]:e})),d(l({},a),{newAnswer:e});if(Kt(e))return d(l({},a),{score:e});if(zt(e)&&n){const u={[e==null?void 0:e.key]:e.value},E=(j=a[n])!=null?j:{};return d(l({},a),{[n]:l(l({},E),u)})}}return a});Y(a=>d(l({},a),{[P]:d(l({},b),{answerList:f})}))}),I=(t,e)=>{Z(n=>d(l({},n),{[t]:e}))},{indicatorScore:lt=[],indicatorDetermine:it=[],isTextEdit:st,dialogSort:h=!1,inputList:G=[],tagInputListConfigurable:at,enableSort:Mt=!1}=i||{},V=N(()=>{var t,e,n;return h?(n=(e=(t=o==null?void 0:o.questionList)==null?void 0:t.textList)==null?void 0:e.map((s,f)=>d(l({},s),{title:f+1})))!=null?n:[]:[]},[o,h]);if(N(()=>Ht(i),[i]))return r.createElement(Xt,null);const At=at&&((m=G.filter(t=>!t.isOverall))==null?void 0:m.length)>0,Tt=(it==null?void 0:it.length)>0||(lt==null?void 0:lt.length)>0||st||At;return r.createElement("div",{className:`${Lt}`},r.createElement("div",{className:`${Lt}__content`},r.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},S("GlobalAnnotation")),h&&r.createElement(le,{waitSortList:(_==null?void 0:_.waitSorts)||[],sortList:(_==null?void 0:_.newSort)||[],setSortList:t=>{const e=t.map(n=>n.map(s=>s.id));I("sort",e),q(d(l({},_),{newSort:t}))},disabeledAll:y,title:S("SortConversationQuality"),prefixId:"model"}),(i==null?void 0:i.text)&&r.createElement("div",{style:{padding:"0px 16px",marginTop:"16px"}},r.createElement(Yt,{textAttribute:(U=g==null?void 0:g.textAttribute)!=null?U:[],textConfig:(i==null?void 0:i.text)&&Ut(i.text)?i==null?void 0:i.text:[],setText:t=>I("textAttribute",t),disabeledAll:y})),Mt&&r.createElement(Wt,{modelData:(J=(Q=o==null?void 0:o.questionList)==null?void 0:Q.textList)!=null?J:[],selectedAnswerSort:t=>I("answerSort",t),selectedSort:(H=x==null?void 0:x.answerSort)!=null?H:[],ref:k,disabeledAll:y,imgIndex:M}),at&&G.length&&r.createElement(ie,{inputList:G,selectedTags:(g==null?void 0:g.tagList)||{},updateValue:t=>{const{key:e,value:n}=t,s=(g==null?void 0:g.tagList)||{};I("tagList",d(l({},s),{[e]:n}))},disabeledAll:y}),b&&r.createElement(r.Fragment,null,r.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},S("QualifiedAnnotation")),r.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"}},r.createElement(mt,{type:"primary",danger:!0},S("Annotating")),r.createElement("div",{style:{padding:16}},S("Group"),"\uFF1A",b.order)),r.createElement("div",null,Tt&&r.createElement(Zt,{list:(b==null?void 0:b.answerList)||[],LLMConfig:i,updateValue:Et,disabeledAll:y})))),r.createElement("div",{style:{margin:"24px 16px",display:"flex"}},(W==null?void 0:W.length)-1!==M&&r.createElement(mt,{type:"primary",style:{marginLeft:"auto"},onClick:()=>{if(D){D(()=>R(B()));return}R(B())},disabled:y},S("Save"))))},ve=p=>({annotation:p.annotation});var Le=Nt(ve,null,null,{context:Vt})(fe);export{Le as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import B from"../../assets/attributeIcon/icon_eyeLock_a.svg.js";import F from"../../assets/attributeIcon/icon_eyeLock_h.svg.js";import{COLORS_ARRAY as b,NULL_COLOR as G}from"../../data/Style.js";import{ColorTag as H}from"../colorTag/index.js";import{Radio as y}from"antd/es";import n,{useState as C,useEffect as M}from"react";import{Popover as W,message as Y}from"antd";import $ from"../colorPalette/index.js";import{CloseOutlined as q}from"@ant-design/icons";import{useTranslation as J}from"react-i18next";import Q from"./components/limitPopover/index.js";import X from"lodash";import{CommonToolUtils as Z,MathUtils as s}from"@labelbee/lb-annotation";import{useDebounceFn as E}from"ahooks";const R=[G].concat(b),p=n.forwardRef((e,_)=>{const w=n.useRef(),{t:g}=J(),A=e.list||[],[D,m]=C(!1),[P,T]=C(void 0),[c,I]=C([]);let d=[...R];e.forbidDefault===!0&&(d=d.slice(1));let k="sensebee-radio-group";e.noHeightLimit&&(k="sensebee-radio-group-no-limit-height");const O=t=>{var l,u;if(!Z.hotkeyFilter(t)||(e==null?void 0:e.forbidColor))return;let o=t.keyCode;e.forbidDefault===!0&&(o=o-1);let i;if(s.isInRange(t.keyCode,[48,57])&&(i=e.list[o-48]),s.isInRange(t.keyCode,[96,105])&&(i=e.list[o-96]),t.shiftKey&&i){if(!(e==null?void 0:e.attributeLockChange))return;f(t,i),t.preventDefault();return}(s.isInRange(t.keyCode,[48,57])||s.isInRange(t.keyCode,[96,105]))&&((u=e==null?void 0:e.attributeChanged)==null||u.call(e,(l=i==null?void 0:i.value)!=null?l:""))},{run:L}=E(O,{wait:200});M(()=>(window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)));const S=(t,l)=>{e.updateColorConfig&&e.updateColorConfig(t,l)},j=(t,l)=>{if(t.shiftKey&&(e==null?void 0:e.attributeLockChange)){f(t,l);return}e.attributeChanged(t.target.value)},{run:N}=E(j,{wait:100}),f=(t,l)=>{var u;if(e==null?void 0:e.forbidColor)return;const o=c.includes(l.value);let i=X.cloneDeep(c);o?i=i.filter(a=>a!==l.value):i.push(l.value),I(i),(u=e==null?void 0:e.attributeLockChange)==null||u.call(e,i),o||Y.success(g("AttributeLockNotify",{label:l.label})),t.preventDefault()};return n.createElement("div",{className:k,style:e.style},n.createElement(y.Group,{name:"radiogroup",defaultValue:e==null?void 0:e.selectedAttribute,value:e==null?void 0:e.selectedAttribute,ref:_},A.map((t,l)=>{var u,o,i;let a=(u=e==null?void 0:e.num)!=null?u:l;const z=(t==null?void 0:t.value)===(e==null?void 0:e.selectedAttribute);e.forbidDefault===!0&&typeof a=="number"&&a++,typeof a=="number"&&a<=9&&a>=0||(a="-");let v=l>8&&!e.forbidDefault?b[(l-1)%b.length]:d[l%d.length];(t==null?void 0:t.color)&&(v=t.color);const{defaultSize:U,logicalCondition:h,sizeRange:V}=((o=t==null?void 0:t.limit)==null?void 0:o.sizeLimit)||{},x=((i=t==null?void 0:t.limit)==null?void 0:i.positionLimit)||U||V||(h==null?void 0:h.length)>0,K=z&&x&&e.forbidShowLimitPopover!==!0;return n.createElement(y,{value:t.value,ref:w,key:t.label+l,onClick:r=>N(r,t)},n.createElement("span",{className:"sensebee-radio-label",title:t.label},!(e==null?void 0:e.forbidColor)&&n.createElement(W,{content:n.createElement($,{defaultColor:v,setColor:r=>S(t.value,r)}),title:n.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},n.createElement("span",null,g("Palette")),n.createElement(q,{onClick:()=>m(!1)})),visible:D&&P===l,onVisibleChange:r=>{!r||m(r)}},n.createElement(H,{color:v,style:{cursor:"pointer",marginRight:"8px"},onClick:()=>{(e==null?void 0:e.enableColorPicker)&&(T(l),m(!0))}})),t.label),!(e==null?void 0:e.forbidColor)&&(e==null?void 0:e.attributeLockChange)&&n.createElement("img",{onClick:r=>f(r,t),src:c.includes(t.value)?B:F,style:{display:c.includes(t.value)?"inline-block":""},className:"sensebee-radio-icon"}),K&&n.createElement(Q,{limit:t.limit,updateSize:e==null?void 0:e.updateSize}),n.createElement("span",{className:"sensebee-radio-num"},a))})))});export{R as ATTRIBUTE_COLORS,p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r,{useState as M,useEffect as V,useMemo as re}from"react";import{AudioPlayer as Oe}from"../audioPlayer/index.js";import{getClassName as ke}from"../../utils/dom.js";import Ne from"../predictTracking/previewResult/index.js";import{Layout as ae}from"antd/es";import{Spin as De}from"antd";import{prefix as $e}from"../../constant/index.js";import{cKeyCode as Me,CommonToolUtils as B,EventBus as ue,uuid as Ve,TagUtils as Be,cTool as Fe}from"@labelbee/lb-annotation";import U from"./index.module.scss.js";import Ke from"./tagResultShow/index.js";import{AudioClipProvider as We,DEFAULT_CLIP_TEXT_CONFIG_ITEM as Ue,useAudioClipStore as Xe}from"./audioContext/index.js";import ze from"./textInput/index.js";import{connect as Ge}from"react-redux";import{a2MapStateToProps as qe}from"../../store/annotation/map.js";import{LabelBeeContext as He}from"../../store/ctx.js";import{jsonParser as Je}from"../../utils/index.js";import{useCustomToolInstance as Qe}from"../../hooks/annotation.js";import{sidebarCls as Z}from"../../views/MainView/sidebar/index.js";import Ye from"./audioSide/labelSidebar/index.js";import Ze from"./audioSide/clipSidebar/index.js";import et from"../../assets/annotation/audio/tag.svg.js";import tt from"../../assets/annotation/audio/tagA.svg.js";import ot from"../../assets/annotation/audio/clip.svg.js";import nt from"../../assets/annotation/audio/clipA.svg.js";import{isImageValue as it}from"../../utils/audio.js";import lt from"./utils/dataTransform.js";import{useMemoizedFn as ce}from"ahooks";var st=Object.defineProperty,rt=Object.defineProperties,at=Object.getOwnPropertyDescriptors,de=Object.getOwnPropertySymbols,ut=Object.prototype.hasOwnProperty,ct=Object.prototype.propertyIsEnumerable,fe=(o,n,a)=>n in o?st(o,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):o[n]=a,R=(o,n)=>{for(var a in n||(n={}))ut.call(n,a)&&fe(o,a,n[a]);if(de)for(var a of de(n))ct.call(n,a)&&fe(o,a,n[a]);return o},F=(o,n)=>rt(o,at(n));const{EAudioToolName:dt}=Fe,me=Me.default,{Sider:ft,Content:mt}=ae,pe=`${$e}-layout`,pt=({setSideTab:o,sideTab:n})=>{const a=[{tab:"tag",commonSvg:et,selectedSvg:tt},{tab:"clip",commonSvg:ot,selectedSvg:nt}];return r.createElement("div",{className:U.toggleAudioOption},a.map((m,y)=>{const{tab:d,selectedSvg:_,commonSvg:T}=m;return r.createElement("div",{key:y,className:U.option},r.createElement("img",{className:U.icon,src:n===d?_:T,onClick:()=>{n!==d&&o(d)}}))}))},gt=({result:o,inputDisabled:n,updateText:a,configList:m,autofocus:y,preContext:d,isCheck:_,clipAttributeConfigurable:T,clipTextConfigurable:k,textConfigurable:b,updateRegion:E,clipAttributeList:f,clipTextList:p})=>r.createElement(ze,{isCheck:_,result:o==null?void 0:o.value,textInputDisabled:n,textID:(o==null?void 0:o.id)||0,updateText:a,configList:m,autofocus:!n&&y,preContext:d,regions:o==null?void 0:o.regions,clipAttributeConfigurable:T,clipTextConfigurable:k,textConfigurable:b,updateRegion:E,clipAttributeList:f,clipTextList:p}),vt=o=>{var n,a;const{sider:m,config:y,result:d,updateTagResult:_,updateRegion:T,isEdit:k,tagConfigurable:b,clipConfigurable:E}=o;let f=(y==null?void 0:y.inputList)||[],p=(n=d==null?void 0:d.tag)!=null?n:{},u=(a=d==null?void 0:d.regions)!=null?a:[];const[X,w]=M([]),[x,g]=M("tag");V(()=>{if(!b&&E){g("clip");return}g("tag")},[b,E]),V(()=>(window.addEventListener("keydown",N),()=>{window.removeEventListener("keydown",N)}));const N=t=>{if(b&&E)switch(t.keyCode){case me.L:g("tag");break;case me.X:g("clip");break}if(x==="tag"){if(!B.hotkeyFilter(t))return;B.isMoveKey(t==null?void 0:t.keyCode)&&t.preventDefault();let i=t.keyCode;if(i&&(i<=57&&i>=49||i<=105&&i>=97)){i>57?i=i-97:i=i-49;const h=X.slice();f.length===1?(L(0,i),w([0,i]),setTimeout(()=>{w([])},500)):h.length===1?(L(h[0],i),w([h[0],i]),setTimeout(()=>{w([])},500)):w([i])}}},L=(t,i)=>{if(t<f.length&&f[t].subSelected&&i<f[t].subSelected.length){const h=f[t].value,s=f[t].isMulti;let j=f[t].subSelected[i].value,z=0;const K=p;for(const S in p)if(S===f[t].value){if(z++,s===!0){const I=K[S].split(";").filter(q=>q!==""),v=I.indexOf(j);v===-1?I.push(j):I.splice(v,1),j=I.join(";")}j===""?delete K[S]:K[S]=j}z===0&&Object.assign(p,{[h]:j}),_(p)}},P=t=>{delete p[t],_(p)},D=b&&E&&r.createElement(pt,{setSideTab:g,sideTab:x}),A=x==="tag"&&r.createElement(Ye,{labelInfoSet:b?f:[],labelSelectedList:X,setLabel:L,tagResult:p,clearResult:P,isEdit:k,withPanelTab:!1}),$=x==="clip"&&r.createElement(Ze,{regions:u,updateRegion:T,useAudioClipStore:Xe});return m?typeof m=="function"?r.createElement("div",{className:`${Z}`},m({toggleAudioOption:D,labelSidebar:A,clipSidebar:$})):m:r.createElement("div",{className:`${Z}`},r.createElement("div",{className:`${Z}__content`},D,A,$))},bt=o=>{var n,a,m,y,d,_,T,k,b;const E=(a=(n=o.style)==null?void 0:n.sider)==null?void 0:a.width,{step:f,stepList:p,audioContext:u,sider:X,drawLayerSlot:w,imgList:x,imgIndex:g,currentData:N,config:L,stepInfo:P,checkMode:D}=o,A=B.getCurrentStepToolAndConfig(f,p),$=Je(N.result),{toolInstanceRef:t}=Qe({basicInfo:$}),[i,h]=M(!0),[s,j]=M(null),[z,K]=M(0),[S,I]=M(!0),v=e=>{if(!e)return;const l=lt.fixData(e);j(l)};V(()=>{h(!0)},[g]),V(()=>{i===!1&&Re()},[i]),V(()=>{ge()},[]),V(()=>{t.current.exportData=()=>[[s],{duration:z,valid:S}],t.current.setResult=Pe,t.current.clearResult=Ae,t.current.currentPageResult=s==null?void 0:s.regions,t.current.emit("updatePageNumber"),t.current.setSelectedRegion=q,t.current.setValid=Ie},[s,S]);const q=e=>{ue.emit("setSelectedRegion",{id:e,isLoopStatus:!0,playImmediately:!0})},ge=()=>{t.current.emit=e=>{const l=t.current.fns.get(e);l&&l.forEach(c=>{c&&(c==null||c())})},t.current.fns=new Map,t.current.singleOn=(e,l)=>{t.current.fns.set(e,[l])},t.current.on=(e,l)=>{t.current.singleOn(e,l)},t.current.unbindAll=e=>{t.current.fns.delete(e)}},H=re(()=>{const e=$[`step_${P==null?void 0:P.step}`];return(e==null?void 0:e.result)||[]},[L,$,P]),{tagConfigurable:ee,textConfigurable:J=!0,clipConfigurable:te=!1,clipAttributeConfigurable:oe=!1,clipAttributeList:ne=[],clipTextConfigurable:G=!1,subAttributeList:ve=[],secondaryAttributeConfigurable:be=!1,inputList:Se=[],configList:ye=[],clipTextList:ie=Ue}=re(()=>{if(A)return B.jsonParser(A==null?void 0:A.config)},[A]),_e={clipConfigurable:te,clipAttributeConfigurable:oe,clipAttributeList:ne,clipTextConfigurable:G,subAttributeList:ve,secondaryAttributeConfigurable:be,clipTextList:ie},Ee=(y=(m=B.jsonParser(N.result))==null?void 0:m.duration)!=null?y:0,xe=S?Ee:0,Ce=!S||i||![J,G].includes(!0)||D;let le={};if(g!==-1&&(x==null?void 0:x.length)){const e=(d=x[g])==null?void 0:d.preResult,l=(u==null?void 0:u.isEdit)?(_=u==null?void 0:u.stepConfig)==null?void 0:_.loadPreStep:P==null?void 0:P.loadPreStep;if(e&&l){const c=B.jsonParser(e),C=(k=(T=c==null?void 0:c.config)==null?void 0:T.context)!=null?k:{};Object.keys(C).forEach(O=>{O&&C[O]&&(le[O]={visible:!0,content:C[O],type:O})})}}const Re=()=>{(H==null?void 0:H.length)>0?v(H[0]):v({id:Ve(),sourceID:"",value:se(),tag:Te(),regions:[]});const e=it(x[g].result||"[]");I(e)},se=(e=!0)=>{const l={};let c=L.configList||[];return c.length>0&&c.forEach(C=>{l[C.key]=e&&C.default||""}),l},Te=()=>Be.getDefaultResultByConfig(L.inputList||[]),Le=({duration:e,hasError:l})=>{(u==null?void 0:u.onLoaded)&&(u==null||u.onLoaded()),h(!1),K(e)},he=ce(e=>{v(F(R({},s||{}),{regions:((s==null?void 0:s.regions)||[]).filter(l=>l.id!==e)}))}),Q=ce(e=>{var l;const c=(l=s==null?void 0:s.regions)!=null?l:[],{id:C}=e,O=c.find(W=>W.id===C);let Y=[];O?Y=c.map(W=>C===W.id?R(R({},W),e):W):Y=[...c,e],v(F(R({},s),{regions:Y}))}),je=(e,l)=>{const c=F(R({},s),{value:F(R({},s.value),{[l]:e})});v(c)},we=e=>{const l=F(R({},s),{tag:e});v(l)},Pe=e=>{v(e)},Ae=()=>{const e=F(R({},s),{value:se(),tag:{},regions:[]});v(e),ue.emit("clearRegions")},Ie=e=>{I(e)};return r.createElement(We,null,r.createElement(De,{spinning:i,wrapperClassName:"audio-tool-spinner"},r.createElement(ae,{className:ke("layout","container"),style:{height:"100%",userSelect:"none"}},o==null?void 0:o.leftSider,r.createElement(mt,{className:`${pe}__content`},r.createElement("div",{className:U.containerWrapper},r.createElement("div",{className:U.audioWrapper},ee&&r.createElement(Ke,{result:s==null?void 0:s.tag,labelInfoSet:Se,hasPromptLayer:!!(u==null?void 0:u.promptLayer)}),u==null?void 0:u.promptLayer,r.createElement(Oe,R({context:{isEdit:u==null?void 0:u.isEdit,count:xe,toolName:dt.AudioTextTool,imgIndex:g},drawLayerSlot:w,fileData:N,onLoaded:Le,invalid:!S,updateRegion:Q,removeRegion:he,regions:s==null?void 0:s.regions,activeToolPanel:u==null?void 0:u.activeToolPanel,footer:o.footer,isCheck:D},_e))),(J||G)&&r.createElement(gt,{preContext:le,result:s,inputDisabled:Ce,updateText:je,updateRegion:Q,configList:ye,autofocus:!1,textConfigurable:J,clipTextConfigurable:G,clipAttributeList:ne,clipAttributeConfigurable:oe,clipTextList:ie,isCheck:D}))),r.createElement(ft,{className:`${pe}__side`,width:E!=null?E:240,style:(b=o.style)==null?void 0:b.sider},r.createElement(vt,{sider:X,config:L,result:s,updateTagResult:we,updateRegion:Q,isEdit:u==null?void 0:u.isEdit,tagConfigurable:ee,clipConfigurable:te})),r.createElement(Ne,null))))};var St=Ge(qe,null,null,{context:He})(bt);export{St as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useState as
|
|
1
|
+
import e,{useState as C,useRef as J,useEffect as H,useMemo as Se}from"react";import{Tooltip as se,Radio as q,Spin as _e,Switch as ke}from"antd";import{QuestionCircleOutlined as Le}from"@ant-design/icons";import{TextareaWithFooter as De}from"../../../views/MainView/sidebar/TextToolSidebar/index.js";import{timeFormat as ue,getAttributeColor as Ae,getAttributeFontColor as Pe,getAttributeShowText as Oe,updateColorOpacity as Me,DEFAULT_TEXT_CONFIG_ITEM as Re}from"../../../utils/audio.js";import{cKeyCode as $e}from"@labelbee/lb-annotation";import Y from"classnames";import ie,{useAudioClipStore as je,DEFAULT_CLIP_TEXT_CONFIG_ITEM as He}from"../audioContext/index.js";import a from"./index.module.scss.js";import{useTranslation as ce}from"react-i18next";import me from"../../longText/index.js";import qe from"../../../assets/annotation/common/icon_clearSmall_a.svg.js";import ze from"../../../assets/annotation/common/icon_clearSmall.svg.js";var Ke=Object.defineProperty,Ve=Object.defineProperties,Ge=Object.getOwnPropertyDescriptors,de=Object.getOwnPropertySymbols,We=Object.prototype.hasOwnProperty,Ue=Object.prototype.propertyIsEnumerable,Ee=(s,l,r)=>l in s?Ke(s,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[l]=r,Z=(s,l)=>{for(var r in l||(l={}))We.call(l,r)&&Ee(s,r,l[r]);if(de)for(var r of de(l))Ue.call(l,r)&&Ee(s,r,l[r]);return s},pe=(s,l)=>Ve(s,Ge(l));const p=$e.default,fe=({onClick:s,title:l,disabled:r})=>{const[b,c]=C(!1);return e.createElement(se,{placement:"bottom",title:l},e.createElement("img",{onMouseEnter:()=>{r||c(!0)},onMouseLeave:()=>c(!1),className:Y({[a.clearIcon]:!0,[a.disabled]:r}),src:b?qe:ze,onClick:s}))},ee=s=>{var l;const{t:r}=ce(),b=J(null),[c,I]=C(!1),[S,f]=C(!1),{disabled:m,config:u,result:R,updateText:v,index:x,switchToNextTextarea:$,hasMultiple:_,textID:g,addPlaceholder:T,onFocus:k,onBlur:y,onFocusStyle:N={},extra:B,errorText:L}=s,{maxLength:h}=u,D=R?R[u.key]:"",A=(l=D==null?void 0:D.length)!=null?l:0,P=o=>{v&&(v(o,u.key),u.required&&f(!o))},O=_&&$,z={id:`textInput-${x}`,ref:b,disabled:m,value:D,maxLength:h,autoSize:{minRows:2,maxRows:6},onChange:o=>{const E=o.target.value;P(E)},onFocus:o=>{I(!0),k==null||k(o),o.target.value&&f(!1)},onBlur:o=>{I(!1),y==null||y(o),u.required&&f(!o.target.value)},style:{resize:"none",wordBreak:"break-all"},onKeyDownCapture:o=>{const{keyCode:E}=o;if(o.ctrlKey){if(E===p.Enter&&o.preventDefault(),T&&[p.One,p.Two,p.Three].includes(E))switch(o.preventDefault(),E){case p.One:T("\u4986");break;case p.Two:T("\u652B");break;case p.Three:T("\u7383");break}}else E===p.Tab&&O?(o.preventDefault(),o.nativeEvent.stopImmediatePropagation(),$(x)):o.nativeEvent.stopPropagation()}},K=e.createElement("div",{className:a.textAreaFooter},e.createElement("div",{className:a.hotkeyTip},O&&e.createElement("span",null,"[",r("Switch"),"]Tab"),e.createElement("span",null,"[",r("TurnPage"),"]Ctrl+Enter")),e.createElement("div",{className:a.wordCount},e.createElement("span",{className:A>=h?a.warning:""},A),"/",e.createElement("span",null,h)));return H(()=>{m&&I(!1)},[m]),H(()=>{f(!1)},[g]),e.createElement("div",{className:a.textField},e.createElement("div",{className:a.label},e.createElement("div",{className:a.labelText},e.createElement("span",{className:Y({[a.titleText]:!0,[a.required]:u.required})},e.createElement(me,{text:u.label,openByText:!0,isToolTips:!0})),e.createElement(fe,{onClick:()=>{m||P("")},title:"",disabled:m})),e.createElement("div",{className:a.extra},B)),e.createElement("div",{className:Y({disabled:m,"textarea-outline":!0,"ant-input-focused":c,[a.textareaContainer]:!0,[a.focus]:c,[a.invalid]:S}),style:c?N:{}},e.createElement(De,{footer:K,textareaProps:z})),L&&e.createElement("span",{style:{color:"#ff4d4f",lineHeight:"22px"}},L))},Xe=s=>{const{configList:l,autofocus:r,textID:b,result:c,showText:I,updateText:S,toggleShowText:f,textInputDisabled:m,isCheck:u,isEdit:R,config:v,preContext:x,regions:$=[],textConfigurable:_=!0,clipTextConfigurable:g,clipAttributeConfigurable:T,updateRegion:k,clipAttributeList:y=[],clipTextList:N=He}=s,{t:B}=ce(),[L,h]=C(0),[D,A]=C(""),P=J(null),O=J(null),[z,K]=C(5),[o,E]=C(!1),{audioClipState:ve}=je(),w=l||[Z({},Re)];let F=$;if(g&&!u){const t=ve.selectedRegion.id;F=F.filter(n=>n.id===t)}const V=t=>{setTimeout(()=>{const n=document.getElementById(`textInput-${t}`);n&&(h(t),n.focus(),n.select(),n.scrollIntoView({behavior:"smooth",block:"center"}))})},te=t=>{const n=_?w.length:0,d=g?F.length*N.length:0,i=n+d,M=(t+1)%i;V(M)},ne=t=>{t.keyCode===p.Tab&&(t.preventDefault(),(w.length>0||g&&N.length>0)&&V(0))},j=t=>{const n=document.getElementById(`textInput-${L}`);if(!(v==null?void 0:v.enablePlaceholderHotkey)||!n||!S)return;const{value:d,selectionStart:i,selectionEnd:M}=n,W=`${d.slice(0,i)}${t}${d.slice(M)}`;S(W,w[L].key),A(t),setTimeout(()=>{n.setSelectionRange(i+1,i+1),n.focus()},0),clearTimeout(P.current),P.current=setTimeout(()=>{A("")},400)};H(()=>(R||document.addEventListener("keydown",ne),()=>{document.removeEventListener("keydown",ne)}),[l]),H(()=>{r&&!m&&V(0)},[b]);let G=w;u&&(G=w.filter(t=>(c==null?void 0:c[t.key])!==void 0));const ae=Se(()=>N.reduce((t,n)=>(F.forEach(d=>{d&&t.push(pe(Z({},n),{clipTextResult:d}))}),t),[]),[N,F]),xe=()=>{const t=O.current;t&&g&&F.length>0&&u&&t.clientHeight+t.scrollTop+1>=t.scrollHeight&&(E(!0),ge())},ge=()=>{setTimeout(()=>{K(t=>Math.min(t+5,ae.length)),E(!1)},300)};return e.createElement("div",{className:a.textInputBox,ref:O,onScroll:xe},e.createElement("div",{className:a.textInputChild},(v==null?void 0:v.enablePlaceholderHotkey)&&e.createElement("div",{className:a.placeholderHotkey},e.createElement("div",{className:a.title},"\u5360\u4F4D\u7B26\u5FEB\u6377\u8F93\u5165",e.createElement(se,{overlayStyle:{maxWidth:240},title:e.createElement("div",null,e.createElement("div",null,"\u4986\uFF08Ctrl+1\uFF09\uFF1A"),e.createElement("div",{style:{marginBottom:12}},"\u6587\u5B57\u5F02\u5E38\uFF0C\u4F46\u53EA\u6839\u636E\u8FD9\u4E2A\u5B57\u7684\u5F62\u72B6\u5C31\u53EF\u4EE5\u731C\u51FA\u662F\u4EC0\u4E48\u5B57"),e.createElement("div",null,"\u652B\uFF08Ctrl+2\uFF09\uFF1A"),e.createElement("div",{style:{marginBottom:12}},"\u6587\u5B57\u5F02\u5E38\uFF0C\u4E14\u65E0\u6CD5\u6839\u636E\u5F62\u72B6\u731C\u5B57\uFF0C\u4F46\u80FD\u7ED3\u5408\u4E0A\u4E0B\u6587\u8BED\u4E49\u5224\u65AD\u51FA\u662F\u4EC0\u4E48\u5B57"),e.createElement("div",null,"\u7383\uFF08Ctrl+3\uFF09\uFF1A"),e.createElement("div",null,"\u5B8C\u5168\u65E0\u6CD5\u5224\u65AD\u662F\u4EC0\u4E48\u5B57")),placement:"bottom"},e.createElement(Le,{className:a.questionIcon}))),e.createElement(q.Group,{value:D},e.createElement(q.Button,{value:"\u4986",onClick:t=>j(t.target.value)},e.createElement("div",{className:"label"},e.createElement("div",{className:"text"},"\u4986 (\u89C6\u89C9)"),e.createElement("div",{className:"hotkey"},"Ctrl+1"))),e.createElement(q.Button,{value:"\u652B",onClick:t=>j(t.target.value)},e.createElement("div",{className:"label"},e.createElement("div",{className:"text"},"\u652B (\u8BED\u4E49)"),e.createElement("div",{className:"hotkey"},"Ctrl+2"))),e.createElement(q.Button,{value:"\u7383",onClick:t=>j(t.target.value)},e.createElement("div",{className:"label"},e.createElement("div",{className:"text"},"\u7383 (\u65E0\u6548)"),e.createElement("div",{className:"hotkey"},"Ctrl+3"))))),e.createElement("div",{className:a.textInputContainer},e.createElement(ie,{audioContext:x==null?void 0:x.before}),_&&G.map((t,n)=>e.createElement(ee,{config:t,key:n,index:n,result:c,updateText:S,switchToNextTextarea:te,hasMultiple:w.length>1,disabled:m,textID:b,addPlaceholder:j,onFocus:()=>h(n)})),g&&F.length>0&&e.createElement(e.Fragment,null,ae.slice(0,z).map((t,n)=>{var d;const{clipTextResult:i}=t,{id:M,start:W,end:Te,attribute:U}=i,{maxLength:he=3e3,label:le,key:oe,required:Fe}=t,re=i==null?void 0:i[oe],Ce={[i.id]:re},be={label:`${le!=null?le:B("textTool")}\uFF08${ue(W,"ss.SSS")} - ${ue(Te,"ss.SSS")}\uFF09`,key:M,maxLength:he},X=(_?G.length:0)+n,Q=Ae(U,y),ye={color:Pe(U,y),backgroundColor:Q},Ne=B("LeastCharacterError",{num:1}),Be=Fe&&re.length<1?Ne:void 0,we=(d=Oe(U,[{value:"",key:B("NoAttribute")},...y]))!=null?d:"";return e.createElement(ee,{config:be,key:n,index:X,disabled:m,result:Ce,updateText:Ie=>{k==null||k(pe(Z({},i),{[oe]:Ie}))},switchToNextTextarea:()=>{te(X)},hasMultiple:!0,onFocus:()=>h(X),onFocusStyle:T?{borderColor:Q,boxShadow:`0 0 0 2px ${Me(Q,.4)}`}:{},extra:T?e.createElement("div",{style:ye,className:a.attribute},e.createElement(me,{text:we,openByText:!0,isToolTips:!0})):null,errorText:Be})}),o&&e.createElement(_e,{size:"small"})),e.createElement(ie,{audioContext:x==null?void 0:x.after}),f&&e.createElement("div",{className:a.switchItem},B("toggleShowText"),e.createElement(ke,{style:{alignSelf:"center"},checked:I,onChange:t=>{f(t)}})))))};export{fe as ClearIcon,ee as SingleTextInput,Xe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={textInputContainer:"index-module_textInputContainer__ES6X3",textField:"index-module_textField__uRcb7",label:"index-module_label__xE6hM",labelText:"index-module_labelText__Zg1c4",titleText:"index-module_titleText__BRM44",required:"index-module_required__iElYl",extra:"index-module_extra__PW5Qk",textareaContainer:"index-module_textareaContainer__dTIv4",textAreaFooter:"index-module_textAreaFooter__h1Vv-",warning:"index-module_warning__NKpW6",hotkeyTip:"index-module_hotkeyTip__BSJ6A",wordCount:"index-module_wordCount__OD4eL",focus:"index-module_focus__H07-Y",invalid:"index-module_invalid__F9RC5",inputCount:"index-module_inputCount__--XiT",notify:"index-module_notify__rYuqq",switchItem:"index-module_switchItem__Q256x",placeholderHotkey:"index-module_placeholderHotkey__0SKPo",title:"index-module_title__YRpw9",questionIcon:"index-module_questionIcon__oK1HK",attribute:"index-module_attribute__g8Vbl",clearIcon:"index-module_clearIcon__ZBZqI",disabled:"index-module_disabled__zqh8C"};export{e as default};
|
|
1
|
+
var e={textInputContainer:"index-module_textInputContainer__ES6X3",textField:"index-module_textField__uRcb7",label:"index-module_label__xE6hM",labelText:"index-module_labelText__Zg1c4",titleText:"index-module_titleText__BRM44",required:"index-module_required__iElYl",extra:"index-module_extra__PW5Qk",textareaContainer:"index-module_textareaContainer__dTIv4",textAreaFooter:"index-module_textAreaFooter__h1Vv-",warning:"index-module_warning__NKpW6",hotkeyTip:"index-module_hotkeyTip__BSJ6A",wordCount:"index-module_wordCount__OD4eL",focus:"index-module_focus__H07-Y",invalid:"index-module_invalid__F9RC5",inputCount:"index-module_inputCount__--XiT",notify:"index-module_notify__rYuqq",switchItem:"index-module_switchItem__Q256x",placeholderHotkey:"index-module_placeholderHotkey__0SKPo",title:"index-module_title__YRpw9",questionIcon:"index-module_questionIcon__oK1HK",attribute:"index-module_attribute__g8Vbl",clearIcon:"index-module_clearIcon__ZBZqI",disabled:"index-module_disabled__zqh8C",textInputBox:"index-module_textInputBox__C6pdt",textInputChild:"index-module_textInputChild__SOQT6"};export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import i,{useState as v,useRef as U,useMemo as ar,useEffect as P}from"react";import{getWebPcm2WavBase64 as ur}from"../audioAnnotate/utils/getWebPcm2Wac.js";import cr,{debounce as dr,sortBy as mr}from"lodash";import{PauseOutlined as fr,CaretRightOutlined as pr}from"@ant-design/icons";import{cKeyCode as vr,cTool as gr,EventBus as E,TagUtils as br}from"@labelbee/lb-annotation";import{i18n as Je}from"@labelbee/lb-utils";import{Button as yr}from"antd";import _r from"../invalidPage/index.js";import Er from"../imageError/index.js";import{classnames as V}from"../../utils/index.js";import Sr,{EPlayerType as hr}from"../videoPlayer/components/SpeedController/index.js";import Rr from"@labelbee/wavesurfer";import Pr from"@labelbee/wavesurfer/dist/plugin/wavesurfer.regions.js";import Cr from"@labelbee/wavesurfer/dist/plugin/wavesurfer.cursor.js";import Tr,{audioZoomInfo as de}from"./zoomSlider/index.js";import wr from"./labelDisplayToggle/index.js";import Ar from"./clipRegion/index.js";import{useAudioClipStore as jr}from"../audioAnnotate/audioContext/index.js";import{useLatest as X,useUpdate as xr,useDeepCompareEffect as Qe,useThrottleFn as et}from"ahooks";import Dr from"./useAudioScroll/index.js";import y from"./index.module.scss.js";import{getAttributeColor as Lr,formatTime as tt,timeFormat as rt,dispatchResizeEvent as Ir,precisionMinus as nt,isDoubleClick as Mr,getCanMoveRange as kr}from"../../utils/audio.js";import Br from"./progressDot/index.js";import Or from"./clipTip/index.js";import Wr from"./useSwitchHotkey/index.js";import Nr from"./useAudioCombine/index.js";import zr from"./useAudioSegment/index.js";import Fr from"./combineTip/index.js";import $r from"./segmentTip/index.js";import Hr from"../../views/MainView/toolFooter/index.js";import{decimalReserved as Z}from"../videoPlayer/utils.js";import{I18nextProvider as Ur}from"react-i18next";import Vr from"../../hooks/useSize.js";var Xr=Object.defineProperty,Zr=Object.defineProperties,qr=Object.getOwnPropertyDescriptors,ot=Object.getOwnPropertySymbols,Kr=Object.prototype.hasOwnProperty,Gr=Object.prototype.propertyIsEnumerable,it=(f,u,d)=>u in f?Xr(f,u,{enumerable:!0,configurable:!0,writable:!0,value:d}):f[u]=d,me=(f,u)=>{for(var d in u||(u={}))Kr.call(u,d)&&it(f,d,u[d]);if(ot)for(var d of ot(u))Gr.call(u,d)&&it(f,d,u[d]);return f},lt=(f,u)=>Zr(f,qr(u));const{EToolName:st}=gr,q=vr.default,at=.1,ut=i.createContext({count:0,isEdit:!1,toolName:st.Empty,imgIndex:0}),ct=({fileData:f={},onLoaded:u,context:d,invalid:dt,height:mt,hideError:ft,onError:fe,updateRegion:L,removeRegion:$,regions:A=[],activeToolPanel:pt,clipConfigurable:vt,clipTextConfigurable:pe,clipAttributeList:gt,clipAttributeConfigurable:ve,secondaryAttributeConfigurable:bt,subAttributeList:yt,isCheck:S,hoverRegionId:K,footer:_t,drawLayerSlot:ge,clipTextList:Et,lang:be})=>{var ye,_e;const{url:H,path:Ee}=f,[G,Y]=v(!1),[Se,he]=v(!1),[j,St]=v(0),[ht,Re]=v(!1),[C,Pe]=v(0),o=U(null),x=U(null),Ce=U(j),J=e=>{Ce.current=e,St(e)},[Te,Rt]=v(0),[k,Pt]=v(de.defaultValue),h=U(null),[we,Ct]=v({}),{audioClipState:Q,setAudioClipState:B}=jr(),[ee,te]=v(!1),c=X(Q),Ae=X(we);X(G);const I=X(A),je=xr(),[xe,Tt]=v([]),[De,wt]=v({}),[At,Le]=v(""),[Ie,jt]=v({start:0,end:0}),xt=Vr(h),Dt=ar(()=>A.filter(e=>{const{start:t,end:r}=Ie;return e.start>=t&&e.start<=r||e.end>=t&&e.end<=r||e.id===At}),[A,Ie]),Lt=dr(()=>{E.emit("audioZoom")},500),Me=e=>{e<de.min||e>de.max||(Pt(e),Ir(),Lt())};Dr({container:h.current,target:document.querySelector(`[data-id=${(_e=(ye=c.current)==null?void 0:ye.selectedRegion)==null?void 0:_e.id}]`),clipping:ee,zoom:k,zoomHandler:Me});const O=()=>{let e=I.current;const{attributeLockList:t}=c.current;t.length&&(e=e.filter(r=>t.includes(r.attribute))),ne(),e.forEach(r=>{var n;(n=o.current)==null||n.addRegion(lt(me({},r),{drag:!S,resize:!S,color:"rgba(0, 0, 0, 0)"}))}),je()},g=e=>{var t,r,n,l,a,p,b;const{id:s,loop:m=!0,playImmediately:_=!1,isLoopStatus:z}=e,M=!1;if(s){const D=(n=(r=(t=o.current)==null?void 0:t.regions)==null?void 0:r.list)!=null?n:{};Object.entries(D).forEach(([,w])=>{const{id:F}=w;s===F?w.select():w.cancelSelect()}),B({selectedRegion:{id:s,loop:M},selectedAttribute:(p=(a=(l=I.current)==null?void 0:l.find(w=>w.id===s))==null?void 0:a.attribute)!=null?p:""}),_&&((b=W(s))==null||b.play())}else B({selectedRegion:{}})},{combineInstance:It}=Nr({waveRef:o,sortByStartRegions:xe,regionMap:De,updateRegion:L,removeRegion:$,generateRegions:O,setSelectedRegion:g}),{segmentInstance:Mt,onRegionMouseMove:kt,segmentTimeTip:Bt}=zr({waveRef:o,regionMap:De,updateRegion:L,removeRegion:$,generateRegions:O,setSelectedRegion:g}),ke={clipTextConfigurable:pe,clipAttributeList:gt,clipAttributeConfigurable:ve,clipConfigurable:vt,secondaryAttributeConfigurable:bt,subAttributeList:yt,clipTextList:Et};P(()=>{var e;be&&((e=Je)==null||e.changeLanguage(be))},[]),P(()=>{B({selectedAttribute:""})},[ve]),P(()=>{re()},[Q.selectedAttribute]),P(()=>{O()},[Q.attributeLockList]),Qe(()=>{B(ke),setTimeout(()=>{Be()})},[ke]),Qe(()=>{Tt(mr(A,["start"])),wt(A.reduce((e,t)=>{const{id:r}=t;return lt(me({},e),{[r]:t})},{})),S&&O()},[A]),P(()=>{g(K?{id:K,loop:!1,playImmediately:!0}:{})},[K]);const Be=()=>{var e,t;c.current.clipConfigurable?(!S&&o.current&&((e=o.current)==null||e.enableDragSelection({slop:5})),O()):((t=o.current)==null||t.disableDragSelection(),ne()),re()},re=()=>{var e,t,r,n,l;let a="";c.current.clipConfigurable?a=Lr(c.current.selectedAttribute,(e=c.current.clipAttributeList)!=null?e:[]):a="transparent",((r=(t=o==null?void 0:o.current)==null?void 0:t.cursor)==null?void 0:r.cursor)&&((l=(n=o==null?void 0:o.current)==null?void 0:n.cursor)==null||l.setStyle({border:`2px dashed ${a}`}))},W=e=>{var t,r,n;return((n=(r=(t=o.current)==null?void 0:t.regions)==null?void 0:r.list)!=null?n:{})[e]},Oe=()=>{var e,t;if(H){const r=((t=(e=Ee==null?void 0:Ee.split("."))==null?void 0:e.pop())==null?void 0:t.toLowerCase())==="pcm";Re(!1),r?ur(H).then(n=>{We(n)}):We(H)}},We=e=>{var t;e&&(he(!0),J(0),Pe(0),(t=o==null?void 0:o.current)==null||t.load(e))},ne=()=>{var e;(e=o.current)==null||e.clearRegions()},oe=e=>{const t=W(e);t&&(te(!1),t==null||t.remove(),$==null||$(e),g({}))},{run:Ne}=et(g,{wait:100});Wr({sortByStartRegions:xe,setSelectedRegion:g});const Ot=e=>{const{start:t,end:r}=Ae.current;return(t||r)&&e.update(Ae.current),e},Wt=({action:e,id:t,eventDownTime:r})=>{var n,l;if(!c.current.clipConfigurable)return;t&&g({id:t});const a=W((t!=null?t:(n=c.current.selectedRegion)==null?void 0:n.id)||""),p=[];(e==="create"?I.current:(l=I.current)==null?void 0:l.filter(m=>m.id!==a.id)).forEach(m=>{const{start:_,end:z,attribute:M}=m;M===c.current.selectedAttribute&&[_,z].forEach(D=>{p.includes(D)||p.push(D)})});const s=kr(p.sort((m,_)=>m-_),r);o.current.range=s},Nt=e=>{re(),setTimeout(()=>{te(!1)});const t=Ot(e),{id:r,start:n,end:l}=t;g({id:r,playImmediately:!0});const a={id:r,start:Z(n,3),end:Z(l,3)};L==null||L(a),je()},zt=()=>{const e=Rr.create({container:"#waveform",waveColor:"#999",progressColor:"#999",height:mt||245,normalize:!0,cursorWidth:2,cursorColor:"white",responsive:0,hideScrollbar:!0,plugins:[Pr.create({regions:A,dragSelection:{slop:5},canMove:!1}),Cr.create({opacity:1,customStyle:{border:"2px dashed transparent"}})]}),t=()=>{var r;J(((r=o==null?void 0:o.current)==null?void 0:r.getCurrentTime())||0)};e.on("ready",()=>{var r;const n=((r=o==null?void 0:o.current)==null?void 0:r.getDuration())||0;Pe(n),t(),u==null||u({duration:Math.round(n)}),he(!1),N(),E.on("setCurrentTimeByPosition",le),E.on("clearRegions",ne),E.on("removeRegionById",oe),E.on("setSelectedRegion",Ne),e.on("regions-eventDown",Wt),Be()}),e.on("audioprocess",()=>{t()}),e.on("play",()=>{Y(!0)}),e.on("pause",()=>{Y(!1)}),e.on("finish",()=>{Y(!1)}),e.on("seek",()=>{t()}),e.on("error",()=>{Re(!0),u==null||u({hasError:!0}),fe==null||fe()}),e.on("region-created",r=>{var n;const{id:l,start:a,end:p}=r;if(I.current.find(s=>s.id===l))return;Le(l);const b={id:l,start:Z(a,3),end:Z(p,3),attribute:c.current.selectedAttribute,text:""};if(c.current.secondaryAttributeConfigurable){const s=br.getDefaultResultByConfig((n=c.current.subAttributeList)!=null?n:[]);b.subAttribute=s!=null?s:{}}pe&&c.current.clipTextList.forEach((m,_)=>{_===0?Object.assign(b,{text:m==null?void 0:m.default}):Object.assign(b,{[m.key]:m==null?void 0:m.default})}),L==null||L(b)}),e.on("region-updated",(r,n)=>{var l,a,p,b,s,m,_,z,M,D;const w=n==null?void 0:n.action;B({combined:!1,segment:!1}),w==="resize"&&((a=(l=o==null?void 0:o.current)==null?void 0:l.cursor)==null||a.setStyle({borderStyle:"solid"})),w==="drag"&&((b=(p=o==null?void 0:o.current)==null?void 0:p.cursor)==null||b.setStyle({borderColor:"transparent"}));const F={},se=[],ae={},Qt=(s=I.current)==null?void 0:s.filter(R=>R.id!==r.id),er=(z=(_=(m=o.current)==null?void 0:m.regions)==null?void 0:_.list)!=null?z:{};Qt.forEach(R=>{var Ke,Ge;const{element:ue}=(Ke=er[R.id])!=null?Ke:{},{start:nr,end:or}=R;if(ue){const{x:Ye,width:ir}=((Ge=ue.getBoundingClientRect)==null?void 0:Ge.call(ue))||{},lr=Ye+ir;[Ye,lr].forEach((ce,sr)=>{se.includes(ce)||(se.push(ce),ae[ce]=sr===0?nr:or)})}});const{x:qe,width:tr}=((D=(M=r.element).getBoundingClientRect)==null?void 0:D.call(M))||{},rr=qe+tr;se.forEach(R=>{Math.abs(nt(R,qe))<5&&(F.start=ae[R]),Math.abs(nt(R,rr))<5&&(F.end=ae[R])}),Ct(F),Ne({id:r.id}),te(!0)}),e.on("region-update-end",r=>{Nt(r),Le("")}),e.on("region-contextmenu",(r,n)=>{if(!S){if(n.preventDefault(),n.stopPropagation(),Mr(n)){oe(r.id);return}g({id:r.id,playImmediately:!0})}}),e.on("region-click",(r,n,l)=>{if(!S){if(n.preventDefault(),n.stopPropagation(),c.current.combined){It(r);return}if(c.current.segment){Mt(r,l);return}g({id:r.id,playImmediately:!0})}}),e.on("region-mousemove",kt),o.current=e},Ft=G?i.createElement(fr,null):i.createElement(pr,null),ze=e=>e?`${parseFloat((e/C*100).toFixed(4))}%`:"0%",Fe=ze(j),$t=ze(Te),T=()=>{if(!Se)return o==null?void 0:o.current},Ht=()=>{var e;(e=T())==null||e.skipForward(at)},Ut=()=>{var e;(e=T())==null||e.skipBackward(at)},N=()=>{var e;(e=T())==null||e.playPause()},$e=e=>{var t;switch(e.keyCode){case q.Right:Ht();break;case q.Left:Ut();break;case q.Space:e.preventDefault(),N();break;case q.Delete:if(!S){const{id:r}=((t=c.current)==null?void 0:t.selectedRegion)||{};r&&oe(r)}break}},Vt=e=>{le(e)},He=cr.throttle(Vt,50);let ie=!1;const Ue=()=>{ie&&(N(),ie=!1),document.removeEventListener("mousemove",He),document.removeEventListener("mouseup",Ue)},Xt=e=>{le(e),G&&(ie=!0,N()),document.addEventListener("mousemove",He),document.addEventListener("mouseup",Ue)},Zt=()=>{Oe()};P(()=>(zt(),()=>{var e;(e=o==null?void 0:o.current)==null||e.destroy(),o.current=null,E.unbindAll("setCurrentTimeByPosition"),E.unbindAll("clearRegions"),E.unbindAll("removeRegionById"),E.unbindAll("setSelectedRegion")}),[]);const qt=e=>{var t,r,n;(t=T())==null||t.playPause(),(r=T())==null||r.setPlaybackRate(e),(n=T())==null||n.playPause()};P(()=>(document.addEventListener("keydown",$e),()=>{document.removeEventListener("keydown",$e)})),P(()=>{g({}),Oe()},[H]),P(()=>{Ve()},[xt,C,k]);const Kt=()=>{if(h.current&&C){const e=h.current.scrollLeft,t=h.current.clientWidth,r=e/h.current.scrollWidth*C,n=(e+t)/h.current.scrollWidth*C;jt({start:r,end:n})}},{run:Ve}=et(Kt,{wait:300}),Xe=e=>{var t,r,n,l;if((o==null?void 0:o.current)&&(x==null?void 0:x.current)){const a=(r=(t=o==null?void 0:o.current)==null?void 0:t.getDuration())!=null?r:0,p=(n=x==null?void 0:x.current)==null?void 0:n.getBoundingClientRect();let s=(e.clientX-p.left)/(((l=x==null?void 0:x.current)==null?void 0:l.clientWidth)||0)*a;return s>a&&(s=a),s}return 0},le=e=>{var t;const r=Xe(e);(t=o==null?void 0:o.current)==null||t.skip(r-Ce.current),J(r)},Gt=e=>{Rt(Xe(e))},Yt=C?Math.max(C-j,0):0,Jt=(d==null?void 0:d.toolName)!==st.Empty&&(d==null?void 0:d.isEdit)!==!0&&(pt==="remark"||S),Ze=i.createElement("div",{className:y.audioPlayer},ht&&!ft&&i.createElement(Er,{fileTypeName:"\u97F3\u9891",ignoreOffsetY:!0,reloadImage:Zt,backgroundColor:"#ffffffbb"}),i.createElement(Or,{getRegionInstanceById:W,clipping:ee}),i.createElement(Fr,{container:h.current}),i.createElement($r,{segmentTimeTip:Bt}),i.createElement("div",{className:y.waveformContainer,ref:h,onScroll:()=>Ve()},i.createElement("div",{id:"waveform",style:{width:`${k*100}%`},className:V({[y.waveform]:!0,"bee-audio-combined":c.current.combined,"bee-audio-clip":c.current.clipConfigurable})},dt&&i.createElement(_r,{isAudio:!0}),i.createElement("div",{ref:x,className:y.progress,onMouseDown:Xt,onMouseMove:Gt},i.createElement("div",{className:V({[y.radioTooltip]:!0}),style:{left:Fe}},tt(j)),i.createElement("div",{className:V({[y.radioTooltip]:!0,[y.mouseTooltip]:!0}),style:{left:$t}},tt(Te)),i.createElement(Br,{playPercentage:Fe})),Jt&&(ge==null?void 0:ge({currentTime:j,remainingTime:Yt,audioPlayer:T()})))),i.createElement("div",{className:y.controlBar},i.createElement(yr,{type:"link",icon:Ft,onClick:()=>{N()},className:V({[y.playButton]:!0,[y.playButtonDisabled]:Se})}),i.createElement("span",{className:y.time},`${rt(j,"ss.SSS")} / -${rt(C-j,"ss.SSS")}`),i.createElement(Sr,{playerType:hr.Audio,onChange:e=>{qt(e)}}),i.createElement(Tr,{onChange:e=>{var t;(t=T())==null||t.pause(),Me(e)},zoom:k}),i.createElement(wr,{EventBus:E})));return d?i.createElement(ut.Provider,{value:d},Ze,Dt.map(e=>{const{id:t}=e,r=document.querySelector(`[data-id=${t}]`);return r?i.createElement(Ar,{el:r,key:t,region:e,edgeAdsorption:we,clipping:ee,zoom:k,instance:W(t),isCheck:S}):null}),i.createElement(Hr,{footer:_t})):Ze},Yr=f=>i.createElement(Ur,{i18n:Je},i.createElement(ct,me({},f)));export{ct as AudioPlayer,ut as AudioPlayerContext,Yr as WrapAudioPlayer};
|
|
1
|
+
import i,{useState as v,useRef as U,useMemo as ar,useEffect as P}from"react";import{getWebPcm2WavBase64 as ur}from"../audioAnnotate/utils/getWebPcm2Wac.js";import cr,{debounce as dr,sortBy as mr}from"lodash";import{PauseOutlined as fr,CaretRightOutlined as pr}from"@ant-design/icons";import{cKeyCode as vr,cTool as gr,EventBus as E,TagUtils as br}from"@labelbee/lb-annotation";import{i18n as Je}from"@labelbee/lb-utils";import{Button as yr}from"antd";import _r from"../invalidPage/index.js";import Er from"../imageError/index.js";import{classnames as V}from"../../utils/index.js";import Sr,{EPlayerType as hr}from"../videoPlayer/components/SpeedController/index.js";import Rr from"@labelbee/wavesurfer";import Pr from"@labelbee/wavesurfer/dist/plugin/wavesurfer.regions.js";import Cr from"@labelbee/wavesurfer/dist/plugin/wavesurfer.cursor.js";import Tr,{audioZoomInfo as me}from"./zoomSlider/index.js";import wr from"./labelDisplayToggle/index.js";import Ar from"./clipRegion/index.js";import{useAudioClipStore as jr}from"../audioAnnotate/audioContext/index.js";import{useLatest as X,useUpdate as xr,useDeepCompareEffect as Qe,useThrottleFn as et}from"ahooks";import Dr from"./useAudioScroll/index.js";import y from"./index.module.scss.js";import{getAttributeColor as Lr,formatTime as tt,timeFormat as rt,dispatchResizeEvent as Ir,precisionMinus as nt,isDoubleClick as Mr,getCanMoveRange as kr}from"../../utils/audio.js";import Br from"./progressDot/index.js";import Or from"./clipTip/index.js";import Wr from"./useSwitchHotkey/index.js";import Nr from"./useAudioCombine/index.js";import zr from"./useAudioSegment/index.js";import Fr from"./combineTip/index.js";import $r from"./segmentTip/index.js";import Hr from"../../views/MainView/toolFooter/index.js";import{decimalReserved as Z}from"../videoPlayer/utils.js";import{I18nextProvider as Ur}from"react-i18next";import Vr from"../../hooks/useSize.js";var Xr=Object.defineProperty,Zr=Object.defineProperties,qr=Object.getOwnPropertyDescriptors,ot=Object.getOwnPropertySymbols,Kr=Object.prototype.hasOwnProperty,Gr=Object.prototype.propertyIsEnumerable,it=(f,u,d)=>u in f?Xr(f,u,{enumerable:!0,configurable:!0,writable:!0,value:d}):f[u]=d,fe=(f,u)=>{for(var d in u||(u={}))Kr.call(u,d)&&it(f,d,u[d]);if(ot)for(var d of ot(u))Gr.call(u,d)&&it(f,d,u[d]);return f},lt=(f,u)=>Zr(f,qr(u));const{EToolName:st}=gr,q=vr.default,at=.1,ut=i.createContext({count:0,isEdit:!1,toolName:st.Empty,imgIndex:0}),ct=({fileData:f={},onLoaded:u,context:d,invalid:dt,height:mt,hideError:ft,onError:pe,updateRegion:L,removeRegion:$,regions:A=[],activeToolPanel:pt,clipConfigurable:vt,clipTextConfigurable:ve,clipAttributeList:gt,clipAttributeConfigurable:ge,secondaryAttributeConfigurable:bt,subAttributeList:yt,isCheck:S,hoverRegionId:K,footer:_t,drawLayerSlot:be,clipTextList:Et,lang:ye})=>{var _e,Ee;const{url:H,path:Se}=f,[G,Y]=v(!1),[he,J]=v(!1),[j,St]=v(0),[ht,Re]=v(!1),[C,Pe]=v(0),o=U(null),x=U(null),Ce=U(j),Q=e=>{Ce.current=e,St(e)},[Te,Rt]=v(0),[k,Pt]=v(me.defaultValue),h=U(null),[we,Ct]=v({}),{audioClipState:ee,setAudioClipState:B}=jr(),[te,re]=v(!1),c=X(ee),Ae=X(we);X(G);const I=X(A),je=xr(),[xe,Tt]=v([]),[De,wt]=v({}),[At,Le]=v(""),[Ie,jt]=v({start:0,end:0}),xt=Vr(h),Dt=ar(()=>A.filter(e=>{const{start:t,end:r}=Ie;return e.start>=t&&e.start<=r||e.end>=t&&e.end<=r||e.id===At}),[A,Ie]),Lt=dr(()=>{E.emit("audioZoom")},500),Me=e=>{e<me.min||e>me.max||(Pt(e),Ir(),Lt())};Dr({container:h.current,target:document.querySelector(`[data-id=${(Ee=(_e=c.current)==null?void 0:_e.selectedRegion)==null?void 0:Ee.id}]`),clipping:te,zoom:k,zoomHandler:Me});const O=()=>{let e=I.current;const{attributeLockList:t}=c.current;t.length&&(e=e.filter(r=>t.includes(r.attribute))),oe(),e.forEach(r=>{var n;(n=o.current)==null||n.addRegion(lt(fe({},r),{drag:!S,resize:!S,color:"rgba(0, 0, 0, 0)"}))}),je()},g=e=>{var t,r,n,l,a,p,b;const{id:s,loop:m=!0,playImmediately:_=!1,isLoopStatus:z}=e,M=!1;if(s){const D=(n=(r=(t=o.current)==null?void 0:t.regions)==null?void 0:r.list)!=null?n:{};Object.entries(D).forEach(([,w])=>{const{id:F}=w;s===F?w.select():w.cancelSelect()}),B({selectedRegion:{id:s,loop:M},selectedAttribute:(p=(a=(l=I.current)==null?void 0:l.find(w=>w.id===s))==null?void 0:a.attribute)!=null?p:""}),_&&((b=W(s))==null||b.play())}else B({selectedRegion:{}})},{combineInstance:It}=Nr({waveRef:o,sortByStartRegions:xe,regionMap:De,updateRegion:L,removeRegion:$,generateRegions:O,setSelectedRegion:g}),{segmentInstance:Mt,onRegionMouseMove:kt,segmentTimeTip:Bt}=zr({waveRef:o,regionMap:De,updateRegion:L,removeRegion:$,generateRegions:O,setSelectedRegion:g}),ke={clipTextConfigurable:ve,clipAttributeList:gt,clipAttributeConfigurable:ge,clipConfigurable:vt,secondaryAttributeConfigurable:bt,subAttributeList:yt,clipTextList:Et};P(()=>{var e;ye&&((e=Je)==null||e.changeLanguage(ye))},[]),P(()=>{B({selectedAttribute:""})},[ge]),P(()=>{ne()},[ee.selectedAttribute]),P(()=>{O()},[ee.attributeLockList]),Qe(()=>{B(ke),setTimeout(()=>{Be()})},[ke]),Qe(()=>{Tt(mr(A,["start"])),wt(A.reduce((e,t)=>{const{id:r}=t;return lt(fe({},e),{[r]:t})},{})),S&&O()},[A]),P(()=>{g(K?{id:K,loop:!1,playImmediately:!0}:{})},[K]);const Be=()=>{var e,t;c.current.clipConfigurable?(!S&&o.current&&((e=o.current)==null||e.enableDragSelection({slop:5})),O()):((t=o.current)==null||t.disableDragSelection(),oe()),ne()},ne=()=>{var e,t,r,n,l;let a="";c.current.clipConfigurable?a=Lr(c.current.selectedAttribute,(e=c.current.clipAttributeList)!=null?e:[]):a="transparent",((r=(t=o==null?void 0:o.current)==null?void 0:t.cursor)==null?void 0:r.cursor)&&((l=(n=o==null?void 0:o.current)==null?void 0:n.cursor)==null||l.setStyle({border:`2px dashed ${a}`}))},W=e=>{var t,r,n;return((n=(r=(t=o.current)==null?void 0:t.regions)==null?void 0:r.list)!=null?n:{})[e]},Oe=()=>{var e,t;if(H){const r=((t=(e=Se==null?void 0:Se.split("."))==null?void 0:e.pop())==null?void 0:t.toLowerCase())==="pcm";Re(!1),r?ur(H).then(n=>{We(n)}):We(H)}},We=e=>{var t;e&&(J(!0),Q(0),Pe(0),(t=o==null?void 0:o.current)==null||t.load(e))},oe=()=>{var e;(e=o.current)==null||e.clearRegions()},ie=e=>{const t=W(e);t&&(re(!1),t==null||t.remove(),$==null||$(e),g({}))},{run:Ne}=et(g,{wait:100});Wr({sortByStartRegions:xe,setSelectedRegion:g});const Ot=e=>{const{start:t,end:r}=Ae.current;return(t||r)&&e.update(Ae.current),e},Wt=({action:e,id:t,eventDownTime:r})=>{var n,l;if(!c.current.clipConfigurable)return;t&&g({id:t});const a=W((t!=null?t:(n=c.current.selectedRegion)==null?void 0:n.id)||""),p=[];(e==="create"?I.current:(l=I.current)==null?void 0:l.filter(m=>m.id!==a.id)).forEach(m=>{const{start:_,end:z,attribute:M}=m;M===c.current.selectedAttribute&&[_,z].forEach(D=>{p.includes(D)||p.push(D)})});const s=kr(p.sort((m,_)=>m-_),r);o.current.range=s},Nt=e=>{ne(),setTimeout(()=>{re(!1)});const t=Ot(e),{id:r,start:n,end:l}=t;g({id:r,playImmediately:!0});const a={id:r,start:Z(n,3),end:Z(l,3)};L==null||L(a),je()},zt=()=>{const e=Rr.create({container:"#waveform",waveColor:"#999",progressColor:"#999",height:mt||245,normalize:!0,cursorWidth:2,cursorColor:"white",responsive:0,hideScrollbar:!0,plugins:[Pr.create({regions:A,dragSelection:{slop:5},canMove:!1}),Cr.create({opacity:1,customStyle:{border:"2px dashed transparent"}})]}),t=()=>{var r;Q(((r=o==null?void 0:o.current)==null?void 0:r.getCurrentTime())||0)};e.on("ready",()=>{var r;const n=((r=o==null?void 0:o.current)==null?void 0:r.getDuration())||0;Pe(n),t(),u==null||u({duration:Math.round(n)}),J(!1),N(),E.on("setCurrentTimeByPosition",se),E.on("clearRegions",oe),E.on("removeRegionById",ie),E.on("setSelectedRegion",Ne),e.on("regions-eventDown",Wt),Be()}),e.on("audioprocess",()=>{t()}),e.on("play",()=>{Y(!0)}),e.on("pause",()=>{Y(!1)}),e.on("finish",()=>{Y(!1)}),e.on("seek",()=>{t()}),e.on("error",()=>{Re(!0),J(!1),u==null||u({hasError:!0}),pe==null||pe()}),e.on("region-created",r=>{var n;const{id:l,start:a,end:p}=r;if(I.current.find(s=>s.id===l))return;Le(l);const b={id:l,start:Z(a,3),end:Z(p,3),attribute:c.current.selectedAttribute,text:""};if(c.current.secondaryAttributeConfigurable){const s=br.getDefaultResultByConfig((n=c.current.subAttributeList)!=null?n:[]);b.subAttribute=s!=null?s:{}}ve&&c.current.clipTextList.forEach((m,_)=>{_===0?Object.assign(b,{text:m==null?void 0:m.default}):Object.assign(b,{[m.key]:m==null?void 0:m.default})}),L==null||L(b)}),e.on("region-updated",(r,n)=>{var l,a,p,b,s,m,_,z,M,D;const w=n==null?void 0:n.action;B({combined:!1,segment:!1}),w==="resize"&&((a=(l=o==null?void 0:o.current)==null?void 0:l.cursor)==null||a.setStyle({borderStyle:"solid"})),w==="drag"&&((b=(p=o==null?void 0:o.current)==null?void 0:p.cursor)==null||b.setStyle({borderColor:"transparent"}));const F={},ae=[],ue={},Qt=(s=I.current)==null?void 0:s.filter(R=>R.id!==r.id),er=(z=(_=(m=o.current)==null?void 0:m.regions)==null?void 0:_.list)!=null?z:{};Qt.forEach(R=>{var Ke,Ge;const{element:ce}=(Ke=er[R.id])!=null?Ke:{},{start:nr,end:or}=R;if(ce){const{x:Ye,width:ir}=((Ge=ce.getBoundingClientRect)==null?void 0:Ge.call(ce))||{},lr=Ye+ir;[Ye,lr].forEach((de,sr)=>{ae.includes(de)||(ae.push(de),ue[de]=sr===0?nr:or)})}});const{x:qe,width:tr}=((D=(M=r.element).getBoundingClientRect)==null?void 0:D.call(M))||{},rr=qe+tr;ae.forEach(R=>{Math.abs(nt(R,qe))<5&&(F.start=ue[R]),Math.abs(nt(R,rr))<5&&(F.end=ue[R])}),Ct(F),Ne({id:r.id}),re(!0)}),e.on("region-update-end",r=>{Nt(r),Le("")}),e.on("region-contextmenu",(r,n)=>{if(!S){if(n.preventDefault(),n.stopPropagation(),Mr(n)){ie(r.id);return}g({id:r.id,playImmediately:!0})}}),e.on("region-click",(r,n,l)=>{if(!S){if(n.preventDefault(),n.stopPropagation(),c.current.combined){It(r);return}if(c.current.segment){Mt(r,l);return}g({id:r.id,playImmediately:!0})}}),e.on("region-mousemove",kt),o.current=e},Ft=G?i.createElement(fr,null):i.createElement(pr,null),ze=e=>e?`${parseFloat((e/C*100).toFixed(4))}%`:"0%",Fe=ze(j),$t=ze(Te),T=()=>{if(!he)return o==null?void 0:o.current},Ht=()=>{var e;(e=T())==null||e.skipForward(at)},Ut=()=>{var e;(e=T())==null||e.skipBackward(at)},N=()=>{var e;(e=T())==null||e.playPause()},$e=e=>{var t;switch(e.keyCode){case q.Right:Ht();break;case q.Left:Ut();break;case q.Space:e.preventDefault(),N();break;case q.Delete:if(!S){const{id:r}=((t=c.current)==null?void 0:t.selectedRegion)||{};r&&ie(r)}break}},Vt=e=>{se(e)},He=cr.throttle(Vt,50);let le=!1;const Ue=()=>{le&&(N(),le=!1),document.removeEventListener("mousemove",He),document.removeEventListener("mouseup",Ue)},Xt=e=>{se(e),G&&(le=!0,N()),document.addEventListener("mousemove",He),document.addEventListener("mouseup",Ue)},Zt=()=>{Oe()};P(()=>(zt(),()=>{var e;(e=o==null?void 0:o.current)==null||e.destroy(),o.current=null,E.unbindAll("setCurrentTimeByPosition"),E.unbindAll("clearRegions"),E.unbindAll("removeRegionById"),E.unbindAll("setSelectedRegion")}),[]);const qt=e=>{var t,r,n;(t=T())==null||t.playPause(),(r=T())==null||r.setPlaybackRate(e),(n=T())==null||n.playPause()};P(()=>(document.addEventListener("keydown",$e),()=>{document.removeEventListener("keydown",$e)})),P(()=>{g({}),Oe()},[H]),P(()=>{Ve()},[xt,C,k]);const Kt=()=>{if(h.current&&C){const e=h.current.scrollLeft,t=h.current.clientWidth,r=e/h.current.scrollWidth*C,n=(e+t)/h.current.scrollWidth*C;jt({start:r,end:n})}},{run:Ve}=et(Kt,{wait:300}),Xe=e=>{var t,r,n,l;if((o==null?void 0:o.current)&&(x==null?void 0:x.current)){const a=(r=(t=o==null?void 0:o.current)==null?void 0:t.getDuration())!=null?r:0,p=(n=x==null?void 0:x.current)==null?void 0:n.getBoundingClientRect();let s=(e.clientX-p.left)/(((l=x==null?void 0:x.current)==null?void 0:l.clientWidth)||0)*a;return s>a&&(s=a),s}return 0},se=e=>{var t;const r=Xe(e);(t=o==null?void 0:o.current)==null||t.skip(r-Ce.current),Q(r)},Gt=e=>{Rt(Xe(e))},Yt=C?Math.max(C-j,0):0,Jt=(d==null?void 0:d.toolName)!==st.Empty&&(d==null?void 0:d.isEdit)!==!0&&(pt==="remark"||S),Ze=i.createElement("div",{className:y.audioPlayer},ht&&!ft&&i.createElement(Er,{fileTypeName:"\u97F3\u9891",ignoreOffsetY:!0,reloadImage:Zt,backgroundColor:"#ffffffbb"}),i.createElement(Or,{getRegionInstanceById:W,clipping:te}),i.createElement(Fr,{container:h.current}),i.createElement($r,{segmentTimeTip:Bt}),i.createElement("div",{className:y.waveformContainer,ref:h,onScroll:()=>Ve()},i.createElement("div",{id:"waveform",style:{width:`${k*100}%`},className:V({[y.waveform]:!0,"bee-audio-combined":c.current.combined,"bee-audio-clip":c.current.clipConfigurable})},dt&&i.createElement(_r,{isAudio:!0}),i.createElement("div",{ref:x,className:y.progress,onMouseDown:Xt,onMouseMove:Gt},i.createElement("div",{className:V({[y.radioTooltip]:!0}),style:{left:Fe}},tt(j)),i.createElement("div",{className:V({[y.radioTooltip]:!0,[y.mouseTooltip]:!0}),style:{left:$t}},tt(Te)),i.createElement(Br,{playPercentage:Fe})),Jt&&(be==null?void 0:be({currentTime:j,remainingTime:Yt,audioPlayer:T()})))),i.createElement("div",{className:y.controlBar},i.createElement(yr,{type:"link",icon:Ft,onClick:()=>{N()},className:V({[y.playButton]:!0,[y.playButtonDisabled]:he})}),i.createElement("span",{className:y.time},`${rt(j,"ss.SSS")} / -${rt(C-j,"ss.SSS")}`),i.createElement(Sr,{playerType:hr.Audio,onChange:e=>{qt(e)}}),i.createElement(Tr,{onChange:e=>{var t;(t=T())==null||t.pause(),Me(e)},zoom:k}),i.createElement(wr,{EventBus:E})));return d?i.createElement(ut.Provider,{value:d},Ze,Dt.map(e=>{const{id:t}=e,r=document.querySelector(`[data-id=${t}]`);return r?i.createElement(Ar,{el:r,key:t,region:e,edgeAdsorption:we,clipping:te,zoom:k,instance:W(t),isCheck:S}):null}),i.createElement(Hr,{footer:_t})):Ze},Yr=f=>i.createElement(Ur,{i18n:Je},i.createElement(ct,fe({},f)));export{ct as AudioPlayer,ut as AudioPlayerContext,Yr as WrapAudioPlayer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useLatest as oe,useMemoizedFn as
|
|
1
|
+
import{useLatest as oe,useMemoizedFn as Z,useDebounceEffect as Ie}from"ahooks";import{Spin as he}from"antd/es";import q,{useContext as De,useRef as J,useState as O,useMemo as _e,useCallback as be,useEffect as p}from"react";import{connect as Ce}from"react-redux";import{usePointCloudViews as we}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as xe}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as ye}from"../../store/annotation/map.js";import{LabelBeeContext as Pe}from"../../store/ctx.js";import{PointCloud2DRectOperation as Se,ImgUtils as Le}from"@labelbee/lb-annotation";import{ImgPosUtils as Oe}from"@labelbee/lb-utils";import{selectSpecifiedRectsFromTopViewSelectedIds as Ve}from"./util.js";import{useUpdateRectList as Ee}from"./useUpdateRectList.js";import je from"lodash";import{useToolStyleContext as Be}from"../../hooks/useToolStyle.js";import Ne from"../../store/toolConfig/index.js";var ke=Object.defineProperty,Ue=Object.defineProperties,ze=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable,le=(a,c,s)=>c in a?ke(a,c,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[c]=s,v=(a,c)=>{for(var s in c||(c={}))Ae.call(c,s)&&le(a,s,c[s]);if(ie)for(var s of ie(c))Me.call(c,s)&&le(a,s,c[s]);return a},C=(a,c)=>Ue(a,ze(c)),$=(a,c,s)=>new Promise((f,g)=>{var _=u=>{try{b(s.next(u))}catch(R){g(R)}},V=u=>{try{b(s.throw(u))}catch(R){g(R)}},b=u=>u.done?f(u.value):Promise.resolve(u.value).then(_,V);b((s=s.apply(a,c)).next())});const Te=a=>{var c,s;const{mappingData:f,size:g,config:_,checkMode:V,afterImgOnLoad:b,shouldExcludePointCloudBoxListUpdate:u}=a,{selectBoxVisibleSwitch:R}=Ne(),E=(c=f==null?void 0:f.url)!=null?c:"",w=(s=f==null?void 0:f.fallbackUrl)!=null?s:"",{pointCloudBoxList:j,setPointCloudResult:B,defaultAttribute:N,rectList:k,addRectIn2DView:ce,updateRectIn2DView:se,removeRectIn2DView:ue,updateRectListByReducer:de,selectedIDs:m,setSelectedIDs:U,selectedID:x}=De(xe),{value:z}=Be(),ae=oe(m),{update2DViewRect:fe,remove2DViewRect:pe}=we(),A=q.useRef(null),n=J(null),G=Z(fe),y=Z(pe),P=J(null),[me,K]=O(!0),[Q,W]=O(""),[ve,M]=O(!1),[ge,S]=O(!0),I=_e(()=>k==null?void 0:k.filter(e=>e.imageName===(f==null?void 0:f.path)),[f==null?void 0:f.path,k]),X=J(I),L=oe(f==null?void 0:f.path),T=be(e=>$(void 0,null,function*(){try{const o=ae.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(o.length){const r=new Set(o),i=t.filter(l=>r.has(l.id)).map(l=>l.id);U(i)}return t}catch(o){}}),[U]),Y=e=>{const{boxID:o}=e;if(S(!1),!u&&o){T(()=>{const t=G==null?void 0:G(e);return t?(P.current=t,B(t),t):null});return}se(e,!0)},ee=e=>{L.current&&ce(C(v({},e),{imageName:L.current}))},te=e=>{if(e.length===0)return;if(!u){const t=e.find(r=>r.boxID);if(t){T(()=>{const r=y==null?void 0:y(t);return r?(P.current=r,B(r),h(),r):null});return}}const o=e.find(t=>t.extId);o&&T(()=>{const{imageName:t,extId:r}=o,i=y==null?void 0:y({boxID:r,imageName:t});return i?(P.current=i,B(i),i):null}),ue(e)},Re=Z(()=>{let e=[];return j.forEach(o=>{const{rects:t=[],id:r,attribute:i,trackID:l}=o,d=t.find(F=>F.imageName===L.current),D=r+"_"+L.current;d&&(e=[...e,C(v({},d),{boxID:r,id:D,attribute:i,order:l})])}),e}),h=Ee(()=>{var e,o,t,r,i;const l=u?[]:Re(),d=(e=n.current)==null?void 0:e.selectedRectID,D=m.slice(0),F=R?Ve(D,l,I):[...l,...I];let ne=[];!R&&(m==null?void 0:m.length)&&(ne=l.filter(H=>d?m.includes(H.boxID)&&!d.includes(H.boxID):m.includes(H.boxID))),(o=n.current)==null||o.setHighLightRectList(ne),(t=n.current)==null||t.setResult(F),Q?((r=n.current)==null||r.setSelectedRectID(Q),W("")):ve&&d&&((i=n.current)==null||i.setSelectedRectID(d),M(!1))}),re=({targetId:e,id:o})=>{S(!1),U(e),W(o)};return p(()=>{if(A.current){const e=new Se({container:A.current,size:g,config:C(v({},_),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:V});return n.current=e,n.current.init(),n.current.on("updateDragResult",Y),n.current.on("afterAddingDrawingRect",ee),n.current.on("deleteSelectedRects",te),n.current.on("onRightClick",re),()=>{var o,t,r,i,l;(o=n.current)==null||o.unbind("updateDragResult",Y),(t=n.current)==null||t.unbind("afterAddingDrawingRect",ee),(r=n.current)==null||r.unbind("deleteSelectedRects",te),(i=n.current)==null||i.unbind("onRightClick",re),(l=n.current)==null||l.destroy()}}},[]),p(()=>{const e=t=>$(void 0,null,function*(){try{return yield Le.load(t)}catch(r){return console.error("Error loading image:",r),null}}),o=()=>$(void 0,null,function*(){var t;K(!0);let r=yield e(E);!r&&w&&(r=yield e(w)),r&&((t=n.current)==null||t.setImgNode(r),b(r)),K(!1)});n.current&&(E||w)&&o()},[E,w]),p(()=>{var e;(e=n.current)==null||e.setSize(g)},[g]),p(()=>{j!==P.current&&h()},[j]),p(()=>{var e,o;const t=I.find(r=>r.id===n.current.selectedRectID);(o=(e=n.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,N),t&&de(r=>{var i;const l=[];let d=null;return r.forEach(D=>{D.id!==n.current.selectedRectID?l.push(D):d=D}),t.extId===void 0&&(d=(i=n.current)==null?void 0:i.selectedRect),[...l,C(v({},d||{}),{attribute:N})]}),M(!0),h()},[N]),p(()=>{const e=X.current;je.isEqual(e,I)||(M(!0),h(),X.current=I)},[I]),p(()=>{h()},[u]),p(()=>{var e,o,t,r;const i=(o=(e=n.current)==null?void 0:e.config)!=null?o:{},l=C(v({},i),{attributeList:(t=_.attributeList)!=null?t:[]});(r=n.current)==null||r.setConfig(JSON.stringify(l))},[_.attributeList]),p(()=>{var e;(e=n.current)==null||e.setEnableAddRect(m.length===0),h()},[m]),Ie(()=>{if(!x||!ge){S(!0),u&&(n.current.setHoverRectID(""),n.current.render());return}const{rectList:e,size:o,zoom:t,imgNode:r}=n.current,i=e.find(d=>d.boxID===x||d.extId===x),l=Oe.getBasicRecPos(r,i,o,.5);if(!l){S(!0);return}u&&n.current.setHoverRectID(i.id),n.current.setCurrentPos(l.currentPos),n.current.setZoom(l.innerZoom),n.current.renderBasicCanvas(),n.current.render()},[x],{wait:200}),p(()=>{const{hiddenText:e}=z||{};if(e===void 0)return;const o=n.current;if(!o)return;const t=v(v({},o.style),z);o.setStyle(t)},[z]),p(()=>{h()},[R]),q.createElement(he,{spinning:me},q.createElement("div",{ref:A,style:v({position:"relative"},g)}))};var Fe=Ce(ye,null,null,{context:Pe})(Te);export{Fe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as d}from"../../utils/dom.js";import{cKeyCode as
|
|
1
|
+
import{getClassName as d}from"../../utils/dom.js";import{cKeyCode as W,PointCloud as X}from"@labelbee/lb-annotation";import{PointCloudUtils as S,EPerspectiveView as E}from"@labelbee/lb-utils";import O from"classnames";import o,{useContext as T,useState as b,useRef as Y,useEffect as u,useMemo as $}from"react";import{PointCloudContainer as ee}from"./PointCloudLayout.js";import{PointCloudContext as te}from"./PointCloudContext.js";import{a2MapStateToProps as oe}from"../../store/annotation/map.js";import{connect as ne}from"react-redux";import{jsonParser as ie}from"../../utils/index.js";import{useSingleBox as le}from"./hooks/useSingleBox.js";import{useSphere as re}from"./hooks/useSphere.js";import{Switch as ae,Tooltip as se}from"antd";import ce from"../../hooks/useSize.js";import{usePointCloudViews as de}from"./hooks/usePointCloudViews.js";import{useTranslation as R}from"react-i18next";import{LabelBeeContext as me}from"../../store/ctx.js";import ue from"./components/PointCloudSizeSlider/index.js";import pe from"./components/TitleButton/index.js";import{LeftOutlined as we}from"@ant-design/icons";import{useToolStyleContext as ve}from"../../hooks/useToolStyle.js";import{usePointCloudAttribute as fe}from"./hooks/usePointCloudAttribute.js";var Ce=Object.defineProperty,A=Object.getOwnPropertySymbols,Ve=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable,F=(n,l,a)=>l in n?Ce(n,l,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[l]=a,Pe=(n,l)=>{for(var a in l||(l={}))Ve.call(l,a)&&F(n,a,l[a]);if(A)for(var a of A(l))ge.call(l,a)&&F(n,a,l[a]);return n};const Ee=W.default,Ie="LABELBEE-POINTCLOUD",I=o.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),w=({perspectiveView:n})=>{const{isActive:l,setTarget3DView:a}=T(I),f=p=>O({[d("point-cloud-3d-view",p)]:!0,active:l});return o.createElement("span",{onClick:()=>{a(E[n])},className:f(n.toLocaleLowerCase())})},H=({isEnlarge:n})=>{const{reset3DView:l,followTopView:a}=T(I),{t:f}=R(),p=o.createElement(o.Fragment,null,o.createElement(w,{perspectiveView:"Top"}),o.createElement(w,{perspectiveView:"Front"}),o.createElement(w,{perspectiveView:"Left"}),o.createElement(w,{perspectiveView:"Back"}),o.createElement(w,{perspectiveView:"Right"}),o.createElement(w,{perspectiveView:"LFT"}),o.createElement(w,{perspectiveView:"RBT"})),t=o.createElement(o.Fragment,null,o.createElement(se,{title:f("CameraFollowTopView")},o.createElement("span",{onClick:()=>{a()},className:d("point-cloud-3d-view","followTop")})),o.createElement("span",{onClick:()=>{l()},className:d("point-cloud-3d-view","reset")}));return n?o.createElement("div",{className:d("point-cloud-3d-sidebarZoom")},t,p):o.createElement("div",{className:d("point-cloud-3d-sidebar")},p,t)},he=({currentData:n,config:l,highlightAttribute:a,setResourceLoading:f})=>{var p;const t=T(te),[U,K]=b(!0),[C,h]=b(!1),V=Y(null),{initPointCloud3d:y}=de(),g=ce(V),{t:x}=R(),{value:B}=ve(),{hiddenText:L}=B||{},{updatePointCloudAttribute:M}=fe(f,l);u(()=>{let e=t.mainViewInstance;e&&e.updateHiddenTextAndRender(L,t.pointCloudBoxList)},[B]),u(()=>{!t.mainViewInstance||y==null||y(g)},[g]);const{selectedBox:m}=le(),{selectedSphere:P}=re(),[Z,j]=b(!0),_=e=>{var i,s;const r=m==null?void 0:m.info;if(r){const c=Pe({},r.center);c.x=c.x-.01,c.z=1e3;const v=e===E.Top;(i=t.mainViewInstance)==null||i.updateCameraByBox(r,e,v?c:void 0)}P&&((s=t.mainViewInstance)==null||s.updateCameraBySphere(P,e))},q=()=>{var e;(e=t.mainViewInstance)==null||e.resetCamera()},G=()=>{var e,i;const s=(e=t.topViewInstance)==null?void 0:e.pointCloudInstance.camera;s&&((i=t.mainViewInstance)==null||i.applyCameraTarget(s))};u(()=>{if(V.current&&(n==null?void 0:n.url)){let e=t.mainViewInstance;!e&&g.width&&(e=new X({container:V.current,isOrthographicCamera:!0,orthographicParams:S.getDefaultOrthographicParams(g),config:l,hiddenText:L}),e.setHandlerPipe({setSelectedIDs:t.setSelectedIDs,setNeedUpdateCenter:j}),t.setMainViewInstance(e))}},[g,n]),u(()=>{var e;if(V.current&&(n==null?void 0:n.url)&&n.result&&t.mainViewInstance){let i=t.mainViewInstance;const s=S.getRectParamsFromResultList(n.result),r=S.getBoxParamsFromResultList(n.result),c=r.find(v=>v.id===t.selectedID);c&&M(c.attribute),t.setPointCloudValid((e=ie(n.result))==null?void 0:e.valid),t.setPointCloudResult(r),t.setRectList(s),i.generateBoxes(r)}},[n.result,t.mainViewInstance]),u(()=>{var e,i,s,r,c,v,k;const N=(e=m==null?void 0:m.info)==null?void 0:e.id;if(!Z){j(!0);return}if(N!==void 0){_(E.Top);const Q=(r=(s=(i=t.topViewInstance)==null?void 0:i.pointCloudInstance)==null?void 0:s.camera.zoom)!=null?r:1;(c=t.mainViewInstance)==null||c.updateCameraZoom(Q)}(v=t.mainViewInstance)==null||v.setHighlightColor(N),(k=t.mainViewInstance)==null||k.render()},[(p=m==null?void 0:m.info)==null?void 0:p.id]),u(()=>{var e,i,s,r;if(P){_(E.Top);const c=(s=(i=(e=t.topViewInstance)==null?void 0:e.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?s:1;(r=t.mainViewInstance)==null||r.updateCameraZoom(c)}},[P]),u(()=>(window.addEventListener("keydown",z),()=>{window.removeEventListener("keydown",z)}),[]);const z=e=>{if(e.keyCode===Ee.Esc){h(!1);return}},D=$(()=>({reset3DView:q,setTarget3DView:_,isActive:!!m,followTopView:G}),[m,t.mainViewInstance]);u(()=>{var e,i,s;const r=t.pointCloudBoxList.filter(c=>c.attribute===a);(r==null?void 0:r.length)>0&&((e=t.mainViewInstance)==null||e.clearHighlightBoxes(),(i=t.mainViewInstance)==null||i.highlightBoxes(r)),r.length===0&&((s=t.mainViewInstance)==null||s.clearHighlightBoxesAndRender())},[a,t.mainViewInstance]);const J=o.createElement(o.Fragment,null,o.createElement(ue,{onChange:e=>{var i;(i=t.mainViewInstance)==null||i.updatePointSize({customSize:e})}}),o.createElement("span",{style:{marginRight:8}},x("ShowArrows")),o.createElement(ae,{size:"small",checked:U,onChange:e=>{var i;K(e),(i=t.mainViewInstance)==null||i.setShowDirection(e)}}),C&&o.createElement(I.Provider,{value:D},o.createElement(H,{isEnlarge:C})));return o.createElement(ee,{className:O({[d("point-cloud-3d-container")]:!0,[d("point-cloud-container","zoom")]:C}),title:C?o.createElement("div",{style:{display:"flex",alignItems:"center"}},o.createElement(we,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{h(!1)}}),x("3DView")):o.createElement(pe,{title:x("3DView"),onClick:()=>{h(!0)}}),toolbar:J},o.createElement("div",{className:d("point-cloud-3d-content")},!C&&o.createElement(I.Provider,{value:D},o.createElement(H,null)),o.createElement("div",{className:d("point-cloud-3d-view"),id:Ie,ref:V})))};var xe=ne(oe,null,null,{context:me})(he);export{xe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PointCloudContext as
|
|
1
|
+
import{PointCloudContext as te}from"./PointCloudContext.js";import{useRotate as oe}from"./hooks/useRotate.js";import{useRotateEdge as re}from"./hooks/useRotateEdge.js";import{useBoxes as se}from"./hooks/useBoxes.js";import{useSingleBox as ne}from"./hooks/useSingleBox.js";import{useSphere as ie}from"./hooks/useSphere.js";import{useContext as ae,useEffect as c}from"react";import{CommonToolUtils as ue,EToolName as P,cTool as le}from"@labelbee/lb-annotation";import{message as C}from"antd";import{connect as ce}from"react-redux";import{a2MapStateToProps as de}from"../../store/annotation/map.js";import{useStatus as pe}from"./hooks/useStatus.js";import{usePointCloudViews as me}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as Pe}from"../../store/ctx.js";import{useHistory as fe}from"./hooks/useHistory.js";import{useAttribute as we}from"./hooks/useAttribute.js";import{useConfig as be}from"./hooks/useConfig.js";import{usePolygon as ye}from"./hooks/usePolygon.js";import{useLine as ve}from"./hooks/useLine.js";import{useUpdatePointCloudColor as Ce}from"./hooks/useUpdatePointCloudColor.js";import{useTranslation as he}from"react-i18next";import{useLatest as B}from"ahooks";var ge=Object.defineProperty,Se=Object.defineProperties,ke=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,xe=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,j=(i,r,a)=>r in i?ge(i,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[r]=a,f=(i,r)=>{for(var a in r||(r={}))xe.call(r,a)&&j(i,a,r[a]);if(O)for(var a of O(r))Ve.call(r,a)&&j(i,a,r[a]);return i},w=(i,r)=>Se(i,ke(r));const{EPolygonPattern:_e}=le,Ie=({currentData:i,config:r,checkMode:a,configString:L,imgIndex:h,toolInstanceRef:u,setResourceLoading:g})=>{const e=ae(te),{changeSelectedBoxValid:E,selectNextBox:A,selectPrevBox:T,updateSelectedBox:D,deleteSelectedPointCloudBoxAndPolygon:H}=ne(),{selectedSphere:b,updatePointCloudSphere:K}=ie(),{clearAllResult:y,updatePointCloudPattern:N}=pe(),{copySelectedBoxes:U,pasteSelectedBoxes:z,copiedBoxes:Oe}=se({config:r,currentData:i}),{updateRotate:S}=oe({currentData:i}),{updateRotateEdge:R}=re({currentData:i}),{updatePointCloudData:p,topViewSelectedChanged:F}=me({setResourceLoading:g}),{redo:k,undo:x,pushHistoryWithList:q,pushHistoryUnderUpdatePolygon:G,pushHistoryUnderUpdateLine:M}=fe(),{syncThreeViewsAttribute:V}=we(),{syncAllViewsConfig:W,reRenderTopViewRange:Y}=be(),{selectedPolygon:_}=ye(),{selectedLine:I}=ve(),{t:v}=he(),{updatePointCloudColor:$}=Ce(g,r),J=B(i),m=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},Q=(t,o)=>{const{topViewInstance:s,mainViewInstance:n}=e;if(!s)return;const{pointCloud2dOperation:l}=s;switch(t){case"q":{S(e.rectRotateSensitivity);break}case"e":S(-Number(e.rectRotateSensitivity));break;case"g":R(-90);break;case"u":{const d=l.pattern===_e.Normal?P.Rect:P.Polygon;N(d);const ee={[P.Polygon]:v("PolygonPattern"),[P.Rect]:v("RectPattern")};C.success(v("ChangePatternMsg",{pattern:ee[d]})),l.clearActiveStatus(),l.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){T();break}A(),o.preventDefault();break;case"f":E();break;case"arrowup":m({y:-1});break;case"arrowdown":m({y:1});break;case"arrowleft":m({x:-1});break;case"arrowright":m({x:1});break;case"delete":H(J.current);break}},X=(t,o)=>{switch(t){case"c":U();break;case"v":z();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?k():x();break}}},Z=B(t=>{if(!ue.hotkeyFilter(t)||a===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){X(o,t);return}Q(o,t)});return c(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(l=>Z.current(l))},[e,e.topViewInstance,e.windowKeydownListenerHook]),c(()=>{W(r)},[L]),c(()=>{(r==null?void 0:r.radius)&&Y(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),c(()=>{p==null||p()},[h,e.mainViewInstance]),c(()=>{e.setHideAttributes([])},[h]),c(()=>{u.current.setDefaultAttribute=t=>{var o;if(V(t),$(t),_&&G(w(f({},_),{attribute:t})),I&&M(w(f({},I),{attribute:t})),b){const s=K(w(f({},b),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),F({newSelectedSphere:b,newSphereList:s}))}},u.current.setSubAttribute=(t,o)=>{var s;const n=e.selectedPointCloudBox;if(n){const l=(s=n==null?void 0:n.subAttribute)!=null?s:{};n.subAttribute=w(f({},l),{[t]:o}),D(n),e.mainViewInstance&&e.selectedPointCloudBox&&(e.mainViewInstance.generateBox(e.selectedPointCloudBox),e.mainViewInstance.setHighlightColor(n.id),e.mainViewInstance.render())}},u.current.clearResult=()=>{y==null||y()},u.current.redo=()=>{k()},u.current.undo=()=>{x()},u.current.setValid=t=>{u.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&y()})},u.current.setForbidOperation=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},u.current.setShowDefaultCursor=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(t)},u.current.asyncData=t=>{setTimeout(()=>{p==null||p(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),c(()=>{u.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},u.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),c(()=>{u.current.history={pushHistory:t=>{q({pointCloudBoxList:t})},initRecord:()=>{}}},[]),c(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||a)return;const s=d=>{V(d)},n=d=>{C.error(d)},l=d=>{C.info(d)};return o.on("syncAttribute",s),o.on("messageError",n),o.on("messageInfo",l),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",n),o.unbind("messageInfo",l)}},[e.topViewInstance]),null};var Be=ce(de,null,null,{context:Pe})(Ie);export{Be as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{BatchUpdateResultByTrackID as z}from"../../../../store/annotation/actionCreators.js";import{LabelBeeContext as R,useDispatch as L}from"../../../../store/ctx.js";import{Form as u,Modal as M,InputNumber as I,Select as E,Popover as T,message as q}from"antd";import e,{useState as N,useEffect as V,useCallback as H}from"react";import{useTranslation as K}from"react-i18next";import{QuestionCircleOutlined as Q}from"@ant-design/icons";import{PointCloudUtils as S}from"@labelbee/lb-utils";import{connect as W}from"react-redux";import{useSingleBox as $}from"../../hooks/useSingleBox.js";import{MathUtils as G}from"@labelbee/lb-annotation";var J=Object.defineProperty,X=Object.defineProperties,Y=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable,B=(r,n,a)=>n in r?J(r,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[n]=a,v=(r,n)=>{for(var a in n||(n={}))Z.call(n,a)&&B(r,a,n[a]);if(F)for(var a of F(n))ee.call(n,a)&&B(r,a,n[a]);return r},te=(r,n)=>X(r,Y(n));const re={labelCol:{span:8},wrapperCol:{span:16}},w=[{required:!0,message:"\u8BF7\u586B\u5199\u4E00\u4E2A\u6570\u5B57"}],ne=[{required:!0,message:"\u8BF7\u9009\u62E9\u4E3B\u5C5E\u6027"}],h=2,O=({text:r})=>e.createElement("span",{style:{borderRadius:"4px 0px 0px 4px",padding:"0px 12px",background:"#FAFAFA",border:"1px solid rgb(217 217 217)",borderRight:"0",display:"flex",alignItems:"center",height:32}},r),ae=({id:r,visible:n,onCancel:a,config:m,imgList:d,imgIndex:k})=>{const A=L(),{selectedBox:i}=$(),[p,y]=N(),[f]=u.useForm(),{t:o}=K();V(()=>{n===!1?(f.resetFields(),y(void 0)):b()},[n]);const C=t=>{var s;if(!r)return;if(!p){q.info("\u8BE5\u8303\u56F4\u4E0D\u5B58\u5728\u66F4\u6539\u6570\u636E, \u8BF7\u66F4\u6539\u7EDF\u4E00\u8303\u56F4");return}const l={attribute:t.attribute};if(m.secondaryAttributeConfigurable){const c={};(s=m.inputList)==null||s.forEach(g=>{const x=t[g.value];x!==void 0&&Object.assign(c,{[g.value]:x})}),Object.keys(c).length>0&&Object.assign(l,{subAttribute:c})}p&&Object.assign(l,p),A(z(r,l,[t.prevPage-1,t.nextPage-1],d)),a()},b=H(()=>{var t;const{prevPage:s,nextPage:l}=f.getFieldsValue(["prevPage","nextPage"]),c=d.filter((x,U)=>G.isInRange(U,[s-1,l-1]));if(!((c==null?void 0:c.length)>0)||!(i==null?void 0:i.info)||((t=i==null?void 0:i.info)==null?void 0:t.trackID)===void 0){y(void 0);return}const g=S.getMaxSizeFromBox({trackID:i.info.trackID,imgList:c});y(g)},[d,i,k]),D=()=>f.submit(),j=()=>{if(!p||!(i==null?void 0:i.info))return;const t={marginRight:16},{length:s,width:l,height:c}=S.transferBox2Kitti(v(v({},i==null?void 0:i.info),p));return e.createElement("div",null,e.createElement("span",{style:t},o("Length"),": ",s.toFixed(h)),e.createElement("span",{style:t},o("Width"),": ",l.toFixed(h)),e.createElement("span",{style:t},o("Height"),": ",c.toFixed(h)),e.createElement(T,{placement:"rightBottom",content:"\u7EDF\u4E00\u5C3A\u5BF8\u4E3A\u8BE5ID\u7684\u6240\u6709\u6807\u6CE8\u6846\u4E2D\u6700\u5927\u7684\u5C3A\u5BF8"},e.createElement(Q,null)))},P={width:"200px"},_={marginBottom:"24px",display:"flex",alignItems:"center"};return e.createElement(M,{title:o("UnifyParams"),visible:n,onCancel:a,onOk:D,wrapClassName:"labelbee-custom-modal"},e.createElement(u,te(v({},re),{form:f,onFinish:C}),e.createElement(u.Item,{name:"id",label:o("UnifyTrackID")},r),e.createElement(u.Item,{label:o("UnifyAttributeRange"),required:!0},e.createElement(u.Item,{style:{display:"inline-block"},rules:w,name:"prevPage",noStyle:!0,initialValue:1},e.createElement(I,{precision:0,min:1,style:{width:"80px"},onChange:()=>b()})),e.createElement("span",{style:{display:"inline-block",width:"24px",textAlign:"center"}},"-"),e.createElement(u.Item,{style:{display:"inline-block"},rules:w,name:"nextPage",noStyle:!0,initialValue:d.length},e.createElement(I,{precision:0,min:1,style:{width:"80px"},onChange:()=>b()})),e.createElement("span",{style:{display:"inline-block",width:"40x",marginLeft:"10px",textAlign:"center"}},o("Page"))),e.createElement(u.Item,{name:"UnifySize",label:o("UnifySize")},j()),e.createElement(u.Item,{label:o("UnifyTag"),required:!0},e.createElement("div",{style:_},e.createElement(O,{text:o("Attribute")}),e.createElement(u.Item,{name:"attribute",noStyle:!0,rules:ne},e.createElement(E,{style:P},m.attributeList.map(t=>e.createElement(E.Option,{key:t.value,value:t.value},t.key))))),m.secondaryAttributeConfigurable&&m.inputList.map(t=>{var s;return e.createElement("div",{key:t.value,style:_},e.createElement(O,{text:t.key}),e.createElement(u.Item,{name:t.value,noStyle:!0,required:!1},e.createElement(E,{style:P},(s=t.subSelected)==null?void 0:s.map(l=>e.createElement(E.Option,{key:l.value,value:l.value},l.key)))))}))))},le=r=>({imgIndex:r.annotation.imgIndex});var ie=W(le,null,null,{context:R})(ae);export{ie as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useContext as j}from"react";import{PointCloudContext as v}from"../PointCloudContext.js";import{useUpdatePointCloudColor as O}from"./useUpdatePointCloudColor.js";import{useAttribute as g}from"./useAttribute.js";import{usePolygon as w}from"./usePolygon.js";import{useLine as S}from"./useLine.js";import{useSphere as c}from"./useSphere.js";import{useHistory as b}from"./useHistory.js";import{usePointCloudViews as V}from"./usePointCloudViews.js";var U=Object.defineProperty,x=Object.defineProperties,L=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,H=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,m=(o,e,t)=>e in o?U(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,n=(o,e)=>{for(var t in e||(e={}))H.call(e,t)&&m(o,t,e[t]);if(P)for(var t of P(e))I.call(e,t)&&m(o,t,e[t]);return o},i=(o,e)=>x(o,L(e));const A=(o,e)=>{const{updatePointCloudColor:t}=O(o,e),{syncThreeViewsAttribute:f}=g(),{selectedPolygon:p}=w(),{selectedLine:u}=S(),{selectedSphere:s}=c(),{updatePointCloudSphere:C}=c(),{pushHistoryUnderUpdatePolygon:_,pushHistoryUnderUpdateLine:y}=b(),{topViewSelectedChanged:h}=V(),a=j(v);return{updatePointCloudAttribute:r=>{var l;if(f(r),t(r),p&&_(i(n({},p),{attribute:r})),u&&y(i(n({},u),{attribute:r})),s){const d=C(i(n({},s),{attribute:r}));a.mainViewInstance&&((l=a.mainViewInstance)==null||l.generateSpheres(d),h({newSelectedSphere:s,newSphereList:d}))}}}};export{A as usePointCloudAttribute};
|