You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
3.7 KiB

"use strict";(self.webpackChunkantd=self.webpackChunkantd||[]).push([[9482,4646],{368824:function(P,u,e){e.r(u);var _=e(657977);u.default=_.default},657977:function(P,u,e){e.r(u);var _=e(805574),r=e.n(_),a=e(513669),I=e(218537),Z=e(605042),x=e(704650),j=e(606641),s=e(667294),A=e(302559),t=e(370917);function ne(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}var L=s.lazy(function(){return Promise.all([e.e(3459),e.e(2494)]).then(e.bind(e,192494))});function U(m){return Object.prototype.toString.call(m)==="[object Object]"}var b={cn:{title:"\u4E3B\u9898\u7F16\u8F91\u5668",save:"\u4FDD\u5B58",edit:"\u7F16\u8F91",export:"\u5BFC\u51FA",editModelTitle:"\u7F16\u8F91\u4E3B\u9898\u914D\u7F6E",editJsonContentTypeError:"\u4E3B\u9898 JSON \u683C\u5F0F\u9519\u8BEF",editSuccessfully:"\u7F16\u8F91\u6210\u529F",saveSuccessfully:"\u4FDD\u5B58\u6210\u529F",initialEditor:"\u6B63\u5728\u521D\u59CB\u5316\u7F16\u8F91\u5668..."},en:{title:"Theme Editor",save:"Save",edit:"Edit",export:"Export",editModelTitle:"edit Theme Config",editJsonContentTypeError:"The theme of the JSON format is incorrect",editSuccessfully:"Edited successfully",saveSuccessfully:"Saved successfully",initialEditor:"Initializing Editor..."}},B={name:"zbl8st",styles:"display:flex;height:56px;align-items:center;padding:0 24px;justify-content:space-between;border-bottom:1px solid #F0F0F0"},N=function(){return{header:B}},v="ant-design-v5-theme-editor-theme",J=function(){var K=a.message.useMessage(),g=r()(K,2),C=g[0],W=g[1],F=(0,A.Z)(b),p=r()(F,2),n=p[0],k=p[1],$=s.useState({}),O=r()($,2),f=O[0],h=O[1],z=(0,s.useState)(!1),S=r()(z,2),H=S[0],T=S[1],G=(0,s.useState)(!0),y=r()(G,2),M=y[0],V=y[1],Y=(0,s.useState)({text:"{}",json:void 0}),D=r()(Y,2),d=D[0],E=D[1];(0,s.useEffect)(function(){var i=localStorage.getItem(v);if(i){var o=JSON.parse(i),l={json:o,text:void 0};E(l),h(o)}},[]);var Q=N(),X=function(){localStorage.setItem(v,JSON.stringify(f)),C.success(n.saveSuccessfully)},w=function(){T(!0)},R=(0,s.useCallback)(function(){T(!1)},[d]),q=function(o,l,c){E(o),V(!c.contentErrors)},ee=(0,s.useCallback)(function(){var i=!M;if(i){a.message.error(n.editJsonContentTypeError);return}var o=d.text?JSON.parse(d.text):d.json;if(!U(o)){a.message.error(n.editJsonContentTypeError);return}h(o),R(),C.success(n.editSuccessfully)},[d,M]),te=function(){var o=new File([JSON.stringify(f,null,2)],"Ant Design Theme.json",{type:"text/json; charset=utf-8;"}),l=document.createElement("a"),c=URL.createObjectURL(o);l.href=c,l.download=o.name,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(c)};return(0,t.tZ)("div",null,(0,t.tZ)(j.ql,null,(0,t.tZ)("title",null,"".concat(n.title," - Ant Design")),(0,t.tZ)("meta",{property:"og:title",content:"".concat(n.title," - Ant Design")})),W,(0,t.tZ)(a.ConfigProvider,{theme:{inherit:!1}},(0,t.tZ)("div",{css:Q.header},(0,t.tZ)(a.Typography.Title,{level:5,style:{margin:0}},n.title),(0,t.tZ)("div",null,(0,t.tZ)(a.Modal,{open:H,title:n.editModelTitle,width:600,okText:n.save,onOk:ee,onCancel:R},(0,t.tZ)(s.Suspense,{fallback:(0,t.tZ)("div",{style:{textAlign:"center",width:"100%",padding:"24px 0"}},(0,t.tZ)(a.Spin,{tip:n.initialEditor}))},(0,t.tZ)(L,{content:d,onChange:q,mainMenuBar:!1}))),(0,t.tZ)(a.Button,{onClick:te,style:{marginRight:8}},n.export),(0,t.tZ)(a.Button,{onClick:w,style:{marginRight:8}},n.edit),(0,t.tZ)(a.Button,{type:"primary",onClick:X},n.save))),(0,t.tZ)(I.Z,{theme:{name:"Custom Theme",key:"test",config:f},style:{height:"calc(100vh - 64px - 56px)"},onThemeChange:function(o){h(o.config),E({json:o.config,text:void 0})},locale:k==="cn"?Z.Z:x.Z})))};u.default=J}}]);