Current Path : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/landing/node/map/dist/ |
Current File : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/landing/node/map/dist/map.bundle.min.js |
this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};(function(t,a){"use strict";const e=BX.Landing.Utils.debounce;const s=BX.Landing.Utils.data;const i=BX.Landing.Utils.proxy;const n=BX.Landing.Utils.onCustomEvent;const o=BX.Landing.Utils.encodeDataValue;class d extends a.Base{constructor(t){super(t);this.type="map";this.attribute="data-map";this.hidden=true;this.createMap();this.lastValue=this.getValue();this.onBlockUpdateAttrs=this.onBlockUpdateAttrs.bind(this);n("BX.Landing.Block:Node:updateAttr",this.onBlockUpdateAttrs)}createMap(){this.mapOptions={mapContainer:this.node,mapOptions:s(this.node,"data-map"),theme:s(this.node,"data-map-theme"),roads:s(this.node,"data-map-roads")||[],landmarks:s(this.node,"data-map-landmarks")||[],labels:s(this.node,"data-map-labels")||[],onMapClick:i(this.onMapClick,this),onChange:e(this.onChange,500,this),fullscreenControl:false,mapTypeControl:false,zoomControl:false};this.map=BX.Landing.Provider.Map.create(this.node,this.mapOptions)}reInitMap(){const t=BX.Runtime.clone(this.mapOptions);this.mapOptions.mapOptions=s(this.node,"data-map");this.mapOptions.theme=s(this.node,"data-map-theme");this.mapOptions.roads=s(this.node,"data-map-roads")||[];this.mapOptions.landmarks=s(this.node,"data-map-landmarks")||[];this.mapOptions.labels=s(this.node,"data-map-labels")||[];if(t!==this.mapOptions){this.map.reinit(this.mapOptions)}}onBlockUpdateAttrs(t){if(t.node===this.node){this.reInitMap();this.lastValue=this.getValue()}}onMapClick(t){if(BX.Landing.UI.Panel.StylePanel.getInstance().isShown()){return}this.map.addMarker({latLng:this.map.getPointByEvent(t),title:"",description:"",showByDefault:false,draggable:true,editable:true});this.map.onMarkerClick(this.map.markers[this.map.markers.length-1])}onChange(t){if(this.isChanged()){if(!t){BX.Landing.History.getInstance().push()}this.lastValue=this.getValue();this.onChangeHandler(this,t)}}isChanged(){return JSON.stringify(this.getValue())!==JSON.stringify(this.lastValue)}getValue(){return this.map&&this.map.isApiLoaded()?this.map.getValue():null}getAttrValue(){return o(this.getValue())}setValue(t,a,e){this.map.setValue(t,e)}getField(){return new BX.Landing.UI.Field.BaseField({selector:this.selector,hidden:true})}}BX.Landing.Node.Map=d;t.Map=d})(this.BX.Landing.Node=this.BX.Landing.Node||{},BX.Landing.Node); //# sourceMappingURL=map.bundle.map.js