1.0.1 • Published 3 years ago

valid-excel-data v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

valid-excel-data

Component in charge of validate the information of a excel table. The information is copied with its headers, it is validated with the headers added in the component instance, and a json is returned.

Installation

Using npm:

npm install valid-excel-data

Using yarn:

yarn add valid-excel-data

Example

<template>
  <div>
    <ValidExcelData
      :title="title"
      :subtitle="subtitle"
      :headers="headers"
      :dataLabels="dataLabels"
      @response="YourMethod"
    />
  </div>
</template>
import ValidExcelData from "valid-excel-data"

export default {
  components: {
    ValidExcelData,
  },
  setup() {
    const headers = [
      { header: "Product", required: true, type: "string" },
      { header: "Stock", required: true, type: "int" },
      { header: "Price", required: true, type: "float" },
      { header: "Comments ", required: false, type: "string" },
    ];
    const title = "Excel information validation";
    const subtitle = "Copy the information and press Ctrl + V to validate";

    const dataLabels = {
      headers: {
        headersValidated: "Header validated",
        headersMissing: "Headers are missing",
        headersNotRequired: "Header not required",
      },
      fields: {
        fieldEmpty: "Empty",
        invalidDataType: "Invalid data type",
      },
      button: {
        textButton: "Continue",
        headersMissing : "Headers are missing",
        invalidDataType: "Field data type invalid",
        fieldEmpty: "Field empty",
      }
    };

    const YourMethod = (json) => {
      // Response of component
      console.log(json);      
    };
},

Props

PropRequiredTypeDefault value
headersTrueArray[]
titleFalseStringValidación de información Excel
subtitleFalseStringCopia la información y presiona Ctrl + V para validar
dataLabelsFalseObjectLabels in spanish

Methods

MethodRequiredResponse
responseTrueArray

Author

Wa-Ai Solutions

License

MIT