@labelbee/lb-components 1.23.0-alpha.35 → 1.23.0-alpha.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),antd=require("antd"),icons=require("@ant-design/icons"),index$2=require("../../../views/MainView/sidebar/TextToolSidebar/index.js"),audio=require("../../../utils/audio.js"),lbAnnotation=require("@labelbee/lb-annotation"),classNames=require("classnames"),index=require("../audioContext/index.js"),index_module=require("./index.module.scss.js"),reactI18next=require("react-i18next"),index$1=require("../../longText/index.js");function _interopDefaultLegacy(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(l,u,n)=>u in l?__defProp(l,u,{enumerable:!0,configurable:!0,writable:!0,value:n}):l[u]=n,__spreadValues=(l,u)=>{for(var n in u||(u={}))__hasOwnProp.call(u,n)&&__defNormalProp(l,n,u[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(u))__propIsEnum.call(u,n)&&__defNormalProp(l,n,u[n]);return l},__spreadProps=(l,u)=>__defProps(l,__getOwnPropDescs(u));const EKeyCode=lbAnnotation.cKeyCode.default,ClearIcon=({onClick:l,title:u,disabled:n})=>React__default.default.createElement(antd.Tooltip,{placement:"bottom",title:u},React__default.default.createElement("span",{className:classNames__default.default({[index_module.clearIcon]:!0,[index_module.disabled]:n}),onClick:l})),SingleTextInput=l=>{var u;const{t:n}=reactI18next.useTranslation(),A=React.useRef(null),[m,C]=React.useState(!1),[y,E]=React.useState(!1),{disabled:o,config:s,result:D,updateText:v,index:p,switchToNextTextarea:P,hasMultiple:_,textID:T,addPlaceholder:x,onFocus:N,onBlur:F,onFocusStyle:h={},extra:b,errorText:I}=l,{maxLength:g}=s,w=D?D[s.key]:"",B=(u=w==null?void 0:w.length)!=null?u:0,S=a=>{v&&(v(a,s.key),s.required&&E(!a))},L=_&&P,d={id:`textInput-${p}`,ref:A,disabled:o,value:w,maxLength:g,autoSize:{minRows:2,maxRows:6},onChange:a=>{const c=a.target.value;S(c)},onFocus:a=>{C(!0),N==null||N(a),a.target.value&&E(!1)},onBlur:a=>{C(!1),F==null||F(a),s.required&&E(!a.target.value)},style:{resize:"none",wordBreak:"break-all"},onKeyDownCapture:a=>{const{keyCode:c}=a;if(a.ctrlKey){if(c===EKeyCode.Enter&&a.preventDefault(),x&&[EKeyCode.One,EKeyCode.Two,EKeyCode.Three].includes(c))switch(a.preventDefault(),c){case EKeyCode.One:x("\u4986");break;case EKeyCode.Two:x("\u652B");break;case EKeyCode.Three:x("\u7383");break}}else c===EKeyCode.Tab&&L?(a.preventDefault(),a.nativeEvent.stopImmediatePropagation(),P(p)):a.nativeEvent.stopPropagation()}},f=React__default.default.createElement("div",{className:index_module.textAreaFooter},React__default.default.createElement("div",{className:index_module.hotkeyTip},L&&React__default.default.createElement("span",null,"[",n("Switch"),"]Tab"),React__default.default.createElement("span",null,"[",n("TurnPage"),"]Ctrl+Enter")),React__default.default.createElement("div",{className:index_module.wordCount},React__default.default.createElement("span",{className:B>=g?index_module.warning:""},B),"/",React__default.default.createElement("span",null,g)));return React.useEffect(()=>{o&&C(!1)},[o]),React.useEffect(()=>{E(!1)},[T]),React__default.default.createElement("div",{className:index_module.textField},React__default.default.createElement("div",{className:index_module.label},React__default.default.createElement("div",{className:index_module.labelText},React__default.default.createElement("span",{className:classNames__default.default({[index_module.titleText]:!0,[index_module.required]:s.required})},React__default.default.createElement(index$1,{text:s.label,openByText:!0,isToolTips:!0})),React__default.default.createElement(ClearIcon,{onClick:()=>{o||S("")},title:"",disabled:o})),React__default.default.createElement("div",{className:index_module.extra},b)),React__default.default.createElement("div",{className:classNames__default.default({disabled:o,"textarea-outline":!0,"ant-input-focused":m,[index_module.textareaContainer]:!0,[index_module.focus]:m,[index_module.invalid]:y}),style:m?h:{}},React__default.default.createElement(index$2.TextareaWithFooter,{footer:f,textareaProps:d})),I&&React__default.default.createElement("span",{style:{color:"#ff4d4f",lineHeight:"22px"}},I))},TextInput=l=>{const{configList:u,autofocus:n,textID:A,result:m,showText:C,updateText:y,toggleShowText:E,textInputDisabled:o,isCheck:s,isEdit:D,config:v,preContext:p,regions:P=[],textConfigurable:_=!0,clipTextConfigurable:T,clipAttributeConfigurable:x,updateRegion:N,clipAttributeList:F=[],clipTextList:h=index.DEFAULT_CLIP_TEXT_CONFIG_ITEM}=l,{t:b}=reactI18next.useTranslation(),[I,g]=React.useState(0),[w,B]=React.useState(""),S=React.useRef(null),{audioClipState:L}=index.useAudioClipStore(),d=u||[__spreadValues({},audio.DEFAULT_TEXT_CONFIG_ITEM)];let f=P;if(T&&!s){const e=L.selectedRegion.id;f=f.filter(t=>t.id===e)}const a=e=>{setTimeout(()=>{const t=document.getElementById(`textInput-${e}`);t&&(g(e),t.focus(),t.select(),t.scrollIntoView({behavior:"smooth",block:"center"}))})},c=e=>{const t=_?d.length:0,i=T?f.length*h.length:0,r=t+i,k=(e+1)%r;a(k)},K=e=>{e.keyCode===EKeyCode.Tab&&(e.preventDefault(),(d.length>0||T&&h.length>0)&&a(0))},O=e=>{const t=document.getElementById(`textInput-${I}`);if(!(v==null?void 0:v.enablePlaceholderHotkey)||!t||!y)return;const{value:i,selectionStart:r,selectionEnd:k}=t,R=`${i.slice(0,r)}${e}${i.slice(k)}`;y(R,d[I].key),B(e),setTimeout(()=>{t.setSelectionRange(r+1,r+1),t.focus()},0),clearTimeout(S.current),S.current=setTimeout(()=>{B("")},400)};React.useEffect(()=>(D||document.addEventListener("keydown",K),()=>{document.removeEventListener("keydown",K)}),[u]),React.useEffect(()=>{n&&!o&&a(0)},[A]);let q=d;s&&(q=d.filter(e=>(m==null?void 0:m[e.key])!==void 0));const W=React.useMemo(()=>h.reduce((e,t)=>(f.forEach(i=>{i&&e.push(__spreadProps(__spreadValues({},t),{clipTextResult:i}))}),e),[]),[h,f]);return React__default.default.createElement(React__default.default.Fragment,null,(v==null?void 0:v.enablePlaceholderHotkey)&&React__default.default.createElement("div",{className:index_module.placeholderHotkey},React__default.default.createElement("div",{className:index_module.title},"\u5360\u4F4D\u7B26\u5FEB\u6377\u8F93\u5165",React__default.default.createElement(antd.Tooltip,{overlayStyle:{maxWidth:240},title:React__default.default.createElement("div",null,React__default.default.createElement("div",null,"\u4986\uFF08Ctrl+1\uFF09\uFF1A"),React__default.default.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"),React__default.default.createElement("div",null,"\u652B\uFF08Ctrl+2\uFF09\uFF1A"),React__default.default.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"),React__default.default.createElement("div",null,"\u7383\uFF08Ctrl+3\uFF09\uFF1A"),React__default.default.createElement("div",null,"\u5B8C\u5168\u65E0\u6CD5\u5224\u65AD\u662F\u4EC0\u4E48\u5B57")),placement:"bottom"},React__default.default.createElement(icons.QuestionCircleOutlined,{className:index_module.questionIcon}))),React__default.default.createElement(antd.Radio.Group,{value:w},React__default.default.createElement(antd.Radio.Button,{value:"\u4986",onClick:e=>O(e.target.value)},React__default.default.createElement("div",{className:"label"},React__default.default.createElement("div",{className:"text"},"\u4986 (\u89C6\u89C9)"),React__default.default.createElement("div",{className:"hotkey"},"Ctrl+1"))),React__default.default.createElement(antd.Radio.Button,{value:"\u652B",onClick:e=>O(e.target.value)},React__default.default.createElement("div",{className:"label"},React__default.default.createElement("div",{className:"text"},"\u652B (\u8BED\u4E49)"),React__default.default.createElement("div",{className:"hotkey"},"Ctrl+2"))),React__default.default.createElement(antd.Radio.Button,{value:"\u7383",onClick:e=>O(e.target.value)},React__default.default.createElement("div",{className:"label"},React__default.default.createElement("div",{className:"text"},"\u7383 (\u65E0\u6548)"),React__default.default.createElement("div",{className:"hotkey"},"Ctrl+3"))))),React__default.default.createElement("div",{className:index_module.textInputContainer},React__default.default.createElement(index.default,{audioContext:p==null?void 0:p.before}),_&&q.map((e,t)=>React__default.default.createElement(SingleTextInput,{config:e,key:t,index:t,result:m,updateText:y,switchToNextTextarea:c,hasMultiple:d.length>1,disabled:o,textID:A,addPlaceholder:O,onFocus:()=>g(t)})),T&&f.length>0&&W.map((e,t)=>{var i;const{clipTextResult:r}=e,{id:k,start:R,end:z,attribute:$}=r,{maxLength:U=3e3,label:H,key:G,required:X}=e,V=r==null?void 0:r[G],Q={[r.id]:V},J={label:`${H!=null?H:b("textTool")}\uFF08${audio.timeFormat(R,"ss.SSS")} - ${audio.timeFormat(z,"ss.SSS")}\uFF09`,key:k,maxLength:U},j=(_?q.length:0)+t,M=audio.getAttributeColor($,F),Y={color:audio.getAttributeFontColor($,F),backgroundColor:M},Z=b("LeastCharacterError",{num:1}),ee=X&&V.length<1?Z:void 0,te=(i=audio.getAttributeShowText($,[{value:"",key:b("NoAttribute")},...F]))!=null?i:"";return React__default.default.createElement(SingleTextInput,{config:J,key:t,index:j,disabled:o,result:Q,updateText:ae=>{N==null||N(__spreadProps(__spreadValues({},r),{[G]:ae}))},switchToNextTextarea:()=>{c(j)},hasMultiple:!0,onFocus:()=>g(j),onFocusStyle:x?{borderColor:M,boxShadow:`0 0 0 2px ${audio.updateColorOpacity(M,.4)}`}:{},extra:x?React__default.default.createElement("div",{style:Y,className:index_module.attribute},React__default.default.createElement(index$1,{text:te,openByText:!0,isToolTips:!0})):null,errorText:ee})}),React__default.default.createElement(index.default,{audioContext:p==null?void 0:p.after}),E&&React__default.default.createElement("div",{className:index_module.switchItem},b("toggleShowText"),React__default.default.createElement(antd.Switch,{style:{alignSelf:"center"},checked:C,onChange:e=>{E(e)}}))))};exports.ClearIcon=ClearIcon,exports.SingleTextInput=SingleTextInput,exports.default=TextInput;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),antd=require("antd"),icons=require("@ant-design/icons"),index$2=require("../../../views/MainView/sidebar/TextToolSidebar/index.js"),audio=require("../../../utils/audio.js"),lbAnnotation=require("@labelbee/lb-annotation"),classNames=require("classnames"),index=require("../audioContext/index.js"),index_module=require("./index.module.scss.js"),reactI18next=require("react-i18next"),index$1=require("../../longText/index.js"),icon_clearSmall_a=require("../../../assets/annotation/common/icon_clearSmall_a.svg.js"),icon_clearSmall=require("../../../assets/annotation/common/icon_clearSmall.svg.js");function _interopDefaultLegacy(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(l,u,n)=>u in l?__defProp(l,u,{enumerable:!0,configurable:!0,writable:!0,value:n}):l[u]=n,__spreadValues=(l,u)=>{for(var n in u||(u={}))__hasOwnProp.call(u,n)&&__defNormalProp(l,n,u[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(u))__propIsEnum.call(u,n)&&__defNormalProp(l,n,u[n]);return l},__spreadProps=(l,u)=>__defProps(l,__getOwnPropDescs(u));const EKeyCode=lbAnnotation.cKeyCode.default,ClearIcon=({onClick:l,title:u,disabled:n})=>{const[T,o]=React.useState(!1);return React__default.default.createElement(antd.Tooltip,{placement:"bottom",title:u},React__default.default.createElement("img",{onMouseEnter:()=>{n||o(!0)},onMouseLeave:()=>o(!1),className:classNames__default.default({[index_module.clearIcon]:!0,[index_module.disabled]:n}),src:T?icon_clearSmall_a:icon_clearSmall,onClick:l}))},SingleTextInput=l=>{var u;const{t:n}=reactI18next.useTranslation(),T=React.useRef(null),[o,y]=React.useState(!1),[_,E]=React.useState(!1),{disabled:s,config:i,result:A,updateText:v,index:x,switchToNextTextarea:L,hasMultiple:S,textID:F,addPlaceholder:p,onFocus:N,onBlur:h,onFocusStyle:C={},extra:b,errorText:I}=l,{maxLength:g}=i,w=A?A[i.key]:"",B=(u=w==null?void 0:w.length)!=null?u:0,k=a=>{v&&(v(a,i.key),i.required&&E(!a))},P=S&&L,f={id:`textInput-${x}`,ref:T,disabled:s,value:w,maxLength:g,autoSize:{minRows:2,maxRows:6},onChange:a=>{const d=a.target.value;k(d)},onFocus:a=>{y(!0),N==null||N(a),a.target.value&&E(!1)},onBlur:a=>{y(!1),h==null||h(a),i.required&&E(!a.target.value)},style:{resize:"none",wordBreak:"break-all"},onKeyDownCapture:a=>{const{keyCode:d}=a;if(a.ctrlKey){if(d===EKeyCode.Enter&&a.preventDefault(),p&&[EKeyCode.One,EKeyCode.Two,EKeyCode.Three].includes(d))switch(a.preventDefault(),d){case EKeyCode.One:p("\u4986");break;case EKeyCode.Two:p("\u652B");break;case EKeyCode.Three:p("\u7383");break}}else d===EKeyCode.Tab&&P?(a.preventDefault(),a.nativeEvent.stopImmediatePropagation(),L(x)):a.nativeEvent.stopPropagation()}},m=React__default.default.createElement("div",{className:index_module.textAreaFooter},React__default.default.createElement("div",{className:index_module.hotkeyTip},P&&React__default.default.createElement("span",null,"[",n("Switch"),"]Tab"),React__default.default.createElement("span",null,"[",n("TurnPage"),"]Ctrl+Enter")),React__default.default.createElement("div",{className:index_module.wordCount},React__default.default.createElement("span",{className:B>=g?index_module.warning:""},B),"/",React__default.default.createElement("span",null,g)));return React.useEffect(()=>{s&&y(!1)},[s]),React.useEffect(()=>{E(!1)},[F]),React__default.default.createElement("div",{className:index_module.textField},React__default.default.createElement("div",{className:index_module.label},React__default.default.createElement("div",{className:index_module.labelText},React__default.default.createElement("span",{className:classNames__default.default({[index_module.titleText]:!0,[index_module.required]:i.required})},React__default.default.createElement(index$1,{text:i.label,openByText:!0,isToolTips:!0})),React__default.default.createElement(ClearIcon,{onClick:()=>{s||k("")},title:"",disabled:s})),React__default.default.createElement("div",{className:index_module.extra},b)),React__default.default.createElement("div",{className:classNames__default.default({disabled:s,"textarea-outline":!0,"ant-input-focused":o,[index_module.textareaContainer]:!0,[index_module.focus]:o,[index_module.invalid]:_}),style:o?C:{}},React__default.default.createElement(index$2.TextareaWithFooter,{footer:m,textareaProps:f})),I&&React__default.default.createElement("span",{style:{color:"#ff4d4f",lineHeight:"22px"}},I))},TextInput=l=>{const{configList:u,autofocus:n,textID:T,result:o,showText:y,updateText:_,toggleShowText:E,textInputDisabled:s,isCheck:i,isEdit:A,config:v,preContext:x,regions:L=[],textConfigurable:S=!0,clipTextConfigurable:F,clipAttributeConfigurable:p,updateRegion:N,clipAttributeList:h=[],clipTextList:C=index.DEFAULT_CLIP_TEXT_CONFIG_ITEM}=l,{t:b}=reactI18next.useTranslation(),[I,g]=React.useState(0),[w,B]=React.useState(""),k=React.useRef(null),{audioClipState:P}=index.useAudioClipStore(),f=u||[__spreadValues({},audio.DEFAULT_TEXT_CONFIG_ITEM)];let m=L;if(F&&!i){const e=P.selectedRegion.id;m=m.filter(t=>t.id===e)}const a=e=>{setTimeout(()=>{const t=document.getElementById(`textInput-${e}`);t&&(g(e),t.focus(),t.select(),t.scrollIntoView({behavior:"smooth",block:"center"}))})},d=e=>{const t=S?f.length:0,c=F?m.length*C.length:0,r=t+c,D=(e+1)%r;a(D)},H=e=>{e.keyCode===EKeyCode.Tab&&(e.preventDefault(),(f.length>0||F&&C.length>0)&&a(0))},q=e=>{const t=document.getElementById(`textInput-${I}`);if(!(v==null?void 0:v.enablePlaceholderHotkey)||!t||!_)return;const{value:c,selectionStart:r,selectionEnd:D}=t,R=`${c.slice(0,r)}${e}${c.slice(D)}`;_(R,f[I].key),B(e),setTimeout(()=>{t.setSelectionRange(r+1,r+1),t.focus()},0),clearTimeout(k.current),k.current=setTimeout(()=>{B("")},400)};React.useEffect(()=>(A||document.addEventListener("keydown",H),()=>{document.removeEventListener("keydown",H)}),[u]),React.useEffect(()=>{n&&!s&&a(0)},[T]);let O=f;i&&(O=f.filter(e=>(o==null?void 0:o[e.key])!==void 0));const W=React.useMemo(()=>C.reduce((e,t)=>(m.forEach(c=>{c&&e.push(__spreadProps(__spreadValues({},t),{clipTextResult:c}))}),e),[]),[C,m]);return React__default.default.createElement(React__default.default.Fragment,null,(v==null?void 0:v.enablePlaceholderHotkey)&&React__default.default.createElement("div",{className:index_module.placeholderHotkey},React__default.default.createElement("div",{className:index_module.title},"\u5360\u4F4D\u7B26\u5FEB\u6377\u8F93\u5165",React__default.default.createElement(antd.Tooltip,{overlayStyle:{maxWidth:240},title:React__default.default.createElement("div",null,React__default.default.createElement("div",null,"\u4986\uFF08Ctrl+1\uFF09\uFF1A"),React__default.default.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"),React__default.default.createElement("div",null,"\u652B\uFF08Ctrl+2\uFF09\uFF1A"),React__default.default.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"),React__default.default.createElement("div",null,"\u7383\uFF08Ctrl+3\uFF09\uFF1A"),React__default.default.createElement("div",null,"\u5B8C\u5168\u65E0\u6CD5\u5224\u65AD\u662F\u4EC0\u4E48\u5B57")),placement:"bottom"},React__default.default.createElement(icons.QuestionCircleOutlined,{className:index_module.questionIcon}))),React__default.default.createElement(antd.Radio.Group,{value:w},React__default.default.createElement(antd.Radio.Button,{value:"\u4986",onClick:e=>q(e.target.value)},React__default.default.createElement("div",{className:"label"},React__default.default.createElement("div",{className:"text"},"\u4986 (\u89C6\u89C9)"),React__default.default.createElement("div",{className:"hotkey"},"Ctrl+1"))),React__default.default.createElement(antd.Radio.Button,{value:"\u652B",onClick:e=>q(e.target.value)},React__default.default.createElement("div",{className:"label"},React__default.default.createElement("div",{className:"text"},"\u652B (\u8BED\u4E49)"),React__default.default.createElement("div",{className:"hotkey"},"Ctrl+2"))),React__default.default.createElement(antd.Radio.Button,{value:"\u7383",onClick:e=>q(e.target.value)},React__default.default.createElement("div",{className:"label"},React__default.default.createElement("div",{className:"text"},"\u7383 (\u65E0\u6548)"),React__default.default.createElement("div",{className:"hotkey"},"Ctrl+3"))))),React__default.default.createElement("div",{className:index_module.textInputContainer},React__default.default.createElement(index.default,{audioContext:x==null?void 0:x.before}),S&&O.map((e,t)=>React__default.default.createElement(SingleTextInput,{config:e,key:t,index:t,result:o,updateText:_,switchToNextTextarea:d,hasMultiple:f.length>1,disabled:s,textID:T,addPlaceholder:q,onFocus:()=>g(t)})),F&&m.length>0&&W.map((e,t)=>{var c;const{clipTextResult:r}=e,{id:D,start:R,end:z,attribute:j}=r,{maxLength:U=3e3,label:K,key:G,required:X}=e,V=r==null?void 0:r[G],Q={[r.id]:V},J={label:`${K!=null?K:b("textTool")}\uFF08${audio.timeFormat(R,"ss.SSS")} - ${audio.timeFormat(z,"ss.SSS")}\uFF09`,key:D,maxLength:U},$=(S?O.length:0)+t,M=audio.getAttributeColor(j,h),Y={color:audio.getAttributeFontColor(j,h),backgroundColor:M},Z=b("LeastCharacterError",{num:1}),ee=X&&V.length<1?Z:void 0,te=(c=audio.getAttributeShowText(j,[{value:"",key:b("NoAttribute")},...h]))!=null?c:"";return React__default.default.createElement(SingleTextInput,{config:J,key:t,index:$,disabled:s,result:Q,updateText:ae=>{N==null||N(__spreadProps(__spreadValues({},r),{[G]:ae}))},switchToNextTextarea:()=>{d($)},hasMultiple:!0,onFocus:()=>g($),onFocusStyle:p?{borderColor:M,boxShadow:`0 0 0 2px ${audio.updateColorOpacity(M,.4)}`}:{},extra:p?React__default.default.createElement("div",{style:Y,className:index_module.attribute},React__default.default.createElement(index$1,{text:te,openByText:!0,isToolTips:!0})):null,errorText:ee})}),React__default.default.createElement(index.default,{audioContext:x==null?void 0:x.after}),E&&React__default.default.createElement("div",{className:index_module.switchItem},b("toggleShowText"),React__default.default.createElement(antd.Switch,{style:{alignSelf:"center"},checked:y,onChange:e=>{E(e)}}))))};exports.ClearIcon=ClearIcon,exports.SingleTextInput=SingleTextInput,exports.default=TextInput;
@@ -1 +1 @@
1
- "use strict";var React=require("react"),antd=require("antd"),reactI18next=require("react-i18next"),index=require("../attributeList/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const subTitleStyle={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},SubAttributeList=t=>{const{subAttributeList:u,setSubAttribute:n,getValue:r}=t,{t:d}=reactI18next.useTranslation(),o=(e,a)=>{if(Array.isArray(a)){n(e,a.join(";"));return}n(e,a)},i=e=>{const a=r(e);return(e==null?void 0:e.isMulti)?a?a==null?void 0:a.split(";"):[]:a};return React__default.default.createElement(React__default.default.Fragment,null,u.map(e=>{var a;return(e==null?void 0:e.subSelected)&&React__default.default.createElement("div",{style:{marginTop:12},key:e.value},React__default.default.createElement("div",{style:subTitleStyle},d("SubAttribute"),"-",e.key),((a=e.subSelected)==null?void 0:a.length)<5?(e==null?void 0:e.isMulti)?React__default.default.createElement(antd.Checkbox.Group,{style:{padding:"0px 20px 16px 16px"},options:e.subSelected.map(l=>({label:l.key,value:l.value})),value:i(e),onChange:l=>o(e.value,l)}):React__default.default.createElement(index.default,{list:e.subSelected.map(l=>({label:l.key,value:l.value})),selectedAttribute:r(e),num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:l=>n(e.value,l),style:{marginBottom:12}}):React__default.default.createElement(antd.Select,{style:{margin:"0px 20px 16px 16px",width:"87%"},mode:(e==null?void 0:e.isMulti)?"multiple":void 0,value:i(e),placeholder:d("PleaseSelect"),onChange:l=>o(e.value,l),allowClear:!0},e.subSelected.map(l=>React__default.default.createElement(antd.Select.Option,{key:l.value,value:l.value},l.key))),React__default.default.createElement(antd.Divider,{style:{margin:0}}))}))};module.exports=SubAttributeList;
1
+ "use strict";var React=require("react"),antd=require("antd"),reactI18next=require("react-i18next"),index=require("../attributeList/index.js"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(l,r,t)=>r in l?__defProp(l,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[r]=t,__spreadValues=(l,r)=>{for(var t in r||(r={}))__hasOwnProp.call(r,t)&&__defNormalProp(l,t,r[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(r))__propIsEnum.call(r,t)&&__defNormalProp(l,t,r[t]);return l};const subTitleStyle={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},SubAttributeList=l=>{const{subAttributeList:r,setSubAttribute:t,getValue:o,lang:i}=l,{t:u}=reactI18next.useTranslation();React.useEffect(()=>{var e;i&&((e=lbUtils.i18n)==null||e.changeLanguage(i))},[]);const d=(e,n)=>{if(Array.isArray(n)){t(e,n.join(";"));return}t(e,n)},c=e=>{const n=o(e);return(e==null?void 0:e.isMulti)?n?n==null?void 0:n.split(";"):[]:n};return React__default.default.createElement(React__default.default.Fragment,null,r.map(e=>{var n;return(e==null?void 0:e.subSelected)&&React__default.default.createElement("div",{style:{marginTop:12},key:e.value},React__default.default.createElement("div",{style:subTitleStyle},u("SubAttribute"),"-",e.key),((n=e.subSelected)==null?void 0:n.length)<5?(e==null?void 0:e.isMulti)?React__default.default.createElement(antd.Checkbox.Group,{style:{padding:"0px 20px 16px 16px"},options:e.subSelected.map(a=>({label:a.key,value:a.value})),value:c(e),onChange:a=>d(e.value,a)}):React__default.default.createElement(index.default,{list:e.subSelected.map(a=>({label:a.key,value:a.value})),selectedAttribute:o(e),num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:a=>t(e.value,a),style:{marginBottom:12}}):React__default.default.createElement(antd.Select,{style:{margin:"0px 20px 16px 16px",width:"87%"},mode:(e==null?void 0:e.isMulti)?"multiple":void 0,value:c(e),placeholder:u("PleaseSelect"),onChange:a=>d(e.value,a),allowClear:!0},e.subSelected.map(a=>React__default.default.createElement(antd.Select.Option,{key:a.value,value:a.value},a.key))),React__default.default.createElement(antd.Divider,{style:{margin:0}}))}))},WrapSubAttributeList=l=>React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(SubAttributeList,__spreadValues({},l)));module.exports=WrapSubAttributeList;
package/dist/index.css CHANGED
@@ -908,14 +908,10 @@
908
908
  height: 14px;
909
909
  margin-left: 4px;
910
910
  vertical-align: text-top;
911
- background-image: url(~@/assets/tool_Icon/icon_clearSmall.svg);
912
911
  background-repeat: no-repeat;
913
912
  background-position: center;
914
913
  cursor: pointer;
915
914
  }
916
- .index-module_clearIcon__ZBZqI:not(.index-module_disabled__zqh8C):hover {
917
- background-image: url(~@/assets/tool_Icon/icon_clearSmall_a.svg);
918
- }
919
915
  .index-module_clearIcon__ZBZqI.index-module_disabled__zqh8C {
920
916
  cursor: not-allowed;
921
917
  }
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("./components/AnnotationView/index.js"),pointCloudAnnotationView=require("./components/AnnotationView/pointCloudAnnotationView.js"),index$2=require("./components/LLMToolView/questionView/index.js"),index$3=require("./components/NLPToolView/textContent/index.js"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),App=require("./App.js"),configureStore=require("./configureStore.js"),actionCreators=require("./store/annotation/actionCreators.js"),TagToolInstanceAdaptorI18nProvider=require("./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js"),PointCloudContext=require("./components/pointCloudView/PointCloudContext.js"),ctx=require("./store/ctx.js"),index$5=require("./components/predictTracking/predictTrackingIcon/index.js"),index$4=require("./components/LLMToolView/index.js"),index$6=require("./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js"),index$7=require("./components/measureCanvas/index.js"),index$8=require("./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js"),index$9=require("./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js"),index$a=require("./components/audioPlayer/index.js"),index$b=require("./utils/index.js"),index$c=require("./constant/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const store=configureStore(),OutputApp=(e,t)=>{const[r,i]=React.useState();return React.useImperativeHandle(t,()=>({toolInstance:r,annotationEngine:store.getState().annotation.annotationEngine,pageBackwardActions:()=>store.dispatch(actionCreators.PageBackward()),pageForwardActions:()=>store.dispatch(actionCreators.PageForward()),pageJump:o=>{const n=~~o-1;store.dispatch(actionCreators.PageJump(n))},hello:()=>alert("hello labelBee!!!")}),[r]),React__default.default.createElement(reactRedux.Provider,{store,context:ctx.LabelBeeContext},React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(PointCloudContext.PointCloudProvider,null,React__default.default.createElement(App,__spreadProps(__spreadValues({},e),{setToolInstance:o=>{var n;i(o),(n=e.onLoad)==null||n.call(e,{toolInstance:o})}})))))};var index=React__default.default.forwardRef(OutputApp);exports.AnnotationView=index$1,exports.PointCloudAnnotationView=pointCloudAnnotationView,exports.QuestionView=index$2.default,exports.TextContent=index$3,Object.defineProperty(exports,"i18n",{enumerable:!0,get:function(){return lbUtils.i18n}}),exports.VideoTagTool=TagToolInstanceAdaptorI18nProvider.VideoTagTool,exports.PredictTracking=index$5,exports.LLMToolView=index$4,exports.SwitchCuboidBoxIn2DView=index$6,exports.MeasureCanvas=index$7,exports.AnnotatedBox=index$8,exports.FindTrackIDIndex=index$9.FindTrackIDIndexInCheckMode,exports.AudioPlayer=index$a.WrapAudioPlayer,exports.generatePointCloudBoxRects=index$b.generatePointCloudBoxRects,Object.defineProperty(exports,"EDataFormatType",{enumerable:!0,get:function(){return index$c.EDataFormatType}}),Object.defineProperty(exports,"ELLMDataType",{enumerable:!0,get:function(){return index$c.ELLMDataType}}),Object.defineProperty(exports,"EStepType",{enumerable:!0,get:function(){return index$c.EStepType}}),Object.defineProperty(exports,"ESubmitType",{enumerable:!0,get:function(){return index$c.ESubmitType}}),exports.componentCls=index$c.componentCls,exports.prefix=index$c.prefix,exports.default=index,exports.store=store;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("./components/AnnotationView/index.js"),pointCloudAnnotationView=require("./components/AnnotationView/pointCloudAnnotationView.js"),index$2=require("./components/LLMToolView/questionView/index.js"),index$3=require("./components/NLPToolView/textContent/index.js"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),App=require("./App.js"),configureStore=require("./configureStore.js"),actionCreators=require("./store/annotation/actionCreators.js"),TagToolInstanceAdaptorI18nProvider=require("./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js"),PointCloudContext=require("./components/pointCloudView/PointCloudContext.js"),ctx=require("./store/ctx.js"),index$5=require("./components/predictTracking/predictTrackingIcon/index.js"),index$4=require("./components/LLMToolView/index.js"),index$6=require("./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js"),index$7=require("./components/measureCanvas/index.js"),index$8=require("./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js"),index$9=require("./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js"),index$a=require("./components/audioPlayer/index.js"),index$b=require("./utils/index.js"),index$c=require("./components/subAttributeList/index.js"),index$d=require("./constant/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const store=configureStore(),OutputApp=(e,t)=>{const[r,i]=React.useState();return React.useImperativeHandle(t,()=>({toolInstance:r,annotationEngine:store.getState().annotation.annotationEngine,pageBackwardActions:()=>store.dispatch(actionCreators.PageBackward()),pageForwardActions:()=>store.dispatch(actionCreators.PageForward()),pageJump:o=>{const n=~~o-1;store.dispatch(actionCreators.PageJump(n))},hello:()=>alert("hello labelBee!!!")}),[r]),React__default.default.createElement(reactRedux.Provider,{store,context:ctx.LabelBeeContext},React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(PointCloudContext.PointCloudProvider,null,React__default.default.createElement(App,__spreadProps(__spreadValues({},e),{setToolInstance:o=>{var n;i(o),(n=e.onLoad)==null||n.call(e,{toolInstance:o})}})))))};var index=React__default.default.forwardRef(OutputApp);exports.AnnotationView=index$1,exports.PointCloudAnnotationView=pointCloudAnnotationView,exports.QuestionView=index$2.default,exports.TextContent=index$3,Object.defineProperty(exports,"i18n",{enumerable:!0,get:function(){return lbUtils.i18n}}),exports.VideoTagTool=TagToolInstanceAdaptorI18nProvider.VideoTagTool,exports.PredictTracking=index$5,exports.LLMToolView=index$4,exports.SwitchCuboidBoxIn2DView=index$6,exports.MeasureCanvas=index$7,exports.AnnotatedBox=index$8,exports.FindTrackIDIndex=index$9.FindTrackIDIndexInCheckMode,exports.AudioPlayer=index$a.WrapAudioPlayer,exports.generatePointCloudBoxRects=index$b.generatePointCloudBoxRects,exports.SubAttributeList=index$c,Object.defineProperty(exports,"EDataFormatType",{enumerable:!0,get:function(){return index$d.EDataFormatType}}),Object.defineProperty(exports,"ELLMDataType",{enumerable:!0,get:function(){return index$d.ELLMDataType}}),Object.defineProperty(exports,"EStepType",{enumerable:!0,get:function(){return index$d.EStepType}}),Object.defineProperty(exports,"ESubmitType",{enumerable:!0,get:function(){return index$d.ESubmitType}}),exports.componentCls=index$d.componentCls,exports.prefix=index$d.prefix,exports.default=index,exports.store=store;
@@ -4,6 +4,7 @@ interface IProps {
4
4
  subAttributeList: IInputList[];
5
5
  setSubAttribute: (value: string, subAttribute: string) => void;
6
6
  getValue: (subAttribute: IInputList) => undefined | string;
7
+ lang?: string;
7
8
  }
8
- declare const SubAttributeList: (props: IProps) => React.JSX.Element;
9
- export default SubAttributeList;
9
+ declare const WrapSubAttributeList: (props: IProps) => React.JSX.Element;
10
+ export default WrapSubAttributeList;
@@ -15,11 +15,12 @@ import AnnotatedBox from './views/MainView/sidebar/PointCloudToolSidebar/compone
15
15
  import { FindTrackIDIndexInCheckMode as FindTrackIDIndex } from './views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex';
16
16
  import { WrapAudioPlayer as AudioPlayer } from './components/audioPlayer';
17
17
  import { generatePointCloudBoxRects } from './utils';
18
+ import SubAttributeList from './components/subAttributeList';
18
19
  export declare const store: import("redux").Store<{}, import("redux").Action<any>> & {
19
20
  dispatch: unknown;
20
21
  };
21
22
  declare const _default: React.ForwardRefExoticComponent<AppProps & React.RefAttributes<unknown>>;
22
23
  export default _default;
23
- export { AnnotationView, PointCloudAnnotationView, QuestionView, TextContent, LLMToolView, i18n, VideoTagTool, PredictTracking, SwitchCuboidBoxIn2DView, MeasureCanvas, AnnotatedBox, FindTrackIDIndex, AudioPlayer, generatePointCloudBoxRects, };
24
+ export { AnnotationView, PointCloudAnnotationView, QuestionView, TextContent, LLMToolView, i18n, VideoTagTool, PredictTracking, SwitchCuboidBoxIn2DView, MeasureCanvas, AnnotatedBox, FindTrackIDIndex, AudioPlayer, generatePointCloudBoxRects, SubAttributeList, };
24
25
  export * from './constant';
25
26
  export * from './typeTem';
@@ -1 +1 @@
1
- import r,{useMemo as I}from"react";import D from"../../../attributeList/index.js";import{EventBus as A}from"@labelbee/lb-annotation";import B from"../../../../assets/annotation/audio/clipSmall.svg.js";import V from"../../../../assets/annotation/audio/clipASmall.svg.js";import M from"../../../../assets/annotation/audio/delete.svg.js";import q from"../../../../assets/annotation/audio/loopA.svg.js";import{getAttributeShowText as z,timeFormat as y}from"../../../../utils/audio.js";import G from"../../../longText/index.js";import{classnames as H}from"../../../../utils/index.js";import a from"./index.module.scss.js";import{useTranslation as J}from"react-i18next";import K from"../../../subAttributeList/index.js";var Q=Object.defineProperty,U=Object.defineProperties,W=Object.getOwnPropertyDescriptors,x=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,C=(o,e,s)=>e in o?Q(o,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[e]=s,m=(o,e)=>{for(var s in e||(e={}))X.call(e,s)&&C(o,s,e[s]);if(x)for(var s of x(e))Y.call(e,s)&&C(o,s,e[s]);return o},d=(o,e)=>U(o,W(e));const Z=o=>{const{regions:e=[],updateRegion:s,useAudioClipStore:h}=o,{audioClipState:j,setAudioClipState:v}=h(),{t:f}=J(),{selectedAttribute:L,selectedRegion:E,clipTextConfigurable:N,clipAttributeList:p,clipAttributeConfigurable:b,secondaryAttributeConfigurable:w,subAttributeList:O,clipTextList:g}=j,{id:l}=E,u=I(()=>e.find(t=>t.id===l),[e,l]),P=t=>{e.length&&l&&s(d(m({},u),{attribute:t})),v({selectedAttribute:t})},T=(t,i)=>{var n;if(e.length&&l){const c=(n=u==null?void 0:u.subAttribute)!=null?n:{};s(d(m({},u),{subAttribute:d(m({},c),{[t]:i})}))}},S=[{label:"\u65E0\u5C5E\u6027",value:"",key:"\u65E0\u5C5E\u6027"},...p.map(t=>d(m({},t),{label:t.key}))],$=t=>{let i="";return N&&(g==null?void 0:g.length)>0&&g.forEach((n,c)=>{i=i+`${!b&&c===0?"":"\uFF0C"}${n.label}\uFF1A${t[n.key]}`}),i};return r.createElement("div",{className:a.clipSidebar},r.createElement("div",{className:a.clipResults},r.createElement("div",{className:a.title},f("ClippedAudio")),e.length>0?r.createElement("div",{className:a.regions},e.map(t=>{const{id:i,attribute:n,text:c,start:_,end:R}=t,k=i===l&&E.loop,F=`${b?z(n,S):""}${$(t)}`;return r.createElement("div",{className:H({[a.region]:!0,[a.selected]:i===l}),key:i,onClick:()=>{A.emit("setSelectedRegion",{id:i,playImmediately:!0})}},r.createElement("div",{className:a.label},k&&r.createElement("img",{src:q}),r.createElement("div",{className:a.text},r.createElement(G,{text:F}))),r.createElement("div",{className:a.time},r.createElement("img",{src:l===i?V:B}),y(_,"ss.SSS")," -",y(R,"ss.SSS")),r.createElement("div",{className:a.delete,onClick:()=>{A.emit("removeRegionById",i)}},r.createElement("img",{src:M})))})):r.createElement("div",{className:a.empty},f("NoClippedData"))),b&&(p==null?void 0:p.length)>0&&r.createElement("div",{className:a.attributeList},r.createElement(D,{list:S,attributeChanged:P,selectedAttribute:L,attributeLockChange:t=>{v({attributeLockList:t})}}),l&&w&&r.createElement(K,{subAttributeList:O,setSubAttribute:T,getValue:t=>{var i;return(i=u==null?void 0:u.subAttribute)==null?void 0:i[t.value]}})))};export{Z as default};
1
+ import r,{useMemo as I}from"react";import D from"../../../attributeList/index.js";import{EventBus as A}from"@labelbee/lb-annotation";import B from"../../../../assets/annotation/audio/clipSmall.svg.js";import V from"../../../../assets/annotation/audio/clipASmall.svg.js";import M from"../../../../assets/annotation/audio/delete.svg.js";import W from"../../../../assets/annotation/audio/loopA.svg.js";import{getAttributeShowText as q,timeFormat as y}from"../../../../utils/audio.js";import z from"../../../longText/index.js";import{classnames as G}from"../../../../utils/index.js";import a from"./index.module.scss.js";import{useTranslation as H}from"react-i18next";import J from"../../../subAttributeList/index.js";var K=Object.defineProperty,Q=Object.defineProperties,U=Object.getOwnPropertyDescriptors,x=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,C=(o,e,s)=>e in o?K(o,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[e]=s,m=(o,e)=>{for(var s in e||(e={}))X.call(e,s)&&C(o,s,e[s]);if(x)for(var s of x(e))Y.call(e,s)&&C(o,s,e[s]);return o},d=(o,e)=>Q(o,U(e));const Z=o=>{const{regions:e=[],updateRegion:s,useAudioClipStore:h}=o,{audioClipState:j,setAudioClipState:v}=h(),{t:f}=H(),{selectedAttribute:L,selectedRegion:E,clipTextConfigurable:N,clipAttributeList:p,clipAttributeConfigurable:b,secondaryAttributeConfigurable:w,subAttributeList:O,clipTextList:g}=j,{id:l}=E,u=I(()=>e.find(t=>t.id===l),[e,l]),P=t=>{e.length&&l&&s(d(m({},u),{attribute:t})),v({selectedAttribute:t})},T=(t,i)=>{var n;if(e.length&&l){const c=(n=u==null?void 0:u.subAttribute)!=null?n:{};s(d(m({},u),{subAttribute:d(m({},c),{[t]:i})}))}},S=[{label:"\u65E0\u5C5E\u6027",value:"",key:"\u65E0\u5C5E\u6027"},...p.map(t=>d(m({},t),{label:t.key}))],$=t=>{let i="";return N&&(g==null?void 0:g.length)>0&&g.forEach((n,c)=>{i=i+`${!b&&c===0?"":"\uFF0C"}${n.label}\uFF1A${t[n.key]}`}),i};return r.createElement("div",{className:a.clipSidebar},r.createElement("div",{className:a.clipResults},r.createElement("div",{className:a.title},f("ClippedAudio")),e.length>0?r.createElement("div",{className:a.regions},e.map(t=>{const{id:i,attribute:n,text:c,start:_,end:R}=t,k=i===l&&E.loop,F=`${b?q(n,S):""}${$(t)}`;return r.createElement("div",{className:G({[a.region]:!0,[a.selected]:i===l}),key:i,onClick:()=>{A.emit("setSelectedRegion",{id:i,playImmediately:!0})}},r.createElement("div",{className:a.label},k&&r.createElement("img",{src:W}),r.createElement("div",{className:a.text},r.createElement(z,{text:F}))),r.createElement("div",{className:a.time},r.createElement("img",{src:l===i?V:B}),y(_,"ss.SSS")," -",y(R,"ss.SSS")),r.createElement("div",{className:a.delete,onClick:()=>{A.emit("removeRegionById",i)}},r.createElement("img",{src:M})))})):r.createElement("div",{className:a.empty},f("NoClippedData"))),b&&(p==null?void 0:p.length)>0&&r.createElement("div",{className:a.attributeList},r.createElement(D,{list:S,attributeChanged:P,selectedAttribute:L,attributeLockChange:t=>{v({attributeLockList:t})}}),l&&w&&r.createElement(J,{subAttributeList:O,setSubAttribute:T,getValue:t=>{var i;return(i=u==null?void 0:u.subAttribute)==null?void 0:i[t.value]}})))};export{Z as default};
@@ -1 +1 @@
1
- import e,{useState as M,useRef as te,useEffect as q,useMemo as Ce}from"react";import{Tooltip as ae,Radio as K,Switch as be}from"antd";import{QuestionCircleOutlined as ye}from"@ant-design/icons";import{TextareaWithFooter as Ne}from"../../../views/MainView/sidebar/TextToolSidebar/index.js";import{timeFormat as le,getAttributeColor as we,getAttributeFontColor as Be,getAttributeShowText as ke,updateColorOpacity as Ie,DEFAULT_TEXT_CONFIG_ITEM as _e}from"../../../utils/audio.js";import{cKeyCode as Se}from"@labelbee/lb-annotation";import U from"classnames";import ne,{useAudioClipStore as Ae,DEFAULT_CLIP_TEXT_CONFIG_ITEM as De}from"../audioContext/index.js";import r from"./index.module.scss.js";import{useTranslation as re}from"react-i18next";import oe from"../../longText/index.js";var Le=Object.defineProperty,Pe=Object.defineProperties,Oe=Object.getOwnPropertyDescriptors,ue=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,$e=Object.prototype.propertyIsEnumerable,se=(u,n,o)=>n in u?Le(u,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):u[n]=o,X=(u,n)=>{for(var o in n||(n={}))Re.call(n,o)&&se(u,o,n[o]);if(ue)for(var o of ue(n))$e.call(n,o)&&se(u,o,n[o]);return u},ce=(u,n)=>Pe(u,Oe(n));const E=Se.default,ie=({onClick:u,title:n,disabled:o})=>e.createElement(ae,{placement:"bottom",title:n},e.createElement("span",{className:U({[r.clearIcon]:!0,[r.disabled]:o}),onClick:u})),Q=u=>{var n;const{t:o}=re(),P=te(null),[x,w]=M(!1),[B,v]=M(!1),{disabled:c,config:i,result:O,updateText:g,index:T,switchToNextTextarea:R,hasMultiple:k,textID:C,addPlaceholder:F,onFocus:I,onBlur:b,onFocusStyle:y={},extra:N,errorText:_}=u,{maxLength:h}=i,S=O?O[i.key]:"",A=(n=S==null?void 0:S.length)!=null?n:0,D=l=>{g&&(g(l,i.key),i.required&&v(!l))},$=k&&R,p={id:`textInput-${T}`,ref:P,disabled:c,value:S,maxLength:h,autoSize:{minRows:2,maxRows:6},onChange:l=>{const m=l.target.value;D(m)},onFocus:l=>{w(!0),I==null||I(l),l.target.value&&v(!1)},onBlur:l=>{w(!1),b==null||b(l),i.required&&v(!l.target.value)},style:{resize:"none",wordBreak:"break-all"},onKeyDownCapture:l=>{const{keyCode:m}=l;if(l.ctrlKey){if(m===E.Enter&&l.preventDefault(),F&&[E.One,E.Two,E.Three].includes(m))switch(l.preventDefault(),m){case E.One:F("\u4986");break;case E.Two:F("\u652B");break;case E.Three:F("\u7383");break}}else m===E.Tab&&$?(l.preventDefault(),l.nativeEvent.stopImmediatePropagation(),R(T)):l.nativeEvent.stopPropagation()}},f=e.createElement("div",{className:r.textAreaFooter},e.createElement("div",{className:r.hotkeyTip},$&&e.createElement("span",null,"[",o("Switch"),"]Tab"),e.createElement("span",null,"[",o("TurnPage"),"]Ctrl+Enter")),e.createElement("div",{className:r.wordCount},e.createElement("span",{className:A>=h?r.warning:""},A),"/",e.createElement("span",null,h)));return q(()=>{c&&w(!1)},[c]),q(()=>{v(!1)},[C]),e.createElement("div",{className:r.textField},e.createElement("div",{className:r.label},e.createElement("div",{className:r.labelText},e.createElement("span",{className:U({[r.titleText]:!0,[r.required]:i.required})},e.createElement(oe,{text:i.label,openByText:!0,isToolTips:!0})),e.createElement(ie,{onClick:()=>{c||D("")},title:"",disabled:c})),e.createElement("div",{className:r.extra},N)),e.createElement("div",{className:U({disabled:c,"textarea-outline":!0,"ant-input-focused":x,[r.textareaContainer]:!0,[r.focus]:x,[r.invalid]:B}),style:x?y:{}},e.createElement(Ne,{footer:f,textareaProps:p})),_&&e.createElement("span",{style:{color:"#ff4d4f",lineHeight:"22px"}},_))},je=u=>{const{configList:n,autofocus:o,textID:P,result:x,showText:w,updateText:B,toggleShowText:v,textInputDisabled:c,isCheck:i,isEdit:O,config:g,preContext:T,regions:R=[],textConfigurable:k=!0,clipTextConfigurable:C,clipAttributeConfigurable:F,updateRegion:I,clipAttributeList:b=[],clipTextList:y=De}=u,{t:N}=re(),[_,h]=M(0),[S,A]=M(""),D=te(null),{audioClipState:$}=Ae(),p=n||[X({},_e)];let f=R;if(C&&!i){const t=$.selectedRegion.id;f=f.filter(a=>a.id===t)}const l=t=>{setTimeout(()=>{const a=document.getElementById(`textInput-${t}`);a&&(h(t),a.focus(),a.select(),a.scrollIntoView({behavior:"smooth",block:"center"}))})},m=t=>{const a=k?p.length:0,d=C?f.length*y.length:0,s=a+d,L=(t+1)%s;l(L)},J=t=>{t.keyCode===E.Tab&&(t.preventDefault(),(p.length>0||C&&y.length>0)&&l(0))},j=t=>{const a=document.getElementById(`textInput-${_}`);if(!(g==null?void 0:g.enablePlaceholderHotkey)||!a||!B)return;const{value:d,selectionStart:s,selectionEnd:L}=a,G=`${d.slice(0,s)}${t}${d.slice(L)}`;B(G,p[_].key),A(t),setTimeout(()=>{a.setSelectionRange(s+1,s+1),a.focus()},0),clearTimeout(D.current),D.current=setTimeout(()=>{A("")},400)};q(()=>(O||document.addEventListener("keydown",J),()=>{document.removeEventListener("keydown",J)}),[n]),q(()=>{o&&!c&&l(0)},[P]);let H=p;i&&(H=p.filter(t=>(x==null?void 0:x[t.key])!==void 0));const de=Ce(()=>y.reduce((t,a)=>(f.forEach(d=>{d&&t.push(ce(X({},a),{clipTextResult:d}))}),t),[]),[y,f]);return e.createElement(e.Fragment,null,(g==null?void 0:g.enablePlaceholderHotkey)&&e.createElement("div",{className:r.placeholderHotkey},e.createElement("div",{className:r.title},"\u5360\u4F4D\u7B26\u5FEB\u6377\u8F93\u5165",e.createElement(ae,{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(ye,{className:r.questionIcon}))),e.createElement(K.Group,{value:S},e.createElement(K.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(K.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(K.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:r.textInputContainer},e.createElement(ne,{audioContext:T==null?void 0:T.before}),k&&H.map((t,a)=>e.createElement(Q,{config:t,key:a,index:a,result:x,updateText:B,switchToNextTextarea:m,hasMultiple:p.length>1,disabled:c,textID:P,addPlaceholder:j,onFocus:()=>h(a)})),C&&f.length>0&&de.map((t,a)=>{var d;const{clipTextResult:s}=t,{id:L,start:G,end:me,attribute:V}=s,{maxLength:Ee=3e3,label:Y,key:Z,required:pe}=t,ee=s==null?void 0:s[Z],fe={[s.id]:ee},xe={label:`${Y!=null?Y:N("textTool")}\uFF08${le(G,"ss.SSS")} - ${le(me,"ss.SSS")}\uFF09`,key:L,maxLength:Ee},W=(k?H.length:0)+a,z=we(V,b),ve={color:Be(V,b),backgroundColor:z},ge=N("LeastCharacterError",{num:1}),Te=pe&&ee.length<1?ge:void 0,Fe=(d=ke(V,[{value:"",key:N("NoAttribute")},...b]))!=null?d:"";return e.createElement(Q,{config:xe,key:a,index:W,disabled:c,result:fe,updateText:he=>{I==null||I(ce(X({},s),{[Z]:he}))},switchToNextTextarea:()=>{m(W)},hasMultiple:!0,onFocus:()=>h(W),onFocusStyle:F?{borderColor:z,boxShadow:`0 0 0 2px ${Ie(z,.4)}`}:{},extra:F?e.createElement("div",{style:ve,className:r.attribute},e.createElement(oe,{text:Fe,openByText:!0,isToolTips:!0})):null,errorText:Te})}),e.createElement(ne,{audioContext:T==null?void 0:T.after}),v&&e.createElement("div",{className:r.switchItem},N("toggleShowText"),e.createElement(be,{style:{alignSelf:"center"},checked:w,onChange:t=>{v(t)}}))))};export{ie as ClearIcon,Q as SingleTextInput,je as default};
1
+ import e,{useState as O,useRef as te,useEffect as q,useMemo as Ce}from"react";import{Tooltip as ae,Radio as H,Switch as be}from"antd";import{QuestionCircleOutlined as ye}from"@ant-design/icons";import{TextareaWithFooter as Ne}from"../../../views/MainView/sidebar/TextToolSidebar/index.js";import{timeFormat as ne,getAttributeColor as we,getAttributeFontColor as Be,getAttributeShowText as _e,updateColorOpacity as ke,DEFAULT_TEXT_CONFIG_ITEM as Ie}from"../../../utils/audio.js";import{cKeyCode as Se}from"@labelbee/lb-annotation";import U from"classnames";import oe,{useAudioClipStore as De,DEFAULT_CLIP_TEXT_CONFIG_ITEM as Ae}from"../audioContext/index.js";import l from"./index.module.scss.js";import{useTranslation as le}from"react-i18next";import re from"../../longText/index.js";import Le from"../../../assets/annotation/common/icon_clearSmall_a.svg.js";import Pe from"../../../assets/annotation/common/icon_clearSmall.svg.js";var Oe=Object.defineProperty,$e=Object.defineProperties,je=Object.getOwnPropertyDescriptors,ue=Object.getOwnPropertySymbols,Me=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable,se=(u,o,r)=>o in u?Oe(u,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):u[o]=r,X=(u,o)=>{for(var r in o||(o={}))Me.call(o,r)&&se(u,r,o[r]);if(ue)for(var r of ue(o))Re.call(o,r)&&se(u,r,o[r]);return u},ie=(u,o)=>$e(u,je(o));const p=Se.default,ce=({onClick:u,title:o,disabled:r})=>{const[C,i]=O(!1);return e.createElement(ae,{placement:"bottom",title:o},e.createElement("img",{onMouseEnter:()=>{r||i(!0)},onMouseLeave:()=>i(!1),className:U({[l.clearIcon]:!0,[l.disabled]:r}),src:C?Le:Pe,onClick:u}))},Q=u=>{var o;const{t:r}=le(),C=te(null),[i,B]=O(!1),[_,x]=O(!1),{disabled:c,config:m,result:$,updateText:g,index:T,switchToNextTextarea:j,hasMultiple:k,textID:b,addPlaceholder:F,onFocus:I,onBlur:y,onFocusStyle:N={},extra:w,errorText:S}=u,{maxLength:h}=m,D=$?$[m.key]:"",A=(o=D==null?void 0:D.length)!=null?o:0,L=n=>{g&&(g(n,m.key),m.required&&x(!n))},M=k&&j,f={id:`textInput-${T}`,ref:C,disabled:c,value:D,maxLength:h,autoSize:{minRows:2,maxRows:6},onChange:n=>{const E=n.target.value;L(E)},onFocus:n=>{B(!0),I==null||I(n),n.target.value&&x(!1)},onBlur:n=>{B(!1),y==null||y(n),m.required&&x(!n.target.value)},style:{resize:"none",wordBreak:"break-all"},onKeyDownCapture:n=>{const{keyCode:E}=n;if(n.ctrlKey){if(E===p.Enter&&n.preventDefault(),F&&[p.One,p.Two,p.Three].includes(E))switch(n.preventDefault(),E){case p.One:F("\u4986");break;case p.Two:F("\u652B");break;case p.Three:F("\u7383");break}}else E===p.Tab&&M?(n.preventDefault(),n.nativeEvent.stopImmediatePropagation(),j(T)):n.nativeEvent.stopPropagation()}},v=e.createElement("div",{className:l.textAreaFooter},e.createElement("div",{className:l.hotkeyTip},M&&e.createElement("span",null,"[",r("Switch"),"]Tab"),e.createElement("span",null,"[",r("TurnPage"),"]Ctrl+Enter")),e.createElement("div",{className:l.wordCount},e.createElement("span",{className:A>=h?l.warning:""},A),"/",e.createElement("span",null,h)));return q(()=>{c&&B(!1)},[c]),q(()=>{x(!1)},[b]),e.createElement("div",{className:l.textField},e.createElement("div",{className:l.label},e.createElement("div",{className:l.labelText},e.createElement("span",{className:U({[l.titleText]:!0,[l.required]:m.required})},e.createElement(re,{text:m.label,openByText:!0,isToolTips:!0})),e.createElement(ce,{onClick:()=>{c||L("")},title:"",disabled:c})),e.createElement("div",{className:l.extra},w)),e.createElement("div",{className:U({disabled:c,"textarea-outline":!0,"ant-input-focused":i,[l.textareaContainer]:!0,[l.focus]:i,[l.invalid]:_}),style:i?N:{}},e.createElement(Ne,{footer:v,textareaProps:f})),S&&e.createElement("span",{style:{color:"#ff4d4f",lineHeight:"22px"}},S))},qe=u=>{const{configList:o,autofocus:r,textID:C,result:i,showText:B,updateText:_,toggleShowText:x,textInputDisabled:c,isCheck:m,isEdit:$,config:g,preContext:T,regions:j=[],textConfigurable:k=!0,clipTextConfigurable:b,clipAttributeConfigurable:F,updateRegion:I,clipAttributeList:y=[],clipTextList:N=Ae}=u,{t:w}=le(),[S,h]=O(0),[D,A]=O(""),L=te(null),{audioClipState:M}=De(),f=o||[X({},Ie)];let v=j;if(b&&!m){const t=M.selectedRegion.id;v=v.filter(a=>a.id===t)}const n=t=>{setTimeout(()=>{const a=document.getElementById(`textInput-${t}`);a&&(h(t),a.focus(),a.select(),a.scrollIntoView({behavior:"smooth",block:"center"}))})},E=t=>{const a=k?f.length:0,d=b?v.length*N.length:0,s=a+d,P=(t+1)%s;n(P)},J=t=>{t.keyCode===p.Tab&&(t.preventDefault(),(f.length>0||b&&N.length>0)&&n(0))},R=t=>{const a=document.getElementById(`textInput-${S}`);if(!(g==null?void 0:g.enablePlaceholderHotkey)||!a||!_)return;const{value:d,selectionStart:s,selectionEnd:P}=a,G=`${d.slice(0,s)}${t}${d.slice(P)}`;_(G,f[S].key),A(t),setTimeout(()=>{a.setSelectionRange(s+1,s+1),a.focus()},0),clearTimeout(L.current),L.current=setTimeout(()=>{A("")},400)};q(()=>($||document.addEventListener("keydown",J),()=>{document.removeEventListener("keydown",J)}),[o]),q(()=>{r&&!c&&n(0)},[C]);let K=f;m&&(K=f.filter(t=>(i==null?void 0:i[t.key])!==void 0));const me=Ce(()=>N.reduce((t,a)=>(v.forEach(d=>{d&&t.push(ie(X({},a),{clipTextResult:d}))}),t),[]),[N,v]);return e.createElement(e.Fragment,null,(g==null?void 0:g.enablePlaceholderHotkey)&&e.createElement("div",{className:l.placeholderHotkey},e.createElement("div",{className:l.title},"\u5360\u4F4D\u7B26\u5FEB\u6377\u8F93\u5165",e.createElement(ae,{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(ye,{className:l.questionIcon}))),e.createElement(H.Group,{value:D},e.createElement(H.Button,{value:"\u4986",onClick:t=>R(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(H.Button,{value:"\u652B",onClick:t=>R(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(H.Button,{value:"\u7383",onClick:t=>R(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:l.textInputContainer},e.createElement(oe,{audioContext:T==null?void 0:T.before}),k&&K.map((t,a)=>e.createElement(Q,{config:t,key:a,index:a,result:i,updateText:_,switchToNextTextarea:E,hasMultiple:f.length>1,disabled:c,textID:C,addPlaceholder:R,onFocus:()=>h(a)})),b&&v.length>0&&me.map((t,a)=>{var d;const{clipTextResult:s}=t,{id:P,start:G,end:de,attribute:V}=s,{maxLength:Ee=3e3,label:Y,key:Z,required:pe}=t,ee=s==null?void 0:s[Z],fe={[s.id]:ee},ve={label:`${Y!=null?Y:w("textTool")}\uFF08${ne(G,"ss.SSS")} - ${ne(de,"ss.SSS")}\uFF09`,key:P,maxLength:Ee},W=(k?K.length:0)+a,z=we(V,y),xe={color:Be(V,y),backgroundColor:z},ge=w("LeastCharacterError",{num:1}),Te=pe&&ee.length<1?ge:void 0,Fe=(d=_e(V,[{value:"",key:w("NoAttribute")},...y]))!=null?d:"";return e.createElement(Q,{config:ve,key:a,index:W,disabled:c,result:fe,updateText:he=>{I==null||I(ie(X({},s),{[Z]:he}))},switchToNextTextarea:()=>{E(W)},hasMultiple:!0,onFocus:()=>h(W),onFocusStyle:F?{borderColor:z,boxShadow:`0 0 0 2px ${ke(z,.4)}`}:{},extra:F?e.createElement("div",{style:xe,className:l.attribute},e.createElement(re,{text:Fe,openByText:!0,isToolTips:!0})):null,errorText:Te})}),e.createElement(oe,{audioContext:T==null?void 0:T.after}),x&&e.createElement("div",{className:l.switchItem},w("toggleShowText"),e.createElement(be,{style:{alignSelf:"center"},checked:B,onChange:t=>{x(t)}}))))};export{ce as ClearIcon,Q as SingleTextInput,qe as default};
@@ -1 +1 @@
1
- import n from"react";import{Checkbox as v,Select as m,Divider as u}from"antd";import{useTranslation as s}from"react-i18next";import x from"../attributeList/index.js";const y={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},g=p=>{const{subAttributeList:c,setSubAttribute:t,getValue:o}=p,{t:r}=s(),i=(e,a)=>{if(Array.isArray(a)){t(e,a.join(";"));return}t(e,a)},d=e=>{const a=o(e);return(e==null?void 0:e.isMulti)?a?a==null?void 0:a.split(";"):[]:a};return n.createElement(n.Fragment,null,c.map(e=>{var a;return(e==null?void 0:e.subSelected)&&n.createElement("div",{style:{marginTop:12},key:e.value},n.createElement("div",{style:y},r("SubAttribute"),"-",e.key),((a=e.subSelected)==null?void 0:a.length)<5?(e==null?void 0:e.isMulti)?n.createElement(v.Group,{style:{padding:"0px 20px 16px 16px"},options:e.subSelected.map(l=>({label:l.key,value:l.value})),value:d(e),onChange:l=>i(e.value,l)}):n.createElement(x,{list:e.subSelected.map(l=>({label:l.key,value:l.value})),selectedAttribute:o(e),num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:l=>t(e.value,l),style:{marginBottom:12}}):n.createElement(m,{style:{margin:"0px 20px 16px 16px",width:"87%"},mode:(e==null?void 0:e.isMulti)?"multiple":void 0,value:d(e),placeholder:r("PleaseSelect"),onChange:l=>i(e.value,l),allowClear:!0},e.subSelected.map(l=>n.createElement(m.Option,{key:l.value,value:l.value},l.key))),n.createElement(u,{style:{margin:0}}))}))};export{g as default};
1
+ import o,{useEffect as g}from"react";import{Checkbox as y,Select as u,Divider as x}from"antd";import{I18nextProvider as S,useTranslation as _}from"react-i18next";import E from"../attributeList/index.js";import{i18n as v}from"@labelbee/lb-utils";var h=Object.defineProperty,s=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,f=(t,a,r)=>a in t?h(t,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[a]=r,P=(t,a)=>{for(var r in a||(a={}))w.call(a,r)&&f(t,r,a[r]);if(s)for(var r of s(a))O.call(a,r)&&f(t,r,a[r]);return t};const k={margin:"12px 20px 8px",fontSize:14,fontWeight:500,wordWrap:"break-word"},C=t=>{const{subAttributeList:a,setSubAttribute:r,getValue:i,lang:p}=t,{t:c}=_();g(()=>{var e;p&&((e=v)==null||e.changeLanguage(p))},[]);const m=(e,n)=>{if(Array.isArray(n)){r(e,n.join(";"));return}r(e,n)},d=e=>{const n=i(e);return(e==null?void 0:e.isMulti)?n?n==null?void 0:n.split(";"):[]:n};return o.createElement(o.Fragment,null,a.map(e=>{var n;return(e==null?void 0:e.subSelected)&&o.createElement("div",{style:{marginTop:12},key:e.value},o.createElement("div",{style:k},c("SubAttribute"),"-",e.key),((n=e.subSelected)==null?void 0:n.length)<5?(e==null?void 0:e.isMulti)?o.createElement(y.Group,{style:{padding:"0px 20px 16px 16px"},options:e.subSelected.map(l=>({label:l.key,value:l.value})),value:d(e),onChange:l=>m(e.value,l)}):o.createElement(E,{list:e.subSelected.map(l=>({label:l.key,value:l.value})),selectedAttribute:i(e),num:"-",forbidColor:!0,forbidDefault:!0,attributeChanged:l=>r(e.value,l),style:{marginBottom:12}}):o.createElement(u,{style:{margin:"0px 20px 16px 16px",width:"87%"},mode:(e==null?void 0:e.isMulti)?"multiple":void 0,value:d(e),placeholder:c("PleaseSelect"),onChange:l=>m(e.value,l),allowClear:!0},e.subSelected.map(l=>o.createElement(u.Option,{key:l.value,value:l.value},l.key))),o.createElement(x,{style:{margin:0}}))}))},L=t=>o.createElement(S,{i18n:v},o.createElement(C,P({},t)));export{L as default};
package/es/index.css CHANGED
@@ -908,14 +908,10 @@
908
908
  height: 14px;
909
909
  margin-left: 4px;
910
910
  vertical-align: text-top;
911
- background-image: url(~@/assets/tool_Icon/icon_clearSmall.svg);
912
911
  background-repeat: no-repeat;
913
912
  background-position: center;
914
913
  cursor: pointer;
915
914
  }
916
- .index-module_clearIcon__ZBZqI:not(.index-module_disabled__zqh8C):hover {
917
- background-image: url(~@/assets/tool_Icon/icon_clearSmall_a.svg);
918
- }
919
915
  .index-module_clearIcon__ZBZqI.index-module_disabled__zqh8C {
920
916
  cursor: not-allowed;
921
917
  }
package/es/index.js CHANGED
@@ -1 +1 @@
1
- export{default as AnnotationView}from"./components/AnnotationView/index.js";export{default as PointCloudAnnotationView}from"./components/AnnotationView/pointCloudAnnotationView.js";export{default as QuestionView}from"./components/LLMToolView/questionView/index.js";export{default as TextContent}from"./components/NLPToolView/textContent/index.js";import{i18n as l}from"@labelbee/lb-utils";export{i18n}from"@labelbee/lb-utils";import r,{useState as c,useImperativeHandle as m}from"react";import{I18nextProvider as f}from"react-i18next";import{Provider as u}from"react-redux";import x from"./App.js";import w from"./configureStore.js";import{PageBackward as P,PageForward as v,PageJump as T}from"./store/annotation/actionCreators.js";export{VideoTagTool}from"./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js";import{PointCloudProvider as g}from"./components/pointCloudView/PointCloudContext.js";import{LabelBeeContext as j}from"./store/ctx.js";export{default as PredictTracking}from"./components/predictTracking/predictTrackingIcon/index.js";export{default as LLMToolView}from"./components/LLMToolView/index.js";export{default as SwitchCuboidBoxIn2DView}from"./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js";export{default as MeasureCanvas}from"./components/measureCanvas/index.js";export{default as AnnotatedBox}from"./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js";export{FindTrackIDIndexInCheckMode as FindTrackIDIndex}from"./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js";export{WrapAudioPlayer as AudioPlayer}from"./components/audioPlayer/index.js";export{generatePointCloudBoxRects}from"./utils/index.js";export{EDataFormatType,ELLMDataType,EStepType,ESubmitType,componentCls,prefix}from"./constant/index.js";var _=Object.defineProperty,I=Object.defineProperties,b=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,C=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,p=(o,e,t)=>e in o?_(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,A=(o,e)=>{for(var t in e||(e={}))C.call(e,t)&&p(o,t,e[t]);if(s)for(var t of s(e))V.call(e,t)&&p(o,t,e[t]);return o},y=(o,e)=>I(o,b(e));const n=w(),O=(o,e)=>{const[t,d]=c();return m(e,()=>({toolInstance:t,annotationEngine:n.getState().annotation.annotationEngine,pageBackwardActions:()=>n.dispatch(P()),pageForwardActions:()=>n.dispatch(v()),pageJump:a=>{const i=~~a-1;n.dispatch(T(i))},hello:()=>alert("hello labelBee!!!")}),[t]),r.createElement(u,{store:n,context:j},r.createElement(f,{i18n:l},r.createElement(g,null,r.createElement(x,y(A({},o),{setToolInstance:a=>{var i;d(a),(i=o.onLoad)==null||i.call(o,{toolInstance:a})}})))))};var E=r.forwardRef(O);export{E as default,n as store};
1
+ export{default as AnnotationView}from"./components/AnnotationView/index.js";export{default as PointCloudAnnotationView}from"./components/AnnotationView/pointCloudAnnotationView.js";export{default as QuestionView}from"./components/LLMToolView/questionView/index.js";export{default as TextContent}from"./components/NLPToolView/textContent/index.js";import{i18n as l}from"@labelbee/lb-utils";export{i18n}from"@labelbee/lb-utils";import r,{useState as c,useImperativeHandle as m}from"react";import{I18nextProvider as u}from"react-i18next";import{Provider as f}from"react-redux";import x from"./App.js";import w from"./configureStore.js";import{PageBackward as P,PageForward as v,PageJump as T}from"./store/annotation/actionCreators.js";export{VideoTagTool}from"./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js";import{PointCloudProvider as g}from"./components/pointCloudView/PointCloudContext.js";import{LabelBeeContext as j}from"./store/ctx.js";export{default as PredictTracking}from"./components/predictTracking/predictTrackingIcon/index.js";export{default as LLMToolView}from"./components/LLMToolView/index.js";export{default as SwitchCuboidBoxIn2DView}from"./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js";export{default as MeasureCanvas}from"./components/measureCanvas/index.js";export{default as AnnotatedBox}from"./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js";export{FindTrackIDIndexInCheckMode as FindTrackIDIndex}from"./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js";export{WrapAudioPlayer as AudioPlayer}from"./components/audioPlayer/index.js";export{generatePointCloudBoxRects}from"./utils/index.js";export{default as SubAttributeList}from"./components/subAttributeList/index.js";export{EDataFormatType,ELLMDataType,EStepType,ESubmitType,componentCls,prefix}from"./constant/index.js";var b=Object.defineProperty,_=Object.defineProperties,I=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,C=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,p=(o,e,t)=>e in o?b(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,A=(o,e)=>{for(var t in e||(e={}))C.call(e,t)&&p(o,t,e[t]);if(s)for(var t of s(e))V.call(e,t)&&p(o,t,e[t]);return o},y=(o,e)=>_(o,I(e));const n=w(),L=(o,e)=>{const[t,d]=c();return m(e,()=>({toolInstance:t,annotationEngine:n.getState().annotation.annotationEngine,pageBackwardActions:()=>n.dispatch(P()),pageForwardActions:()=>n.dispatch(v()),pageJump:a=>{const i=~~a-1;n.dispatch(T(i))},hello:()=>alert("hello labelBee!!!")}),[t]),r.createElement(f,{store:n,context:j},r.createElement(u,{i18n:l},r.createElement(g,null,r.createElement(x,y(A({},o),{setToolInstance:a=>{var i;d(a),(i=o.onLoad)==null||i.call(o,{toolInstance:a})}})))))};var O=r.forwardRef(L);export{O as default,n as store};
@@ -1 +1 @@
1
- import e,{useState as y,useContext as T,useEffect as j}from"react";import{EditFilled as ot}from"@ant-design/icons";import{ToolIcons as nt}from"../ToolIcons.js";import{EToolName as rt}from"../../../../data/enums/ToolType.js";import{cTool as lt}from"@labelbee/lb-annotation";import{PointCloudContext as D}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as h,Input as it,message as I}from"antd";import st from"../../../../utils/StepUtils.js";import{connect as at}from"react-redux";import{jsonParser as ct,classnames as ut}from"../../../../utils/index.js";import{useStatus as $}from"../../../../components/pointCloudView/hooks/useStatus.js";import{useSingleBox as R}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{useTranslation as k}from"react-i18next";import{LabelBeeContext as dt,useDispatch as mt}from"../../../../store/ctx.js";import pt from"./components/batchUpdateModal/index.js";import ft from"./components/annotatedBox/index.js";import gt from"./components/findTrackIDIndex/index.js";import{EPointCloudSegmentStatus as w,EPointCloudPattern as vt}from"@labelbee/lb-utils";import St from"../../../../components/attributeList/index.js";import{useAttribute as bt}from"../../../../components/pointCloudView/hooks/useAttribute.js";import Ct from"../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js";import _t from"../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js";import Pt from"../../../../assets/annotation/pointCloudTool/circleSelector.svg.js";import xt from"../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js";import Et from"../../../../assets/annotation/rectTool/icon_rect.svg.js";import yt from"../../../../assets/annotation/rectTool/icon_rect_a.svg.js";import{sidebarCls as L}from"../index.js";import{SetTaskStepList as It}from"../../../../store/annotation/actionCreators.js";import{usePointCloudViews as wt}from"../../../../components/pointCloudView/hooks/usePointCloudViews.js";import Lt from"../../../../components/subAttributeList/index.js";var Tt=Object.defineProperty,jt=Object.defineProperties,Dt=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,ht=Object.prototype.hasOwnProperty,kt=Object.prototype.propertyIsEnumerable,z=(o,t,n)=>t in o?Tt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,A=(o,t)=>{for(var n in t||(t={}))ht.call(t,n)&&z(o,n,t[n]);if(U)for(var n of U(t))kt.call(t,n)&&z(o,n,t[n]);return o},V=(o,t)=>jt(o,Dt(t));const At=()=>{const[o,t]=y(!1),n=T(D),{pointCloudBoxList:a}=n,{selectedBox:c,updateSelectedBox:r}=R(),[u,d]=y(""),{t:g}=k(),p=c==null?void 0:c.info.trackID,s=m=>!!a.find(b=>b.trackID===m&&b.id!==(c==null?void 0:c.info.id)),i=(m=!1)=>{const f=parseInt(u,10);if(m&&t(!1),isNaN(f)){I.error(g("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){I.error(g("NotAllowDecimalPointsInTrackID"));return}if(s(f)){I.error(g("DuplicateTrackIDsExist"));return}if(!(f>0)){I.error(g("PositiveIntegerCheck"));return}S(f)};j(()=>{t(!1)},[p]);const S=m=>{var f;const b=r({trackID:m});(f=n==null?void 0:n.topViewInstance)==null||f.updatePolygonList(b!=null?b:[])};return e.createElement("div",{style:{padding:24}},e.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},e.createElement("span",null,g("CurrentBoxTrackIDs")),p&&e.createElement(pt,{id:p,updateCurrentPolygonList:m=>S(m)})),e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"12px"}},o&&p?e.createElement(it,{defaultValue:p,onChange:m=>{d(m.target.value)},disabled:!p,size:"small",onBlur:()=>{i()},onPressEnter:()=>{i(!0)}}):e.createElement("span",null,p),e.createElement(ot,{style:{color:"#999",marginLeft:16,cursor:typeof p!="undefined"?"pointer":"not-allowed"},onClick:()=>{p&&t(!o)}})))},F=({segmentStatus:o,globalPattern:t})=>t===vt.Segmentation&&![w.Edit,w.Ready].includes(o),M=({attributeList:o,subAttributeList:t,toolInstance:n,config:a,stepList:c,stepInfo:r,enableColorPicker:u})=>{const[d,g]=y({segmentStatus:w.Ready}),{selectedBox:p}=R(),s=T(D),{ptSegmentInstance:i}=s,{t:S}=k(),{defaultAttribute:m}=bt(),f=wt(),{isPointCloudSegmentationPattern:b}=$(),J=mt(),W={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};j(()=>{if(!!i)return i.on("syncPointCloudStatus",g),()=>{i.unbind("syncPointCloudStatus",g)}},[i]);const X=(l,C)=>{var _,P,x,B,N;const E=(_=a==null?void 0:a.attributeList)==null?void 0:_.map(v=>v.value===l?V(A({},v),{color:C}):v),O=V(A({},a),{attributeList:E}),tt=JSON.stringify(O),et=c==null?void 0:c.map(v=>(v==null?void 0:v.step)===(r==null?void 0:r.step)?V(A({},v),{config:tt}):v);(P=s==null?void 0:s.topViewInstance)==null||P.updateAttributeList(E),(x=s==null?void 0:s.sideViewInstance)==null||x.updateAttributeList(E),(B=s==null?void 0:s.backViewInstance)==null||B.updateAttributeList(E),(N=s==null?void 0:s.mainViewInstance)==null||N.setConfig(O),J(It({stepList:et}))},Y=l=>{f.updateViewsByDefaultSize&&f.updateViewsByDefaultSize(l)},q=l=>{F({globalPattern:s.globalPattern,segmentStatus:d.segmentStatus})||n.setDefaultAttribute(l)},G=(l,C)=>{F({globalPattern:s.globalPattern,segmentStatus:d.segmentStatus})||n.setSubAttribute(l,C)},K=o.map(l=>({label:l.key,value:l.value,color:l==null?void 0:l.color,limit:l==null?void 0:l.limit,isDefault:l==null?void 0:l.isDefault})),Q=p||d.cacheSegData&&d.segmentStatus===w.Edit,Z=b;return e.createElement("div",{style:{flex:1,overflowX:"hidden",overflowY:"auto"}},e.createElement("div",{style:W},S("Attribute")),e.createElement(St,{list:K,forbidDefault:!0,selectedAttribute:m!=null?m:"",attributeChanged:l=>q(l),updateColorConfig:X,enableColorPicker:u,updateSize:Y,forbidShowLimitPopover:Z}),e.createElement(h,{style:{margin:0}}),Q&&e.createElement(Lt,{subAttributeList:t,setSubAttribute:G,getValue:l=>{var C,_,P,x;return((_=(C=s.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:_[l.value])||((x=(P=d.cacheSegData)==null?void 0:P.subAttribute)==null?void 0:x[l.value])}}))},Vt=[{toolName:"LassoSelector",commonSvg:Ct,selectedSvg:_t},{toolName:"RectSelector",commonSvg:Et,selectedSvg:yt},{toolName:"CircleSelector",commonSvg:Pt,selectedSvg:xt}],H=({toolInstance:o})=>{const{ptSegmentInstance:t}=T(D),[n,a]=y("LassoSelector"),{t:c}=k();return j(()=>{if(!t)return;const r=()=>{a("LassoSelector")},u=()=>{a("RectSelector")},d=()=>{a("CircleSelector")};return t.on("LassoSelector",r),t.on("RectSelector",u),t.on("CircleSelector",d),()=>{t.unbind("LassoSelector",r),t.unbind("RectSelector",u),t.unbind("CircleSelector",d)}},[t]),e.createElement("div",{className:`${L}__level`},Vt.map(r=>{const u=n===r.toolName;return e.createElement("span",{className:`${L}__toolOption`,key:r.toolName,onClick:()=>t==null?void 0:t.emit(r.toolName)},e.createElement("img",{className:`${L}__singleTool`,src:u?r==null?void 0:r.selectedSvg:r==null?void 0:r.commonSvg}),e.createElement("span",{className:ut({[`${L}__toolOption__selected`]:u})},c(r.toolName)))}))},Bt=({stepInfo:o,toolInstance:t,imgList:n,imgIndex:a,stepList:c,enableColorPicker:r})=>{var u,d;const{updatePointCloudPattern:g,pointCloudPattern:p,isPointCloudSegmentationPattern:s}=$(),i=ct(o.config),S=(u=i==null?void 0:i.attributeList)!=null?u:[],m=(i==null?void 0:i.secondaryAttributeConfigurable)===!0?(d=i==null?void 0:i.inputList)!=null?d:[]:[];return s?e.createElement(e.Fragment,null,e.createElement(H,{toolInstance:t}),e.createElement(M,{toolInstance:t,attributeList:S,subAttributeList:m,config:i,stepList:c,stepInfo:o,enableColorPicker:r})):e.createElement(e.Fragment,null,e.createElement(nt,{toolName:lt.EPointCloudName.PointCloud,selectedToolName:p,onChange:f=>g==null?void 0:g(f)}),e.createElement(M,{toolInstance:t,attributeList:S,subAttributeList:m,config:i,stepList:c,stepInfo:o,enableColorPicker:r}),(i==null?void 0:i.trackConfigurable)===!0&&p===rt.Rect&&e.createElement("div",{style:{flexShrink:0,height:280,overflow:"auto"}},e.createElement(At,null),e.createElement(h,{style:{margin:0}}),e.createElement(ft,{imgList:n,imgIndex:a}),e.createElement(h,{style:{margin:0}}),e.createElement(gt,{imgList:n,imgIndex:a})))},Nt=o=>{var t,n,a,c;const r=st.getCurrentStepInfo((t=o.annotation)==null?void 0:t.step,(n=o.annotation)==null?void 0:n.stepList),u=(a=o.annotation)==null?void 0:a.toolInstance,d=(c=o.annotation)==null?void 0:c.stepList;return{stepInfo:r,toolInstance:u,imgList:o.annotation.imgList,imgIndex:o.annotation.imgIndex,stepList:d}};var Ot=at(Nt,null,null,{context:dt})(Bt);export{H as PointCloudSegToolIcon,Ot as default};
1
+ import e,{useState as y,useContext as T,useEffect as j}from"react";import{EditFilled as ot}from"@ant-design/icons";import{ToolIcons as nt}from"../ToolIcons.js";import{EToolName as rt}from"../../../../data/enums/ToolType.js";import{cTool as lt}from"@labelbee/lb-annotation";import{PointCloudContext as D}from"../../../../components/pointCloudView/PointCloudContext.js";import{Divider as h,Input as it,message as I}from"antd";import st from"../../../../utils/StepUtils.js";import{connect as at}from"react-redux";import{jsonParser as ct,classnames as ut}from"../../../../utils/index.js";import{useStatus as $}from"../../../../components/pointCloudView/hooks/useStatus.js";import{useSingleBox as R}from"../../../../components/pointCloudView/hooks/useSingleBox.js";import{useTranslation as k}from"react-i18next";import{LabelBeeContext as dt,useDispatch as mt}from"../../../../store/ctx.js";import pt from"./components/batchUpdateModal/index.js";import ft from"./components/annotatedBox/index.js";import gt from"./components/findTrackIDIndex/index.js";import{EPointCloudSegmentStatus as w,EPointCloudPattern as vt}from"@labelbee/lb-utils";import St from"../../../../components/attributeList/index.js";import{useAttribute as bt}from"../../../../components/pointCloudView/hooks/useAttribute.js";import Ct from"../../../../assets/annotation/pointCloudTool/lassoSelector.svg.js";import _t from"../../../../assets/annotation/pointCloudTool/lassoSelector_a.svg.js";import Pt from"../../../../assets/annotation/pointCloudTool/circleSelector.svg.js";import xt from"../../../../assets/annotation/pointCloudTool/circleSelector_a.svg.js";import Et from"../../../../assets/annotation/rectTool/icon_rect.svg.js";import yt from"../../../../assets/annotation/rectTool/icon_rect_a.svg.js";import{sidebarCls as L}from"../index.js";import{SetTaskStepList as It}from"../../../../store/annotation/actionCreators.js";import{usePointCloudViews as wt}from"../../../../components/pointCloudView/hooks/usePointCloudViews.js";import Lt from"../../../../components/subAttributeList/index.js";var Tt=Object.defineProperty,jt=Object.defineProperties,Dt=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,ht=Object.prototype.hasOwnProperty,kt=Object.prototype.propertyIsEnumerable,z=(o,t,n)=>t in o?Tt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,A=(o,t)=>{for(var n in t||(t={}))ht.call(t,n)&&z(o,n,t[n]);if(U)for(var n of U(t))kt.call(t,n)&&z(o,n,t[n]);return o},V=(o,t)=>jt(o,Dt(t));const At=()=>{const[o,t]=y(!1),n=T(D),{pointCloudBoxList:a}=n,{selectedBox:c,updateSelectedBox:r}=R(),[u,d]=y(""),{t:g}=k(),p=c==null?void 0:c.info.trackID,s=m=>!!a.find(b=>b.trackID===m&&b.id!==(c==null?void 0:c.info.id)),i=(m=!1)=>{const f=parseInt(u,10);if(m&&t(!1),isNaN(f)){I.error(g("PositiveIntegerCheck"));return}if(u.indexOf(".")>-1){I.error(g("NotAllowDecimalPointsInTrackID"));return}if(s(f)){I.error(g("DuplicateTrackIDsExist"));return}if(!(f>0)){I.error(g("PositiveIntegerCheck"));return}S(f)};j(()=>{t(!1)},[p]);const S=m=>{var f;const b=r({trackID:m});(f=n==null?void 0:n.topViewInstance)==null||f.updatePolygonList(b!=null?b:[])};return e.createElement("div",{style:{padding:24}},e.createElement("div",{style:{marginBottom:16,display:"flex",justifyContent:"space-between",alignItems:"center"}},e.createElement("span",null,g("CurrentBoxTrackIDs")),p&&e.createElement(pt,{id:p,updateCurrentPolygonList:m=>S(m)})),e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"12px"}},o&&p?e.createElement(it,{defaultValue:p,onChange:m=>{d(m.target.value)},disabled:!p,size:"small",onBlur:()=>{i()},onPressEnter:()=>{i(!0)}}):e.createElement("span",null,p),e.createElement(ot,{style:{color:"#999",marginLeft:16,cursor:typeof p!="undefined"?"pointer":"not-allowed"},onClick:()=>{p&&t(!o)}})))},F=({segmentStatus:o,globalPattern:t})=>t===vt.Segmentation&&![w.Edit,w.Ready].includes(o),M=({attributeList:o,subAttributeList:t,toolInstance:n,config:a,stepList:c,stepInfo:r,enableColorPicker:u})=>{const[d,g]=y({segmentStatus:w.Ready}),{selectedBox:p}=R(),s=T(D),{ptSegmentInstance:i}=s,{t:S}=k(),{defaultAttribute:m}=bt(),f=wt(),{isPointCloudSegmentationPattern:b}=$(),H=mt(),J={fontWeight:500,fontSize:14,margin:"12px 0 8px 20px"};j(()=>{if(!!i)return i.on("syncPointCloudStatus",g),()=>{i.unbind("syncPointCloudStatus",g)}},[i]);const X=(l,C)=>{var _,P,x,B,N;const E=(_=a==null?void 0:a.attributeList)==null?void 0:_.map(v=>v.value===l?V(A({},v),{color:C}):v),O=V(A({},a),{attributeList:E}),tt=JSON.stringify(O),et=c==null?void 0:c.map(v=>(v==null?void 0:v.step)===(r==null?void 0:r.step)?V(A({},v),{config:tt}):v);(P=s==null?void 0:s.topViewInstance)==null||P.updateAttributeList(E),(x=s==null?void 0:s.sideViewInstance)==null||x.updateAttributeList(E),(B=s==null?void 0:s.backViewInstance)==null||B.updateAttributeList(E),(N=s==null?void 0:s.mainViewInstance)==null||N.setConfig(O),H(It({stepList:et}))},Y=l=>{f.updateViewsByDefaultSize&&f.updateViewsByDefaultSize(l)},q=l=>{F({globalPattern:s.globalPattern,segmentStatus:d.segmentStatus})||n.setDefaultAttribute(l)},G=(l,C)=>{F({globalPattern:s.globalPattern,segmentStatus:d.segmentStatus})||n.setSubAttribute(l,C)},K=o.map(l=>({label:l.key,value:l.value,color:l==null?void 0:l.color,limit:l==null?void 0:l.limit,isDefault:l==null?void 0:l.isDefault})),Q=p||d.cacheSegData&&d.segmentStatus===w.Edit,Z=b;return e.createElement("div",{style:{flex:1,overflowX:"hidden",overflowY:"auto"}},e.createElement("div",{style:J},S("Attribute")),e.createElement(St,{list:K,forbidDefault:!0,selectedAttribute:m!=null?m:"",attributeChanged:l=>q(l),updateColorConfig:X,enableColorPicker:u,updateSize:Y,forbidShowLimitPopover:Z}),e.createElement(h,{style:{margin:0}}),Q&&e.createElement(Lt,{subAttributeList:t,setSubAttribute:G,getValue:l=>{var C,_,P,x;return((_=(C=s.selectedPointCloudBox)==null?void 0:C.subAttribute)==null?void 0:_[l.value])||((x=(P=d.cacheSegData)==null?void 0:P.subAttribute)==null?void 0:x[l.value])}}))},Vt=[{toolName:"LassoSelector",commonSvg:Ct,selectedSvg:_t},{toolName:"RectSelector",commonSvg:Et,selectedSvg:yt},{toolName:"CircleSelector",commonSvg:Pt,selectedSvg:xt}],W=({toolInstance:o})=>{const{ptSegmentInstance:t}=T(D),[n,a]=y("LassoSelector"),{t:c}=k();return j(()=>{if(!t)return;const r=()=>{a("LassoSelector")},u=()=>{a("RectSelector")},d=()=>{a("CircleSelector")};return t.on("LassoSelector",r),t.on("RectSelector",u),t.on("CircleSelector",d),()=>{t.unbind("LassoSelector",r),t.unbind("RectSelector",u),t.unbind("CircleSelector",d)}},[t]),e.createElement("div",{className:`${L}__level`},Vt.map(r=>{const u=n===r.toolName;return e.createElement("span",{className:`${L}__toolOption`,key:r.toolName,onClick:()=>t==null?void 0:t.emit(r.toolName)},e.createElement("img",{className:`${L}__singleTool`,src:u?r==null?void 0:r.selectedSvg:r==null?void 0:r.commonSvg}),e.createElement("span",{className:ut({[`${L}__toolOption__selected`]:u})},c(r.toolName)))}))},Bt=({stepInfo:o,toolInstance:t,imgList:n,imgIndex:a,stepList:c,enableColorPicker:r})=>{var u,d;const{updatePointCloudPattern:g,pointCloudPattern:p,isPointCloudSegmentationPattern:s}=$(),i=ct(o.config),S=(u=i==null?void 0:i.attributeList)!=null?u:[],m=(i==null?void 0:i.secondaryAttributeConfigurable)===!0?(d=i==null?void 0:i.inputList)!=null?d:[]:[];return s?e.createElement(e.Fragment,null,e.createElement(W,{toolInstance:t}),e.createElement(M,{toolInstance:t,attributeList:S,subAttributeList:m,config:i,stepList:c,stepInfo:o,enableColorPicker:r})):e.createElement(e.Fragment,null,e.createElement(nt,{toolName:lt.EPointCloudName.PointCloud,selectedToolName:p,onChange:f=>g==null?void 0:g(f)}),e.createElement(M,{toolInstance:t,attributeList:S,subAttributeList:m,config:i,stepList:c,stepInfo:o,enableColorPicker:r}),(i==null?void 0:i.trackConfigurable)===!0&&p===rt.Rect&&e.createElement("div",{style:{flexShrink:0,height:280,overflow:"auto"}},e.createElement(At,null),e.createElement(h,{style:{margin:0}}),e.createElement(ft,{imgList:n,imgIndex:a}),e.createElement(h,{style:{margin:0}}),e.createElement(gt,{imgList:n,imgIndex:a})))},Nt=o=>{var t,n,a,c;const r=st.getCurrentStepInfo((t=o.annotation)==null?void 0:t.step,(n=o.annotation)==null?void 0:n.stepList),u=(a=o.annotation)==null?void 0:a.toolInstance,d=(c=o.annotation)==null?void 0:c.stepList;return{stepInfo:r,toolInstance:u,imgList:o.annotation.imgList,imgIndex:o.annotation.imgIndex,stepList:d}};var Ot=at(Nt,null,null,{context:dt})(Bt);export{W as PointCloudSegToolIcon,Ot as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.23.0-alpha.35",
3
+ "version": "1.23.0-alpha.37",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -43,8 +43,8 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@ant-design/icons": "^4.6.2",
46
- "@labelbee/lb-annotation": "1.27.0-alpha.16",
47
- "@labelbee/lb-utils": "1.19.0-alpha.10",
46
+ "@labelbee/lb-annotation": "1.27.0-alpha.17",
47
+ "@labelbee/lb-utils": "1.19.0-alpha.11",
48
48
  "@labelbee/wavesurfer": "1.0.0",
49
49
  "@types/react-dom": "^18.2.7",
50
50
  "@types/react-transition-group": "^4.4.9",