%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 3.145.20.52 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/js/landing/ui/panel/basepresetpanel/src/preset/ |
Upload File : |
import {EventEmitter} from 'main.core.events'; import {Cache, Dom, Tag, Text, Type} from 'main.core'; import type {Options} from 'crm.form'; import {Loc} from 'landing.loc'; import {TextCrop} from 'ui.textcrop'; import './css/preset.css'; type PresetOptions = { id: string, title: string, category: string, description?: string, icon?: string, items?: Array<string>, formOptions?: Options, disabled?: boolean, soon?: boolean, defaultSection?: string, }; const defaultOptions: PresetOptions = { disabled: false, soon: false, }; /** * @memberOf BX.Landing.UI.Panel.BasePresetPanel */ export default class Preset extends EventEmitter { options: PresetOptions; constructor(options: PresetOptions) { super(options); this.setEventNamespace('BX.Landing.UI.Panel.BasePresetPanel.Preset'); this.options = {...defaultOptions, ...options}; this.cache = new Cache.MemoryCache(); } getTextCrop(): TextCrop { return this.cache.remember('textCrop', () => { return new TextCrop({ rows: 2, target: this.getDescriptionNode(), }); }); } getIconNode(): HTMLDivElement { return this.cache.remember('iconNode', () => { return Tag.render` <div class="landing-ui-panel-preset-icon" style="background-image: url(${this.options.icon}?v2)" ></div> `; }); } getTitleNode(): HTMLDivElement { return this.cache.remember('titleNode', () => { return Tag.render` <div class="landing-ui-panel-preset-text-title" title="${Text.encode(this.options.title)}" >${this.options.title}</div> `; }); } getDescriptionNode(): HTMLDivElement { return this.cache.remember('descriptionNode', () => { return Tag.render` <div class="landing-ui-panel-preset-text-description" title="${Text.encode(this.options.description)}" >${this.options.description}</div> `; }); } activate() { Dom.addClass(this.getLayout(), 'landing-ui-panel-preset-active'); } deactivate() { Dom.removeClass(this.getLayout(), 'landing-ui-panel-preset-active'); } isActive(): boolean { return Dom.hasClass(this.getLayout(), 'landing-ui-panel-preset-active'); } getSoonLabel(): HTMLDivElement { return this.cache.remember('soonLabel', () => { return Tag.render` <div class="landing-ui-panel-preset-soon-label"> ${Loc.getMessage('LANDING_UI_BASE_PRESET_PANEL_SOON_LABEL')} </div> `; }); } getLayout(): HTMLDivElement { return this.cache.remember('layout', () => { const onLayoutClick = (event: MouseEvent) => { event.preventDefault(); if (this.options.openable) { this.activate(); } this.emit('onClick'); }; const additionalClass = this.options.active ? ' landing-ui-panel-preset-active' : ''; const disabledClass = this.options.disabled ? ' landing-ui-disabled' : ''; return Tag.render` <div class="landing-ui-panel-preset${additionalClass}${disabledClass}" onclick="${onLayoutClick}"> ${Type.isStringFilled(this.options.icon) ? this.getIconNode() : ''} <div class="landing-ui-panel-preset-text"> ${Type.isStringFilled(this.options.title) ? this.getTitleNode() : ''} ${Type.isStringFilled(this.options.description) ? this.getDescriptionNode() : ''} </div> ${this.options.soon ? this.getSoonLabel() : ''} </div> `; }); } }