Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/sale/barcode/src/widget/items/ |
Upload File : |
import {Tag, Event} from 'main.core'; export default class Barcode { constructor(props) { this._id = props.id || 0; this._value = props.value || ''; this._readonly = props.readonly; this._node = null; this._inputNode = null; this._isExist = null; this._eventEmitter = new Event.EventEmitter() } render() { let readonly = this._readonly ? ' readonly="readonly"' : ''; this._inputNode = Tag.render`<input type="text" onchange="${this.onChange.bind(this)}"${readonly}>`; this._inputNode.value = this._value; this._node = Tag.render`<div class="sale-order-shipment-barcode">${this._inputNode}</div>`; return this._node; } onChange() { this._value = this._inputNode.value; this._eventEmitter.emit('onChange', this); } onChangeSubscribe(callback) { this._eventEmitter.subscribe('onChange', callback); } get id() { return this._id; } get value() { return this._value; } set value(value) { this._value = value; this._inputNode.value = value; } set isExist(isExist) { this._isExist = isExist; this.showExistence(isExist); } get isExist() { return this._isExist; } showExistence(isExist) { if(isExist === false) { this._node.classList.remove("exists"); this._node.classList.add("not-exists"); } else if(isExist === true) { this._node.classList.remove("not-exists"); this._node.classList.add("exists"); } else if(isExist === null) { this._node.classList.remove("not-exists"); this._node.classList.remove("exists"); } } }