gbs-add-block 1.0.4 → 1.0.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 CHANGED
@@ -1,4 +1,4 @@
1
- # GBS Building Blocks 2.0 (v1.0.4)
1
+ # GBS Building Blocks 2.0 (v1.0.5)
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 1.0.4)
9
+ ## What's New 🎉 (Ver 1.0.5)
10
10
 
11
11
  - Major Update with more stable features and Data Grid.
12
12
  - Deprecated Grid Component, Use New Data Grid instead.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gbs-add-block",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "React Component Library",
5
5
  "type": "module",
6
6
  "files": [
@@ -8,7 +8,8 @@ export const usePaginatedData = (
8
8
  apiEndpoint: string,
9
9
  initialPageSize = 10,
10
10
  method: "GET" | "POST" = "GET",
11
- columns: any[] = []
11
+ columns: any[] = [],
12
+ additionalParams: any = {}
12
13
  ) => {
13
14
  const [data, setData] = useState<any[]>([]);
14
15
  const [loading, setLoading] = useState(false);
@@ -27,7 +28,6 @@ export const usePaginatedData = (
27
28
  pageSize: number,
28
29
  currentFilters: any[] = [],
29
30
  search = "",
30
- additionalParams: any = {},
31
31
  isExportCall: boolean | null = null,
32
32
  exportType: string | null = null
33
33
  ) => {
@@ -128,9 +128,13 @@ export const usePaginatedData = (
128
128
  // Handle search input
129
129
  const handleSearch = useCallback(
130
130
  (searchTerm: string) => {
131
- const updatedFilters = filters.filter((f) => {
132
- return !(f as any).searchTerm;
133
- });
131
+ const existingSearch = filters.find(
132
+ (f) => f.type === "search" && f.value === searchTerm
133
+ );
134
+
135
+ if (existingSearch) return;
136
+
137
+ const updatedFilters = filters.filter((f) => f.type !== "search");
134
138
 
135
139
  const finalFilters = [
136
140
  ...updatedFilters,
@@ -146,7 +150,7 @@ export const usePaginatedData = (
146
150
  // Handle exports
147
151
  const handleExports = useCallback(
148
152
  (exportType: string) => {
149
- fetchData(method, 0, pagination.pageSize, [], "", {}, true, exportType);
153
+ fetchData(method, 0, pagination.pageSize, [], "", true, exportType);
150
154
  },
151
155
  [fetchData, method, pagination.pageSize]
152
156
  );