@labelbee/lb-components 1.23.0-alpha.122 → 1.23.0-alpha.124

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.
Files changed (23) hide show
  1. package/dist/_virtual/2DViewWorker.js +1 -1
  2. package/dist/components/LLMMultiWheelView/dialogView/index.js +1 -1
  3. package/dist/components/LLMMultiWheelView/index.js +1 -1
  4. package/dist/components/LLMMultiWheelView/sidebar/index.js +1 -1
  5. package/dist/components/LLMToolView/sidebar/components/answerSort/index.js +1 -1
  6. package/dist/components/LLMToolView/sidebar/components/modelAnswerSort/index.js +1 -1
  7. package/dist/store/LLMMultiWheel/index.js +1 -1
  8. package/dist/types/components/LLMMultiWheelView/types.d.ts +62 -0
  9. package/dist/types/components/LLMToolView/sidebar/components/modelAnswerSort/index.d.ts +15 -5
  10. package/dist/types/components/LLMToolView/types.d.ts +3 -2
  11. package/dist/types/components/LLMToolView/utils/data.d.ts +1 -0
  12. package/dist/types/store/LLMMultiWheel/index.d.ts +5 -6
  13. package/es/_virtual/2DViewWorker.js +1 -1
  14. package/es/components/LLMMultiWheelView/dialogView/index.js +1 -1
  15. package/es/components/LLMMultiWheelView/index.js +1 -1
  16. package/es/components/LLMMultiWheelView/sidebar/index.js +1 -1
  17. package/es/components/LLMToolView/sidebar/components/answerSort/index.js +1 -1
  18. package/es/components/LLMToolView/sidebar/components/modelAnswerSort/index.js +1 -1
  19. package/es/store/LLMMultiWheel/index.js +1 -1
  20. package/package.json +1 -1
  21. package/dist/components/LLMToolView/sidebar/components/modelSort/index.js +0 -1
  22. package/dist/types/components/LLMToolView/sidebar/components/modelSort/index.d.ts +0 -16
  23. package/es/components/LLMToolView/sidebar/components/modelSort/index.js +0 -1
