Giter VIP home page Giter VIP logo

filefy's Introduction

mehmet baran

I started my career professionally in the software industry. I developed a lot of projects, especially in payment systems. Furthermore, I am interested in software architecture, design principles and object oriented programming. For me, it has always been more important to make software teams easier to work and to get right system architectures and best available performance and simplicity. I always want to work in jobs that i can make the company’s software development processes more efficient and more powerful.

Stats about me

mbrn's GitHub Stats

filefy's People

Contributors

demorose avatar mbrn avatar nick-lucas avatar robertgardner avatar strob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

filefy's Issues

Adding a row before columns

I'm working with material table and on my table, there are some filters by date. When I export the data, I need the user to see what they filtered the table, like 'today' or 'yesterday' and a title for the document, which is the page title.

My question is, how can I add a row before the columns name row?
image

Design filefy architecture

Architecture shuld be abstracted that file generators and different file format generators should be added later easily.

All values in exported CSV are enclosed within double quotes

I am using this package in my ReactJS code with material-table. In the exported CSV, all values are enclosed within double quotes. (see below)

All I want is to export the table as a tab delimited values and I DON'T want these values enclosed in double quotes. If I open the exported file and save as tab delimited file, I can see MS-Excel is removing double quotes.

"Title","First Name","Last Name","Address Line 1","Address Line 2","City","State","PostCode","Phone","Mobile","Fax","Email","Company","Order Number","Primary Campus","Category","Permit Type","Receipt Number","Staff\Student ID","Rego No","Make","Alt Rego No","Alt Make","Validations Errors","Warnings"
"","Greg Turnbull","Odgers","14 Empire St","","Poke","AB","C2750","","90909090","","[email protected]","","897878723","Hando",,"General Half Year ","WEB181224","47","8987723","yywte","Mazda 3","iouuu","",
"","Bob","Gaunder","222 CAT drive","","Nona","CT","D2126","","8977776","","[email protected]","","89898","Jacksonville",,"General Annual ","WEB181226","94","787233","FFR782","nissan","","",

<MaterialTable
title="Validation Results"
icons={tableIcons}
columns={columns}
data={applicationList}
options={{
exportButton: true,
exportAllData: true,
exportDelimiter: " ",
exportCsv: (columns, applicationList) => {
const repoColumns = columns.filter(columnDef => {
return !columnDef.hidden && columnDef.field && columnDef.export !== false;
});

                  let data = applicationList.map(rowData =>
                      columns.map(columnDef => {
                        return columnDef.render ? columnDef.render(rowData) : rowData[columnDef.field];
                      })
                    );
                    
                    alert('You should develop a code to export ' + data + ' rows');
                    new CsvBuilder(fileName+"_01")
                        .setDelimeter(',')
                        .setColumns(columns.map(columnDef => columnDef.title))
                        .addRows(data)
                        .exportFile();
                  },
                  showTitle: false,
                  isLoading: true,
                  //exportDelimiter: '        ',
                  headerStyle: {
                    backgroundColor: "#01579b",
                    color: "#FFF",
                  },
                  rowStyle: (rowData) => ({
                    color: rowData.errors !== "" ? "red" : "",
                  }),
                }}
                editable={{
                  onRowUpdate: (newData, oldData) =>
                    new Promise((resolve, reject) => {
                      setTimeout(() => {
                        const dataUpdate = [...applicationList];
                        const index = oldData.tableData.id;
                        dataUpdate[index] = newData;
                        setApplicationList([...dataUpdate]);

                        resolve();
                      }, 1000);
                    }),
                }}
              />

Multiple occurrences of the CSV escape character double quote (") are not escaped

In CsvBuilder.ts the function escapeCell() is making the following call to insert "escapes" (presumably) for all occurrences of double-quote found in the "cell value" passed in:

private escapeCell(cellData: string): string { if(typeof cellData === 'string') { return '"' + cellData.replace('"', '""') + '"'; } return cellData; }

The replace currently will only replace the first occurrence of a double-quote encountered in the cellData; later, this leads to rendering problems in the spreadsheet. I tested the following change on my own system:

   return '"' + cellData.replace(/\"/g, '""') + '"';

Seems to work fine (fixed my spreadsheet issue anyway). Sorry I am not providing a link to a codepen or such; I am a newbie and it would take me a little time to get the hang of that, and I am short on time at the moment. I just wanted to bring this one to attention as we are trying to use the CSV Builder in conjunction with Material Table in our project. I would be glad to submit a PR if that works best for all of you.

Please advise...

Escape cells

The output CSV doesn't quote values, resulting in some weird output. (For exemple, if there is a line break in a cell, then it creates a new line in the file)

Fix:
In getRowData, replace all double quotes by a double double quotes (to escape it) and surround it with double quotes.

return row.map((data) => '"'+data.replace('"', '""')+'"').join(delimiter)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.