csv-to-form

1.0.5 • Public • Published

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>`

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i csv-to-form

      Weekly Downloads

      0

      Version

      1.0.5

      License

      ISC

      Unpacked Size

      8.69 kB

      Total Files

      4

      Last publish

      Collaborators

      • code.sujan