rez-table-listing-mui 1.2.11 → 1.2.13
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 +3 -1
- 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/App.tsx +7 -3
- package/src/assets/Satoshi/Satoshi-Black.ttf +0 -0
- package/src/assets/Satoshi/Satoshi-BlackItalic.ttf +0 -0
- package/src/assets/Satoshi/Satoshi-Bold.ttf +0 -0
- package/src/assets/Satoshi/Satoshi-BoldItalic.ttf +0 -0
- package/src/assets/Satoshi/Satoshi-Italic.ttf +0 -0
- package/src/assets/Satoshi/Satoshi-Light.ttf +0 -0
- package/src/assets/Satoshi/Satoshi-LightItalic.ttf +0 -0
- package/src/assets/Satoshi/Satoshi-Medium.ttf +0 -0
- package/src/assets/Satoshi/Satoshi-MediumItalic.ttf +0 -0
- package/src/assets/Satoshi/Satoshi-Regular.ttf +0 -0
- package/src/assets/Satoshi/Satoshi-Variable.ttf +0 -0
- package/src/assets/Satoshi/Satoshi-VariableItalic.ttf +0 -0
- package/src/assets/global.css +88 -0
- package/src/assets/variable.ts +15 -0
- package/src/components/common/index.scss +2 -1
- package/src/components/index-table.tsx +16 -0
- package/src/components/index.scss +1 -2
- package/src/components/table-head-dnd-cell.tsx +5 -5
- package/src/components/table-head.tsx +5 -5
- package/src/components/table-settings/components/quick-tab.tsx +22 -20
- package/src/components/table-settings/index.tsx +1 -0
- package/src/components/tabs/index.scss +2 -1
- package/src/libs/hooks/useCraftTable.tsx +9 -0
- package/src/libs/hooks/useDefaultColumns.tsx +2 -1
- package/src/libs/utils/common.ts +1 -1
- package/src/main.tsx +1 -0
- package/src/types/table-options.ts +3 -0
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -26,13 +26,14 @@ import { SettingsDataProps } from "./types/filter-settings";
|
|
|
26
26
|
import { FilterMasterStateProps } from "./types/filter";
|
|
27
27
|
import { ColumnDef } from "@tanstack/react-table";
|
|
28
28
|
import { ENTITY_TYPE } from "./libs/utils/common";
|
|
29
|
+
import { makeData, Person } from "./libs/utils/make-hierar-data";
|
|
29
30
|
|
|
30
31
|
function App() {
|
|
31
32
|
// const [mockLoading, setMockLoading] = useState<boolean>(true);
|
|
32
33
|
// const [jsonData] = useState<any[]>([]);
|
|
33
34
|
const [columns, setColumns] = useState<any[]>([]);
|
|
34
35
|
const [searchTerm, setSearchTerm] = useState("");
|
|
35
|
-
|
|
36
|
+
const [data, setData] = useState<Person[]>(() => makeData(200, 3, 2));
|
|
36
37
|
|
|
37
38
|
const [selectedTab, setSelectedTab] = useState("All");
|
|
38
39
|
|
|
@@ -225,6 +226,7 @@ function App() {
|
|
|
225
226
|
fontWeight: 500,
|
|
226
227
|
borderRadius: "4px",
|
|
227
228
|
padding: "4px",
|
|
229
|
+
width: "fit-content",
|
|
228
230
|
}}
|
|
229
231
|
>
|
|
230
232
|
{statusValue}
|
|
@@ -338,8 +340,10 @@ function App() {
|
|
|
338
340
|
<LoginButton />
|
|
339
341
|
|
|
340
342
|
<TableWrapper
|
|
341
|
-
data={filteredData}
|
|
342
|
-
|
|
343
|
+
// data={filteredData}
|
|
344
|
+
data={data}
|
|
345
|
+
columns={defaultColumns}
|
|
346
|
+
// columns={columns && columns.length > 0 ? columns : defaultColumns}
|
|
343
347
|
tableStates={tableStates}
|
|
344
348
|
featureOptions={{
|
|
345
349
|
striped: true,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/* Satoshi Font Family */
|
|
2
|
+
@font-face {
|
|
3
|
+
font-family: "Satoshi";
|
|
4
|
+
src: url("./Satoshi/Satoshi-Light.ttf") format("truetype");
|
|
5
|
+
font-weight: 300;
|
|
6
|
+
font-style: normal;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
@font-face {
|
|
10
|
+
font-family: "Satoshi";
|
|
11
|
+
src: url("./Satoshi/Satoshi-LightItalic.ttf") format("truetype");
|
|
12
|
+
font-weight: 300;
|
|
13
|
+
font-style: italic;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@font-face {
|
|
17
|
+
font-family: "Satoshi";
|
|
18
|
+
src: url("./Satoshi/Satoshi-Regular.ttf") format("truetype");
|
|
19
|
+
font-weight: 400;
|
|
20
|
+
font-style: normal;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@font-face {
|
|
24
|
+
font-family: "Satoshi";
|
|
25
|
+
src: url("./Satoshi/Satoshi-Italic.ttf") format("truetype");
|
|
26
|
+
font-weight: 400;
|
|
27
|
+
font-style: italic;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@font-face {
|
|
31
|
+
font-family: "Satoshi";
|
|
32
|
+
src: url("./Satoshi/Satoshi-Medium.ttf") format("truetype");
|
|
33
|
+
font-weight: 500;
|
|
34
|
+
font-style: normal;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@font-face {
|
|
38
|
+
font-family: "Satoshi";
|
|
39
|
+
src: url("./Satoshi/Satoshi-MediumItalic.ttf") format("truetype");
|
|
40
|
+
font-weight: 500;
|
|
41
|
+
font-style: italic;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@font-face {
|
|
45
|
+
font-family: "Satoshi";
|
|
46
|
+
src: url("./Satoshi/Satoshi-Bold.ttf") format("truetype");
|
|
47
|
+
font-weight: 700;
|
|
48
|
+
font-style: normal;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@font-face {
|
|
52
|
+
font-family: "Satoshi";
|
|
53
|
+
src: url("./Satoshi/Satoshi-BoldItalic.ttf") format("truetype");
|
|
54
|
+
font-weight: 700;
|
|
55
|
+
font-style: italic;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@font-face {
|
|
59
|
+
font-family: "Satoshi";
|
|
60
|
+
src: url("./Satoshi/Satoshi-Black.ttf") format("truetype");
|
|
61
|
+
font-weight: 900;
|
|
62
|
+
font-style: normal;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@font-face {
|
|
66
|
+
font-family: "Satoshi";
|
|
67
|
+
src: url("./Satoshi/Satoshi-BlackItalic.ttf") format("truetype");
|
|
68
|
+
font-weight: 900;
|
|
69
|
+
font-style: italic;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Global font application */
|
|
73
|
+
* {
|
|
74
|
+
font-family: "Satoshi", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
body {
|
|
78
|
+
font-family: "Satoshi", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
79
|
+
font-weight: 400;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
h1, h2, h3, h4, h5, h6 {
|
|
83
|
+
font-family: "Satoshi", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
input, textarea, select, button {
|
|
87
|
+
font-family: inherit;
|
|
88
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const headerHeight = "64px";
|
|
2
|
+
export const primarySidebarWidth = "64px";
|
|
3
|
+
export const totalSidebarWidth = "260px";
|
|
4
|
+
export const submenuSidebarWidth = "12.25rem";
|
|
5
|
+
export const primaryfontRegular = "Satoshi-regular";
|
|
6
|
+
export const primaryfontBlack = "Satoshi-Black";
|
|
7
|
+
export const primaryFontBlackItalic = "Satoshi-BlackItalic";
|
|
8
|
+
export const primaryFontBold = "Satoshi-Bold";
|
|
9
|
+
export const primaryFontBoldItalic = "Satoshi-BoldItalic";
|
|
10
|
+
export const primaryFontItalic = "Satoshi-Italic";
|
|
11
|
+
export const primaryLight = "Satoshi-Light";
|
|
12
|
+
export const primaryLightItalic = "Satoshi-LightItalic";
|
|
13
|
+
export const primaryRegular = "Satoshi-Regular";
|
|
14
|
+
export const primaryVariable = "Satoshi-Variable";
|
|
15
|
+
export const primaryVariableItalic = "Satoshi-VariableItalic";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ColumnDef,
|
|
3
|
+
ColumnMeta,
|
|
3
4
|
getCoreRowModel,
|
|
4
5
|
getExpandedRowModel,
|
|
5
6
|
getPaginationRowModel,
|
|
@@ -21,6 +22,10 @@ import TableDND from "./table-dnd";
|
|
|
21
22
|
import Table from "./table";
|
|
22
23
|
import { useFullscreenPopoverContainer } from "../libs/hooks/useFullScreen";
|
|
23
24
|
|
|
25
|
+
interface CustomColumnMeta<T> extends ColumnMeta<T, unknown> {
|
|
26
|
+
defaultPinned?: "left" | "right" | undefined;
|
|
27
|
+
}
|
|
28
|
+
|
|
24
29
|
function TableWrapper<T>({
|
|
25
30
|
data = [],
|
|
26
31
|
columns = [],
|
|
@@ -85,6 +90,17 @@ function TableWrapper<T>({
|
|
|
85
90
|
}
|
|
86
91
|
}, [columns]);
|
|
87
92
|
|
|
93
|
+
//For Default Column Pinning to work
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
table.getAllLeafColumns().forEach((col) => {
|
|
96
|
+
const where = (col.columnDef.meta as CustomColumnMeta<T>)
|
|
97
|
+
?.defaultPinned as "left" | "right" | undefined;
|
|
98
|
+
if (where && !col.getIsPinned()) {
|
|
99
|
+
col.pin(where);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}, [tableStates?.columnPinning?.left, metaColumns]);
|
|
103
|
+
|
|
88
104
|
const [columnOrder, setColumnOrder] = useState<string[]>(() =>
|
|
89
105
|
metaColumns.map((c) => c.id!)
|
|
90
106
|
);
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
--grey-900: #414042;
|
|
11
11
|
--filter-width: 24rem;
|
|
12
12
|
|
|
13
|
-
font-family:
|
|
14
|
-
Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
|
|
13
|
+
font-family: "Satoshi", sans-serif;
|
|
15
14
|
|
|
16
15
|
// set default styles for all elements
|
|
17
16
|
& * {
|
|
@@ -52,11 +52,11 @@ function DraggableTableHeader<T>({
|
|
|
52
52
|
style?: CSSProperties;
|
|
53
53
|
} = {
|
|
54
54
|
className: "ts__content",
|
|
55
|
-
style: {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
},
|
|
55
|
+
// style: {
|
|
56
|
+
// justifyContent: getColumnAlignment(
|
|
57
|
+
// (header?.column?.columnDef?.meta as align)?.align
|
|
58
|
+
// ),
|
|
59
|
+
// },
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
// if (header.column.getCanSort()) {
|
|
@@ -75,11 +75,11 @@ function TableHead<T>({
|
|
|
75
75
|
style?: CSSProperties;
|
|
76
76
|
} = {
|
|
77
77
|
className: "ts__content",
|
|
78
|
-
style: {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
},
|
|
78
|
+
// style: {
|
|
79
|
+
// justifyContent: getColumnAlignment(
|
|
80
|
+
// (header?.column?.columnDef?.meta as align)?.align
|
|
81
|
+
// ),
|
|
82
|
+
// },
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
// if (header.column.getCanSort()) {
|
|
@@ -108,31 +108,33 @@ const QuickTab = ({
|
|
|
108
108
|
);
|
|
109
109
|
|
|
110
110
|
// Update the error state
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
111
|
+
|
|
112
|
+
// Later we can use this to show error message when we will make error logic more simple
|
|
113
|
+
// setSaveButtonError((prev) => {
|
|
114
|
+
// const otherMessages =
|
|
115
|
+
// prev?.messages?.filter((message) => message.type !== ERROR_CODE) ||
|
|
116
|
+
// [];
|
|
117
|
+
|
|
118
|
+
// return {
|
|
119
|
+
// ...prev,
|
|
120
|
+
// hasError: true,
|
|
121
|
+
// messages: hasQuickTabError
|
|
122
|
+
// ? [...prev?.messages]
|
|
123
|
+
// : [...otherMessages, errorMessage],
|
|
124
|
+
// };
|
|
125
|
+
// });
|
|
124
126
|
} else {
|
|
125
127
|
const hasOtherMessages = saveButtonError?.messages?.some(
|
|
126
128
|
(message) => message.type !== ERROR_CODE
|
|
127
129
|
);
|
|
128
130
|
// Reset error state if the list is valid
|
|
129
|
-
setSaveButtonError((prev) => ({
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}));
|
|
131
|
+
// setSaveButtonError((prev) => ({
|
|
132
|
+
// ...prev,
|
|
133
|
+
// hasError: hasOtherMessages,
|
|
134
|
+
// messages:
|
|
135
|
+
// prev?.messages?.filter((message) => message.type !== ERROR_CODE) ||
|
|
136
|
+
// [],
|
|
137
|
+
// }));
|
|
136
138
|
}
|
|
137
139
|
}
|
|
138
140
|
}, [quickTabStates?.hide_list, quickTabStates?.show_list]);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ColumnPinningState,
|
|
2
3
|
ExpandedState,
|
|
3
4
|
PaginationState,
|
|
4
5
|
RowSelectionState,
|
|
@@ -49,6 +50,12 @@ export function useCraftTable(paginationPageSize: number = 25) {
|
|
|
49
50
|
);
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
// For Default Column Pinning
|
|
54
|
+
const [columnPinning, setColumnPinning] = useState<ColumnPinningState>({
|
|
55
|
+
left: [],
|
|
56
|
+
right: [],
|
|
57
|
+
});
|
|
58
|
+
|
|
52
59
|
const craftTableOptions: CraftTableOptionsProps = {
|
|
53
60
|
sorting: sorting,
|
|
54
61
|
setSorting: setSorting,
|
|
@@ -74,6 +81,8 @@ export function useCraftTable(paginationPageSize: number = 25) {
|
|
|
74
81
|
setShowTableFilter: setShowTableFilter,
|
|
75
82
|
showFilterOptions: showFilterOptions,
|
|
76
83
|
setShowFilterOption: setShowFilterOption,
|
|
84
|
+
columnPinning: columnPinning,
|
|
85
|
+
setColumnPinning: setColumnPinning,
|
|
77
86
|
};
|
|
78
87
|
|
|
79
88
|
return craftTableOptions;
|
|
@@ -58,7 +58,7 @@ export const useDefaultColumns = () => {
|
|
|
58
58
|
header: "Last Name",
|
|
59
59
|
accessorKey: "lastName",
|
|
60
60
|
size: 100,
|
|
61
|
-
meta: { label: "Last Name" },
|
|
61
|
+
meta: { label: "Last Name", defaultPinned: "left" },
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
header: "Email Id",
|
|
@@ -106,6 +106,7 @@ export const useDefaultColumns = () => {
|
|
|
106
106
|
label: "Action",
|
|
107
107
|
type: "custom",
|
|
108
108
|
propName: "renderAction",
|
|
109
|
+
align: "right",
|
|
109
110
|
},
|
|
110
111
|
},
|
|
111
112
|
],
|
package/src/libs/utils/common.ts
CHANGED
|
@@ -78,7 +78,7 @@ export function customDebounce<T extends (...args: any[]) => any>(
|
|
|
78
78
|
|
|
79
79
|
//ENTITY TYPE
|
|
80
80
|
const ENVIRONMENT = "uat";
|
|
81
|
-
export const ENTITY_TYPE = "
|
|
81
|
+
export const ENTITY_TYPE = "UPR";
|
|
82
82
|
|
|
83
83
|
const environments = {
|
|
84
84
|
adm_dev: "http://localhost:4010/api",
|
package/src/main.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import ReactDOM from "react-dom/client";
|
|
3
3
|
import App from "./App.tsx";
|
|
4
4
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
5
|
+
import "./assets/global.css";
|
|
5
6
|
|
|
6
7
|
ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
7
8
|
<QueryClientProvider
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
RowSelectionState,
|
|
4
4
|
SortingState,
|
|
5
5
|
ExpandedState,
|
|
6
|
+
ColumnPinningState,
|
|
6
7
|
} from "@tanstack/react-table";
|
|
7
8
|
import { Dispatch, SetStateAction } from "react";
|
|
8
9
|
import {
|
|
@@ -45,6 +46,8 @@ export interface CraftTableOptionsProps {
|
|
|
45
46
|
setShowTableFilter: Dispatch<SetStateAction<boolean>>;
|
|
46
47
|
showFilterOptions: boolean;
|
|
47
48
|
setShowFilterOption: Dispatch<SetStateAction<boolean>>;
|
|
49
|
+
columnPinning: ColumnPinningState;
|
|
50
|
+
setColumnPinning: Dispatch<SetStateAction<ColumnPinningState>>;
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
export interface craftTableFilterSettingsOptionsProps {
|