@@ -18,8 +18,9 @@ define([
18
18
'vp_base/js/com/com_String' ,
19
19
'vp_base/js/com/com_interface' ,
20
20
'vp_base/js/com/component/PopupComponent' ,
21
+ 'vp_base/js/com/component/SuggestInput' ,
21
22
'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 ) {
23
24
24
25
const PROFILE_TYPE = {
25
26
NONE : - 1 ,
@@ -44,7 +45,7 @@ define([
44
45
this . config . codeview = false ;
45
46
this . config . dataview = false ;
46
47
this . config . runButton = false ;
47
- this . config . size = { width : 500 , height : 430 } ;
48
+ this . config . size = { width : 500 , height : 500 } ;
48
49
49
50
this . selectedReport = '' ;
50
51
}
@@ -167,7 +168,7 @@ define([
167
168
// render variable list
168
169
// replace
169
170
$ ( that . wrapSelector ( '#vp_pfVariable' ) ) . replaceWith ( function ( ) {
170
- return that . renderVariableList ( varList ) ;
171
+ return that . templateForVariableList ( varList ) ;
171
172
} ) ;
172
173
$ ( that . wrapSelector ( '#vp_pfVariable' ) ) . trigger ( 'change' ) ;
173
174
} catch ( ex ) {
@@ -176,20 +177,35 @@ define([
176
177
} ) ;
177
178
}
178
179
179
- renderVariableList ( varList ) {
180
- var tag = new com_String ( ) ;
180
+ templateForVariableList ( varList ) {
181
181
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 ( ) ;
193
209
}
194
210
195
211
/**
0 commit comments