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

/***
 * @extends ScalableComponent
 * @constructor
 */
function TimeRange24Input() {
    ScalableComponent.apply(this, arguments);
}

inheritComponentClass(TimeRange24Input, ScalableComponent);

TimeRange24Input.prototype.tag = 'TimeRange24Input';

TimeRange24Input.prototype.menuIcon = 'span.mdi.mdi-timelapse';


TimeRange24Input.prototype.render = function () {
    return _('timerange24input');
};

TimeRange24Input.prototype.measureMinSize = function () {
    return {height: 30, width: 318};
};

TimeRange24Input.prototype.onCreated = function () {
    ScalableComponent.prototype.onCreated.apply(this, arguments);
    var self = this;
    this.domElt.on('change', function (event) {
        if (self.pinHandlers[event.property])
            self.pinFire(event.property);
            self.pinFire('value');
    });
};

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

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

TimeRange24Input.prototype.attributeHandlers.notNull = {
    set: function (value) {
        this.domElt.notNull = !!value;
    },
    get: function () {
        return this.domElt.notNull;
    },
    export: function () {
        if (this.domElt.notNull) return undefined;
        return this.domElt.notNull;
    },
    descriptor: {
        type: 'bool'
    }
};

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

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

TimeRange24Input.prototype.pinHandlers.value = {
    get: function () {
        return {dayOffset: this.attributes.dayOffset, duration: this.attributes.duration};
    },
    receives: function (value){
        value  = value ||{};
        if ('dayOffset' in value){
            this.attributes.dayOffset = value.dayOffset;
        }
        if ('duration' in value){
            this.attributes.duration = value.duration;
        }
    },
    descriptor: {type: 'object'}
};

TimeRange24Input.prototype.createDataBindingDescriptor = function () {
    var self = this;
    var subObj = {};
    Object.defineProperties(subObj, {
        dayOffset: {
            set: function (value) {
                self.attributes.dayOffset = value;
            },
            get: function () {
                return self.attributes.dayOffset;
            },
            configurable: true,
            enumerable: true
        },
        duration: {
            set: function (value) {
                self.attributes.duration = value;
            },
            get: function () {
                return self.attributes.duration;
            },
            configurable: true,
            enumerable: true
        }
    });


    return {
        set: function (props) {
            props = props || {};
            if ('dayOffset' in props) subObj.dayOffset = props.dayOffset;
            if ('duration' in props) subObj.duration = props.duration;
        },
        get: function () {
            return subObj;
        }
    }

}

AssemblerInstance.addClass(TimeRange24Input);

export default TimeRange24Input;

VaKeR 2022