{ "pandav:/index.js": { "cubeCode": "Cube('pandav:/com/weather/1.1.0',['pandav:/npm/bcore/0.0.18/event','pandav:/npm/react/17.0.2','pandav:/npm/react-dom/17.0.2','pandav:/com/weather/1.1.0/weather.jsx','pandav:/npm/jquery/2.1.4'],function(a,b,c){var d=c('pandav:/npm/bcore/0.0.18/event'),e=c('pandav:/npm/react/17.0.2'),f=c('pandav:/npm/react-dom/17.0.2'),g=c('pandav:/com/weather/1.1.0/weather.jsx'),h=c('pandav:/npm/jquery/2.1.4');return a.exports=d.extend(function(a,b){this.config={theme:{}},this.container=a,this.apis=b.apis,this.containSize={boxWidth:h(a)&&h(a).width(),boxHeight:h(a)&&h(a).height()},this.init(b)},{init:function(a){this.mergeConfig(a)},mergeConfig:function(a){var b;return a?(b=a,this.config=a):b=this.config,b},updateOptions:function(a){this.render(this._data,a)},data:function(a){return a&&(this._data=a),this._data},setColors:function(){},resize:function(a,b){this.containSize={boxWidth:a,boxHeight:b},this.render(this._data,this.config)},render:function(a,b){a=this.data(a);var c=this.mergeConfig(b),d={width:this.containSize.boxWidth,height:this.containSize.boxHeight,emitEvent:this.emit.bind(this),configuration:c?.options,data:a,id:this.__id};f.render(e.createElement(g,d),this.container)},destroy:function(){return!!this.container&&void(f.unmountComponentAtNode(this.container),this.container.innerHTML='')}}),a.exports});", "requires": [ "pandav:/weather.jsx" ], "buildLevel": 1, "outputDir": "/com/weather/1.1.0", "outputPath": "/com/weather/1.1.0/index.js", "fileName": "/index.js" }, "pandav:/weather.jsx": { "cubeCode": "Cube('pandav:/com/weather/1.1.0/weather.jsx',['pandav:/npm/react/17.0.2','pandav:/npm/lodash/4.6.1','pandav:/com/cube-chart/0.0.2'],function(a,b,c){function d(a){\"@babel/helpers - typeof\";return d='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&'function'==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?'symbol':typeof a},d(a)}function e(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function f(a,b){for(var c,d=0;dc&&(d.refresh(),b+=g(h/c)*c),d.timer=requestAnimationFrame(e)};d.timer=requestAnimationFrame(e)}};var f=a.data,g=a.configuration;return c.state={weatherData:f[0]},c.data=f,c.config=g,c.timer=null,c.refresh(),c}return p(b,a),g(b,[{key:'refresh',value:function a(){var b=this;this.imageList=this.config.imageList.icon;var c=this.config.chart.date,d='https://restapi.amap.com/v3/weather/weatherInfo?city='+this.config.chart.currentWeather+'&key=4d3847e60090e1c4d602a2077136c906&extensions=all';'100000'==this.config.chart.currentWeather?null:r(d,function(a){var d=a.forecasts[0].casts[c],e=[{weather:d.dayweather,temperature:{min:d.nighttemp,max:d.daytemp},wind:d.daywind+'\\u98CE'+d.daypower+'\\u7EA7'}];b.setState({weatherData:e[0]})})}},{key:'componentDidMount',value:function a(){var b=this.config.chart.update;this.updateWeather(b)}},{key:'UNSAFE_componentWillReceiveProps',value:function b(a){cancelAnimationFrame(this.timer),this.config=a.configuration;var c=this.config.chart.update;this.refresh();var d=t.isEqual(this.props.data,a.data);d||this.setState({weatherData:a.data[0]}),this.updateWeather(c)}},{key:'render',value:function a(){var b=this.props,c=b.id,d=b.width,e=b.height,f=this.config,g=f.infoList,h=g.nameInfo,i=g.temperatureInfo,j=g.windInfo,k=f.chart,l=k.weatherIcon,m=k.weatherInfo,n=f.chart,o=this.state.weatherData;return s.createElement('div',{className:'__pandav-component',style:{position:'absolute',width:d,height:e},id:c},s.createElement(w,{weatherData:o,styles:n},s.createElement(x,{styles:l,weatherData:o,imageList:this.imageList}),s.createElement(y,{styles:m},h.turnOn&&s.createElement(z,{styles:h,weatherData:o}),i.turnOn&&s.createElement(A,{styles:i,weatherData:o}),j.turnOn&&s.createElement(B,{styles:j,weatherData:o,dir:m.flexDirection}))))}}]),b}(s.Component),w=function b(a){var c=a.weatherData,d=a.children,e=a.styles;return c?s.createElement('div',{style:{display:'flex',height:'100%',flexDirection:e.weatherIcon.flexDirection,alignItems:'center',justifyContent:'space-between'}},d):null},x=function b(a){var c=a.styles,d=c.flexDirection,e=c.size,f=c.color,g=c.marginRight,h=c.marginBottom,i=a.weatherData,j=a.imageList,k=u(f,1),l={晴:D,多云:E,阴:F,阵雨:G,阵雪:H,雷阵雨并伴有冰雹:I,雷阵雨:I,雨:J,雨夹雪:J,小雨:J,中雨:J,大雨:K,暴雨:J,大暴雨:J,\"小雨-中雨\":J,\"中雨-大雨\":J,\"大雨-暴雨\":J,\"暴雨-大暴雨\":J,\"大暴雨-特大暴雨\":J,弱高吹雪:L,雪:L,小雪:L,大雪:M,暴雪:L,\"小雪-中雪\":L,\"中雪-大雪\":L,\"大雪-暴雪\":L,风:N,飑:N,龙卷风:N,雾:O,轻雾:O,霾:O,浮尘:N,扬沙:N,强沙尘暴:N},m=l[i.weather];return s.createElement('div',{style:{display:'flex',alignItems:'center',justifyContent:'center',width:e,height:e,marginRight:'row'===d?g:0,marginBottom:'column'===d?h:0}},(m?m:C)(k,j,i.weather).map(function(a,b){return s.createElement('span',{style:Object.assign({},a,{backgroundBlendMode:'overlay',position:'absolute',width:e,height:e}),key:b})}))},y=function b(a){var c=a.children,d=a.styles,e=d.flexDirection,f=d.alignItems,g=d.reverse;return s.createElement('div',{style:{height:'100%',display:'flex',flex:1,justifyContent:'space-between',alignItems:'column'===e?f:'center',flexDirection:g?''.concat(e,'-reverse'):e}},c)},z=function b(a){var c=a.weatherData,d=a.styles.text,e=d.textStyle,f=d.textTranslate;return s.createElement('div',{style:Object.assign({},e,{fontWeight:e.fontWeight,fontStyle:e.italic,transform:'translate3d('+f.x+'px,'+f.y+'px, 0)'})},s.createElement('span',null,c.weather))},A=function b(a){var c=a.styles,d=c.connector,e=c.text,f=e.textStyle.color,g=e.textTranslate,h=e.textStyle,i=c.suffix,j=a.weatherData,k={color:f};return j.temperature?s.createElement('div',{style:Object.assign({display:'flex',alignItems:'baseline'},h,{},{fontWeight:h.fontWeight,fontStyle:h.italic},k,{},{transform:'translate3d('+g.x+'px,'+g.y+'px, 0)'})},s.createElement('span',null,j.temperature.min),s.createElement('span',null,d),s.createElement('span',null,j.temperature.max),i.show&&s.createElement('span',{style:Object.assign(Object.assign({},i.textStyle),{},{fontWeight:i.textStyle.fontWeight,fontStyle:i.textStyle.italic,transform:'translate3d('+i.textTranslate.x+'px,'+i.textTranslate.y+'px, 0)'})},i.content)):null},B=function b(a){var c=a.styles.text,d=c.textStyle,e=c.textTranslate,f=a.weatherData,g=a.dir;return f.wind?s.createElement('div',{style:Object.assign(Object.assign({display:'flex',flexDirection:g},d),{},{fontWeight:d.fontWeight,fontStyle:d.italic,transform:'translate3d('+e.x+'px,'+e.y+'px, 0)'})},f.wind.direction&&f.wind.level?s.createElement(s.Fragment,null,s.createElement('span',null,f.wind.direction),s.createElement('span',null,f.wind.level,'\\u7EA7')):s.createElement('span',null,f.wind)):null},C=function e(c,d){var e,f=c.r,h=c.g,g=c.b,b=c.a;for(var a in d)'\\u6674\\u5929'===d[a].value&&(e=d[a].url);return[{WebkitMask:'url('+e+') 0px 0px / 100% 100%',backgroundImage:'url('+e+')',backgroundColor:'rgba('+f+', '+h+', '+g+', '+b+')',backgroundPosition:'0px 0px',backgroundSize:'100% 100%',backgroundRepeat:'no-repeat'}]},D=function e(c,d){var e,f=c.r,h=c.g,g=c.b,b=c.a;for(var a in d)'\\u6674\\u5929'===d[a].value&&(e=d[a].url);return[{WebkitMask:'url('+e+') 0px 0px / 100% 100%',backgroundImage:'url('+e+')',backgroundColor:'rgba('+f+', '+h+', '+g+', '+b+')',backgroundPosition:'0px 0px',backgroundSize:'100% 100%',backgroundRepeat:'no-repeat'}]},E=function e(c,d){var e,f=c.r,h=c.g,g=c.b,b=c.a;for(var a in d)'\\u591A\\u4E91'===d[a].value&&(e=d[a].url);return[{WebkitMask:'url('+e+') 0px 0px / 100% 100%',backgroundImage:'url('+e+')',backgroundColor:'rgba('+f+', '+h+', '+g+', '+b+')',backgroundPosition:'0px 0px',backgroundSize:'100% 100%',backgroundRepeat:'no-repeat'}]},F=function e(c,d){var e,f=c.r,h=c.g,g=c.b,b=c.a;for(var a in d)'\\u9634'===d[a].value&&(e=d[a].url);return[{WebkitMask:'url('+e+') 0px 0px / 100% 100%',backgroundImage:'url('+e+')',backgroundColor:'rgba('+f+', '+h+', '+g+', '+b+')',backgroundPosition:'0px 0px',backgroundSize:'100% 100%',backgroundRepeat:'no-repeat'}]},G=function e(c,d){var e,f=c.r,h=c.g,g=c.b,b=c.a;for(var a in d)'\\u9635\\u96E8'===d[a].value&&(e=d[a].url);return[{WebkitMask:'url('+e+') 0px 0px / 100% 100%',backgroundImage:'url('+e+')',backgroundColor:'rgba('+f+', '+h+', '+g+', '+b+')',backgroundPosition:'0px 0px',backgroundSize:'100% 100%',backgroundRepeat:'no-repeat'}]},H=function e(c,d){var e,f=c.r,h=c.g,g=c.b,b=c.a;for(var a in d)'\\u9635\\u96EA'===d[a].value&&(e=d[a].url);return[{WebkitMask:'url('+e+') 0px 0px / 100% 100%',backgroundImage:'url('+e+')',backgroundColor:'rgba('+f+', '+h+', '+g+', '+b+')',backgroundPosition:'0px 0px',backgroundSize:'100% 100%',backgroundRepeat:'no-repeat'}]},I=function e(c,d){var e,f=c.r,h=c.g,g=c.b,b=c.a;for(var a in d)'\\u96F7\\u9635\\u96E8'===d[a].value&&(e=d[a].url);return[{WebkitMask:'url('+e+') 0px 0px / 100% 100%',backgroundImage:'url('+e+')',backgroundColor:'rgba('+f+', '+h+', '+g+', '+b+')',backgroundPosition:'0px 0px',backgroundSize:'100% 100%',backgroundRepeat:'no-repeat'}]},J=function f(c,d,e){var f,h=c.r,i=c.g,g=c.b,b=c.a;for(var a in d){var j=d[a].value;if(j.includes('\\u96E8')&&(f=d[a].url,j===e))break}return[{WebkitMask:'url('+f+') 0px 0px / 100% 100%',backgroundImage:'url('+f+')',backgroundColor:'rgba('+h+', '+i+', '+g+', '+b+')',backgroundPosition:'0px 0px',backgroundSize:'100% 100%',backgroundRepeat:'no-repeat'}]},K=function e(c,d){var e,f=c.r,h=c.g,g=c.b,b=c.a;for(var a in d)'\\u5927\\u96E8'===d[a].value&&(e=d[a].url);return[{WebkitMask:'url('+e+') 0px 0px / 100% 100%',backgroundImage:'url('+e+')',backgroundColor:'rgba('+f+', '+h+', '+g+', '+b+')',backgroundPosition:'0px 0px',backgroundSize:'100% 100%',backgroundRepeat:'no-repeat'}]},L=function f(c,d,e){var f,h=c.r,i=c.g,g=c.b,b=c.a;for(var a in d){var j=d[a].value;if(j.includes('\\u96EA')&&(f=d[a].url,j===e))break}return[{WebkitMask:'url('+f+') 0px 0px / 100% 100%',backgroundImage:'url('+f+')',backgroundColor:'rgba('+h+', '+i+', '+g+', '+b+')',backgroundPosition:'0px 0px',backgroundSize:'100% 100%',backgroundRepeat:'no-repeat'}]},M=function e(c,d){var f,h=c.r,i=c.g,g=c.b,b=c.a;for(var a in d)'\\u5927\\u96EA'===d[a].value&&(f=d[a].url);return[{WebkitMask:'url('+f+') 0px 0px / 100% 100%',backgroundImage:'url('+f+')',backgroundColor:'rgba('+h+', '+i+', '+g+', '+b+')',backgroundPosition:'0px 0px',backgroundSize:'100% 100%',backgroundRepeat:'no-repeat'}]},N=function f(c,d,e){var f,h=c.r,i=c.g,g=c.b,b=c.a;for(var a in d){var j=d[a].value;if(j.includes('\\u98CE')&&(f=d[a].url,j===e))break}return[{WebkitMask:'url('+f+') 0px 0px / 100% 100%',backgroundImage:'url('+f+')',backgroundColor:'rgba('+h+', '+i+', '+g+', '+b+')',backgroundPosition:'0px 0px',backgroundSize:'100% 100%',backgroundRepeat:'no-repeat'}]},O=function f(c,d,e){var f,h=c.r,i=c.g,g=c.b,b=c.a;for(var a in d){var j=d[a].value;if((j.includes('\\u96FE')||j.includes('\\u973E'))&&(f=d[a].url,j===e))break}return[{WebkitMask:'url('+f+') 0px 0px / 100% 100%',backgroundImage:'url('+f+')',backgroundColor:'rgba('+h+', '+i+', '+g+', '+b+')',backgroundPosition:'0px 0px',backgroundSize:'100% 100%',backgroundRepeat:'no-repeat'}]};return a.exports=v,a.exports});", "requires": [], "buildLevel": 2, "outputDir": "/com/weather/1.1.0", "outputPath": "/com/weather/1.1.0/weather.jsx", "fileName": "/weather.jsx" } }