2 lines
3.4 KiB
JavaScript
2 lines
3.4 KiB
JavaScript
import{t as f,l as a,G as _,H as k,am as E,bY as S,L as g,bZ as w,z as L,D as d,Q as h,T as n,ap as F,a2 as T,ah as R}from"./index-CEmnTf-r.js";var P=function(c){f(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 _(this,void 0,void 0,function(){var o,i,r,s;return k(this,function(p){switch(p.label){case 0:return o=this.props,i=o.dispatchEvent,r=o.onChange,[4,i("change",R(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,m=l.resetValue,u=l.onChange,v=l.formStore,y=l.store,C=l.name,b=t==null?void 0:t.actionType;switch(b){case"clear":u("");break;case"reset":u==null||u((p=(s=E((r=v==null?void 0:v.pristine)!==null&&r!==void 0?r:y==null?void 0:y.pristine,C))!==null&&s!==void 0?s:m)!==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,m=l===void 0?!1:l,u=o.mobileUI;return this.props.translate,i?a.createElement("div",{className:this.props.classnames("LocationControl",{"is-mobile":u}),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(S,{ak:s,value:i,coordinatesType:p,autoSelectCurrentLoc:!1,onlySelectCurrentLoc:!0,showSug:!1,showGeoLoc:r.showGeoLoc,mapStyle:r.mapStyle,hideViewControl:m})):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,i=t.mobileUI;return g(this.props.ak,this.props.data)||o.locationPickerAK,a.createElement("div",{className:this.props.classnames("LocationControl",{"is-mobile":i})},a.createElement(w,L({},this.props,{ak:g(this.props.ak,this.props.data),onChange:this.handleChange})))},e.defaultProps={vendor:"baidu",coordinatesType:"bd09"},d([h,n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"close",null),d([h,n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"open",null),d([h,n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"handleClick",null),d([h,n("design:type",Function),n("design:paramtypes",[Object]),n("design:returntype",Promise)],e.prototype,"handleChange",null),d([h,n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"getParent",null),d([h,n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"getTarget",null),d([F(),n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"render",null),e}(a.Component),O=function(c){f(e,c);function e(){return c!==null&&c.apply(this,arguments)||this}return e=d([T({type:"location-picker"})],e),e}(P);export{P as LocationControl,O as LocationRenderer};
|