rez-table-listing-mui 1.3.62 → 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 +23 -41
- package/src/listing/components/tabs/tabs.styles.ts +49 -0
- package/src/listing/libs/hooks/useEntityTableHooks.ts +3 -3
- package/src/listing/libs/utils/apiColumn.ts +7 -3
- package/src/listing/libs/utils/common.ts +44 -0
- package/src/listing/types/table.ts +2 -2
- package/src/view/ListingView.tsx +39 -88
- 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
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { flexRender } from "@tanstack/react-table";
|
|
2
|
-
import { useSortable } from "@dnd-kit/sortable";
|
|
3
|
-
import { CSSProperties, useState } from "react";
|
|
4
|
-
import { CSS } from "@dnd-kit/utilities";
|
|
5
|
-
import { DownArrow, DragHandleIcon, UpArrow } from "../../assets/svg";
|
|
6
|
-
import {
|
|
7
|
-
getColumnAlignment,
|
|
8
|
-
getColumnPinningStyles,
|
|
9
|
-
} from "../libs/utils/common";
|
|
10
|
-
import { align } from "../types/common";
|
|
11
|
-
import { TableHeaderProps } from "../types/table";
|
|
12
|
-
import TableHeadPin from "./table-head-pin";
|
|
13
|
-
import TableHeadPopover from "./table-head-popover";
|
|
14
|
-
|
|
15
|
-
function DraggableTableHeader<T>({
|
|
16
|
-
header,
|
|
17
|
-
activeTab,
|
|
18
|
-
featureOptions,
|
|
19
|
-
tableStates,
|
|
20
|
-
filterSettingStates,
|
|
21
|
-
onSaveSettings,
|
|
22
|
-
}: TableHeaderProps<T>) {
|
|
23
|
-
const { enableColumnPinning } = featureOptions;
|
|
24
|
-
|
|
25
|
-
// Popover
|
|
26
|
-
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
|
|
27
|
-
|
|
28
|
-
const handleHover = (event: React.MouseEvent<HTMLElement>) => {
|
|
29
|
-
setAnchorEl((prev) => (prev ? null : event.currentTarget));
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const handleClose = () => {
|
|
33
|
-
setAnchorEl(null);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const { isDragging, transform, attributes, listeners } = useSortable({
|
|
37
|
-
id: header.column.id,
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const isPinned = header.column.getIsPinned();
|
|
41
|
-
|
|
42
|
-
const styles: CSSProperties = {
|
|
43
|
-
opacity: isDragging ? 0.8 : 1,
|
|
44
|
-
position: "relative",
|
|
45
|
-
transform: CSS.Translate.toString(transform),
|
|
46
|
-
transition: "width transform 0.2s ease-in-out",
|
|
47
|
-
width: header.column.getSize(),
|
|
48
|
-
minWidth: `${header.column.columnDef.minSize ?? 180}px`,
|
|
49
|
-
maxWidth: `${header.column.columnDef.maxSize}px`,
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
let sortProps: {
|
|
53
|
-
className: string;
|
|
54
|
-
title?: string;
|
|
55
|
-
style?: CSSProperties;
|
|
56
|
-
} = {
|
|
57
|
-
className: "ts__content",
|
|
58
|
-
// style: {
|
|
59
|
-
// justifyContent: getColumnAlignment(
|
|
60
|
-
// (header?.column?.columnDef?.meta as align)?.align
|
|
61
|
-
// ),
|
|
62
|
-
// },
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
// if (header.column.getCanSort()) {
|
|
66
|
-
// sortProps = {
|
|
67
|
-
// ...sortProps,
|
|
68
|
-
// title:
|
|
69
|
-
// header.column.getNextSortingOrder() === "asc"
|
|
70
|
-
// ? "Sort ascending"
|
|
71
|
-
// : header.column.getNextSortingOrder() === "desc"
|
|
72
|
-
// ? "Sort descending"
|
|
73
|
-
// : "Clear sort",
|
|
74
|
-
// };
|
|
75
|
-
// }
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<th
|
|
79
|
-
onMouseLeave={handleClose}
|
|
80
|
-
key={header?.id}
|
|
81
|
-
className="ts__head__th"
|
|
82
|
-
colSpan={header.colSpan}
|
|
83
|
-
onClick={handleHover}
|
|
84
|
-
style={{
|
|
85
|
-
width: `${header.column.getSize()}px `,
|
|
86
|
-
minWidth: `${header.column.columnDef.minSize}px`,
|
|
87
|
-
maxWidth: `${header.column.columnDef.maxSize}px`,
|
|
88
|
-
...styles,
|
|
89
|
-
...getColumnPinningStyles(header.column),
|
|
90
|
-
zIndex: isPinned ? 3 : isDragging ? 1 : 0,
|
|
91
|
-
}}
|
|
92
|
-
>
|
|
93
|
-
{header.isPlaceholder ? null : (
|
|
94
|
-
<div {...sortProps}>
|
|
95
|
-
<div
|
|
96
|
-
className={`${
|
|
97
|
-
header.column.getCanSort() ? "ts__content__sort" : ""
|
|
98
|
-
}`.trim()}
|
|
99
|
-
// onClick={header.column.getToggleSortingHandler()}
|
|
100
|
-
>
|
|
101
|
-
{flexRender(header.column.columnDef.header, header.getContext())}
|
|
102
|
-
|
|
103
|
-
{{
|
|
104
|
-
asc: <UpArrow />,
|
|
105
|
-
desc: <DownArrow />,
|
|
106
|
-
}[header.column.getIsSorted() as "asc" | "desc"] ?? null}
|
|
107
|
-
</div>
|
|
108
|
-
|
|
109
|
-
{enableColumnPinning && (
|
|
110
|
-
<TableHeadPin
|
|
111
|
-
header={header}
|
|
112
|
-
featureOptions={featureOptions}
|
|
113
|
-
tableStates={tableStates}
|
|
114
|
-
filterSettingStates={filterSettingStates}
|
|
115
|
-
/>
|
|
116
|
-
)}
|
|
117
|
-
|
|
118
|
-
<div {...attributes} {...listeners} className="ts__dnd__button">
|
|
119
|
-
<DragHandleIcon />
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
)}
|
|
123
|
-
|
|
124
|
-
{/* column resizing */}
|
|
125
|
-
{header.column.getCanResize() ? (
|
|
126
|
-
<div
|
|
127
|
-
onDoubleClick={() => header.column.resetSize()}
|
|
128
|
-
onMouseDown={header.getResizeHandler()}
|
|
129
|
-
onTouchStart={header.getResizeHandler()}
|
|
130
|
-
className={`column__resize ${
|
|
131
|
-
header.column.getIsResizing() ? "is__resizing" : ""
|
|
132
|
-
}`}
|
|
133
|
-
/>
|
|
134
|
-
) : null}
|
|
135
|
-
|
|
136
|
-
{/* Popover */}
|
|
137
|
-
<TableHeadPopover
|
|
138
|
-
anchorEl={anchorEl}
|
|
139
|
-
activeTab={activeTab}
|
|
140
|
-
onClose={handleClose}
|
|
141
|
-
header={header}
|
|
142
|
-
tableStates={tableStates}
|
|
143
|
-
filterSettingStates={filterSettingStates}
|
|
144
|
-
onSaveSettings={onSaveSettings}
|
|
145
|
-
/>
|
|
146
|
-
</th>
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export default DraggableTableHeader;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { IconPinOffOutline } from "../../assets/svg";
|
|
2
|
-
import { TableHeaderProps } from "../types/table";
|
|
3
|
-
|
|
4
|
-
function TableHeadPin<T>({ header }: TableHeaderProps<T>) {
|
|
5
|
-
return header.column.getIsPinned() !== "left" ? (
|
|
6
|
-
<div className="ts--head--button" onClick={() => header.column.pin("left")}>
|
|
7
|
-
{/* <IconPinOutline /> */}
|
|
8
|
-
</div>
|
|
9
|
-
) : (
|
|
10
|
-
<div
|
|
11
|
-
className="ts--head--button"
|
|
12
|
-
onClick={(e) => {
|
|
13
|
-
e.stopPropagation();
|
|
14
|
-
header.column.pin(false);
|
|
15
|
-
}}
|
|
16
|
-
>
|
|
17
|
-
<IconPinOffOutline />
|
|
18
|
-
</div>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export default TableHeadPin;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
.table-tabs {
|
|
2
|
-
.tabs {
|
|
3
|
-
display: flex;
|
|
4
|
-
justify-content: flex-start;
|
|
5
|
-
align-items: center;
|
|
6
|
-
margin: 0rem;
|
|
7
|
-
padding: 0rem;
|
|
8
|
-
|
|
9
|
-
.tabs-settings {
|
|
10
|
-
margin-left: 0.1rem;
|
|
11
|
-
margin-right: 0.5rem;
|
|
12
|
-
cursor: pointer;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.tab {
|
|
16
|
-
display: flex;
|
|
17
|
-
gap: 0.5rem;
|
|
18
|
-
padding: 0.5rem 1rem;
|
|
19
|
-
cursor: pointer;
|
|
20
|
-
color: var(--grey-900);
|
|
21
|
-
font-size: 0.875rem;
|
|
22
|
-
font-family: "Satoshi";
|
|
23
|
-
font-weight: 700;
|
|
24
|
-
|
|
25
|
-
.tab__label {
|
|
26
|
-
font-family: inherit;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&.active {
|
|
30
|
-
background: var(--grey-500);
|
|
31
|
-
border-top-left-radius: 0.5rem;
|
|
32
|
-
border-top-right-radius: 0.5rem;
|
|
33
|
-
backdrop-filter: blur(200px);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.tabs-dropdown {
|
|
38
|
-
margin-left: 1rem;
|
|
39
|
-
cursor: pointer;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { SxProps, Theme } from "@mui/material";
|
|
2
|
-
|
|
3
|
-
interface TabStylesProps {
|
|
4
|
-
tabs: SxProps<Theme>;
|
|
5
|
-
tab: SxProps<Theme>;
|
|
6
|
-
tabCount: SxProps<Theme>;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const tableTabsStyles: TabStylesProps = {
|
|
10
|
-
tabs: {
|
|
11
|
-
minHeight: "38px",
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
tab: {
|
|
15
|
-
color: "#888888",
|
|
16
|
-
padding: "8px 12px",
|
|
17
|
-
minHeight: "38px",
|
|
18
|
-
textTransform: "none",
|
|
19
|
-
minWidth: "unset",
|
|
20
|
-
whiteSpace: "nowrap",
|
|
21
|
-
|
|
22
|
-
"&.Mui-selected": {
|
|
23
|
-
color: "#0e0c0b",
|
|
24
|
-
fontWeight: 700,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
tabCount: {
|
|
29
|
-
padding: "2px 3px",
|
|
30
|
-
borderRadius: "6px",
|
|
31
|
-
border: "1px solid #0E0C0BE6",
|
|
32
|
-
color: "#0E0C0B",
|
|
33
|
-
},
|
|
34
|
-
};
|