@neeyo/mantine-datatable 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +142 -0
- package/dist/index.d.ts +1112 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +49 -0
- package/dist/styles.layer.css +49 -0
- package/package.json +113 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 – 2026 Ionuț-Cristian Florescu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Mantine DataTable
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
[![NPM version][npm-image]][npm-url]
|
|
5
|
+
[![License][license-image]][license-url]
|
|
6
|
+
[![Stars][stars-image]][stars-url]
|
|
7
|
+
[![Last commit][last-commit-image]][repo-url]
|
|
8
|
+
[![Language][language-image]][repo-url]
|
|
9
|
+
|
|
10
|
+
The [lightweight](https://bundlephobia.com/package/@neeyo/mantine-datatable), dependency-free, **dark-theme aware** table component for your Mantine UI data-rich applications, featuring asynchronous data loading support, pagination, intuitive Gmail-style additive batch rows selection, column sorting, custom cell data rendering, row expansion, nesting, and [much more](https://documatrix.github.io/mantine-datatable/).
|
|
11
|
+
|
|
12
|
+
> ℹ️ This repository is a fork of the original open-source Mantine DataTable project.
|
|
13
|
+
> It is maintained to match **our own feature requests and semantics for how a table should behave**, so its scope is intentionally narrower than that of a general-purpose community package.
|
|
14
|
+
|
|
15
|
+
[](https://documatrix.github.io/mantine-datatable/)
|
|
16
|
+
|
|
17
|
+
**⚠️ Requires Mantine V9.x.**
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- **Lightweight** - no external dependencies, [no bloat](https://bundlephobia.com/package/@neeyo/mantine-datatable)
|
|
22
|
+
- **Dark-theme aware** - automatically adapts to the current [Mantine color scheme](https://mantine.dev/theming/color-schemes/)
|
|
23
|
+
- **[Fully customizable](https://documatrix.github.io/mantine-datatable/examples/overriding-the-default-styles)** - you can customize the look and feel of the table and its components
|
|
24
|
+
- **[Asynchronous data loading](https://documatrix.github.io/mantine-datatable/examples/asynchronous-data-loading)** - load data from a remote API endpoint and show a loading indicator while waiting for the response
|
|
25
|
+
- **[Pagination](https://documatrix.github.io/mantine-datatable/examples/pagination)** - split large data sets into pages
|
|
26
|
+
- **[Column sorting](https://documatrix.github.io/mantine-datatable/examples/sorting)** - sort data by one or more columns
|
|
27
|
+
- **[Custom cell data rendering](https://documatrix.github.io/mantine-datatable/examples/column-properties-and-styling)** - render cell data using custom components
|
|
28
|
+
- **[Row expansion](https://documatrix.github.io/mantine-datatable/examples/expanding-rows)** - expand a row to show additional details
|
|
29
|
+
- **[Nesting](https://documatrix.github.io/mantine-datatable/examples/nested-tables)** - nest tables to show hierarchical data
|
|
30
|
+
- **[Additive batch rows selection](https://documatrix.github.io/mantine-datatable/examples/records-selection)** - select or deselect ranges of rows using the Shift key
|
|
31
|
+
- **[Automatically-scrollable](https://documatrix.github.io/mantine-datatable/examples/scrollable-vs-auto-height)** - automatically scrollable or auto-height
|
|
32
|
+
- **[AutoAnimate support](https://documatrix.github.io/mantine-datatable/examples/using-with-auto-animate)** - animate row sorting, addition and removal
|
|
33
|
+
- **[Column reordering, toggling](https://documatrix.github.io/mantine-datatable/examples/column-dragging-and-toggling)** and **[resizing](https://documatrix.github.io/mantine-datatable/examples/column-resizing)** - persisted to local storage
|
|
34
|
+
- **[Drag-and-drop support](https://documatrix.github.io/mantine-datatable/examples/row-dragging)** - implemented using [@hello-pangea/dnd](https://github.com/hello-pangea/dnd)
|
|
35
|
+
- **[Comprehensive RTL support](https://documatrix.github.io/mantine-datatable/examples/rtl-support)** - all features automatically adapt to [Mantine `DirectionProvider`](https://mantine.dev/styles/rtl/)'s settings
|
|
36
|
+
- **More** - check out the [full documentation](https://documatrix.github.io/mantine-datatable/)
|
|
37
|
+
|
|
38
|
+
## Full documentation and examples
|
|
39
|
+
|
|
40
|
+
Visit [documatrix.github.io/mantine-datatable](https://documatrix.github.io/mantine-datatable/) to view the full documentation and learn how to use it by browsing a comprehensive list of examples.
|
|
41
|
+
|
|
42
|
+
## Quickstart
|
|
43
|
+
|
|
44
|
+
Create a new [application with Mantine](https://mantine.dev/getting-started/), make sure to have the `clsx` peer dependency installed,
|
|
45
|
+
then install the package with `npm i @neeyo/mantine-datatable`, `yarn add @neeyo/mantine-datatable`, `pnpm add @neeyo/mantine-datatable` or `bun add @neeyo/mantine-datatable`.
|
|
46
|
+
|
|
47
|
+
Import the necessary CSS files:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import '@mantine/core/styles.layer.css';
|
|
51
|
+
import '@neeyo/mantine-datatable/styles.layer.css';
|
|
52
|
+
import './layout.css';
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Make sure to [apply the styles in the correct order](https://mantine.dev/styles/mantine-styles/):
|
|
56
|
+
|
|
57
|
+
```css
|
|
58
|
+
/* layout.css */
|
|
59
|
+
/* 👇 Apply Mantine core styles first, DataTable styles second */
|
|
60
|
+
@layer mantine, mantine-datatable;
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Use the component in your code:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
'use client';
|
|
67
|
+
|
|
68
|
+
import { Box } from '@mantine/core';
|
|
69
|
+
import { showNotification } from '@mantine/notifications';
|
|
70
|
+
import { DataTable } from '@neeyo/mantine-datatable';
|
|
71
|
+
|
|
72
|
+
export function GettingStartedExample() {
|
|
73
|
+
return (
|
|
74
|
+
<DataTable
|
|
75
|
+
withTableBorder
|
|
76
|
+
borderRadius="sm"
|
|
77
|
+
withColumnBorders
|
|
78
|
+
striped
|
|
79
|
+
highlightOnHover
|
|
80
|
+
// 👇 provide data
|
|
81
|
+
records={[
|
|
82
|
+
{ id: 1, name: 'Joe Biden', bornIn: 1942, party: 'Democratic' },
|
|
83
|
+
// more records...
|
|
84
|
+
]}
|
|
85
|
+
// 👇 define columns
|
|
86
|
+
columns={[
|
|
87
|
+
{
|
|
88
|
+
accessor: 'id',
|
|
89
|
+
// 👇 this column has a custom title
|
|
90
|
+
title: '#',
|
|
91
|
+
// 👇 right-align column
|
|
92
|
+
textAlign: 'right',
|
|
93
|
+
},
|
|
94
|
+
{ accessor: 'name' },
|
|
95
|
+
{
|
|
96
|
+
accessor: 'party',
|
|
97
|
+
// 👇 this column has custom cell data rendering
|
|
98
|
+
render: ({ party }) => (
|
|
99
|
+
<Box fw={700} c={party === 'Democratic' ? 'blue' : 'red'}>
|
|
100
|
+
{party.slice(0, 3).toUpperCase()}
|
|
101
|
+
</Box>
|
|
102
|
+
),
|
|
103
|
+
},
|
|
104
|
+
{ accessor: 'bornIn' },
|
|
105
|
+
]}
|
|
106
|
+
// 👇 execute this callback when a row is clicked
|
|
107
|
+
onRowClick={({ record: { name, party, bornIn } }) =>
|
|
108
|
+
showNotification({
|
|
109
|
+
title: `Clicked on ${name}`,
|
|
110
|
+
message: `You clicked on ${name}, a ${party.toLowerCase()} president born in ${bornIn}`,
|
|
111
|
+
withBorder: true,
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
/>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Make sure to browse the comprehensive list of [usage examples](https://documatrix.github.io/mantine-datatable/examples/basic-usage) to learn how to unleash the full power of Mantine DataTable.
|
|
120
|
+
|
|
121
|
+
## Contributing
|
|
122
|
+
|
|
123
|
+
See the [contributing guide in the documentation website](https://documatrix.github.io/mantine-datatable/contribute-and-support) or the repo [CONTRIBUTING.md](https://github.com/documatrix/mantine-datatable/blob/main/CONTRIBUTING.md) file for details.
|
|
124
|
+
|
|
125
|
+
Keep in mind that development focuses on our own feature requests and semantics on how a table should behave — please discuss new ideas in an issue before putting significant effort into a PR.
|
|
126
|
+
|
|
127
|
+
💡 Target your PRs to the `main` branch and use [Conventional Commits](https://www.conventionalcommits.org/) in PR titles — releases are automated with [release-please](https://github.com/googleapis/release-please).
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
The [MIT License](LICENSE).
|
|
132
|
+
This project is a fork; the LICENSE file retains the original copyright notice, as required by the MIT license.
|
|
133
|
+
|
|
134
|
+
[npm-url]: https://npmjs.org/package/@neeyo/mantine-datatable
|
|
135
|
+
[repo-url]: https://github.com/documatrix/mantine-datatable
|
|
136
|
+
[stars-url]: https://github.com/documatrix/mantine-datatable/stargazers
|
|
137
|
+
[license-url]: LICENSE
|
|
138
|
+
[npm-image]: https://img.shields.io/npm/v/@neeyo/mantine-datatable.svg?style=flat-square
|
|
139
|
+
[license-image]: http://img.shields.io/npm/l/@neeyo/mantine-datatable.svg?style=flat-square
|
|
140
|
+
[stars-image]: https://img.shields.io/github/stars/documatrix/mantine-datatable?style=flat-square
|
|
141
|
+
[last-commit-image]: https://img.shields.io/github/last-commit/documatrix/mantine-datatable?style=flat-square
|
|
142
|
+
[language-image]: https://img.shields.io/github/languages/top/documatrix/mantine-datatable?style=flat-square
|