@@ -18,8 +18,9 @@ define([
1818 'vp_base/js/com/com_String' ,
1919 'vp_base/js/com/com_interface' ,
2020 'vp_base/js/com/component/PopupComponent' ,
21+ 'vp_base/js/com/component/SuggestInput' ,
2122 'vp_base/js/com/component/FileNavigation'
22- ] , function ( proHTML , proCss , com_String , com_interface , PopupComponent , FileNavigation ) {
23+ ] , function ( proHTML , proCss , com_String , com_interface , PopupComponent , SuggestInput , FileNavigation ) {
2324
2425 const PROFILE_TYPE = {
2526 NONE : - 1 ,
@@ -44,7 +45,7 @@ define([
4445 this . config . codeview = false ;
4546 this . config . dataview = false ;
4647 this . config . runButton = false ;
47- this . config . size = { width : 500 , height : 430 } ;
48+ this . config . size = { width : 500 , height : 500 } ;
4849
4950 this . selectedReport = '' ;
5051 }
@@ -167,7 +168,7 @@ define([
167168 // render variable list
168169 // replace
169170 $ ( that . wrapSelector ( '#vp_pfVariable' ) ) . replaceWith ( function ( ) {
170- return that . renderVariableList ( varList ) ;
171+ return that . templateForVariableList ( varList ) ;
171172 } ) ;
172173 $ ( that . wrapSelector ( '#vp_pfVariable' ) ) . trigger ( 'change' ) ;
173174 } catch ( ex ) {
@@ -176,20 +177,35 @@ define([
176177 } ) ;
177178 }
178179
179- renderVariableList ( varList ) {
180- var tag = new com_String ( ) ;
180+ templateForVariableList ( varList ) {
181181 var beforeValue = $ ( this . wrapSelector ( '#vp_pfVariable' ) ) . val ( ) ;
182- tag . appendFormatLine ( '<select id="{0}" class="vp-select vp-pf-select">' , 'vp_pfVariable' ) ;
183- varList . forEach ( vObj => {
184- // varName, varType
185- var label = vObj . varName ;
186- tag . appendFormatLine ( '<option value="{0}" data-type="{1}" {2}>{3}</option>'
187- , vObj . varName , vObj . varType
188- , beforeValue == vObj . varName ?'selected' :''
189- , label ) ;
190- } ) ;
191- tag . appendLine ( '</select>' ) ; // VP_VS_VARIABLES
192- return tag . toString ( ) ;
182+ if ( beforeValue == null ) {
183+ beforeValue = '' ;
184+ }
185+ // var tag = new com_String();
186+ // tag.appendFormatLine('<select id="{0}" class="vp-select vp-pf-select">', 'vp_pfVariable');
187+ // varList.forEach(vObj => {
188+ // // varName, varType
189+ // var label = vObj.varName;
190+ // tag.appendFormatLine('<option value="{0}" data-type="{1}" {2}>{3}</option>'
191+ // , vObj.varName, vObj.varType
192+ // , beforeValue == vObj.varName?'selected':''
193+ // , label);
194+ // });
195+ // tag.appendLine('</select>'); // VP_VS_VARIABLES
196+ // return tag.toString();
197+
198+ let mappedList = varList . map ( obj => { return { label : obj . varName , value : obj . varName , dtype : obj . varType } } ) ;
199+
200+ var variableInput = new SuggestInput ( ) ;
201+ variableInput . setComponentID ( 'vp_pfVariable' ) ;
202+ variableInput . addClass ( 'vp-pf-select' ) ;
203+ variableInput . setPlaceholder ( 'Select variable' ) ;
204+ variableInput . setSuggestList ( function ( ) { return mappedList ; } ) ;
205+ variableInput . setNormalFilter ( true ) ;
206+ variableInput . setValue ( beforeValue ) ;
207+
208+ return variableInput . toTagString ( ) ;
193209 }
194210
195211 /**
0 commit comments