3.18.0 • Published 5 years ago

@tillhub/vue-table-page v3.18.0

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

@tillhub/vue-table-page-pagination CircleCI

Vue Table with Pagination for table range selection

Install

npm install --save @tillhub/vue-table-page

Demo

Usage

<template>
  <vue-table-page
    title="Example Page"
    :message="message"
    :table-length="tableLength"
    @page-change="changeTablesPage">
    <header-example slot="page-header"/>
    <table-example
      slot="page-table"
      :table-data="tableData" />
  </vue-table-page>
</template>

<script>
import Vue from 'vue'
import 'element-ui/lib/theme-chalk/index.css'
import ElementUI from 'element-ui'

Vue.use(ElementUI)

import VueTablePage from '@tillhub/vue-table-page'
import '@tillhub/vue-table-page/dist/vue-table-page.css'

export default {
  name: 'App',
  components: {
    VueTablePage
  },
  methods: {
    changeTablesPage(pages){
      console.log(pages)
    }
  },
}
</script>

CSS

import '@tillhub/vue-table-page/dist/vue-table-page.css'

Slots

There are three slots at the moment. The "header-left", "header-right", and the "page-table".

Slotrequiredlocation
header-leftnoTop of page. Below the Title and Message box if present. All content will be aligned on the left.
header-rightnoTop of page. Below the Title and Message box if present. All content will be aligned on the right.
page-tablenoMiddle of the page below the header and above the pagination footer.

Properties

The Properties for the component.

Propertytyperequiredexampledefaultdescription
localestringno"de" or "en""en"Currently only German and English is supported. Only 'de' and 'en '
table-sizenumberno100nullNeed the total size of table to calculate the pagination if not usting table-data
table-dataArrayno{key: value}[]Must provide if you wish to use the @table-chagne event. Needs to be an Array of objects
hide-paginationbooleannotruefalseWill hide pagination footer
pageobjectno{ offset: 20, limit: 50, callLimit: 500}{ offset: 0, limit: 20, callLimit: 1000}The offset and limit to provide if need to specify location of pagination. The callLimit provides when the next set of data should be called
page-SizesArrayno100, 20020, 50, 100Sets the page size option in footer
call-limitnumberno5001000Will hide pagination footer
header-stylecss Objno{ padding: '10px'}{}Will update style for header
body-cardbolleannotruefalseWill apply a card style around body

The additional properties for header.

Propertytyperequiredexampledefaultdescription
titlestringno"Products"""The title will appear in the top left of header in h2
messagestringno"Info Here"""If provided a pop up box with info button will appear with message below the title if present
show-messagebooleannotruefalseon load will show or hide the message box

The additional properties for using Default Table. Note the default table will be used when a 'page-table' slot is not provided

Propertytyperequiredexampledefaultdescription
table-dataArrayYes{key: value}[]Must provide if you wish to use the default table. Needs to be an Array of objects
table-max-heightNumber/stringNo1000'auto'You can apply a custom max-height to make the header stationary and table scrollable
table-heightNumber/stringNo1000'100%'You can apply a custom height
empty-displayStringNo'N/A''--'Apply a custom default display when the value of cell is null
headersArrayYes{label: 'Lable', value: 'key', minWidth: 10,sortable: true}[]Must provide the headers for the table if using default table. The lable and value (keys from the 'table-data' items) must be provided. Other options are providing the minWidth, or width of column, and if column is sourtable
remote-sortBooleanNotruefalseIf provided the sorting will be disabled and instead an event called 'sort-change' will be emitted.
show-summaryBooleanNotruefalsewhether to display a summary row; columns sum every number in that column up and display them
summary-methodFunctionNo({ columns, data }) => { // return some array }undefinedpass a method to summary-method, which returns an array, and each element of the returned array will be displayed in the columns of the summary row

Table headers parameters option for the 'headers' prop

parametertyperequiredexampledescription
labelstringyes"Product Name"This is what will be shown in the column header
valuestringyes"product_name"This will reference the unique key in the table options
minWidthstringno"10px"The column width will be dynamic. This is the minimum width the column will be.
widthstringno"10px"This will set the column width. Without it the column width will be dynamic.
typestringno"date", "currency"This will format the value according to the local for either date or currency
fixedstring/Booleanno"left", "right", "top", "bottom"This will make the entire column fixed.
formatFunctionnoitem=> !item ? 'n/a' : itemYou can pass in a function that auto formats the cell content

Event

The Pagination will retrun and object with the offSet and size (page limit). This should allow the use to calculate what data is in view of the table

Eventtypeexampledefaultdescription
@page-changefuction(pageObj)=>{}n/aPasses the offset and size in an object on pagination change { offset: 20, limit: 100, callNext: false}. The offset is the place the visable table begins. The limit is the number of item in visable table. the callNext is the
@table-changefuction(pageObj)=>{}n/aWhen the full table is provided in 'table-data' prop, this event will provided the data for the visable data
@height-changenumber235n/aThis will emit the height the body is after calculating header changes. this allows for dynamic sizing

License

MIT © jmy-kellogg

3.18.0

5 years ago

3.16.3

5 years ago

3.17.1

5 years ago

3.17.0

5 years ago

3.16.2

5 years ago

3.16.1

5 years ago

3.16.0

5 years ago

3.15.0

5 years ago

3.14.1

5 years ago

3.14.0

5 years ago

3.13.0

5 years ago

3.12.0

5 years ago

3.11.0

5 years ago

3.10.0

5 years ago

3.9.0

5 years ago

3.8.0

5 years ago

3.7.0

5 years ago

3.6.2

5 years ago

3.6.1

5 years ago

3.6.0

5 years ago

3.5.0

5 years ago

3.4.0

5 years ago

3.3.0

5 years ago

3.2.0

5 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.8.0

5 years ago

1.7.0

5 years ago

1.6.1

5 years ago

1.6.0

5 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.1

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

0.0.0

6 years ago