2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[1411],{51411:function(Ne,O,t){t.r(O),t.d(O,{default:function(){return Ee}});var Q=t(90228),b=t.n(Q),J=t(87999),w=t.n(J),X=t(48305),B=t.n(X),s=t(50959),q=t(49547),Z=t(35748),_=t(80896),ee=t(36165),ae=t(27610),L=t(19014),te=t(50925),V=t(94675),C=t(7485),ne=t(27633),re=t(26068),l=t.n(re),N=t(83340),P=t(44706),ue=t(33938),le=t(47186),oe=t(41268),ie=t(66292),se=t.n(ie),ce=t(82092),de=t.n(ce),me=t(38546),ve=t(82187),fe=t.n(ve),z={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),he=N,ge=function(e){var i=e.name,y=e.justCopied,d=e.onSelect,f=e.theme,v=fe()(de()({copied:y===i},f,!!f));return(0,a.jsx)("li",{className:v,onClick:function(){d&&d(f,i)},children:(0,a.jsx)(me.Z,{title:i,children:s.createElement(he[i],{className:z.anticon})})})},Fe=ge,Ce=function(e){var i=e.icons,y=e.title,d=e.newIcons,f=e.theme,v=(0,C.useIntl)(),F=s.useState(null),S=B()(F,2),j=S[0],p=S[1],h=s.useRef(null),u=s.useCallback(function(r,o){var n=e.onSelect;n&&n(r,o),p(r),h.current=setTimeout(function(){p(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:z.anticonsList,children:i.map(function(r){return(0,a.jsx)(Fe,{name:r,theme:f,isNew:d.includes(r),justCopied:j,onSelect:u},r)})})]})},Se=Ce,pe=t(953),xe=t(25666),Be=t(57185),ze=null,Ue=pe.Z.Dragger,ye=function(){var e=(0,C.useIntl)(),i=e.formatMessage,y=(0,s.useState)({loading:!1,modalOpen:!1,popoverVisible:!1,icons:[],fileList:[],error:!1,modelLoaded:!1}),d=B()(y,2),f=d[0],v=d[1],F=function(r){try{var o=window.antdIconClassifier.predict(r);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(m){return l()(l()({},m),{},{loading:!1,error:!0})})}},S=function(r){return new Promise(function(o){var n=new Image;n.setAttribute("crossOrigin","anonymous"),n.src=r,n.onload=function(){o(n)}})},j=(0,s.useCallback)(function(u){v(function(o){return l()(l()({},o),{},{loading:!0})});var r=new FileReader;r.onload=function(){S(r.result).then(F),v(function(o){return l()(l()({},o),{},{fileList:[{uid:1,name:u.name,status:"done",url:r.result}]})})},r.readAsDataURL(u)},[]),p=(0,s.useCallback)(function(u){var r=u.clipboardData&&u.clipboardData.items,o=null;if(r&&r.length){for(var n=0;n<r.length;n++)if(r[n].type.includes("image")){o=r[n].getAsFile();break}}o&&j(o)},[]),h=(0,s.useCallback)(function(){v(function(u){return l()(l()({},u),{},{modalOpen:!u.modalOpen,popoverVisible:!1,fileList:[],icons:[]})}),localStorage.getItem("disableIconTip")||localStorage.setItem("disableIconTip","true")},[]);return(0,s.useEffect)(function(){var u=document.createElement("script");return u.onload=w()(b()().mark(function r(){return b()().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,window.antdIconClassifier.load();case 2:v(function(m){return l()(l()({},m),{},{modelLoaded:!0})}),document.addEventListener("paste",p);case 4:case"end":return n.stop()}},r)})),u.src="https://cdn.jsdelivr.net/gh/lewis617/antd-icon-classifier@0.0/dist/main.js",document.head.appendChild(u),v(function(r){return l()(l()({},r),{},{popoverVisible:!localStorage.getItem("disableIconTip")})}),function(){document.removeEventListener("paste",p)}},[]),(0,a.jsx)("div",{className:"iconPicSearcher",children:(0,a.jsx)(xe.Z,{open:f.popoverVisible,children:(0,a.jsx)(Be.Z,{className:"icon-pic-btn",onClick:h})})})},Ie=ye,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";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="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})}))},be=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})}))},Te=t(50683),Ae=Object.keys(Te).map(function(c){return c.replace(/(Outlined|Filled|TwoTone)$/,"")}).filter(function(c,e,i){return i.indexOf(c)===e}),U=["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"],$=["Question","QuestionCircle","Plus","PlusCircle","Pause","PauseCircle","Minus","MinusCircle","PlusSquare","MinusSquare","Info","InfoCircle","Exclamation","ExclamationCircle","Close","CloseCircle","CloseSquare","Check","CheckCircle","CheckSquare","ClockCircle","Warning","IssuesClose","Stop"],G=["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"],H=["AreaChart","PieChart","BarChart","DotChart","LineChart","RadarChart","HeatMap","Fall","Rise","Stock","BoxPlot","Fund","Sliders"],W=["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"],Me=[].concat(U,$,G,H,W),Re=Ae.filter(function(c){return!Me.includes(c)}),k={direction:U,suggestion:$,editor:G,data:H,logo:W,other:Re},$e=null,M=function(c){return c.Filled="Filled",c.Outlined="Outlined",c.TwoTone="TwoTone",c}({}),K=N,we=function(e){var i=e.onSelect,y=s.useState({theme:M.Outlined,searchKey:""}),d=B()(y,2),f=d[0],v=d[1],F=[],S=s.useCallback(se()(function(h){v(function(u){return l()(l()({},u),{},{searchKey:h})})}),[]),j=s.useCallback(function(h){v(function(u){return l()(l()({},u),{},{theme:h.target.value})})},[]),p=s.useMemo(function(){var h=f.searchKey,u=h===void 0?"":h,r=f.theme,o=Object.keys(k).map(function(n){var m=k[n];if(u){var A=u.replace(new RegExp("^<([a-zA-Z]*)\\s/>$","gi"),function(g,R){return R}).replace(/(Filled|Outlined|TwoTone)$/,"").toLowerCase();m=m.filter(function(g){return g.toLowerCase().includes(A)})}return m=m.filter(function(g){return g!=="CopyrightCircle"}),{category:n,icons:m.map(function(g){return g+r}).filter(function(g){return K[g]})}}).filter(function(n){var m=n.icons;return!!m.length}).map(function(n){var m=n.category,A=n.icons;return(0,a.jsx)(Se,{title:m,theme:r,icons:A,newIcons:F,onSelect:function(R,T){i&&i(T,K[T])}},m)});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)(le.ZP.Group,{value:f.theme,onChange:j,size:"large",optionType:"button",buttonStyle:"solid",options:[{label:(0,a.jsx)(P.Z,{component:De}),value:M.Outlined},{label:(0,a.jsx)(P.Z,{component:je}),value:M.Filled},{label:(0,a.jsx)(P.Z,{component:be}),value:M.TwoTone}]}),(0,a.jsx)(oe.Z.Search,{style:{margin:"0 10px",flex:1},allowClear:!0,onChange:function(u){return S(u.currentTarget.value)},size:"large",autoFocus:!0,suffix:(0,a.jsx)(Ie,{})})]}),p]})},Le=we,Pe=function(e){var i=te.Z.useForm(),y=B()(i,1),d=y[0],f=(0,s.useState)("M"),v=B()(f,2),F=v[0],S=v[1],j=(0,s.useState)("1"),p=B()(j,2),h=p[0],u=p[1],r=(0,s.useState)(),o=B()(r,2),n=o[0],m=o[1],A=(0,s.useState)(!1),g=B()(A,2),R=g[0],T=g[1],Y=e.menuTree,Ge=e.visibleOptions,He=e.statusOptions;(0,s.useEffect)(function(){d.resetFields(),m(e.values.icon),S(e.values.menuType),S(e.values.isFrame),d.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})},[d,e]);var We=(0,C.useIntl)(),Oe=function(){d.submit()},Ze=function(){e.onCancel()},Ve=function(){var x=w()(b()().mark(function I(D){return b()().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:e.onSubmit(D);case 1:case"end":return E.stop()}},I)}));return function(D){return x.apply(this,arguments)}}();return(0,a.jsxs)(V.Z,{width:640,title:"\u7F16\u8F91\u83DC\u5355\u6743\u9650",open:e.open,forceRender:!0,destroyOnClose:!0,onOk:Oe,onCancel:Ze,children:[(0,a.jsxs)(q.A,{form:d,grid:!0,submitter:!1,layout:"horizontal",onFinish:Ve,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)(C.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:Y},request:w()(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:Y}]);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)(ee.Z.Group,{name:"menuType",options:[{label:"\u76EE\u5F55",value:"M"},{label:"\u83DC\u5355",value:"C"},{label:"\u6309\u94AE",value:"F"}],label:"\u83DC\u5355\u7C7B\u578B",placeholder:"\u8BF7\u8F93\u5165\u83DC\u5355\u7C7B\u578B",rules:[{required:!1,message:(0,a.jsx)(C.FormattedMessage,{id:"\u8BF7\u8F93\u5165\u83DC\u5355\u7C7B\u578B\uFF01",defaultMessage:"\u8BF7\u8F93\u5165\u83DC\u5355\u7C7B\u578B\uFF01"})}],fieldProps:{onChange:function(I){S(I.target.value)}}}),(0,a.jsx)(ae.Z,{name:"icon",label:"\u83DC\u5355\u56FE\u6807",valueEnum:{},hidden:F==="F",addonBefore:(0,ne.I)(n),fieldProps:{onClick:function(){T(!0)}},placeholder:"\u8BF7\u8F93\u5165\u83DC\u5355\u56FE\u6807",rules:[{required:!1,message:(0,a.jsx)(C.FormattedMessage,{id:"\u8BF7\u8F93\u5165\u83DC\u5355\u56FE\u6807\uFF01",defaultMessage:"\u8BF7\u8F93\u5165\u83DC\u5355\u56FE\u6807\uFF01"})}]}),(0,a.jsx)(L.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)(C.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)(C.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)(L.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)(C.FormattedMessage,{id:"\u8BF7\u8F93\u5165\u8DEF\u7531\u5730\u5740\uFF01",defaultMessage:"\u8BF7\u8F93\u5165\u8DEF\u7531\u5730\u5740\uFF01"})}]}),(0,a.jsx)(L.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)(C.FormattedMessage,{id:"\u8BF7\u8F93\u5165\u6743\u9650\u6807\u8BC6\uFF01",defaultMessage:"\u8BF7\u8F93\u5165\u6743\u9650\u6807\u8BC6\uFF01"})}]})]}),(0,a.jsx)(V.Z,{width:800,open:R,onCancel:function(){T(!1)},footer:null,children:(0,a.jsx)(Le,{onSelect:function(I){d.setFieldsValue({icon:I}),m(I),T(!1)}})})]})},Ee=Pe}}]);
|