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