alberthaff / ngx-papaparse Goto Github PK
View Code? Open in Web Editor NEWPapa Parse wrapper for Angular
Home Page: https://alberthaff.dk/projects/ngx-papaparse/docs/v8
License: MIT License
Papa Parse wrapper for Angular
Home Page: https://alberthaff.dk/projects/ngx-papaparse/docs/v8
License: MIT License
it happen when I use worker property.
Can you please update to Angular 7
Describe the bug
The compilation error occurs because there are some lines that typescript detects:
An accessor cannot be declared in an ambient context.
The errors are in node_modules/ngx-papaparse/lib/papa.de.ts, in the lines:
To Reproduce
The error occurs when compiling the angular project
ng serve
Expected behavior
hope it compiles correctly, no errors
Software and platform
Additional context
Although it is not a good practice, the problem can be solved by adding to the tsconfig.ts file, in compilerOptions the line: "skipLibCheck": true, and now, TypeScript allows me to use the library as long as I do not use the incompatible parts or with
Angular produces this message at the build. I can temporarily suppress it by adding an exception to angular.json file, but it would be nice to have the library properly packaged. Here's a link to Angular's documentation on CommonJS related issues: https://angular.io/guide/build#configuring-commonjs-dependencies
WARNING in /home/sergei/Projects/Angular/revenue-matters/node_modules/ngx-papaparse/__ivy_ngcc__/fesm2015/ngx-papaparse.js depends on 'papaparse/papaparse.min.js'. CommonJS or AMD dependencies can cause optimization bailouts.
It sounds, given the documentation for Papa Parse, that the 'comments' property should be of type 'string'. I assume this is a property that hasn't been coded yet. Will it been implemented soon?
We are running the latest Angular release 5.1.0 and getting the following error.
[email protected]" has incorrect peer dependency "@angular/core@^4.1.2".
Can you loosen the dependency range, so we can get rid of the warning?
Papa parse 5.0.0 is out. Some features like transformHeader is really useful, do you mind add support for the latest version?
This is just a suggestion:
After updating an Angular Project from v14
to v15
I get the following warning:
Processing legacy "View Engine" libraries:
- ngx-papaparse [es2015/esm2015] (https://github.com/alberthaff/ngx-papaparse)
Encourage the library authors to publish an Ivy distribution.
As detailed here, Ivy is going to be the only available Engine for Angular.
In your application's tsconfig.json file, remove enableIvy. In v15, Ivy is the only rendering engine so enableIvy is not required.
It is possible that in future versions of Angular this will cause some errors.
This is not feature or bug requests. I am writing this to say Thank You @alberthaff for maintaining this project :)
Love it!
Describe the bug
The exported class Papa
has a method with signature
unparse(data: any, config?: PapaUnparseConfig): string;
however the PapaUnparseConfig
type is not exported from ngx-papaparse, making it impossible to pass a typed variable as parameter to unparse
.
This parameter used to be of type PapaParseConfig which also used to be exported.
To Reproduce
import { Papa, PapaUnparseConfig } from 'ngx-papaparse'; // [ts] Module '".../ngx-papaparse"' has no exported member 'PapaUnparseConfig'. [2305]
...
class SomeClass {
exportConfig: PapaUnparseConfig = {
delimiter: ';',
header: true,
skipEmptyLines: true,
newline: '\r\n',
worker: true,
};
...
someFunction(...) {
...
return this.papaParse.unparse(
{
fields: MY_CSV_COLUMNS,
data: mydata,
},
this.exportConfig);
}
Expected behavior
ngx-papaparse
should export all types that the Papa
class depends on.
Setup Travis CI and add badge to readme
ngx-papaparse- 1.2.2
node - v6.9.1
npm- 5.0.4
angular- 4.2.6
typescript- 2.3.4
C:/USA/Intranet/Client/node_modules/ngx-papaparse/dist/lib/papaparse.interface.d.ts(45,28): error TS7006: Parameter 'b' implicitly has an 'any' type.
Cannot use ngx-papaparse with angular 9+
Already ran npm install [email protected]
ERROR in node_modules/ngx-papaparse/lib/papa.d.ts:5:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.
This likely means that the library (ngx-papaparse) which declares Papa has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be
compatible with Ivy.
5 export declare class Papa {
On the "Generating CSV" page in the docs, the last example shows the use of "this.papa.parse" instead of "this.papa.unparse".
https://github.com/Alberthaff/ngx-papaparse/wiki/Generating-CSV
Version 5 is not published on npm yet.
Please publish this version because I am using Angular 9 and I need it.
Thanks.
Hi,
I am getting the following error when running the mentioned commands:
ERROR in ./node_modules/papaparse/papaparse.min.js
Module not found: Error: Can't resolve 'stream' in 'C:\development\workbench\node_modules\papaparse'
Describe the bug
Today I upgraded ngx-papaparse to version 6.0 and then my build failed with error message:
./node_modules/ngx-papaparse/fesm2020/ngx-papaparse.mjs:3:0-50 - Error: Module not found: Error: Can't resolve 'papaparse/papaparse.min.js' in '/path/to/project/node_modules/ngx-papaparse/fesm2020'
Papaparse was not added as dependency in package.json because it was not necessary with ngx-paparse@5.
Is it now necessary to add papaparse as dependency to use ngx-papaparse@6 ?
Hi, will you be upgrading to angular 6?
Describe the bug
I'm getting this error while installing packages on my app that's recently been updated to Angular 8:
npm WARN [email protected] requires a peer of @angular/common@^6.0.0 || ^7.0.0 but none is installed. You must install peer dependencies yourself.
To Reproduce
Install current ngx-papaparse on a new or upgraded Angular 8 project
npm install ngx-papaparse --save
Expected behavior
No warnings or errors
Software and platform
I have my "complete" callback assigned results to a component level varible
...
parseCsvFile(file) {
this.papa.parse(file, {
header: true,
dynamicTyping: true,
skipEmptyLines: "greedy",
worker: true,
complete: this.onPapaParseComplete
});
}
onPapaParseComplete(results) {
console.log("Completed Results", results);
this.rosterCSVData = results.data
...
onUploadRoster() {
console.log(this.rosterCSVData) ===> NULL
}
}
I import file and confirmed the data in csv. But later call onUploadRoster(), the result is blank. How come?
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/papaparse/index.d.ts is correct.
This module has, for example, dynamicTyping?: boolean;
even though the accompanying doc comment specifies it can also be an object or folder.
Full support for Angular 5
The docs should be placed in /docs/index.md in each version's branch.
Versions:
Describe the bug
When enabling serviceworkers by setting the according flag to true, the CSV data is correctly parsed, but the page UI completely freezes until parsing is finished. So, the behaviour is the same as wehen setting the workers flag to false.
To Reproduce
{
"glob": "**/papaparse.min.js",
"input": "./node_modules/papaparse",
"output": "/assets/"
}
{
provide: 'PapaParseGlobalConfig',
useValue: <PapaParseGlobalConfig>{
scriptPath: '/assets/papaparse.min.js'
}
}
const csvData = new File([blob], fileName);
this.papa.parse(csvData,
{
fastMode: true,
worker: true,
delimiter: ';',
header: true,
complete: (results, file) => {
some post logic...
...
}
}
}
);
Expected behavior
If the workers flag is set to true the page should stay reactive, while CSV data is parsed, as described in the docs:
Using a worker will keep your page reactive, but may be slightly slower.
Note that worker option is only available when parsing files and not when converting from JSON to CSV.
Software and platform
Additional context
Add any other context about the problem here.
Describe the bug
A clear and concise description of what the bug or problem is.
The documentation tells that if you set the option "header" to true, the first row will be interpreted as field names, however in my case, the header of CSV file starts at row number 3.
To Reproduce
Please provide the necessary steps to reproduce the unwanted behaviour.
This is the screen shot for my CSV file (My personal trade history)
Expected behavior
A clear and concise description of what you expected to happen.
So, generally I want to start the header at line 3 or maybe just ignore the first two lines. As I read the documentation there is an option called "comments" which is of type string, which skips the line whenever it encounters that comment (e.g "#" or "//") but these does not solve my issue.
Software and platform
Additional context
Thank you for providing this library which enable us to parse csv files easily.
I can find a good example on how to provide an upload form input and how to parse it using ngx-papaparse with the streaming feature (320 MB file size)
Can you help me with a simple example how to achieve this plz ?
Switch to Angular-librarian for compilation.
Since PapaParseModule is removed you have to use providers: [Papa]
in your module for it to work, this is not stated in documentation.
Papaparse and Unit Test
I have a method that is using parse from your module and I can't find a way to test this method.
Indeed, all my unit test expect are triggered before complete callback() (because of async).
I tried many things with jasmine : async... tick() ... but I can't find any solution.
Do you have any solution to wait 'complete callback()' in unit test?
Thank you for your help
ERROR in Error: Metadata version mismatch for module D:/admin/node_modules/ngx-papaparse/ngx-papaparse.d.ts, found version 4, expected 3, resolving symbol AppModule in D:/admin/src/app/app.module.ts, resolving symbol AppModule in D:/admin/src/app/app.module.ts
at Error (native)
at syntaxError (D:\admin\node_modules\@angular\compiler\bundles\compiler.umd.js:1729:34)
at simplifyInContext (D:\admin\node_modules\@angular\compiler\bundles\compiler.umd.js:24979:23)
at StaticReflector.simplify (D:\admin\node_modules\@angular\compiler\bundles\compiler.umd.js:24991:13)
at StaticReflector.annotations (D:\admin\node_modules\@angular\compiler\bundles\compiler.umd.js:24418:41)
at _getNgModuleMetadata (D:\admin\node_modules\@angular\compiler-cli\src\ngtools_impl.js:138:31)
at _extractLazyRoutesFromStaticModule (D:\admin\node_modules\@angular\compiler-cli\src\ngtools_impl.js:109:26)
at Object.listLazyRoutesOfModule (D:\admin\node_modules\@angular\compiler-cli\src\ngtools_impl.js:53:22)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (D:\admin\node_modules\@angular\compiler-cli\src\ngtools_api.js:91:39)
at AotPlugin._getLazyRoutesFromNgtools (D:\admin\node_modules\@ngtools\webpack\src\plugin.js:212:44)
at _donePromise.Promise.resolve.then.then.then.then.then (D:\admin\node_modules\@ngtools\webpack\src\plugin.js:448:24)
at process._tickCallback (internal/process/next_tick.js:109:7)
webpack: Failed to compile.
any guess what happended?
Feature Request
I would like to see the transformHeader
configuration property supported by this component. This feature is useful for trimming off pesky white space between commas in the header row, in addition to formatting headers in other ways or performing fuzzy matching on them before getting the output back from Papa.
See the PapaParse docs for a complete description of config.transformHeader
.
Expected behavior
I would like to provide a function to configuration which accepts the header as an argument and returns a string to be used in place of that header so that I can trim white space, performing matching, etc. with the headers. This function should work precisely as config.transformHeader
works in PapaParse.
Describe the bug
I'm getting this warning while installing packages on my app that's recently been updated to Angular 9:
Entry point 'ngx-papaparse' contains deep imports into '.../node_modules/papaparse/papaparse.min.js'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
To Reproduce
Install current ngx-papaparse on a new or upgraded Angular 9 project
Expected behavior
No warnings or errors
Software and platform
Additional context
I tried installing with the following command from the readme instructions:
npm install ngx-papaparse@5 --save
However I got the following error:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for ngx-papaparse@5.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
So, I went down to 4, which installs without any issue:
npm install ngx-papaparse@4 --save
However, I cannot actually use the library in my project (in app.module.ts):
import { PapaParseModule } from 'ngx-papaparse';
Results in the this error:
Module '"../../node_modules/ngx-papaparse/ngx-papaparse"' has no exported member 'PapaParseModule'.ts(2305)
I have an import file
code,from,to
IMSF01,0700,2200
but after import (code below), i noticed the console log showing 'from' node is storing 700 (number) instead of 0700 (string)
this.papa.parse($event.srcElement.files[0], {
header: true,
dynamicTyping: true,
skipEmptyLines: "greedy",
worker: true,
complete: (result, file) => {
// BUG! imported 0700 became 700
console.log(result);
this.importData = result.data;
}
})
Is there any any config i can turn on to preserve the leading zeros?
sample.zip
The attached file contains characters like this:
, "
The parser incorrectly parses and creates more data cells than headers.
Angular 10 is now throwing this warning:
WARNING in /someproject/node_modules/ngx-papaparse/__ivy_ngcc__/fesm2015/ngx-papaparse.js depends on 'papaparse/papaparse.min.js'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Just wanted to put this on your radar.
As documented at https://www.papaparse.com/docs#json-to-csv, config for parse
method is different from config for unparse
method.
For example, unparse
config has quotes
option, which does not exist in parse
config.
This library, use PapaParseConfig
interface for both parse
and unparse
method. This cause a compile error when I try to pass {quotes: true}
as config parameter for unparse.
this.papa.unparse(data, {quotes: true});
I think we can fix this problem by providing different inteface for parse
and unparse
.
Setup coveralls and add code-coverage badge to readme
recordSeperator
and unitSeperator
should be named recordSeparator
and unitSeparator
.
I've been getting this error, possibly since a version change:
ERROR in Error: Metadata version mismatch for module /my/directories/node_modules/ngx-papaparse/ngx-papaparse.d.ts, found version 4, expected 3, resolving symbol RandomModule in /my/directories/src/app/modules/features/random/random.module.ts, resolving symbol RandomModule in /my/directories/src/app/modules/features/random/random.module.ts
The error disappears if I replace '"version":4' in ngx-papaparse.metadata.json with '"version":3'.
I'm not sure it's a problem with the module but I'm not really seeing what the error would be on my end either.
Describe the bug
A clear and concise description of what the bug or problem is.
Everytime i run ng serve there is this warning that displays saying Entry point 'ngx-papaparse' contains deep imports into
To Reproduce
Please provide the necessary steps to reproduce the unwanted behaviour.
Previously, I added this package to an Angular 6 Project in stackblitz here for testing purposes only.
Version of ngx-papaparse - 2.1.0
Version of Angular - 6.0.0
Expected behavior
A clear and concise description of what you expected to happen.
I want to fixed this warning though it says that it is not a problem but I'm concern if this will continue to display when I run ng serve in the future, I'm currently in Angular 9.
Software and platform
Additional context
Add any other context about the problem here.
I've search several related topics about this, and the common answer is to ignore because it's not a major problem but I'm not satisfied of this.
Any clarification would be helpful. I'm not really sure if this thing must be taken seriously or not at all. Thanks.
Currently in updated Papa Parse version there is a new options parameter.
delimitersToGuess: [',', '\t', '|', ';', Papa.RECORD_SEP, Papa.UNIT_SEP]
Could you please update PapaParse and config description to expose new settings?
I'd like to have some way to return the response as an async observable, I think it's possible using the step
callback.
I'll fork and look the project, and try to create a PR.
Any suggestions?
Describe the bug
The complete callback has the following signature is PapaParseConfig
complete?: (results: PapaParseResult, parser: PapaParseParser) => void;
but Papa Parse actually calls with the results and a File object if parsing a local file.
This causes type errors when using this callback and the only workaround I found was to define a complete callback specifying the type of the second argument as any
, e.g.
complete: (results, file: any) => {}
The signature for step
looks correct, I'm not sure about chunk
.
Describe the bug
Trying to parse a csv with duplicate column names and config header: true
will rename duplicate headers but will not add the information in the meta properties of the parse result.
To Reproduce
Please provide the necessary steps to reproduce the unwanted behaviour.
this.papa.parse(file, {
worker: true,
header: true,
skipEmptyLines: true,
complete: (results: ParseResult<{[key: string]: string}[]>) => {
console.log(results);
}
}
Expected behavior
According to the documentation, I should see something in ParseResult.meta.renamedHeaders
Software and platform
Additional context
I'm using ngx-papaperse v8.0.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.