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/entity-selector/src/dialog/tabs/ |
Upload File : |
import { Cache, Tag, Loc, Dom } from 'main.core'; import { Loader } from 'main.loader'; import type Tab from './tab'; export default class SearchLoader { tab: Tab = null; loader: Loader = null; cache = new Cache.MemoryCache(); constructor(tab: Tab) { this.tab = tab; } getTab(): Tab { return this.tab; } getLoader(): Loader { if (this.loader === null) { this.loader = new Loader({ target: this.getIconContainer(), size: 32 }); } return this.loader; } getContainer(): HTMLElement { return this.cache.remember('container', () => { return Tag.render` <div class="ui-selector-search-loader"> ${this.getBoxContainer()} ${this.getSpacerContainer()} </div> `; }); } getBoxContainer(): HTMLElement { return this.cache.remember('box-container', () => { return Tag.render` <div class="ui-selector-search-loader-box"> ${this.getIconContainer()} ${this.getTextContainer()} </div>`; }); } getIconContainer(): HTMLElement { return this.cache.remember('icon', () => { return Tag.render`<div class="ui-selector-search-loader-icon"></div>`; }); } getTextContainer(): HTMLElement { return this.cache.remember('text', () => { return Tag.render` <div class="ui-selector-search-loader-text">${ Loc.getMessage('UI_SELECTOR_SEARCH_LOADER_TEXT') }</div> `; }); } getSpacerContainer(): HTMLElement { return this.cache.remember('spacer', () => { return Tag.render`<div class="ui-selector-search-loader-spacer"></div>`; }); } show(): void { if (!this.getContainer().parentNode) { Dom.append(this.getContainer(), this.getTab().getContainer()); } void this.getLoader().show(); Dom.addClass(this.getContainer(), 'ui-selector-search-loader--show'); requestAnimationFrame(() => { Dom.addClass(this.getContainer(), 'ui-selector-search-loader--animate'); }); } hide(): void { if (this.loader === null) { return; } Dom.removeClass( this.getContainer(), ['ui-selector-search-loader--show', 'ui-selector-search-loader--animate'] ); void this.getLoader().hide(); } isShown(): boolean { return this.loader !== null && this.loader.isShown(); } }