%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 18.220.191.227 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/report/install/components/bitrix/report.visualconstructor.config.fields/templates/selectwithpopup/ |
Upload File : |
;(function(){ "use strict"; BX.namespace('BX.Report.VisualConstructor.Widget.Config.Fields'); /** * @param options * @extends BX.Report.VisualConstructor.Field.Base * @constructor */ BX.Report.VisualConstructor.Widget.Config.Fields.SelectWithPopup = function(options) { console.trace("new SelectWithPopup"); this.fieldScope = options.fieldScope; this.selectControl = this.fieldScope.querySelector('[data-role="visualconstructor-field-custom-select"]'); this.selectControlValue = this.fieldScope.querySelector('[data-role="visualconstructor-field-custom-select-value"]'); this.optionList = options.optionList; this.value = options.value; this.id = this.fieldScope.id; this.init(); BX.Report.VisualConstructor.Field.Base.apply(this, arguments); }; BX.Report.VisualConstructor.Widget.Config.Fields.SelectWithPopup.prototype = { __proto__: BX.Report.VisualConstructor.Field.Base.prototype, constructor: BX.Report.VisualConstructor.Widget.Config.Fields.SelectWithPopup, init: function() { BX.bind(this.selectControl, "click", BX.delegate(this.openSelectPopup, this)); }, openSelectPopup: function() { this.getSelectPopup().show(); }, getSelectPopup: function() { if (this.selectPopup) { this.selectPopup.destroy(); } var popupMenuId = this.id + '_select_popup'; this.popupContent = this.getSelectableOptionListContainer(this.optionList, this.handlerOptionChange); this.selectPopup = this.createPopup(popupMenuId, this.selectControl, this.popupContent); return this.selectPopup; }, createPopup: function(popupMenuId, control, content) { return new BX.PopupWindow(popupMenuId, control, { noAllPaddings: true, closeByEsc: true, angle: true, autoHide: true, zIndex: 9999, offsetTop: 0, content: content, targetContainer: document.querySelector('[data-role="report-configuration-page-wrapper"]'), }); }, getSelectableOptionListContainer: function(items, clickCallback) { var container = BX.create('div', { attrs: { className: 'visualconstructor-select-popup-wrapper' } }); for (var i in items) { if (items.hasOwnProperty(i)) { container.appendChild(BX.create('div', { attrs: { className: 'visualconstructor-select-item-wrapper' }, dataset: { selectionValue: i, selectionLabel: items[i] }, text: items[i], events: { click: function (e) { clickCallback.call(this, e.currentTarget.dataset.selectionValue, e.currentTarget.dataset.selectionLabel); }.bind(this) } })); } } return container; }, handlerOptionChange: function(selectionValue, selectionLabel) { if (this.selectPopup) { this.selectPopup.close(); } this.selectControl.innerHTML = selectionLabel; this.selectControlValue.value = selectionValue; this.value = selectionValue; BX.onCustomEvent(this.fieldScope, this.id + '_onChange', [this]); }, getValue: function() { return this.value; }, setOptions: function(options) { this.optionList = options; var firstOptionName = Object.keys(this.optionList)[0]; if (firstOptionName) { this.handlerOptionChange(firstOptionName, this.optionList[firstOptionName]); /*this.selectControl.innerHTML = this.optionList[firstOptionName]; this.selectControlValue.value = firstOptionName; this.value = firstOptionName;*/ } else { this.selectControl.innerHTML = ''; this.selectControlValue.value = ''; this.value = null; } } } })();