BaseSignal.js
3 years ago
SignalCheckbox.js
3 years ago
SignalHiddenArray.js
3 years ago
SignalRadio.js
3 years ago
SignalRange.js
3 years ago
SignalRenderState.js
3 years ago
SignalSelect.js
3 years ago
SignalText.js
3 years ago
SignalWysiwyg.js
3 years ago
functions.js
3 years ago
SignalCheckbox.js
28 lines
| 1 | import BaseSignal from './BaseSignal'; |
| 2 | |
| 3 | function SignalCheckbox() { |
| 4 | BaseSignal.call( this ); |
| 5 | |
| 6 | this.isSupported = function ( node, inputData ) { |
| 7 | return 'checkbox' === node.type; |
| 8 | }; |
| 9 | this.runSignal = function () { |
| 10 | this.input.calcValue = 0; |
| 11 | |
| 12 | for ( const node of this.input.nodes ) { |
| 13 | node.checked = this.input.value.current?.includes( node.value ); |
| 14 | |
| 15 | if ( !node.checked ) { |
| 16 | continue; |
| 17 | } |
| 18 | |
| 19 | this.input.calcValue += parseFloat( |
| 20 | node.dataset?.calculate ?? node.value, |
| 21 | ); |
| 22 | } |
| 23 | }; |
| 24 | } |
| 25 | |
| 26 | SignalCheckbox.prototype = Object.create( BaseSignal.prototype ); |
| 27 | |
| 28 | export default SignalCheckbox; |