gbs-add-block 1.0.2 → 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 +2 -2
- package/package.json +1 -1
- package/source/components/sidebar/components/MenuSection.tsx +1 -1
- package/source/components/sidebar/components/SidebarMenu.tsx +1 -1
- package/source/components/sidebar/hooks/useSidebarState.ts +1 -1
- package/source/components/usepaginateddata/usePaginatedData.ts +10 -6
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# GBS Building Blocks 2.0 (v1.0.
|
|
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.
|
|
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
|
@@ -5,7 +5,7 @@ type MenuSectionProps = {
|
|
|
5
5
|
section: MenuSectionType;
|
|
6
6
|
sectionIndex: number;
|
|
7
7
|
iconMap: Record<string, IconComponent>;
|
|
8
|
-
toggleItem: (sectionIndex: number, itemId: number) => void;
|
|
8
|
+
toggleItem: (sectionIndex: number, itemId: number | string) => void;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export const MenuSection = ({
|
|
@@ -4,7 +4,7 @@ import { MenuSection as MenuSectionComponent } from "./MenuSection";
|
|
|
4
4
|
type SidebarMenuProps = {
|
|
5
5
|
sections?: MenuSection[];
|
|
6
6
|
iconMap: Record<string, IconComponent>;
|
|
7
|
-
toggleItem: (sectionIndex: number, itemId: number) => void;
|
|
7
|
+
toggleItem: (sectionIndex: number, itemId: number | string) => void;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export const SidebarMenu = ({
|
|
@@ -4,7 +4,7 @@ import { MenuData } from "../type";
|
|
|
4
4
|
export const useSidebarState = (menuData: MenuData) => {
|
|
5
5
|
const [sidebarData, setSidebarData] = useState<MenuData>(menuData);
|
|
6
6
|
|
|
7
|
-
const toggleItem = (sectionIndex: number, itemId: number): void => {
|
|
7
|
+
const toggleItem = (sectionIndex: number, itemId: number | string): void => {
|
|
8
8
|
const newData = { ...sidebarData };
|
|
9
9
|
|
|
10
10
|
const section = newData.sections?.[sectionIndex];
|
|
@@ -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
|
|
132
|
-
|
|
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, [], "",
|
|
153
|
+
fetchData(method, 0, pagination.pageSize, [], "", true, exportType);
|
|
150
154
|
},
|
|
151
155
|
[fetchData, method, pagination.pageSize]
|
|
152
156
|
);
|