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/Time24Input.js
import FCore from "../core/FCore";
import ScalableComponent from "../core/ScalableComponent";
import {MILLIS_PER_DAY} from "absol/src/Time/datetime";
import inheritComponentClass from "../core/inheritComponentClass";
import InputAttributeHandlers, {InputAttributeNames} from "./handlers/InputAttributeHandlers";
import {AssemblerInstance} from "../core/Assembler";


var _ = FCore._;

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

inheritComponentClass(Time24Input, ScalableComponent);//5p


Time24Input.prototype.tag = "Time24Input";
Time24Input.prototype.menuIcon = "span.mdi.mdi-clock-end";

Object.assign(Time24Input.prototype.attributeHandlers, InputAttributeHandlers);

Time24Input.prototype.attributeHandlers.value = {
    set: function (value) {
        var prev = this.domElt.value;
        this.domElt.value = value;
        if (this.domElt.value !== value) {
            this.pinFire('value');
        }
    },
    get: function () {
        return this.domElt.value;
    },
    descriptor: {
        type: 'number',
        min: 0,
        max: MILLIS_PER_DAY - 1
    }
};

Time24Input.prototype.attributeHandlers.offset = {
    set: function (value) {
        this.domElt.dayOffset = value;
    },
    get: function () {
        return this.domElt.dayOffset;
    },
    descriptor: {
        type: 'number',
        min: 0,
        max: MILLIS_PER_DAY - 1
    }
};



Time24Input.prototype.attributeHandlers.format = {
    set: function (value) {
        this.domElt.format = value;
    },
    get: function () {
        return this.domElt.format;
    },
    export: function () {
        if (this.domElt.format === 'hh:mm a') return undefined;
        return this.domElt.format;
    },
    descriptor: {
        type: 'enum',
        values: ['hh:mm a', 'HH:mm']
    }
};

Time24Input.prototype.pinHandlers.value = {
    receives: function (value) {
        this.attributes.value = value;
    },
    get: function () {
        return this.attributes.value;
    },
    descriptor: {
        type: 'number'
    }
};


Time24Input.prototype.pinHandlers.offset = {
    receives: function (value) {
        this.attributes.offset = value;
    },
    descriptor: {
        type: 'number'
    }
};


Time24Input.prototype.render = function () {
    return _('time24input');
};


Time24Input.prototype.onCreate = function () {
    ScalableComponent.prototype.onCreate.call(this);
    this.attributes.value = null;
    this.attributes.format = 'HH:mm';
    this.style.width = 160;
    this.style.height = 30;
};

Time24Input.prototype.onCreated = function () {
    ScalableComponent.prototype.onCreated.call(this);
    this.domElt.on('change', function () {
        this.pinFire('value');
    }.bind(this));
};



Time24Input.prototype.getAcceptsEventNames = function () {
    return ScalableComponent.prototype.getAcceptsEventNames.call(this).concat(['change']);
};

Time24Input.prototype.measureMinSize = function () {
    return { width: 75, height: 16 };
};

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

AssemblerInstance.addClass(Time24Input);

export default Time24Input;

VaKeR 2022