rez-table-listing-mui 1.3.61 → 2.0.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/dist/index.d.ts +4 -5
- 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/index.scss +0 -144
- package/src/listing/components/login/index.tsx +4 -4
- package/src/listing/components/pagination/default/index.tsx +108 -138
- package/src/listing/components/pagination/default/pagination.styles.ts +113 -0
- package/src/listing/components/{table-body-dnd-cell.tsx → table-body/table-body-dnd-cell.tsx} +18 -25
- package/src/listing/components/table-body/table-body.styles.ts +64 -0
- package/src/listing/components/{table-body.tsx → table-body/table-body.tsx} +35 -32
- package/src/listing/components/table-head/table-head-dnd-cell.tsx +112 -0
- package/src/listing/components/table-head/table-head-pin.tsx +29 -0
- package/src/listing/components/{table-head-popover.tsx → table-head/table-head-popover.tsx} +4 -16
- package/src/listing/components/table-head/table-head-resizer.tsx +22 -0
- package/src/listing/components/table-head/table-head.styles.ts +115 -0
- package/src/listing/components/{table-head.tsx → table-head/table-head.tsx} +36 -69
- package/src/listing/components/table.tsx +2 -2
- package/src/listing/components/tabs/index.tsx +28 -42
- package/src/listing/components/tabs/tabs.styles.ts +49 -0
- package/src/listing/libs/hooks/useEntityTableAPI.tsx +8 -0
- package/src/listing/libs/hooks/useEntityTableHooks.ts +3 -3
- package/src/listing/libs/services/getLayoutAPI.tsx +1 -1
- package/src/listing/libs/utils/apiColumn.ts +17 -8
- package/src/listing/libs/utils/common.ts +45 -1
- package/src/listing/types/common.ts +1 -0
- package/src/listing/types/table.ts +2 -2
- package/src/view/ListingView.tsx +58 -91
- package/src/listing/components/table-head-dnd-cell.tsx +0 -150
- package/src/listing/components/table-head-pin.tsx +0 -22
- package/src/listing/components/tabs/index.scss +0 -42
- package/src/listing/components/tabs/styles.ts +0 -34
|
@@ -3,17 +3,25 @@ import {
|
|
|
3
3
|
CraftTableFeatureProps,
|
|
4
4
|
craftTableFilterSettingsOptionsProps,
|
|
5
5
|
CraftTableOptionsProps,
|
|
6
|
-
} from "
|
|
7
|
-
import { DownArrow, UpArrow } from "
|
|
8
|
-
import {
|
|
9
|
-
import { getColumnPinningStyles } from "
|
|
6
|
+
} from "../../types/table-options";
|
|
7
|
+
import { DownArrow, UpArrow } from "../../../assets/svg";
|
|
8
|
+
import { useState } from "react";
|
|
9
|
+
import { getColumnPinningStyles } from "../../libs/utils/common";
|
|
10
10
|
import {
|
|
11
11
|
horizontalListSortingStrategy,
|
|
12
12
|
SortableContext,
|
|
13
13
|
} from "@dnd-kit/sortable";
|
|
14
14
|
import DraggableTableHeader from "./table-head-dnd-cell";
|
|
15
15
|
import TableHeadPin from "./table-head-pin";
|
|
16
|
-
import Checkbox from "
|
|
16
|
+
import Checkbox from "../inputs/checkbox";
|
|
17
|
+
import TableColumnResizeHandle from "./table-head-resizer";
|
|
18
|
+
import {
|
|
19
|
+
TableHeadCell,
|
|
20
|
+
TableHeadContent,
|
|
21
|
+
TableHeadRoot,
|
|
22
|
+
TableHeadRow,
|
|
23
|
+
TableHeadSort,
|
|
24
|
+
} from "./table-head.styles";
|
|
17
25
|
|
|
18
26
|
interface TableHeadProps<T> {
|
|
19
27
|
table: Table<T>;
|
|
@@ -49,54 +57,26 @@ function TableHead<T>({
|
|
|
49
57
|
};
|
|
50
58
|
|
|
51
59
|
return (
|
|
52
|
-
<
|
|
60
|
+
<TableHeadRoot sticky={stickyHeader}>
|
|
53
61
|
{table.getHeaderGroups().map((headerGroup) => (
|
|
54
|
-
<
|
|
62
|
+
<TableHeadRow striped={featureOptions.striped} key={headerGroup?.id}>
|
|
55
63
|
{enableRowSelection && (
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
left: 0,
|
|
61
|
-
width: "50px",
|
|
62
|
-
}}
|
|
64
|
+
<TableHeadCell
|
|
65
|
+
sticky
|
|
66
|
+
compact={featureOptions.compactTable}
|
|
67
|
+
style={{ width: 50 }}
|
|
63
68
|
>
|
|
64
|
-
<
|
|
69
|
+
<TableHeadContent>
|
|
65
70
|
<Checkbox
|
|
66
71
|
checked={table.getIsAllRowsSelected()}
|
|
67
72
|
indeterminate={table.getIsSomeRowsSelected()}
|
|
68
73
|
onChange={() => table.toggleAllRowsSelected()}
|
|
69
74
|
/>
|
|
70
|
-
</
|
|
71
|
-
</
|
|
75
|
+
</TableHeadContent>
|
|
76
|
+
</TableHeadCell>
|
|
72
77
|
)}
|
|
73
78
|
|
|
74
79
|
{headerGroup.headers.map((header) => {
|
|
75
|
-
let sortProps: {
|
|
76
|
-
className: string;
|
|
77
|
-
title?: string;
|
|
78
|
-
style?: CSSProperties;
|
|
79
|
-
} = {
|
|
80
|
-
className: "ts__content",
|
|
81
|
-
// style: {
|
|
82
|
-
// justifyContent: getColumnAlignment(
|
|
83
|
-
// (header?.column?.columnDef?.meta as align)?.align
|
|
84
|
-
// ),
|
|
85
|
-
// },
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
// if (header.column.getCanSort()) {
|
|
89
|
-
// sortProps = {
|
|
90
|
-
// ...sortProps,
|
|
91
|
-
// title:
|
|
92
|
-
// header.column.getNextSortingOrder() === "asc"
|
|
93
|
-
// ? "Sort ascending"
|
|
94
|
-
// : header.column.getNextSortingOrder() === "desc"
|
|
95
|
-
// ? "Sort descending"
|
|
96
|
-
// : "Clear sort",
|
|
97
|
-
// };
|
|
98
|
-
// }
|
|
99
|
-
|
|
100
80
|
return enableColumnReordering ? (
|
|
101
81
|
<SortableContext
|
|
102
82
|
key={header?.id}
|
|
@@ -113,36 +93,30 @@ function TableHead<T>({
|
|
|
113
93
|
/>
|
|
114
94
|
</SortableContext>
|
|
115
95
|
) : (
|
|
116
|
-
<
|
|
96
|
+
<TableHeadCell
|
|
117
97
|
key={header?.id}
|
|
118
|
-
className="ts__head__th"
|
|
119
98
|
colSpan={header.colSpan}
|
|
99
|
+
compact={featureOptions.compactTable}
|
|
100
|
+
onClick={handleHover}
|
|
120
101
|
style={{
|
|
121
102
|
...getColumnPinningStyles(header.column),
|
|
122
103
|
width: `${header.column.getSize()}px`,
|
|
123
104
|
minWidth: `${header.column.columnDef.minSize}px`,
|
|
124
105
|
maxWidth: `${header.column.columnDef.maxSize}px`,
|
|
125
106
|
}}
|
|
126
|
-
onClick={handleHover}
|
|
127
107
|
>
|
|
128
108
|
{header.isPlaceholder ? null : (
|
|
129
|
-
<
|
|
130
|
-
<
|
|
131
|
-
className={`${
|
|
132
|
-
header.column.getCanSort() ? "ts__content__sort" : ""
|
|
133
|
-
}`.trim()}
|
|
134
|
-
// onClick={header.column.getToggleSortingHandler()}
|
|
135
|
-
>
|
|
109
|
+
<TableHeadContent>
|
|
110
|
+
<TableHeadSort sortable={header.column.getCanSort()}>
|
|
136
111
|
{flexRender(
|
|
137
112
|
header.column.columnDef.header,
|
|
138
113
|
header.getContext()
|
|
139
114
|
)}
|
|
140
115
|
|
|
141
|
-
{{
|
|
142
|
-
asc
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
</div>
|
|
116
|
+
{{ asc: <UpArrow />, desc: <DownArrow /> }[
|
|
117
|
+
header.column.getIsSorted() as "asc" | "desc"
|
|
118
|
+
] ?? null}
|
|
119
|
+
</TableHeadSort>
|
|
146
120
|
|
|
147
121
|
{enableColumnPinning && (
|
|
148
122
|
<TableHeadPin
|
|
@@ -151,19 +125,12 @@ function TableHead<T>({
|
|
|
151
125
|
tableStates={tableStates}
|
|
152
126
|
/>
|
|
153
127
|
)}
|
|
154
|
-
</
|
|
128
|
+
</TableHeadContent>
|
|
155
129
|
)}
|
|
156
130
|
|
|
157
131
|
{/* column resizing */}
|
|
158
132
|
{header.column.getCanResize() ? (
|
|
159
|
-
<
|
|
160
|
-
onDoubleClick={() => header.column.resetSize()}
|
|
161
|
-
onMouseDown={header.getResizeHandler()}
|
|
162
|
-
onTouchStart={header.getResizeHandler()}
|
|
163
|
-
className={`column__resize ${
|
|
164
|
-
header.column.getIsResizing() ? "is__resizing" : ""
|
|
165
|
-
}`}
|
|
166
|
-
/>
|
|
133
|
+
<TableColumnResizeHandle header={header} />
|
|
167
134
|
) : null}
|
|
168
135
|
|
|
169
136
|
{/* Popover */}
|
|
@@ -174,12 +141,12 @@ function TableHead<T>({
|
|
|
174
141
|
wrap={wrap}
|
|
175
142
|
tableStates={tableStates}
|
|
176
143
|
/> */}
|
|
177
|
-
</
|
|
144
|
+
</TableHeadCell>
|
|
178
145
|
);
|
|
179
146
|
})}
|
|
180
|
-
</
|
|
147
|
+
</TableHeadRow>
|
|
181
148
|
))}
|
|
182
|
-
</
|
|
149
|
+
</TableHeadRoot>
|
|
183
150
|
);
|
|
184
151
|
}
|
|
185
152
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { formatClassName } from "../libs/utils/common";
|
|
2
2
|
import { CraftTableComponentProps } from "../types/table";
|
|
3
|
-
import TableBody from "./table-body";
|
|
4
|
-
import TableHead from "./table-head";
|
|
3
|
+
import TableBody from "./table-body/table-body";
|
|
4
|
+
import TableHead from "./table-head/table-head";
|
|
5
5
|
|
|
6
6
|
function Table<T>({
|
|
7
7
|
table,
|
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import { Box, CircularProgress, IconButton, Tab, Tabs } from "@mui/material";
|
|
1
|
+
import { Box, CircularProgress, IconButton } from "@mui/material";
|
|
3
2
|
import { CraftTableOptionsProps } from "../../types/table-options";
|
|
4
|
-
import SettingsOutlinedIcon from "@mui/icons-material/SettingsOutlined";
|
|
5
3
|
import { settingsOptionsProps } from "../../types/table";
|
|
6
|
-
import { tableTabsStyles } from "./styles";
|
|
7
4
|
import { useMemo } from "react";
|
|
8
|
-
import {
|
|
5
|
+
import { TableTab, TableTabCount, TableTabsRoot } from "./tabs.styles";
|
|
6
|
+
import { SettingsOutlined } from "@mui/icons-material";
|
|
9
7
|
|
|
10
8
|
interface TabDataProps {
|
|
11
9
|
tab_name: string | null;
|
|
12
|
-
count
|
|
10
|
+
count?: string | number;
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
interface TableTabsProps {
|
|
16
14
|
loading?: boolean;
|
|
17
15
|
tabsData?: TabDataProps[];
|
|
18
|
-
activeTab?:
|
|
16
|
+
activeTab?: TabDataProps;
|
|
19
17
|
tableStates: CraftTableOptionsProps;
|
|
20
18
|
onClick: (state: string) => void;
|
|
21
|
-
columns?: any[];
|
|
22
19
|
settingsOptions?: settingsOptionsProps;
|
|
23
20
|
}
|
|
24
21
|
|
|
25
22
|
export function TableTabs({
|
|
26
23
|
loading = false,
|
|
27
24
|
tabsData = [],
|
|
28
|
-
activeTab = "All",
|
|
25
|
+
activeTab = { tab_name: "All", count: 0 },
|
|
29
26
|
onClick,
|
|
30
27
|
tableStates,
|
|
31
28
|
settingsOptions,
|
|
@@ -34,10 +31,12 @@ export function TableTabs({
|
|
|
34
31
|
|
|
35
32
|
const handleTabClick = (tab: string) => {
|
|
36
33
|
onClick(tab);
|
|
37
|
-
tableStates.setPagination((prev) => ({
|
|
34
|
+
tableStates.setPagination((prev) => ({
|
|
35
|
+
...prev,
|
|
36
|
+
pageIndex: 0,
|
|
37
|
+
}));
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
// Normalize tab_name to uppercase for display + logic
|
|
41
40
|
const normalizedTabs = useMemo(() => {
|
|
42
41
|
return tabsData
|
|
43
42
|
?.filter((tab) => tab.tab_name !== null)
|
|
@@ -55,60 +54,47 @@ export function TableTabs({
|
|
|
55
54
|
);
|
|
56
55
|
}, [normalizedTabs]);
|
|
57
56
|
|
|
58
|
-
const selectedTab = activeTab || defaultTab;
|
|
57
|
+
const selectedTab = activeTab?.tab_name || defaultTab;
|
|
59
58
|
|
|
60
59
|
return (
|
|
61
60
|
<Box display="flex" alignItems="center" justifyContent="flex-start">
|
|
62
|
-
{/*
|
|
61
|
+
{/* Settings icon */}
|
|
63
62
|
{settingsOptions?.showIcon && (
|
|
64
|
-
<IconButton
|
|
65
|
-
|
|
66
|
-
sx={{ zIndex: 1000, mx: 0 }}
|
|
67
|
-
>
|
|
68
|
-
<SettingIcon />
|
|
63
|
+
<IconButton size="small" onClick={settingsOptions?.onClick}>
|
|
64
|
+
<SettingsOutlined fontSize="small" />
|
|
69
65
|
</IconButton>
|
|
70
66
|
)}
|
|
71
67
|
|
|
72
68
|
{/* Tabs */}
|
|
73
|
-
<
|
|
69
|
+
<TableTabsRoot
|
|
74
70
|
value={selectedTab}
|
|
75
71
|
onChange={(_, newValue) => handleTabClick(newValue)}
|
|
76
72
|
variant="scrollable"
|
|
77
73
|
scrollButtons="auto"
|
|
78
|
-
slotProps={{ indicator: { sx: { display: "none" } } }}
|
|
79
|
-
sx={tableTabsStyles.tabs}
|
|
80
74
|
>
|
|
81
|
-
{normalizedTabs.map((
|
|
82
|
-
const isSelected = activeTab === tab_name;
|
|
75
|
+
{normalizedTabs.map((tab) => {
|
|
76
|
+
const isSelected = activeTab?.tab_name === tab?.tab_name;
|
|
83
77
|
|
|
84
78
|
return (
|
|
85
|
-
<
|
|
86
|
-
key={tab_name}
|
|
87
|
-
value={
|
|
79
|
+
<TableTab
|
|
80
|
+
key={tab?.tab_name}
|
|
81
|
+
value={tab}
|
|
88
82
|
label={
|
|
89
83
|
<Box display="flex" alignItems="center" gap={1}>
|
|
90
|
-
<Box
|
|
91
|
-
|
|
92
|
-
sx={{
|
|
93
|
-
...tableTabsStyles.tabCount,
|
|
94
|
-
...(isSelected && {
|
|
95
|
-
// backgroundColor: "#ced3da",
|
|
96
|
-
// borderColor: "#ced3da",
|
|
97
|
-
backgroundColor: "#000",
|
|
98
|
-
color: "#fff",
|
|
99
|
-
fontWeight: "500",
|
|
100
|
-
}),
|
|
101
|
-
}}
|
|
102
|
-
>
|
|
103
|
-
{count == 0 ? "0" : String(count).padStart(2, "0")}
|
|
84
|
+
<Box sx={{ color: isSelected ? "#000" : "" }}>
|
|
85
|
+
{tab?.tab_name}
|
|
104
86
|
</Box>
|
|
87
|
+
<TableTabCount selected={isSelected}>
|
|
88
|
+
{tab?.count == 0
|
|
89
|
+
? "0"
|
|
90
|
+
: String(tab?.count).padStart(2, "0")}
|
|
91
|
+
</TableTabCount>
|
|
105
92
|
</Box>
|
|
106
93
|
}
|
|
107
|
-
sx={tableTabsStyles.tab}
|
|
108
94
|
/>
|
|
109
95
|
);
|
|
110
96
|
})}
|
|
111
|
-
</
|
|
97
|
+
</TableTabsRoot>
|
|
112
98
|
</Box>
|
|
113
99
|
);
|
|
114
100
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// tableTabs.styles.ts
|
|
2
|
+
import { styled } from "@mui/material/styles";
|
|
3
|
+
import Tabs, { tabsClasses } from "@mui/material/Tabs";
|
|
4
|
+
import Tab, { tabClasses } from "@mui/material/Tab";
|
|
5
|
+
import Box from "@mui/material/Box";
|
|
6
|
+
|
|
7
|
+
export const TableTabsRoot = styled(Tabs)(({ theme }) => ({
|
|
8
|
+
minHeight: theme.spacing(3.5),
|
|
9
|
+
|
|
10
|
+
[`& .${tabsClasses.flexContainer}`]: {
|
|
11
|
+
minHeight: theme.spacing(3.5),
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
// hide indicator (instead of slotProps every time)
|
|
15
|
+
[`& .${tabsClasses.indicator}`]: {
|
|
16
|
+
display: "none",
|
|
17
|
+
},
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
export const TableTab = styled(Tab)(({ theme }) => ({
|
|
21
|
+
color: theme.palette.grey[600],
|
|
22
|
+
padding: theme.spacing(1, 1.5),
|
|
23
|
+
minHeight: theme.spacing(3.5),
|
|
24
|
+
maxHeight: theme.spacing(3.5),
|
|
25
|
+
textTransform: "none",
|
|
26
|
+
minWidth: "unset",
|
|
27
|
+
whiteSpace: "nowrap",
|
|
28
|
+
|
|
29
|
+
[`&.${tabClasses.selected}`]: {
|
|
30
|
+
color: theme.palette.text.primary,
|
|
31
|
+
fontWeight: 700,
|
|
32
|
+
},
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
export const TableTabCount = styled(Box, {
|
|
36
|
+
shouldForwardProp: (prop) => prop !== "selected",
|
|
37
|
+
})<{ selected?: boolean }>(({ theme, selected }) => ({
|
|
38
|
+
padding: theme.spacing(0.25),
|
|
39
|
+
borderRadius: theme.shape.borderRadius,
|
|
40
|
+
border: `1px solid ${
|
|
41
|
+
selected ? theme.palette.text.primary : theme.palette.grey[700]
|
|
42
|
+
}`,
|
|
43
|
+
color: selected ? theme.palette.common.white : theme.palette.text.primary,
|
|
44
|
+
backgroundColor: selected ? theme.palette.text.primary : "transparent",
|
|
45
|
+
fontWeight: selected ? 500 : 400,
|
|
46
|
+
lineHeight: 1,
|
|
47
|
+
minWidth: 20,
|
|
48
|
+
textAlign: "center",
|
|
49
|
+
}));
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
getOperationList,
|
|
25
25
|
getLayoutAttributes,
|
|
26
26
|
getAttributes,
|
|
27
|
+
getTableTabs,
|
|
27
28
|
} from "../utils/apiColumn";
|
|
28
29
|
import {
|
|
29
30
|
FilterDataMainFilterEntityListProps,
|
|
@@ -401,6 +402,13 @@ export const useGetLayoutAttributes = ({
|
|
|
401
402
|
return { layoutAttributes };
|
|
402
403
|
};
|
|
403
404
|
|
|
405
|
+
export const useGetTableTabs = (payload: any) => {
|
|
406
|
+
const { data: tableTabs, isLoading } = useQuery({
|
|
407
|
+
queryKey: ["tableTabs", payload],
|
|
408
|
+
queryFn: () => getTableTabs(payload),
|
|
409
|
+
});
|
|
410
|
+
return { tableTabs, isLoading };
|
|
411
|
+
};
|
|
404
412
|
// export const useGetSettingsColumnAttributes = (entity_type: string) => {
|
|
405
413
|
// // First query to get meta data
|
|
406
414
|
// const settingsColumnAttributes = useQuery({
|
|
@@ -14,11 +14,11 @@ export const useDetailsQueryAPI = (value: string | undefined) => {
|
|
|
14
14
|
return { detailsQuery };
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export const useFetchData = (entity_type: string) => {
|
|
17
|
+
export const useFetchData = (entity_type: string, payload?: any) => {
|
|
18
18
|
// First query to get meta data
|
|
19
19
|
const metaQuery = useQuery({
|
|
20
|
-
queryKey: ["meta", entity_type],
|
|
21
|
-
queryFn: () => entityTableFilterMaster(entity_type),
|
|
20
|
+
queryKey: ["meta", entity_type, payload],
|
|
21
|
+
queryFn: () => entityTableFilterMaster(entity_type, payload),
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
return { metaQuery };
|
|
@@ -7,7 +7,7 @@ export const getLeadNavigationTabs = async (entity_type: string) => {
|
|
|
7
7
|
type: "layout",
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
const response = await api.get("/layout-preference", { params });
|
|
10
|
+
const response = await api.get("meta/layout-preference", { params });
|
|
11
11
|
|
|
12
12
|
return response.data.mapped_json;
|
|
13
13
|
} catch (error) {
|
|
@@ -27,10 +27,14 @@ export const entityTableMetaMaster = async (entity_type: string) => {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export const entityTableFilterMaster = async (
|
|
30
|
+
export const entityTableFilterMaster = async (
|
|
31
|
+
entity_type: string,
|
|
32
|
+
payload?: any
|
|
33
|
+
) => {
|
|
31
34
|
try {
|
|
32
35
|
const response = await api.post(
|
|
33
|
-
`/meta/get-table-data?entity_type=${entity_type}&list_type=${entity_type}
|
|
36
|
+
`/meta/get-table-data?entity_type=${entity_type}&list_type=${entity_type}`,
|
|
37
|
+
payload
|
|
34
38
|
);
|
|
35
39
|
|
|
36
40
|
// const filteredData = {
|
|
@@ -141,7 +145,7 @@ export const saveSettingsData = async (payload: any) => {
|
|
|
141
145
|
export const getSettingsData = async (entity_type: any) => {
|
|
142
146
|
try {
|
|
143
147
|
const response = await api.get(
|
|
144
|
-
`layout-preference?entity_type=${entity_type}`
|
|
148
|
+
`meta/layout-preference?entity_type=${entity_type}`
|
|
145
149
|
);
|
|
146
150
|
return response.data;
|
|
147
151
|
} catch (error) {
|
|
@@ -156,7 +160,7 @@ export const viewSettingsDropDown = async ({
|
|
|
156
160
|
sort_by,
|
|
157
161
|
}: viewSettingsDropDownAPIProps): Promise<Array<string>> => {
|
|
158
162
|
const response = await api.get(
|
|
159
|
-
|
|
163
|
+
`meta/layout-preference/column?entity_type=${entity_type}&column=${column}&sort_by=${sort_by}`
|
|
160
164
|
);
|
|
161
165
|
|
|
162
166
|
return response.data;
|
|
@@ -164,7 +168,7 @@ export const viewSettingsDropDown = async ({
|
|
|
164
168
|
|
|
165
169
|
export const getFilterEntityList = async (entity_type: string) => {
|
|
166
170
|
const response = await api.get(
|
|
167
|
-
|
|
171
|
+
`meta/entity-relation/${entity_type}?include=true`
|
|
168
172
|
);
|
|
169
173
|
|
|
170
174
|
return response.data;
|
|
@@ -176,7 +180,7 @@ export const getFilterCriteriaByEntity = async (
|
|
|
176
180
|
const params = { entity_type: selectedFilterEntity?.value };
|
|
177
181
|
|
|
178
182
|
const response = await api.get(
|
|
179
|
-
|
|
183
|
+
`meta/attribute-master/getAttributes?direct=false&entity_type=${selectedFilterEntity?.value}`
|
|
180
184
|
);
|
|
181
185
|
|
|
182
186
|
return response.data;
|
|
@@ -198,7 +202,7 @@ export const getLayoutAttributes = async ({
|
|
|
198
202
|
element_type,
|
|
199
203
|
};
|
|
200
204
|
const response = await api.post(
|
|
201
|
-
|
|
205
|
+
`meta/layout-preference/attributes`,
|
|
202
206
|
{ entity_type },
|
|
203
207
|
{ params }
|
|
204
208
|
);
|
|
@@ -207,9 +211,14 @@ export const getLayoutAttributes = async ({
|
|
|
207
211
|
|
|
208
212
|
export const getAttributes = async (entity_type: string) => {
|
|
209
213
|
const response = await api.get(
|
|
210
|
-
|
|
214
|
+
`meta/attribute-master/getAttributes?direct=false&entity_type=${entity_type}`
|
|
211
215
|
);
|
|
212
216
|
console.log("resss", response);
|
|
213
217
|
|
|
214
218
|
return response.data;
|
|
215
219
|
};
|
|
220
|
+
|
|
221
|
+
export const getTableTabs = async (payload: any) => {
|
|
222
|
+
const response = await api.post(`filter/adm/tabs`, payload);
|
|
223
|
+
return response.data;
|
|
224
|
+
};
|
|
@@ -78,7 +78,7 @@ export function customDebounce<T extends (...args: any[]) => any>(
|
|
|
78
78
|
|
|
79
79
|
//ENTITY TYPE
|
|
80
80
|
const ENVIRONMENT = "adm_dev";
|
|
81
|
-
export const ENTITY_TYPE = "
|
|
81
|
+
export const ENTITY_TYPE = "ROL";
|
|
82
82
|
export const MAPPED_ENTITY_TYPE = "LYPR"; // LAP OR LYPR
|
|
83
83
|
export const USER_ID = 226;
|
|
84
84
|
|
|
@@ -111,3 +111,47 @@ api.interceptors.request.use(
|
|
|
111
111
|
return Promise.reject(error);
|
|
112
112
|
}
|
|
113
113
|
);
|
|
114
|
+
|
|
115
|
+
export const formatTableHeaders = (columns: any) => {
|
|
116
|
+
const mapped = columns.map((col: any) => {
|
|
117
|
+
const meta =
|
|
118
|
+
col.attribute_key === "status" ||
|
|
119
|
+
col.attribute_key === "lead_status" ||
|
|
120
|
+
col.attribute_key === "flag" ||
|
|
121
|
+
col.attribute_key === "invitation_status"
|
|
122
|
+
? { type: "custom", propName: "renderStatus", align: col.align }
|
|
123
|
+
: col.attribute_key === "profile_image" ||
|
|
124
|
+
col.attribute_key === "short_logo"
|
|
125
|
+
? {
|
|
126
|
+
type: "custom",
|
|
127
|
+
propName: "profileImageFetch",
|
|
128
|
+
align: col.align,
|
|
129
|
+
}
|
|
130
|
+
: col.attribute_key === "start_date" || col.attribute_key === "end_date"
|
|
131
|
+
? { type: "custom", propName: "dateFormater", align: col.align }
|
|
132
|
+
: col.attribute_key === "action"
|
|
133
|
+
? { type: "custom", propName: "renderAction", align: col.align }
|
|
134
|
+
: col.attribute_key === "code"
|
|
135
|
+
? {
|
|
136
|
+
type: "custom",
|
|
137
|
+
propName: "drillCellRenderer",
|
|
138
|
+
align: col.align,
|
|
139
|
+
}
|
|
140
|
+
: col.attribute_key === "primary_mobile"
|
|
141
|
+
? {
|
|
142
|
+
type: "custom",
|
|
143
|
+
propName: "apiCallonClick",
|
|
144
|
+
align: col.align,
|
|
145
|
+
}
|
|
146
|
+
: undefined;
|
|
147
|
+
|
|
148
|
+
return {
|
|
149
|
+
header: col.name ?? "",
|
|
150
|
+
accessorKey: col.attribute_key ?? "",
|
|
151
|
+
size: col.size,
|
|
152
|
+
meta,
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
return mapped;
|
|
157
|
+
};
|
|
@@ -95,7 +95,7 @@ export interface CraftTableProps<T> {
|
|
|
95
95
|
filterOptions?: FilterOptionsProps;
|
|
96
96
|
settingsOptions?: settingsOptionsProps;
|
|
97
97
|
craftTableFilterSettingsOptions?: craftTableFilterSettingsOptionsProps;
|
|
98
|
-
activeTab?:
|
|
98
|
+
activeTab?: any;
|
|
99
99
|
}
|
|
100
100
|
export interface CraftTableComponentProps<T> {
|
|
101
101
|
table: Table<T>;
|
|
@@ -115,6 +115,6 @@ export interface TableHeaderProps<T> {
|
|
|
115
115
|
activeTab?: string;
|
|
116
116
|
featureOptions: CraftTableFeatureProps;
|
|
117
117
|
tableStates: CraftTableOptionsProps;
|
|
118
|
-
filterSettingStates
|
|
118
|
+
filterSettingStates?: craftTableFilterSettingsOptionsProps;
|
|
119
119
|
onSaveSettings?: (columnId: string) => void;
|
|
120
120
|
}
|