rez-table-listing-mui 0.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/.eslintrc.cjs +18 -0
- package/README.md +164 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/index.html +13 -0
- package/package.json +64 -0
- package/public/vite.svg +1 -0
- package/rollup.config.js +42 -0
- package/src/App.tsx +153 -0
- package/src/assets/svg.tsx +833 -0
- package/src/components/columm-visibility-modal/column-list-item.tsx +44 -0
- package/src/components/columm-visibility-modal/index.scss +72 -0
- package/src/components/columm-visibility-modal/index.tsx +175 -0
- package/src/components/common/index.scss +11 -0
- package/src/components/common/index.tsx +11 -0
- package/src/components/dropdown/index.scss +17 -0
- package/src/components/dropdown/index.tsx +27 -0
- package/src/components/index-table.tsx +266 -0
- package/src/components/index.scss +176 -0
- package/src/components/inputs/checkbox/index.tsx +58 -0
- package/src/components/inputs/index.scss +63 -0
- package/src/components/inputs/switch.tsx +14 -0
- package/src/components/nestedcomponent/index.scss +14 -0
- package/src/components/nestedcomponent/index.tsx +53 -0
- package/src/components/pagination/default/index.scss +76 -0
- package/src/components/pagination/default/index.tsx +168 -0
- package/src/components/sorting-modal.tsx/index.tsx +200 -0
- package/src/components/sorting-modal.tsx/sorting-item.tsx +35 -0
- package/src/components/table-body-dnd-cell.tsx +50 -0
- package/src/components/table-body.tsx +109 -0
- package/src/components/table-change-layout.tsx +106 -0
- package/src/components/table-dnd.tsx +62 -0
- package/src/components/table-head-dnd-cell.tsx +144 -0
- package/src/components/table-head-pin.tsx +16 -0
- package/src/components/table-head-popover.tsx +85 -0
- package/src/components/table-head.tsx +156 -0
- package/src/components/table.tsx +38 -0
- package/src/components/tabs/index.scss +41 -0
- package/src/components/tabs/index.tsx +132 -0
- package/src/components/topbar/index.scss +84 -0
- package/src/components/topbar/index.tsx +226 -0
- package/src/components/viewmore/index.scss +0 -0
- package/src/components/viewmore/index.tsx +171 -0
- package/src/index.ts +4 -0
- package/src/libs/hooks/useCraftTable.tsx +37 -0
- package/src/libs/hooks/useDefaultColumns.tsx +96 -0
- package/src/libs/hooks/useFullScreen.tsx +25 -0
- package/src/libs/hooks/useOutsideClick.tsx +24 -0
- package/src/libs/utils/Data-format.ts +18 -0
- package/src/libs/utils/amount-format.ts +70 -0
- package/src/libs/utils/common.ts +62 -0
- package/src/libs/utils/date-format.ts +6 -0
- package/src/libs/utils/make-data.ts +79 -0
- package/src/libs/utils/make-hierar-data.ts +51 -0
- package/src/libs/utils/make-nested-data.ts +86 -0
- package/src/libs/utils/rows-data.ts +251 -0
- package/src/main.tsx +9 -0
- package/src/types/common.ts +30 -0
- package/src/types/table-options.ts +38 -0
- package/src/types/table.ts +65 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.json +25 -0
- package/tsconfig.node.json +11 -0
- package/vite.config.ts +7 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
.ts__table__container {
|
|
2
|
+
--black: #000;
|
|
3
|
+
--white: #fff;
|
|
4
|
+
--grey-100: #fafafa;
|
|
5
|
+
--grey-200: #f4f4f4;
|
|
6
|
+
--grey-300: #edeeef;
|
|
7
|
+
--grey-500: #dcddde;
|
|
8
|
+
--grey-600: #bbbbbd;
|
|
9
|
+
--grey-700: #77787b;
|
|
10
|
+
--grey-900: #414042;
|
|
11
|
+
|
|
12
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
|
13
|
+
Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
|
|
14
|
+
|
|
15
|
+
// set default styles for all elements
|
|
16
|
+
& * {
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.ts__loader {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
align-items: center;
|
|
25
|
+
gap: 1rem;
|
|
26
|
+
color: var(--grey-900);
|
|
27
|
+
font-size: 1.2rem;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.ts__table__wrapper {
|
|
31
|
+
overflow-x: auto;
|
|
32
|
+
max-height: calc(100vh - 106px);
|
|
33
|
+
|
|
34
|
+
.ts__table.ts--striped > .ts__body > .ts__body__tr:nth-of-type(odd) {
|
|
35
|
+
background-color: var(--grey-200);
|
|
36
|
+
}
|
|
37
|
+
.ts__table:not(.ts--striped) > .ts__body > .ts__body__tr:hover {
|
|
38
|
+
background-color: var(--grey-100);
|
|
39
|
+
box-shadow: inset 0 2px 2px rgba(0, 0, 0, 0.05),
|
|
40
|
+
inset 0 -2px 2px rgba(0, 0, 0, 0.05);
|
|
41
|
+
}
|
|
42
|
+
.ts__table:not(.ts--striped) > .ts__head > .ts__head__tr {
|
|
43
|
+
background-color: var(--grey-100);
|
|
44
|
+
|
|
45
|
+
.ts__head__th {
|
|
46
|
+
border: 1px solid var(--grey-500);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ts__table.ts--compact {
|
|
51
|
+
.ts__head > .ts__head__tr > .ts__head__th {
|
|
52
|
+
padding: 0.25rem 0.5rem;
|
|
53
|
+
|
|
54
|
+
.ts__content {
|
|
55
|
+
font-size: 0.875rem;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.ts__body > .ts__body__tr > .ts__body__td {
|
|
60
|
+
padding: 0.25rem 0.5rem;
|
|
61
|
+
|
|
62
|
+
.ts__content {
|
|
63
|
+
font-size: 0.75rem;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.ts__table {
|
|
69
|
+
width: max-content;
|
|
70
|
+
min-width: 100%;
|
|
71
|
+
border-spacing: 0;
|
|
72
|
+
border-collapse: separate;
|
|
73
|
+
|
|
74
|
+
.ts__head.ts--sticky {
|
|
75
|
+
position: sticky;
|
|
76
|
+
top: 0rem;
|
|
77
|
+
z-index: 3;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.ts__head {
|
|
81
|
+
position: relative;
|
|
82
|
+
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.05);
|
|
83
|
+
|
|
84
|
+
.ts__head__tr {
|
|
85
|
+
background-color: var(--white);
|
|
86
|
+
|
|
87
|
+
.ts__head__th {
|
|
88
|
+
position: relative;
|
|
89
|
+
padding: 0.5rem 1rem;
|
|
90
|
+
border: 1px solid var(--grey-300);
|
|
91
|
+
|
|
92
|
+
.ts__dnd__button {
|
|
93
|
+
color: var(--grey-100);
|
|
94
|
+
// width: max-content;
|
|
95
|
+
// height: max-content;
|
|
96
|
+
// cursor: grabbing;
|
|
97
|
+
|
|
98
|
+
&:hover {
|
|
99
|
+
scale: 1.1;
|
|
100
|
+
color: var(--grey-900);
|
|
101
|
+
width: max-content;
|
|
102
|
+
height: max-content;
|
|
103
|
+
cursor: grabbing;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.ts__content {
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: center;
|
|
110
|
+
gap: 0.25rem;
|
|
111
|
+
|
|
112
|
+
.ts__content__sort {
|
|
113
|
+
cursor: pointer;
|
|
114
|
+
user-select: none;
|
|
115
|
+
|
|
116
|
+
svg {
|
|
117
|
+
margin-left: 0.25rem;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.ts--head--button {
|
|
122
|
+
display: flex;
|
|
123
|
+
justify-content: center;
|
|
124
|
+
align-items: center;
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
|
|
127
|
+
&:hover {
|
|
128
|
+
scale: 1.1;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
svg {
|
|
132
|
+
color: var(--grey-700);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.column__resize {
|
|
138
|
+
position: absolute;
|
|
139
|
+
top: 0;
|
|
140
|
+
right: 0;
|
|
141
|
+
height: 100%;
|
|
142
|
+
width: 5px;
|
|
143
|
+
background: rgba(0, 0, 0, 0.5);
|
|
144
|
+
cursor: col-resize;
|
|
145
|
+
user-select: none;
|
|
146
|
+
touch-action: none;
|
|
147
|
+
opacity: 0;
|
|
148
|
+
|
|
149
|
+
&:hover {
|
|
150
|
+
opacity: 1;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.column__resize.is__resizing {
|
|
155
|
+
background: rgba(0, 0, 0, 0.8);
|
|
156
|
+
opacity: 1;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.ts__body {
|
|
163
|
+
.ts__body__tr {
|
|
164
|
+
background-color: var(--white);
|
|
165
|
+
|
|
166
|
+
.ts__body__td {
|
|
167
|
+
font-size: 0.875rem;
|
|
168
|
+
padding: 0.5rem 1rem;
|
|
169
|
+
border-top: 1px solid var(--grey-300);
|
|
170
|
+
border-bottom: 1px solid var(--grey-300);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import { v4 as uuidv4 } from "uuid";
|
|
3
|
+
|
|
4
|
+
interface CheckboxProps {
|
|
5
|
+
type?: "checkbox";
|
|
6
|
+
checked: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
onChange: (checked: boolean) => void;
|
|
9
|
+
indeterminate?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const Checkbox = ({
|
|
15
|
+
checked = false,
|
|
16
|
+
disabled = false,
|
|
17
|
+
onChange = () => {},
|
|
18
|
+
indeterminate = false,
|
|
19
|
+
className,
|
|
20
|
+
style,
|
|
21
|
+
...props
|
|
22
|
+
}: CheckboxProps) => {
|
|
23
|
+
const id = uuidv4();
|
|
24
|
+
const [check, setCheck] = React.useState<boolean>(checked);
|
|
25
|
+
const ref = useRef(null);
|
|
26
|
+
|
|
27
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
28
|
+
const isChecked = e.target.checked;
|
|
29
|
+
setCheck(isChecked);
|
|
30
|
+
|
|
31
|
+
if (onChange) onChange(isChecked);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
setCheck(checked);
|
|
36
|
+
}, [checked]);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (ref.current) {
|
|
40
|
+
(ref.current as HTMLInputElement).indeterminate = indeterminate;
|
|
41
|
+
}
|
|
42
|
+
}, [indeterminate]);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<input
|
|
46
|
+
id={id}
|
|
47
|
+
ref={ref}
|
|
48
|
+
type="checkbox"
|
|
49
|
+
checked={check}
|
|
50
|
+
onChange={handleChange}
|
|
51
|
+
disabled={disabled}
|
|
52
|
+
className={className}
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default Checkbox;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
.ts__table__container {
|
|
2
|
+
.input-switch {
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-block;
|
|
5
|
+
width: 2rem;
|
|
6
|
+
height: 1rem;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* Hide default HTML checkbox */
|
|
10
|
+
.input-switch input {
|
|
11
|
+
opacity: 0;
|
|
12
|
+
width: 0;
|
|
13
|
+
height: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* The slider */
|
|
17
|
+
.slider {
|
|
18
|
+
position: absolute;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
top: 0;
|
|
21
|
+
left: 0;
|
|
22
|
+
right: 0;
|
|
23
|
+
bottom: 0;
|
|
24
|
+
background-color: #ccc;
|
|
25
|
+
-webkit-transition: 0.4s;
|
|
26
|
+
transition: 0.4s;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.slider:before {
|
|
30
|
+
position: absolute;
|
|
31
|
+
content: "";
|
|
32
|
+
height: 0.8rem;
|
|
33
|
+
width: 0.8rem;
|
|
34
|
+
left: 2px;
|
|
35
|
+
bottom: 2px;
|
|
36
|
+
background-color: white;
|
|
37
|
+
-webkit-transition: 0.4s;
|
|
38
|
+
transition: 0.4s;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
input:checked + .slider {
|
|
42
|
+
background-color: #c7222a;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
input:focus + .slider {
|
|
46
|
+
box-shadow: 0 0 1px #2196f3;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
input:checked + .slider:before {
|
|
50
|
+
-webkit-transform: translateX(0.9rem);
|
|
51
|
+
-ms-transform: translateX(0.9rem);
|
|
52
|
+
transform: translateX(0.9rem);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Rounded sliders */
|
|
56
|
+
.slider.round {
|
|
57
|
+
border-radius: 34px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.slider.round:before {
|
|
61
|
+
border-radius: 50%;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "./index.scss";
|
|
2
|
+
|
|
3
|
+
interface SwitchProps extends React.InputHTMLAttributes<HTMLInputElement> {}
|
|
4
|
+
|
|
5
|
+
const Switch = ({ ...props }: SwitchProps) => {
|
|
6
|
+
return (
|
|
7
|
+
<label className="input-switch">
|
|
8
|
+
<input type="checkbox" {...props} />
|
|
9
|
+
<span className="slider round"></span>
|
|
10
|
+
</label>
|
|
11
|
+
);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default Switch;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// import { Row } from "@tanstack/react-table";
|
|
2
|
+
// import "./index.scss";
|
|
3
|
+
|
|
4
|
+
// export function NestedComponent({ row }: { row: Row<defaultColumnsProps1> }) {
|
|
5
|
+
// const data = {
|
|
6
|
+
// col1: [
|
|
7
|
+
// {
|
|
8
|
+
// header: "Location Name",
|
|
9
|
+
// value: row?.original?.location?.name,
|
|
10
|
+
// },
|
|
11
|
+
// {
|
|
12
|
+
// header: "Location URL",
|
|
13
|
+
// value: row?.original?.location?.url,
|
|
14
|
+
// },
|
|
15
|
+
// {
|
|
16
|
+
// header: "Origin Name",
|
|
17
|
+
// value: row?.original?.origin?.name,
|
|
18
|
+
// },
|
|
19
|
+
// {
|
|
20
|
+
// header: "Origin URL",
|
|
21
|
+
// value: row?.original?.origin?.url,
|
|
22
|
+
// },
|
|
23
|
+
// ],
|
|
24
|
+
// col2: [
|
|
25
|
+
// {
|
|
26
|
+
// header: "Created Date",
|
|
27
|
+
// value: row?.original?.created,
|
|
28
|
+
// },
|
|
29
|
+
// ],
|
|
30
|
+
// };
|
|
31
|
+
|
|
32
|
+
// return (
|
|
33
|
+
// <div className="nested-component">
|
|
34
|
+
// <div className="row-items">
|
|
35
|
+
// {data?.col1.map((item) => (
|
|
36
|
+
// <div>
|
|
37
|
+
// <p className="row-items-header">{item?.header}</p>
|
|
38
|
+
// <p>{item?.value}</p>
|
|
39
|
+
// </div>
|
|
40
|
+
// ))}
|
|
41
|
+
// </div>
|
|
42
|
+
|
|
43
|
+
// <div className="row-items">
|
|
44
|
+
// {data?.col2.map((item) => (
|
|
45
|
+
// <div>
|
|
46
|
+
// <p className="row-items-header">{item?.header}</p>
|
|
47
|
+
// <p>{item?.value}</p>
|
|
48
|
+
// </div>
|
|
49
|
+
// ))}
|
|
50
|
+
// </div>
|
|
51
|
+
// </div>
|
|
52
|
+
// );
|
|
53
|
+
// }
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
.pagination_container {
|
|
2
|
+
--grey-300: #edeeef;
|
|
3
|
+
|
|
4
|
+
// box-shadow: 0 -2px 2px rgba(0, 0, 0, 0.05);
|
|
5
|
+
padding: 8px;
|
|
6
|
+
display: flex;
|
|
7
|
+
justify-content: flex-end;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: 1.5rem;
|
|
10
|
+
font-size: 0.875rem;
|
|
11
|
+
// border-top: 1px solid var(--grey-300);
|
|
12
|
+
background-color: #fff;
|
|
13
|
+
margin-bottom: 0.5rem;
|
|
14
|
+
|
|
15
|
+
@media screen and (max-width: 991px) {
|
|
16
|
+
justify-content: center;
|
|
17
|
+
font-size: 0.75rem;
|
|
18
|
+
|
|
19
|
+
.go_to_page_container {
|
|
20
|
+
display: none;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
@media screen and (max-width: 768px) {
|
|
24
|
+
gap: 1rem;
|
|
25
|
+
|
|
26
|
+
.records_range_container,
|
|
27
|
+
.rows_per_page_container {
|
|
28
|
+
display: none;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.pagination_btn_container {
|
|
33
|
+
display: flex;
|
|
34
|
+
gap: 0.5rem;
|
|
35
|
+
|
|
36
|
+
.pagination_btn {
|
|
37
|
+
position: relative;
|
|
38
|
+
user-select: none;
|
|
39
|
+
border: none;
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
height: 2rem;
|
|
42
|
+
width: 2rem;
|
|
43
|
+
padding: 4px;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
transition: 0.4s;
|
|
46
|
+
background-color: transparent;
|
|
47
|
+
|
|
48
|
+
@media screen and (max-width: 768px) {
|
|
49
|
+
height: 1.5rem;
|
|
50
|
+
width: 1.5rem;
|
|
51
|
+
padding: 0rem;
|
|
52
|
+
|
|
53
|
+
svg {
|
|
54
|
+
width: 1.25rem;
|
|
55
|
+
height: 1.25rem;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:disabled {
|
|
60
|
+
cursor: unset;
|
|
61
|
+
fill: rgba(0, 0, 0, 0.18);
|
|
62
|
+
}
|
|
63
|
+
&:not(:disabled) {
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
}
|
|
66
|
+
&:focus {
|
|
67
|
+
outline: none;
|
|
68
|
+
}
|
|
69
|
+
&:hover:not(:disabled) {
|
|
70
|
+
background-color: var(--grey-300);
|
|
71
|
+
box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.6),
|
|
72
|
+
0 1px 3px 1px rgba(60, 64, 67, 0.3);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { Table } from "@tanstack/react-table";
|
|
2
|
+
import {
|
|
3
|
+
TableFirstPageIcon,
|
|
4
|
+
TableLastPageIcon,
|
|
5
|
+
TableNextPageIcon,
|
|
6
|
+
TablePreviousPageIcon,
|
|
7
|
+
} from "../../../assets/svg";
|
|
8
|
+
import "./index.scss";
|
|
9
|
+
import { CraftTablePaginationProps } from "../../../types/table";
|
|
10
|
+
|
|
11
|
+
interface DefaultPaginationProps<T> {
|
|
12
|
+
table: Table<T>;
|
|
13
|
+
rowsPerPageArray: number[];
|
|
14
|
+
paginationOptions?: CraftTablePaginationProps;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function DefaultPagination<T>({
|
|
18
|
+
table,
|
|
19
|
+
rowsPerPageArray,
|
|
20
|
+
paginationOptions,
|
|
21
|
+
}: DefaultPaginationProps<T>) {
|
|
22
|
+
const pageIndex = table.getState().pagination.pageIndex + 1;
|
|
23
|
+
const pageCount = table.getPageCount();
|
|
24
|
+
const pageSize = table.getState().pagination.pageSize;
|
|
25
|
+
const rowCount = table.getRowCount();
|
|
26
|
+
const recordsRangeFirst = pageIndex * pageSize - pageSize + 1;
|
|
27
|
+
const recordsRangeLast = Math.min(pageIndex * pageSize, rowCount);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div className="pagination_container">
|
|
31
|
+
{paginationOptions?.paginationView === "full" ? (
|
|
32
|
+
<>
|
|
33
|
+
<span className="go_to_page_container">
|
|
34
|
+
Go to page :
|
|
35
|
+
<input
|
|
36
|
+
type="number"
|
|
37
|
+
defaultValue={pageIndex}
|
|
38
|
+
onKeyDown={(e) => {
|
|
39
|
+
if (e.key === "Enter") {
|
|
40
|
+
const page = e.currentTarget.value
|
|
41
|
+
? Number(e.currentTarget.value) - 1
|
|
42
|
+
: 0;
|
|
43
|
+
table.setPageIndex(page);
|
|
44
|
+
}
|
|
45
|
+
}}
|
|
46
|
+
style={{ width: "60px", textAlign: "center" }}
|
|
47
|
+
min={1}
|
|
48
|
+
max={table?.getPageCount()}
|
|
49
|
+
/>
|
|
50
|
+
|
|
51
|
+
</span>
|
|
52
|
+
|
|
53
|
+
<div className="rows_per_page_container">
|
|
54
|
+
<span>Rows Per Page : </span>
|
|
55
|
+
<select
|
|
56
|
+
value={table.getState().pagination.pageSize}
|
|
57
|
+
onChange={(e) => {
|
|
58
|
+
table.setPageSize(Number(e.target.value));
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
{rowsPerPageArray.map((pageSize) => (
|
|
62
|
+
<option key={pageSize} value={pageSize}>
|
|
63
|
+
{pageSize}
|
|
64
|
+
</option>
|
|
65
|
+
))}
|
|
66
|
+
</select>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<div className="records_range_container">
|
|
70
|
+
<span>Showing </span>
|
|
71
|
+
<strong>
|
|
72
|
+
{recordsRangeFirst} - {recordsRangeLast} of {rowCount}
|
|
73
|
+
</strong>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<span className="page_range_container">
|
|
77
|
+
<span> Page </span>
|
|
78
|
+
<strong>
|
|
79
|
+
{pageIndex} of {pageCount}
|
|
80
|
+
|
|
81
|
+
</strong>
|
|
82
|
+
</span>
|
|
83
|
+
|
|
84
|
+
<div className="pagination_btn_container">
|
|
85
|
+
<button
|
|
86
|
+
title="First Page"
|
|
87
|
+
className="pagination_btn"
|
|
88
|
+
disabled={!table.getCanPreviousPage()}
|
|
89
|
+
onClick={() => table.setPageIndex(0)}
|
|
90
|
+
>
|
|
91
|
+
<TableFirstPageIcon />
|
|
92
|
+
</button>
|
|
93
|
+
<button
|
|
94
|
+
title="Previous Page"
|
|
95
|
+
className="pagination_btn"
|
|
96
|
+
disabled={!table.getCanPreviousPage()}
|
|
97
|
+
onClick={() => table.previousPage()}
|
|
98
|
+
>
|
|
99
|
+
<TablePreviousPageIcon />
|
|
100
|
+
</button>
|
|
101
|
+
<button
|
|
102
|
+
title="Next Page"
|
|
103
|
+
className="pagination_btn"
|
|
104
|
+
disabled={!table.getCanNextPage()}
|
|
105
|
+
onClick={() => table.nextPage()}
|
|
106
|
+
>
|
|
107
|
+
<TableNextPageIcon />
|
|
108
|
+
</button>
|
|
109
|
+
<button
|
|
110
|
+
title="Last Page"
|
|
111
|
+
className="pagination_btn"
|
|
112
|
+
disabled={!table.getCanNextPage()}
|
|
113
|
+
onClick={() => table.setPageIndex(pageCount - 1)}
|
|
114
|
+
>
|
|
115
|
+
<TableLastPageIcon />
|
|
116
|
+
</button>
|
|
117
|
+
</div>
|
|
118
|
+
</>
|
|
119
|
+
) : (
|
|
120
|
+
<>
|
|
121
|
+
<div className="rows_per_page_container">
|
|
122
|
+
{/* <span>Rows Per Page : </span> */}
|
|
123
|
+
<select
|
|
124
|
+
value={table.getState().pagination.pageSize}
|
|
125
|
+
onChange={(e) => {
|
|
126
|
+
table.setPageSize(Number(e.target.value));
|
|
127
|
+
}}
|
|
128
|
+
>
|
|
129
|
+
{rowsPerPageArray.map((pageSize) => (
|
|
130
|
+
<option key={pageSize} value={pageSize}>
|
|
131
|
+
{pageSize}
|
|
132
|
+
</option>
|
|
133
|
+
))}
|
|
134
|
+
</select>
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<div className="records_range_container">
|
|
138
|
+
{/* <span>Showing </span> */}
|
|
139
|
+
<strong>
|
|
140
|
+
{recordsRangeFirst} - {recordsRangeLast} of {rowCount}
|
|
141
|
+
</strong>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<div className="pagination_btn_container">
|
|
145
|
+
<button
|
|
146
|
+
title="Previous Page"
|
|
147
|
+
className="pagination_btn"
|
|
148
|
+
disabled={!table.getCanPreviousPage()}
|
|
149
|
+
onClick={() => table.previousPage()}
|
|
150
|
+
>
|
|
151
|
+
<TablePreviousPageIcon />
|
|
152
|
+
</button>
|
|
153
|
+
<button
|
|
154
|
+
title="Next Page"
|
|
155
|
+
className="pagination_btn"
|
|
156
|
+
disabled={!table.getCanNextPage()}
|
|
157
|
+
onClick={() => table.nextPage()}
|
|
158
|
+
>
|
|
159
|
+
<TableNextPageIcon />
|
|
160
|
+
</button>
|
|
161
|
+
</div>
|
|
162
|
+
</>
|
|
163
|
+
)}
|
|
164
|
+
</div>
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export default DefaultPagination;
|