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/rest/form-constructor/src/fields/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/rest/form-constructor/src/fields/dropdown-list.js
import { Dom, Tag, Type, Event } from 'main.core';
import type { FieldConfig } from '../types';
import { BaseField } from './base-field';

export class DropdownList extends BaseField
{
	constructor(options: FieldConfig)
	{
		super(options);
		this.readySave = true;
	}

	renderFieldContainer(): HTMLElement
	{
		const wrapper = Tag.render`
			<div class="ui-ctl ui-ctl-after-icon ui-ctl-dropdown">
				<div class="ui-ctl-after ui-ctl-icon-angle"></div>
			</div>
		`;

		if (Type.isArray(this.options.items))
		{
			const itemsWrapper = Tag.render`
				<select class="ui-ctl-element" id="${this.getId()}" />
			`;
			this.options.items.forEach((item) => {
				const itemElement = Tag.render`
					<option value="${item.value}">${item.name}</option>
				`;

				if (this.options.value === item.value)
				{
					Dom.attr(itemElement, {
						selected: true,
					});
				}

				Dom.append(itemElement, itemsWrapper);
			});
			Dom.append(itemsWrapper, wrapper);

			Event.bind(itemsWrapper, 'change', (event) => {
				this.value = event.target.value;
				if (Object.prototype.hasOwnProperty.call(this.options, 'updateForm') && this.options.updateForm)
				{
					this.emit('onFieldChange', {
						target: event.target,
						field: this,
					});
				}
			});
		}

		return wrapper;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit