@@ -31,7 +31,7 @@ define([
31
31
class Frame extends PopupComponent {
32
32
_init ( ) {
33
33
super . _init ( ) ;
34
- this . config . sizeLevel = 4 ;
34
+ this . config . sizeLevel = 5 ;
35
35
this . config . checkModules = [ 'pd' ] ;
36
36
37
37
// state
@@ -788,6 +788,7 @@ define([
788
788
if ( tab === 'apply' ) {
789
789
let colName = $ ( that . wrapSelector ( '.vp-inner-popup-apply-column option:selected' ) ) . text ( ) ;
790
790
$ ( that . wrapSelector ( '.vp-inner-popup-apply-target-name' ) ) . text ( colName ) ;
791
+ $ ( that . wrapSelector ( '.vp-inner-popup-apply-column' ) ) . trigger ( 'change' ) ;
791
792
}
792
793
} ) ;
793
794
@@ -828,6 +829,7 @@ define([
828
829
if ( tab === 'apply' ) {
829
830
let colName = $ ( that . wrapSelector ( '.vp-inner-popup-apply-column option:selected' ) ) . text ( ) ;
830
831
$ ( that . wrapSelector ( '.vp-inner-popup-apply-target-name' ) ) . text ( colName ) ;
832
+ $ ( that . wrapSelector ( '.vp-inner-popup-apply-column' ) ) . trigger ( 'change' ) ;
831
833
}
832
834
} ) ;
833
835
}
@@ -943,10 +945,10 @@ define([
943
945
$ ( that . wrapSelector ( '.vp-inner-popup-apply-cond-usetext' ) ) . prop ( 'checked' , false ) ;
944
946
}
945
947
$ ( operTag ) . replaceWith ( function ( ) {
946
- return that . templateForConditionOperator ( colDtype , 'vp-inner-popup-apply-oper-list' ) ;
948
+ return that . templateForConditionOperator ( colDtype , 'vp-inner-popup-apply-oper-list' , $ ( this ) . val ( ) ) ;
947
949
} ) ;
948
950
$ ( condTag ) . replaceWith ( function ( ) {
949
- return that . templateForConditionCondInput ( category , colDtype , 'vp-inner-popup-apply-condition' ) ;
951
+ return that . templateForConditionCondInput ( category , colDtype , 'vp-inner-popup-apply-condition' , $ ( this ) . val ( ) ) ;
950
952
} ) ;
951
953
} catch {
952
954
$ ( that . wrapSelector ( '.vp-inner-popup-apply-cond-usetext' ) ) . prop ( 'checked' , false ) ;
@@ -981,6 +983,7 @@ define([
981
983
$ ( this . wrapSelector ( '.vp-inner-popup-add-case' ) ) . on ( 'click' , function ( ) {
982
984
// add case
983
985
$ ( this ) . parent ( ) . find ( '.vp-inner-popup-apply-case-box' ) . append ( $ ( that . templateForApplyCase ( ) ) ) ;
986
+ $ ( that . wrapSelector ( '.vp-inner-popup-apply-column' ) ) . trigger ( 'change' ) ;
984
987
} ) ;
985
988
986
989
$ ( document ) . off ( 'click' , this . wrapSelector ( '.vp-inner-popup-apply-add-cond' ) ) ;
@@ -989,6 +992,7 @@ define([
989
992
$ ( this ) . parent ( ) . find ( '.vp-inner-popup-apply-cond-box' ) . append ( $ ( that . templateForApplyCondition ( ) ) ) ;
990
993
// show operator except last operator
991
994
$ ( this ) . parent ( ) . find ( '.vp-inner-popup-apply-oper-connect:not(:last)' ) . show ( ) ;
995
+ $ ( that . wrapSelector ( '.vp-inner-popup-apply-column' ) ) . trigger ( 'change' ) ;
992
996
} ) ;
993
997
994
998
$ ( document ) . off ( 'click' , this . wrapSelector ( '.vp-inner-popup-apply-del-cond' ) ) ;
@@ -1538,12 +1542,12 @@ define([
1538
1542
// content.appendFormatLine('<textarea type="text" id="{0}" class="{1}" placeholder="{2}">lambda x: x</textarea>'
1539
1543
// , 'vp_popupAddApply', 'vp-input vp-inner-popup-apply-lambda', 'Type code manually');
1540
1544
// render condition
1541
- content . appendLine ( '<div class="vp-grid-box vp-scrollbar" style="max-height: 220px ;">' ) ;
1545
+ content . appendLine ( '<div class="vp-grid-box vp-scrollbar" style="max-height: 180px ;">' ) ;
1542
1546
content . appendFormatLine ( '<div class="{0}">' , 'vp-inner-popup-apply-case-box' ) ;
1543
1547
content . appendLine ( this . templateForApplyCase ( ) ) ;
1544
1548
content . appendLine ( '</div>' ) ;
1545
- content . appendFormatLine ( '<button class="vp-button {0}">+ Case</button>' , 'vp-inner-popup-add-case' ) ;
1546
1549
content . appendLine ( '</div>' ) ;
1550
+ content . appendFormatLine ( '<button class="vp-button {0}">+ Case</button>' , 'vp-inner-popup-add-case' ) ;
1547
1551
content . appendLine ( '<div class="vp-grid-col-120">' ) ;
1548
1552
// else on/off
1549
1553
content . appendFormatLine ( '<button class="vp-button {0}" data-else="off">Else On</button>' , 'vp-inner-popup-toggle-else' ) ;
@@ -2034,7 +2038,7 @@ define([
2034
2038
return content . toString ( ) ;
2035
2039
}
2036
2040
2037
- templateForConditionOperator ( dtype = 'object' , className = 'vp-inner-popup-oper-list' ) {
2041
+ templateForConditionOperator ( dtype = 'object' , className = 'vp-inner-popup-oper-list' , prevValue = '' ) {
2038
2042
var content = new com_String ( ) ;
2039
2043
content . appendFormatLine ( '<select class="{0} {1}">' , 'vp-select s' , className ) ;
2040
2044
var operList = [ '' , '==' , '!=' , '<' , '<=' , '>' , '>=' , 'contains' , 'not contains' , 'starts with' , 'ends with' , 'isnull()' , 'notnull()' ] ;
@@ -2045,16 +2049,22 @@ define([
2045
2049
operList = [ '' , '==' , '!=' , '<' , '<=' , '>' , '>=' , 'isnull()' , 'notnull()' ] ;
2046
2050
}
2047
2051
operList . forEach ( oper => {
2048
- content . appendFormatLine ( '<option value="{0}">{1}</option>' , oper , oper ) ;
2052
+ if ( oper === prevValue ) {
2053
+ content . appendFormatLine ( '<option value="{0}" selected>{1}</option>' , oper , oper ) ;
2054
+ } else {
2055
+ content . appendFormatLine ( '<option value="{0}">{1}</option>' , oper , oper ) ;
2056
+ }
2049
2057
} ) ;
2050
2058
content . appendLine ( '</select>' ) ;
2051
2059
return content . toString ( ) ;
2052
2060
}
2053
2061
2054
- templateForConditionCondInput ( category , dtype = 'object' , className = 'vp-inner-popup-condition' ) {
2062
+ templateForConditionCondInput ( category , dtype = 'object' , className = 'vp-inner-popup-condition' , prevValue = '' ) {
2055
2063
var vpCondSuggest = new SuggestInput ( ) ;
2056
2064
vpCondSuggest . addClass ( 'vp-input m ' + className ) ;
2057
-
2065
+ if ( prevValue !== '' ) {
2066
+ vpCondSuggest . setValue ( prevValue ) ;
2067
+ }
2058
2068
if ( category && category . length > 0 ) {
2059
2069
vpCondSuggest . setPlaceholder ( ( dtype == 'object' ?'Categorical' :dtype ) + " dtype" ) ;
2060
2070
vpCondSuggest . setSuggestList ( function ( ) { return category ; } ) ;
@@ -3405,8 +3415,9 @@ define([
3405
3415
code . appendLine ( codeStr ) ;
3406
3416
code . appendFormat ( "{0}.iloc[{1}:{2}].to_json(orient='{3}')" , tempObj , prevLines , lines , 'split' ) ;
3407
3417
3418
+
3408
3419
this . loading = true ;
3409
- vpKernel . execute ( code . toString ( ) ) . then ( function ( resultObj ) {
3420
+ vpKernel . execute ( com_util . ignoreWarning ( code . toString ( ) ) ) . then ( function ( resultObj ) {
3410
3421
let { result } = resultObj ;
3411
3422
try {
3412
3423
if ( ! result || result . length <= 0 ) {
@@ -3604,7 +3615,7 @@ define([
3604
3615
vpLog . display ( VP_LOG_TYPE . ERROR , result . ename + ': ' + result . evalue , msg , code . toString ( ) ) ;
3605
3616
if ( that . isHidden ( ) == false ) {
3606
3617
// show alert modal only if this popup is visible
3607
- com_util . renderAlertModal ( result . ename + ': ' + result . evalue ) ;
3618
+ com_util . renderAlertModal ( result . ename + ': ' + result . evalue , { content : code . toString ( ) , type : 'code' } ) ;
3608
3619
}
3609
3620
that . loading = false ;
3610
3621
} ) ;
0 commit comments