diff --git a/designer/395.async.js b/designer/395.async.js index 3e70cf9..57a11b8 100644 --- a/designer/395.async.js +++ b/designer/395.async.js @@ -931,7 +931,7 @@ background-color: #fff; } } -`;class o5 extends i().Component{constructor(e){super(e),this.changeRelativeUrl=e=>{e!==this.state.relativeUrl&&this.setState({relativeUrl:e})},this.onInputChange=e=>{const t=e.target.value.startsWith("/")?e.target.value:`/${e.target.value}`;this.changeRelativeUrl(t)},this.onPressEnter=e=>{var t,n;const r=e.currentTarget.value;null===(n=(t=this.props).onInputEnter)||void 0===n||n.call(t,r,e)},this.state={relativeUrl:e.startRoute||"/"}}componentDidUpdate(e,t){this.props.startRoute&&e.startRoute!==this.props.startRoute&&this.props.startRoute!==t.relativeUrl&&this.setState({relativeUrl:this.props.startRoute})}render(){const{disabled:e,onBack:t,onForward:n,onRefresh:r}=this.props;return i().createElement(c.xu,{className:"navigator",bg:"white",px:"l",py:"m",borderBottom:"solid",borderBottomColor:"line.normal",css:s5},i().createElement(c.xu,null,i().createElement(Ve,{icon:i().createElement(H2,null),onClick:t,title:"返回"}),i().createElement(Ve,{icon:i().createElement(t5,null),onClick:n,title:"前进"}),i().createElement(Ve,{icon:i().createElement(i5,null),onClick:r,title:"刷新"})),i().createElement(u.Input,{className:"navigatorInput",size:"small",value:this.state.relativeUrl,onChange:this.onInputChange,onPressEnter:this.onPressEnter,disabled:e}),i().createElement(a5,null))}}const a5=w((()=>{const e=I();return i().createElement(c.ZA,{attached:!0},i().createElement(Fe,{size:"s",selected:"desktop"===e.simulator.name,onClick:()=>{e.setSimulator("desktop")}},i().createElement(RJ,null)),i().createElement(Fe,{size:"s",selected:"phone"===e.simulator.name,onClick:()=>{e.setSimulator("phone")}},i().createElement(LJ,null)))}));function l5({isPreview:e,configFormatter:t,filesFormatter:n,onViewChange:r,onMessage:i,onLoad:s,sandboxType:o,startRoute:a,injectScript:c}={}){const u=D(),p=I(),d=l(),f=null!=e?e:p.isPreview,h=()=>f===p.isPreview,m=h(),g=()=>({sandboxQuery:d,isPreview:f,isActive:h(),sandboxType:o}),y=R2({sandboxQuery:d,workspace:u,designer:p,onViewChange:e=>r&&r(e,g())});let _=Array.from(u.files.keys()).reduce(((e,n)=>{let r=u.getFile(n).code;return"/tango.config.json"===n&&(r=function(e,{isPreview:t,injectScript:n,formatter:r}={}){let i;try{i=JSON.parse(e)}catch(t){return S$.kg.error("Json parse failed!",t),e}const s=(0,W.NA)(i,"sandbox.evaluateJavaScript")||"";let o=s;n&&(o=`${o};${n}`);s!==o&&(0,W.sO)(i,"sandbox.evaluateJavaScript",o);const a=(0,W.NA)(i,"packages"),l=(0,W.NA)(i,"sandbox.externals")||{},c=(0,W.NA)(i,"sandbox.externalResources")||[],u=(0,W.NA)(i,"externalResources")||[];if(a){const e=(e,t)=>{const n=e.map((e=>e.replace(/{{(.*?)}}/g,((e,n)=>(null==t?void 0:t[n])||e))));c.push(...n)},n=(e,t)=>{t&&(l[e]=t)};Object.keys(a).forEach((r=>{const i=a[r];i.designerResources&&!t?(e(i.designerResources,{name:r,version:i.version}),n(r,i.library)):i.resources&&(e(i.resources,{name:r,version:i.version}),n(r,i.library))}))}(null==u?void 0:u.length)&&c.push(...u);(0,W.sO)(i,"sandbox.externals",l),(0,W.sO)(i,"sandbox.externalResources",[...new Set(c)]),(0,gK.mf)(r)&&(i=null==r?void 0:r(i));return JSON.stringify(i)}(r,{isPreview:f,injectScript:c,formatter:t})),e[n]={code:r},e}),{});_=function(e,t="/src/index.js"){if(e["/tango.config.json"]){const t=e["/tango.config.json"].code,n=JSON.parse(t);e["/sandbox.config.json"]={code:JSON.stringify(n.sandbox,null,2)}}e["/index.html"]||(e["/index.html"]={code:`\n \n \n
\n \n \n \n