Giter Club home page Giter Club logo

vue-data-tablee's Introduction

Vue Data Tablee

JavaScript Style Guide FOSSA Status

Yeap, another Vue table component. This one is based on vue-good-table, a simple and pretty table component.

Screenshot of a styled DataTable component

Install

Install from npm.

npm install vue-data-tablee

With Vue.use function declare vue-data-tablee components.

import 'vue-data-tablee/dist/vue-data-tablee.css'
import Vue from 'vue'
import DataTablee from 'vue-data-tablee'

Vue.use(DataTablee)

You can also import just components you need, without installing globally.

<template>
  <data-table :rows="rows" :cols="cols" />
</template>

<script>
import { DataTable } from 'vue-data-tablee'

export default {
  components: { DataTable },
  ...
}
</script>

Component Props

Name Type Default About
cols Array.<Col> [] Cols list.
rows Array.<Object> [] Rows list.
align 'center' | 'right' | 'left' 'left' Global column alignment option.
empty String '' Empty cell's character.
selectable Boolean false Add checkbox column to select a row. It emits event on change
sort Boolean | Function.(a:*, b:*):Number true Global sort option. Could enable/disable sort or use a custom sort function.
sortExternal Boolean false Only change sort and arrow. Useful to sort outsite component.

Cols properties

Name Type About
label String Column label (<th>{{ label }}</th>).
field String Property name, or property path. Ex 'user.contact.phone'.
align 'center' | 'right' | 'left' Column alignment option. Stronger than global sort
width Number Column width.
hidden Boolean Defines if column is hidden.
headerClass String Adds this class to column header cell.
contentClass String Adds this class to columns content cells.
sort Boolean | Function.(a:*, b:*):Number Could enable/disable column sort or use a custom sort function. Stronger than global sort

Events

Name Payload About
select Array.<Object> Emitted on select row (selectable option).
sort { column:Col, sortment:('ascending'|'descending') } Emitted on sort change.

License

Released under MIT license.

FOSSA Status

vue-data-tablee's People

Contributors

abensur avatar fossabot avatar vitorluizc 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

Watchers

 avatar  avatar  avatar  avatar  avatar

vue-data-tablee's Issues

Add unit tests

All serious livrarias and plugins should have United testa and Vue-Data-Tablee ia not and exception. Só, all features, like listing, sorting and select should be tested.

  • Choose a test framework;
  • Create test script;
  • Create test coverage analysis;
  • Test list and render;
  • Test sort;
  • Test select rows;

Emit sort actions

There's no way to identify sort as events. Emitting them is a simple way to request sort from back-end.

Html on cell value ?

Hi,
Thanks a lot for your work.
I try to use html option into cell value but not works. Do you implement it ?

cols: [
        {
          label: "Name",
          field: "name",
          html: true
        },
rows: [
        {
          name: "<span class='test'></span> Hey !"
        }
]

I defined an html property on my column, but it show <span class='test'></span> like a string and not interprate in html render.
Thanks for your answer.

Define column style

Hi guys !
Do you plan to consider the following column style properties :

  • width
  • hidden
  • tdClass
  • thClass

I need to specify it into column property but not in custom template. That's a lot for your work ;)

Select table rows

Add a way to select, using a checkbox, a row and emit this select event. Also, would be nice to have a prop to select all rows.

Add Storybook and show live documentation examples;

Storybook is a powerfull tool to test style specs, and see component's variants. I can combine It with docs and create a pretty nice documentation page, It also replaces poi on development envirvonment.

  • Add @storybook/vue and NPM build, start scripts;
  • Create all DataTable stories.

Add support to brackets on cols value

Using brackets on cols value throws error on get helper.

[
  { label: 'Company', value: 'users[0].company.name' }
]

I've discovered some ways to do it and a path module alternative. I'd like to use it or something like IDX (https://github.com/facebookincubator/idx).

function getProperty (object: object, property: string): any {
  try {
    const get = new Function('object', `return object.${property}`);
    return get(object);
  } catch (_) {
    return;
  }
}

Don't split functionalities into mixins

Right now, all table functionalities are separated into mixins which handle everything, but DataTable component's template use some that mixin properties. It's hard to trace properties on component's template and the only way to fix it is merging them to component and split only helper functions.

Would be a solution, also, create DataTableRow and DataTableCol to handle style and to export them.

  • Merge Sortable mixin to component;
  • Merge Selectable mixin to component;
  • Merge Alignable mixin to component;
  • Create DataTableRow;
  • Create DataTableCell;

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.