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 Markingcode { constructor(props) { this._id = props.id || 0; this._input = null; this._value = props.value || ''; this._readonly = props.readonly; this._eventEmitter = new Event.EventEmitter(); } get id() { return this._id; } get value() { return this._value; } render() { let readonly = this._readonly ? ' readonly="readonly"' : '' this._input = Tag.render`<input type="text" ${readonly}>`; this._input.value = this._value; Event.bind(this._input, 'keypress', this.onKeyPress.bind(this)); Event.bind(this._input, 'change', this.onChange.bind(this)); return this._input; } onChange(e) { this._value = e.target.value; this._eventEmitter.emit('onChange', this); } onKeyPress(e) { /** * @see https://stackoverflow.com/questions/48296955/ascii-control-character-html-input-text */ if (e.charCode === 29) { this._input.value += String.fromCharCode(e.which); } } onChangeSubscribe(callback) { this._eventEmitter.subscribe('onChange', callback); } }