From b768eadc3ea8dccb41837d5e1f35a88d714ffbd3 Mon Sep 17 00:00:00 2001 From: Minku Koo Date: Tue, 30 Aug 2022 21:46:53 +0900 Subject: [PATCH 1/5] add delimiter options --- data/m_library/pandasLibrary.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/data/m_library/pandasLibrary.js b/data/m_library/pandasLibrary.js index d1f38172..50d0d173 100644 --- a/data/m_library/pandasLibrary.js +++ b/data/m_library/pandasLibrary.js @@ -160,6 +160,11 @@ define([ component: 'option_suggest', options: ['None', '0'] }, + { + name: 'delimiter', + type: 'text', + label: 'Delimiter' + }, { name: 'sep', type: 'text', From 1677e7414640e0d073a7b8a1873d23ba817a55dd Mon Sep 17 00:00:00 2001 From: Minku Koo Date: Tue, 30 Aug 2022 21:47:17 +0900 Subject: [PATCH 2/5] update File.js for add tsv --- js/m_apps/File.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/js/m_apps/File.js b/js/m_apps/File.js index 3ae75c07..48960d0f 100644 --- a/js/m_apps/File.js +++ b/js/m_apps/File.js @@ -39,6 +39,7 @@ define([ this.fileExtensions = { 'csv': 'csv', + 'tsv': 'tsv', 'excel': 'xlsx', 'json': 'json', 'pickle': '' @@ -72,6 +73,7 @@ define([ 'Read': { fileTypeId: { 'csv': 'pd004', + 'tsv': 'pd004', 'excel': 'pd123', 'json': 'pd076', 'pickle': 'pd079' @@ -86,6 +88,7 @@ define([ 'Write': { fileTypeId: { 'csv': 'pd005', + 'tsv': 'pd005', 'excel': 'pd124', 'json': 'pd077', 'pickle': 'pd078' @@ -147,7 +150,7 @@ define([ _bindEventByType(pageType) { var that = this; var prefix = '#vp_file' + pageType + ' '; - + // select file type $(this.wrapSelector(prefix + '#fileType')).change(function() { var value = $(this).val(); @@ -244,7 +247,7 @@ define([ renderPage(pageType) { var that = this; var prefix = '#vp_file' + pageType + ' '; - + // clear $(this.wrapSelector(prefix + '#vp_inputOutputBox table tbody')).html(''); $(this.wrapSelector(prefix + '#vp_optionBox table tbody')).html(''); @@ -386,6 +389,13 @@ define([ name: 'fileType', type: 'var' }); + // if file type is tsv + var fileSelected = $("#fileType").val(); + // $ delimeter = '\t' + if($("#fileType").val() === "tsv"){ + $("#delimiter").val(`\n`); + } + var result = pdGen.vp_codeGenerator(this.uuid + ' #vp_fileRead', thisPkg, userOption.toString()); sbCode.append(result); } else if (pageType == 'Write') { From 5386998a7041389199d0f0227ce02699a3c99d44 Mon Sep 17 00:00:00 2001 From: "minku.koo" Date: Tue, 30 Aug 2022 22:52:49 +0900 Subject: [PATCH 3/5] Update pandasLibrary.js --- data/m_library/pandasLibrary.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/data/m_library/pandasLibrary.js b/data/m_library/pandasLibrary.js index 50d0d173..82dd9e1d 100644 --- a/data/m_library/pandasLibrary.js +++ b/data/m_library/pandasLibrary.js @@ -238,6 +238,11 @@ define([ default: 'True', component: 'bool_checkbox' }, + { + name: 'delimiter', + type: 'text', + label: 'Delimiter' + }, { name: 'index', type: 'bool', From 95ce07ab93e0734597f961c52f8002190d712c57 Mon Sep 17 00:00:00 2001 From: "minku.koo" Date: Tue, 30 Aug 2022 22:53:02 +0900 Subject: [PATCH 4/5] Update File.js --- js/m_apps/File.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/m_apps/File.js b/js/m_apps/File.js index 48960d0f..3ab6d5f1 100644 --- a/js/m_apps/File.js +++ b/js/m_apps/File.js @@ -389,11 +389,9 @@ define([ name: 'fileType', type: 'var' }); - // if file type is tsv - var fileSelected = $("#fileType").val(); - // $ delimeter = '\t' + if($("#fileType").val() === "tsv"){ - $("#delimiter").val(`\n`); + $("#delimiter").val('\\' + "t"); } var result = pdGen.vp_codeGenerator(this.uuid + ' #vp_fileRead', thisPkg, userOption.toString()); @@ -404,6 +402,11 @@ define([ name: 'fileType', type: 'var' }); + + if($("#fileType").val() === "tsv"){ + $("#delimiter").val('\\' + "t"); + } + var result = pdGen.vp_codeGenerator(this.uuid + ' #vp_fileWrite', thisPkg, userOption.toString()); sbCode.append(result); } From b848d2f12ef1736833e7d1a86792d8a873ae9c56 Mon Sep 17 00:00:00 2001 From: "minku.koo" Date: Sat, 3 Sep 2022 02:37:56 +0900 Subject: [PATCH 5/5] #175 - Add 'tsv' file on File.js options add tsv ssv dsv extention to csv option --- data/m_library/pandasLibrary.js | 5 ----- js/m_apps/File.js | 25 +++++++++++-------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/data/m_library/pandasLibrary.js b/data/m_library/pandasLibrary.js index 82dd9e1d..50d0d173 100644 --- a/data/m_library/pandasLibrary.js +++ b/data/m_library/pandasLibrary.js @@ -238,11 +238,6 @@ define([ default: 'True', component: 'bool_checkbox' }, - { - name: 'delimiter', - type: 'text', - label: 'Delimiter' - }, { name: 'index', type: 'bool', diff --git a/js/m_apps/File.js b/js/m_apps/File.js index 3ab6d5f1..ba2d3da8 100644 --- a/js/m_apps/File.js +++ b/js/m_apps/File.js @@ -6,7 +6,7 @@ * Note : Apps > File * License : GNU GPLv3 with Visual Python special exception * Date : 2021. 11. 18 - * Change Date : + * Change Date : 2022. 09. 03 */ //============================================================================ @@ -39,7 +39,6 @@ define([ this.fileExtensions = { 'csv': 'csv', - 'tsv': 'tsv', 'excel': 'xlsx', 'json': 'json', 'pickle': '' @@ -73,7 +72,6 @@ define([ 'Read': { fileTypeId: { 'csv': 'pd004', - 'tsv': 'pd004', 'excel': 'pd123', 'json': 'pd076', 'pickle': 'pd079' @@ -88,7 +86,6 @@ define([ 'Write': { fileTypeId: { 'csv': 'pd005', - 'tsv': 'pd005', 'excel': 'pd124', 'json': 'pd077', 'pickle': 'pd078' @@ -150,7 +147,13 @@ define([ _bindEventByType(pageType) { var that = this; var prefix = '#vp_file' + pageType + ' '; + var fileExtensionArr = [that.state.fileExtension]; + // add tsv dsv ssv extension to csv option + if(that.state.fileExtension === 'csv'){ + fileExtensionArr = fileExtensionArr.concat(['tsv', 'dsv', 'ssv']); + } + // select file type $(this.wrapSelector(prefix + '#fileType')).change(function() { var value = $(this).val(); @@ -160,7 +163,7 @@ define([ that.renderPage(pageType); that._bindEventByType(pageType); }); - + // open file navigation $(this.wrapSelector(prefix + '#vp_openFileNavigationBtn')).click(function() { @@ -168,10 +171,10 @@ define([ if (pageType == 'Read') { type = 'open'; } - + let fileNavi = new FileNavigation({ type: type, - extensions: [ that.state.fileExtension ], + extensions: fileExtensionArr, finish: function(filesPath, status, error) { let {file, path} = filesPath[0]; that.state.selectedFile = file; @@ -371,7 +374,7 @@ define([ var sbCode = new com_String; this.saveState(); - + var prefix = '#vp_file' + pageType + ' '; var userOption = new com_String(); var userOptValue = $(this.wrapSelector(prefix + '#userOption')).val(); @@ -390,9 +393,6 @@ define([ type: 'var' }); - if($("#fileType").val() === "tsv"){ - $("#delimiter").val('\\' + "t"); - } var result = pdGen.vp_codeGenerator(this.uuid + ' #vp_fileRead', thisPkg, userOption.toString()); sbCode.append(result); @@ -403,9 +403,6 @@ define([ type: 'var' }); - if($("#fileType").val() === "tsv"){ - $("#delimiter").val('\\' + "t"); - } var result = pdGen.vp_codeGenerator(this.uuid + ' #vp_fileWrite', thisPkg, userOption.toString()); sbCode.append(result);