2 lines
21 KiB
JavaScript
2 lines
21 KiB
JavaScript
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[274],{59419:function(ce,U,u){var E=u(75782),y=u(58733),w=u(18518),c=u(50959),T=u(60061),f=u(72961),W=u(11527),D=["fieldProps","children","params","proFieldProps","mode","valueEnum","request","showSearch","options"],I=["fieldProps","children","params","proFieldProps","mode","valueEnum","request","options"],Z=c.forwardRef(function(e,K){var te=e.fieldProps,ue=e.children,ae=e.params,ne=e.proFieldProps,Q=e.mode,$=e.valueEnum,ee=e.request,t=e.showSearch,v=e.options,d=(0,y.Z)(e,D),a=(0,c.useContext)(T.Z);return(0,W.jsx)(f.Z,(0,E.Z)((0,E.Z)({valueEnum:(0,w.h)($),request:ee,params:ae,valueType:"select",filedConfig:{customLightMode:!0},fieldProps:(0,E.Z)({options:v,mode:Q,showSearch:t,getPopupContainer:a.getPopupContainer},te),ref:K,proFieldProps:ne},d),{},{children:ue}))}),M=c.forwardRef(function(e,K){var te=e.fieldProps,ue=e.children,ae=e.params,ne=e.proFieldProps,Q=e.mode,$=e.valueEnum,ee=e.request,t=e.options,v=(0,y.Z)(e,I),d=(0,E.Z)({options:t,mode:Q||"multiple",labelInValue:!0,showSearch:!0,showArrow:!1,autoClearSearchValue:!0,optionLabelProp:"label"},te),a=(0,c.useContext)(T.Z);return(0,W.jsx)(f.Z,(0,E.Z)((0,E.Z)({valueEnum:(0,w.h)($),request:ee,params:ae,valueType:"select",filedConfig:{customLightMode:!0},fieldProps:(0,E.Z)({getPopupContainer:a.getPopupContainer},d),ref:K,proFieldProps:ne},v),{},{children:ue}))}),B=Z,C=M,o=B;o.SearchSelect=C,o.displayName="ProFormComponent",U.Z=o},40792:function(ce,U,u){var E=u(75782),y=u(58733),w=u(50959),c=u(72961),T=u(11527),f=["fieldProps","unCheckedChildren","checkedChildren","proFieldProps"],W=w.forwardRef(function(D,I){var Z=D.fieldProps,M=D.unCheckedChildren,B=D.checkedChildren,C=D.proFieldProps,o=(0,y.Z)(D,f);return(0,T.jsx)(c.Z,(0,E.Z)({valueType:"switch",fieldProps:(0,E.Z)({unCheckedChildren:M,checkedChildren:B},Z),ref:I,valuePropName:"checked",proFieldProps:C,filedConfig:{valuePropName:"checked",ignoreWidth:!0}},o))});U.Z=W},66732:function(ce,U,u){var E=u(75782),y=u(58733),w=u(50959),c=u(72961),T=u(11527),f=["fieldProps","proFieldProps"],W=["fieldProps","proFieldProps"],D="text",I=function(C){var o=C.fieldProps,e=C.proFieldProps,K=(0,y.Z)(C,f);return(0,T.jsx)(c.Z,(0,E.Z)({valueType:D,fieldProps:o,filedConfig:{valueType:D},proFieldProps:e},K))},Z=function(C){var o=C.fieldProps,e=C.proFieldProps,K=(0,y.Z)(C,W);return(0,T.jsx)(c.Z,(0,E.Z)({valueType:"password",fieldProps:o,proFieldProps:e,filedConfig:{valueType:D}},K))},M=I;M.Password=Z,M.displayName="ProFormComponent",U.Z=M},3176:function(ce,U,u){var E=u(75782),y=u(58733),w=u(50959),c=u(72961),T=u(11527),f=["fieldProps","proFieldProps"],W=function(I,Z){var M=I.fieldProps,B=I.proFieldProps,C=(0,y.Z)(I,f);return(0,T.jsx)(c.Z,(0,E.Z)({ref:Z,valueType:"textarea",fieldProps:M,proFieldProps:B},C))};U.Z=w.forwardRef(W)},7765:function(ce,U,u){u.r(U),u.d(U,{default:function(){return N}});var E=u(25359),y=u.n(E),w=u(49811),c=u.n(w),T=u(54306),f=u.n(T),W=u(93525),D=u.n(W),I=u(27693),Z=u(68243),M=u(28964),B=u(4050),C=u(31255),o=u(50959),e=u(11527);function K(n,L){var H=n.concat(L);return D()(new Set(H))}function te(n){var L,H=(0,o.useState)((L=n.data)!==null&&L!==void 0?L:[]),G=f()(H,2),S=G[0],_=G[1],P=(0,o.useState)(!1),s=f()(P,2),h=s[0],J=s[1],m=(0,o.useState)(""),R=f()(m,2),V=R[0],X=R[1],de=(0,o.useState)(-1),oe=f()(de,2),Y=oe[0],q=oe[1],De=(0,o.useState)(""),fe=f()(De,2),pe=fe[0],Ce=fe[1],me=(0,o.useRef)(null),ve=(0,o.useRef)(null);(0,o.useEffect)(function(){if(h){var p;(p=me.current)===null||p===void 0||p.focus()}},[h]),(0,o.useEffect)(function(){var p;(p=ve.current)===null||p===void 0||p.focus()},[V]);var Se=function(g){var k=S.filter(function(le){return le!==g});console.log(k),_(k),n.setTags(k)},xe=function(){J(!0)},Ae=function(g){X(g.target.value)},he=function(){if(V&&S.indexOf(V)===-1){var g=V.trim().split(/\s+/),k=K(S,g);_(k),n.setTags(k)}J(!1),X("")},ye=function(g){Ce(g.target.value)},Fe=function(){var g=D()(S);g[Y]=pe,_(g),n.setTags(g),q(-1),X("")},Ee={width:78,verticalAlign:"top"},ge={borderStyle:"dashed"};return(0,e.jsxs)(Z.Z,{size:[0,8],wrap:!0,children:[(0,e.jsx)(Z.Z,{size:[0,8],wrap:!0,children:S.map(function(p,g){if(Y===g)return(0,e.jsx)(M.Z,{ref:ve,size:"small",style:Ee,value:pe,onChange:ye,onBlur:Fe,onPressEnter:Fe},p);var k=p.length>20,le=(0,e.jsx)(B.Z,{closable:!0,style:{userSelect:"none"},onClose:function(){return Se(p)},children:(0,e.jsx)("span",{onDoubleClick:function(Be){g!==0&&(q(g),Ce(p),Be.preventDefault())},children:k?"".concat(p.slice(0,20),"..."):p})},p);return k?(0,e.jsx)(C.Z,{title:p,children:le},p):le})}),h?(0,e.jsx)(M.Z,{ref:me,type:"text",size:"small",style:Ee,value:V,onChange:Ae,onBlur:he,onPressEnter:he}):(0,e.jsxs)(B.Z,{style:ge,onClick:xe,children:[(0,e.jsx)(I.Z,{}),"\u589E\u52A0"]})]})}var ue=te,ae=u(12472),ne=u(61643),Q=u(81308),$=u(59419),ee=u(66732),t=u(24176),v=u(40792),d=u(3176),a=u(86195),i=u(833),j=u(26572),O=u(79112),re=u(53315),N=function(){var n=(0,o.useRef)(),L=(0,o.useState)(b),H=f()(L,2),G=H[0],S=H[1],_=[{title:"\u7F16\u53F7",dataIndex:"id",key:"id"},{title:"\u7FA4\u7EC4ID",dataIndex:"chat_id",key:"chat_id"},{title:"\u7FA4\u540D",dataIndex:"chat_name",key:"chat_name"},{title:"\u5E73\u53F0",dataIndex:"platform",key:"platform",render:function(s,h){return(0,e.jsx)(B.Z,{color:"purple",children:s})}},{title:"\u6A21\u5F0F",dataIndex:"in",key:"in",render:function(s,h){return(0,e.jsxs)(Z.Z,{size:[0,8],wrap:!0,children:[h.in&&(0,e.jsx)(B.Z,{color:"blue",children:"\u91C7\u96C6"}),h.out&&(0,e.jsx)(B.Z,{color:"geekblue",children:"\u8F6C\u53D1"})]})}},{title:"\u5907\u6CE8",dataIndex:"remark",key:"remark"},{title:"\u521B\u5EFA\u65E5\u671F",dataIndex:"created_at",key:"created_at",render:function(s,h){return(0,e.jsx)("span",{children:new Date(s*1e3).toLocaleDateString()})}},{title:"\u542F\u7528",dataIndex:"enable",key:"enable",renderFormItem:function(){return(0,e.jsx)(i.Z,{disabled:!0,defaultChecked:!1})},render:function(s,h){return(0,e.jsx)(i.Z,{onChange:function(m){(0,a.request)("/api/carry/group",{method:"post",data:JSON.stringify({chat_id:h.chat_id,enable:m})})},defaultChecked:h==null?void 0:h.enable})}},{title:"\u64CD\u4F5C",valueType:"option",width:"10%",render:function(s,h){return[(0,e.jsx)("a",{onClick:function(){return S(h)},children:"\u7F16\u8F91"},"more"),(0,e.jsx)("a",{onClick:function(){var m,R;(0,a.request)("/api/carry/group",{method:"delete",data:JSON.stringify({chat_id:h.chat_id})}),(m=n.current)===null||m===void 0||(R=m.reloadAndRest)===null||R===void 0||R.call(m)},children:"\u5220\u9664"},"delete")]}}];return(0,e.jsxs)(ae._z,{content:"\u642C\u8FD0\u7FA4\u7EC4",children:[(0,e.jsx)(Z.Z,{style:{marginBottom:10},children:(0,e.jsx)(j.ZP,{type:"primary",onClick:function(){S(ie)},icon:(0,e.jsx)(I.Z,{}),children:"\u65B0\u5EFA\u4E00\u884C"})}),(0,e.jsx)(ne.Z,{search:!1,actionRef:n,rowKey:function(s){return s.chat_id},columns:_,request:c()(y()().mark(function P(){var s,h=arguments;return y()().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return s=h.length>0&&h[0]!==void 0?h[0]:{},m.abrupt("return",(0,a.request)("/api/carry/groups",{params:s}));case 2:case"end":return m.stop()}},P)}))}),G.id!=-1&&(0,e.jsx)(z,{open:G.id!=-1,data:G,onCancel:function(){return S(b)},onFinish:function(){var P=c()(y()().mark(function s(h){return y()().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:(0,a.request)("/api/carry/group",{method:"post",data:JSON.stringify(h)}).then(function(R){var V,X;(V=n.current)===null||V===void 0||(X=V.reloadAndRest)===null||X===void 0||X.call(V),S(b)});case 1:case"end":return m.stop()}},s)}));return function(s){return P.apply(this,arguments)}}()})]})};function z(n){var L,H,G,S,_,P=(0,o.useState)([]),s=f()(P,2),h=s[0],J=s[1],m=(0,o.useState)({}),R=f()(m,2),V=R[0],X=R[1],de=(0,o.useState)(!1),oe=f()(de,2),Y=oe[0],q=oe[1],De=(0,o.useState)({}),fe=f()(De,2),pe=fe[0],Ce=fe[1],me=(0,o.useState)([]),ve=f()(me,2),Se=ve[0],xe=ve[1],Ae=(0,o.useState)(n.data.out),he=f()(Ae,2),ye=he[0],Fe=he[1],Ee=(0,o.useState)(((L=(H=n.data.allowed)===null||H===void 0?void 0:H.length)!==null&&L!==void 0?L:0)==0),ge=f()(Ee,2),p=ge[0],g=ge[1],k=(0,o.useState)(se.allowed),le=f()(k,2),be=le[0],Be=le[1],We=(0,o.useState)([]),Ze=f()(We,2),Pe=Ze[0],Le=Ze[1],_e=(0,o.useState)([]),Me=f()(_e,2),$e=Me[0],je=Me[1],Ue=(0,o.useState)([]),Re=f()(Ue,2),we=Re[0],Ke=Re[1],x=(0,o.useRef)(),Oe=function(r){var l;return(l=x.current)===null||l===void 0?void 0:l.getFieldValue(r)},Te=function(r,l){var A;return(A=x.current)===null||A===void 0?void 0:A.setFieldValue(r,l)};return(0,o.useEffect)(function(){var F,r,l=(F=x.current)===null||F===void 0?void 0:F.getFieldValue("platform");return(0,a.request)((r="/api/carry/group_selects?chat_id="+n.data.chat_id+"&platform="+l)!==null&&r!==void 0?r:"").then(function(A){if(A.data){var Ie;J(A.data.bots_id),Ce(A.data.group_names),xe(A.data.platforms),X(A.data.scripts),je(A.data.user_names);var Ve=(Ie=x.current)===null||Ie===void 0?void 0:Ie.getFieldValue("bots_id");(!Ve||!Ve.length)&&A.data.bots_id.length&&Te("bots_id",[A.data.bots_id[0]])}}),function(){}},[Y]),(0,e.jsx)(O.Z,{title:n.data.id==0?"\u521B\u5EFA":"\u7F16\u8F91",open:!0,onCancel:n.onCancel,onOk:function(){var r;n.onFinish(x==null||(r=x.current)===null||r===void 0?void 0:r.getFieldsValue())},children:(0,e.jsxs)(Q.A,{formRef:x,onValuesChange:function(r){if(r.platform){var l;q(!Y),x==null||(l=x.current)===null||l===void 0||l.setFieldsValue({bots_id:[]})}"out"in r&&Fe(r.out),r.allowed&&g(r.allowed)},onFinish:n.onFinish,submitter:!1,children:[(0,e.jsx)($.Z,{tooltip:"\u7CFB\u7EDF\u552F\u4E00\u4E0D\u53EF\u66F4\u6539\uFF0C\u53EA\u80FD\u5220\u9664\u3002",name:"chat_id",initialValue:n.data.chat_id,label:"\u7FA4\u7EC4ID",disabled:n.data.id!=0,required:!0,fieldProps:{showSearch:!0,onSearch:function(r){(0,a.request)("/api/nickname/labels?gkeyword="+r).then(function(l){l&&l.data&&Le(l.data)})},onChange:function(r){if(Pe)for(var l in Pe){var A=Pe[l];A.value==r&&(Te("chat_name",A.chat_name),A.platform!=!Oe("platform")&&(Te("platform",A.platform),q(!Y)))}},filterOption:!1,defaultActiveFirstOption:!1,showArrow:!1,notFoundContent:null},options:Pe}),(0,e.jsxs)(Q.A.Group,{children:[(0,e.jsx)(ee.Z,{name:"remark",initialValue:n.data.remark,label:"\u7FA4\u7EC4\u5907\u6CE8",rules:[{message:"\u8BF7\u586B\u5199\u7FA4\u5907\u6CE8"}]}),(0,e.jsx)(ee.Z,{name:"chat_name",initialValue:n.data.chat_name,label:"\u7FA4\u540D\u79F0",disabled:!0})]}),(0,e.jsxs)(Q.A.Group,{children:[(0,e.jsx)($.Z,{tooltip:"\u5E73\u53F0\u63A5\u5165\u7CFB\u7EDF\u540E\u5C06\u81EA\u52A8\u51FA\u73B0\u5728\u5217\u8868\u4E2D\u3002",initialValue:n.data.platform,valueEnum:Se.reduce(function(F,r){return F[r]=r,F},{}),name:"platform",label:"\u901A\u4FE1\u5E73\u53F0",required:!0}),(0,e.jsxs)(t.UW,{children:[(0,e.jsx)(v.Z,{name:"in",tooltip:"\u5F00\u542F\u540E\u5C06\u5728\u6B64\u7FA4\u804A\u76D1\u542C\u6D88\u606F\uFF0C\u4F46\u673A\u5668\u4EBA\u540C\u65F6\u4E0D\u518D\u56DE\u590D\u8BE5\u7FA4\u804A\u6307\u4EE4\uFF0C\u4F46\u662F\u4E0D\u5F71\u54CD\u6D88\u606F\u63A8\u9001\u3002\u5F00\u542F\u6B64\u6A21\u5F0F\u7684\u4E00\u822C\u662F\u522B\u4EBA\u7684\u7FA4\u3002",label:"\u91C7\u96C6\u6A21\u5F0F",initialValue:n.data.in}),(0,e.jsx)(v.Z,{name:"out",tooltip:"\u5F00\u542F\u540E\u5C06\u5728\u6B64\u7FA4\u8F6C\u53D1\u6D88\u606F\u3002\u5F00\u542F\u6B64\u6A21\u5F0F\u7684\u7FA4\u4E00\u822C\u662F\u81EA\u5DF1\u7684\u7FA4\u3002",label:"\u8F6C\u53D1\u6A21\u5F0F",initialValue:n.data.out})]})]}),ye&&(0,e.jsx)($.Z,{name:"from",label:"\u91C7\u96C6\u6E90",tooltip:"\u6307\u5B9A\u8981\u8FDB\u884C\u6D88\u606F\u91C7\u96C6\u7684\u7FA4\u804A\u3002",valueEnum:pe,fieldProps:{mode:"multiple"},initialValue:(G=n.data.from)!==null&&G!==void 0?G:[]}),(0,e.jsx)($.Z,{name:"bots_id",label:"\u5DE5\u4F5C\u673A\u5668\u4EBA",tooltip:"\u6307\u5B9A\u8981\u8FDB\u884C\u6D88\u606F\u91C7\u96C6\u548C\u8F6C\u53D1\u7684\u673A\u5668\u4EBA\uFF0C\u540C\u4E00\u6D88\u606F\u540C\u65F6\u53EA\u5141\u8BB8\u4E00\u4E2A\u673A\u5668\u4EBA\u5DE5\u4F5C\uFF0C\u5982\u679C\u6307\u5B9A\u7684\u673A\u5668\u4EBA\u79BB\u7EBF\u5219\u91C7\u7528\u5176\u4ED6\u673A\u5668\u4EBA\u9876\u4E0A\u3002\u6B64\u5916\uFF0C\u91C7\u96C6\u6A21\u5F0F\u4E2D\u53EA\u6709\u7B2C\u4E00\u4E2AID\u6709\u6548\u3002",valueEnum:h.reduce(function(F,r){return F[r]=r,F},{}),fieldProps:{mode:"multiple"},placeholder:"\u9ED8\u8BA4\u9009\u62E9\u4E00\u4E2A",initialValue:(S=n.data.bots_id)!==null&&S!==void 0?S:[]}),(0,e.jsx)($.Z,{tooltip:"\u53EF\u4EE5\u987A\u5E8F\u901A\u8FC7\u811A\u672C\u5904\u7406\u53D1\u9001\u524D\u7684\u6D88\u606F\u3002",name:"scripts",label:"\u5904\u7406\u811A\u672C",fieldProps:{mode:"multiple"},valueEnum:V,initialValue:(_=n.data.scripts)!==null&&_!==void 0?_:[]}),(0,e.jsx)($.Z,{name:"allowed",tooltip:"\u6B64\u5904\u586B\u767D\u540D\u5355\u7528\u6237ID\u3002\u91C7\u96C6\u7FA4\u53EA\u63A5\u6536\u6765\u81EA\u767D\u540D\u5355\u7528\u6237\u6D88\u606F\uFF0C\u8F6C\u53D1\u7FA4\u53EA\u8F6C\u53D1\u6765\u81EA\u767D\u540D\u5355\u7528\u6237\u6D88\u606F\u3002\u8BBE\u7F6E\u767D\u540D\u5355\u5C06\u5FFD\u7565\u9ED1\u540D\u5355\u3002",initialValue:n.data.allowed,label:"\u767D\u540D\u5355",fieldProps:{mode:"multiple",showSearch:!0,onSearch:function(r){(0,a.request)("/api/nickname/labels?ukeyword="+r+"&platform="+Oe("platform")).then(function(l){l&&l.data&&je(l.data)})},filterOption:!1,defaultActiveFirstOption:!1,showArrow:!1,notFoundContent:null,onChange:function(r){r.length!=0?g(!1):g(!0)}},options:$e}),p&&(0,e.jsx)($.Z,{name:"prohibited",initialValue:n.data.prohibited,tooltip:"\u6B64\u5904\u586B\u9ED1\u540D\u5355\u7528\u6237ID\u3002\u91C7\u96C6\u7FA4\u548C\u8F6C\u53D1\u7FA4\u5C06\u5FFD\u7565\u9ED1\u540D\u5355\u7528\u6237\u6240\u6709\u6D88\u606F\u3002",label:"\u9ED1\u540D\u5355",fieldProps:{mode:"multiple",showSearch:!0,onSearch:function(r){(0,a.request)("/api/nickname/labels?ukeyword="+r+"&platform="+Oe("platform")).then(function(l){l&&l.data&&je(l.data)})},filterOption:!1,defaultActiveFirstOption:!1,showArrow:!1,notFoundContent:null},options:$e}),(0,e.jsxs)(t.UW,{children:[(0,e.jsx)(v.Z,{name:"deduplication",tooltip:"\u5F00\u542F\u540E\u5C06\u4F1A\u5BF9\u6587\u672C\u6D88\u606F\u3001\u56FE\u6587\u6D88\u606F\u8FDB\u884C\u53BB\u91CD\uFF0C\u4E0D\u4FDD\u8BC1\u5341\u5206\u51C6\u786E\u3002",label:"\u6587\u672C\u53BB\u91CD",initialValue:n.data.deduplication}),(0,e.jsx)(v.Z,{name:"deduplication2",tooltip:"\u5F85\u5B9E\u73B0\uFF0C\u5360\u4E2A\u4F4D\u7F6E\uFF0C\u5F00\u542F\u540E\u5C06\u4F1A\u5BF9\u56FE\u7247\u6D88\u606F\u8FDB\u884C\u53BB\u91CD\uFF0C\u5BF9\u8BA1\u7B97\u673A\u6027\u80FD\u6709\u8F83\u9AD8\u8981\u6C42\u3002",label:"\u56FE\u7247\u53BB\u91CD",initialValue:n.data.deduplication2})]}),(0,e.jsx)(re.Z,{tabBarExtraContent:(0,e.jsx)(C.Z,{placement:"top",title:be,children:(0,e.jsx)(j.ZP,{children:"\u63D0\u793A"})}),onTabClick:function(r,l){Be(se[r])},items:[{label:"\u5305\u542B\u8BCD",key:"include",children:(0,e.jsx)(ue,{setTags:function(r){var l;x==null||(l=x.current)===null||l===void 0||l.setFieldsValue({include:r})},data:n.data.include})},{label:"\u6392\u9664\u8BCD",key:"exclude",children:(0,e.jsx)(ue,{setTags:function(r){var l;x==null||(l=x.current)===null||l===void 0||l.setFieldsValue({exclude:r})},data:n.data.exclude})}]}),(0,e.jsx)(d.Z,{hidden:!0,name:"allowed",initialValue:n.data.allowed,label:"\u767D\u540D\u5355"}),(0,e.jsx)(d.Z,{hidden:!0,name:"prohibited",initialValue:n.data.prohibited,label:"\u9ED1\u540D\u5355"}),(0,e.jsx)(d.Z,{hidden:!0,name:"include",initialValue:n.data.include,label:"\u5305\u542B\u5173\u952E\u8BCD"}),(0,e.jsx)(d.Z,{hidden:!0,name:"exclude",initialValue:n.data.exclude,label:"\u6392\u9664\u5173\u952E\u8BCD"})]})},n.data.chat_id)}var b={id:-1},ie={id:0},se={include:"\u6B64\u5904\u586B\u5199\u5305\u542B\u8BCD\u3002\u91C7\u96C6\u7FA4\u548C\u8F6C\u53D1\u7FA4\u5C06\u5FFD\u7565\u4E0D\u542B\u6709\u4EFB\u610F\u5305\u542B\u8BCD\u7684\u6D88\u606F\u3002\u652F\u6301\u6B63\u5219\uFF0C\u9700\u8981\u4F7F\u7528\u201C/\u201D\u5C06\u6B63\u5219\u8868\u8FBE\u5F0F\u5305\u8D77\u6765\u3002",exclude:"\u6B64\u5904\u586B\u5199\u6392\u9664\u8BCD\u3002\u91C7\u96C6\u7FA4\u548C\u8F6C\u53D1\u7FA4\u5C06\u5FFD\u7565\u4EFB\u4F55\u542B\u6709\u4EFB\u610F\u6392\u9664\u8BCD\u7684\u6D88\u606F\u3002\u652F\u6301\u6B63\u5219\uFF0C\u9700\u8981\u4F7F\u7528\u201C/\u201D\u5C06\u6B63\u5219\u8868\u8FBE\u5F0F\u5305\u8D77\u6765\u3002"}},4050:function(ce,U,u){u.d(U,{Z:function(){return ee}});var E=u(96157),y=u(84875),w=u.n(y),c=u(50959),T=u(85548),f=u(78862),W=u(70458);function D(t){return typeof t!="string"?t:t.charAt(0).toUpperCase()+t.slice(1)}var I=u(49272),Z=u(42498),M=u(97624),B=u(74074);const C=(t,v,d)=>{const a=D(d);return{[`${t.componentCls}-${v}`]:{color:t[`color${d}`],background:t[`color${a}Bg`],borderColor:t[`color${a}Border`]}}},o=t=>(0,Z.Z)(t,(v,d)=>{let{textColor:a,lightBorderColor:i,lightColor:j,darkColor:O}=d;return{[`${t.componentCls}-${v}`]:{color:a,background:j,borderColor:i,"&-inverse":{color:t.colorTextLightSolid,background:O,borderColor:O},[`&${t.componentCls}-borderless`]:{borderColor:"transparent"}}}}),e=t=>{const{paddingXXS:v,lineWidth:d,tagPaddingHorizontal:a,componentCls:i}=t,j=a-d,O=v-d;return{[i]:Object.assign(Object.assign({},(0,I.Wf)(t)),{display:"inline-block",height:"auto",marginInlineEnd:t.marginXS,paddingInline:j,fontSize:t.tagFontSize,lineHeight:`${t.tagLineHeight}px`,whiteSpace:"nowrap",background:t.tagDefaultBg,border:`${t.lineWidth}px ${t.lineType} ${t.colorBorder}`,borderRadius:t.borderRadiusSM,opacity:1,transition:`all ${t.motionDurationMid}`,textAlign:"start",[`&${i}-rtl`]:{direction:"rtl"},"&, a, a:hover":{color:t.tagDefaultColor},[`${i}-close-icon`]:{marginInlineStart:O,color:t.colorTextDescription,fontSize:t.tagIconSize,cursor:"pointer",transition:`all ${t.motionDurationMid}`,"&:hover":{color:t.colorTextHeading}},[`&${i}-has-color`]:{borderColor:"transparent",[`&, a, a:hover, ${t.iconCls}-close, ${t.iconCls}-close:hover`]:{color:t.colorTextLightSolid}},["&-checkable"]:{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",[`&:not(${i}-checkable-checked):hover`]:{color:t.colorPrimary,backgroundColor:t.colorFillSecondary},"&:active, &-checked":{color:t.colorTextLightSolid},"&-checked":{backgroundColor:t.colorPrimary,"&:hover":{backgroundColor:t.colorPrimaryHover}},"&:active":{backgroundColor:t.colorPrimaryActive}},["&-hidden"]:{display:"none"},[`> ${t.iconCls} + span, > span + ${t.iconCls}`]:{marginInlineStart:j}}),[`${i}-borderless`]:{borderColor:"transparent",background:t.tagBorderlessBg}}};var K=(0,M.Z)("Tag",t=>{const{fontSize:v,lineHeight:d,lineWidth:a,fontSizeIcon:i}=t,j=Math.round(v*d),O=t.fontSizeSM,re=j-a*2,N=t.colorFillQuaternary,z=t.colorText,b=(0,B.TS)(t,{tagFontSize:O,tagLineHeight:re,tagDefaultBg:N,tagDefaultColor:z,tagIconSize:i-2*a,tagPaddingHorizontal:8,tagBorderlessBg:t.colorFillTertiary});return[e(b),o(b),C(b,"success","Success"),C(b,"processing","Info"),C(b,"error","Error"),C(b,"warning","Warning")]}),te=function(t,v){var d={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&v.indexOf(a)<0&&(d[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,a=Object.getOwnPropertySymbols(t);i<a.length;i++)v.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(t,a[i])&&(d[a[i]]=t[a[i]]);return d},ae=t=>{const{prefixCls:v,className:d,checked:a,onChange:i,onClick:j}=t,O=te(t,["prefixCls","className","checked","onChange","onClick"]),{getPrefixCls:re}=c.useContext(W.E_),N=n=>{i==null||i(!a),j==null||j(n)},z=re("tag",v),[b,ie]=K(z),se=w()(z,{[`${z}-checkable`]:!0,[`${z}-checkable-checked`]:a},d,ie);return b(c.createElement("span",Object.assign({},O,{className:se,onClick:N})))},ne=function(t,v){var d={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&v.indexOf(a)<0&&(d[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,a=Object.getOwnPropertySymbols(t);i<a.length;i++)v.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(t,a[i])&&(d[a[i]]=t[a[i]]);return d};const Q=(t,v)=>{const{prefixCls:d,className:a,rootClassName:i,style:j,children:O,icon:re,color:N,onClose:z,closeIcon:b,closable:ie=!1,bordered:se=!0}=t,n=ne(t,["prefixCls","className","rootClassName","style","children","icon","color","onClose","closeIcon","closable","bordered"]),{getPrefixCls:L,direction:H}=c.useContext(W.E_),[G,S]=c.useState(!0);c.useEffect(()=>{"visible"in n&&S(n.visible)},[n.visible]);const _=(0,T.o2)(N)||(0,T.yT)(N),P=Object.assign({backgroundColor:N&&!_?N:void 0},j),s=L("tag",d),[h,J]=K(s),m=w()(s,{[`${s}-${N}`]:_,[`${s}-has-color`]:N&&!_,[`${s}-hidden`]:!G,[`${s}-rtl`]:H==="rtl",[`${s}-borderless`]:!se},a,i,J),R=q=>{q.stopPropagation(),z==null||z(q),!q.defaultPrevented&&S(!1)},V=c.useMemo(()=>ie?b?c.createElement("span",{className:`${s}-close-icon`,onClick:R},b):c.createElement(E.Z,{className:`${s}-close-icon`,onClick:R}):null,[ie,b,s,R]),X=typeof n.onClick=="function"||O&&O.type==="a",de=re||null,oe=de?c.createElement(c.Fragment,null,de,c.createElement("span",null,O)):O,Y=c.createElement("span",Object.assign({},n,{ref:v,className:m,style:P}),oe,V);return h(X?c.createElement(f.Z,null,Y):Y)},$=c.forwardRef(Q);$.CheckableTag=ae;var ee=$}}]);
|