pam-grid 1.0.9 → 1.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/README.md +228 -0
- package/dist/index.css +4 -2
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +76 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +76 -40
- package/dist/index.mjs.map +1 -1
- package/dist/styles/pam.grid.css +4 -2
- package/dist/styles/pam.grid.css.map +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# 📊 PMS Grid (PamGrid)
|
|
2
|
+
|
|
3
|
+
A powerful, flexible, and extensible **React Data Grid** built with modern patterns and inspired by enterprise systems.
|
|
4
|
+
|
|
5
|
+
PMS Grid is designed for **large-scale applications (ERP, CRM, Admin Panels)** and provides advanced features like:
|
|
6
|
+
|
|
7
|
+
- Fixed headers & pinned columns
|
|
8
|
+
- Column resizing & reordering
|
|
9
|
+
- Row selection & bulk actions
|
|
10
|
+
- Grouping & aggregation
|
|
11
|
+
- Expandable rows
|
|
12
|
+
- Client-side & server-side support
|
|
13
|
+
- Advanced filtering & faceted filters
|
|
14
|
+
- Support Bootstrap classes
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 🚀 Features
|
|
19
|
+
|
|
20
|
+
### 🔹 Core
|
|
21
|
+
- ⚡ High performance rendering
|
|
22
|
+
- 🔍 Global search (debounced)
|
|
23
|
+
- 📄 Pagination (client & server)
|
|
24
|
+
- 🔃 Sorting (asc/desc/reset)
|
|
25
|
+
- 📱 Responsive layout
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
### 🔹 Advanced Grid Features
|
|
30
|
+
|
|
31
|
+
#### 📌 Column Features
|
|
32
|
+
- Resize columns (drag)
|
|
33
|
+
- Reorder columns (drag & drop)
|
|
34
|
+
- Show / Hide columns
|
|
35
|
+
- Pin columns (left / right)
|
|
36
|
+
|
|
37
|
+
#### 📌 Row Features
|
|
38
|
+
- Row selection (single / multi)
|
|
39
|
+
- Bulk selection (checkbox)
|
|
40
|
+
- Expandable rows
|
|
41
|
+
- Row actions (buttons / dropdown)
|
|
42
|
+
|
|
43
|
+
#### 📌 Grouping & Aggregation
|
|
44
|
+
- Group by column
|
|
45
|
+
- Custom group labels
|
|
46
|
+
- Aggregation (sum, avg, etc.)
|
|
47
|
+
|
|
48
|
+
#### 📌 Filtering
|
|
49
|
+
- Global search
|
|
50
|
+
- Advanced column filters
|
|
51
|
+
- Faceted filters (API or static)
|
|
52
|
+
- Switch-based filters
|
|
53
|
+
|
|
54
|
+
#### 📌 UI Features
|
|
55
|
+
- Fullscreen mode
|
|
56
|
+
- Sticky headers
|
|
57
|
+
- Empty states
|
|
58
|
+
- Loading overlay
|
|
59
|
+
- Tooltips
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## How to install (Required 18 version of react-js)
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
|
|
67
|
+
npm install pam-grid
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
#### How To use:
|
|
71
|
+
Three most importances keys in lib.
|
|
72
|
+
1. Columns
|
|
73
|
+
2. Hook,
|
|
74
|
+
3. Component (Main Component)
|
|
75
|
+
```bash
|
|
76
|
+
|
|
77
|
+
1. Columns first should define
|
|
78
|
+
const userColumns = [
|
|
79
|
+
{
|
|
80
|
+
key: "name",
|
|
81
|
+
title: "Name",
|
|
82
|
+
sortable: true,
|
|
83
|
+
width: 200,
|
|
84
|
+
....,
|
|
85
|
+
...,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
key: "age",
|
|
89
|
+
title: "Age",
|
|
90
|
+
sortable: true,
|
|
91
|
+
},
|
|
92
|
+
......,
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
type
|
|
96
|
+
export GridColumn {
|
|
97
|
+
key: keyof T | (string & {});
|
|
98
|
+
title: string;
|
|
99
|
+
|
|
100
|
+
width?: number;
|
|
101
|
+
maxWidth?: number;
|
|
102
|
+
minWidth?: number;
|
|
103
|
+
className?: string;
|
|
104
|
+
|
|
105
|
+
sortable?: boolean;
|
|
106
|
+
groupable?: boolean;
|
|
107
|
+
align?: string; // start,end,center,between,around
|
|
108
|
+
// used for grouping value
|
|
109
|
+
groupByValue?: (row: T) => GroupKey;
|
|
110
|
+
|
|
111
|
+
// used for group header display
|
|
112
|
+
groupLabel?: (value: GroupKey, items: T[]) => React.ReactNode;
|
|
113
|
+
pinned?: PinnedPosition;
|
|
114
|
+
visible?: boolean;
|
|
115
|
+
order: number;
|
|
116
|
+
enableAdvancedFilter?: boolean | { type: AdvancedFilterType };
|
|
117
|
+
originalKey?: string;
|
|
118
|
+
nestedPath?: string;
|
|
119
|
+
aggregate?: (vals: number[]) => string;
|
|
120
|
+
onCellClick?: (row: T, column: GridColumn<T>) => void;
|
|
121
|
+
render?: (row: T) => React.ReactNode;
|
|
122
|
+
|
|
123
|
+
facetedFilter?: FacetedFilter;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
|
|
130
|
+
import { PamGrid, useGridCore } from "pam-grid";
|
|
131
|
+
// 2. useGridCore()
|
|
132
|
+
|
|
133
|
+
const grid = useGridCore({
|
|
134
|
+
columns: userColumns,
|
|
135
|
+
serverMode: true, // define which mode
|
|
136
|
+
initialPageSize: 20,
|
|
137
|
+
addNewRecord: {
|
|
138
|
+
label: "Add New User",
|
|
139
|
+
name: "New",
|
|
140
|
+
onClick: () => { // provided callback fun },
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// if server side , This hook return functions and states, help for calling api with filter update state
|
|
145
|
+
1.Function: (if server side)
|
|
146
|
+
i. grid.setServerRows(data);
|
|
147
|
+
ii. grid.setServerTotal(no_of_data);
|
|
148
|
+
2.State ( state mainly use for get latest state of filtering )
|
|
149
|
+
const {sortBy,advanceFilters,groupBy,facetFilters,debouncedSearch} = grid;
|
|
150
|
+
above filters state as itself object gernerally needed key(column name) eg. sortBy.key
|
|
151
|
+
|
|
152
|
+
//3. PamGrid
|
|
153
|
+
/* PamGrid take some props,
|
|
154
|
+
1.columns
|
|
155
|
+
2.grid
|
|
156
|
+
3.loading
|
|
157
|
+
4.isFetching
|
|
158
|
+
5.features : {
|
|
159
|
+
search: true,
|
|
160
|
+
aggregation:true,
|
|
161
|
+
selection: true,
|
|
162
|
+
grouping: true,
|
|
163
|
+
pinning: true,
|
|
164
|
+
pagination: true,
|
|
165
|
+
resizing: true,
|
|
166
|
+
reorder: true,
|
|
167
|
+
fullScreen:true,
|
|
168
|
+
columnVisibility: true,
|
|
169
|
+
pageSizeSelector: true,
|
|
170
|
+
actions: [
|
|
171
|
+
{
|
|
172
|
+
label: "string",
|
|
173
|
+
icon: "string",
|
|
174
|
+
onlyIcon:true,
|
|
175
|
+
onClick: (row) => { },
|
|
176
|
+
isVisible: boolean
|
|
177
|
+
},
|
|
178
|
+
.....
|
|
179
|
+
]
|
|
180
|
+
|
|
181
|
+
renderExpanded={(row) => <MyComponent props={row}>}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Finally render
|
|
185
|
+
|
|
186
|
+
<PamGrid
|
|
187
|
+
columns={userColumns}
|
|
188
|
+
grid={grid}
|
|
189
|
+
loading={isLoading}
|
|
190
|
+
isFetching={isFetching && !isLoading}
|
|
191
|
+
isDropdown
|
|
192
|
+
customeDiv={
|
|
193
|
+
<div className="col-6 col-sm-4 col-md-2 my-1">
|
|
194
|
+
|
|
195
|
+
<DatePicker
|
|
196
|
+
name="date"
|
|
197
|
+
control={control}
|
|
198
|
+
placeholder="DD-MM-YYYY"
|
|
199
|
+
className="w-100"
|
|
200
|
+
maxDate={new Date()}
|
|
201
|
+
/>
|
|
202
|
+
</div>
|
|
203
|
+
}
|
|
204
|
+
features={{
|
|
205
|
+
search: true,
|
|
206
|
+
selection: true,
|
|
207
|
+
pinning: true,
|
|
208
|
+
pagination: true,
|
|
209
|
+
resizing: true,
|
|
210
|
+
reorder: true,
|
|
211
|
+
columnVisibility: true,
|
|
212
|
+
pageSizeSelector: true,
|
|
213
|
+
expand: true,
|
|
214
|
+
actions: [
|
|
215
|
+
{
|
|
216
|
+
label: "Edit",
|
|
217
|
+
icon: "bx bx-edit text-primary cursor-pointer",
|
|
218
|
+
onClick: (row) => onEdit?.(row),
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
}}
|
|
222
|
+
renderExpanded={(row) => <UserDetails id={row?.id} />}
|
|
223
|
+
/>
|
|
224
|
+
|
|
225
|
+
*/
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
```
|
package/dist/index.css
CHANGED
|
@@ -27441,7 +27441,6 @@ body:not(.modal-open) .layout-content-navbar .layout-navbar {
|
|
|
27441
27441
|
z-index: 6;
|
|
27442
27442
|
background: #fff;
|
|
27443
27443
|
border-bottom: 1px solid #dee2e6;
|
|
27444
|
-
font-weight: 600;
|
|
27445
27444
|
box-shadow: inset 0 -1px 0 #dee2e6;
|
|
27446
27445
|
}
|
|
27447
27446
|
.pms-grid td.pinned,
|
|
@@ -27458,7 +27457,7 @@ body:not(.modal-open) .layout-content-navbar .layout-navbar {
|
|
|
27458
27457
|
right: 0;
|
|
27459
27458
|
z-index: 8;
|
|
27460
27459
|
background: #fff;
|
|
27461
|
-
|
|
27460
|
+
border-left: 1px solid #e4e6e8;
|
|
27462
27461
|
}
|
|
27463
27462
|
.pms-grid tbody tr:hover {
|
|
27464
27463
|
background-color: #e9f5ff;
|
|
@@ -27662,6 +27661,9 @@ body:not(.modal-open) .layout-content-navbar .layout-navbar {
|
|
|
27662
27661
|
.cursor-resize {
|
|
27663
27662
|
cursor: e-resize;
|
|
27664
27663
|
}
|
|
27664
|
+
.col-resize {
|
|
27665
|
+
cursor: col-resize;
|
|
27666
|
+
}
|
|
27665
27667
|
.cursor-grab {
|
|
27666
27668
|
cursor: grab;
|
|
27667
27669
|
}
|