Skip to content

Commit 810310b

Browse files
author
Patrick Knabe
committed
Defaults modified and validation extended
1 parent 3602aa5 commit 810310b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

display.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
return valid;
2222
} },
2323
height: { value: 0 },
24-
digits: { value: 2, validate: digits => ( +digits || 0 ) >= 1 && ( +digits || 0 ) <= 10 },
25-
decimals: { value: 1, validate: decimals => ( +decimals || 0 ) >= 0 && ( +decimals || 0 ) <= 9 }
24+
digits: { value: 5, validate: digits => ( +digits || 0 ) >= 1 && ( +digits || 0 ) <= 10 },
25+
decimals: { value: 1, validate: function( decimals ) {
26+
return ( +decimals || 0 ) >= 0 && ( +decimals || 0 ) < ( +$( '#node-input-digits' ).val() || this.digits );
27+
} }
2628
},
2729
label: function() {
2830
return this.name || 'digital display';

display.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ module.exports = RED => {
2727
</svg>
2828
</div>
2929
`,
30-
width: config.width,
31-
height: +config.height || RED.nodes.getNode( config.group ).config.width,
30+
width: +config.width || RED.nodes.getNode( config.group ).config.width,
31+
height: +config.height || 1,
3232
group: config.group,
3333
order: config.order,
3434
beforeEmit: msg => ( { msg } ),

0 commit comments

Comments
 (0)