@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.
Files changed (2) hide show
  1. package/README.md +86 -111
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,164 +1,139 @@
1
- ๐Ÿ“ฆ React Table Grid Custom
1
+ @mkt-loitd/react-table-grid-custom
2
2
 
3
- A powerful, flexible React Table component built on top of react-data-grid, designed for Next.js and TypeScript projects.
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
- โœ… Built on react-data-grid
10
-
11
- โœ… 100% TypeScript
12
-
13
- โœ… Pagination & sorting
7
+ โš›๏ธ Built for React
14
8
 
15
- โœ… Row selection (checkbox)
9
+ ๐Ÿงฉ Fully customizable columns
16
10
 
17
- โœ… Context menu (right click)
11
+ ๐Ÿ“ Support for custom cell render
18
12
 
19
- โœ… Show / hide columns
13
+ ๐Ÿ“ฆ Lightweight & easy to integrate
20
14
 
21
- โœ… Mantine UI integration
15
+ ๐Ÿ›  Written in TypeScript
22
16
 
23
- โœ… Optimized for Next.js 13+ (App Router & Pages Router)
17
+ ๐Ÿ” Supports both ESM and CJS
24
18
 
25
- โœ… ESM + CJS support
19
+ ๐Ÿ“ฆ Installation
26
20
 
27
- โœ… Tree-shakeable (sideEffects: false)
21
+ Using npm:
28
22
 
29
- ๐Ÿ“ฆ Installation
30
23
  npm install @mkt-loitd/react-table-grid-custom
31
24
 
32
25
 
33
- or
26
+ Using yarn:
34
27
 
35
28
  yarn add @mkt-loitd/react-table-grid-custom
36
29
 
37
30
 
38
- or
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
- 'use client'
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: TColumnsTable<any> = [
65
- { key: 'id', name: 'ID' },
66
- { key: 'name', name: 'Name' },
67
- { key: 'email', name: 'Email' }
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@gmail.com' },
72
- { id: 2, name: 'Jane', email: 'jane@gmail.com' }
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 Example() {
59
+ export default function App() {
76
60
  return (
77
- <div style={{ height: 400 }}>
78
- <ReactTableGridCustom
79
- columns={columns}
80
- data={data}
81
- page={1}
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
- ๐Ÿงฉ Main Component
90
- ReactTableGridCustom<T>
91
- import type { IReactTableGridCustom } from '@mkt-loitd/react-table-grid-custom'
92
-
93
- Props
94
- Prop Type Description
95
- columns TColumnsTable<T> Column definitions
96
- data T[] Table data
97
- page number Current page
98
- pageSize number Records per page
99
- total number Total records
100
- onChange (page: number) => void Page change callback
101
- selectedRows ReadonlySet<Key> Selected rows
102
- fetching boolean Show loading overlay
103
- hiddenPagination boolean Hide pagination
104
- hiddenSTT boolean Hide index (STT) column
105
- classNameWapperTable string Wrapper table class
106
- classNamePaginationTable string Pagination wrapper class
107
- ๐Ÿงฉ Context Menu Wrapper
108
- TableStyleContextWapper
109
- import {
110
- TableStyleContextWapper,
111
- type TableStyleWapperProps
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
- Built with Mantine UI
102
+ You can fully customize the table using your own CSS:
130
103
 
131
- Fully compatible with Tailwind CSS
104
+ .react-table-grid {
105
+ border: 1px solid #e5e7eb;
106
+ }
132
107
 
133
- Uses default styles from react-data-grid
108
+ .react-table-grid-row:hover {
109
+ background-color: #f9fafb;
110
+ }
134
111
 
135
- import 'react-data-grid/lib/styles.css'
136
112
 
137
- ๐Ÿ“ Package Structure
138
- dist/
139
- README.md
113
+ Or wrap it inside your design system (Tailwind, AntD, MUI, etc).
140
114
 
141
- ๐Ÿ›  Development
142
- npm run dev
115
+ ๐Ÿ“‚ Build Output
143
116
 
117
+ This package is built using tsup:
144
118
 
145
- Build package:
119
+ dist/index.esm.js โ€“ ES Module
146
120
 
147
- npm run build
121
+ dist/index.cjs.js โ€“ CommonJS
148
122
 
123
+ dist/index.d.ts โ€“ Type definitions
149
124
 
150
- Test locally:
125
+ ๐Ÿงช Compatibility
151
126
 
152
- npm pack
127
+ React >= 17
153
128
 
154
- ๐Ÿ“„ License
129
+ React DOM >= 17
155
130
 
156
- ISC ยฉ LoiTD
131
+ Node >= 16
157
132
 
158
- ๐Ÿ’ฌ Support
133
+ ๐Ÿ›  Development
134
+ npm install
135
+ npm run build
159
136
 
160
- ๐Ÿž Issues:
161
- https://github.com/loitd140201/react-table/issues
137
+ ๐Ÿ“„ License
162
138
 
163
- ๐Ÿ“ฆ Repository:
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.0.9",
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
- "prepublishOnly": "npm run build",
28
+ "prebuild": "node scripts/prebuild.js",
29
29
  "release:patch": "npm version patch --no-git-tag-version"
30
30
  },
31
31
  "peerDependencies": {