2 lines
14 KiB
JavaScript
2 lines
14 KiB
JavaScript
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[1411],{51411:function(Ve,O,t){t.r(O),t.d(O,{default:function(){return we}});var Q=t(90228),b=t.n(Q),J=t(87999),M=t.n(J),X=t(48305),I=t.n(X),s=t(50959),q=t(49547),Z=t(35748),_=t(80896),V=t(36165),ee=t(27610),E=t(19014),ae=t(50925),N=t(94675),g=t(7485),te=t(27633),ne=t(26068),l=t.n(ne),z=t(88831),P=t(44706),ue=t(33938),re=t(47186),le=t(41268),oe=t(66292),ie=t.n(oe),se=t(82092),ce=t.n(se),de=t(38546),me=t(82187),ve=t.n(me),U={iconPicSearcher:"iconPicSearcher___hJg4D","icon-pic-btn":"icon-pic-btn___L4v1S","icon-pic-preview":"icon-pic-preview___ilSDh","icon-pic-search-result":"icon-pic-search-result___gIGCh","result-tip":"result-tip___LzRmi","col-icon":"col-icon___BSYZg",anticon:"anticon___qL_hm",anticonsList:"anticonsList___HMi_c",rtl:"rtl___Ezi11",anticonClass:"anticonClass___Ei9dm","ant-badge":"ant-badge___Zv5ig",TwoTone:"TwoTone___EPyBa",copied:"copied___NGd_a","copied-code":"copied-code___wW8vD"},a=t(11527),fe=z,he=function(e){var i=e.name,B=e.justCopied,m=e.onSelect,f=e.theme,v=ve()(ce()({copied:B===i},f,!!f));return(0,a.jsx)("li",{className:v,onClick:function(){m&&m(f,i)},children:(0,a.jsx)(de.Z,{title:i,children:s.createElement(fe[i],{className:U.anticon})})})},Fe=he,ge=function(e){var i=e.icons,B=e.title,m=e.newIcons,f=e.theme,v=(0,g.useIntl)(),F=s.useState(null),p=I()(F,2),j=p[0],C=p[1],h=s.useRef(null),r=s.useCallback(function(u,o){var n=e.onSelect;n&&n(u,o),C(u),h.current=setTimeout(function(){C(null)},2e3)},[]);return s.useEffect(function(){return function(){h.current&&clearTimeout(h.current)}},[]),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{children:"icon"}),(0,a.jsx)("ul",{className:U.anticonsList,children:i.map(function(u){return(0,a.jsx)(Fe,{name:u,theme:f,isNew:m.includes(u),justCopied:j,onSelect:r},u)})})]})},Ce=ge,Se=t(953),pe=t(25666),xe=t(57185),Ne=null,ze=Se.Z.Dragger,Be=function(){var e=(0,g.useIntl)(),i=e.formatMessage,B=(0,s.useState)({loading:!1,modalOpen:!1,popoverVisible:!1,icons:[],fileList:[],error:!1,modelLoaded:!1}),m=I()(B,2),f=m[0],v=m[1],F=function(u){try{var o=window.antdIconClassifier.predict(u);gtag&&o.length&>ag("event","icon",{event_category:"search-by-image",event_label:o[0].className}),o=o.map(function(n){return{score:n.score,type:n.className.replace(/\s/g,"-")}}),v(function(n){return l()(l()({},n),{},{loading:!1,error:!1,icons:o})})}catch(n){v(function(d){return l()(l()({},d),{},{loading:!1,error:!0})})}},p=function(u){return new Promise(function(o){var n=new Image;n.setAttribute("crossOrigin","anonymous"),n.src=u,n.onload=function(){o(n)}})},j=(0,s.useCallback)(function(r){v(function(o){return l()(l()({},o),{},{loading:!0})});var u=new FileReader;u.onload=function(){p(u.result).then(F),v(function(o){return l()(l()({},o),{},{fileList:[{uid:1,name:r.name,status:"done",url:u.result}]})})},u.readAsDataURL(r)},[]),C=(0,s.useCallback)(function(r){var u=r.clipboardData&&r.clipboardData.items,o=null;if(u&&u.length){for(var n=0;n<u.length;n++)if(u[n].type.includes("image")){o=u[n].getAsFile();break}}o&&j(o)},[]),h=(0,s.useCallback)(function(){v(function(r){return l()(l()({},r),{},{modalOpen:!r.modalOpen,popoverVisible:!1,fileList:[],icons:[]})}),localStorage.getItem("disableIconTip")||localStorage.setItem("disableIconTip","true")},[]);return(0,s.useEffect)(function(){var r=document.createElement("script");return r.onload=M()(b()().mark(function u(){return b()().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,window.antdIconClassifier.load();case 2:v(function(d){return l()(l()({},d),{},{modelLoaded:!0})}),document.addEventListener("paste",C);case 4:case"end":return n.stop()}},u)})),r.src="https://cdn.jsdelivr.net/gh/lewis617/antd-icon-classifier@0.0/dist/main.js",document.head.appendChild(r),v(function(u){return l()(l()({},u),{},{popoverVisible:!localStorage.getItem("disableIconTip")})}),function(){document.removeEventListener("paste",C)}},[]),(0,a.jsx)("div",{className:"iconPicSearcher",children:(0,a.jsx)(pe.Z,{open:f.popoverVisible,children:(0,a.jsx)(xe.Z,{className:"icon-pic-btn",onClick:h})})})},ye=Be,Ie=function(e){var i="M864 64H160C107 64 64 107 64 160v704c0 53 43 96 96 96h704c53 0 96-43 96-96V160c0-53-43-96-96-96z";return(0,a.jsx)("svg",l()(l()({},e),{},{viewBox:"0 0 1024 1024",children:(0,a.jsx)("path",{d:i})}))},je=function(e){var i="M864 64H160C107 64 64 107 64 160v704c0 53 43 96 96 96h704c53 0 96-43 96-96V160c0-53-43-96-96-96z m-12 800H172c-6.6 0-12-5.4-12-12V172c0-6.6 5.4-12 12-12h680c6.6 0 12 5.4 12 12v680c0 6.6-5.4 12-12 12z";return(0,a.jsx)("svg",l()(l()({},e),{},{viewBox:"0 0 1024 1024",children:(0,a.jsx)("path",{d:i})}))},De=function(e){var i="M16 512c0 273.932 222.066 496 496 496s496-222.068 496-496S785.932 16 512 16 16 238.066 16 512z m496 368V144c203.41 0 368 164.622 368 368 0 203.41-164.622 368-368 368z";return(0,a.jsx)("svg",l()(l()({},e),{},{viewBox:"0 0 1024 1024",children:(0,a.jsx)("path",{d:i})}))},be=t(50683),Te=Object.keys(be).map(function(c){return c.replace(/(Outlined|Filled|TwoTone)$/,"")}).filter(function(c,e,i){return i.indexOf(c)===e}),$=["StepBackward","StepForward","FastBackward","FastForward","Shrink","ArrowsAlt","Down","Up","Left","Right","CaretUp","CaretDown","CaretLeft","CaretRight","UpCircle","DownCircle","LeftCircle","RightCircle","DoubleRight","DoubleLeft","VerticalLeft","VerticalRight","VerticalAlignTop","VerticalAlignMiddle","VerticalAlignBottom","Forward","Backward","Rollback","Enter","Retweet","Swap","SwapLeft","SwapRight","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PlayCircle","UpSquare","DownSquare","LeftSquare","RightSquare","Login","Logout","MenuFold","MenuUnfold","BorderBottom","BorderHorizontal","BorderInner","BorderOuter","BorderLeft","BorderRight","BorderTop","BorderVerticle","PicCenter","PicLeft","PicRight","RadiusBottomleft","RadiusBottomright","RadiusUpleft","RadiusUpright","Fullscreen","FullscreenExit"],G=["Question","QuestionCircle","Plus","PlusCircle","Pause","PauseCircle","Minus","MinusCircle","PlusSquare","MinusSquare","Info","InfoCircle","Exclamation","ExclamationCircle","Close","CloseCircle","CloseSquare","Check","CheckCircle","CheckSquare","ClockCircle","Warning","IssuesClose","Stop"],H=["Edit","Form","Copy","Scissor","Delete","Snippets","Diff","Highlight","AlignCenter","AlignLeft","AlignRight","BgColors","Bold","Italic","Underline","Strikethrough","Redo","Undo","ZoomIn","ZoomOut","FontColors","FontSize","LineHeight","Dash","SmallDash","SortAscending","SortDescending","Drag","OrderedList","UnorderedList","RadiusSetting","ColumnWidth","ColumnHeight"],W=["AreaChart","PieChart","BarChart","DotChart","LineChart","RadarChart","HeatMap","Fall","Rise","Stock","BoxPlot","Fund","Sliders"],k=["Android","Apple","Windows","Ie","Chrome","Github","Aliwangwang","Dingding","WeiboSquare","WeiboCircle","TaobaoCircle","Html5","Weibo","Twitter","Wechat","Youtube","AlipayCircle","Taobao","Skype","Qq","MediumWorkmark","Gitlab","Medium","Linkedin","GooglePlus","Dropbox","Facebook","Codepen","CodeSandbox","CodeSandboxCircle","Amazon","Google","CodepenCircle","Alipay","AntDesign","AntCloud","Aliyun","Zhihu","Slack","SlackSquare","Behance","BehanceSquare","Dribbble","DribbbleSquare","Instagram","Yuque","Alibaba","Yahoo","Reddit","Sketch","WhatsApp","Dingtalk"],Ae=[].concat($,G,H,W,k),Me=Te.filter(function(c){return!Ae.includes(c)}),K={direction:$,suggestion:G,editor:H,data:W,logo:k,other:Me},Ue=null,A=function(c){return c.Filled="Filled",c.Outlined="Outlined",c.TwoTone="TwoTone",c}({}),Y=z,Ee=function(e){var i=e.onSelect,B=s.useState({theme:A.Outlined,searchKey:""}),m=I()(B,2),f=m[0],v=m[1],F=[],p=s.useCallback(ie()(function(h){v(function(r){return l()(l()({},r),{},{searchKey:h})})}),[]),j=s.useCallback(function(h){v(function(r){return l()(l()({},r),{},{theme:h.target.value})})},[]),C=s.useMemo(function(){var h=f.searchKey,r=h===void 0?"":h,u=f.theme,o=Object.keys(K).map(function(n){var d=K[n];if(r){var T=r.replace(new RegExp("^<([a-zA-Z]*)\\s/>$","gi"),function(S,R){return R}).replace(/(Filled|Outlined|TwoTone)$/,"").toLowerCase();d=d.filter(function(S){return S.toLowerCase().includes(T)})}return d=d.filter(function(S){return S!=="CopyrightCircle"}),{category:n,icons:d.map(function(S){return S+u}).filter(function(S){return Y[S]})}}).filter(function(n){var d=n.icons;return!!d.length}).map(function(n){var d=n.category,T=n.icons;return(0,a.jsx)(Ce,{title:d,theme:u,icons:T,newIcons:F,onSelect:function(R,w){i&&i(w,Y[w])}},d)});return o.length===0?(0,a.jsx)(ue.Z,{style:{margin:"2em 0"}}):o},[f.searchKey,f.theme]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between"},children:[(0,a.jsx)(re.ZP.Group,{value:f.theme,onChange:j,size:"large",optionType:"button",buttonStyle:"solid",options:[{label:(0,a.jsx)(P.Z,{component:je}),value:A.Outlined},{label:(0,a.jsx)(P.Z,{component:Ie}),value:A.Filled},{label:(0,a.jsx)(P.Z,{component:De}),value:A.TwoTone}]}),(0,a.jsx)(le.Z.Search,{style:{margin:"0 10px",flex:1},allowClear:!0,onChange:function(r){return p(r.currentTarget.value)},size:"large",autoFocus:!0,suffix:(0,a.jsx)(ye,{})})]}),C]})},Pe=Ee,Re=function(e){var i=ae.Z.useForm(),B=I()(i,1),m=B[0],f=(0,s.useState)("M"),v=I()(f,2),F=v[0],p=v[1],j=(0,s.useState)(),C=I()(j,2),h=C[0],r=C[1],u=(0,s.useState)(!1),o=I()(u,2),n=o[0],d=o[1],T=e.menuTree,S=e.visibleOptions,R=e.statusOptions;(0,s.useEffect)(function(){m.resetFields(),r(e.values.icon),p(e.values.menuType),m.setFieldsValue({id:e.values.id,name:e.values.name,parentId:e.values.parentId,orderNum:e.values.orderNum,path:e.values.path,component:e.values.component,query:e.values.query,isFrame:e.values.isFrame,isCache:e.values.isCache,menuType:e.values.menuType,visible:e.values.visible,status:e.values.status,perms:e.values.perms,icon:e.values.icon,createBy:e.values.createBy,createTime:e.values.createTime,updateBy:e.values.updateBy,updateTime:e.values.updateTime,remark:e.values.remark})},[m,e]);var w=(0,g.useIntl)(),Le=function(){m.submit()},Oe=function(){e.onCancel()},Ze=function(){var x=M()(b()().mark(function y(D){return b()().wrap(function(L){for(;;)switch(L.prev=L.next){case 0:e.onSubmit(D);case 1:case"end":return L.stop()}},y)}));return function(D){return x.apply(this,arguments)}}();return(0,a.jsxs)(N.Z,{width:640,title:"\u7F16\u8F91\u83DC\u5355\u6743\u9650",open:e.open,forceRender:!0,destroyOnClose:!0,onOk:Le,onCancel:Oe,children:[(0,a.jsxs)(q.A,{form:m,grid:!0,submitter:!1,layout:"horizontal",onFinish:Ze,children:[(0,a.jsx)(Z.Z,{name:"id",label:"\u83DC\u5355\u7F16\u53F7",placeholder:"\u8BF7\u8F93\u5165\u83DC\u5355\u7F16\u53F7",disabled:!0,hidden:!0,rules:[{required:!1,message:(0,a.jsx)(g.FormattedMessage,{id:"\u8BF7\u8F93\u5165\u83DC\u5355\u7F16\u53F7\uFF01",defaultMessage:"\u8BF7\u8F93\u5165\u83DC\u5355\u7F16\u53F7\uFF01"})}]}),(0,a.jsx)(_.Z,{name:"parentId",label:"\u4E0A\u7EA7\u83DC\u5355",params:{menuTree:T},request:M()(b()().mark(function x(){return b()().wrap(function(D){for(;;)switch(D.prev=D.next){case 0:return D.abrupt("return",[{name:"\u5168\u90E8",id:0,children:T}]);case 1:case"end":return D.stop()}},x)})),placeholder:"\u8BF7\u8F93\u5165\u7236\u83DC\u5355\u7F16\u53F7",fieldProps:{defaultValue:0,fieldNames:{label:"name",value:"id"}}}),(0,a.jsx)(V.Z.Group,{name:"menuType",valueEnum:{M:"\u76EE\u5F55",C:"\u83DC\u5355",F:"\u6309\u94AE"},label:"\u83DC\u5355\u7C7B\u578B",placeholder:"\u8BF7\u8F93\u5165\u83DC\u5355\u7C7B\u578B",rules:[{required:!1,message:(0,a.jsx)(g.FormattedMessage,{id:"\u8BF7\u8F93\u5165\u83DC\u5355\u7C7B\u578B\uFF01",defaultMessage:"\u8BF7\u8F93\u5165\u83DC\u5355\u7C7B\u578B\uFF01"})}],fieldProps:{onChange:function(y){p(y.target.value)}}}),(0,a.jsx)(ee.Z,{name:"icon",label:"\u83DC\u5355\u56FE\u6807",valueEnum:{},hidden:F==="F",addonBefore:(0,te.I)(h),fieldProps:{onClick:function(){d(!0)}},placeholder:"\u8BF7\u8F93\u5165\u83DC\u5355\u56FE\u6807",rules:[{required:!1,message:(0,a.jsx)(g.FormattedMessage,{id:"\u8BF7\u8F93\u5165\u83DC\u5355\u56FE\u6807\uFF01",defaultMessage:"\u8BF7\u8F93\u5165\u83DC\u5355\u56FE\u6807\uFF01"})}]}),(0,a.jsx)(E.Z,{name:"name",label:"\u83DC\u5355\u540D\u79F0",colProps:{md:12,xl:12},placeholder:"\u8BF7\u8F93\u5165\u83DC\u5355\u540D\u79F0",rules:[{required:!0,message:(0,a.jsx)(g.FormattedMessage,{id:"\u8BF7\u8F93\u5165\u83DC\u5355\u540D\u79F0\uFF01",defaultMessage:"\u8BF7\u8F93\u5165\u83DC\u5355\u540D\u79F0\uFF01"})}]}),(0,a.jsx)(Z.Z,{name:"orderNum",label:"\u663E\u793A\u987A\u5E8F",width:"lg",colProps:{md:12,xl:12},placeholder:"\u8BF7\u8F93\u5165\u663E\u793A\u987A\u5E8F",rules:[{required:!1,message:(0,a.jsx)(g.FormattedMessage,{id:"\u8BF7\u8F93\u5165\u663E\u793A\u987A\u5E8F\uFF01",defaultMessage:"\u8BF7\u8F93\u5165\u663E\u793A\u987A\u5E8F\uFF01"})}],fieldProps:{defaultValue:1}}),(0,a.jsx)(V.Z.Group,{name:"isFrame",valueEnum:{0:"\u662F",1:"\u5426"},initialValue:"1",label:"\u662F\u5426\u4E3A\u5916\u94FE",colProps:{md:12,xl:12},placeholder:"\u8BF7\u8F93\u5165\u662F\u5426\u4E3A\u5916\u94FE",hidden:F==="F",rules:[{required:!1,message:(0,a.jsx)(g.FormattedMessage,{id:"\u8BF7\u8F93\u5165\u662F\u5426\u4E3A\u5916\u94FE\uFF01",defaultMessage:"\u8BF7\u8F93\u5165\u662F\u5426\u4E3A\u5916\u94FE\uFF01"})}],fieldProps:{defaultValue:"1"}}),(0,a.jsx)(E.Z,{name:"path",label:"\u8DEF\u7531\u5730\u5740",width:"lg",colProps:{md:12,xl:12},placeholder:"\u8BF7\u8F93\u5165\u8DEF\u7531\u5730\u5740",hidden:F==="F",rules:[{required:F!=="F",message:(0,a.jsx)(g.FormattedMessage,{id:"\u8BF7\u8F93\u5165\u8DEF\u7531\u5730\u5740\uFF01",defaultMessage:"\u8BF7\u8F93\u5165\u8DEF\u7531\u5730\u5740\uFF01"})}]}),(0,a.jsx)(E.Z,{name:"perms",label:"\u6743\u9650\u6807\u8BC6",colProps:{md:12,xl:12},placeholder:"\u8BF7\u8F93\u5165\u6743\u9650\u6807\u8BC6",hidden:F==="M",rules:[{required:!1,message:(0,a.jsx)(g.FormattedMessage,{id:"\u8BF7\u8F93\u5165\u6743\u9650\u6807\u8BC6\uFF01",defaultMessage:"\u8BF7\u8F93\u5165\u6743\u9650\u6807\u8BC6\uFF01"})}]})]}),(0,a.jsx)(N.Z,{width:800,open:n,onCancel:function(){d(!1)},footer:null,children:(0,a.jsx)(Pe,{onSelect:function(y){m.setFieldsValue({icon:y}),r(y),d(!1)}})})]})},we=Re}}]);
|