Gathering detailed insights and metrics for mantine-datatable-filter
Gathering detailed insights and metrics for mantine-datatable-filter
Gathering detailed insights and metrics for mantine-datatable-filter
Gathering detailed insights and metrics for mantine-datatable-filter
a lightweight hook which help to handle mantine datatable filtering, column sorting and pagination.
npm install mantine-datatable-filter
Typescript
Module System
Node Version
NPM Version
56.1
Supply Chain
77.1
Quality
74.4
Maintenance
100
Vulnerability
99.6
License
TypeScript (100%)
Total Downloads
1,130
Last Day
1
Last Week
9
Last Month
26
Last Year
227
1 Stars
18 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Apr 02, 2024
Minified
Minified + Gzipped
Latest Version
1.0.9
Package Id
mantine-datatable-filter@1.0.9
Unpacked Size
19.33 kB
Size
4.69 kB
File Count
22
NPM Version
9.5.1
Node Version
18.16.0
Published on
Oct 02, 2023
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
80%
9
Compared to previous week
Last Month
-29.7%
26
Compared to previous month
Last Year
-74.9%
227
Compared to previous year
a lightweight hook which help to handle mantine datatable filtering, column sorting and pagination.
npm install mantine-datatable-filter
1import { DataTable } from 'mantine-datatable' 2import useMantineDataTableFilter from 'mantine-datatable-filter'
1const dtFilter = useMantineDataTableFilter({ 2 sort: { 3 columnAccessor: 'id', 4 direction: 'desc', 5 }, 6 pagination: { 7 totalRecords: totalRecords ?? 0, 8 sizes: [10, 15, 20], 9 }, 10 columns: [ 11 { 12 accessor: 'id', 13 type: 'number', 14 inputProps: { 15 label: 'ID', 16 placeholder: 'Search by ID', 17 } 18 }, 19 { 20 accessor: 'name', 21 type: 'text', 22 inputProps: { 23 label: 'Name', 24 placeholder: 'Search by name', 25 } 26 } 27 ], 28 onChange: (values, cleanedValues) => { 29 // handle change 30 }, 31 debounced: 200 32})
1return <DataTable 2 // Add handler props here. 3 {...dtFilter.props} 4 columns={[ 5 { 6 accessor: 'id', 7 title: 'ID', 8 sortable: true, 9 // Add filter props for each of columns. 10 ...dtFilter.getFilterProps('id') 11 }, 12 { 13 accessor: 'name', 14 title: 'Name', 15 sortable: true, 16 ...dtFilter.getFilterProps('name') 17 } 18 ]} 19 />
Property | Type | Default Value | Description |
---|---|---|---|
accessor | string | Primary key for each column. | |
type | "text" | "number" | "date" | "datetime" | "select" | Column type. | |
post? | (value: "text" | "number" | "date" | "datetime" | "select") => "text" | "number" | "date" | "datetime" | "select" | () => {} | Post process function for a column. Note this will affect only for cleaned value. |
inputProps? | InputProps | {} | Props for filter input. Please refer to mantine documentations for input props. |
resetLabel? | string | "Reset" | Date type only. |
Property | Type | Default Value | Description |
---|---|---|---|
columnAccessor | string | Default sorting key. | |
direction | "asc" | "desc" | Direction of sorting. |
Property | Type | Default Value | Description |
---|---|---|---|
initialPage | number | 1 | Initial page. |
totalRecords | number | Total records. | |
sizes? | number | number[] | 10 | Total records per page. |
Property | Type | Default Value | Description |
---|---|---|---|
values | HandlerValues | Raw values. | |
cleanedValues | HandlerCleanedValues | Cleaned, with post data process and removed blank filters' values. |
Property | Type | Default Value | Description |
---|---|---|---|
debounced? | number | 0 | Debounced state for onChange when user input on filters. |
deps? | DependencyList | any[] | [] | Dependencies for triggering onChange. This is useful for adding extra features to the handler. |
Property | Type | Description |
---|---|---|
values | HandlerValues | Handler values. |
getFilterProps | (accessor: string) => FilterProps | Getter for generating filter option props for a column. |
refetch | () => void | Function for triggering onChange. |
props | DatatableProps | Sorting and pagination props for datatable. |
Property | Type | Description |
---|---|---|
sort | DataTableSortStatus | null | Column for sorting. |
filters | all of { key: FilterType } | Column filters values. |
pagination | { page: number; size: number } | Column pagination values. |
Property | Type | Description |
---|---|---|
accessor | string | Primary key for each column. |
type | "text" | "number" | "date" | "datetime" | "select" | Column type. |
value | (depends on type, refer to mantine documentation) | Column value. |
No vulnerabilities found.
No security vulnerabilities found.