![]() 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-form/js/components/ |
Upload File : |
import FCore from "../core/FCore"; import '../../css/component.css'; import ContentScalelessComponent from "../core/ContentScalelessComponent"; import inheritComponentClass from "../core/inheritComponentClass"; import InputAttributeHandlers, {InputAttributeNames} from "./handlers/InputAttributeHandlers"; import {AssemblerInstance} from "../core/Assembler"; var _ = FCore._; var $ = FCore.$; /*** * @extends ContentScalelessComponent * @constructor */ function CheckBox() { ContentScalelessComponent.call(this); } inheritComponentClass(CheckBox, ContentScalelessComponent); CheckBox.prototype.tag = "CheckBox"; CheckBox.prototype.menuIcon = "span.mdi.mdi-checkbox-outline.mdi-check-box-outline"; CheckBox.prototype.onCreate = function () { ContentScalelessComponent.prototype.onCreate.call(this); this.style.width = 18; this.style.height = 18; this.style.vAlign = 'top'; this.style.hAlign = 'left'; this.style.textHAlign = 'center'; this.style.textVAlign = 'center'; this.attributes.checked = false; }; CheckBox.prototype.onCreated = function () { ContentScalelessComponent.prototype.onCreated.call(this); this.$content.on('change', function () { this.pinFire('checked'); }.bind(this)); }; CheckBox.prototype.renderContent = function () { return _('checkboxbutton'); }; CheckBox.prototype.getAcceptsEventNames = function () { return ContentScalelessComponent.prototype.getAcceptsEventNames.call(this).concat(['change']); }; CheckBox.prototype.measureMinSize = function () { return {width: 18, height: 18}; }; CheckBox.prototype.createDataBindingDescriptor = function () { var thisC = this; return { set: function (value) { return thisC.setAttribute('checked', !!value); }, get: function () { return thisC.getAttribute('checked'); } } }; CheckBox.prototype.attributeHandlers.checked = { set: function (value) { var prev = this.$content.checked; this.$content.checked = !!value; if (this.$content.checked !== prev) { this.pinFire('checked'); } }, get: function () { return this.$content.checked; }, descriptor: { type: "bool", sign: "NotDependentBool" }, export: function () { return this.$content.checked || undefined; } }; Object.assign(CheckBox.prototype.attributeHandlers, InputAttributeHandlers); CheckBox.prototype.attributeHandlers.disabled = { set: function (value) { this.$content.disabled = value; }, get: function () { return this.$content.disabled; }, descriptor: { type: "bool" }, export: function () { return this.$content.disabled || undefined; } }; CheckBox.prototype.pinHandlers.checked = { receives: function (value) { this.attributes.checked = !!value; }, get: function () { return this.$content.checked; }, descriptor: { type: "bool" } }; CheckBox.prototype.pinHandlers.disabled = { receives: function (value) { this.attributes.disabled = !!value; }, get: function () { return this.$content.disabled; }, descriptor: { type: "bool" } }; AssemblerInstance.addClass(CheckBox); export default CheckBox;