1.0.5 • Published 2 years ago

csv-to-form v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Csv To Form

Csv To Form is a library that helps to paste bulk data on tabular form.

Demo : https://csv-to-form.netlify.app/

Installation

npm i "csv-to-form"
yarn add "csv-to-form"

Usages

Add data-header attribute on th, which will be used as key of object when paste payload will be provided

Data pasted on column with th class watch will be returned as pasted payload. Use config.watcher to use custom class

Data pasted on column with th class skip-paste will be ignored. Use config.cellFilter to use custom class.

import {useCsvPaster} from "csv-to-form/csv-to-form.js";

window.addEventListener("DOMContentLoaded", (ev) => {
    useCsvPaster(config);
})

Config Options

{
    elem : HTMLTableElement, //elem where paste listener will be added
    watcher : (elem) => {} // use to fetch needed paste cell data,
    cellFilter : (elem) => {} // use to filter cell for paste,
    onCellPasteComplete : (elem) => {} // function to execute after each paste on cell
}

Emitted Events

addRows : (ev)  `emitted when table row has to be added with count on ev.detail`
pasteCompleted : (payload)  `emitted when paste is completed with data on watched cell as Array<Object>`
1.0.5

2 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago