@@ -34,7 +34,7 @@ define([
34
34
this . config . sizeLevel = 1 ;
35
35
36
36
this . state = {
37
- subsetEditor : undefined ,
37
+ vp_instanceVariable : '' ,
38
38
variable : {
39
39
stack : [ ]
40
40
} ,
@@ -43,6 +43,8 @@ define([
43
43
...this . state
44
44
}
45
45
this . pointer = this . state . variable ;
46
+ this . subsetEditor = null ;
47
+ this . insEditor = null ;
46
48
47
49
this . _addCodemirror ( 'vp_instanceVariable' , this . wrapSelector ( '#vp_instanceVariable' ) , 'readonly' ) ;
48
50
}
@@ -173,7 +175,9 @@ define([
173
175
}
174
176
175
177
templateForBody ( ) {
176
- return insHtml ;
178
+ let page = $ ( insHtml ) ;
179
+ $ ( page ) . find ( '#vp_instanceVariable' ) . val ( this . state . vp_instanceVariable ) ;
180
+ return page ;
177
181
}
178
182
179
183
render ( ) {
@@ -182,25 +186,25 @@ define([
182
186
let that = this ;
183
187
184
188
// vpSubsetEditor
185
- this . state . subsetEditor = new Subset ( { pandasObject : '' , config : { name : 'Subset' } } ,
189
+ this . subsetEditor = new Subset ( { pandasObject : '' , config : { name : 'Subset' } } ,
186
190
{
187
191
useInputVariable : true ,
188
192
targetSelector : this . wrapSelector ( '#vp_instanceVariable' ) ,
189
193
pageThis : this ,
190
194
finish : function ( code ) {
191
195
that . addStack ( ) ;
192
- that . state . subsetEditor . state . pandasObject = code ;
196
+ that . subsetEditor . state . pandasObject = code ;
193
197
that . updateValue ( code ) ;
194
198
}
195
199
} ) ;
196
- this . state . subsetEditor . disableButton ( ) ;
200
+ this . subsetEditor . disableButton ( ) ;
197
201
198
- this . ALLOW_SUBSET_TYPES = this . state . subsetEditor . getAllowSubsetTypes ( ) ;
202
+ this . ALLOW_SUBSET_TYPES = this . subsetEditor . getAllowSubsetTypes ( ) ;
199
203
200
204
// vpInstanceEditor
201
- this . state . variable . insEditor = new InstanceEditor ( this , "vp_instanceVariable" , 'vp_variableInsEditContainer' ) ;
205
+ this . insEditor = new InstanceEditor ( this , "vp_instanceVariable" , 'vp_variableInsEditContainer' ) ;
202
206
203
- this . state . variable . insEditor . show ( ) ;
207
+ this . insEditor . show ( ) ;
204
208
205
209
// variable load
206
210
this . reloadInsEditor ( ) ;
@@ -232,17 +236,17 @@ define([
232
236
233
237
hide ( ) {
234
238
super . hide ( ) ;
235
- this . state . subsetEditor && this . state . subsetEditor . hide ( ) ;
239
+ this . subsetEditor && this . subsetEditor . hide ( ) ;
236
240
}
237
241
238
242
close ( ) {
239
243
super . close ( ) ;
240
- this . state . subsetEditor && this . state . subsetEditor . close ( ) ;
244
+ this . subsetEditor && this . subsetEditor . close ( ) ;
241
245
}
242
246
243
247
remove ( ) {
244
248
super . remove ( ) ;
245
- this . state . subsetEditor && this . state . subsetEditor . remove ( ) ;
249
+ this . subsetEditor && this . subsetEditor . remove ( ) ;
246
250
}
247
251
248
252
updateValue ( value ) {
@@ -254,6 +258,7 @@ define([
254
258
cm . focus ( ) ;
255
259
cm . setCursor ( { line : 0 , ch : value . length } ) ;
256
260
}
261
+ this . state . vp_instanceVariable = value ;
257
262
}
258
263
259
264
addStack ( ) {
@@ -287,22 +292,17 @@ define([
287
292
var varType = varObj . type ;
288
293
289
294
if ( that . ALLOW_SUBSET_TYPES . includes ( varType ) ) {
290
- that . state . subsetEditor . state . dataType = varType ;
295
+ that . subsetEditor . state . dataType = varType ;
291
296
let cmObj = that . getCodemirror ( 'vp_instanceVariable' ) ;
292
297
let nowCode = ( cmObj && cmObj . cm ) ?cmObj . cm . getValue ( ) :'' ;
293
- that . state . subsetEditor . state . pandasObject = nowCode ;
294
- that . state . subsetEditor . enableButton ( ) ;
298
+ that . subsetEditor . state . pandasObject = nowCode ;
299
+ that . subsetEditor . enableButton ( ) ;
295
300
} else {
296
- that . state . subsetEditor . disableButton ( ) ;
301
+ that . subsetEditor . disableButton ( ) ;
297
302
}
298
303
} ;
299
304
300
- if ( type == '' ) {
301
- this . pointer . insEditor . reload ( callbackFunction ) ;
302
- } else {
303
- tempPointer = this . state [ type ] ;
304
- this . state [ type ] . insEditor . reload ( callbackFunction ) ;
305
- }
305
+ this . insEditor . reload ( callbackFunction ) ;
306
306
}
307
307
}
308
308
0 commit comments