@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.
- package/dist/_virtual/2DViewWorker.js +1 -1
- package/dist/components/LLMMultiWheelView/dialogView/index.js +1 -1
- package/dist/components/LLMMultiWheelView/index.js +1 -1
- package/dist/components/LLMMultiWheelView/sidebar/index.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/answerSort/index.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/modelAnswerSort/index.js +1 -1
- package/dist/store/LLMMultiWheel/index.js +1 -1
- package/dist/types/components/LLMMultiWheelView/types.d.ts +62 -0
- package/dist/types/components/LLMToolView/sidebar/components/modelAnswerSort/index.d.ts +15 -5
- package/dist/types/components/LLMToolView/types.d.ts +3 -2
- package/dist/types/components/LLMToolView/utils/data.d.ts +1 -0
- package/dist/types/store/LLMMultiWheel/index.d.ts +5 -6
- package/es/_virtual/2DViewWorker.js +1 -1
- package/es/components/LLMMultiWheelView/dialogView/index.js +1 -1
- package/es/components/LLMMultiWheelView/index.js +1 -1
- package/es/components/LLMMultiWheelView/sidebar/index.js +1 -1
- package/es/components/LLMToolView/sidebar/components/answerSort/index.js +1 -1
- package/es/components/LLMToolView/sidebar/components/modelAnswerSort/index.js +1 -1
- package/es/store/LLMMultiWheel/index.js +1 -1
- package/package.json +1 -1
- package/dist/components/LLMToolView/sidebar/components/modelSort/index.js +0 -1
- package/dist/types/components/LLMToolView/sidebar/components/modelSort/index.d.ts +0 -16
- package/es/components/LLMToolView/sidebar/components/modelSort/index.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getTextControlByConfig as
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 +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};
|