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.
1 lines
3.7 KiB
1 lines
3.7 KiB
"use strict";(self.webpackChunkantd=self.webpackChunkantd||[]).push([[4646],{657977:function(te,h,t){t.r(h);var R=t(805574),l=t.n(R),a=t(513669),P=t(218537),x=t(605042),Z=t(704650),I=t(606641),s=t(667294),j=t(302559),e=t(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 A=s.lazy(function(){return Promise.all([t.e(3459),t.e(2494)]).then(t.bind(t,192494))});function L(c){return Object.prototype.toString.call(c)==="[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..."}},U={name:"zbl8st",styles:"display:flex;height:56px;align-items:center;padding:0 24px;justify-content:space-between;border-bottom:1px solid #F0F0F0"},B=function(){return{header:U}},v="ant-design-v5-theme-editor-theme",N=function(){var J=a.message.useMessage(),E=l()(J,2),g=E[0],K=E[1],W=(0,j.Z)(b),C=l()(W,2),n=C[0],k=C[1],F=s.useState({}),p=l()(F,2),_=p[0],m=p[1],$=(0,s.useState)(!1),S=l()($,2),z=S[0],y=S[1],H=(0,s.useState)(!0),T=l()(H,2),O=T[0],G=T[1],V=(0,s.useState)({text:"{}",json:void 0}),M=l()(V,2),d=M[0],f=M[1];(0,s.useEffect)(function(){var i=localStorage.getItem(v);if(i){var o=JSON.parse(i),r={json:o,text:void 0};f(r),m(o)}},[]);var Y=B(),Q=function(){localStorage.setItem(v,JSON.stringify(_)),g.success(n.saveSuccessfully)},X=function(){y(!0)},D=(0,s.useCallback)(function(){y(!1)},[d]),w=function(o,r,u){f(o),G(!u.contentErrors)},q=(0,s.useCallback)(function(){var i=!O;if(i){a.message.error(n.editJsonContentTypeError);return}var o=d.text?JSON.parse(d.text):d.json;if(!L(o)){a.message.error(n.editJsonContentTypeError);return}m(o),D(),g.success(n.editSuccessfully)},[d,O]),ee=function(){var o=new File([JSON.stringify(_,null,2)],"Ant Design Theme.json",{type:"text/json; charset=utf-8;"}),r=document.createElement("a"),u=URL.createObjectURL(o);r.href=u,r.download=o.name,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(u)};return(0,e.tZ)("div",null,(0,e.tZ)(I.ql,null,(0,e.tZ)("title",null,"".concat(n.title," - Ant Design")),(0,e.tZ)("meta",{property:"og:title",content:"".concat(n.title," - Ant Design")})),K,(0,e.tZ)(a.ConfigProvider,{theme:{inherit:!1}},(0,e.tZ)("div",{css:Y.header},(0,e.tZ)(a.Typography.Title,{level:5,style:{margin:0}},n.title),(0,e.tZ)("div",null,(0,e.tZ)(a.Modal,{open:z,title:n.editModelTitle,width:600,okText:n.save,onOk:q,onCancel:D},(0,e.tZ)(s.Suspense,{fallback:(0,e.tZ)("div",{style:{textAlign:"center",width:"100%",padding:"24px 0"}},(0,e.tZ)(a.Spin,{tip:n.initialEditor}))},(0,e.tZ)(A,{content:d,onChange:w,mainMenuBar:!1}))),(0,e.tZ)(a.Button,{onClick:ee,style:{marginRight:8}},n.export),(0,e.tZ)(a.Button,{onClick:X,style:{marginRight:8}},n.edit),(0,e.tZ)(a.Button,{type:"primary",onClick:Q},n.save))),(0,e.tZ)(P.Z,{theme:{name:"Custom Theme",key:"test",config:_},style:{height:"calc(100vh - 64px - 56px)"},onThemeChange:function(o){m(o.config),f({json:o.config,text:void 0})},locale:k==="cn"?x.Z:Z.Z})))};h.default=N}}]);
|
|
|