@@ -1 +1 @@
1
- import{getTextControlByConfig as v,RenderAnswer as N}from"../../LLMToolView/questionView/index.js";import{RenderQuestion as V}from"../../LLMToolView/questionView/components/header/index.js";import x from"../../LLMToolView/questionView/components/imgView/index.js";import y from"../../../store/LLMMultiWheel/index.js";import{classnames as I}from"../../../utils/index.js";import{Button as i}from"antd";import e from"react";const M=m=>{const{id:t,answerList:s,question:l,index:c,name:d="",answerIsImg:u,questionIsImg:E,LLMConfig:p}=m,{dataFormatType:n,selectedID:w,setSelectedID:L}=y(),a=c+1,g=d||`\u5BF9\u8BDD${a}`;return e.createElement("div",{key:t,onClick:()=>L(t),className:I({dialog:!0,selected:t===w})},e.createElement("div",{className:"header"},e.createElement("span",{className:"order"},a),e.createElement("div",{className:"name"},e.createElement("div",{className:"show-name"},g),e.createElement("div",{className:"tips"},"\uFF08\u9009\u4E2D\u6807\u6CE8\uFF09"))),e.createElement("div",{className:"dialog-question"},e.createElement(i,{type:"primary"},"\u9898\u76EE",a),e.createElement("div",null,e.createElement(V,{question:l,dataFormatType:n,isImg:E}))),e.createElement("div",{className:"dialog-answer"},s.map((o,r)=>{const f=v(o,p);return e.createElement("div",{key:r},e.createElement(i,{type:"primary"},"\u7B54\u6848",r+1),u?e.createElement(x,{answerList:s}):e.createElement(N,{i:o,isTextControl:f,dataFormatType:n}))})))};export{M as default};
1
+ import{getTextControlByConfig as P,RenderAnswer as I}from"../../LLMToolView/questionView/index.js";import{RenderQuestion as N}from"../../LLMToolView/questionView/components/header/index.js";import V from"../../LLMToolView/questionView/components/imgView/index.js";import j from"../../../store/LLMMultiWheel/index.js";import{classnames as h}from"../../../utils/index.js";import{Button as l}from"antd";import t from"react";var x=Object.defineProperty,D=Object.defineProperties,M=Object.getOwnPropertyDescriptors,c=Object.getOwnPropertySymbols,q=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,d=(o,e,r)=>e in o?x(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,F=(o,e)=>{for(var r in e||(e={}))q.call(e,r)&&d(o,r,e[r]);if(c)for(var r of c(e))C.call(e,r)&&d(o,r,e[r]);return o},T=(o,e)=>D(o,M(e));const B=o=>{const{id:e,answerList:r,question:p,index:u,name:f="",answerIsImg:w,questionIsImg:E,LLMConfig:_}=o,{dataFormatType:s,selectedID:v,setSelectedID:g}=j(),a=u+1,y=f||`\u5BF9\u8BDD${a}`;return t.createElement("div",{key:e,onClick:()=>g(e),className:h({dialog:!0,selected:e===v})},t.createElement("div",{className:"header"},t.createElement("span",{className:"order"},a),t.createElement("div",{className:"name"},t.createElement("div",{className:"show-name"},y),t.createElement("div",{className:"tips"},"\uFF08\u9009\u4E2D\u6807\u6CE8\uFF09"))),t.createElement("div",{className:"dialog-question"},t.createElement(l,{type:"primary"},"\u9898\u76EE",a),t.createElement("div",null,t.createElement(N,{question:p,dataFormatType:s,isImg:E}))),t.createElement("div",{className:"dialog-answer"},r.map((L,n)=>{const i=n+1,m=T(F({},L),{order:i}),O=P(m,_);return t.createElement("div",{key:n},t.createElement(l,{type:"primary"},"\u7B54\u6848",i),w?t.createElement(V,{answerList:r}):t.createElement(I,{i:m,isTextControl:O,dataFormatType:s}))})))};export{B as default};
@@ -1 +1 @@
1
- import r,{useState as g,useEffect as M}from"react";import{ELLMDataType as y}from"../../constant/index.js";import{getStepConfig as W}from"../../store/annotation/reducer.js";import{LabelBeeContext as q}from"../../store/ctx.js";import{jsonParser as N}from"../../utils/index.js";import{connect as A}from"react-redux";import x from"../../store/LLMMultiWheel/index.js";import{LLMMultiWheelViewCls as j}from"../../views/MainView/LLMMultiWheelLayout/index.js";import{ToggleDataFormatType as F}from"../LLMToolView/questionView/components/header/index.js";import $ from"./dialogView/index.js";import k from"../messageMaskLayer/index.js";import R from"../../views/MainView/annotationTips/index.js";import{useTranslation as U}from"react-i18next";import{LLMViewCls as B}from"../LLMToolView/questionView/index.js";import{Layout as Q}from"antd";var z=Object.defineProperty,G=Object.defineProperties,H=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,J=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,I=(t,e,o)=>e in t?z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,X=(t,e)=>{for(var o in e||(e={}))J.call(e,o)&&I(t,o,e[o]);if(P)for(var o of P(e))K.call(e,o)&&I(t,o,e[o]);return t},Y=(t,e)=>G(t,H(e));const T=t=>{const{questionIsImg:e,answerIsImg:o,LLMConfig:u,dialogList:m}=t,{dataFormatType:f,setDataFormatType:c}=x();return r.createElement("div",{className:`${j}`},r.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},r.createElement(F,{dataFormatType:f,setDataFormatType:c})),r.createElement("div",{className:`${j}-container`},m==null?void 0:m.map((a,s)=>r.createElement($,Y(X({},a),{key:s,index:s,questionIsImg:e,answerIsImg:o,LLMConfig:u})))))},Z=t=>{var e,o;const{annotation:u,tips:m,showTips:f,drawLayerSlot:c}=t,{imgIndex:a,imgList:s,stepList:L,step:v,toolInstance:i}=u,[l,V]=g(),{setSelectedID:E}=x(),[h,O]=g([]),S=((e=l==null?void 0:l.dataType)==null?void 0:e.prompt)===y.Picture,C=((o=l==null?void 0:l.dataType)==null?void 0:o.response)===y.Picture,{t:D}=U(),[,b]=g(0);return M(()=>{var n,p,w;if(!s[a])return;const _=(n=s[a])!=null?n:{},d=(w=(p=_==null?void 0:_.questionList)==null?void 0:p.textList)!=null?w:[];O(d),(d==null?void 0:d.length)&&E(d[0].id)},[a]),M(()=>{var n;if(L&&v){const p=(n=W(L,v))==null?void 0:n.config;V(N(p))}},[L,v]),M(()=>{if(i)return i.on("validUpdated",()=>{b(n=>n+1)}),()=>{i.unbindAll("validUpdated")}},[i]),r.createElement(Q,{className:B},!(i==null?void 0:i.valid)&&r.createElement(k,{message:D("InvalidQuestionAndSkip")}),c==null?void 0:c({}),f===!0&&r.createElement(R,{tips:m}),r.createElement(T,{questionIsImg:S,answerIsImg:C,LLMConfig:l,dialogList:h}))},ee=t=>({annotation:t.annotation});var te=A(ee,null,null,{context:q})(Z);export{T as LLMMultiWheelSourceView,te as default};
1
+ import i,{useState as M,useEffect as f}from"react";import{ELLMDataType as E}from"../../constant/index.js";import{getStepConfig as k}from"../../store/annotation/reducer.js";import{LabelBeeContext as R}from"../../store/ctx.js";import{jsonParser as U}from"../../utils/index.js";import{connect as B}from"react-redux";import h from"../../store/LLMMultiWheel/index.js";import{LLMMultiWheelViewCls as O}from"../../views/MainView/LLMMultiWheelLayout/index.js";import{ToggleDataFormatType as Q}from"../LLMToolView/questionView/components/header/index.js";import z from"./dialogView/index.js";import G from"../messageMaskLayer/index.js";import H from"../../views/MainView/annotationTips/index.js";import{useTranslation as J}from"react-i18next";import{LLMViewCls as K}from"../LLMToolView/questionView/index.js";import{Layout as X}from"antd";var Y=Object.defineProperty,Z=Object.defineProperties,ee=Object.getOwnPropertyDescriptors,S=Object.getOwnPropertySymbols,te=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable,D=(t,e,o)=>e in t?Y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,y=(t,e)=>{for(var o in e||(e={}))te.call(e,o)&&D(t,o,e[o]);if(S)for(var o of S(e))oe.call(e,o)&&D(t,o,e[o]);return t},x=(t,e)=>Z(t,ee(e));const b=t=>{const{questionIsImg:e,answerIsImg:o,LLMConfig:v,dialogList:m}=t,{dataFormatType:g,setDataFormatType:L}=h();return i.createElement("div",{className:`${O}`},i.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},i.createElement(Q,{dataFormatType:g,setDataFormatType:L})),i.createElement("div",{className:`${O}-container`},m==null?void 0:m.map((u,d)=>i.createElement(z,x(y({},u),{key:d,index:d,questionIsImg:e,answerIsImg:o,LLMConfig:v})))))},ne=t=>{var e,o;const{annotation:v,tips:m,showTips:g,drawLayerSlot:L}=t,{imgIndex:u,imgList:d,stepList:w,step:_,toolInstance:l}=v,[p,C]=M(),{setSelectedID:W,newAnswerListMap:j}=h(),[P,I]=M([]),q=((e=p==null?void 0:p.dataType)==null?void 0:e.prompt)===E.Picture,A=((o=p==null?void 0:p.dataType)==null?void 0:o.response)===E.Picture,{t:$}=J(),[,N]=M(0);return f(()=>{var r,n,c;if(!d[u])return;const a=(r=d[u])!=null?r:{},s=(c=(n=a==null?void 0:a.questionList)==null?void 0:n.textList)!=null?c:[];I(s),(s==null?void 0:s.length)&&W(s[0].id)},[u]),f(()=>{const r=P.map(n=>{var c;return x(y({},n),{answerList:(c=n==null?void 0:n.answerList)==null?void 0:c.map(a=>{var s,T,V;const F=`${(s=n==null?void 0:n.id)!=null?s:""}-${(T=a==null?void 0:a.id)!=null?T:""}`;return x(y({},a),{newAnswer:(V=j[F])!=null?V:a.answer})})})});I(r)},[j]),f(()=>{var r;if(w&&_){const n=(r=k(w,_))==null?void 0:r.config;C(U(n))}},[w,_]),f(()=>{if(l)return l.on("validUpdated",()=>{N(r=>r+1)}),()=>{l.unbindAll("validUpdated")}},[l]),i.createElement(X,{className:K},!(l==null?void 0:l.valid)&&i.createElement(G,{message:$("InvalidQuestionAndSkip")}),L==null?void 0:L({}),g===!0&&i.createElement(H,{tips:m}),i.createElement(b,{questionIsImg:q,answerIsImg:A,LLMConfig:p,dialogList:P}))},re=t=>({annotation:t.annotation});var ie=B(re,null,null,{context:R})(ne);export{b as LLMMultiWheelSourceView,ie as default};
@@ -1 +1 @@
1
- import n,{useState as I,useMemo as O,useEffect as A}from"react";import{LabelBeeContext as ct}from"../../../store/ctx.js";import{connect as mt}from"react-redux";import{prefix as pt}from"../../../constant/index.js";import{getStepConfig as ft}from"../../../store/annotation/reducer.js";import{jsonParser as K}from"../../../utils/index.js";import vt from"../../LLMToolView/sidebar/components/modelSort/index.js";import Lt from"../../LLMToolView/sidebar/components/modelAnswerSort/index.js";import{useTranslation as xt}from"react-i18next";import{useCustomToolInstance as gt}from"../../../hooks/annotation.js";import{isBoolean as wt,isString as _t,isNumber as Et,isObject as yt,isArray as bt}from"lodash";import{PageForward as C}from"../../../store/annotation/actionCreators.js";import{cKeyCode as Mt,EToolName as St}from"@labelbee/lb-annotation";import{getLLMIsNoConfig as At,EmptyConfig as Ct}from"../../LLMToolView/sidebar/index.js";import ht from"../../LLMToolView/sidebar/components/textInputBox/index.js";import{Button as z}from"antd";import jt from"../../LLMToolView/sidebar/components/answerList/index.js";import Tt from"../../../store/LLMMultiWheel/index.js";import Pt from"../../../utils/StepUtils.js";import{getCurrentResultFromResultList as Dt,getRenderDataByResult as It}from"../../LLMToolView/utils/data.js";import{useMemoizedFn as U}from"ahooks";var Ot=Object.defineProperty,Rt=Object.defineProperties,Vt=Object.getOwnPropertyDescriptors,Q=Object.getOwnPropertySymbols,Nt=Object.prototype.hasOwnProperty,Bt=Object.prototype.propertyIsEnumerable,G=(l,o,a)=>o in l?Ot(l,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[o]=a,c=(l,o)=>{for(var a in o||(o={}))Nt.call(o,a)&&G(l,a,o[a]);if(Q)for(var a of Q(o))Bt.call(o,a)&&G(l,a,o[a]);return l},m=(l,o)=>Rt(l,Vt(o));const Wt=Mt.default,J=`${pt}-sidebar`,$t=l=>{var o,a;const{annotation:H,dispatch:g,checkMode:X}=l,{imgIndex:w,imgList:h,stepList:_,step:E,skipBeforePageTurning:y}=H,[d,Y]=I(),{t:b}=xt(),i=(o=h[w])!=null?o:{},R=K(i==null?void 0:i.result),{toolInstanceRef:f}=gt({basicInfo:R}),[j,Z]=I(!0),[M,V]=I({}),{selectedID:T}=Tt(),x=O(()=>M[T],[T,M]),P=!f.current.valid||X;A(()=>{var t;if(_&&E){const e=(t=ft(_,E))==null?void 0:t.config;Y(K(e))}},[E,JSON.stringify(_)]),A(()=>{!i||w===-1||(f.current.setValid=N,f.current.clearResult=tt,N(),B())},[w,d,i==null?void 0:i.id]);const tt=()=>{var t;B((t=i==null?void 0:i.questionList)==null?void 0:t.textList)},N=t=>{var e;const s=t!=null?t:R.valid;wt(s)&&(Z(s),f.current.valid=s,(e=f.current)==null||e.emit("validUpdated"))},B=t=>{var e,s;const p=Pt.getCurrentStepInfo(E,_),u=Dt(i==null?void 0:i.result,p.step);let r=(e=i==null?void 0:i.questionList)==null?void 0:e.textList;((s=u==null?void 0:u.modelData)==null?void 0:s.length)&&f.current.valid&&(r=u==null?void 0:u.modelData),t&&(r=t,u.sort=[]);let v={};r==null||r.forEach((L,D)=>{var q;const at=It(d,m(c({},L),{answerList:(q=L==null?void 0:L.answerList)==null?void 0:q.map((dt,ut)=>m(c({},dt),{order:`${ut+1}`}))}));v[L.id]=m(c({},at),{order:`${D+1}`,id:L.id})}),V(v)};A(()=>{et()},[M,j]),A(()=>(window.addEventListener("keydown",W),()=>{window.removeEventListener("keydown",W)}),[]);const et=U(()=>{var t,e;const p={modelData:(e=(t=i==null?void 0:i.questionList)==null?void 0:t.textList)==null?void 0:e.map(u=>{var r;const v=(r=M[u.id])!=null?r:{};return{id:u.id,answerList:v.answerList}})};f.current.exportData=()=>[[p],{valid:j}],f.current.currentPageResult=m(c({},p),{toolName:St.LLMMultiWheel,valid:j})}),W=t=>{if(t.ctrlKey&&t.keyCode===Wt.Enter){if(y){y(()=>g(C()));return}g(C())}},nt=U(({order:t,value:e,key:s})=>{const{answerList:p}=x,u=p==null?void 0:p.map(r=>{var v;if((r==null?void 0:r.order)===t){if(s==="textEdit"&&_t(e))return m(c({},r),{newAnswer:e});if(Et(e))return m(c({},r),{score:e});if(yt(e)&&s){const L={[e==null?void 0:e.key]:e.value},D=(v=r[s])!=null?v:{};return m(c({},r),{[s]:c(c({},D),L)})}}return r});V(r=>m(c({},r),{[T]:m(c({},x),{answerList:u})}))}),{indicatorScore:$=[],indicatorDetermine:F=[],isTextEdit:rt,dialogSort:S=!1,inputList:ot=[],tagInputListConfigurable:it}=d||{},k=O(()=>{var t,e,s;return S?(s=(e=(t=i==null?void 0:i.questionList)==null?void 0:t.textList)==null?void 0:e.map((p,u)=>m(c({},p),{title:`${u+1}`})))!=null?s:[]:[]},[i,S]);if(O(()=>At(d),[d]))return n.createElement(Ct,null);const st=it&&((a=ot.filter(t=>!t.isOverall))==null?void 0:a.length)>0,lt=(F==null?void 0:F.length)>0||($==null?void 0:$.length)>0||rt||st;return n.createElement("div",{className:`${J}`},n.createElement("div",{className:`${J}__content`},n.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},b("GlobalAnnotation")),S&&n.createElement(vt,{setSort:()=>{},modelList:S?k!=null?k:[]:[],title:b("SortConversationQuality"),prefixId:"model"}),(d==null?void 0:d.text)&&n.createElement("div",{style:{padding:"0px 16px",marginTop:"16px"}},n.createElement(ht,{textAttribute:[],textConfig:(d==null?void 0:d.text)&&bt(d.text)?d==null?void 0:d.text:[],setText:t=>{},disabeledAll:P})),n.createElement(Lt,{maxAnswerList:[{id:"A1",answer:"1"},{id:"A2",answer:"2"},{id:"A3",answer:"3"}],modelData:[{id:1,answerList:[{id:"A1",answer:"11"},{id:"A2",answer:"21"}]},{id:2,answerList:[{id:"A1",answer:"1"},{id:"A2",answer:"2"},{id:"A3",answer:"3"}]},{id:3,answerList:[{id:"A1",answer:"13"},{id:"A2",answer:"23"}]}]}),x&&n.createElement(n.Fragment,null,n.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},b("QualifiedAnnotation")),n.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"}},n.createElement(z,{type:"primary",danger:!0},"\u6B63\u5728\u6807\u6CE8"),n.createElement("div",{style:{padding:16}},"\u7EC4\uFF1A",x.order)),n.createElement("div",null,lt&&n.createElement(jt,{list:(x==null?void 0:x.answerList)||[],LLMConfig:d,updateValue:nt,disabeledAll:P})))),n.createElement("div",{style:{margin:"24px 16px",display:"flex"}},(h==null?void 0:h.length)-1!==w&&n.createElement(z,{type:"primary",style:{marginLeft:"auto"},onClick:()=>{if(y){y(()=>g(C()));return}g(C())},disabled:P},b("Save"))))},Ft=l=>({annotation:l.annotation});var kt=mt(Ft,null,null,{context:ct})($t);export{kt as default};
1
+ import l,{useState as E,useRef as ut,useMemo as G,useEffect as V}from"react";import{LabelBeeContext as Dt}from"../../../store/ctx.js";import{connect as It}from"react-redux";import{prefix as Ot}from"../../../constant/index.js";import{getStepConfig as Vt}from"../../../store/annotation/reducer.js";import{jsonParser as dt}from"../../../utils/index.js";import Nt,{getSorts as ct}from"../../LLMToolView/sidebar/components/modelAnswerSort/index.js";import{useTranslation as Bt}from"react-i18next";import{useCustomToolInstance as $t}from"../../../hooks/annotation.js";import{isBoolean as Wt,isString as Ft,isNumber as qt,isObject as kt,isArray as Gt}from"lodash";import{PageForward as N}from"../../../store/annotation/actionCreators.js";import{cKeyCode as Kt,EToolName as zt}from"@labelbee/lb-annotation";import{getLLMIsNoConfig as Ut,EmptyConfig as Qt}from"../../LLMToolView/sidebar/index.js";import Jt from"../../LLMToolView/sidebar/components/textInputBox/index.js";import{Button as pt}from"antd";import Ht from"../../LLMToolView/sidebar/components/answerList/index.js";import Xt from"../../../store/LLMMultiWheel/index.js";import Yt from"../../../utils/StepUtils.js";import{getCurrentResultFromResultList as Zt,getRenderDataByResult as te}from"../../LLMToolView/utils/data.js";import{useMemoizedFn as K}from"ahooks";import ee from"../../LLMToolView/sidebar/components/answerSort/index.js";var ne=Object.defineProperty,oe=Object.defineProperties,re=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,le=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable,ft=(c,s,p)=>s in c?ne(c,s,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[s]=p,i=(c,s)=>{for(var p in s||(s={}))le.call(s,p)&&ft(c,p,s[p]);if(mt)for(var p of mt(s))ie.call(s,p)&&ft(c,p,s[p]);return c},a=(c,s)=>oe(c,re(s));const se=Kt.default,vt=`${Ot}-sidebar`,ae={sort:[],answerSort:{},textAttribute:[]},ue=c=>{var s,p,z,U,Q,J,H;const{annotation:Lt,dispatch:y,checkMode:xt}=c,{imgIndex:M,imgList:B,stepList:C,step:A,skipBeforePageTurning:h}=Lt,[m,gt]=E(),{t:j}=Bt(),r=(s=B[M])!=null?s:{},X=dt(r==null?void 0:r.result),{toolInstanceRef:v}=$t({basicInfo:X}),[$,wt]=E(!0),[T,Y]=E({}),[R,Z]=E(ae),W=ut();ut();const[x,F]=E({}),{selectedID:P,setNewAnswerListMap:tt,newAnswerListMap:et}=Xt(),g=G(()=>T[P],[P,T]),S=!v.current.valid||xt;V(()=>{var t;if(C&&A){const e=(t=Vt(C,A))==null?void 0:t.config;gt(dt(e))}},[A,JSON.stringify(C)]),V(()=>{!r||M===-1||(v.current.setValid=nt,v.current.clearResult=_t,nt(),ot())},[M,m,r==null?void 0:r.id]);const _t=()=>{var t,e,n,u,f;ot((t=r==null?void 0:r.questionList)==null?void 0:t.textList),((e=W.current)==null?void 0:e.clearValue)&&((n=W.current)==null||n.clearValue());const{waitSorts:o}=ct({selectedSort:(f=(u=D())==null?void 0:u.sort)!=null?f:[],initSelected:[],modelList:I?O!=null?O:[]:[]});F(a(i({},x),{waitSorts:o,newSort:[]}))},nt=t=>{var e;const n=t!=null?t:X.valid;Wt(n)&&(wt(n),v.current.valid=n,(e=v.current)==null||e.emit("validUpdated"))},D=()=>{const t=Yt.getCurrentStepInfo(A,C);return Zt(r==null?void 0:r.result,t.step)},ot=K(t=>{var e,n,u,f,o,L,b;const d=D();let w=(e=r==null?void 0:r.questionList)==null?void 0:e.textList;((n=d==null?void 0:d.modelData)==null?void 0:n.length)&&v.current.valid&&(w=d==null?void 0:d.modelData),t&&(w=t,d.sort=[],d.textAttribute=[],d.answerSort=[]);let st={};w==null||w.forEach((_,Tt)=>{var at;const Rt=te(m,a(i({},_),{answerList:(at=_==null?void 0:_.answerList)==null?void 0:at.map((k,Pt)=>(tt(a(i({},et),{[`${_.id}-${k.id}`]:k.answer})),a(i({},k),{order:Pt+1})))}));st[_.id]=a(i({},Rt),{order:Tt+1,id:_.id})});const{waitSorts:ht,newSort:jt}=ct({selectedSort:(f=(u=D())==null?void 0:u.sort)!=null?f:[],modelList:I?O!=null?O:[]:[]});F({waitSorts:ht,newSort:jt}),Z({sort:(o=d==null?void 0:d.sort)!=null?o:[],textAttribute:(L=d==null?void 0:d.textAttribute)!=null?L:[],answerSort:(b=d==null?void 0:d.answerSort)!=null?b:[]}),Y(st)});V(()=>{St()},[T,$,R]),V(()=>(window.addEventListener("keydown",rt),()=>{window.removeEventListener("keydown",rt)}),[]);const St=K(()=>{var t,e;const n=(e=(t=r==null?void 0:r.questionList)==null?void 0:t.textList)==null?void 0:e.map(f=>{var o;const L=(o=T[f.id])!=null?o:{};return{id:f.id,answerList:L.answerList}}),u=a(i({},R),{modelData:n});v.current.exportData=()=>[[u],{valid:$}],v.current.currentPageResult=a(i({},u),{toolName:zt.LLMMultiWheel,valid:$})}),rt=t=>{if(t.ctrlKey&&t.keyCode===se.Enter){if(h){h(()=>y(N()));return}y(N())}},bt=K(({order:t,value:e,key:n})=>{const{answerList:u}=g,f=u==null?void 0:u.map(o=>{var L,b;if((o==null?void 0:o.order)===t){if(n==="textEdit"&&Ft(e))return tt(a(i({},et),{[`${P}-${(L=o==null?void 0:o.id)!=null?L:""}`]:e})),a(i({},o),{newAnswer:e});if(qt(e))return a(i({},o),{score:e});if(kt(e)&&n){const d={[e==null?void 0:e.key]:e.value},w=(b=o[n])!=null?b:{};return a(i({},o),{[n]:i(i({},w),d)})}}return o});Y(o=>a(i({},o),{[P]:a(i({},g),{answerList:f})}))}),q=(t,e)=>{Z(n=>a(i({},n),{[t]:e}))},{indicatorScore:lt=[],indicatorDetermine:it=[],isTextEdit:Et,dialogSort:I=!1,inputList:yt=[],tagInputListConfigurable:Mt}=m||{},O=G(()=>{var t,e,n;return I?(n=(e=(t=r==null?void 0:r.questionList)==null?void 0:t.textList)==null?void 0:e.map((u,f)=>a(i({},u),{title:f+1})))!=null?n:[]:[]},[r,I]);if(G(()=>Ut(m),[m]))return l.createElement(Qt,null);const Ct=Mt&&((p=yt.filter(t=>!t.isOverall))==null?void 0:p.length)>0,At=(it==null?void 0:it.length)>0||(lt==null?void 0:lt.length)>0||Et||Ct;return l.createElement("div",{className:`${vt}`},l.createElement("div",{className:`${vt}__content`},l.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},j("GlobalAnnotation")),l.createElement(ee,{waitSortList:(x==null?void 0:x.waitSorts)||[],sortList:(x==null?void 0:x.newSort)||[],setSortList:t=>{const e=t.map(n=>n.map(u=>u.id));q("sort",e),F(a(i({},x),{newSort:t}))},disabeledAll:S,title:j("SortConversationQuality"),prefixId:"model"}),(m==null?void 0:m.text)&&l.createElement("div",{style:{padding:"0px 16px",marginTop:"16px"}},l.createElement(Jt,{textAttribute:(z=R==null?void 0:R.textAttribute)!=null?z:[],textConfig:(m==null?void 0:m.text)&&Gt(m.text)?m==null?void 0:m.text:[],setText:t=>q("textAttribute",t),disabeledAll:S})),l.createElement(Nt,{modelData:(Q=(U=r==null?void 0:r.questionList)==null?void 0:U.textList)!=null?Q:[],selectedAnswerSort:t=>q("answerSort",t),selectedSort:(H=(J=D())==null?void 0:J.answerSort)!=null?H:[],ref:W,disabeledAll:S}),g&&l.createElement(l.Fragment,null,l.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},j("QualifiedAnnotation")),l.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"}},l.createElement(pt,{type:"primary",danger:!0},"\u6B63\u5728\u6807\u6CE8"),l.createElement("div",{style:{padding:16}},"\u7EC4\uFF1A",g.order)),l.createElement("div",null,At&&l.createElement(Ht,{list:(g==null?void 0:g.answerList)||[],LLMConfig:m,updateValue:bt,disabeledAll:S})))),l.createElement("div",{style:{margin:"24px 16px",display:"flex"}},(B==null?void 0:B.length)-1!==M&&l.createElement(pt,{type:"primary",style:{marginLeft:"auto"},onClick:()=>{if(h){h(()=>y(N()));return}y(N())},disabled:S},j("Save"))))},de=c=>({annotation:c.annotation});var ce=It(de,null,null,{context:Dt})(ue);export{ce as default};
@@ -1 +1 @@
1
- import s,{useReducer as se,useContext as ae,useState as j,useEffect as J}from"react";import{prefix as le}from"../../../../../constant/index.js";import{Tag as de}from"antd";import{useTranslation as Q}from"react-i18next";import{LeftOutlined as ce}from"@ant-design/icons";import{classnames as pe}from"../../../../../utils/index.js";import{isArray as ue,cloneDeep as fe}from"lodash";import{MathUtils as y}from"@labelbee/lb-annotation";import{LLMContext as me}from"../../../../../store/ctx.js";var ge=Object.defineProperty,ve=Object.defineProperties,xe=Object.getOwnPropertyDescriptors,W=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,q=(i,p,a)=>p in i?ge(i,p,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[p]=a,z=(i,p)=>{for(var a in p||(p={}))he.call(p,a)&&q(i,a,p[a]);if(W)for(var a of W(p))_e.call(p,a)&&q(i,a,p[a]);return i},ye=(i,p)=>ve(i,xe(p)),g;(function(i){i.Top="Top",i.Right="Right",i.Bottom="Bottom",i.Left="Left"})(g||(g={}));const w=`${le}-LLMSidebar-contentBox`,B="@",be=()=>{const{t:i}=Q();return s.createElement("div",{className:`${w}__navigation`},s.createElement("span",null,i("Best")),s.createElement("div",{style:{display:"flex",alignItems:"center",flex:1,margin:"0px 20px"}},s.createElement(ce,null),s.createElement("div",{style:{height:0,border:"1px solid #999999",width:"100%"}})),s.createElement("span",null,i("Worst")))},Le=i=>{const[,p]=se(e=>e+1,0),{sortList:a,setSortList:k,waitSortList:F,disabeledAll:V,header:K,title:U,prefixId:Y="answer"}=i,X=`${Y}-waitBox`,h=`${Y}-sortBox`,{setHoverKey:G}=ae(me),[$,b]=j(void 0),[E,H]=j(void 0),[_,Z]=j([]),{t:O}=Q();J(()=>{Z(F)},[F]),J(()=>{ne()},[JSON.stringify(a)]);const S=({item:e,operation:t,id:n})=>{const o={[`border${$}`]:"2px solid #8C9AFF"};return s.createElement("div",z({key:`${e==null?void 0:e.id}`,color:"#EBEBEB",id:n,className:pe({[`${w}__answerTag`]:!0}),style:E===(e==null?void 0:e.id)&&$?o:void 0,draggable:V||!(e==null?void 0:e.id)?"":"true",onMouseMove:()=>{G(e.id)},onMouseLeave:()=>{G(-1)}},t),e==null?void 0:e.title)},D=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2}),ee=(e,t)=>{const n=y.getLineLength(e,D(t.tl,t.tr)),o=y.getLineLength(e,D(t.tr,t.tr)),d=y.getLineLength(e,D(t.bl,t.br)),c=y.getLineLength(e,D(t.tl,t.bl));return{minDistance:Math.min(n,o,d,c),toTopDistance:n,toRightDistance:o,toBottompDistance:d,toLeftDistance:c}},te=(e,t)=>{const{minDistance:n,toTopDistance:o,toRightDistance:d,toBottompDistance:c,toLeftDistance:u}=ee(e,t);switch(n){case o:b(g.Top);break;case d:b(g.Right);break;case c:b(g.Bottom);break;case u:b(g.Left);break}},ne=()=>{const e=document.getElementById(h);if(e==null?void 0:e.childNodes){let t=[];e.childNodes.forEach((n,o)=>{var d;let c=n;((d=n==null?void 0:n.childNodes)==null?void 0:d.length)>1&&(c=n.childNodes[0]);const u=c.getBoundingClientRect()||{},{bottom:r,top:f,left:l,right:m,width:v,height:x,x:P,y:A}=u,R={x:l+v/2,y:f+x/2},M={tl:{x:P,y:A},tr:{x:m,y:f},br:{x:m,y:r},bl:{x:l,y:r}},ie=a[o].reduce((re,N)=>{let I=N;return ue(N)&&N.length>1&&(I=N[0]),I=ye(z({},I),{tagCenterPoint:R,tagVertexPoint:M}),[...re,I]},[]);t.push(ie)}),k(t)}},T=e=>{var t,n,o,d,c,u;const r=e.pageX,f=e.pageY,l={x:r,y:f};let m=a;if((m==null?void 0:m.length)>0){let v=m[0];for(let x=0;x<m.length;x++)if(x>0){const P=(t=m[x][0])==null?void 0:t.tagCenterPoint,A=(n=v[0])==null?void 0:n.tagCenterPoint,R=y.getLineLength(l,P),M=y.getLineLength(l,A);R<M&&(v=a[x])}if(!l.x||!l.y)return;if(L(e.target.id)===((o=v[0])==null?void 0:o.id)){H(void 0);return}H((d=v[0])==null?void 0:d.id),((c=v[0])==null?void 0:c.tagVertexPoint)&&l&&te(l,(u=v[0])==null?void 0:u.tagVertexPoint)}},C=e=>{var t;const{target:n}=e;let o=-1,d=-1,c=-1,u=[],r=fe(a);if(c=r.findIndex(f=>f[0].id===Number(E)),((t=n==null?void 0:n.parentNode)==null?void 0:t.parentNode.id)===h){o=L(n.parentNode.id);const f=L(n.id);u=r[~~o].filter(m=>m.id===~~f);const l=r[~~o].findIndex(m=>m.id===~~f);r[~~o].splice(l,1)}if((n==null?void 0:n.parentNode.id)===h){if(!E)return;o=L(n.id),d=r.findIndex(l=>l[0].id===o);const f=r.find(l=>l[0].id===o);f&&(u=f),r.splice(d,1),c=r.findIndex(l=>l[0].id===~~E)}switch(n.parentNode.id===X&&(o=L(n.id),d=_.findIndex(f=>f.id===o),u=[_[d]],_.splice(d,1)),$){case g.Left:r.splice(c,0,u);break;case g.Right:r.splice(c+1,0,u);break;case g.Top:case g.Bottom:r[c].push(...u);break;default:r.push(u);break}k(r),b(void 0),p()},L=e=>{const t=e.indexOf(B);return Number(e.substring(t+1,e.length))},oe=K!=null?K:s.createElement("div",{className:`${w}__title`},s.createElement("span",null,U!=null?U:O("RankingQualityOfAnswers")),_.length>0&&s.createElement(de,{color:"#FFD9D9",style:{color:"#F26549",marginLeft:8}},O("Unfinished")));return s.createElement("div",{style:{padding:"0px 16px",marginBottom:"16px",width:"100%"}},oe,s.createElement("div",null,s.createElement("div",{style:{display:"flex",alignItems:"center"}},s.createElement("span",{style:{marginRight:"16px"}},O("ToBeSorted")),s.createElement("div",{id:X,className:`${w}__answerBox`},_.length>0&&_.map(e=>S({item:e,id:`waitBoxItem${B}${e==null?void 0:e.id}`,operation:{onDrag:T,onDragEnd:C}})))),s.createElement(be,null),s.createElement("div",{id:h,className:`${w}__answerBox`},a.map((e,t)=>{var n;return e.length>1?s.createElement("div",{key:`item-${t}`,id:`${h}${B}${t}`,style:{border:"1px dashed #d9d9d9"}},e.map(o=>S({item:o,id:`sortBoxItem${B}${o==null?void 0:o.id}`,operation:{onDrag:T,onDragEnd:C}}))):S({item:e[0],id:`${h}${B}${(n=e[0])==null?void 0:n.id}`,operation:{onDrag:T,onDragEnd:C}})}))))};export{Le as default};
1
+ import s,{useReducer as se,useContext as ae,useState as k,useEffect as J}from"react";import{prefix as le}from"../../../../../constant/index.js";import{Tag as de}from"antd";import{useTranslation as Q}from"react-i18next";import{LeftOutlined as ce}from"@ant-design/icons";import{classnames as pe}from"../../../../../utils/index.js";import{isArray as ue,cloneDeep as fe}from"lodash";import{MathUtils as y}from"@labelbee/lb-annotation";import{LLMContext as me}from"../../../../../store/ctx.js";var ge=Object.defineProperty,ve=Object.defineProperties,xe=Object.getOwnPropertyDescriptors,W=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,q=(i,p,a)=>p in i?ge(i,p,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[p]=a,z=(i,p)=>{for(var a in p||(p={}))he.call(p,a)&&q(i,a,p[a]);if(W)for(var a of W(p))_e.call(p,a)&&q(i,a,p[a]);return i},ye=(i,p)=>ve(i,xe(p)),g;(function(i){i.Top="Top",i.Right="Right",i.Bottom="Bottom",i.Left="Left"})(g||(g={}));const w=`${le}-LLMSidebar-contentBox`,B="@",be=()=>{const{t:i}=Q();return s.createElement("div",{className:`${w}__navigation`},s.createElement("span",null,i("Best")),s.createElement("div",{style:{display:"flex",alignItems:"center",flex:1,margin:"0px 20px"}},s.createElement(ce,null),s.createElement("div",{style:{height:0,border:"1px solid #999999",width:"100%"}})),s.createElement("span",null,i("Worst")))},Le=i=>{const[,p]=se(e=>e+1,0),{sortList:a,setSortList:F,waitSortList:K,disabeledAll:V,header:U,title:Y,prefixId:X="answer"}=i,I=`${X}-waitBox`,x=`${X}-sortBox`,{setHoverKey:G}=ae(me),[O,b]=k(void 0),[E,H]=k(void 0),[_,Z]=k([]),{t:S}=Q();J(()=>{Z(K)},[K]),J(()=>{ne()},[JSON.stringify(a)]);const T=({item:e,operation:t,id:n})=>{const o={[`border${O}`]:"2px solid #8C9AFF"};return s.createElement("div",z({key:`${e==null?void 0:e.id}`,color:"#EBEBEB",id:n,className:pe({[`${w}__answerTag`]:!0}),style:E===(e==null?void 0:e.id)&&O?o:void 0,draggable:V||!(e==null?void 0:e.id)?"":"true",onMouseMove:()=>{G(e.id)},onMouseLeave:()=>{G(-1)}},t),e==null?void 0:e.title)},D=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2}),ee=(e,t)=>{const n=y.getLineLength(e,D(t.tl,t.tr)),o=y.getLineLength(e,D(t.tr,t.tr)),d=y.getLineLength(e,D(t.bl,t.br)),c=y.getLineLength(e,D(t.tl,t.bl));return{minDistance:Math.min(n,o,d,c),toTopDistance:n,toRightDistance:o,toBottompDistance:d,toLeftDistance:c}},te=(e,t)=>{const{minDistance:n,toTopDistance:o,toRightDistance:d,toBottompDistance:c,toLeftDistance:u}=ee(e,t);switch(n){case o:b(g.Top);break;case d:b(g.Right);break;case c:b(g.Bottom);break;case u:b(g.Left);break}},ne=()=>{const e=document.getElementById(x);if(e==null?void 0:e.childNodes){let t=[];e.childNodes.forEach((n,o)=>{var d;let c=n;((d=n==null?void 0:n.childNodes)==null?void 0:d.length)>1&&(c=n.childNodes[0]);const u=c.getBoundingClientRect()||{},{bottom:r,top:f,left:l,right:m,width:v,height:h,x:A,y:R}=u,M={x:l+v/2,y:f+h/2},j={tl:{x:A,y:R},tr:{x:m,y:f},br:{x:m,y:r},bl:{x:l,y:r}},ie=a[o].reduce((re,$)=>{let N=$;return ue($)&&$.length>1&&(N=$[0]),N=ye(z({},N),{tagCenterPoint:M,tagVertexPoint:j}),[...re,N]},[]);t.push(ie)}),F(t)}},C=e=>{var t,n,o,d,c,u;const r=e.pageX,f=e.pageY,l={x:r,y:f};let m=a;if((m==null?void 0:m.length)>0){let v=m[0];for(let h=0;h<m.length;h++)if(h>0){const A=(t=m[h][0])==null?void 0:t.tagCenterPoint,R=(n=v[0])==null?void 0:n.tagCenterPoint,M=y.getLineLength(l,A),j=y.getLineLength(l,R);M<j&&(v=a[h])}if(!l.x||!l.y)return;if(L(e.target.id)===((o=v[0])==null?void 0:o.id)){H(void 0);return}H((d=v[0])==null?void 0:d.id),((c=v[0])==null?void 0:c.tagVertexPoint)&&l&&te(l,(u=v[0])==null?void 0:u.tagVertexPoint)}},P=e=>{var t;const{target:n}=e;let o=-1,d=-1,c=-1,u=[],r=fe(a);if(c=r.findIndex(f=>f[0].id===Number(E)),((t=n==null?void 0:n.parentNode)==null?void 0:t.parentNode.id)===x){o=L(n.parentNode.id);const f=L(n.id);u=r[~~o].filter(m=>m.id===~~f);const l=r[~~o].findIndex(m=>m.id===~~f);r[~~o].splice(l,1)}if((n==null?void 0:n.parentNode.id)===x){if(!E)return;o=L(n.id),d=r.findIndex(l=>l[0].id===o);const f=r.find(l=>l[0].id===o);f&&(u=f),r.splice(d,1),c=r.findIndex(l=>l[0].id===~~E)}switch(n.parentNode.id===I&&(o=L(n.id),d=_.findIndex(f=>f.id===o),u=[_[d]],_.splice(d,1)),O){case g.Left:r.splice(c,0,u);break;case g.Right:r.splice(c+1,0,u);break;case g.Top:case g.Bottom:r[c].push(...u);break;default:r.push(u);break}F(r),b(void 0),p()},L=e=>{const t=e.indexOf(B);return Number(e.substring(t+1,e.length))},oe=U!=null?U:s.createElement("div",{className:`${w}__title`},s.createElement("span",null,Y!=null?Y:S("RankingQualityOfAnswers")),_.length>0&&s.createElement(de,{color:"#FFD9D9",style:{color:"#F26549",marginLeft:8}},S("Unfinished")));return s.createElement("div",{style:{padding:"0px 16px",marginBottom:"16px",width:"100%"}},oe,s.createElement("div",null,s.createElement("div",{style:{display:"flex",alignItems:"center"}},s.createElement("span",{style:{marginRight:"16px"}},S("ToBeSorted")),s.createElement("div",{id:I,className:`${w}__answerBox`},_.length>0&&_.map(e=>T({item:e,id:`${I}-waitBoxItem${B}${e==null?void 0:e.id}`,operation:{onDrag:C,onDragEnd:P}})))),s.createElement(be,null),s.createElement("div",{id:x,className:`${w}__answerBox`},a.map((e,t)=>{var n;return e.length>1?s.createElement("div",{key:`item-${t}`,id:`${x}${B}${t}`,style:{border:"1px dashed #d9d9d9"}},e.map(o=>T({item:o,id:`${x}-sortBoxItem${B}${o==null?void 0:o.id}`,operation:{onDrag:C,onDragEnd:P}}))):T({item:e[0],id:`${x}${B}${(n=e[0])==null?void 0:n.id}`,operation:{onDrag:C,onDragEnd:P}})}))))};export{Le as default};
@@ -1 +1 @@
1
- import n,{useState as w,useMemo as g}from"react";import{Tag as S}from"antd";import y from"../modelSort/index.js";import{useTranslation as x}from"react-i18next";var O=Object.defineProperty,P=Object.defineProperties,h=Object.getOwnPropertyDescriptors,c=Object.getOwnPropertySymbols,E=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable,m=(r,e,t)=>e in r?O(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,A=(r,e)=>{for(var t in e||(e={}))E.call(e,t)&&m(r,t,e[t]);if(c)for(var t of c(e))D.call(e,t)&&m(r,t,e[t]);return r},b=(r,e)=>P(r,h(e));const j=r=>{var e;const{selectedSort:t,maxAnswerList:f,modelData:p}=r,[i,L]=w({waitSorts:[],selecteds:t}),{t:d}=x(),u=g(()=>p.map((o,a)=>b(A({},o),{title:a+1})),[p]),v=o=>(u.filter(l=>l.answerList.some(s=>s.id===o))||[]).map(l=>({id:l.id,title:l.title})),_=(o,a)=>{};return n.createElement("div",null,n.createElement("div",{style:{fontWeight:500,fontSize:"16px",width:"100%",lineHeight:"46px",padding:"0px 16px"}},n.createElement("span",null,d("RankingQualityOfAnswers")),((e=i==null?void 0:i.waitSorts)==null?void 0:e.length)>0&&n.createElement(S,{color:"#FFD9D9",style:{color:"#F26549",marginLeft:8}},d("Unfinished"))),f.map((o,a)=>{var l,s;return n.createElement("div",{key:a,style:{display:"flex"}},n.createElement("div",{style:{fontSize:"16px",fontWeight:500,width:"80px",lineHeight:"50px",textAlign:"center"}},`${d("Answer")}${a+1}`),n.createElement(y,{setSort:M=>{_(o.id)},modelList:v(o.id),selectedSort:(s=(l=i.selecteds)==null?void 0:l[o.id])!=null?s:[],header:"",prefixId:`modelAnswer${a}`}))}))};export{j as default};
1
+ import u,{forwardRef as j,useState as I,useMemo as O,useEffect as V,useImperativeHandle as $}from"react";import{useTranslation as M}from"react-i18next";import{useDebounceFn as R}from"ahooks";import H from"../answerSort/index.js";var T=Object.defineProperty,z=Object.defineProperties,W=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,k=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable,A=(a,t,r)=>t in a?T(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,v=(a,t)=>{for(var r in t||(t={}))k.call(t,r)&&A(a,r,t[r]);if(y)for(var r of y(t))F.call(t,r)&&A(a,r,t[r]);return a},S=(a,t)=>z(a,W(t));const P=({selectedSort:a,initSelected:t,modelList:r})=>{const n=t!=null?t:a;let m=[];const _=r.filter(i=>!(n&&(n==null?void 0:n.length)>0?n.flat():[]).includes(i.id));return n&&(n==null?void 0:n.length)>0&&(m=n.map(i=>i.map(p=>r.find(w=>w.id===p)))),{waitSorts:_,newSort:m}},N=(a,t)=>{const{selectedSort:r,modelData:n,selectedAnswerSort:m,disabeledAll:_}=a,[i,p]=I({waitSorts:{},selecteds:r}),{t:w}=M(),D=O(()=>n.map((l,o)=>S(v({},l),{title:o+1})),[n]),h=O(()=>n.reduce((s,e)=>e.answerList.length>s.length?e.answerList:s,[]).map((s,e)=>({id:s.id,title:`${e+1}`}))||[],[n]);V(()=>{r&&x()},[n]);const E=l=>(D.filter(s=>s.answerList.some(e=>e.id===l))||[]).map(s=>S(v({},s),{id:s.id,title:s.title})),x=l=>{const o=i,s=l!=null?l:r;h.forEach(e=>{const d=E(e.id),c=s==null?void 0:s[e.id],{waitSorts:f,newSort:g}=P({selectedSort:c,modelList:d});o.waitSorts[e.id]=f,o.selecteds[e.id]=g}),p(o)};$(t,()=>({clearValue:()=>x({})}),[n]);const L=(l,o)=>{if(o.some(e=>e.some(d=>d==null?void 0:d.id))){const e=S(v({},i.selecteds),{[l]:o}),d={};Object.keys(e).forEach(c=>{d[c]=e[c].map(f=>f.map(g=>g.id))}),m(d),p(S(v({},i),{selecteds:e}))}},{run:b}=R(L,{wait:10});return u.createElement("div",null,u.createElement("div",{style:{fontWeight:500,fontSize:"16px",width:"100%",lineHeight:"46px",padding:"0px 16px"}},u.createElement("span",null,w("RankingQualityOfAnswers"))),h.map((l,o)=>{var s,e,d,c;return u.createElement("div",{key:o,style:{display:"flex"}},u.createElement("div",{style:{fontSize:"16px",fontWeight:500,width:"80px",lineHeight:"50px",textAlign:"center"}},`${w("Answer")}${o+1}`),u.createElement(H,{waitSortList:(e=(s=i==null?void 0:i.waitSorts)==null?void 0:s[l.id])!=null?e:[],sortList:(c=(d=i==null?void 0:i.selecteds)==null?void 0:d[l.id])!=null?c:[],setSortList:f=>{b(l.id,f)},disabeledAll:_,header:"",prefixId:`modelAnswer${o}`}))}))};var Q=j(N);export{Q as default,P as getSorts};
@@ -1 +1 @@
1
- import{EDataFormatType as s}from"../../constant/index.js";import{create as i}from"zustand";const o=i(e=>({dataFormatType:s.Default,setDataFormatType:t=>e(a=>({dataFormatType:t})),selectedID:"",setSelectedID:t=>e(a=>({selectedID:t})),highlightIDs:[],setHighlightIDs:t=>e(a=>({highlightIDs:t})),selectedIDs:[],setSelectedIDs:t=>e(a=>({selectedIDs:t})),rectRotateSensitivity:2,setRectRotateSensitivity:t=>e(a=>({rectRotateSensitivity:t}))}));export{o as default};
1
+ import{EDataFormatType as s}from"../../constant/index.js";import{create as r}from"zustand";const o=r(e=>({dataFormatType:s.Default,setDataFormatType:t=>e(a=>({dataFormatType:t})),selectedID:"",setSelectedID:t=>e(a=>({selectedID:t})),newAnswerListMap:{},setNewAnswerListMap:t=>e(a=>({newAnswerListMap:t}))}));export{o as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.23.0-alpha.122",
3
+ "version": "1.23.0-alpha.124",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -1 +0,0 @@
1
- "use strict";var React=require("react"),index=require("../answerSort/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,r)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,__spreadValues=(t,e)=>{for(var r in e||(e={}))__hasOwnProp.call(e,r)&&__defNormalProp(t,r,e[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(e))__propIsEnum.call(e,r)&&__defNormalProp(t,r,e[r]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const ModelSort=t=>{const{disabeledAll:e,modelList:r,selectedSort:o,setSort:c,header:p,title:u,prefixId:f}=t,[s,d]=React.useState({});React.useEffect(()=>{_()},[]);const _=()=>{let a=[];const l=r.filter(n=>!(o&&(o==null?void 0:o.length)>0?o.flat():[]).includes(n.id));o&&(o==null?void 0:o.length)>0&&(a=o.map(n=>n.map(i=>r.find(v=>v.id===i)))),d({waitSorts:l,newSort:a})},S=a=>{const l=a.map(n=>n.map(i=>i.id));c(l)};return React__default.default.createElement(index,{waitSortList:(s==null?void 0:s.waitSorts)||[],sortList:(s==null?void 0:s.newSort)||[],setSortList:a=>{d(__spreadProps(__spreadValues({},s),{newSort:a})),S(a)},disabeledAll:e,header:p,title:u,prefixId:f})};module.exports=ModelSort;
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- interface IModelList {
3
- id: number;
4
- title: number;
5
- }
6
- interface IProps {
7
- modelList: IModelList[];
8
- selectedSort?: number[][];
9
- disabeledAll?: boolean;
10
- setSort: (sort: number[][]) => void;
11
- header?: HTMLElement | string;
12
- title?: string;
13
- prefixId?: string;
14
- }
15
- declare const ModelSort: (props: IProps) => React.JSX.Element;
16
- export default ModelSort;
@@ -1 +0,0 @@
1
- import O,{useState as P,useEffect as g}from"react";import y from"../answerSort/index.js";var b=Object.defineProperty,h=Object.defineProperties,j=Object.getOwnPropertyDescriptors,p=Object.getOwnPropertySymbols,D=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,c=(r,t,e)=>t in r?b(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,x=(r,t)=>{for(var e in t||(t={}))D.call(t,e)&&c(r,e,t[e]);if(p)for(var e of p(t))I.call(t,e)&&c(r,e,t[e]);return r},E=(r,t)=>h(r,j(t));const L=r=>{const{disabeledAll:t,modelList:e,selectedSort:o,setSort:f,header:u,title:_,prefixId:S}=r,[a,d]=P({});g(()=>{m()},[]);const m=()=>{let s=[];const l=e.filter(n=>!(o&&(o==null?void 0:o.length)>0?o.flat():[]).includes(n.id));o&&(o==null?void 0:o.length)>0&&(s=o.map(n=>n.map(i=>e.find(v=>v.id===i)))),d({waitSorts:l,newSort:s})},w=s=>{const l=s.map(n=>n.map(i=>i.id));f(l)};return O.createElement(y,{waitSortList:(a==null?void 0:a.waitSorts)||[],sortList:(a==null?void 0:a.newSort)||[],setSortList:s=>{d(E(x({},a),{newSort:s})),w(s)},disabeledAll:t,header:u,title:_,prefixId:S})};export{L as default};