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/rospirotorg.ru/bitrix/js/ui/entity-selector/src/search/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/ui/entity-selector/src/search/search-query.js
import { Type } from 'main.core';

export default class SearchQuery
{
	queryWords: string[] = [];
	query: string = '';
	cacheable: boolean = true;
	dynamicSearchEntities: string[] = [];
	resultLimit: number = 100;

	constructor(query: string)
	{
		this.query = query.trim().replace(/\s\s+/g, ' ');
		this.queryWords = Type.isStringFilled(this.query) ? this.query.split(' ') : [];
	}

	getQueryWords(): string[]
	{
		return this.queryWords;
	}

	getQuery(): string
	{
		return this.query;
	}

	isEmpty(): boolean
	{
		return this.getQueryWords().length === 0;
	}

	setCacheable(flag: boolean): void
	{
		if (Type.isBoolean(flag))
		{
			this.cacheable = flag;
		}
	}

	isCacheable(): boolean
	{
		return this.cacheable;
	}

	setResultLimit(limit: number)
	{
		if (Type.isNumber(limit) && limit >= 0)
		{
			this.resultLimit = limit;
		}
	}

	getResultLimit(): number
	{
		return this.resultLimit;
	}

	hasDynamicSearch(): boolean
	{
		return this.getDynamicSearchEntities().length > 0;
	}

	hasDynamicSearchEntity(entityId: string): boolean
	{
		return this.getDynamicSearchEntities().includes(entityId);
	}

	setDynamicSearchEntities(entities: string[]): void
	{
		if (Type.isArrayFilled(entities))
		{
			entities.forEach((entityId: string) => {
				if (Type.isStringFilled(entityId) && !this.hasDynamicSearchEntity(entityId))
				{
					this.dynamicSearchEntities.push(entityId);
				}
			});
		}

		return this.dynamicSearchEntities;
	}

	getDynamicSearchEntities(): string[]
	{
		return this.dynamicSearchEntities;
	}

	getAjaxJson(): { [key: string]: any }
	{
		return this.toJSON();
	}

	toJSON(): { [key: string]: any }
	{
		return {
			queryWords: this.getQueryWords(),
			query: this.getQuery(),
			dynamicSearchEntities: this.getDynamicSearchEntities(),
		};
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit