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/ui/tour/src/ |
Upload File : |
import { Dom, Event, Reflection, Type } from 'main.core'; export class Step extends Event.EventEmitter { constructor(options) { super(options); this.target = null; if ( Type.isString(options.target) && options.target !== '' || Type.isFunction(options.target) || Type.isDomNode(options.target) ) { this.target = options.target; } this.id = options.id || null; this.text = options.text; this.areaPadding = options.areaPadding; this.link = options.link || ''; this.linkTitle = options.linkTitle || null; this.rounded = options.rounded || false; this.title = options.title || null; this.iconSrc = options.iconSrc || null; this.article = options.article || null; this.articleAnchor = options.articleAnchor || null; this.infoHelperCode = options.infoHelperCode || null; this.position = options.position || null; this.cursorMode = options.cursorMode || false; this.targetEvent = options.targetEvent || null; this.buttons = options.buttons || []; this.condition = options.condition || null; const events = Type.isPlainObject(options.events) ? options.events : {}; for (const eventName in events) { const callback = Type.isFunction(events[eventName]) ? events[eventName] : Reflection.getClass(events[eventName]); if (callback) { this.subscribe(this.constructor.getFullEventName(eventName), () => { callback(); }); } } } getCondition() { return this.condition; } getTarget() { if (Type.isString(this.target) && this.target !== '') { return document.querySelector(this.target); } if (Type.isFunction(this.target)) { return this.target(); } return this.target; } getTargetPos() { if (Type.isDomNode(this.target)) { return Dom.getPosition(this.target); } } getId() { return this.id; } getButtons() { return this.buttons; } getAreaPadding() { return this.areaPadding; } getRounded() { return this.rounded; } getText() { return this.text; } getLink() { return this.link; } getLinkTitle(): ?string { return this.linkTitle; } getTitle() { return this.title; } getIconSrc(): ?string { return this.iconSrc; } getPosition() { return this.position; } getArticle(): string { return this.article; } getArticleAnchor(): string { return this.articleAnchor; } getInfoHelperCode(): ?string { return this.infoHelperCode; } getCursorMode() { return this.cursorMode; } getTargetEvent() { return this.targetEvent; } static getFullEventName(shortName) { return `Step:${shortName}`; } setTarget(target) { this.target = target; } initTargetEvent() { if (Type.isFunction(this.targetEvent)) { this.targetEvent(); return; } this.getTarget().dispatchEvent(new MouseEvent(this.targetEvent)); } }