ChangeData.js
2 years ago
CheckboxData.js
2 years ago
InputData.js
2 years ago
InputMaskedData.js
2 years ago
MultiSelectData.js
2 years ago
NoListenData.js
2 years ago
RadioData.js
2 years ago
RangeData.js
2 years ago
RenderStateData.js
2 years ago
WysiwygData.js
2 years ago
functions.js
2 years ago
ChangeData.js
39 lines
| 1 | import InputData from './InputData'; |
| 2 | import { isChangeType } from '../supports'; |
| 3 | import ReactiveHook from '../reactive/ReactiveHook'; |
| 4 | import { STRICT_MODE } from '../signals/BaseSignal'; |
| 5 | |
| 6 | function ChangeData() { |
| 7 | InputData.call( this ); |
| 8 | |
| 9 | this.isSupported = function ( node ) { |
| 10 | return isChangeType( node ); |
| 11 | }; |
| 12 | this.addListeners = function () { |
| 13 | const [ node ] = this.nodes; |
| 14 | |
| 15 | node.addEventListener( 'change', event => { |
| 16 | this.value.current = event.target.value; |
| 17 | } ); |
| 18 | |
| 19 | !STRICT_MODE && jQuery( node ).on( 'change', event => { |
| 20 | if ( this.value.current == event.target.value ) { |
| 21 | return; |
| 22 | } |
| 23 | this.callable.lockTrigger(); |
| 24 | this.value.current = event.target.value; |
| 25 | this.callable.unlockTrigger(); |
| 26 | } ); |
| 27 | |
| 28 | this.enterKey = new ReactiveHook(); |
| 29 | node.addEventListener( 'keydown', this.handleEnterKey.bind( this ) ); |
| 30 | }; |
| 31 | |
| 32 | this.onClear = function () { |
| 33 | this.silenceSet( '' ); |
| 34 | }; |
| 35 | } |
| 36 | |
| 37 | ChangeData.prototype = Object.create( InputData.prototype ); |
| 38 | |
| 39 | export default ChangeData; |