![]() 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-full/dist/js/ |
Upload File : |
/*** module: node_modules/absol-form/js/components/Image.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _FCore = _interopRequireWildcard(require("../core/FCore")); var _ScalableComponent = _interopRequireDefault(require("../core/ScalableComponent")); var _Assembler = require("../core/Assembler"); var _inheritComponentClass = _interopRequireDefault(require("../core/inheritComponentClass")); var _ = _FCore.default._; /** * @extends ScalableComponent * @constructor */ function Image() { _ScalableComponent.default.call(this); this.naturalWidth = 0; this.naturalHeight = 0; this.loadedSync = Promise.resolve([0, 0]); } (0, _inheritComponentClass.default)(Image, _ScalableComponent.default); Image.prototype.tag = "Image"; Image.prototype.menuIcon = "span.mdi.mdi-image-outline"; Image.prototype.style.display = 'inline-block'; Image.prototype.style.vAlign = 'center'; Image.prototype.attributeHandlers.src = { set: function (value) { var src; if (typeof value === 'string') { src = value; } else if (value && value.url) { src = value.url; } this.$img.src = src; if (value) { this.domElt.removeClass('as-empty'); } else { this.domElt.addClass('as-empty'); } return value; }, descriptor: { type: "text", long: true, sign: 'SimpleUrl' }, export: function (ref) { var value = ref.get() || undefined; if (value === this.constructor.prototype.attributes.src) value = undefined; return value; } }; Image.prototype.attributeHandlers.placeHolder = { set: function (value) { if (value !== 'avatar') value = 'default'; this.domElt.attr('data-place-holder', value); return value; }, descriptor: { type: 'enum', values: ['default', 'avatar'] }, export: function (ref) { var value = ref.get(); if (value !== 'avatar') value = undefined; return value || undefined; } }; 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.render = function () { this.domElt = _({ class: ['as-image', 'as-empty'], child: 'img' }); this.$img = (0, _FCore.$)('img', this.domElt); this.$img.on('load', () => { this.domElt.addStyle('--as-natural-width', this.$img.naturalWidth + 'px').addStyle('--as-natural-height', this.$img.naturalHeight + 'px').addStyle('--as-image-ratio', this.$img.naturalWidth / this.$img.naturalHeight); this.updateViewStyle(); }); }; Image.prototype.createDataBindingDescriptor = function () { var thisC = this; return { configurable: true, set: function (value) { thisC.setAttribute('src', value); }, get: function () { return thisC.getAttribute('src'); } }; }; _Assembler.AssemblerInstance.addClass(Image); var _default = Image; exports.default = _default;