2.0.0 β€’ Published 5 years ago

vuex-table v2.0.0

Weekly downloads
58
License
MIT
Repository
-
Last release
5 years ago

Vuex-table

Vuex-table is a Vue component created in order to easily fit in any Vue (even Vuex or Typescript) project. It consists on a table representation of informations whose data can be provided both from frontend or backend.

NEW ! Vuex-table is now coded on Vue.js and Typescript (see Documentation)

Features βš™

  • Sorting Rows can be sorted according to column field (ex. sorting names alphabetically ) Image from Gyazo
  • Selection

    Rows can checked one by one or all at once by clicking on checkbox.

    Image from Gyazo

  • Search

    Rows which match with user input in searchbar will be displayed, so that user can easily find the information he/she is looking for.

    Image from Gyazo

  • Pagination

    For better browsing on data, a maximum number of rows is displayed and others can be shown just by changing page.

    Image from Gyazo

  • Show/Hide details

    Each row may contain details that users can show and hide by clicking on the icon.

    Image from Gyazo

  • Show/Hide columns

    Each column can be hidden or shown by clicking on the appropriate checkbox.

    Image from Gyazo

  • Responsive

    Vuex-table is responsive, with simple and intuitive mobile User Experience.

    Image from Gyazo

Language Support (i18n)

Vuex-table is conceived to be translated in all languages. In order to properly set your default language you need the following elements:

  • ISO 639-1 code in lowercase of the language (i.e. en for English, fr for French, etc)
  • A script or JSON containing all translations for each language you'd like to add

Example (for setting German):

// externalLangs.js 

export default {
    "de":
        {
            "search": "Geben Sie Ihren Suchbegriff ein", 
            "previous": "Vorheriges Item", 
            "next": "NΓ€chstes Item"
        }      
    } 

Then you can change your default language like this

import ExternalVuexTableLangs from '../langs/externalLangs.js;

<vuex-table current-lang="de" :langs='ExternalVuexTableLangs' />

Documentation πŸ“”

Documentation is in the docs directory. You can find here online documentation.

Quick start πŸš€

Pss...it's easy! 😎

Install

npm install --save vuex-table

or

yarn add vuex-table

To install dependencies

npm install

Import

import Vue from 'vue';
import VuexTable from 'vuex-table';
 
Vue.use(VuexTable);

Example

<template>
    <vuex-table
        :headers="state.headers"
        :data="state.data"
        :selectable-columns="true"
        :selected-columns.sync="state.selectedColumns"
        :selected-rows.sync="state.selectedRows"
        :enable-details="true"
        :items-per-page="state.itemsPerPage"
        :current-page.sync ="state.currentPage"
    >
        <template slot-scope="props">
             {{props.data}}
        </template>
        <template slot="details" slot-scope="props">
            <span>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut consequatur cupiditate deserunt eligendi eveniet iste iure, labore minus natus nostrum numquam pariatur placeat porro quia repellat veniam vero voluptatem voluptates.</span>
        </template>
    </vuex-table>
</template>

API

Properties

NameDescriptionTypeValuesDefault
backend-paginationUse asynchronous data fetching from any API or backendboolean-false
backend-sortingUse asynchronous data sorting from any API or backendboolean-false
current-langCurrent lang of the tablestringISO 639-1en
current-pageCurrent page showed when initializing the tablenumber-1
dataData passed to the tableObject[]required-
default-sort-directionSort direction by defaultstringasc OR descasc
detailsAll opened detail slots by defaultnumber[]-[]
enable-detailsEnable detail slots for each rowboolean-false
headersHeaders of the tableObject[]required-
is-sortableAllow columns to be sortedboolean-true
langsExtra langs added by the user (see related section)Object-{}
paginatedEnable paginationboolean-true
selectable-columnsAllow columns to be selectedboolean-false
selectable-rowsAllow rows to be selectedboolean-false
selected-columnsSelected columns when initializing the tablenumber[]-[]
selected-rowsSelected rows when initializing the tablenumber[]-[]
totalTotal number of items (for pagination)numberrequired-

Slots

Slot nameDescriptionProps (if scoped)
defaultDefault slot rendered for each cellfield: string, row: number, column: number, header: Object, data: any
detailsRow detail (collapsible)row: number

Events

Event nameDescriptionParameters
sortTriggered when a sort is requestedheader: Object, currentSortDirection: asc OR desc
next-cardTriggered in mobile mode when the next item is requestedoldCard: number, newCard: number
previous-cardTriggered in mobile mode when the previous item is requestedoldCard: number, newCard: number
details-openTriggered when a detail slot is openedindex: number
details-closeTriggered when a detail slot is closedindex: number
selected-rowTriggered when a row is selected or de-selectedselection: number[], newlySelectedRow: number (-1 if all is selected), isDeselected: boolean
selected-columnTriggered when a column is selected or de-selectedselection: number[], newlySelectedRow: number (-1 if all is selected), isDeselected: boolean
page-changeTriggered the current page changeoldPage: number, newPage: number

Collaborators πŸ‘©πŸ»β€πŸ’»πŸ‘¨πŸΌβ€πŸ’»

Superpitch team

License

Code released under MIT license.

Copyright (c) 2019, Superpitch.

2.0.0

5 years ago

1.6.25

6 years ago

1.6.24

6 years ago

1.6.23

6 years ago

1.6.22

6 years ago

1.6.21

6 years ago

1.6.20

6 years ago

1.6.18

6 years ago

1.6.15

6 years ago

1.6.14

6 years ago

1.6.13

6 years ago

1.6.12

6 years ago

1.6.11

6 years ago

1.6.10

6 years ago

1.6.9

6 years ago

1.6.8

6 years ago

1.6.7

6 years ago

1.6.6

6 years ago

1.6.5

6 years ago

1.6.4

6 years ago

1.6.3

6 years ago

1.6.2

6 years ago

1.6.1

6 years ago

1.6.0

6 years ago

1.5.0

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago