From 1bef526ae4838668a80691eac59086586dae520c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Kr=C3=A4mer?= Date: Tue, 30 Jan 2018 09:39:06 +0100 Subject: [PATCH 1/6] fix #80 Hiding Header not working when material isn't used --- lib/angular-csv-import.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/angular-csv-import.js b/lib/angular-csv-import.js index a1a2445..211eb2d 100644 --- a/lib/angular-csv-import.js +++ b/lib/angular-csv-import.js @@ -30,9 +30,9 @@ csvImport.directive('ngCsvImport', function() { var material = angular.isDefined(attrs.material); var multiple = angular.isDefined(attrs.multiple); return '
'+ - '
Header
' + - (material ? '
' : - '') + + '
Header
' + + (material ? '
' : + '
') + '
Encoding
{{encoding}}
'+ '
'+ '
Seperator
'+ From 12a8cc764d28fda0359f059223ce1893129f7f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Kr=C3=A4mer?= Date: Tue, 30 Jan 2018 09:50:01 +0100 Subject: [PATCH 2/6] fix #80 Hiding Header not working when material isn't used Dist Folder --- dist/angular-csv-import.js | 17 ++++++----------- dist/angular-csv-import.min.js | 6 +++--- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/dist/angular-csv-import.js b/dist/angular-csv-import.js index e4306ff..1094ef3 100644 --- a/dist/angular-csv-import.js +++ b/dist/angular-csv-import.js @@ -1,5 +1,5 @@ -/*! angular-csv-import - v0.0.37 - 2017-05-19 -* Copyright (c) 2017 ; Licensed */ +/*! angular-csv-import - v0.0.38 - 2018-01-30 +* Copyright (c) 2018 ; Licensed */ 'use strict'; var csvImport = angular.module('ngCsvImport', []); @@ -26,16 +26,15 @@ csvImport.directive('ngCsvImport', function() { mdInputClass: '@?', mdButtonTitle: '@?', mdSvgIcon: '@?', - uploadButtonLabel: '=', - lockImportSameFile:'=?' + uploadButtonLabel: '=' }, template: function(element, attrs) { var material = angular.isDefined(attrs.material); var multiple = angular.isDefined(attrs.multiple); return '
'+ - '
Header
' + - (material ? '
' : - '') + + '
Header
' + + (material ? '
' : + '
') + '
Encoding
{{encoding}}
'+ '
'+ '
Seperator
'+ @@ -144,10 +143,6 @@ csvImport.directive('ngCsvImport', function() { }); } } - - if(!scope.lockImportSameFile){ - angular.element(document).find('.ng-csv-import.ng-isolate-scope input[type="file"]')[0].value = null; - } }); var csvToJSON = function(content) { diff --git a/dist/angular-csv-import.min.js b/dist/angular-csv-import.min.js index fceda0a..20cdd86 100644 --- a/dist/angular-csv-import.min.js +++ b/dist/angular-csv-import.min.js @@ -1,3 +1,3 @@ -/*! angular-csv-import - v0.0.37 - 2017-05-19 -* Copyright (c) 2017 ; Licensed */ -"use strict";var csvImport=angular.module("ngCsvImport",[]);csvImport.directive("ngCsvImport",function(){return{restrict:"E",transclude:!0,replace:!0,scope:{content:"=?",header:"=?",headerVisible:"=?",separator:"=?",separatorVisible:"=?",result:"=?",encoding:"=?",encodingVisible:"=?",accept:"=?",acceptSize:"=?",acceptSizeExceedCallback:"=?",callback:"=?",mdButtonClass:"@?",mdInputClass:"@?",mdButtonTitle:"@?",mdSvgIcon:"@?",uploadButtonLabel:"="},template:function(a,b){var c=angular.isDefined(b.material),d=angular.isDefined(b.multiple);return'
Header
'+(c?'
':'')+'
Encoding
{{encoding}}
Seperator
'+(c?' {{mdButtonTitle}}':"")+"
"},link:function(a,b,c){if(a.separatorVisible=!!a.separatorVisible,a.headerVisible=!!a.headerVisible,a.acceptSize=a.acceptSize||Number.POSITIVE_INFINITY,a.material=angular.isDefined(c.material),a.multiple=angular.isDefined(c.multiple),a.multiple)throw new Error("Multiple attribute is not supported yet.");var d=angular.element(b[0].querySelector('input[type="file"]')),e=angular.element(b[0].querySelector("md-input-container"));if(a.material&&d){if(d.removeClass("ng-show"),d.addClass("ng-hide"),e){var f=angular.element(e[0].querySelector("div.md-errors-spacer"));f&&f.remove()}a.onClick=function(){d.click()}}angular.element(b[0].querySelector(".separator-input")).on("keyup",function(b){if(null!=a.content){var c={csv:a.content,header:a.header,separator:b.target.value,encoding:a.encoding};a.result=g(c),a.$apply(),"function"==typeof a.callback&&null!=a.callback&&a.callback(b)}}),b.on("change",function(b){if(b.target.files.length){if(b.target.files[0].size>a.acceptSize)return void("function"==typeof a.acceptSizeExceedCallback&&a.acceptSizeExceedCallback(b.target.files[0]));a.filename=b.target.files[0].name;var c=new FileReader;if(c.onload=function(c){a.$apply(function(){var d={csv:c.target.result.replace(/\r\n|\r/g,"\n"),header:a.header,separator:a.separator};a.content=d.csv,a.result=g(d),a.result.filename=a.filename,a.$$postDigest(function(){"function"==typeof a.callback&&null!=a.callback&&a.callback(b)})})},"file"!==b.target.type||null==b.target.files&&null==b.srcElement.files){if(null!=a.content){var d={csv:a.content,header:!a.header,separator:a.separator};a.result=g(d),a.$$postDigest(function(){"function"==typeof a.callback&&null!=a.callback&&a.callback(b)})}}else c.readAsText((b.srcElement||b.target).files[0],a.encoding)}});var g=function(a){var b=a.csv.split(new RegExp('\n(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)')),c=[],d=0,e=b[0].split(a.separator).length,f=[];a.header&&(f=b[0].split(a.separator),d=1);for(var g=d;g
Header
'+(c?'
':'
')+'
Encoding
{{encoding}}
Seperator
'+(c?' {{mdButtonTitle}}':"")+"
"},link:function(a,b,c){if(a.separatorVisible=!!a.separatorVisible,a.headerVisible=!!a.headerVisible,a.acceptSize=a.acceptSize||Number.POSITIVE_INFINITY,a.material=angular.isDefined(c.material),a.multiple=angular.isDefined(c.multiple),a.multiple)throw new Error("Multiple attribute is not supported yet.");var d=angular.element(b[0].querySelector('input[type="file"]')),e=angular.element(b[0].querySelector("md-input-container"));if(a.material&&d){if(d.removeClass("ng-show"),d.addClass("ng-hide"),e){var f=angular.element(e[0].querySelector("div.md-errors-spacer"));f&&f.remove()}a.onClick=function(){d.click()}}angular.element(b[0].querySelector(".separator-input")).on("keyup",function(b){if(null!=a.content){var c={csv:a.content,header:a.header,separator:b.target.value,encoding:a.encoding};a.result=g(c),a.$apply(),"function"==typeof a.callback&&null!=a.callback&&a.callback(b)}}),b.on("change",function(b){if(b.target.files.length){if(b.target.files[0].size>a.acceptSize)return void("function"==typeof a.acceptSizeExceedCallback&&a.acceptSizeExceedCallback(b.target.files[0]));a.filename=b.target.files[0].name;var c=new FileReader;if(c.onload=function(c){a.$apply(function(){var d={csv:c.target.result.replace(/\r\n|\r/g,"\n"),header:a.header,separator:a.separator};a.content=d.csv,a.result=g(d),a.result.filename=a.filename,a.$$postDigest(function(){"function"==typeof a.callback&&null!=a.callback&&a.callback(b)})})},"file"!==b.target.type||null==b.target.files&&null==b.srcElement.files){if(null!=a.content){var d={csv:a.content,header:!a.header,separator:a.separator};a.result=g(d),a.$$postDigest(function(){"function"==typeof a.callback&&null!=a.callback&&a.callback(b)})}}else c.readAsText((b.srcElement||b.target).files[0],a.encoding)}});var g=function(a){var b=a.csv.split(new RegExp('\n(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)')),c=[],d=0,e=b[0].split(a.separator).length,f=[];a.header&&(f=b[0].split(a.separator),d=1);for(var g=d;g Date: Tue, 30 Jan 2018 15:10:56 +0100 Subject: [PATCH 3/6] fix #72 in correct file (not in dist) --- lib/angular-csv-import.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/angular-csv-import.js b/lib/angular-csv-import.js index 211eb2d..3bc5265 100644 --- a/lib/angular-csv-import.js +++ b/lib/angular-csv-import.js @@ -24,7 +24,8 @@ csvImport.directive('ngCsvImport', function() { mdInputClass: '@?', mdButtonTitle: '@?', mdSvgIcon: '@?', - uploadButtonLabel: '=' + uploadButtonLabel: '=', + lockImportSameFile:'=?' }, template: function(element, attrs) { var material = angular.isDefined(attrs.material); @@ -141,6 +142,9 @@ csvImport.directive('ngCsvImport', function() { }); } } + if(!scope.lockImportSameFile){ + angular.element(document).find('.ng-csv-import.ng-isolate-scope input[type="file"]')[0].value = null; + } }); var csvToJSON = function(content) { From 7bf58d2f6ffd6f4bfc4063fce2341b897a20d1fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Kr=C3=A4mer?= Date: Tue, 30 Jan 2018 15:12:29 +0100 Subject: [PATCH 4/6] consistent whitespace --- lib/angular-csv-import.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/angular-csv-import.js b/lib/angular-csv-import.js index 3bc5265..59e1144 100644 --- a/lib/angular-csv-import.js +++ b/lib/angular-csv-import.js @@ -82,9 +82,9 @@ csvImport.directive('ngCsvImport', function() { scope.result = csvToJSON(content); scope.$apply(); if ( typeof scope.callback === 'function' ) { - if ( scope.callback != null) { - scope.callback(e); - } + if ( scope.callback != null) { + scope.callback(e); + } } } }); @@ -115,9 +115,9 @@ csvImport.directive('ngCsvImport', function() { scope.result.filename = scope.filename; scope.$$postDigest(function(){ if ( typeof scope.callback === 'function' ) { - if ( scope.callback != null) { - scope.callback(onChangeEvent); - } + if ( scope.callback != null) { + scope.callback(onChangeEvent); + } } }); }); @@ -135,9 +135,9 @@ csvImport.directive('ngCsvImport', function() { scope.result = csvToJSON(content); scope.$$postDigest(function(){ if ( typeof scope.callback === 'function' ) { - if ( scope.callback != null) { - scope.callback(onChangeEvent); - } + if ( scope.callback != null) { + scope.callback(onChangeEvent); + } } }); } From d03fac7a737ac2460a3c0d136b1b796196d28465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Kr=C3=A4mer?= Date: Tue, 30 Jan 2018 15:56:56 +0100 Subject: [PATCH 5/6] update dist --- dist/angular-csv-import.js | 28 ++++++++++++++++------------ dist/angular-csv-import.min.js | 6 +++--- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/dist/angular-csv-import.js b/dist/angular-csv-import.js index 1094ef3..475dd4a 100644 --- a/dist/angular-csv-import.js +++ b/dist/angular-csv-import.js @@ -1,5 +1,5 @@ -/*! angular-csv-import - v0.0.38 - 2018-01-30 -* Copyright (c) 2018 ; Licensed */ +/*! angular-csv-import - v0.0.38 - 2018-01-30 +* Copyright (c) 2018 ; Licensed */ 'use strict'; var csvImport = angular.module('ngCsvImport', []); @@ -26,7 +26,8 @@ csvImport.directive('ngCsvImport', function() { mdInputClass: '@?', mdButtonTitle: '@?', mdSvgIcon: '@?', - uploadButtonLabel: '=' + uploadButtonLabel: '=', + lockImportSameFile:'=?' }, template: function(element, attrs) { var material = angular.isDefined(attrs.material); @@ -83,9 +84,9 @@ csvImport.directive('ngCsvImport', function() { scope.result = csvToJSON(content); scope.$apply(); if ( typeof scope.callback === 'function' ) { - if ( scope.callback != null) { - scope.callback(e); - } + if ( scope.callback != null) { + scope.callback(e); + } } } }); @@ -116,9 +117,9 @@ csvImport.directive('ngCsvImport', function() { scope.result.filename = scope.filename; scope.$$postDigest(function(){ if ( typeof scope.callback === 'function' ) { - if ( scope.callback != null) { - scope.callback(onChangeEvent); - } + if ( scope.callback != null) { + scope.callback(onChangeEvent); + } } }); }); @@ -136,13 +137,16 @@ csvImport.directive('ngCsvImport', function() { scope.result = csvToJSON(content); scope.$$postDigest(function(){ if ( typeof scope.callback === 'function' ) { - if ( scope.callback != null) { - scope.callback(onChangeEvent); - } + if ( scope.callback != null) { + scope.callback(onChangeEvent); + } } }); } } + if(!scope.lockImportSameFile){ + angular.element(document).find('.ng-csv-import.ng-isolate-scope input[type="file"]')[0].value = null; + } }); var csvToJSON = function(content) { diff --git a/dist/angular-csv-import.min.js b/dist/angular-csv-import.min.js index 20cdd86..5ddde1b 100644 --- a/dist/angular-csv-import.min.js +++ b/dist/angular-csv-import.min.js @@ -1,3 +1,3 @@ -/*! angular-csv-import - v0.0.38 - 2018-01-30 -* Copyright (c) 2018 ; Licensed */ -"use strict";var csvImport=angular.module("ngCsvImport",[]);csvImport.directive("ngCsvImport",function(){return{restrict:"E",transclude:!0,replace:!0,scope:{content:"=?",header:"=?",headerVisible:"=?",separator:"=?",separatorVisible:"=?",result:"=?",encoding:"=?",encodingVisible:"=?",accept:"=?",acceptSize:"=?",acceptSizeExceedCallback:"=?",callback:"=?",mdButtonClass:"@?",mdInputClass:"@?",mdButtonTitle:"@?",mdSvgIcon:"@?",uploadButtonLabel:"="},template:function(a,b){var c=angular.isDefined(b.material),d=angular.isDefined(b.multiple);return'
Header
'+(c?'
':'
')+'
Encoding
{{encoding}}
Seperator
'+(c?' {{mdButtonTitle}}':"")+"
"},link:function(a,b,c){if(a.separatorVisible=!!a.separatorVisible,a.headerVisible=!!a.headerVisible,a.acceptSize=a.acceptSize||Number.POSITIVE_INFINITY,a.material=angular.isDefined(c.material),a.multiple=angular.isDefined(c.multiple),a.multiple)throw new Error("Multiple attribute is not supported yet.");var d=angular.element(b[0].querySelector('input[type="file"]')),e=angular.element(b[0].querySelector("md-input-container"));if(a.material&&d){if(d.removeClass("ng-show"),d.addClass("ng-hide"),e){var f=angular.element(e[0].querySelector("div.md-errors-spacer"));f&&f.remove()}a.onClick=function(){d.click()}}angular.element(b[0].querySelector(".separator-input")).on("keyup",function(b){if(null!=a.content){var c={csv:a.content,header:a.header,separator:b.target.value,encoding:a.encoding};a.result=g(c),a.$apply(),"function"==typeof a.callback&&null!=a.callback&&a.callback(b)}}),b.on("change",function(b){if(b.target.files.length){if(b.target.files[0].size>a.acceptSize)return void("function"==typeof a.acceptSizeExceedCallback&&a.acceptSizeExceedCallback(b.target.files[0]));a.filename=b.target.files[0].name;var c=new FileReader;if(c.onload=function(c){a.$apply(function(){var d={csv:c.target.result.replace(/\r\n|\r/g,"\n"),header:a.header,separator:a.separator};a.content=d.csv,a.result=g(d),a.result.filename=a.filename,a.$$postDigest(function(){"function"==typeof a.callback&&null!=a.callback&&a.callback(b)})})},"file"!==b.target.type||null==b.target.files&&null==b.srcElement.files){if(null!=a.content){var d={csv:a.content,header:!a.header,separator:a.separator};a.result=g(d),a.$$postDigest(function(){"function"==typeof a.callback&&null!=a.callback&&a.callback(b)})}}else c.readAsText((b.srcElement||b.target).files[0],a.encoding)}});var g=function(a){var b=a.csv.split(new RegExp('\n(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)')),c=[],d=0,e=b[0].split(a.separator).length,f=[];a.header&&(f=b[0].split(a.separator),d=1);for(var g=d;g
Header
'+(c?'
':'')+'
Encoding
{{encoding}}
Seperator
'+(c?' {{mdButtonTitle}}':"")+"
"},link:function(a,b,c){if(a.separatorVisible=!!a.separatorVisible,a.headerVisible=!!a.headerVisible,a.acceptSize=a.acceptSize||Number.POSITIVE_INFINITY,a.material=angular.isDefined(c.material),a.multiple=angular.isDefined(c.multiple),a.multiple)throw new Error("Multiple attribute is not supported yet.");var d=angular.element(b[0].querySelector('input[type="file"]')),e=angular.element(b[0].querySelector("md-input-container"));if(a.material&&d){if(d.removeClass("ng-show"),d.addClass("ng-hide"),e){var f=angular.element(e[0].querySelector("div.md-errors-spacer"));f&&f.remove()}a.onClick=function(){d.click()}}angular.element(b[0].querySelector(".separator-input")).on("keyup",function(b){if(null!=a.content){var c={csv:a.content,header:a.header,separator:b.target.value,encoding:a.encoding};a.result=g(c),a.$apply(),"function"==typeof a.callback&&null!=a.callback&&a.callback(b)}}),b.on("change",function(b){if(b.target.files.length){if(b.target.files[0].size>a.acceptSize)return void("function"==typeof a.acceptSizeExceedCallback&&a.acceptSizeExceedCallback(b.target.files[0]));a.filename=b.target.files[0].name;var c=new FileReader;if(c.onload=function(c){a.$apply(function(){var d={csv:c.target.result.replace(/\r\n|\r/g,"\n"),header:a.header,separator:a.separator};a.content=d.csv,a.result=g(d),a.result.filename=a.filename,a.$$postDigest(function(){"function"==typeof a.callback&&null!=a.callback&&a.callback(b)})})},"file"!==b.target.type||null==b.target.files&&null==b.srcElement.files){if(null!=a.content){var d={csv:a.content,header:!a.header,separator:a.separator};a.result=g(d),a.$$postDigest(function(){"function"==typeof a.callback&&null!=a.callback&&a.callback(b)})}}else c.readAsText((b.srcElement||b.target).files[0],a.encoding);a.lockImportSameFile||(angular.element(document).find('.ng-csv-import.ng-isolate-scope input[type="file"]')[0].value=null)}});var g=function(a){var b=a.csv.split(new RegExp('\n(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)')),c=[],d=0,e=b[0].split(a.separator).length,f=[];a.header&&(f=b[0].split(a.separator),d=1);for(var g=d;g Date: Tue, 6 Feb 2018 08:31:22 +0100 Subject: [PATCH 6/6] fix #80 Hiding Header not working when material isn't used Fix material button being rendered when material is disabled --- dist/angular-csv-import.js | 6 +++--- dist/angular-csv-import.min.js | 4 ++-- lib/angular-csv-import.js | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dist/angular-csv-import.js b/dist/angular-csv-import.js index 475dd4a..29bda81 100644 --- a/dist/angular-csv-import.js +++ b/dist/angular-csv-import.js @@ -1,4 +1,4 @@ -/*! angular-csv-import - v0.0.38 - 2018-01-30 +/*! angular-csv-import - v0.0.38 - 2018-02-06 * Copyright (c) 2018 ; Licensed */ 'use strict'; @@ -34,8 +34,8 @@ csvImport.directive('ngCsvImport', function() { var multiple = angular.isDefined(attrs.multiple); return '
'+ '
Header
' + - (material ? '
' : - '
') + + (material ? '' : '') + + '' + '
Encoding
{{encoding}}
'+ '
'+ '
Seperator
'+ diff --git a/dist/angular-csv-import.min.js b/dist/angular-csv-import.min.js index 5ddde1b..7982c1b 100644 --- a/dist/angular-csv-import.min.js +++ b/dist/angular-csv-import.min.js @@ -1,3 +1,3 @@ -/*! angular-csv-import - v0.0.38 - 2018-01-30 +/*! angular-csv-import - v0.0.38 - 2018-02-06 * Copyright (c) 2018 ; Licensed */ -"use strict";var csvImport=angular.module("ngCsvImport",[]);csvImport.directive("ngCsvImport",function(){return{restrict:"E",transclude:!0,replace:!0,scope:{content:"=?",header:"=?",headerVisible:"=?",separator:"=?",separatorVisible:"=?",result:"=?",encoding:"=?",encodingVisible:"=?",accept:"=?",acceptSize:"=?",acceptSizeExceedCallback:"=?",callback:"=?",mdButtonClass:"@?",mdInputClass:"@?",mdButtonTitle:"@?",mdSvgIcon:"@?",uploadButtonLabel:"=",lockImportSameFile:"=?"},template:function(a,b){var c=angular.isDefined(b.material),d=angular.isDefined(b.multiple);return'
Header
'+(c?'
':'
')+'
Encoding
{{encoding}}
Seperator
'+(c?' {{mdButtonTitle}}':"")+"
"},link:function(a,b,c){if(a.separatorVisible=!!a.separatorVisible,a.headerVisible=!!a.headerVisible,a.acceptSize=a.acceptSize||Number.POSITIVE_INFINITY,a.material=angular.isDefined(c.material),a.multiple=angular.isDefined(c.multiple),a.multiple)throw new Error("Multiple attribute is not supported yet.");var d=angular.element(b[0].querySelector('input[type="file"]')),e=angular.element(b[0].querySelector("md-input-container"));if(a.material&&d){if(d.removeClass("ng-show"),d.addClass("ng-hide"),e){var f=angular.element(e[0].querySelector("div.md-errors-spacer"));f&&f.remove()}a.onClick=function(){d.click()}}angular.element(b[0].querySelector(".separator-input")).on("keyup",function(b){if(null!=a.content){var c={csv:a.content,header:a.header,separator:b.target.value,encoding:a.encoding};a.result=g(c),a.$apply(),"function"==typeof a.callback&&null!=a.callback&&a.callback(b)}}),b.on("change",function(b){if(b.target.files.length){if(b.target.files[0].size>a.acceptSize)return void("function"==typeof a.acceptSizeExceedCallback&&a.acceptSizeExceedCallback(b.target.files[0]));a.filename=b.target.files[0].name;var c=new FileReader;if(c.onload=function(c){a.$apply(function(){var d={csv:c.target.result.replace(/\r\n|\r/g,"\n"),header:a.header,separator:a.separator};a.content=d.csv,a.result=g(d),a.result.filename=a.filename,a.$$postDigest(function(){"function"==typeof a.callback&&null!=a.callback&&a.callback(b)})})},"file"!==b.target.type||null==b.target.files&&null==b.srcElement.files){if(null!=a.content){var d={csv:a.content,header:!a.header,separator:a.separator};a.result=g(d),a.$$postDigest(function(){"function"==typeof a.callback&&null!=a.callback&&a.callback(b)})}}else c.readAsText((b.srcElement||b.target).files[0],a.encoding);a.lockImportSameFile||(angular.element(document).find('.ng-csv-import.ng-isolate-scope input[type="file"]')[0].value=null)}});var g=function(a){var b=a.csv.split(new RegExp('\n(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)')),c=[],d=0,e=b[0].split(a.separator).length,f=[];a.header&&(f=b[0].split(a.separator),d=1);for(var g=d;g
Header
'+(c?'':'')+'
Encoding
{{encoding}}
Seperator
'+(c?' {{mdButtonTitle}}':"")+"
"},link:function(a,b,c){if(a.separatorVisible=!!a.separatorVisible,a.headerVisible=!!a.headerVisible,a.acceptSize=a.acceptSize||Number.POSITIVE_INFINITY,a.material=angular.isDefined(c.material),a.multiple=angular.isDefined(c.multiple),a.multiple)throw new Error("Multiple attribute is not supported yet.");var d=angular.element(b[0].querySelector('input[type="file"]')),e=angular.element(b[0].querySelector("md-input-container"));if(a.material&&d){if(d.removeClass("ng-show"),d.addClass("ng-hide"),e){var f=angular.element(e[0].querySelector("div.md-errors-spacer"));f&&f.remove()}a.onClick=function(){d.click()}}angular.element(b[0].querySelector(".separator-input")).on("keyup",function(b){if(null!=a.content){var c={csv:a.content,header:a.header,separator:b.target.value,encoding:a.encoding};a.result=g(c),a.$apply(),"function"==typeof a.callback&&null!=a.callback&&a.callback(b)}}),b.on("change",function(b){if(b.target.files.length){if(b.target.files[0].size>a.acceptSize)return void("function"==typeof a.acceptSizeExceedCallback&&a.acceptSizeExceedCallback(b.target.files[0]));a.filename=b.target.files[0].name;var c=new FileReader;if(c.onload=function(c){a.$apply(function(){var d={csv:c.target.result.replace(/\r\n|\r/g,"\n"),header:a.header,separator:a.separator};a.content=d.csv,a.result=g(d),a.result.filename=a.filename,a.$$postDigest(function(){"function"==typeof a.callback&&null!=a.callback&&a.callback(b)})})},"file"!==b.target.type||null==b.target.files&&null==b.srcElement.files){if(null!=a.content){var d={csv:a.content,header:!a.header,separator:a.separator};a.result=g(d),a.$$postDigest(function(){"function"==typeof a.callback&&null!=a.callback&&a.callback(b)})}}else c.readAsText((b.srcElement||b.target).files[0],a.encoding);a.lockImportSameFile||(angular.element(document).find('.ng-csv-import.ng-isolate-scope input[type="file"]')[0].value=null)}});var g=function(a){var b=a.csv.split(new RegExp('\n(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)')),c=[],d=0,e=b[0].split(a.separator).length,f=[];a.header&&(f=b[0].split(a.separator),d=1);for(var g=d;g'+ '
Header
' + - (material ? '
' : - '') + + (material ? '' : '') + + '' + '
Encoding
{{encoding}}
'+ '
'+ '
Seperator
'+