4.12.10 • Published 5 months ago

@czkoudy/pagination-table v4.12.10

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@czkoudy/pagination-table

React functional component for turning ordinary tables into Pagination Data Tables

NPM JavaScript Style Guide

Downloads

🦸 Looking for contributors

I am looking for contributors who can move this project further.
I would like to work with someone to learn more about Javascript and Typescript, React
and how to work closely with a team.

⚙️Install

npm install --save @czkoudy/pagination-table

📓Usage

import PaginationTable from '@czkoudy/pagination-table';

const data = [{ id: 5 }, { id: 6 }];
const header = [{ label: 'ID' }];
const body = [{ key: 'id' }];

return <PaginationTable data={data} header={header} body={body} />;

🗳️4.3.0-beta Release

🔧Breaking Changes

  • rename sortable to sort in options object

🔥Improvements

  • 🆕 - stayOnPage in options to stay on the same page after data refresh
  • 🆕 - slowly moving to TypeScript
  • 🆕 - table now can have title - options.tableTitle

Changes in 3.7.0

Fix - selection has been redone New - Added option to select all on a page New - Search input is aligned to the right

const options = {
  //rest of options
  selection: {
      key: '_id',
      buttons: [
        {
          component: Button,
          props: {
            onClick: handleOnButtonClick,
            label: 'Delete Selected',
          },
        },
      ],
    },
}

Changes in 3.6.1

New - body option useWholeObject - this will return whole object to set function rather than single field - key and function fields are required

Changes from 3.3.0

Fix - sorting was ignoring casing New - show page length menu

const options = {
    lengthChange:  true, //default false
    lengthMenu:  Array[] // default [5, 10, 15, 20],
}

const options = {
    selection: {
      buttons: [ // Array of object for buttons to be visible
        {
          label: "",
          onClickFunction: () => function() // function will receive an array of keys defined in selection.key
          className: "", // className for button
        }
      ]
    }
}

New option in sortable settings

excludeColumns: Array[] // default [], array of indexes of columns to exclude

Changes from 3.2.5

New - debug option in options object, default: false

Fix - added fields to search objects

  • colums - array of column indexes to be included in search, default string "all"

Changes from 3.2.0

  • now exports PaginationTable as well as usePaginationTable hook

Breaking changes from 3.0.1

  • PaginationTable now uses hooks

  • onRowClick moved to options object

Additional changes from 3.0.1

  • support for row selection

Breaking changes in 2.0.0

Now there is options object passed in rather then individual properties.

search

default: false

// Adding CSS class for input field

search: {
    className: ""
}

sortable

default: false

sortable: {
    column: Integer // index of default column order
  direction: String // 'asc' or 'des'
}

info

default: false

emptyRows

default: false

perPage

default: 10

pagination

default: null

className

default: ""

CSS class for the whole table

All constants are arrays with objects.

API

PaginationTable props

NameTypeRequiredDefault
dataArray[]Yes-
headerArray[]Yes-
bodyArray[]Yes-
optionsArray[]Nosee below

options props

NameTypeRequiredDefaultDescription
perPageIntNo10
emptyRowsBooleanNofalse
lengthChangeBooleanNofalse
lengthMenuArray[]No5,10,15,20
infoBooleanNotrue
searchBoolean or ObjectNofalse
search.columnsArray or StringNo"all"Array of indexes of columns to search within
search.classNameStringNofalseClassName for search input
sortBoolean or ObjectNofalse
sort.columnIntNo0Index of default column to sort by
sort.directionStringNo"asc""asc" or "desc"
sort.excludeColumnsArrayNo[]Array of columns indesx to exclude sorting for
onRowClickObjectNo{}
onRowClick.functionFunctionNo{}function to be actioned on click on row
onRowClick.keyStringNo"id"Key to be passed to functionv
onRowClick.excludeColumnsArrayNonullArray of columns indesx to exclude from onRowClick
loadingObjectNo{}
loading.componentReact.ComponentNonull
loading.textStringNo"Loading"
debugBooleanNofalseLogging to console progress of PaginationTable

header props

NameTypeRequiredDefaultDescription
labelIntNo10
widthBooleanNofalse

header props

NameTypeRequiredDefaultDescription
labelStringYes-
widthStringNo-String with pixel width

body props

NameTypeRequiredDefaultDescription
keyStringYes-
dateStringNo-this is using format() from date-fns module. See more at date-fns
functionFunctionNo-referencing function which will have key as its argument
componentComponentNo-will wrap the key in the Component
useDotBooleanNoTrueallows to dive into objects with dot notation
componentComponentNo-will wrap the key in the Component
componentComponentNo-will wrap the key in the Component

License

MIT © czkoudy

4.12.10

5 months ago

4.12.7

5 months ago

4.12.8

5 months ago

4.12.9

5 months ago

4.12.3

5 months ago

4.12.0

5 months ago

4.12.1

5 months ago

4.12.2

5 months ago

4.11.0

5 months ago

4.10.0

5 months ago

4.9.1

5 months ago

4.9.0

6 months ago

4.4.1

8 months ago

4.4.0

9 months ago

4.8.1

6 months ago

4.8.0

6 months ago

4.8.3

6 months ago

4.8.2

6 months ago

4.7.0

6 months ago

4.3.4

9 months ago

4.3.3

10 months ago

4.6.0

7 months ago

4.5.0

7 months ago

4.1.0-beta

12 months ago

4.0.2-beta

12 months ago

4.0.3-beta

12 months ago

4.0.1-beta

12 months ago

4.3.1-beta

12 months ago

4.3.2

12 months ago

4.3.1

12 months ago

4.2.0-beta

12 months ago

4.3.0-beta

12 months ago

4.0.0-beta

1 year ago

3.7.6

1 year ago

3.7.5

1 year ago

3.7.4

1 year ago

3.7.3

1 year ago

3.7.2

1 year ago

3.7.1

1 year ago

3.7.0

1 year ago

3.6.1

2 years ago

3.5.4

2 years ago

3.6.0

2 years ago

3.5.3

2 years ago

3.5.2

2 years ago

3.5.1

2 years ago

3.5.0

2 years ago

3.4.2

2 years ago

3.4.0

2 years ago

3.4.1

2 years ago

3.3.1

2 years ago

3.3.0

2 years ago

3.3.3

2 years ago

3.3.2

2 years ago

3.2.2

2 years ago

3.2.1

2 years ago

3.2.0

2 years ago

3.2.5

2 years ago

3.2.4

2 years ago

3.2.3

2 years ago

3.1.0

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.7

3 years ago

3.0.6

3 years ago

3.0.5

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.2.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.1.2

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

0.0.15

3 years ago

0.0.16

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.19

3 years ago

0.0.14

3 years ago

0.1.0

3 years ago

0.1.1

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.9

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

1.0.0

3 years ago