@@ -54,10 +54,12 @@ define([
54
54
pageThis : null , // target's page object
55
55
id : '' , // target id
56
56
value : null , // pre-defined value
57
+ withPopup : true , // with filter button to show simple subset popup
57
58
finish : null , // callback after selection (value, dtype)
58
59
select : null , // callback after selection from suggestInput (value, dtype)
59
60
allowDataType : null , // list of allowed data types
60
61
// additional options
62
+ boxClasses : '' ,
61
63
classes : '' ,
62
64
attrs : '' ,
63
65
placeholder : 'Select variable' ,
@@ -95,7 +97,7 @@ define([
95
97
}
96
98
97
99
this . _target = null ;
98
- if ( this . prop . pageThis ) {
100
+ if ( this . prop . pageThis && this . prop . id !== '' ) {
99
101
this . _target = this . prop . pageThis . wrapSelector ( '#' + this . prop . id ) ;
100
102
}
101
103
@@ -183,7 +185,7 @@ define([
183
185
autoFocus : true ,
184
186
minLength : 0 ,
185
187
source : function ( req , res ) {
186
- var srcList = varList ;
188
+ var srcList = varList . filter ( obj => that . prop . allowDataType . includes ( obj . dtype ) ) ;
187
189
var returlList = new Array ( ) ;
188
190
for ( var idx = 0 ; idx < srcList . length ; idx ++ ) {
189
191
// srcList as object array
@@ -358,20 +360,35 @@ define([
358
360
templateForTarget ( ) {
359
361
let value = this . prop . value ;
360
362
if ( value == undefined ) {
361
- value = this . prop . pageThis . state [ this . prop . id ] || '' ;
363
+ if ( this . prop . id !== '' ) {
364
+ value = this . prop . pageThis . state [ this . prop . id ] || '' ;
365
+ } else {
366
+ value = '' ;
367
+ }
368
+ }
369
+ if ( this . prop . withPopup === true ) {
370
+ return `
371
+ <div class="vp-ds-box vp-ds-box-${ this . uuid } vp-ds-uninit ${ this . prop . boxClasses } ">
372
+ <input type="text" class="vp-ds-target vp-input vp-state ${ this . prop . classes } "
373
+ ${ this . prop . attrs }
374
+ id="${ this . prop . id } " value="${ value } "
375
+ placeholder="${ this . prop . placeholder } " ${ this . prop . required ?'required="required"' :'' } />
376
+ <span class="vp-ds-filter">
377
+ <!-- LAB: img to url -->
378
+ <!-- <img src="${ com_Const . IMAGE_PATH } filter.svg"/> -->
379
+ </span>
380
+ </div>
381
+ ` ;
382
+ } else {
383
+ return `
384
+ <div class="vp-ds-box vp-ds-box-${ this . uuid } vp-ds-uninit ${ this . prop . boxClasses } ">
385
+ <input type="text" class="vp-ds-target vp-input vp-state ${ this . prop . classes } "
386
+ ${ this . prop . attrs }
387
+ id="${ this . prop . id } " value="${ value } "
388
+ placeholder="${ this . prop . placeholder } " ${ this . prop . required ?'required="required"' :'' } />
389
+ </div>
390
+ ` ;
362
391
}
363
- return `
364
- <div class="vp-ds-box vp-ds-box-${ this . uuid } vp-ds-uninit">
365
- <input type="text" class="vp-ds-target vp-input vp-state ${ this . prop . classes } "
366
- ${ this . prop . attrs }
367
- id="${ this . prop . id } " value="${ value } "
368
- placeholder="${ this . prop . placeholder } " ${ this . prop . required ?'required="required"' :'' } />
369
- <span class="vp-ds-filter">
370
- <!-- LAB: img to url -->
371
- <!-- <img src="${ com_Const . IMAGE_PATH } filter.svg"/> -->
372
- </span>
373
- </div>
374
- ` ;
375
392
}
376
393
377
394
templateForMultiSelector ( ) {
0 commit comments