npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fabiendeborde/mantine-datagrid

v0.1.6

Published

A mantine wrapper around react-table

Downloads

13

Readme

Mantine Datagrid

GitHub release Size GitHub license

A wrapper around React Table (TanStack Table v8) using Mantine.

This library requires the following packages: @emotion/react, @mantine/core, @mantine/hooks, @mantine/dates and it exposes this package: @tanstack/react-table.
It was heavily inspired by the work of Yannick Küchlin (GitHub repository) and Milan Jain(CodeSandbox) from this discussion.

I do not plan to really maintain or update this library except if it is needed by other private projects, but feel free to leave suggestions or bug reports, I'll try my best to check them as soon as I can.

Setup

npm i @fabiendeborde/mantine-datagrid
yarn add @fabiendeborde/mantine-datagrid

Props

| name | type | default | description | | ------------- | ------------- | ------------- | ------------- | | data -required- | T[] | - | Table data | | columns -required- | ColumnDef<T, unknown>[] | - | Table columns definitions | | loading | boolean | false | Show a loader on loading (LoadingOverlay) | | debug | boolean | false | Enable React Table debug logging | | containerProps | ScrollAreaProps | undefined | Table container props (https://mantine.dev/core/scroll-area/) | | containerStyle | CSSProperties | undefined | Table container style | | containerRef | MutableRefObject | undefined | Table container ref | | containerMaxHeight | number | undefined | Table container max height in pixel | | onRowClick | (row: T) => void | undefined | Callback on Table row click (with row values) | | withRowSelection | boolean | false | Enable Row selection | | onRowSelection | (selection: RowSelectionState) => void | undefined | Callback on row selection (with selection state) | | withPagination | boolean | undefined | Enable pagination | | withTopPagination | boolean | false | Enable pagination above the Table | | manualPagination | boolean | undefined | Enables manual pagination | | paginationOptions | object | undefined | Pagination options | | ・paginationOptions.initialPageIndex | number | 0 | Initial page index | | ・paginationOptions.initialPageSize | number | 10 | Initial page size (rows per page) | | ・paginationOptions.pageIndex | number | 0 | Controlled page index (only used when manual pagination is true) | | ・paginationOptions.pageSize | number | 10 | Controlled page size (rows per page) (only used when manual pagination is true) | | ・paginationOptions.pageSizes | string[] | ["10", "25", "50", "100"] | Sets of string for page size (rows per page) selections. | | ・paginationOptions.position | GroupPosition | undefined | Pagination position | | ・paginationOptions.rowsCount | number | undefined | Set data total rows (only used when manual pagination is true) | | ・paginationOptions.pageCount | number | undefined | Set data total pages (only used when manual pagination is true) | | paginationRef | MutableRefObject | undefined | Table pagination ref | | onPaginationChange | (filter: PaginationState) => void | undefined | Callback on pagination change (with pagination state) | | withGlobalFilter | boolean | false | Enable global filter (not recommanded in manual mode, as the global filter will only work on the current page) | | onColumnFilterChange | (filter: ColumnFiltersState) => void | undefined | Ccallback on column filter change (with column fiter state) | | onSortingChange | (sort: SortingState) => void | undefined | Callback on column sort change (with column sorting state) | | striped | boolean | false | If true every odd row of table will have gray background color | | highlightOnHover | boolean | false | If true row will have hover color | | horizontalSpacing | MantineNumberSize | 'xs' | Horizontal cells spacing from theme.spacing or number to set value in px | | verticalSpacing | MantineNumberSize | 'xs' | Vertical cells spacing from theme.spacing or number to set value in px | | fontSize | MantineNumberSize | 'sm' | Sets font size of all text inside table | | withVirtualizedRows | boolean | false | Enable Virtualized Rows | | virtualizedRowOverscan | number | undefined | The amount of items to load both behind and ahead of the current window range | | gridState | GridState { pagination?: PaginationState; sorting?: SortingState; columnFilters?: ColumnFiltersState;} | undefined | Grid State used for controlled pagination & filters |

Usage

<Datagrid<User>
  loading={false}
  debug={false}
  columns={columns}
  data={data}
  withPagination
  withTopPagination={false}
  paginationOptions={{
    initialPageIndex: 0,
    initialPageSize: 10,
    pageSizes: ['10', '25', '50', '100', '250', '1000'],
    position: 'right'
  }}
  withGlobalFilter
  withVirtualizedRows
  virtualizedRowOverscan={25}
/>

License

Distributed under the ISC license. See LICENSE for more information.

TODO

[] update readme [] add tests [] add autocomplete in string filter (use mantine component, withAutocomplete props?) [] improve example project (use real API?)