rez-table-listing-mui 1.3.57 → 1.3.59
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/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/listing/components/tabs/index.tsx +13 -15
- package/src/listing/types/common.ts +2 -2
- package/src/view/ListingView.tsx +6 -6
package/package.json
CHANGED
|
@@ -8,8 +8,8 @@ import { useMemo } from "react";
|
|
|
8
8
|
import { SettingIcon } from "../../../assets/svg";
|
|
9
9
|
|
|
10
10
|
interface TabDataProps {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
tab_name: string | null;
|
|
12
|
+
count: string | number;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
interface TableTabsProps {
|
|
@@ -37,20 +37,20 @@ export function TableTabs({
|
|
|
37
37
|
tableStates.setPagination((prev) => ({ ...prev, pageIndex: 0 }));
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
// Normalize
|
|
40
|
+
// Normalize tab_name to uppercase for display + logic
|
|
41
41
|
const normalizedTabs = useMemo(() => {
|
|
42
42
|
return tabsData
|
|
43
|
-
?.filter((tab) => tab.
|
|
43
|
+
?.filter((tab) => tab.tab_name !== null)
|
|
44
44
|
?.map((tab) => ({
|
|
45
45
|
...tab,
|
|
46
|
-
|
|
46
|
+
tab_name: tab.tab_name,
|
|
47
47
|
}));
|
|
48
48
|
}, [tabsData]);
|
|
49
49
|
|
|
50
50
|
const defaultTab = useMemo(() => {
|
|
51
51
|
return (
|
|
52
|
-
normalizedTabs.find((t) => t.
|
|
53
|
-
normalizedTabs[0]?.
|
|
52
|
+
normalizedTabs.find((t) => t.tab_name === "All")?.tab_name ||
|
|
53
|
+
normalizedTabs[0]?.tab_name ||
|
|
54
54
|
""
|
|
55
55
|
);
|
|
56
56
|
}, [normalizedTabs]);
|
|
@@ -78,16 +78,16 @@ export function TableTabs({
|
|
|
78
78
|
slotProps={{ indicator: { sx: { display: "none" } } }}
|
|
79
79
|
sx={tableTabsStyles.tabs}
|
|
80
80
|
>
|
|
81
|
-
{normalizedTabs.map(({
|
|
82
|
-
const isSelected = activeTab ===
|
|
81
|
+
{normalizedTabs.map(({ tab_name, count }) => {
|
|
82
|
+
const isSelected = activeTab === tab_name;
|
|
83
83
|
|
|
84
84
|
return (
|
|
85
85
|
<Tab
|
|
86
|
-
key={
|
|
87
|
-
value={
|
|
86
|
+
key={tab_name}
|
|
87
|
+
value={tab_name}
|
|
88
88
|
label={
|
|
89
89
|
<Box display="flex" alignItems="center" gap={1}>
|
|
90
|
-
<Box>{
|
|
90
|
+
<Box>{tab_name}</Box>
|
|
91
91
|
<Box
|
|
92
92
|
sx={{
|
|
93
93
|
...tableTabsStyles.tabCount,
|
|
@@ -100,9 +100,7 @@ export function TableTabs({
|
|
|
100
100
|
}),
|
|
101
101
|
}}
|
|
102
102
|
>
|
|
103
|
-
{
|
|
104
|
-
? "0"
|
|
105
|
-
: String(tab_value_count).padStart(2, "0")}
|
|
103
|
+
{count == 0 ? "0" : String(count).padStart(2, "0")}
|
|
106
104
|
</Box>
|
|
107
105
|
</Box>
|
|
108
106
|
}
|
package/src/view/ListingView.tsx
CHANGED
|
@@ -231,17 +231,17 @@ function ListingView() {
|
|
|
231
231
|
tabsData &&
|
|
232
232
|
tabsData.length > 0 &&
|
|
233
233
|
!tabsData.some(
|
|
234
|
-
(tab) => tab.
|
|
234
|
+
(tab) => tab.tab_name?.toLowerCase() === selectedTab.toLowerCase()
|
|
235
235
|
)
|
|
236
236
|
) {
|
|
237
237
|
// Try to select 'ALL' if it exists
|
|
238
238
|
const allTab = tabsData.find(
|
|
239
|
-
(tab) => tab.
|
|
239
|
+
(tab) => tab.tab_name?.toLowerCase() === "all"
|
|
240
240
|
);
|
|
241
241
|
if (allTab) {
|
|
242
|
-
setSelectedTab(allTab.
|
|
242
|
+
setSelectedTab(allTab.tab_name || "All");
|
|
243
243
|
} else {
|
|
244
|
-
setSelectedTab(tabsData[0].
|
|
244
|
+
setSelectedTab(tabsData[0].tab_name || "All");
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
}, [tabsData, selectedTab]);
|
|
@@ -251,9 +251,9 @@ function ListingView() {
|
|
|
251
251
|
tableData?.entity_tabs?.find((tab) => {
|
|
252
252
|
const activeTab = selectedTab || "All";
|
|
253
253
|
return (
|
|
254
|
-
tab.
|
|
254
|
+
tab.tab_name?.toLocaleLowerCase() === activeTab.toLocaleLowerCase()
|
|
255
255
|
);
|
|
256
|
-
})?.
|
|
256
|
+
})?.count || "0"
|
|
257
257
|
);
|
|
258
258
|
}, [tableData, selectedTab]);
|
|
259
259
|
|