gbs-add-block 0.0.87 → 0.0.88
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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# GBS Building Blocks 2.0 (v0.0.
|
|
1
|
+
# GBS Building Blocks 2.0 (v0.0.88)
|
|
2
2
|
|
|
3
3
|
Latest and upgraded version of GBS building blocks with headless UI and removed dependencies.
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ Latest and upgraded version of GBS building blocks with headless UI and removed
|
|
|
6
6
|
|
|
7
7
|
For detailed documentation on usage and props, Please visit: [Building Block Documentation v2.0](https://blackmax-designs.gitbook.io/building-block-v2.0)
|
|
8
8
|
|
|
9
|
-
## What's New 🎉 (Ver 0.0.
|
|
9
|
+
## What's New 🎉 (Ver 0.0.88)
|
|
10
10
|
|
|
11
11
|
- Updated for bug fixes.
|
|
12
12
|
|
package/package.json
CHANGED
|
@@ -92,6 +92,7 @@ export const GridProvider: React.FC<{
|
|
|
92
92
|
gridColumnStyle = "p-2 text-xs",
|
|
93
93
|
rowChange = () => {},
|
|
94
94
|
pageStatus = () => {},
|
|
95
|
+
activeFilterArrayValue = [],
|
|
95
96
|
} = props;
|
|
96
97
|
|
|
97
98
|
// States Handling Grid
|
|
@@ -133,9 +134,13 @@ export const GridProvider: React.FC<{
|
|
|
133
134
|
const handleDataSource = async () => {
|
|
134
135
|
if (Array.isArray(dataSource) && dataSource.length > 0) {
|
|
135
136
|
setWorkingDataSource(dataSource);
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
|
|
138
|
+
// if lazy is true, then totalPages will be taken from pageSettings
|
|
139
|
+
const totalPages =
|
|
140
|
+
lazy && pageSettings.totalPages
|
|
141
|
+
? pageSettings.totalPages
|
|
142
|
+
: Math.ceil(dataSource.length / pageSettings.pageNumber);
|
|
143
|
+
|
|
139
144
|
setTotalPages(totalPages);
|
|
140
145
|
setPageEnd(Math.min(10, totalPages));
|
|
141
146
|
} else if (typeof dataSource === "string") {
|
|
@@ -289,6 +294,8 @@ export const GridProvider: React.FC<{
|
|
|
289
294
|
setWorkingColumns(updatedColumns);
|
|
290
295
|
setWorkingDataSource(updatedFullDataSource);
|
|
291
296
|
setActiveFilterArray(updatedActiveFilterArray);
|
|
297
|
+
if (activeFilterArrayValue)
|
|
298
|
+
activeFilterArrayValue(updatedActiveFilterArray);
|
|
292
299
|
resetPage(updatedFullDataSource);
|
|
293
300
|
}
|
|
294
301
|
|
|
@@ -305,6 +312,8 @@ export const GridProvider: React.FC<{
|
|
|
305
312
|
setWorkingColumns(updatedColumns);
|
|
306
313
|
setWorkingDataSource(updatedDataSource);
|
|
307
314
|
setActiveFilterArray(updatedActiveFilterArray);
|
|
315
|
+
if (activeFilterArrayValue)
|
|
316
|
+
activeFilterArrayValue(updatedActiveFilterArray);
|
|
308
317
|
resetPage(updatedDataSource);
|
|
309
318
|
}
|
|
310
319
|
|
|
@@ -26,6 +26,7 @@ const GridContent = forwardRef((_, ref) => {
|
|
|
26
26
|
prevPage,
|
|
27
27
|
goToFirstPage,
|
|
28
28
|
goToEndPage,
|
|
29
|
+
activeFilterArray,
|
|
29
30
|
} = useGridContext();
|
|
30
31
|
|
|
31
32
|
// Making Grid Functions Accessible in Parent
|
|
@@ -41,6 +42,7 @@ const GridContent = forwardRef((_, ref) => {
|
|
|
41
42
|
handleSearch,
|
|
42
43
|
handleApplyFilter,
|
|
43
44
|
clearFilter,
|
|
45
|
+
getActiveFilters: () => activeFilterArray,
|
|
44
46
|
};
|
|
45
47
|
},
|
|
46
48
|
[
|
|
@@ -52,6 +54,7 @@ const GridContent = forwardRef((_, ref) => {
|
|
|
52
54
|
handleSearch,
|
|
53
55
|
handleApplyFilter,
|
|
54
56
|
clearFilter,
|
|
57
|
+
activeFilterArray,
|
|
55
58
|
]
|
|
56
59
|
);
|
|
57
60
|
|
|
@@ -2,6 +2,13 @@ import { ChangeEvent } from "react";
|
|
|
2
2
|
|
|
3
3
|
interface PageSettingsProps {
|
|
4
4
|
pageNumber: number;
|
|
5
|
+
totalPages?: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface ActiveFilterArrayValue {
|
|
9
|
+
filterColumn: string;
|
|
10
|
+
filterCondition: string;
|
|
11
|
+
filterValue: string;
|
|
5
12
|
}
|
|
6
13
|
|
|
7
14
|
export type GridProps = {
|
|
@@ -29,6 +36,7 @@ export type GridProps = {
|
|
|
29
36
|
gridColumnStyle?: string;
|
|
30
37
|
rowChange?: any;
|
|
31
38
|
pageStatus?: any;
|
|
39
|
+
activeFilterArrayValue?: ActiveFilterArrayValue[] | any;
|
|
32
40
|
};
|
|
33
41
|
|
|
34
42
|
interface GridColumn {
|