react-live-data-table 1.0.3 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/readme.md +1 -37
- package/src/ReactDataTable.jsx +26 -4
package/package.json
CHANGED
package/readme.md
CHANGED
@@ -8,7 +8,7 @@ A highly customizable and efficient data grid table for React. It supports featu
|
|
8
8
|
|
9
9
|
To install the package, run one of the following commands:
|
10
10
|
|
11
|
-
|
11
|
+
bash
|
12
12
|
npm install react-data-grid-table
|
13
13
|
|
14
14
|
# React Data Grid
|
@@ -41,40 +41,4 @@ A flexible React data grid component with support for pagination, row selection,
|
|
41
41
|
| `rowHeights` | `number` | `40` | Height of each row |
|
42
42
|
| `headerProps` | `object` | `{}` | Custom header properties |
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
### Column Definition
|
48
|
-
|
49
|
-
```typescript
|
50
|
-
interface ColumnDefinition {
|
51
|
-
field: string; // Key of the data field to display
|
52
|
-
headerName: string; // Text to show in column header
|
53
|
-
width?: number; // Column width in pixels
|
54
|
-
sortable?: boolean; // Enable column sorting
|
55
|
-
render?: (value: any, rowData: Object) => React.ReactNode; // Custom cell renderer
|
56
|
-
|
57
|
-
|
58
44
|
## Basic Usage
|
59
|
-
|
60
|
-
```jsx
|
61
|
-
import { ReactDataTable } from 'react-data-grid';
|
62
|
-
|
63
|
-
const App = () => {
|
64
|
-
const columns = [
|
65
|
-
{ field: 'id', headerName: 'ID' },
|
66
|
-
{ field: 'name', headerName: 'Name' }
|
67
|
-
];
|
68
|
-
|
69
|
-
const data = [
|
70
|
-
{ id: 1, name: 'John' },
|
71
|
-
{ id: 2, name: 'Jane' }
|
72
|
-
];
|
73
|
-
|
74
|
-
return (
|
75
|
-
<ReactDataTable
|
76
|
-
columns={columns}
|
77
|
-
dataSource={data}
|
78
|
-
/>
|
79
|
-
);
|
80
|
-
};
|
package/src/ReactDataTable.jsx
CHANGED
@@ -188,13 +188,35 @@ function ReactDataTable({
|
|
188
188
|
|
189
189
|
return (
|
190
190
|
<div className="bg-white relative w-full">
|
191
|
-
{loading &&
|
192
|
-
<div
|
193
|
-
|
191
|
+
{loading && (
|
192
|
+
<div className="absolute inset-0 bg-white/50 z-20 flex items-center justify-center">
|
193
|
+
<div className={`flex items-center justify-center`}>
|
194
|
+
<div role="status" className="relative">
|
195
|
+
<svg
|
196
|
+
className={`animate-spin w-6 h-6}`}
|
197
|
+
viewBox="0 0 24 24"
|
198
|
+
fill="none"
|
199
|
+
xmlns="http://www.w3.org/2000/svg"
|
200
|
+
>
|
201
|
+
<circle
|
202
|
+
className="opacity-25"
|
203
|
+
cx="12"
|
204
|
+
cy="12"
|
205
|
+
r="10"
|
206
|
+
stroke="currentColor"
|
207
|
+
strokeWidth="4"
|
208
|
+
/>
|
209
|
+
<path
|
210
|
+
className="opacity-75"
|
211
|
+
fill="currentColor"
|
212
|
+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
213
|
+
/>
|
214
|
+
</svg>
|
194
215
|
<span className="sr-only">Loading...</span>
|
195
216
|
</div>
|
196
217
|
</div>
|
197
|
-
|
218
|
+
</div>
|
219
|
+
)}
|
198
220
|
|
199
221
|
{
|
200
222
|
flatData.length === 0 && !loading ? (
|