UNPKG

amis-playground

Version:

amis-playground 是一个amis在线代码编辑器可实时预览运行效果

2 lines (1 loc) 3.42 kB
import{a as C,R as a,j as k,k as E,ap as S,E as g,bF as F,n as f,bG as w,e as L,f as d,p as u,q as n,aT as T,F as R,X as P}from"./index-7c288cb3.js";var O=function(c){C(e,c);function e(){var t=c!==null&&c.apply(this,arguments)||this;return t.domRef=a.createRef(),t.state={isOpened:!1},t}return e.prototype.close=function(){this.setState({isOpened:!1})},e.prototype.open=function(){this.setState({isOpened:!0})},e.prototype.handleClick=function(){this.state.isOpened?this.close():this.open()},e.prototype.handleChange=function(t){return k(this,void 0,void 0,function(){var o,i,r,s;return E(this,function(p){switch(p.label){case 0:return o=this.props,i=o.dispatchEvent,r=o.onChange,[4,i("change",P(this.props,{value:t}))];case 1:return s=p.sent(),s!=null&&s.prevented?[2]:(r(t),[2])}})})},e.prototype.getParent=function(){var t;return(t=this.domRef.current)===null||t===void 0?void 0:t.parentElement},e.prototype.getTarget=function(){return this.domRef.current},e.prototype.doAction=function(t,o,i){var r,s,p,l=this.props,v=l.resetValue,h=l.onChange,m=l.formStore,y=l.store,_=l.name,b=t==null?void 0:t.actionType;switch(b){case"clear":h("");break;case"reset":h==null||h((p=(s=S((r=m==null?void 0:m.pristine)!==null&&r!==void 0?r:y==null?void 0:y.pristine,_))!==null&&s!==void 0?s:v)!==null&&p!==void 0?p:"");break}},e.prototype.renderStatic=function(t){t===void 0&&(t="-");var o=this.props;o.classnames;var i=o.value,r=o.staticSchema,s=o.ak,p=o.coordinatesType,l=o.hideViewControl,v=l===void 0?!1:l;return this.props.translate,i?a.createElement("div",{className:this.props.classnames("LocationControl",{"is-mobile":g()}),ref:this.domRef},r!=null&&r.embed?a.createElement(a.Fragment,null,r.showAddress===!1?null:a.createElement("div",{className:"mb-2"},i.address),a.createElement(F,{ak:s,value:i,coordinatesType:p,autoSelectCurrentLoc:!1,onlySelectCurrentLoc:!0,showSug:!1,showGeoLoc:r.showGeoLoc,mapStyle:r.mapStyle,hideViewControl:v})):a.createElement("span",null,i.address)):a.createElement(a.Fragment,null,t)},e.prototype.render=function(){var t=this.props;t.style;var o=t.env;return f(this.props.ak,this.props.data)||o.locationPickerAK,a.createElement("div",{className:this.props.classnames("LocationControl",{"is-mobile":g()})},a.createElement(w,L({},this.props,{ak:f(this.props.ak,this.props.data),onChange:this.handleChange})))},e.defaultProps={vendor:"baidu",coordinatesType:"bd09"},d([u,n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"close",null),d([u,n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"open",null),d([u,n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"handleClick",null),d([u,n("design:type",Function),n("design:paramtypes",[Object]),n("design:returntype",Promise)],e.prototype,"handleChange",null),d([u,n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"getParent",null),d([u,n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"getTarget",null),d([T(),n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"render",null),e}(a.Component),A=function(c){C(e,c);function e(){return c!==null&&c.apply(this,arguments)||this}return e=d([R({type:"location-picker"})],e),e}(O);export{O as LocationControl,A as LocationRenderer};