VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
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/core/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-form/js/core/ContentScalelessComponent.js
import FCore from "../core/FCore";

import '../../css/component.css';
import ScalableComponent from "../core/ScalableComponent";
import inheritComponentClass from "./inheritComponentClass";

var _ = FCore._;
var $ = FCore.$;

/***
 * @extends ScalableComponent
 * @constructor
 */
function ContentScalelessComponent() {
    ScalableComponent.call(this);
}

inheritComponentClass(ContentScalelessComponent, ScalableComponent);

ContentScalelessComponent.prototype.tag = "ContentScalelessComponent";

ContentScalelessComponent.prototype.BOX_ALIGN_CLASSES = {
    lefttop: 'as-align-left-top',
    centertop: 'as-align-center-top',
    righttop: 'as-align-right-top',

    leftcenter: 'as-align-left-center',
    centercenter: 'as-align-center-center',
    rightcenter: 'as-align-right-center',

    leftbottom: 'as-align-left-bottom',
    centerbottom: 'as-align-center-bottom',
    rightbottom: 'as-align-right-bottom'
};

ContentScalelessComponent.prototype.styleHandlers.boxAlign = {
    set: function (value) {
        var accepts = Object.keys(this.BOX_ALIGN_CLASSES);
        if (accepts.indexOf(value) < 0) value = 'lefttop';
        var lastClass = this.BOX_ALIGN_CLASSES[this.style.boxAlign];
        if (lastClass) this.view.removeClass(lastClass);
        this.domElt.addClass(this.BOX_ALIGN_CLASSES[value]);
        return value;
    },
    descriptor: {
        type: 'boxAlign'
    }
}

ContentScalelessComponent.prototype.onCreate = function () {
    ScalableComponent.prototype.onCreate.call(this);
    this.style.boxAlign = 'lefttop';
};


ContentScalelessComponent.prototype.render = function () {
    this.$content = this.renderContent();
    this.$cell = _({
        class: 'as-component-content-scaleless-cell',
        child: this.$content
    });
    return _({
        class: 'as-component-content-scaleless',
        child: this.$cell
    });
};


ContentScalelessComponent.prototype.renderContent = function () {
    throw new Error('Not Implement!');
};


ContentScalelessComponent.prototype.getAcceptsStyleNames = function () {
    return ScalableComponent.prototype.getAcceptsStyleNames.call(this).concat(['boxAlign']);
};


ContentScalelessComponent.prototype.measureMinSize = function () {
    if (!this.$content) return {width: 69, height: 30};
    var bound = this.$content.getBoundingClientRect();
    return {width: bound.width, height: bound.height};
};

export default ContentScalelessComponent;

VaKeR 2022