@@ -354,29 +354,29 @@ define([
354354 /**
355355 * Render column selector using ColumnSelector module
356356 * @param {Array<string> } previousList previous selected columns
357- * @param {Array<string> } includeList columns to include
357+ * @param {Array<string> } excludeList columns to exclude
358358 */
359- renderColumnSelector ( targetVariable , previousList , includeList ) {
359+ renderColumnSelector ( targetVariable , previousList , excludeList ) {
360360 this . popup . ColSelector = new vpMultiSelector (
361361 this . _wrapSelector ( '.' + APP_POPUP_BODY ) ,
362- { mode : 'columns' , parent : targetVariable , selectedList : previousList , includeList : includeList }
362+ { mode : 'columns' , parent : targetVariable , selectedList : previousList , excludeList : excludeList }
363363 ) ;
364364 }
365365
366366 /**
367367 * Open Inner popup page for column selection
368368 * @param {Object } targetSelector
369369 * @param {string } title
370- * @param {Array<string> } includeList
370+ * @param {Array<string> } excludeList
371371 */
372- openInnerPopup ( targetVariable , targetSelector , title = 'Select columns' , includeList = [ ] ) {
372+ openInnerPopup ( targetVariable , targetSelector , title = 'Select columns' , excludeList = [ ] ) {
373373 this . popup . targetVariable = targetVariable ;
374374 this . popup . targetSelector = targetSelector ;
375375 var previousList = this . popup . targetSelector . data ( 'list' ) ;
376376 if ( previousList ) {
377377 previousList = previousList . map ( col => col . code )
378378 }
379- this . renderColumnSelector ( targetVariable , previousList , includeList ) ;
379+ this . renderColumnSelector ( targetVariable , previousList , excludeList ) ;
380380
381381 // set title
382382 $ ( this . _wrapSelector ( '.' + APP_POPUP_BOX + ' .' + APP_TITLE ) ) . text ( title ) ;
@@ -508,7 +508,8 @@ define([
508508 // index select button event
509509 $ ( document ) . on ( 'click' , this . _wrapSelector ( '#vp_rsIndexSelect' ) , function ( ) {
510510 var targetVariable = [ that . state . variable ] ;
511- that . openInnerPopup ( targetVariable , $ ( that . _wrapSelector ( '#vp_rsIndex' ) ) , 'Select columns' ) ;
511+ var excludeList = [ ...that . state . pivot . columns , ...that . state . pivot . values ] . map ( obj => obj . code ) ;
512+ that . openInnerPopup ( targetVariable , $ ( that . _wrapSelector ( '#vp_rsIndex' ) ) , 'Select columns' , excludeList ) ;
512513 } ) ;
513514
514515 // columns change event
@@ -520,7 +521,8 @@ define([
520521 // columns select button event
521522 $ ( document ) . on ( 'click' , this . _wrapSelector ( '#vp_rsColumnsSelect' ) , function ( ) {
522523 var targetVariable = [ that . state . variable ] ;
523- that . openInnerPopup ( targetVariable , $ ( that . _wrapSelector ( '#vp_rsColumns' ) ) , 'Select columns' ) ;
524+ var excludeList = [ ...that . state . pivot . index , ...that . state . pivot . values ] . map ( obj => obj . code ) ;
525+ that . openInnerPopup ( targetVariable , $ ( that . _wrapSelector ( '#vp_rsColumns' ) ) , 'Select columns' , excludeList ) ;
524526 } ) ;
525527
526528 // values change event
@@ -532,7 +534,8 @@ define([
532534 // values select button event
533535 $ ( document ) . on ( 'click' , this . _wrapSelector ( '#vp_rsValuesSelect' ) , function ( ) {
534536 var targetVariable = [ that . state . variable ] ;
535- that . openInnerPopup ( targetVariable , $ ( that . _wrapSelector ( '#vp_rsValues' ) ) , 'Select columns' ) ;
537+ var excludeList = [ ...that . state . pivot . index , ...that . state . pivot . columns ] . map ( obj => obj . code ) ;
538+ that . openInnerPopup ( targetVariable , $ ( that . _wrapSelector ( '#vp_rsValues' ) ) , 'Select columns' , excludeList ) ;
536539 } ) ;
537540
538541 // id vars change event
@@ -544,7 +547,8 @@ define([
544547 // id vars select button event
545548 $ ( document ) . on ( 'click' , this . _wrapSelector ( '#vp_rsIdVarsSelect' ) , function ( ) {
546549 var targetVariable = [ that . state . variable ] ;
547- that . openInnerPopup ( targetVariable , $ ( that . _wrapSelector ( '#vp_rsIdVars' ) ) , 'Select columns' ) ;
550+ var excludeList = that . state . melt . valueVars . map ( obj => obj . code ) ;
551+ that . openInnerPopup ( targetVariable , $ ( that . _wrapSelector ( '#vp_rsIdVars' ) ) , 'Select columns' , excludeList ) ;
548552 } ) ;
549553
550554 // value vars change event
@@ -556,7 +560,8 @@ define([
556560 // value vars select button event
557561 $ ( document ) . on ( 'click' , this . _wrapSelector ( '#vp_rsValueVarsSelect' ) , function ( ) {
558562 var targetVariable = [ that . state . variable ] ;
559- that . openInnerPopup ( targetVariable , $ ( that . _wrapSelector ( '#vp_rsValueVars' ) ) , 'Select columns' ) ;
563+ var excludeList = that . state . melt . idVars . map ( obj => obj . code ) ;
564+ that . openInnerPopup ( targetVariable , $ ( that . _wrapSelector ( '#vp_rsValueVars' ) ) , 'Select columns' , excludeList ) ;
560565 } ) ;
561566
562567 // allocateTo event
0 commit comments