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/landing/ui/field/presetfield/src/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/landing/ui/field/presetfield/src/presetfield.js
import 'ui.design-tokens';

import {BaseField} from 'landing.ui.field.basefield';
import {Cache, Dom, Tag} from 'main.core';
import {Loc} from 'landing.loc';

import './css/style.css';

/**
 * @memberOf BX.Landing.UI.Field
 */
export class PresetField extends BaseField
{
	constructor(options = {})
	{
		super(options);
		this.setEventNamespace('BX.Landing.UI.Field.PresetField');
		this.subscribeFromOptions(options.events);
		Dom.addClass(this.layout, 'landing-ui-field-preset');
		this.setTitle(Loc.getMessage('LANDING_PRESET_FIELD_TITLE'));

		this.cache = new Cache.MemoryCache();
		this.onLinkClick = this.onLinkClick.bind(this);

		Dom.replace(this.layout, this.getLayout());
		this.layout = this.getLayout();
	}

	getLayout(): HTMLDivElement
	{
		return this.cache.remember('layout', () => {
			return Tag.render`
				<div class="landing-ui-field-preset-layout">
					<div class="landing-ui-field-preset-left">
						${this.getIcon()}
					</div>
					<div class="landing-ui-field-preset-right">
						${this.header}
						${this.getLink()}
					</div>
				</div>
			`;
		});
	}

	getIcon(): HTMLSpanElement
	{
		return this.cache.remember('icon', () => {
			return Tag.render`<span class="landing-ui-field-preset-icon landing-ui-field-preset-icon-default"></span>`;
		});
	}

	setIcon(icon: string)
	{
		Dom.style(this.getIcon(), 'background-image', `url(${icon})`);
	}

	getLink(): HTMLSpanElement
	{
		return this.cache.remember('link', () => {
			return Tag.render`
				<div class="landing-ui-field-preset-link" onclick="${this.onLinkClick}">
					${Loc.getMessage('LANDING_PRESET_DEFAULT_CASE_TITLE')}
				</div>
			`;
		});
	}

	setLinkText(text: string)
	{
		this.getLink().textContent = text;
	}

	onLinkClick(event: MouseEvent)
	{
		event.preventDefault();

		this.emit('onClick');
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit