![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/html/libs/absol-full/dist/js/ |
Upload File : |
/*** module: node_modules/absol-form/js/blocks/CBRadioGroup.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _BaseBlock = _interopRequireDefault(require("../core/BaseBlock")); var _inheritComponentClass = _interopRequireDefault(require("../core/inheritComponentClass")); var _Assembler = require("../core/Assembler"); /*** * @extends BaseBlock * @constructor */ function CBRadioGroup() { this._value = undefined; //not define yet this['ev_radio'] = this.ev_radio.bind(this); _BaseBlock.default.call(this); } (0, _inheritComponentClass.default)(CBRadioGroup, _BaseBlock.default); CBRadioGroup.prototype.tag = "CBRadioGroup"; CBRadioGroup.prototype.attributeHandlers.groupName = { set: function (value) { var ref = arguments[arguments.length - 1]; this._assignToFragment(ref.get(), value); return value; }, descriptor: { type: 'text' } }; CBRadioGroup.prototype.attributeHandlers.value = { set: function (value) { value = value || null; var prev = this._getValue(value); if (this.fragment) { this._value = this._setValue(value); } else { this._value = value; } if (prev !== value) this.pinFire('value'); }, get: function () { if (this.fragment) { this._value = this._getValue(value); } return this._value; }, descriptor: { type: "text" } }; CBRadioGroup.prototype.pinHandlers.value = { receives: function (value) { this.attributes.value = value; }, get: function () { return this._value; }, descriptor: { type: 'text' } }; CBRadioGroup.prototype._getValue = function () { if (!this.fragment) return this._value; if (!this.fragment.__radio_assigned__) return null; var assigned = this.fragment.__radio_assigned__; var list = assigned[this.attributes.groupName]; if (!list) return null; var radio; for (var i = 0; i < list.length; ++i) { radio = list[i]; if (radio.attributes.checked) return radio.attributes.value; } return null; }; CBRadioGroup.prototype._setValue = function (value) { if (!this.fragment) return this._value; if (!this.fragment.__radio_assigned__) return null; var assigned = this.fragment.__radio_assigned__; var list = assigned[this.attributes.groupName]; if (!list) return null; if (value) value = value + ''; var res = null; var radio; for (var i = 0; i < list.length; ++i) { radio = list[i]; if (radio.attributes.value === value) { radio.attributes.checked = true; res = value; } else radio.attributes.checked = false; } return res; }; CBRadioGroup.prototype.onAttached = function () { if (this._value !== undefined) this._setValue(this._value); }; CBRadioGroup.prototype._assignToFragment = function (oldGName, newGName) { if (!this.fragment) return; this.fragment.emittor.off('radio.' + oldGName, this.ev_radio); this.fragment.emittor.on('radio.' + newGName, this.ev_radio); }; CBRadioGroup.prototype.ev_radio = function (event) { this._value = event.value; this.pinFire('value', this._value); }; _Assembler.AssemblerInstance.addClass(CBRadioGroup); var _default = CBRadioGroup; exports.default = _default;