1111 * or submit itself to any jurisdiction.
1212 */
1313
14+ import radioButton from '../../common/form/inputs/RadioButton.js' ;
1415import { h } from '/js/src/index.js' ;
1516
1617/**
@@ -20,33 +21,30 @@ import { h } from '/js/src/index.js';
2021 */
2122const ddflpOperationRadioButtons = ( runModel ) => {
2223 const state = runModel . getDdflpFilterOperation ( ) ;
24+ const name = 'ddFlpFilterRadio' ;
25+ const label1 = 'ANY' ;
26+ const label2 = 'OFF' ;
27+ const label3 = 'ON' ;
2328 return h ( '.form-group-header.flex-row.w-100' , [
24- radioButton ( 'ANY' , state === '' , ( ) => runModel . removeDdflp ( ) ) ,
25- radioButton ( 'OFF' , state === false , ( ) => runModel . setDdflpFilterOperation ( false ) ) ,
26- radioButton ( 'ON' , state === true , ( ) => runModel . setDdflpFilterOperation ( true ) ) ,
29+ radioButton ( {
30+ label : label1 ,
31+ isChecked : state === '' ,
32+ action : ( ) => runModel . removeDdflp ( ) ,
33+ name : name ,
34+ } ) ,
35+ radioButton ( {
36+ label : label2 ,
37+ isChecked : state === false ,
38+ action : ( ) => runModel . setDdflpFilterOperation ( false ) ,
39+ name : name ,
40+ } ) ,
41+ radioButton ( {
42+ label : label3 ,
43+ isChecked : state === true ,
44+ action : ( ) => runModel . setDdflpFilterOperation ( true ) ,
45+ name : name ,
46+ } ) ,
2747 ] ) ;
2848} ;
2949
30- /**
31- * Build a radio button with its configuration and actions
32- * @param {string } label - label to be displayed to the user for radio button
33- * @param {boolean } isChecked - is radio button selected or not
34- * @param {Function } action - action to be followed on user click
35- * @return {vnode } - radio button with label associated
36- */
37- const radioButton = ( label , isChecked , action ) => h ( '.w-33.form-check' , [
38- h ( 'input.form-check-input' , {
39- onchange : action ,
40- type : 'radio' ,
41- id : `ddFlpFilterRadio${ label } ` ,
42- name : 'ddFlpFilterRadio' ,
43- value : label ,
44- checked : isChecked ,
45- } , '' ) ,
46- h ( 'label.form-check-label' , {
47- style : 'cursor: pointer;' ,
48- for : `ddFlpFilterRadio${ label } ` ,
49- } , label ) ,
50- ] ) ;
51-
5250export default ddflpOperationRadioButtons ;
0 commit comments