@labelbee/lb-components 1.23.0-alpha.2 → 1.23.0-alpha.4

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";var React=require("react"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$3=require("../../constant/index.js"),index$2=require("./textContent/index.js"),index$1=require("../../views/MainView/annotationTips/index.js"),reducer=require("../../store/annotation/reducer.js"),index=require("../../utils/index.js"),data=require("../LLMToolView/utils/data.js"),annotation=require("../../hooks/annotation.js"),lbAnnotation=require("@labelbee/lb-annotation");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,n,o)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,__spreadValues=(e,n)=>{for(var o in n||(n={}))__hasOwnProp.call(n,o)&&__defNormalProp(e,o,n[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(n))__propIsEnum.call(n,o)&&__defNormalProp(e,o,n[o]);return e},__spreadProps=(e,n)=>__defProps(e,__getOwnPropDescs(n));const NLPViewCls=`${index$3.prefix}-NLPView`,NLPToolView=e=>{const{annotation:n,checkMode:o,tips:q,showTips:N,extraLayer:T,extraData:V,onChangeAnnotation:A,customAnnotationData:E}=e,{imgIndex:c,imgList:f,stepList:p,step:x}=n,{highlightKey:M,setHighlightKey:$}=React.useContext(ctx.NLPContext),{toolInstanceRef:i}=annotation.useCustomToolInstance(),[_,I]=React.useState(""),[g,k]=React.useState([]),[m,B]=React.useState(void 0),[K,H]=React.useState([{content:""}]),[a,l]=React.useState({id:1,newText:"",indicatorDetermine:{},textAnnotation:[]}),F=React.useMemo(()=>(a==null?void 0:a.textAnnotation)?(m&&(a.textAnnotation=m),a.textAnnotation.filter(t=>g.length===0||g.includes(t.attribute))):[],[a,g,m]),v=React.useMemo(()=>{var t;if(p&&x){const r=(t=reducer.getStepConfig(p,x))==null?void 0:t.config;return index.jsonParser(r)}},[p,x]);React.useEffect(()=>{var t;if(!f[c])return;const r=(t=f[c])==null?void 0:t.textData;H(r),(v==null?void 0:v.attributeConfigurable)||h([])},[c,v]),React.useEffect(()=>{var t;if(!f[c])return;const r=(t=f[c])!=null?t:{},u=data.getCurrentResultFromResultList(r==null?void 0:r.result);l(u)},[c]),React.useEffect(()=>{i.current.exportData=()=>[[a],{}],i.current.setResult=()=>{},i.current.updateResult=t=>{l(t)},i.current.clearResult=J,i.current.setDefaultAttribute=z,i.current.setHighlightKey=$,i.current.deleteTextAnnotation=Q,i.current.setAttributeLockList=G,i.current.setVisibleResult=h,b()},[a]);const b=()=>{i.current.emit("changeAttributeSidebar"),i.current.emit("changeIndicatorDetermine")},z=t=>{i.current.defaultAttribute=t,I(t),b()},G=t=>{k(t)},h=t=>{B(t)},J=()=>{l({id:1,newText:"",indicatorDetermine:{},textAnnotation:[]}),b()},Q=t=>{l(r=>__spreadProps(__spreadValues({},r),{textAnnotation:r.textAnnotation.filter(u=>u.id!==t)}))},U=(t,r)=>{var u,d;if(r===""||!t)return;const s=window.getSelection(),{anchorOffset:L=0,focusOffset:P=0,anchorNode:X,focusNode:Y}=s||{};if(X===Y){const w=Math.min(L,P),S=Math.max(L,P);let y;if((t==null?void 0:t.current)&&s){const C=(u=t.current)==null?void 0:u.getBoundingClientRect(),O=s.getRangeAt(0).getBoundingClientRect(),R=O.right-C.left,j=O.top-C.top;R&&j&&(y={left:R,top:j})}const D={id:lbAnnotation.uuid(8,62),start:w,end:S,text:r};if(typeof A=="function"){A(__spreadProps(__spreadValues({},D),{endPosition:y}));return}if(W(w,S,_,a==null?void 0:a.textAnnotation)||o)return;l(__spreadProps(__spreadValues({},a),{textAnnotation:[...(a==null?void 0:a.textAnnotation)||[],__spreadProps(__spreadValues({},D),{attribute:_})]})),(d=window.getSelection())==null||d.empty()}},W=(t,r,u,d)=>d==null?void 0:d.some(s=>(s==null?void 0:s.start)===t&&(s==null?void 0:s.end)===r&&(s==null?void 0:s.attribute)===u);return React__default.default.createElement("div",{className:NLPViewCls},React__default.default.createElement("div",{className:`${NLPViewCls}-question`},N===!0&&React__default.default.createElement(index$1,{tips:q}),React__default.default.createElement(index$2,{highlightKey:M,textData:K,NLPConfig:v,textAnnotation:F,onSelectionChange:U,extraLayer:T,extraData:V,customAnnotationData:E})))},mapStateToProps=e=>({annotation:e.annotation});var NLPToolView$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(NLPToolView);module.exports=NLPToolView$1;
1
+ "use strict";var React=require("react"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$3=require("../../constant/index.js"),index$2=require("./textContent/index.js"),index$1=require("../../views/MainView/annotationTips/index.js"),reducer=require("../../store/annotation/reducer.js"),index=require("../../utils/index.js"),data=require("../LLMToolView/utils/data.js"),annotation=require("../../hooks/annotation.js"),lbAnnotation=require("@labelbee/lb-annotation");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,n,o)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,__spreadValues=(e,n)=>{for(var o in n||(n={}))__hasOwnProp.call(n,o)&&__defNormalProp(e,o,n[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(n))__propIsEnum.call(n,o)&&__defNormalProp(e,o,n[o]);return e},__spreadProps=(e,n)=>__defProps(e,__getOwnPropDescs(n));const NLPViewCls=`${index$3.prefix}-NLPView`,NLPToolView=e=>{const{annotation:n,checkMode:o,tips:q,showTips:T,extraLayer:V,extraData:E,onChangeAnnotation:A,customAnnotationData:M}=e,{imgIndex:c,imgList:f,stepList:p,step:x}=n,{highlightKey:$,setHighlightKey:I}=React.useContext(ctx.NLPContext),{toolInstanceRef:i}=annotation.useCustomToolInstance(),[_,k]=React.useState(""),[g,B]=React.useState([]),[m,K]=React.useState(void 0),[H,F]=React.useState([{content:""}]),[a,l]=React.useState({id:1,newText:"",indicatorDetermine:{},textAnnotation:[]}),z=React.useMemo(()=>(a==null?void 0:a.textAnnotation)?(m&&(a.textAnnotation=m),a.textAnnotation.filter(t=>g.length===0||g.includes(t.attribute))):[],[a,g,m]),v=React.useMemo(()=>{var t;if(p&&x){const r=(t=reducer.getStepConfig(p,x))==null?void 0:t.config;return index.jsonParser(r)}},[p,x]);React.useEffect(()=>{var t;if(!f[c])return;const r=(t=f[c])==null?void 0:t.textData;F(r),(v==null?void 0:v.attributeConfigurable)||h([])},[c,v]),React.useEffect(()=>{var t;if(!f[c])return;const r=(t=f[c])!=null?t:{},u=data.getCurrentResultFromResultList(r==null?void 0:r.result);l(u)},[c]),React.useEffect(()=>{i.current.exportData=()=>[[a],{}],i.current.setResult=()=>{},i.current.updateResult=t=>{l(t)},i.current.clearResult=Q,i.current.setDefaultAttribute=G,i.current.setHighlightKey=I,i.current.deleteTextAnnotation=U,i.current.setAttributeLockList=J,i.current.setVisibleResult=h,b()},[a]);const b=()=>{i.current.emit("changeAttributeSidebar"),i.current.emit("changeIndicatorDetermine")},G=t=>{i.current.defaultAttribute=t,k(t),b()},J=t=>{B(t)},h=t=>{K(t)},Q=()=>{l({id:1,newText:"",indicatorDetermine:{},textAnnotation:[]}),b()},U=t=>{l(r=>__spreadProps(__spreadValues({},r),{textAnnotation:r.textAnnotation.filter(u=>u.id!==t)}))},W=(t,r)=>{var u,d;if(r===""||!t)return;const s=window.getSelection(),{anchorOffset:L=0,focusOffset:P=0,anchorNode:Y,focusNode:Z}=s||{};if(Y===Z){const w=Math.min(L,P),S=Math.max(L,P);let y;if((t==null?void 0:t.current)&&s){const O=(u=t.current)==null?void 0:u.getBoundingClientRect(),R=s.getRangeAt(0).getBoundingClientRect(),j=R.right-O.left,N=R.top-O.top;j&&N&&(y={left:j,top:N})}const D={id:lbAnnotation.uuid(8,62),start:w,end:S,text:r};if(typeof A=="function"){A(__spreadProps(__spreadValues({},D),{endPosition:y}));return}if(X(w,S,_,a==null?void 0:a.textAnnotation)||o)return;const C=(a==null?void 0:a.textAnnotation)||[];C.push(__spreadProps(__spreadValues({},D),{attribute:_}));const tt=__spreadProps(__spreadValues({},a),{textAnnotation:C});l(tt),(d=window.getSelection())==null||d.empty()}},X=(t,r,u,d)=>d==null?void 0:d.some(s=>(s==null?void 0:s.start)===t&&(s==null?void 0:s.end)===r&&(s==null?void 0:s.attribute)===u);return React__default.default.createElement("div",{className:NLPViewCls,id:"NLPView"},React__default.default.createElement("div",{className:`${NLPViewCls}-question`},T===!0&&React__default.default.createElement(index$1,{tips:q}),React__default.default.createElement(index$2,{highlightKey:$,textData:H,NLPConfig:v,textAnnotation:z,onSelectionChange:W,extraLayer:V,extraData:E,customAnnotationData:M})))},mapStateToProps=e=>({annotation:e.annotation});var NLPToolView$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(NLPToolView);module.exports=NLPToolView$1;
@@ -1 +1 @@
1
- "use strict";var _=require("lodash"),React=require("react");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ___default=_interopDefaultLegacy(_),React__default=_interopDefaultLegacy(React),ExtraMask=({splitIntervals:t,extraData:o})=>React__default.default.createElement("div",{style:{position:"absolute",top:0,left:0,backgroundColor:"transparent",color:"transparent"}},t.map((e,l)=>{var n;const r=___default.default.last(e.extraAnnotations);let a=`2px solid ${((n=e==null?void 0:e.extraAnnotations)==null?void 0:n.find(d=>(d==null?void 0:d.auditID)===(o==null?void 0:o.hoverAuditID)))?"#ffc60a":"#fcdf7e"}`;return(o==null?void 0:o.isShowRemark)||(a=""),r?React__default.default.createElement("span",{style:{borderBottom:a,padding:"2px 0px"},id:r==null?void 0:r.id,key:l},e.text):React__default.default.createElement("span",{key:l},e.text)}));module.exports=ExtraMask;
1
+ "use strict";var _=require("lodash"),React=require("react");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ___default=_interopDefaultLegacy(_),React__default=_interopDefaultLegacy(React),ExtraMask=({splitIntervals:t,extraData:o})=>React__default.default.createElement("div",{style:{position:"absolute",top:0,left:0,backgroundColor:"transparent",color:"transparent"}},t.map((e,l)=>{var n;const r=___default.default.last(e.extraAnnotations);let a=`2px solid ${((n=e==null?void 0:e.extraAnnotations)==null?void 0:n.find(d=>(d==null?void 0:d.auditID)===(o==null?void 0:o.hoverAuditID)))?"#ff8609":"#fcdf7e"}`;return(o==null?void 0:o.isShowRemark)||(a=""),r?React__default.default.createElement("span",{style:{borderBottom:a,padding:"2px 0px"},id:r==null?void 0:r.id,key:l},e.text):React__default.default.createElement("span",{key:l},e.text)}));module.exports=ExtraMask;
@@ -1 +1 @@
1
- "use strict";var React=require("react"),reactI18next=require("react-i18next"),lbUtils=require("@labelbee/lb-utils"),index$2=require("../../../constant/index.js"),ahooks=require("ahooks"),_=require("lodash"),lbAnnotation=require("@labelbee/lb-annotation"),styleString=require("../../../constant/styleString.js"),index=require("../utils/index.js"),index$1=require("../../../utils/index.js"),extraMask=require("./extraMask.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,o,n)=>o in e?__defProp(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,__spreadValues=(e,o)=>{for(var n in o||(o={}))__hasOwnProp.call(o,n)&&__defNormalProp(e,n,o[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(o))__propIsEnum.call(o,n)&&__defNormalProp(e,n,o[n]);return e};const NLPViewCls=`${index$2.prefix}-NLPView`,renderExtraModal=({extraLayer:e,extraStyle:o,setExtraStyle:n,setExtraResut:u,extraResut:c})=>{if(typeof e=="function"&&n&&u)return e({style:o,onClose:()=>{var d;n(void 0),u(void 0),(d=window.getSelection())==null||d.empty()},submitData:c})},TextContent=e=>{const{highlightKey:o,textData:n,lang:u,NLPConfig:c,onSelectionChange:d,textAnnotation:h,extraData:i,customAnnotationData:E}=e,{displayRemarkList:f=[]}=i||{},{t:w}=reactI18next.useTranslation(),v=React.useRef(null),I=ahooks.useTextSelection(v),[m,q]=React.useState(),[D,b]=React.useState(void 0),p=React.useMemo(()=>{var t;return(t=n==null?void 0:n[0])==null?void 0:t.content},[n]),R=React.useMemo(()=>{const t=___default.default.clone(f);return(m==null?void 0:m.start)&&t.push(m),index.getIntervals(p,t!=null?t:[],"extraAnnotations")},[f,m,p]),j=React.useMemo(()=>index.getIntervals(p,h!=null?h:[],"annotations"),[h,p]);React.useEffect(()=>{if(E){const{id:t,start:a,end:s,text:l,endPosition:r}=E;q({id:t,start:a,end:s,text:l}),b(r)}},[E]);const P=(t="")=>{if(c==null?void 0:c.attributeConfigurable){const a=lbAnnotation.CommonToolUtils.jsonParser(styleString);return lbUtils.toolStyleConverter.getColorByConfig({attribute:t,config:c,style:a})}};return React.useEffect(()=>{var t;u&&((t=lbUtils.i18n)==null||t.changeLanguage(u))},[]),React.useEffect(()=>{d==null||d(v,I.text)},[I.text]),React.useEffect(()=>{var t;if(!(i==null?void 0:i.editAuditID))return;const a=f.filter(r=>(r==null?void 0:r.auditID)===i.editAuditID)[0],s=(t=a==null?void 0:a.id)!=null?t:"",l=document.getElementById(s);if(l&&v.current){const r=l.getBoundingClientRect(),g=v.current.getBoundingClientRect(),x=r.right-g.left,y=r.bottom-g.top-l.offsetHeight;x&&y&&b&&b({left:x,top:y})}},[i==null?void 0:i.editAuditID]),React__default.default.createElement("div",null,React__default.default.createElement("div",{className:`${NLPViewCls}-question-title`},w("textTool")),React__default.default.createElement("div",{className:index$1.classnames({[`${NLPViewCls}-question-content`]:!0}),style:{position:"relative"},onDoubleClick:t=>{t.preventDefault()}},React__default.default.createElement("div",{style:{position:"relative"}},j.map((t,a)=>{var s,l,r,g;const x=___default.default.last(t.annotations);if(x){let y=P(x.attribute);const S=(s=t==null?void 0:t.annotations)==null?void 0:s.find(C=>C.id===o);if(S){const C=(g=(r=(l=t==null?void 0:t.annotations)==null?void 0:l.filter(k=>k.id===o))==null?void 0:r[0])==null?void 0:g.attribute;y=P(C)}return React__default.default.createElement("span",{style:{backgroundColor:y.valid.stroke,color:S?"white":void 0,padding:"2px 0px"},key:a},t.text)}else return React__default.default.createElement("span",{key:a},t.text)}),(f==null?void 0:f.length)>0&&React__default.default.createElement(extraMask,{splitIntervals:R,extraData:i}),renderExtraModal({extraLayer:e==null?void 0:e.extraLayer,setExtraStyle:b,extraStyle:D,extraResut:m,setExtraResut:q}),React__default.default.createElement("div",{className:`${NLPViewCls}-question-content-mask`,ref:v},p))))},WrapQuestionView=e=>React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(TextContent,__spreadValues({},e)));module.exports=WrapQuestionView;
1
+ "use strict";var React=require("react"),reactI18next=require("react-i18next"),lbUtils=require("@labelbee/lb-utils"),index$2=require("../../../constant/index.js"),ahooks=require("ahooks"),_=require("lodash"),lbAnnotation=require("@labelbee/lb-annotation"),styleString=require("../../../constant/styleString.js"),index=require("../utils/index.js"),index$1=require("../../../utils/index.js"),extraMask=require("./extraMask.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,o,n)=>o in t?__defProp(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,__spreadValues=(t,o)=>{for(var n in o||(o={}))__hasOwnProp.call(o,n)&&__defNormalProp(t,n,o[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(o))__propIsEnum.call(o,n)&&__defNormalProp(t,n,o[n]);return t};const NLPViewCls=`${index$2.prefix}-NLPView`,renderExtraModal=({extraLayer:t,extraStyle:o,setExtraStyle:n,setExtraResut:d,extraResut:f})=>{if(typeof t=="function"&&n&&d)return t({style:o,onClose:()=>{var v;n(void 0),d(void 0),(v=window.getSelection())==null||v.empty()},submitData:f})},TextContent=t=>{const{highlightKey:o,textData:n,lang:d,NLPConfig:f,onSelectionChange:v,textAnnotation:E,extraData:l,customAnnotationData:I}=t,{displayRemarkList:p=[]}=l||{},{t:S}=reactI18next.useTranslation(),m=React.useRef(null),q=ahooks.useTextSelection(m),[g,w]=React.useState(),[D,b]=React.useState(void 0),x=React.useMemo(()=>{var e;return(e=n==null?void 0:n[0])==null?void 0:e.content},[n]),R=React.useMemo(()=>{const e=___default.default.clone(p);return(g==null?void 0:g.start)&&e.push(g),index.getIntervals(x,e!=null?e:[],"extraAnnotations")},[p,g,x]),j=React.useMemo(()=>index.getIntervals(x,E!=null?E:[],"annotations"),[E,x]);React.useEffect(()=>{if(I){const{id:e,start:r,end:i,text:u,endPosition:a}=I;w({id:e,start:r,end:i,text:u}),b(a)}},[I]);const P=(e="")=>{if(f==null?void 0:f.attributeConfigurable){const r=lbAnnotation.CommonToolUtils.jsonParser(styleString);return lbUtils.toolStyleConverter.getColorByConfig({attribute:e,config:f,style:r})}};return React.useEffect(()=>{var e;d&&((e=lbUtils.i18n)==null||e.changeLanguage(d))},[]),React.useEffect(()=>{v==null||v(m,q.text)},[q.text]),React.useEffect(()=>{var e;if(!(l==null?void 0:l.editAuditID))return;const r=document.getElementById("NLPView"),i=p.filter(s=>(s==null?void 0:s.auditID)===l.editAuditID)[0],u=(e=i==null?void 0:i.id)!=null?e:"",a=document.getElementById(u);if(a&&m.current){const s=a.getBoundingClientRect(),h=m.current.getBoundingClientRect(),y=s.right-h.left,c=a.offsetTop;y&&c&&b&&(r&&r.scrollTo({top:c,behavior:"auto"}),b({left:y,top:c}))}},[l==null?void 0:l.editAuditID]),React__default.default.createElement("div",null,React__default.default.createElement("div",{className:`${NLPViewCls}-question-title`},S("textTool")),React__default.default.createElement("div",{className:index$1.classnames({[`${NLPViewCls}-question-content`]:!0}),style:{position:"relative",whiteSpace:"pre-wrap"},onDoubleClick:e=>{e.preventDefault()}},React__default.default.createElement("div",{style:{position:"relative"}},j.map((e,r)=>{var i,u,a,s;const h=___default.default.last(e.annotations);if(h){let y=P(h.attribute);const c=(i=e==null?void 0:e.annotations)==null?void 0:i.find(C=>C.id===o);if(c){const C=(s=(a=(u=e==null?void 0:e.annotations)==null?void 0:u.filter(k=>k.id===o))==null?void 0:a[0])==null?void 0:s.attribute;y=P(C)}return React__default.default.createElement("span",{style:{backgroundColor:y.valid.stroke,color:c?"white":void 0,padding:"2px 0px"},key:r},e.text)}else return React__default.default.createElement("span",{key:r},e.text)}),(p==null?void 0:p.length)>0&&React__default.default.createElement(extraMask,{splitIntervals:R,extraData:l}),renderExtraModal({extraLayer:t==null?void 0:t.extraLayer,setExtraStyle:b,extraStyle:D,extraResut:g,setExtraResut:w}),React__default.default.createElement("div",{className:`${NLPViewCls}-question-content-mask`,ref:m},x))))},WrapQuestionView=t=>React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(TextContent,__spreadValues({},t)));module.exports=WrapQuestionView;
@@ -1 +1 @@
1
- "use strict";var React=require("react"),reactRedux=require("react-redux"),StepUtils=require("../../../../utils/StepUtils.js"),reactI18next=require("react-i18next"),ctx=require("../../../../store/ctx.js"),index=require("../../../../utils/index.js"),index$1=require("../../../../components/LLMToolView/sidebar/components/determineGroup/index.js"),data=require("../../../../components/LLMToolView/utils/data.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,n)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,__spreadValues=(t,e)=>{for(var n in e||(e={}))__hasOwnProp.call(e,n)&&__defNormalProp(t,n,e[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(e))__propIsEnum.call(e,n)&&__defNormalProp(t,n,e[n]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const IndicatorDetermineList=t=>{const{toolInstance:e,stepInfo:n,disabeledAll:u,imgIndex:c,imgList:d}=t,[m]=e.exportData(),[i,_]=React.useState(m==null?void 0:m[0]),{t:g}=reactI18next.useTranslation(),[D,x]=React.useState(0);React.useEffect(()=>{var o;if(!d[c])return;const r=(o=d[c])!=null?o:{},a=data.getCurrentResultFromResultList((r==null?void 0:r.result)||"");_(a)},[c,d]),React.useEffect(()=>(e&&e.on("changeIndicatorDetermine",o=>{const[r]=e.exportData();_(r==null?void 0:r[0]),x(a=>a+1)}),()=>{e==null||e.unbindAll("changeIndicatorDetermine")}),[e]);const I=index.jsonParser(n.config),{indicatorDetermine:p}=I,y=o=>{var r;const{value:a,key:l}=o;if(l){const v={[l]:a},s=(r=i==null?void 0:i.indicatorDetermine)!=null?r:{},f=__spreadProps(__spreadValues({},i),{indicatorDetermine:__spreadValues(__spreadValues({},s),v)});e.updateResult(f)}};if((p==null?void 0:p.length)>0){const o=p.filter(r=>r==null?void 0:r.label);return React__default.default.createElement("div",{style:{padding:"12px",marginBottom:"12px"}},React__default.default.createElement("div",{style:{fontSize:"16px",fontWeight:500,lineHeight:"46px"}},g("IndicatorJudgment")),React__default.default.createElement("div",{style:{maxHeight:"400px",overflow:"auto"}},o.map((r,a)=>{var l;const{label:v,value:s}=r;return React__default.default.createElement(index$1,{selectValue:(l=i==null?void 0:i.indicatorDetermine)==null?void 0:l[s],title:v,updateValue:f=>{y({key:s,value:f})},key:a,disabeledAll:u})})))}return null},mapStateToProps=t=>{var e,n;const u=StepUtils.getCurrentStepInfo((e=t.annotation)==null?void 0:e.step,(n=t.annotation)==null?void 0:n.stepList);return{toolInstance:t.annotation.toolInstance,stepInfo:u,imgIndex:t.annotation.imgIndex,imgList:t.annotation.imgList}};var IndicatorDetermineList$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(IndicatorDetermineList);module.exports=IndicatorDetermineList$1;
1
+ "use strict";var React=require("react"),reactRedux=require("react-redux"),StepUtils=require("../../../../utils/StepUtils.js"),reactI18next=require("react-i18next"),ctx=require("../../../../store/ctx.js"),index=require("../../../../utils/index.js"),index$1=require("../../../../components/LLMToolView/sidebar/components/determineGroup/index.js"),data=require("../../../../components/LLMToolView/utils/data.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,n)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,__spreadValues=(t,e)=>{for(var n in e||(e={}))__hasOwnProp.call(e,n)&&__defNormalProp(t,n,e[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(e))__propIsEnum.call(e,n)&&__defNormalProp(t,n,e[n]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const IndicatorDetermineList=t=>{const{toolInstance:e,stepInfo:n,disabeledAll:u,imgIndex:c,imgList:d}=t,[m]=e.exportData(),[i,g]=React.useState(m==null?void 0:m[0]),{t:_}=reactI18next.useTranslation(),[D,x]=React.useState(0);React.useEffect(()=>{var o;if(!d[c])return;const r=(o=d[c])!=null?o:{},a=data.getCurrentResultFromResultList((r==null?void 0:r.result)||"");g(a)},[c,d]),React.useEffect(()=>(e&&e.on("changeIndicatorDetermine",o=>{const[r]=e.exportData();g(r==null?void 0:r[0]),x(a=>a+1)}),()=>{e==null||e.unbindAll("changeIndicatorDetermine")}),[e]);const I=index.jsonParser(n.config),{indicatorDetermine:p}=I,y=o=>{var r;const{value:a,key:l}=o;if(l){const v={[l]:a},s=(r=i==null?void 0:i.indicatorDetermine)!=null?r:{},f=__spreadProps(__spreadValues({},i),{indicatorDetermine:__spreadValues(__spreadValues({},s),v)});e.updateResult(f)}};if((p==null?void 0:p.length)>0){const o=p.filter(r=>r==null?void 0:r.label);return React__default.default.createElement("div",{style:{padding:"12px",marginBottom:"12px"}},(o==null?void 0:o.length)>0&&React__default.default.createElement("div",null,React__default.default.createElement("div",{style:{fontSize:"16px",fontWeight:500,lineHeight:"46px"}},_("IndicatorJudgment")),React__default.default.createElement("div",{style:{maxHeight:"400px",overflow:"auto"}},o.map((r,a)=>{var l;const{label:v,value:s}=r;return React__default.default.createElement(index$1,{selectValue:(l=i==null?void 0:i.indicatorDetermine)==null?void 0:l[s],title:v,updateValue:f=>{y({key:s,value:f})},key:a,disabeledAll:u})}))))}return null},mapStateToProps=t=>{var e,n;const u=StepUtils.getCurrentStepInfo((e=t.annotation)==null?void 0:e.step,(n=t.annotation)==null?void 0:n.stepList);return{toolInstance:t.annotation.toolInstance,stepInfo:u,imgIndex:t.annotation.imgIndex,imgList:t.annotation.imgList}};var IndicatorDetermineList$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(IndicatorDetermineList);module.exports=IndicatorDetermineList$1;
@@ -1 +1 @@
1
- import g,{useContext as ct,useState as f,useMemo as M,useEffect as P}from"react";import{connect as ut}from"react-redux";import{LabelBeeContext as lt,NLPContext as dt}from"../../store/ctx.js";import{prefix as ft}from"../../constant/index.js";import pt from"./textContent/index.js";import mt from"../../views/MainView/annotationTips/index.js";import{getStepConfig as gt}from"../../store/annotation/reducer.js";import{jsonParser as vt}from"../../utils/index.js";import{getCurrentResultFromResultList as xt}from"../LLMToolView/utils/data.js";import{useCustomToolInstance as bt}from"../../hooks/annotation.js";import{uuid as At}from"@labelbee/lb-annotation";var _t=Object.defineProperty,ht=Object.defineProperties,wt=Object.getOwnPropertyDescriptors,k=Object.getOwnPropertySymbols,Pt=Object.prototype.hasOwnProperty,Lt=Object.prototype.propertyIsEnumerable,B=(o,e,r)=>e in o?_t(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,v=(o,e)=>{for(var r in e||(e={}))Pt.call(e,r)&&B(o,r,e[r]);if(k)for(var r of k(e))Lt.call(e,r)&&B(o,r,e[r]);return o},x=(o,e)=>ht(o,wt(e));const K=`${ft}-NLPView`,yt=o=>{const{annotation:e,checkMode:r,tips:$,showTips:H,extraLayer:q,extraData:F,onChangeAnnotation:L,customAnnotationData:Q}=o,{imgIndex:u,imgList:p,stepList:b,step:A}=e,{highlightKey:W,setHighlightKey:z}=ct(dt),{toolInstanceRef:i}=bt(),[y,G]=f(""),[_,J]=f([]),[h,U]=f(void 0),[X,Y]=f([{content:""}]),[s,l]=f({id:1,newText:"",indicatorDetermine:{},textAnnotation:[]}),Z=M(()=>(s==null?void 0:s.textAnnotation)?(h&&(s.textAnnotation=h),s.textAnnotation.filter(t=>_.length===0||_.includes(t.attribute))):[],[s,_,h]),m=M(()=>{var t;if(b&&A){const n=(t=gt(b,A))==null?void 0:t.config;return vt(n)}},[b,A]);P(()=>{var t;if(!p[u])return;const n=(t=p[u])==null?void 0:t.textData;Y(n),(m==null?void 0:m.attributeConfigurable)||C([])},[u,m]),P(()=>{var t;if(!p[u])return;const n=(t=p[u])!=null?t:{},c=xt(n==null?void 0:n.result);l(c)},[u]),P(()=>{i.current.exportData=()=>[[s],{}],i.current.setResult=()=>{},i.current.updateResult=t=>{l(t)},i.current.clearResult=nt,i.current.setDefaultAttribute=tt,i.current.setHighlightKey=z,i.current.deleteTextAnnotation=ot,i.current.setAttributeLockList=et,i.current.setVisibleResult=C,w()},[s]);const w=()=>{i.current.emit("changeAttributeSidebar"),i.current.emit("changeIndicatorDetermine")},tt=t=>{i.current.defaultAttribute=t,G(t),w()},et=t=>{J(t)},C=t=>{U(t)},nt=()=>{l({id:1,newText:"",indicatorDetermine:{},textAnnotation:[]}),w()},ot=t=>{l(n=>x(v({},n),{textAnnotation:n.textAnnotation.filter(c=>c.id!==t)}))},rt=(t,n)=>{var c,d;if(n===""||!t)return;const a=window.getSelection(),{anchorOffset:D=0,focusOffset:O=0,anchorNode:st,focusNode:at}=a||{};if(st===at){const S=Math.min(D,O),j=Math.max(D,O);let R;if((t==null?void 0:t.current)&&a){const N=(c=t.current)==null?void 0:c.getBoundingClientRect(),V=a.getRangeAt(0).getBoundingClientRect(),E=V.right-N.left,I=V.top-N.top;E&&I&&(R={left:E,top:I})}const T={id:At(8,62),start:S,end:j,text:n};if(typeof L=="function"){L(x(v({},T),{endPosition:R}));return}if(it(S,j,y,s==null?void 0:s.textAnnotation)||r)return;l(x(v({},s),{textAnnotation:[...(s==null?void 0:s.textAnnotation)||[],x(v({},T),{attribute:y})]})),(d=window.getSelection())==null||d.empty()}},it=(t,n,c,d)=>d==null?void 0:d.some(a=>(a==null?void 0:a.start)===t&&(a==null?void 0:a.end)===n&&(a==null?void 0:a.attribute)===c);return g.createElement("div",{className:K},g.createElement("div",{className:`${K}-question`},H===!0&&g.createElement(mt,{tips:$}),g.createElement(pt,{highlightKey:W,textData:X,NLPConfig:m,textAnnotation:Z,onSelectionChange:rt,extraLayer:q,extraData:F,customAnnotationData:Q})))},Ct=o=>({annotation:o.annotation});var Dt=ut(Ct,null,null,{context:lt})(yt);export{Dt as default};
1
+ import g,{useContext as lt,useState as f,useMemo as k,useEffect as P}from"react";import{connect as dt}from"react-redux";import{LabelBeeContext as ft,NLPContext as pt}from"../../store/ctx.js";import{prefix as mt}from"../../constant/index.js";import gt from"./textContent/index.js";import vt from"../../views/MainView/annotationTips/index.js";import{getStepConfig as xt}from"../../store/annotation/reducer.js";import{jsonParser as bt}from"../../utils/index.js";import{getCurrentResultFromResultList as At}from"../LLMToolView/utils/data.js";import{useCustomToolInstance as _t}from"../../hooks/annotation.js";import{uuid as ht}from"@labelbee/lb-annotation";var wt=Object.defineProperty,Pt=Object.defineProperties,Lt=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,yt=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable,K=(o,e,r)=>e in o?wt(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,v=(o,e)=>{for(var r in e||(e={}))yt.call(e,r)&&K(o,r,e[r]);if(B)for(var r of B(e))Ct.call(e,r)&&K(o,r,e[r]);return o},x=(o,e)=>Pt(o,Lt(e));const $=`${mt}-NLPView`,Dt=o=>{const{annotation:e,checkMode:r,tips:H,showTips:q,extraLayer:F,extraData:Q,onChangeAnnotation:L,customAnnotationData:W}=o,{imgIndex:u,imgList:p,stepList:b,step:A}=e,{highlightKey:z,setHighlightKey:G}=lt(pt),{toolInstanceRef:i}=_t(),[y,J]=f(""),[_,U]=f([]),[h,X]=f(void 0),[Y,Z]=f([{content:""}]),[s,l]=f({id:1,newText:"",indicatorDetermine:{},textAnnotation:[]}),tt=k(()=>(s==null?void 0:s.textAnnotation)?(h&&(s.textAnnotation=h),s.textAnnotation.filter(t=>_.length===0||_.includes(t.attribute))):[],[s,_,h]),m=k(()=>{var t;if(b&&A){const n=(t=xt(b,A))==null?void 0:t.config;return bt(n)}},[b,A]);P(()=>{var t;if(!p[u])return;const n=(t=p[u])==null?void 0:t.textData;Z(n),(m==null?void 0:m.attributeConfigurable)||C([])},[u,m]),P(()=>{var t;if(!p[u])return;const n=(t=p[u])!=null?t:{},c=At(n==null?void 0:n.result);l(c)},[u]),P(()=>{i.current.exportData=()=>[[s],{}],i.current.setResult=()=>{},i.current.updateResult=t=>{l(t)},i.current.clearResult=ot,i.current.setDefaultAttribute=et,i.current.setHighlightKey=G,i.current.deleteTextAnnotation=rt,i.current.setAttributeLockList=nt,i.current.setVisibleResult=C,w()},[s]);const w=()=>{i.current.emit("changeAttributeSidebar"),i.current.emit("changeIndicatorDetermine")},et=t=>{i.current.defaultAttribute=t,J(t),w()},nt=t=>{U(t)},C=t=>{X(t)},ot=()=>{l({id:1,newText:"",indicatorDetermine:{},textAnnotation:[]}),w()},rt=t=>{l(n=>x(v({},n),{textAnnotation:n.textAnnotation.filter(c=>c.id!==t)}))},it=(t,n)=>{var c,d;if(n===""||!t)return;const a=window.getSelection(),{anchorOffset:D=0,focusOffset:O=0,anchorNode:at,focusNode:ct}=a||{};if(at===ct){const S=Math.min(D,O),j=Math.max(D,O);let N;if((t==null?void 0:t.current)&&a){const V=(c=t.current)==null?void 0:c.getBoundingClientRect(),E=a.getRangeAt(0).getBoundingClientRect(),I=E.right-V.left,M=E.top-V.top;I&&M&&(N={left:I,top:M})}const R={id:ht(8,62),start:S,end:j,text:n};if(typeof L=="function"){L(x(v({},R),{endPosition:N}));return}if(st(S,j,y,s==null?void 0:s.textAnnotation)||r)return;const T=(s==null?void 0:s.textAnnotation)||[];T.push(x(v({},R),{attribute:y}));const ut=x(v({},s),{textAnnotation:T});l(ut),(d=window.getSelection())==null||d.empty()}},st=(t,n,c,d)=>d==null?void 0:d.some(a=>(a==null?void 0:a.start)===t&&(a==null?void 0:a.end)===n&&(a==null?void 0:a.attribute)===c);return g.createElement("div",{className:$,id:"NLPView"},g.createElement("div",{className:`${$}-question`},q===!0&&g.createElement(vt,{tips:H}),g.createElement(gt,{highlightKey:z,textData:Y,NLPConfig:m,textAnnotation:tt,onSelectionChange:it,extraLayer:F,extraData:Q,customAnnotationData:W})))},Ot=o=>({annotation:o.annotation});var St=dt(Ot,null,null,{context:ft})(Dt);export{St as default};
@@ -1 +1 @@
1
- import s from"lodash";import r from"react";var u=({splitIntervals:d,extraData:t})=>r.createElement("div",{style:{position:"absolute",top:0,left:0,backgroundColor:"transparent",color:"transparent"}},d.map((o,n)=>{var l;const e=s.last(o.extraAnnotations);let i=`2px solid ${((l=o==null?void 0:o.extraAnnotations)==null?void 0:l.find(a=>(a==null?void 0:a.auditID)===(t==null?void 0:t.hoverAuditID)))?"#ffc60a":"#fcdf7e"}`;return(t==null?void 0:t.isShowRemark)||(i=""),e?r.createElement("span",{style:{borderBottom:i,padding:"2px 0px"},id:e==null?void 0:e.id,key:n},o.text):r.createElement("span",{key:n},o.text)}));export{u as default};
1
+ import s from"lodash";import r from"react";var u=({splitIntervals:a,extraData:t})=>r.createElement("div",{style:{position:"absolute",top:0,left:0,backgroundColor:"transparent",color:"transparent"}},a.map((o,n)=>{var l;const e=s.last(o.extraAnnotations);let i=`2px solid ${((l=o==null?void 0:o.extraAnnotations)==null?void 0:l.find(d=>(d==null?void 0:d.auditID)===(t==null?void 0:t.hoverAuditID)))?"#ff8609":"#fcdf7e"}`;return(t==null?void 0:t.isShowRemark)||(i=""),e?r.createElement("span",{style:{borderBottom:i,padding:"2px 0px"},id:e==null?void 0:e.id,key:n},o.text):r.createElement("span",{key:n},o.text)}));export{u as default};
@@ -1 +1 @@
1
- import i,{useRef as H,useState as k,useMemo as P,useEffect as h}from"react";import{I18nextProvider as K,useTranslation as Q}from"react-i18next";import{i18n as O,toolStyleConverter as U}from"@labelbee/lb-utils";import{prefix as W}from"../../../constant/index.js";import{useTextSelection as z}from"ahooks";import A from"lodash";import{CommonToolUtils as F}from"@labelbee/lb-annotation";import G from"../../../constant/styleString.js";import{getIntervals as L}from"../utils/index.js";import{classnames as J}from"../../../utils/index.js";import X from"./extraMask.js";var Y=Object.defineProperty,N=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,tt=Object.prototype.propertyIsEnumerable,T=(n,o,e)=>o in n?Y(n,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[o]=e,et=(n,o)=>{for(var e in o||(o={}))Z.call(o,e)&&T(n,e,o[e]);if(N)for(var e of N(o))tt.call(o,e)&&T(n,e,o[e]);return n};const w=`${W}-NLPView`,nt=({extraLayer:n,extraStyle:o,setExtraStyle:e,setExtraResut:u,extraResut:d})=>{if(typeof n=="function"&&e&&u)return n({style:o,onClose:()=>{var m;e(void 0),u(void 0),(m=window.getSelection())==null||m.empty()},submitData:d})},ot=n=>{const{highlightKey:o,textData:e,lang:u,NLPConfig:d,onSelectionChange:m,textAnnotation:E,extraData:s,customAnnotationData:C}=n,{displayRemarkList:f=[]}=s||{},{t:B}=Q(),v=H(null),S=z(v),[p,D]=k(),[M,b]=k(void 0),g=P(()=>{var t;return(t=e==null?void 0:e[0])==null?void 0:t.content},[e]),V=P(()=>{const t=A.clone(f);return(p==null?void 0:p.start)&&t.push(p),L(g,t!=null?t:[],"extraAnnotations")},[f,p,g]),$=P(()=>L(g,E!=null?E:[],"annotations"),[E,g]);h(()=>{if(C){const{id:t,start:l,end:c,text:a,endPosition:r}=C;D({id:t,start:l,end:c,text:a}),b(r)}},[C]);const R=(t="")=>{if(d==null?void 0:d.attributeConfigurable){const l=F.jsonParser(G);return U.getColorByConfig({attribute:t,config:d,style:l})}};return h(()=>{var t;u&&((t=O)==null||t.changeLanguage(u))},[]),h(()=>{m==null||m(v,S.text)},[S.text]),h(()=>{var t;if(!(s==null?void 0:s.editAuditID))return;const l=f.filter(r=>(r==null?void 0:r.auditID)===s.editAuditID)[0],c=(t=l==null?void 0:l.id)!=null?t:"",a=document.getElementById(c);if(a&&v.current){const r=a.getBoundingClientRect(),x=v.current.getBoundingClientRect(),y=r.right-x.left,_=r.bottom-x.top-a.offsetHeight;y&&_&&b&&b({left:y,top:_})}},[s==null?void 0:s.editAuditID]),i.createElement("div",null,i.createElement("div",{className:`${w}-question-title`},B("textTool")),i.createElement("div",{className:J({[`${w}-question-content`]:!0}),style:{position:"relative"},onDoubleClick:t=>{t.preventDefault()}},i.createElement("div",{style:{position:"relative"}},$.map((t,l)=>{var c,a,r,x;const y=A.last(t.annotations);if(y){let _=R(y.attribute);const j=(c=t==null?void 0:t.annotations)==null?void 0:c.find(I=>I.id===o);if(j){const I=(x=(r=(a=t==null?void 0:t.annotations)==null?void 0:a.filter(q=>q.id===o))==null?void 0:r[0])==null?void 0:x.attribute;_=R(I)}return i.createElement("span",{style:{backgroundColor:_.valid.stroke,color:j?"white":void 0,padding:"2px 0px"},key:l},t.text)}else return i.createElement("span",{key:l},t.text)}),(f==null?void 0:f.length)>0&&i.createElement(X,{splitIntervals:V,extraData:s}),nt({extraLayer:n==null?void 0:n.extraLayer,setExtraStyle:b,extraStyle:M,extraResut:p,setExtraResut:D}),i.createElement("div",{className:`${w}-question-content-mask`,ref:v},g))))},rt=n=>i.createElement(K,{i18n:O},i.createElement(ot,et({},n)));export{rt as default};
1
+ import r,{useRef as K,useState as k,useMemo as P,useEffect as E}from"react";import{I18nextProvider as Q,useTranslation as U}from"react-i18next";import{i18n as L,toolStyleConverter as W}from"@labelbee/lb-utils";import{prefix as z}from"../../../constant/index.js";import{useTextSelection as F}from"ahooks";import N from"lodash";import{CommonToolUtils as G}from"@labelbee/lb-annotation";import H from"../../../constant/styleString.js";import{getIntervals as O}from"../utils/index.js";import{classnames as J}from"../../../utils/index.js";import X from"./extraMask.js";var Y=Object.defineProperty,T=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,tt=Object.prototype.propertyIsEnumerable,A=(n,o,e)=>o in n?Y(n,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[o]=e,et=(n,o)=>{for(var e in o||(o={}))Z.call(o,e)&&A(n,e,o[e]);if(T)for(var e of T(o))tt.call(o,e)&&A(n,e,o[e]);return n};const S=`${z}-NLPView`,nt=({extraLayer:n,extraStyle:o,setExtraStyle:e,setExtraResut:m,extraResut:f})=>{if(typeof n=="function"&&e&&m)return n({style:o,onClose:()=>{var p;e(void 0),m(void 0),(p=window.getSelection())==null||p.empty()},submitData:f})},ot=n=>{const{highlightKey:o,textData:e,lang:m,NLPConfig:f,onSelectionChange:p,textAnnotation:C,extraData:a,customAnnotationData:w}=n,{displayRemarkList:v=[]}=a||{},{t:B}=U(),g=K(null),D=F(g),[x,R]=k(),[V,b]=k(void 0),y=P(()=>{var t;return(t=e==null?void 0:e[0])==null?void 0:t.content},[e]),M=P(()=>{const t=N.clone(v);return(x==null?void 0:x.start)&&t.push(x),O(y,t!=null?t:[],"extraAnnotations")},[v,x,y]),$=P(()=>O(y,C!=null?C:[],"annotations"),[C,y]);E(()=>{if(w){const{id:t,start:i,end:s,text:u,endPosition:l}=w;R({id:t,start:i,end:s,text:u}),b(l)}},[w]);const j=(t="")=>{if(f==null?void 0:f.attributeConfigurable){const i=G.jsonParser(H);return W.getColorByConfig({attribute:t,config:f,style:i})}};return E(()=>{var t;m&&((t=L)==null||t.changeLanguage(m))},[]),E(()=>{p==null||p(g,D.text)},[D.text]),E(()=>{var t;if(!(a==null?void 0:a.editAuditID))return;const i=document.getElementById("NLPView"),s=v.filter(c=>(c==null?void 0:c.auditID)===a.editAuditID)[0],u=(t=s==null?void 0:s.id)!=null?t:"",l=document.getElementById(u);if(l&&g.current){const c=l.getBoundingClientRect(),h=g.current.getBoundingClientRect(),_=c.right-h.left,d=l.offsetTop;_&&d&&b&&(i&&i.scrollTo({top:d,behavior:"auto"}),b({left:_,top:d}))}},[a==null?void 0:a.editAuditID]),r.createElement("div",null,r.createElement("div",{className:`${S}-question-title`},B("textTool")),r.createElement("div",{className:J({[`${S}-question-content`]:!0}),style:{position:"relative",whiteSpace:"pre-wrap"},onDoubleClick:t=>{t.preventDefault()}},r.createElement("div",{style:{position:"relative"}},$.map((t,i)=>{var s,u,l,c;const h=N.last(t.annotations);if(h){let _=j(h.attribute);const d=(s=t==null?void 0:t.annotations)==null?void 0:s.find(I=>I.id===o);if(d){const I=(c=(l=(u=t==null?void 0:t.annotations)==null?void 0:u.filter(q=>q.id===o))==null?void 0:l[0])==null?void 0:c.attribute;_=j(I)}return r.createElement("span",{style:{backgroundColor:_.valid.stroke,color:d?"white":void 0,padding:"2px 0px"},key:i},t.text)}else return r.createElement("span",{key:i},t.text)}),(v==null?void 0:v.length)>0&&r.createElement(X,{splitIntervals:M,extraData:a}),nt({extraLayer:n==null?void 0:n.extraLayer,setExtraStyle:b,extraStyle:V,extraResut:x,setExtraResut:R}),r.createElement("div",{className:`${S}-question-content-mask`,ref:g},y))))},rt=n=>r.createElement(Q,{i18n:L},r.createElement(ot,et({},n)));export{rt as default};
@@ -1 +1 @@
1
- import c,{useState as I,useEffect as D}from"react";import{connect as j}from"react-redux";import h from"../../../../utils/StepUtils.js";import{useTranslation as R}from"react-i18next";import{LabelBeeContext as S}from"../../../../store/ctx.js";import{jsonParser as E}from"../../../../utils/index.js";import V from"../../../../components/LLMToolView/sidebar/components/determineGroup/index.js";import{getCurrentResultFromResultList as C}from"../../../../components/LLMToolView/utils/data.js";var T=Object.defineProperty,A=Object.defineProperties,B=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable,P=(t,e,n)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_=(t,e)=>{for(var n in e||(e={}))G.call(e,n)&&P(t,n,e[n]);if(y)for(var n of y(e))H.call(e,n)&&P(t,n,e[n]);return t},M=(t,e)=>A(t,B(e));const U=t=>{const{toolInstance:e,stepInfo:n,disabeledAll:u,imgIndex:p,imgList:d}=t,[g]=e.exportData(),[a,x]=I(g==null?void 0:g[0]),{t:L}=R(),[F,O]=I(0);D(()=>{var o;if(!d[p])return;const r=(o=d[p])!=null?o:{},i=C((r==null?void 0:r.result)||"");x(i)},[p,d]),D(()=>(e&&e.on("changeIndicatorDetermine",o=>{const[r]=e.exportData();x(r==null?void 0:r[0]),O(i=>i+1)}),()=>{e==null||e.unbindAll("changeIndicatorDetermine")}),[e]);const b=E(n.config),{indicatorDetermine:m}=b,w=o=>{var r;const{value:i,key:l}=o;if(l){const f={[l]:i},s=(r=a==null?void 0:a.indicatorDetermine)!=null?r:{},v=M(_({},a),{indicatorDetermine:_(_({},s),f)});e.updateResult(v)}};if((m==null?void 0:m.length)>0){const o=m.filter(r=>r==null?void 0:r.label);return c.createElement("div",{style:{padding:"12px",marginBottom:"12px"}},c.createElement("div",{style:{fontSize:"16px",fontWeight:500,lineHeight:"46px"}},L("IndicatorJudgment")),c.createElement("div",{style:{maxHeight:"400px",overflow:"auto"}},o.map((r,i)=>{var l;const{label:f,value:s}=r;return c.createElement(V,{selectValue:(l=a==null?void 0:a.indicatorDetermine)==null?void 0:l[s],title:f,updateValue:v=>{w({key:s,value:v})},key:i,disabeledAll:u})})))}return null},k=t=>{var e,n;const u=h.getCurrentStepInfo((e=t.annotation)==null?void 0:e.step,(n=t.annotation)==null?void 0:n.stepList);return{toolInstance:t.annotation.toolInstance,stepInfo:u,imgIndex:t.annotation.imgIndex,imgList:t.annotation.imgList}};var z=j(k,null,null,{context:S})(U);export{z as default};
1
+ import s,{useState as I,useEffect as D}from"react";import{connect as j}from"react-redux";import h from"../../../../utils/StepUtils.js";import{useTranslation as E}from"react-i18next";import{LabelBeeContext as R}from"../../../../store/ctx.js";import{jsonParser as S}from"../../../../utils/index.js";import V from"../../../../components/LLMToolView/sidebar/components/determineGroup/index.js";import{getCurrentResultFromResultList as C}from"../../../../components/LLMToolView/utils/data.js";var T=Object.defineProperty,A=Object.defineProperties,B=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable,P=(t,e,n)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,g=(t,e)=>{for(var n in e||(e={}))G.call(e,n)&&P(t,n,e[n]);if(y)for(var n of y(e))H.call(e,n)&&P(t,n,e[n]);return t},M=(t,e)=>A(t,B(e));const U=t=>{const{toolInstance:e,stepInfo:n,disabeledAll:u,imgIndex:d,imgList:p}=t,[_]=e.exportData(),[l,x]=I(_==null?void 0:_[0]),{t:L}=E(),[F,O]=I(0);D(()=>{var o;if(!p[d])return;const r=(o=p[d])!=null?o:{},i=C((r==null?void 0:r.result)||"");x(i)},[d,p]),D(()=>(e&&e.on("changeIndicatorDetermine",o=>{const[r]=e.exportData();x(r==null?void 0:r[0]),O(i=>i+1)}),()=>{e==null||e.unbindAll("changeIndicatorDetermine")}),[e]);const b=S(n.config),{indicatorDetermine:m}=b,w=o=>{var r;const{value:i,key:a}=o;if(a){const f={[a]:i},c=(r=l==null?void 0:l.indicatorDetermine)!=null?r:{},v=M(g({},l),{indicatorDetermine:g(g({},c),f)});e.updateResult(v)}};if((m==null?void 0:m.length)>0){const o=m.filter(r=>r==null?void 0:r.label);return s.createElement("div",{style:{padding:"12px",marginBottom:"12px"}},(o==null?void 0:o.length)>0&&s.createElement("div",null,s.createElement("div",{style:{fontSize:"16px",fontWeight:500,lineHeight:"46px"}},L("IndicatorJudgment")),s.createElement("div",{style:{maxHeight:"400px",overflow:"auto"}},o.map((r,i)=>{var a;const{label:f,value:c}=r;return s.createElement(V,{selectValue:(a=l==null?void 0:l.indicatorDetermine)==null?void 0:a[c],title:f,updateValue:v=>{w({key:c,value:v})},key:i,disabeledAll:u})}))))}return null},k=t=>{var e,n;const u=h.getCurrentStepInfo((e=t.annotation)==null?void 0:e.step,(n=t.annotation)==null?void 0:n.stepList);return{toolInstance:t.annotation.toolInstance,stepInfo:u,imgIndex:t.annotation.imgIndex,imgList:t.annotation.imgList}};var z=j(k,null,null,{context:R})(U);export{z as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.23.0-alpha.2",
3
+ "version": "1.23.0-alpha.4",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@ant-design/icons": "^4.6.2",
46
- "@labelbee/lb-annotation": "1.27.0-alpha.2",
46
+ "@labelbee/lb-annotation": "1.27.0-alpha.3",
47
47
  "@labelbee/lb-utils": "1.19.0-alpha.1",
48
48
  "@labelbee/wavesurfer": "1.0.0",
49
49
  "@types/react-dom": "^18.2.7",