Skip to content

Commit ec63d1e

Browse files
author
minjk-bl
committed
Edit sizeLevel 4 width
1 parent 311313b commit ec63d1e

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

visualpython/js/m_apps/Frame.js

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ define([
3131
class Frame extends PopupComponent {
3232
_init() {
3333
super._init();
34-
this.config.sizeLevel = 4;
34+
this.config.sizeLevel = 5;
3535
this.config.checkModules = ['pd'];
3636

3737
// state
@@ -788,6 +788,7 @@ define([
788788
if (tab === 'apply') {
789789
let colName = $(that.wrapSelector('.vp-inner-popup-apply-column option:selected')).text();
790790
$(that.wrapSelector('.vp-inner-popup-apply-target-name')).text(colName);
791+
$(that.wrapSelector('.vp-inner-popup-apply-column')).trigger('change');
791792
}
792793
});
793794

@@ -828,6 +829,7 @@ define([
828829
if (tab === 'apply') {
829830
let colName = $(that.wrapSelector('.vp-inner-popup-apply-column option:selected')).text();
830831
$(that.wrapSelector('.vp-inner-popup-apply-target-name')).text(colName);
832+
$(that.wrapSelector('.vp-inner-popup-apply-column')).trigger('change');
831833
}
832834
});
833835
}
@@ -943,10 +945,10 @@ define([
943945
$(that.wrapSelector('.vp-inner-popup-apply-cond-usetext')).prop('checked', false);
944946
}
945947
$(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());
947949
});
948950
$(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());
950952
});
951953
} catch {
952954
$(that.wrapSelector('.vp-inner-popup-apply-cond-usetext')).prop('checked', false);
@@ -981,6 +983,7 @@ define([
981983
$(this.wrapSelector('.vp-inner-popup-add-case')).on('click', function() {
982984
// add case
983985
$(this).parent().find('.vp-inner-popup-apply-case-box').append($(that.templateForApplyCase()));
986+
$(that.wrapSelector('.vp-inner-popup-apply-column')).trigger('change');
984987
});
985988

986989
$(document).off('click', this.wrapSelector('.vp-inner-popup-apply-add-cond'));
@@ -989,6 +992,7 @@ define([
989992
$(this).parent().find('.vp-inner-popup-apply-cond-box').append($(that.templateForApplyCondition()));
990993
// show operator except last operator
991994
$(this).parent().find('.vp-inner-popup-apply-oper-connect:not(:last)').show();
995+
$(that.wrapSelector('.vp-inner-popup-apply-column')).trigger('change');
992996
});
993997

994998
$(document).off('click', this.wrapSelector('.vp-inner-popup-apply-del-cond'));
@@ -1538,12 +1542,12 @@ define([
15381542
// content.appendFormatLine('<textarea type="text" id="{0}" class="{1}" placeholder="{2}">lambda x: x</textarea>'
15391543
// , 'vp_popupAddApply', 'vp-input vp-inner-popup-apply-lambda', 'Type code manually');
15401544
// 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;">');
15421546
content.appendFormatLine('<div class="{0}">', 'vp-inner-popup-apply-case-box');
15431547
content.appendLine(this.templateForApplyCase());
15441548
content.appendLine('</div>');
1545-
content.appendFormatLine('<button class="vp-button {0}">+ Case</button>', 'vp-inner-popup-add-case');
15461549
content.appendLine('</div>');
1550+
content.appendFormatLine('<button class="vp-button {0}">+ Case</button>', 'vp-inner-popup-add-case');
15471551
content.appendLine('<div class="vp-grid-col-120">');
15481552
// else on/off
15491553
content.appendFormatLine('<button class="vp-button {0}" data-else="off">Else On</button>', 'vp-inner-popup-toggle-else');
@@ -2034,7 +2038,7 @@ define([
20342038
return content.toString();
20352039
}
20362040

2037-
templateForConditionOperator(dtype='object', className='vp-inner-popup-oper-list') {
2041+
templateForConditionOperator(dtype='object', className='vp-inner-popup-oper-list', prevValue='') {
20382042
var content = new com_String();
20392043
content.appendFormatLine('<select class="{0} {1}">', 'vp-select s', className);
20402044
var operList = ['', '==', '!=', '<', '<=', '>', '>=', 'contains', 'not contains', 'starts with', 'ends with', 'isnull()', 'notnull()'];
@@ -2045,16 +2049,22 @@ define([
20452049
operList = ['', '==', '!=', '<', '<=', '>', '>=', 'isnull()', 'notnull()'];
20462050
}
20472051
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+
}
20492057
});
20502058
content.appendLine('</select>');
20512059
return content.toString();
20522060
}
20532061

2054-
templateForConditionCondInput(category, dtype='object', className='vp-inner-popup-condition') {
2062+
templateForConditionCondInput(category, dtype='object', className='vp-inner-popup-condition', prevValue='') {
20552063
var vpCondSuggest = new SuggestInput();
20562064
vpCondSuggest.addClass('vp-input m ' + className);
2057-
2065+
if (prevValue !== '') {
2066+
vpCondSuggest.setValue(prevValue);
2067+
}
20582068
if (category && category.length > 0) {
20592069
vpCondSuggest.setPlaceholder((dtype=='object'?'Categorical':dtype) + " dtype");
20602070
vpCondSuggest.setSuggestList(function () { return category; });
@@ -3405,8 +3415,9 @@ define([
34053415
code.appendLine(codeStr);
34063416
code.appendFormat("{0}.iloc[{1}:{2}].to_json(orient='{3}')", tempObj, prevLines, lines, 'split');
34073417

3418+
34083419
this.loading = true;
3409-
vpKernel.execute(code.toString()).then(function(resultObj) {
3420+
vpKernel.execute(com_util.ignoreWarning(code.toString())).then(function(resultObj) {
34103421
let { result } = resultObj;
34113422
try {
34123423
if (!result || result.length <= 0) {
@@ -3604,7 +3615,7 @@ define([
36043615
vpLog.display(VP_LOG_TYPE.ERROR, result.ename + ': ' + result.evalue, msg, code.toString());
36053616
if (that.isHidden() == false) {
36063617
// 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' });
36083619
}
36093620
that.loading = false;
36103621
});

visualpython/js/m_apps/Information.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ define([
3131
super._init();
3232
/** Write codes executed before rendering */
3333
this.config.dataview = false;
34-
this.config.sizeLevel = 4;
34+
this.config.sizeLevel = 5;
3535
this.config.dataview = false;
3636
this.config.runButton = false;
3737
this.config.checkModules = ['pd', 'plt'];

0 commit comments

Comments
 (0)