Skip to content

Commit 5d277b2

Browse files
author
minjk-bl
committed
Edit Subset to allow usage on other apps
1 parent baec650 commit 5d277b2

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

visualpython/js/m_apps/Subset.js

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ define([
2626

2727
/**
2828
* Subset
29+
* ====================================
30+
* Special mode
31+
* 1. useAsModule : Use subset as module like DataSelector
32+
* - No allocation
33+
* - No run to cell (able to use apply button instead)
34+
* - renders button to target
35+
* 2. useInputVariable : Use subset as module but use applied variable
36+
* - No allocation
37+
* - No data selection
38+
* - No run to cell
39+
* - renders button to target
40+
* 3. useInputColumns : Use subset as module but use applied columns
41+
* - No allocation
42+
* - No column selection
2943
*/
3044
class Subset extends PopupComponent {
3145
_init() {
@@ -39,8 +53,9 @@ define([
3953
this.targetSelector = this.prop.targetSelector;
4054
this.pageThis = this.prop.pageThis;
4155

56+
this.useAsModule = this.prop.useAsModule;
4257
this.useInputVariable = this.prop.useInputVariable;
43-
if (this.useInputVariable) {
58+
if (this.useInputVariable === true || this.useAsModule === true) {
4459
this.eventTarget = this.targetSelector;
4560
this.useCell = false; // show apply button only
4661
}
@@ -115,6 +130,13 @@ define([
115130
this.loadStateAfterRender();
116131

117132
// render button
133+
if (this.useAsModule) {
134+
// render button
135+
this.renderButton();
136+
137+
// hide allocate to
138+
$(this.wrapSelector('.' + VP_DS_ALLOCATE_TO)).closest('tr').hide();
139+
}
118140
if (this.useInputVariable) {
119141
// set readonly
120142
$(this.wrapSelector('.' + VP_DS_PANDAS_OBJECT)).attr('disabled', true);
@@ -1911,9 +1933,11 @@ define([
19111933
if (this.useInputVariable) {
19121934
this.loadVariables();
19131935
this.reloadSubsetData();
1936+
}
1937+
if (this.useCell === false) {
19141938
// show save button only
19151939
this.setSaveOnlyMode();
1916-
}
1940+
}
19171941
// generate code after displaying page
19181942
// - codemirror can be set after display
19191943
this.generateCode();
@@ -1924,13 +1948,13 @@ define([
19241948
//====================================================================
19251949

19261950
hideButton() {
1927-
if (this.useInputVariable) {
1951+
if (this.useInputVariable === true || this.useAsModule === true) {
19281952
$(this.pageThis.wrapSelector('.' + VP_DS_BTN + '.' + this.uuid)).hide();
19291953
}
19301954
}
19311955

19321956
disableButton() {
1933-
if (this.useInputVariable) {
1957+
if (this.useInputVariable === true || this.useAsModule === true) {
19341958
var buttonEle = $(this.pageThis.wrapSelector('.' + VP_DS_BTN + '.' + this.uuid));
19351959
if (!buttonEle.hasClass('disabled')) {
19361960
buttonEle.addClass('disabled');
@@ -1939,12 +1963,12 @@ define([
19391963
}
19401964

19411965
enableButton() {
1942-
if (this.useInputVariable) {
1966+
if (this.useInputVariable === true || this.useAsModule === true) {
19431967
$(this.pageThis.wrapSelector('.' + VP_DS_BTN + '.' + this.uuid)).removeClass('disabled');
19441968
}
19451969
}
19461970
showButton() {
1947-
if (this.useInputVariable) {
1971+
if (this.useInputVariable === true || this.useAsModule === true) {
19481972
$(this.pageThis.wrapSelector('.' + VP_DS_BTN + '.' + this.uuid)).show();
19491973
}
19501974
}

0 commit comments

Comments
 (0)