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/components/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-form/js/components/Image.js
import FCore from "../core/FCore";
import ScalableComponent from "../core/ScalableComponent";
import Dom from "absol/src/HTML5/Dom";
import OOP from "absol/src/HTML5/OOP";
import {AssemblerInstance} from "../core/Assembler";
import inheritComponentClass from "../core/inheritComponentClass";

var _ = FCore._;

/**
 * @extends ScalableComponent
 * @constructor
 */
function Image() {
    ScalableComponent.call(this);
    this.naturalWidth = 0;
    this.naturalHeight = 0;
    this.loadedSync = Promise.resolve([0, 0]);
}

inheritComponentClass(Image, ScalableComponent);

Image.prototype.tag = "Image";
Image.prototype.menuIcon = "span.mdi.mdi-image-outline";

Image.prototype.attributeHandlers.src = {
    set: function (value) {
        this.domElt.src = value;
    },
    get: function () {
        return this.domElt.src;
    },
    descriptor: {
        type: "text",
        long: true,
        sign: 'SimpleUrl'
    }
};

Image.prototype.attributeHandlers.naturalSize = {
    descriptor: function () {
        return {
            type: 'const',
            value: this.loadedSync.then(function (wh) {
                return wh.join(' x ')
            })
        };
    }
};

Image.prototype.pinHandlers.src = {
    receives: function (value) {
        this.attributes.src = value;
    }
};


Image.prototype.onCreate = function () {
    ScalableComponent.prototype.onCreate.call(this);
    this.attributes.src = '';
}

Image.prototype.render = function () {
    return _('img');
};


Image.prototype.getAcceptsAttributeNames = function () {
    return ScalableComponent.prototype.getAcceptsAttributeNames.call(this).concat(['src', 'naturalSize']);
};


Image.prototype.createDataBindingDescriptor = function () {
    var thisC = this;
    return {
        configurable: true,
        set: function (value) {
            thisC.setAttribute('src', value);
        },
        get: function () {
            return thisC.getAttribute('src');
        }
    }
};

AssemblerInstance.addClass(Image);

export default Image;

VaKeR 2022