@mkt-loitd/react-table-grid-custom 1.0.9 โ 1.1.5
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/README.md +86 -111
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,164 +1,139 @@
|
|
|
1
|
-
|
|
1
|
+
@mkt-loitd/react-table-grid-custom
|
|
2
2
|
|
|
3
|
-
A
|
|
4
|
-
|
|
5
|
-
Supports pagination, sorting, row selection, context menu, column visibility, and Mantine UI.
|
|
3
|
+
A flexible and customizable React Table Grid component built with TypeScript, designed for displaying tabular data with custom columns, layouts, and rendering logic.
|
|
6
4
|
|
|
7
5
|
โจ Features
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
โ
100% TypeScript
|
|
12
|
-
|
|
13
|
-
โ
Pagination & sorting
|
|
7
|
+
โ๏ธ Built for React
|
|
14
8
|
|
|
15
|
-
|
|
9
|
+
๐งฉ Fully customizable columns
|
|
16
10
|
|
|
17
|
-
|
|
11
|
+
๐ Support for custom cell render
|
|
18
12
|
|
|
19
|
-
|
|
13
|
+
๐ฆ Lightweight & easy to integrate
|
|
20
14
|
|
|
21
|
-
|
|
15
|
+
๐ Written in TypeScript
|
|
22
16
|
|
|
23
|
-
|
|
17
|
+
๐ Supports both ESM and CJS
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
๐ฆ Installation
|
|
26
20
|
|
|
27
|
-
|
|
21
|
+
Using npm:
|
|
28
22
|
|
|
29
|
-
๐ฆ Installation
|
|
30
23
|
npm install @mkt-loitd/react-table-grid-custom
|
|
31
24
|
|
|
32
25
|
|
|
33
|
-
|
|
26
|
+
Using yarn:
|
|
34
27
|
|
|
35
28
|
yarn add @mkt-loitd/react-table-grid-custom
|
|
36
29
|
|
|
37
30
|
|
|
38
|
-
|
|
31
|
+
Using pnpm:
|
|
39
32
|
|
|
40
33
|
pnpm add @mkt-loitd/react-table-grid-custom
|
|
41
34
|
|
|
42
|
-
๐ Repository
|
|
43
|
-
|
|
44
|
-
๐ GitHub:
|
|
45
|
-
https://github.com/loitd140201/react-table
|
|
46
|
-
|
|
47
|
-
โ ๏ธ Peer Dependencies
|
|
48
|
-
|
|
49
|
-
Make sure your project already has:
|
|
50
|
-
|
|
51
|
-
react >= 18
|
|
52
|
-
react-dom >= 18
|
|
53
|
-
next >= 13
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
These packages are required but not bundled.
|
|
57
|
-
|
|
58
35
|
๐ Basic Usage
|
|
59
|
-
|
|
60
|
-
|
|
36
|
+
import React from 'react'
|
|
61
37
|
import { ReactTableGridCustom } from '@mkt-loitd/react-table-grid-custom'
|
|
62
|
-
import type { TColumnsTable } from '@mkt-loitd/react-table-grid-custom'
|
|
63
38
|
|
|
64
|
-
const columns
|
|
65
|
-
{
|
|
66
|
-
|
|
67
|
-
|
|
39
|
+
const columns = [
|
|
40
|
+
{
|
|
41
|
+
key: 'name',
|
|
42
|
+
title: 'Name',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
key: 'email',
|
|
46
|
+
title: 'Email',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
key: 'age',
|
|
50
|
+
title: 'Age',
|
|
51
|
+
},
|
|
68
52
|
]
|
|
69
53
|
|
|
70
54
|
const data = [
|
|
71
|
-
{ id: 1, name: 'John', email: 'john@
|
|
72
|
-
{ id: 2, name: 'Jane', email: 'jane@
|
|
55
|
+
{ id: 1, name: 'John Doe', email: 'john@example.com', age: 28 },
|
|
56
|
+
{ id: 2, name: 'Jane Smith', email: 'jane@example.com', age: 32 },
|
|
73
57
|
]
|
|
74
58
|
|
|
75
|
-
export default function
|
|
59
|
+
export default function App() {
|
|
76
60
|
return (
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
pageSize={10}
|
|
83
|
-
total={data.length}
|
|
84
|
-
/>
|
|
85
|
-
</div>
|
|
61
|
+
<ReactTableGridCustom
|
|
62
|
+
columns={columns}
|
|
63
|
+
data={data}
|
|
64
|
+
rowKey="id"
|
|
65
|
+
/>
|
|
86
66
|
)
|
|
87
67
|
}
|
|
88
68
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
} from '@mkt-loitd/react-table-grid-custom'
|
|
113
|
-
|
|
114
|
-
Example
|
|
115
|
-
<TableStyleContextWapper
|
|
116
|
-
clsTablecustom="h-full"
|
|
117
|
-
renderContext={{
|
|
118
|
-
renderData: true,
|
|
119
|
-
onClick: (key, row) => {
|
|
120
|
-
console.log(key, row)
|
|
121
|
-
}
|
|
122
|
-
}}
|
|
123
|
-
>
|
|
124
|
-
<ReactTableGridCustom {...props} />
|
|
125
|
-
</TableStyleContextWapper>
|
|
69
|
+
๐งฑ Column Definition
|
|
70
|
+
interface Column {
|
|
71
|
+
key: string
|
|
72
|
+
title: string
|
|
73
|
+
width?: number | string
|
|
74
|
+
render?: (value: any, row: any, rowIndex: number) => React.ReactNode
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
Example with custom render:
|
|
78
|
+
const columns = [
|
|
79
|
+
{
|
|
80
|
+
key: 'name',
|
|
81
|
+
title: 'Name',
|
|
82
|
+
render: (value) => <strong>{value}</strong>,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
key: 'action',
|
|
86
|
+
title: 'Action',
|
|
87
|
+
render: (_, row) => (
|
|
88
|
+
<button onClick={() => console.log(row)}>View</button>
|
|
89
|
+
),
|
|
90
|
+
},
|
|
91
|
+
]
|
|
126
92
|
|
|
93
|
+
๐ Props
|
|
94
|
+
Prop Type Required Description
|
|
95
|
+
columns Column[] โ
Table column configuration
|
|
96
|
+
data any[] โ
Data source
|
|
97
|
+
rowKey string โ
Unique key for each row
|
|
98
|
+
className string โ Custom CSS class
|
|
99
|
+
style CSSProperties โ Inline styles
|
|
127
100
|
๐จ Styling
|
|
128
101
|
|
|
129
|
-
|
|
102
|
+
You can fully customize the table using your own CSS:
|
|
130
103
|
|
|
131
|
-
|
|
104
|
+
.react-table-grid {
|
|
105
|
+
border: 1px solid #e5e7eb;
|
|
106
|
+
}
|
|
132
107
|
|
|
133
|
-
|
|
108
|
+
.react-table-grid-row:hover {
|
|
109
|
+
background-color: #f9fafb;
|
|
110
|
+
}
|
|
134
111
|
|
|
135
|
-
import 'react-data-grid/lib/styles.css'
|
|
136
112
|
|
|
137
|
-
|
|
138
|
-
dist/
|
|
139
|
-
README.md
|
|
113
|
+
Or wrap it inside your design system (Tailwind, AntD, MUI, etc).
|
|
140
114
|
|
|
141
|
-
|
|
142
|
-
npm run dev
|
|
115
|
+
๐ Build Output
|
|
143
116
|
|
|
117
|
+
This package is built using tsup:
|
|
144
118
|
|
|
145
|
-
|
|
119
|
+
dist/index.esm.js โ ES Module
|
|
146
120
|
|
|
147
|
-
|
|
121
|
+
dist/index.cjs.js โ CommonJS
|
|
148
122
|
|
|
123
|
+
dist/index.d.ts โ Type definitions
|
|
149
124
|
|
|
150
|
-
|
|
125
|
+
๐งช Compatibility
|
|
151
126
|
|
|
152
|
-
|
|
127
|
+
React >= 17
|
|
153
128
|
|
|
154
|
-
|
|
129
|
+
React DOM >= 17
|
|
155
130
|
|
|
156
|
-
|
|
131
|
+
Node >= 16
|
|
157
132
|
|
|
158
|
-
|
|
133
|
+
๐ Development
|
|
134
|
+
npm install
|
|
135
|
+
npm run build
|
|
159
136
|
|
|
160
|
-
|
|
161
|
-
https://github.com/loitd140201/react-table/issues
|
|
137
|
+
๐ License
|
|
162
138
|
|
|
163
|
-
|
|
164
|
-
https://github.com/loitd140201/react-table
|
|
139
|
+
MIT ยฉ mkt-loitd
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkt-loitd/react-table-grid-custom",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "React Table Grid Custom component",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"private": false,
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"dev": "tsup src/index.ts --watch --format esm,cjs --dts",
|
|
27
27
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
28
|
-
"
|
|
28
|
+
"prebuild": "node scripts/prebuild.js",
|
|
29
29
|
"release:patch": "npm version patch --no-git-tag-version"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|