6
6
* Note : Apps > File
7
7
* License : GNU GPLv3 with Visual Python special exception
8
8
* Date : 2021. 11. 18
9
- * Change Date :
9
+ * Change Date : 2022. 09. 03
10
10
*/
11
11
12
12
//============================================================================
@@ -39,7 +39,6 @@ define([
39
39
40
40
this . fileExtensions = {
41
41
'csv' : 'csv' ,
42
- 'tsv' : 'tsv' ,
43
42
'excel' : 'xlsx' ,
44
43
'json' : 'json' ,
45
44
'pickle' : ''
@@ -73,7 +72,6 @@ define([
73
72
'Read' : {
74
73
fileTypeId : {
75
74
'csv' : 'pd004' ,
76
- 'tsv' : 'pd004' ,
77
75
'excel' : 'pd123' ,
78
76
'json' : 'pd076' ,
79
77
'pickle' : 'pd079'
@@ -88,7 +86,6 @@ define([
88
86
'Write' : {
89
87
fileTypeId : {
90
88
'csv' : 'pd005' ,
91
- 'tsv' : 'pd005' ,
92
89
'excel' : 'pd124' ,
93
90
'json' : 'pd077' ,
94
91
'pickle' : 'pd078'
@@ -150,7 +147,13 @@ define([
150
147
_bindEventByType ( pageType ) {
151
148
var that = this ;
152
149
var prefix = '#vp_file' + pageType + ' ' ;
150
+ var fileExtensionArr = [ that . state . fileExtension ] ;
153
151
152
+ // add tsv dsv ssv extension to csv option
153
+ if ( that . state . fileExtension === 'csv' ) {
154
+ fileExtensionArr = fileExtensionArr . concat ( [ 'tsv' , 'dsv' , 'ssv' ] ) ;
155
+ }
156
+
154
157
// select file type
155
158
$ ( this . wrapSelector ( prefix + '#fileType' ) ) . change ( function ( ) {
156
159
var value = $ ( this ) . val ( ) ;
@@ -160,18 +163,18 @@ define([
160
163
that . renderPage ( pageType ) ;
161
164
that . _bindEventByType ( pageType ) ;
162
165
} ) ;
163
-
166
+
164
167
// open file navigation
165
168
$ ( this . wrapSelector ( prefix + '#vp_openFileNavigationBtn' ) ) . click ( function ( ) {
166
169
167
170
let type = 'save' ;
168
171
if ( pageType == 'Read' ) {
169
172
type = 'open' ;
170
173
}
171
-
174
+
172
175
let fileNavi = new FileNavigation ( {
173
176
type : type ,
174
- extensions : [ that . state . fileExtension ] ,
177
+ extensions : fileExtensionArr ,
175
178
finish : function ( filesPath , status , error ) {
176
179
let { file, path} = filesPath [ 0 ] ;
177
180
that . state . selectedFile = file ;
@@ -371,7 +374,7 @@ define([
371
374
var sbCode = new com_String ;
372
375
373
376
this . saveState ( ) ;
374
-
377
+
375
378
var prefix = '#vp_file' + pageType + ' ' ;
376
379
var userOption = new com_String ( ) ;
377
380
var userOptValue = $ ( this . wrapSelector ( prefix + '#userOption' ) ) . val ( ) ;
@@ -390,9 +393,6 @@ define([
390
393
type : 'var'
391
394
} ) ;
392
395
393
- if ( $ ( "#fileType" ) . val ( ) === "tsv" ) {
394
- $ ( "#delimiter" ) . val ( '\\' + "t" ) ;
395
- }
396
396
397
397
var result = pdGen . vp_codeGenerator ( this . uuid + ' #vp_fileRead' , thisPkg , userOption . toString ( ) ) ;
398
398
sbCode . append ( result ) ;
@@ -403,9 +403,6 @@ define([
403
403
type : 'var'
404
404
} ) ;
405
405
406
- if ( $ ( "#fileType" ) . val ( ) === "tsv" ) {
407
- $ ( "#delimiter" ) . val ( '\\' + "t" ) ;
408
- }
409
406
410
407
var result = pdGen . vp_codeGenerator ( this . uuid + ' #vp_fileWrite' , thisPkg , userOption . toString ( ) ) ;
411
408
sbCode . append ( result ) ;
0 commit comments