![]() 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 : /proc/self/root/var/www/html/libs/absol-form/js/core/ |
Upload File : |
import EventEmitter from 'absol/src/HTML5/EventEmitter'; import FModel from './FModel'; import noop from "absol/src/Code/noop"; import {randomIdent} from "absol/src/String/stringGenerate"; import {randomUniqueIdent} from "./utils"; import CCBlock from "absol/src/AppPattern/circuit/CCBlock"; import inheritComponentClass from "./inheritComponentClass"; /*** * @constructor * @augments EventEmitter * @augments FViewable * @augments FNode * @augments FModel */ function BaseBlock() { EventEmitter.call(this); FModel.call(this); CCBlock.call(this, { id: randomUniqueIdent() }); /*** * * @type {null|FmFragment} */ this.fragment = null; this.attributes.loadAttributeHandlers(this.attributeHandlers); this.onCreated(); } inheritComponentClass(BaseBlock, EventEmitter, FModel, CCBlock); BaseBlock.prototype.type = "BLOCK"; BaseBlock.prototype.tag = "BaseBlock"; BaseBlock.prototype.menuIcon = 'span.mdi.mdi-cube-outline'; BaseBlock.prototype.attributeHandlers.id = { set: function (value) { if (!value) value = randomIdent(16); this.id = value + ''; }, get: function () { return this.id; }, descriptor: function () { return { type: 'const', value: this.id }; } }; BaseBlock.prototype.attributeHandlers.displayName = { set: function (value) { value = value || ''; value += ''; return value; }, descriptor: { type: 'text', displayName: "Name" }, export: function (ref) { return ref.get() || undefined; } }; BaseBlock.prototype.attributeHandlers.permissions = { descriptor: { type: 'object', hidden: true } }; BaseBlock.prototype.onCreate = function () { this.constructor.count = this.constructor.count || 0; this.attributes.displayName = ''; this.attributes.name = this.tag + "_" + (this.constructor.count++); }; BaseBlock.prototype.onCreated = noop; BaseBlock.prototype.onAttached = noop; BaseBlock.prototype.getData = function () { var data = { tag: this.tag } var key; var attributes = this.attributes.export(); for (key in attributes) { data.attributes = attributes; break; } return data; } BaseBlock.prototype.setAttributes = function (attributes) { Object.assign(this.attributes, attributes) }; export default BaseBlock;