@mkt-loitd/react-table-grid-custom 1.2.3 → 1.2.5
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.css +0 -97
- package/dist/index.d.mts +8 -154
- package/dist/index.d.ts +8 -154
- package/dist/index.js +1 -258
- package/dist/index.mjs +1 -257
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -55,100 +55,3 @@ div[aria-sort] > span {
|
|
|
55
55
|
position: sticky !important;
|
|
56
56
|
right: 0 !important;
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
/* src/component/ui/ContextMenu/ContextMenu.css */
|
|
60
|
-
.shadow-menu {
|
|
61
|
-
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
|
|
62
|
-
animation: open 0.3s;
|
|
63
|
-
transform-origin: top left;
|
|
64
|
-
}
|
|
65
|
-
.shadow-submenu {
|
|
66
|
-
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
|
|
67
|
-
}
|
|
68
|
-
@keyframes open {
|
|
69
|
-
from {
|
|
70
|
-
transform: scale(0);
|
|
71
|
-
}
|
|
72
|
-
to {
|
|
73
|
-
transform: scale(1);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/* node_modules/tippy.js/dist/tippy.css */
|
|
78
|
-
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
79
|
-
opacity: 0;
|
|
80
|
-
}
|
|
81
|
-
[data-tippy-root] {
|
|
82
|
-
max-width: calc(100vw - 10px);
|
|
83
|
-
}
|
|
84
|
-
.tippy-box {
|
|
85
|
-
position: relative;
|
|
86
|
-
background-color: #333;
|
|
87
|
-
color: #fff;
|
|
88
|
-
border-radius: 4px;
|
|
89
|
-
font-size: 14px;
|
|
90
|
-
line-height: 1.4;
|
|
91
|
-
white-space: normal;
|
|
92
|
-
outline: 0;
|
|
93
|
-
transition-property:
|
|
94
|
-
transform,
|
|
95
|
-
visibility,
|
|
96
|
-
opacity;
|
|
97
|
-
}
|
|
98
|
-
.tippy-box[data-placement^=top] > .tippy-arrow {
|
|
99
|
-
bottom: 0;
|
|
100
|
-
}
|
|
101
|
-
.tippy-box[data-placement^=top] > .tippy-arrow:before {
|
|
102
|
-
bottom: -7px;
|
|
103
|
-
left: 0;
|
|
104
|
-
border-width: 8px 8px 0;
|
|
105
|
-
border-top-color: initial;
|
|
106
|
-
transform-origin: center top;
|
|
107
|
-
}
|
|
108
|
-
.tippy-box[data-placement^=bottom] > .tippy-arrow {
|
|
109
|
-
top: 0;
|
|
110
|
-
}
|
|
111
|
-
.tippy-box[data-placement^=bottom] > .tippy-arrow:before {
|
|
112
|
-
top: -7px;
|
|
113
|
-
left: 0;
|
|
114
|
-
border-width: 0 8px 8px;
|
|
115
|
-
border-bottom-color: initial;
|
|
116
|
-
transform-origin: center bottom;
|
|
117
|
-
}
|
|
118
|
-
.tippy-box[data-placement^=left] > .tippy-arrow {
|
|
119
|
-
right: 0;
|
|
120
|
-
}
|
|
121
|
-
.tippy-box[data-placement^=left] > .tippy-arrow:before {
|
|
122
|
-
border-width: 8px 0 8px 8px;
|
|
123
|
-
border-left-color: initial;
|
|
124
|
-
right: -7px;
|
|
125
|
-
transform-origin: center left;
|
|
126
|
-
}
|
|
127
|
-
.tippy-box[data-placement^=right] > .tippy-arrow {
|
|
128
|
-
left: 0;
|
|
129
|
-
}
|
|
130
|
-
.tippy-box[data-placement^=right] > .tippy-arrow:before {
|
|
131
|
-
left: -7px;
|
|
132
|
-
border-width: 8px 8px 8px 0;
|
|
133
|
-
border-right-color: initial;
|
|
134
|
-
transform-origin: center right;
|
|
135
|
-
}
|
|
136
|
-
.tippy-box[data-inertia][data-state=visible] {
|
|
137
|
-
transition-timing-function: cubic-bezier(.54, 1.5, .38, 1.11);
|
|
138
|
-
}
|
|
139
|
-
.tippy-arrow {
|
|
140
|
-
width: 16px;
|
|
141
|
-
height: 16px;
|
|
142
|
-
color: #333;
|
|
143
|
-
}
|
|
144
|
-
.tippy-arrow:before {
|
|
145
|
-
content: "";
|
|
146
|
-
position: absolute;
|
|
147
|
-
border-color: transparent;
|
|
148
|
-
border-style: solid;
|
|
149
|
-
}
|
|
150
|
-
.tippy-content {
|
|
151
|
-
position: relative;
|
|
152
|
-
padding: 5px 9px;
|
|
153
|
-
z-index: 1;
|
|
154
|
-
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
1
|
import { Dispatch, SetStateAction, Key, ReactNode, JSX, MutableRefObject } from 'react';
|
|
3
2
|
import { ColumnOrColumnGroup, DataGridProps } from 'react-data-grid';
|
|
4
3
|
export { Column, ColumnOrColumnGroup, DataGridProps } from 'react-data-grid';
|
|
5
4
|
import { PaginationRootProps } from '@mantine/core';
|
|
6
|
-
import { TFunction } from 'i18next';
|
|
7
|
-
import { UseMutateFunction } from '@tanstack/react-query';
|
|
8
5
|
|
|
9
6
|
type TColumnsTable<T = unknown, SR = unknown> = readonly ColumnOrColumnGroup<NoInfer<T>, NoInfer<SR>>[];
|
|
10
7
|
interface IPaginationParams$1 {
|
|
@@ -14,7 +11,7 @@ interface IPaginationParams$1 {
|
|
|
14
11
|
interface IObjectDynamic {
|
|
15
12
|
[key: string]: any;
|
|
16
13
|
}
|
|
17
|
-
interface ISetConfigPagination
|
|
14
|
+
interface ISetConfigPagination extends IPaginationParams$1, IObjectDynamic {
|
|
18
15
|
}
|
|
19
16
|
interface useShowHideColumnParameter<T, SR = unknown> {
|
|
20
17
|
nameLocal?: string;
|
|
@@ -32,6 +29,9 @@ interface useShowHideColumnReturn<T, SR> {
|
|
|
32
29
|
handleFindLocation: (filterColumns: TColumnsTable<T, SR>, locationColumns?: string[]) => TColumnsTable<T, SR>;
|
|
33
30
|
handleChangeLocation?: (arr: string[]) => void;
|
|
34
31
|
}
|
|
32
|
+
interface ICalculatorTotalPage extends IPaginationParams$1 {
|
|
33
|
+
total?: number;
|
|
34
|
+
}
|
|
35
35
|
|
|
36
36
|
declare const useShowHideColumn: <T, SR = unknown>({ nameLocal, columns, ignoreColumns }: useShowHideColumnParameter<T, SR>) => useShowHideColumnReturn<T, SR>;
|
|
37
37
|
|
|
@@ -49,7 +49,7 @@ interface IReactTableGridCustom<T = unknown, SR = unknown, K extends Key = Key>
|
|
|
49
49
|
data?: T[];
|
|
50
50
|
/** Nếu hàm onChange nên dùng useCallback */
|
|
51
51
|
onChange?: Pick<PaginationRootProps, 'onChange'>['onChange'];
|
|
52
|
-
setConfigPagination?: Dispatch<SetStateAction<ISetConfigPagination
|
|
52
|
+
setConfigPagination?: Dispatch<SetStateAction<ISetConfigPagination>>;
|
|
53
53
|
/** Nếu hàm rowKeyGetter nên dùng useCallback*/
|
|
54
54
|
rowKeyGetter?: string | Maybe<(row: NoInfer<T>) => K>;
|
|
55
55
|
hiddenPaginationText?: boolean;
|
|
@@ -58,9 +58,10 @@ interface IReactTableGridCustom<T = unknown, SR = unknown, K extends Key = Key>
|
|
|
58
58
|
listPageSize?: string[];
|
|
59
59
|
fetching?: boolean;
|
|
60
60
|
TableLogo?: string;
|
|
61
|
+
[key: string]: any;
|
|
61
62
|
}
|
|
62
63
|
interface refTablePaginationClient extends Required<IPaginationParams> {
|
|
63
|
-
setConfigSearch: Dispatch<SetStateAction<ISetConfigPagination
|
|
64
|
+
setConfigSearch: Dispatch<SetStateAction<ISetConfigPagination>>;
|
|
64
65
|
resetPagition: (conditional?: boolean) => void;
|
|
65
66
|
}
|
|
66
67
|
|
|
@@ -75,157 +76,10 @@ interface ReactTableGridCustomPaginationClientProps<T = unknown, SR = unknown, K
|
|
|
75
76
|
}
|
|
76
77
|
declare const ReactTableGridCustomPaginationClient: ReactTableGridCustomPaginationClientComponent;
|
|
77
78
|
|
|
78
|
-
interface ContextMenuProps {
|
|
79
|
-
selector: string;
|
|
80
|
-
children?: ReactNode;
|
|
81
|
-
zIndex?: number;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
interface IMainResponse<T = any> {
|
|
85
|
-
success?: boolean;
|
|
86
|
-
status?: 'success' | 'error' | 'warning';
|
|
87
|
-
data?: T;
|
|
88
|
-
payload?: {
|
|
89
|
-
data?: T;
|
|
90
|
-
[key: string]: any;
|
|
91
|
-
};
|
|
92
|
-
message?: {
|
|
93
|
-
key: string;
|
|
94
|
-
[key: string]: any;
|
|
95
|
-
};
|
|
96
|
-
error?: any;
|
|
97
|
-
}
|
|
98
|
-
interface IFieldUpdateAndCheck<T = any, F = any, V = any> {
|
|
99
|
-
id?: string | number;
|
|
100
|
-
field?: F;
|
|
101
|
-
value?: V;
|
|
102
|
-
data?: T;
|
|
103
|
-
[key: string]: any;
|
|
104
|
-
}
|
|
105
|
-
interface Account {
|
|
106
|
-
id?: string | number;
|
|
107
|
-
username?: string;
|
|
108
|
-
password?: string;
|
|
109
|
-
email?: string;
|
|
110
|
-
status?: string;
|
|
111
|
-
[key: string]: any;
|
|
112
|
-
}
|
|
113
|
-
interface Post {
|
|
114
|
-
id?: string | number;
|
|
115
|
-
title?: string;
|
|
116
|
-
content?: string;
|
|
117
|
-
createdAt?: number;
|
|
118
|
-
[key: string]: any;
|
|
119
|
-
}
|
|
120
|
-
interface AppSettings {
|
|
121
|
-
[key: string]: any;
|
|
122
|
-
}
|
|
123
|
-
interface ISetConfigPagination {
|
|
124
|
-
page?: number;
|
|
125
|
-
limit?: number;
|
|
126
|
-
total?: number;
|
|
127
|
-
[key: string]: any;
|
|
128
|
-
}
|
|
129
|
-
type ITaskName = string;
|
|
130
|
-
|
|
131
|
-
interface IActionUiUtilBy {
|
|
132
|
-
action?: string;
|
|
133
|
-
[key: string]: any;
|
|
134
|
-
}
|
|
135
|
-
interface IPayloadStartAction {
|
|
136
|
-
action?: string;
|
|
137
|
-
[key: string]: any;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
interface Proxy {
|
|
141
|
-
id?: string;
|
|
142
|
-
host?: string;
|
|
143
|
-
port?: number;
|
|
144
|
-
username?: string;
|
|
145
|
-
password?: string;
|
|
146
|
-
protocol?: string;
|
|
147
|
-
provider?: string;
|
|
148
|
-
[key: string]: any;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
interface IPayloadRemoveProxy {
|
|
152
|
-
ids: string[];
|
|
153
|
-
}
|
|
154
|
-
interface IPayloadService {
|
|
155
|
-
updateByClipboard?: UseMutateFunction<IMainResponse<string[]>, Error, IFieldUpdateAndCheck<Account, string[], keyof Account>, unknown>;
|
|
156
|
-
removeFieldBy?: UseMutateFunction<IMainResponse<boolean>, Error, IFieldUpdateAndCheck<Account, Array<keyof Account>, string[]>, unknown>;
|
|
157
|
-
copyByField?: UseMutateFunction<IMainResponse<boolean>, Error, IFieldUpdateAndCheck<Account, string, string[]>, unknown>;
|
|
158
|
-
actionBy?: UseMutateFunction<IMainResponse<string[]>, Error, IFieldUpdateAndCheck<Account, IActionUiUtilBy, string[]>, unknown>;
|
|
159
|
-
updateAccountByField?: UseMutateFunction<IMainResponse<boolean>, Error, IFieldUpdateAndCheck<Account, Partial<Account>, string[]>, unknown>;
|
|
160
|
-
deleteProxy?: UseMutateFunction<IMainResponse<boolean>, Error, IPayloadRemoveProxy, unknown>;
|
|
161
|
-
removePostByField?: UseMutateFunction<IMainResponse<boolean>, Error, IFieldUpdateAndCheck<Post, undefined, string[]>, unknown>;
|
|
162
|
-
startAction?: UseMutateFunction<IMainResponse<boolean>, Error, IPayloadStartAction, unknown>;
|
|
163
|
-
updateSettings?: UseMutateFunction<IMainResponse<boolean>, Error, IFieldUpdateAndCheck<AppSettings, object, boolean>, unknown>;
|
|
164
|
-
useCopyProxyByField?: UseMutateFunction<IMainResponse<boolean>, Error, IFieldUpdateAndCheck<Proxy, string, string[]>[], unknown>;
|
|
165
|
-
exportLinkSuccess?: UseMutateFunction<IMainResponse<boolean>, Error, ITaskName, unknown>;
|
|
166
|
-
setAction?: Dispatch<SetStateAction<ITaskName>>;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
type IDispatchState<T> = Dispatch<SetStateAction<T>>;
|
|
170
|
-
|
|
171
|
-
interface IExpandValue extends IPayloadService {
|
|
172
|
-
t?: TFunction<any, any> | undefined | any;
|
|
173
|
-
setConfigSearch?: IDispatchState<ISetConfigPagination>;
|
|
174
|
-
setSelectedRecords?: Dispatch<ReadonlySet<string>>;
|
|
175
|
-
setIsShowEdit?: Dispatch<SetStateAction<boolean>>;
|
|
176
|
-
setIsOpenEditContent?: Dispatch<SetStateAction<boolean>>;
|
|
177
|
-
setIsCopy?: Dispatch<SetStateAction<boolean>>;
|
|
178
|
-
setIsChangeCate?: Dispatch<SetStateAction<boolean>>;
|
|
179
|
-
setIsBackup?: Dispatch<SetStateAction<boolean>>;
|
|
180
|
-
}
|
|
181
|
-
type configContextMenuType = {
|
|
182
|
-
Icon: (prop?: any) => ReactNode;
|
|
183
|
-
action: string;
|
|
184
|
-
onClick?: (value: string[], expandValue: IExpandValue) => void;
|
|
185
|
-
children?: configContextMenuType[];
|
|
186
|
-
};
|
|
187
|
-
interface RenderContextMenuProps {
|
|
188
|
-
renderData?: configContextMenuType[];
|
|
189
|
-
valueClickItem?: any;
|
|
190
|
-
expandValue?: IExpandValue;
|
|
191
|
-
classWapper?: boolean;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
interface TableStyleWapperProps {
|
|
195
|
-
children?: ReactNode;
|
|
196
|
-
contextMenuProps?: Omit<ContextMenuProps, 'selector' | 'children'> & {
|
|
197
|
-
selector?: string;
|
|
198
|
-
};
|
|
199
|
-
renderContext?: RenderContextMenuProps;
|
|
200
|
-
clsTablecustom?: string;
|
|
201
|
-
}
|
|
202
|
-
declare const TableStyleContextWapper: react.NamedExoticComponent<TableStyleWapperProps>;
|
|
203
|
-
|
|
204
79
|
interface IPaginationParams {
|
|
205
80
|
pageSize?: number;
|
|
206
81
|
page?: number;
|
|
207
82
|
}
|
|
208
83
|
type Maybe<T> = T | undefined | null;
|
|
209
|
-
interface ICalculatorTotalPage extends IPaginationParams {
|
|
210
|
-
total?: number;
|
|
211
|
-
}
|
|
212
|
-
interface ISTTParams extends IPaginationParams {
|
|
213
|
-
}
|
|
214
|
-
interface UseShowHideColumnParameter<T, SR = unknown> {
|
|
215
|
-
nameLocal?: string;
|
|
216
|
-
/** nếu đầu vào là columns: Functions() thì nên dùng useMemo thì sẽ tối ưu hơn */
|
|
217
|
-
columns: TColumnsTable<T, SR>;
|
|
218
|
-
ignoreColumns?: string[];
|
|
219
|
-
}
|
|
220
|
-
interface UseShowHideColumnReturn<T, SR> {
|
|
221
|
-
hiddenColumns: string[];
|
|
222
|
-
setHiddenColumns: Dispatch<SetStateAction<string[]>>;
|
|
223
|
-
columnsTable: TColumnsTable<T, SR>;
|
|
224
|
-
changeHiddenColumn: (key: string | string[]) => void;
|
|
225
|
-
newShowhideColumns: TColumnsTable<T, SR>;
|
|
226
|
-
locationColumns: string[];
|
|
227
|
-
handleFindLocation: (filterColumns: TColumnsTable<T, SR>, locationColumns?: string[]) => TColumnsTable<T, SR>;
|
|
228
|
-
handleChangeLocation?: (arr: string[]) => void;
|
|
229
|
-
}
|
|
230
84
|
|
|
231
|
-
export { type
|
|
85
|
+
export { type IPaginationParams, type IReactTableGridCustom, type Maybe, ReactTableGridCustom, ReactTableGridCustomPaginationClient, type TColumnsTable, useShowHideColumn };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
1
|
import { Dispatch, SetStateAction, Key, ReactNode, JSX, MutableRefObject } from 'react';
|
|
3
2
|
import { ColumnOrColumnGroup, DataGridProps } from 'react-data-grid';
|
|
4
3
|
export { Column, ColumnOrColumnGroup, DataGridProps } from 'react-data-grid';
|
|
5
4
|
import { PaginationRootProps } from '@mantine/core';
|
|
6
|
-
import { TFunction } from 'i18next';
|
|
7
|
-
import { UseMutateFunction } from '@tanstack/react-query';
|
|
8
5
|
|
|
9
6
|
type TColumnsTable<T = unknown, SR = unknown> = readonly ColumnOrColumnGroup<NoInfer<T>, NoInfer<SR>>[];
|
|
10
7
|
interface IPaginationParams$1 {
|
|
@@ -14,7 +11,7 @@ interface IPaginationParams$1 {
|
|
|
14
11
|
interface IObjectDynamic {
|
|
15
12
|
[key: string]: any;
|
|
16
13
|
}
|
|
17
|
-
interface ISetConfigPagination
|
|
14
|
+
interface ISetConfigPagination extends IPaginationParams$1, IObjectDynamic {
|
|
18
15
|
}
|
|
19
16
|
interface useShowHideColumnParameter<T, SR = unknown> {
|
|
20
17
|
nameLocal?: string;
|
|
@@ -32,6 +29,9 @@ interface useShowHideColumnReturn<T, SR> {
|
|
|
32
29
|
handleFindLocation: (filterColumns: TColumnsTable<T, SR>, locationColumns?: string[]) => TColumnsTable<T, SR>;
|
|
33
30
|
handleChangeLocation?: (arr: string[]) => void;
|
|
34
31
|
}
|
|
32
|
+
interface ICalculatorTotalPage extends IPaginationParams$1 {
|
|
33
|
+
total?: number;
|
|
34
|
+
}
|
|
35
35
|
|
|
36
36
|
declare const useShowHideColumn: <T, SR = unknown>({ nameLocal, columns, ignoreColumns }: useShowHideColumnParameter<T, SR>) => useShowHideColumnReturn<T, SR>;
|
|
37
37
|
|
|
@@ -49,7 +49,7 @@ interface IReactTableGridCustom<T = unknown, SR = unknown, K extends Key = Key>
|
|
|
49
49
|
data?: T[];
|
|
50
50
|
/** Nếu hàm onChange nên dùng useCallback */
|
|
51
51
|
onChange?: Pick<PaginationRootProps, 'onChange'>['onChange'];
|
|
52
|
-
setConfigPagination?: Dispatch<SetStateAction<ISetConfigPagination
|
|
52
|
+
setConfigPagination?: Dispatch<SetStateAction<ISetConfigPagination>>;
|
|
53
53
|
/** Nếu hàm rowKeyGetter nên dùng useCallback*/
|
|
54
54
|
rowKeyGetter?: string | Maybe<(row: NoInfer<T>) => K>;
|
|
55
55
|
hiddenPaginationText?: boolean;
|
|
@@ -58,9 +58,10 @@ interface IReactTableGridCustom<T = unknown, SR = unknown, K extends Key = Key>
|
|
|
58
58
|
listPageSize?: string[];
|
|
59
59
|
fetching?: boolean;
|
|
60
60
|
TableLogo?: string;
|
|
61
|
+
[key: string]: any;
|
|
61
62
|
}
|
|
62
63
|
interface refTablePaginationClient extends Required<IPaginationParams> {
|
|
63
|
-
setConfigSearch: Dispatch<SetStateAction<ISetConfigPagination
|
|
64
|
+
setConfigSearch: Dispatch<SetStateAction<ISetConfigPagination>>;
|
|
64
65
|
resetPagition: (conditional?: boolean) => void;
|
|
65
66
|
}
|
|
66
67
|
|
|
@@ -75,157 +76,10 @@ interface ReactTableGridCustomPaginationClientProps<T = unknown, SR = unknown, K
|
|
|
75
76
|
}
|
|
76
77
|
declare const ReactTableGridCustomPaginationClient: ReactTableGridCustomPaginationClientComponent;
|
|
77
78
|
|
|
78
|
-
interface ContextMenuProps {
|
|
79
|
-
selector: string;
|
|
80
|
-
children?: ReactNode;
|
|
81
|
-
zIndex?: number;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
interface IMainResponse<T = any> {
|
|
85
|
-
success?: boolean;
|
|
86
|
-
status?: 'success' | 'error' | 'warning';
|
|
87
|
-
data?: T;
|
|
88
|
-
payload?: {
|
|
89
|
-
data?: T;
|
|
90
|
-
[key: string]: any;
|
|
91
|
-
};
|
|
92
|
-
message?: {
|
|
93
|
-
key: string;
|
|
94
|
-
[key: string]: any;
|
|
95
|
-
};
|
|
96
|
-
error?: any;
|
|
97
|
-
}
|
|
98
|
-
interface IFieldUpdateAndCheck<T = any, F = any, V = any> {
|
|
99
|
-
id?: string | number;
|
|
100
|
-
field?: F;
|
|
101
|
-
value?: V;
|
|
102
|
-
data?: T;
|
|
103
|
-
[key: string]: any;
|
|
104
|
-
}
|
|
105
|
-
interface Account {
|
|
106
|
-
id?: string | number;
|
|
107
|
-
username?: string;
|
|
108
|
-
password?: string;
|
|
109
|
-
email?: string;
|
|
110
|
-
status?: string;
|
|
111
|
-
[key: string]: any;
|
|
112
|
-
}
|
|
113
|
-
interface Post {
|
|
114
|
-
id?: string | number;
|
|
115
|
-
title?: string;
|
|
116
|
-
content?: string;
|
|
117
|
-
createdAt?: number;
|
|
118
|
-
[key: string]: any;
|
|
119
|
-
}
|
|
120
|
-
interface AppSettings {
|
|
121
|
-
[key: string]: any;
|
|
122
|
-
}
|
|
123
|
-
interface ISetConfigPagination {
|
|
124
|
-
page?: number;
|
|
125
|
-
limit?: number;
|
|
126
|
-
total?: number;
|
|
127
|
-
[key: string]: any;
|
|
128
|
-
}
|
|
129
|
-
type ITaskName = string;
|
|
130
|
-
|
|
131
|
-
interface IActionUiUtilBy {
|
|
132
|
-
action?: string;
|
|
133
|
-
[key: string]: any;
|
|
134
|
-
}
|
|
135
|
-
interface IPayloadStartAction {
|
|
136
|
-
action?: string;
|
|
137
|
-
[key: string]: any;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
interface Proxy {
|
|
141
|
-
id?: string;
|
|
142
|
-
host?: string;
|
|
143
|
-
port?: number;
|
|
144
|
-
username?: string;
|
|
145
|
-
password?: string;
|
|
146
|
-
protocol?: string;
|
|
147
|
-
provider?: string;
|
|
148
|
-
[key: string]: any;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
interface IPayloadRemoveProxy {
|
|
152
|
-
ids: string[];
|
|
153
|
-
}
|
|
154
|
-
interface IPayloadService {
|
|
155
|
-
updateByClipboard?: UseMutateFunction<IMainResponse<string[]>, Error, IFieldUpdateAndCheck<Account, string[], keyof Account>, unknown>;
|
|
156
|
-
removeFieldBy?: UseMutateFunction<IMainResponse<boolean>, Error, IFieldUpdateAndCheck<Account, Array<keyof Account>, string[]>, unknown>;
|
|
157
|
-
copyByField?: UseMutateFunction<IMainResponse<boolean>, Error, IFieldUpdateAndCheck<Account, string, string[]>, unknown>;
|
|
158
|
-
actionBy?: UseMutateFunction<IMainResponse<string[]>, Error, IFieldUpdateAndCheck<Account, IActionUiUtilBy, string[]>, unknown>;
|
|
159
|
-
updateAccountByField?: UseMutateFunction<IMainResponse<boolean>, Error, IFieldUpdateAndCheck<Account, Partial<Account>, string[]>, unknown>;
|
|
160
|
-
deleteProxy?: UseMutateFunction<IMainResponse<boolean>, Error, IPayloadRemoveProxy, unknown>;
|
|
161
|
-
removePostByField?: UseMutateFunction<IMainResponse<boolean>, Error, IFieldUpdateAndCheck<Post, undefined, string[]>, unknown>;
|
|
162
|
-
startAction?: UseMutateFunction<IMainResponse<boolean>, Error, IPayloadStartAction, unknown>;
|
|
163
|
-
updateSettings?: UseMutateFunction<IMainResponse<boolean>, Error, IFieldUpdateAndCheck<AppSettings, object, boolean>, unknown>;
|
|
164
|
-
useCopyProxyByField?: UseMutateFunction<IMainResponse<boolean>, Error, IFieldUpdateAndCheck<Proxy, string, string[]>[], unknown>;
|
|
165
|
-
exportLinkSuccess?: UseMutateFunction<IMainResponse<boolean>, Error, ITaskName, unknown>;
|
|
166
|
-
setAction?: Dispatch<SetStateAction<ITaskName>>;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
type IDispatchState<T> = Dispatch<SetStateAction<T>>;
|
|
170
|
-
|
|
171
|
-
interface IExpandValue extends IPayloadService {
|
|
172
|
-
t?: TFunction<any, any> | undefined | any;
|
|
173
|
-
setConfigSearch?: IDispatchState<ISetConfigPagination>;
|
|
174
|
-
setSelectedRecords?: Dispatch<ReadonlySet<string>>;
|
|
175
|
-
setIsShowEdit?: Dispatch<SetStateAction<boolean>>;
|
|
176
|
-
setIsOpenEditContent?: Dispatch<SetStateAction<boolean>>;
|
|
177
|
-
setIsCopy?: Dispatch<SetStateAction<boolean>>;
|
|
178
|
-
setIsChangeCate?: Dispatch<SetStateAction<boolean>>;
|
|
179
|
-
setIsBackup?: Dispatch<SetStateAction<boolean>>;
|
|
180
|
-
}
|
|
181
|
-
type configContextMenuType = {
|
|
182
|
-
Icon: (prop?: any) => ReactNode;
|
|
183
|
-
action: string;
|
|
184
|
-
onClick?: (value: string[], expandValue: IExpandValue) => void;
|
|
185
|
-
children?: configContextMenuType[];
|
|
186
|
-
};
|
|
187
|
-
interface RenderContextMenuProps {
|
|
188
|
-
renderData?: configContextMenuType[];
|
|
189
|
-
valueClickItem?: any;
|
|
190
|
-
expandValue?: IExpandValue;
|
|
191
|
-
classWapper?: boolean;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
interface TableStyleWapperProps {
|
|
195
|
-
children?: ReactNode;
|
|
196
|
-
contextMenuProps?: Omit<ContextMenuProps, 'selector' | 'children'> & {
|
|
197
|
-
selector?: string;
|
|
198
|
-
};
|
|
199
|
-
renderContext?: RenderContextMenuProps;
|
|
200
|
-
clsTablecustom?: string;
|
|
201
|
-
}
|
|
202
|
-
declare const TableStyleContextWapper: react.NamedExoticComponent<TableStyleWapperProps>;
|
|
203
|
-
|
|
204
79
|
interface IPaginationParams {
|
|
205
80
|
pageSize?: number;
|
|
206
81
|
page?: number;
|
|
207
82
|
}
|
|
208
83
|
type Maybe<T> = T | undefined | null;
|
|
209
|
-
interface ICalculatorTotalPage extends IPaginationParams {
|
|
210
|
-
total?: number;
|
|
211
|
-
}
|
|
212
|
-
interface ISTTParams extends IPaginationParams {
|
|
213
|
-
}
|
|
214
|
-
interface UseShowHideColumnParameter<T, SR = unknown> {
|
|
215
|
-
nameLocal?: string;
|
|
216
|
-
/** nếu đầu vào là columns: Functions() thì nên dùng useMemo thì sẽ tối ưu hơn */
|
|
217
|
-
columns: TColumnsTable<T, SR>;
|
|
218
|
-
ignoreColumns?: string[];
|
|
219
|
-
}
|
|
220
|
-
interface UseShowHideColumnReturn<T, SR> {
|
|
221
|
-
hiddenColumns: string[];
|
|
222
|
-
setHiddenColumns: Dispatch<SetStateAction<string[]>>;
|
|
223
|
-
columnsTable: TColumnsTable<T, SR>;
|
|
224
|
-
changeHiddenColumn: (key: string | string[]) => void;
|
|
225
|
-
newShowhideColumns: TColumnsTable<T, SR>;
|
|
226
|
-
locationColumns: string[];
|
|
227
|
-
handleFindLocation: (filterColumns: TColumnsTable<T, SR>, locationColumns?: string[]) => TColumnsTable<T, SR>;
|
|
228
|
-
handleChangeLocation?: (arr: string[]) => void;
|
|
229
|
-
}
|
|
230
84
|
|
|
231
|
-
export { type
|
|
85
|
+
export { type IPaginationParams, type IReactTableGridCustom, type Maybe, ReactTableGridCustom, ReactTableGridCustomPaginationClient, type TColumnsTable, useShowHideColumn };
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,6 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
ReactTableGridCustom: () => ReactTableGridCustom,
|
|
34
34
|
ReactTableGridCustomPaginationClient: () => ReactTableGridCustomPaginationClient,
|
|
35
|
-
TableStyleContextWapper: () => TableStyleContextWapper,
|
|
36
35
|
useShowHideColumn: () => useShowHideColumn
|
|
37
36
|
});
|
|
38
37
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -517,7 +516,7 @@ var ReactTableGridCustomPaginationClientInner = ({
|
|
|
517
516
|
ReactTableGridCustom,
|
|
518
517
|
{
|
|
519
518
|
data: newDataAccount,
|
|
520
|
-
total: data == null ? void 0 : data.length,
|
|
519
|
+
total: (data == null ? void 0 : data.length) || 0,
|
|
521
520
|
page: configSearch == null ? void 0 : configSearch.page,
|
|
522
521
|
pageSize: configSearch == null ? void 0 : configSearch.pageSize,
|
|
523
522
|
setConfigPagination: setConfigSearch,
|
|
@@ -528,265 +527,9 @@ var ReactTableGridCustomPaginationClientInner = ({
|
|
|
528
527
|
var ReactTableGridCustomPaginationClient = (0, import_react5.memo)(
|
|
529
528
|
ReactTableGridCustomPaginationClientInner
|
|
530
529
|
);
|
|
531
|
-
|
|
532
|
-
// src/component/ui/Table/TableStyleContextWapper.tsx
|
|
533
|
-
var import_react10 = require("react");
|
|
534
|
-
|
|
535
|
-
// src/component/ui/ContextMenu/ContextMenu.tsx
|
|
536
|
-
var import_react6 = require("react");
|
|
537
|
-
var import_react_dom = require("react-dom");
|
|
538
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
539
|
-
var ContextMenu = ({ selector, children, zIndex = 40 }) => {
|
|
540
|
-
const menuRef = (0, import_react6.useRef)(null);
|
|
541
|
-
const closeMenu = (0, import_react6.useCallback)(() => {
|
|
542
|
-
const contextMenuElem = menuRef.current;
|
|
543
|
-
const elementParent = document.querySelector(selector);
|
|
544
|
-
if (contextMenuElem && contextMenuElem.classList.contains("shadow-menu")) {
|
|
545
|
-
contextMenuElem.classList.remove("shadow-menu");
|
|
546
|
-
contextMenuElem.style.opacity = "0";
|
|
547
|
-
contextMenuElem.style.visibility = "hidden";
|
|
548
|
-
}
|
|
549
|
-
if (elementParent) {
|
|
550
|
-
elementParent.style.removeProperty("overflow");
|
|
551
|
-
}
|
|
552
|
-
}, [menuRef.current]);
|
|
553
|
-
(0, import_react6.useEffect)(() => {
|
|
554
|
-
const elementParent = document.querySelector(selector);
|
|
555
|
-
if (elementParent) {
|
|
556
|
-
const clickMenu = (e) => {
|
|
557
|
-
const contextMenuElem = menuRef.current;
|
|
558
|
-
if (contextMenuElem) {
|
|
559
|
-
contextMenuElem.style.opacity = "1";
|
|
560
|
-
contextMenuElem.style.visibility = "visible";
|
|
561
|
-
const { width: widthContextMenu, height: heightContextMenu } = contextMenuElem.getBoundingClientRect();
|
|
562
|
-
elementParent.style.overflow = "hidden";
|
|
563
|
-
const maxWidth = window.innerWidth;
|
|
564
|
-
const maxHeight = window.innerHeight;
|
|
565
|
-
const remainingLeft = maxWidth - e.clientX;
|
|
566
|
-
const isLeft = remainingLeft >= widthContextMenu;
|
|
567
|
-
const showTop = heightContextMenu + e.clientY <= maxHeight;
|
|
568
|
-
const showBottom = e.clientY - heightContextMenu >= 0;
|
|
569
|
-
const isCenter = !(showTop || showBottom);
|
|
570
|
-
isCenter;
|
|
571
|
-
const styleOrigin = {
|
|
572
|
-
x: "left",
|
|
573
|
-
y: "top"
|
|
574
|
-
};
|
|
575
|
-
if (isLeft) {
|
|
576
|
-
contextMenuElem.style.left = `${e.clientX}px`;
|
|
577
|
-
styleOrigin.x = "left";
|
|
578
|
-
} else {
|
|
579
|
-
contextMenuElem.style.left = `${e.clientX - widthContextMenu}px`;
|
|
580
|
-
styleOrigin.x = "right";
|
|
581
|
-
}
|
|
582
|
-
if (showTop) {
|
|
583
|
-
contextMenuElem.style.top = `${e.clientY}px`;
|
|
584
|
-
styleOrigin.y = "top";
|
|
585
|
-
} else if (showBottom) {
|
|
586
|
-
contextMenuElem.style.top = `${e.clientY - heightContextMenu}px`;
|
|
587
|
-
styleOrigin.y = "bottom";
|
|
588
|
-
} else {
|
|
589
|
-
const HalfHeight = heightContextMenu / 2;
|
|
590
|
-
const calculatorTop = HalfHeight + e.clientY;
|
|
591
|
-
const showTopCenter = calculatorTop <= maxHeight;
|
|
592
|
-
const calculatorBottom = e.clientY - HalfHeight;
|
|
593
|
-
const showBottom2 = calculatorBottom >= 0;
|
|
594
|
-
let topNew = calculatorBottom;
|
|
595
|
-
if (!showBottom2 && showTopCenter) {
|
|
596
|
-
topNew = topNew - calculatorBottom;
|
|
597
|
-
} else if (!showTopCenter && showBottom2) {
|
|
598
|
-
const ts = calculatorTop - maxHeight;
|
|
599
|
-
topNew = topNew - ts;
|
|
600
|
-
}
|
|
601
|
-
contextMenuElem.style.top = `${topNew}px`;
|
|
602
|
-
styleOrigin.y = "center";
|
|
603
|
-
}
|
|
604
|
-
contextMenuElem.style.transformOrigin = `${styleOrigin.y} ${styleOrigin.x}`;
|
|
605
|
-
if (!contextMenuElem.classList.contains("shadow-menu")) {
|
|
606
|
-
contextMenuElem.classList.add("shadow-menu");
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
};
|
|
610
|
-
elementParent.addEventListener("contextmenu", clickMenu);
|
|
611
|
-
window.addEventListener("click", closeMenu);
|
|
612
|
-
return () => {
|
|
613
|
-
elementParent.removeEventListener("contextmenu", clickMenu);
|
|
614
|
-
window.removeEventListener("click", closeMenu);
|
|
615
|
-
};
|
|
616
|
-
}
|
|
617
|
-
return () => {
|
|
618
|
-
};
|
|
619
|
-
}, []);
|
|
620
|
-
return (0, import_react_dom.createPortal)(
|
|
621
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
622
|
-
"div",
|
|
623
|
-
{
|
|
624
|
-
className: "fixed z-40 w-fit",
|
|
625
|
-
ref: menuRef,
|
|
626
|
-
style: { opacity: 0, visibility: "hidden", zIndex },
|
|
627
|
-
children
|
|
628
|
-
}
|
|
629
|
-
),
|
|
630
|
-
document.body
|
|
631
|
-
);
|
|
632
|
-
};
|
|
633
|
-
var ContextMenu_default = ContextMenu;
|
|
634
|
-
|
|
635
|
-
// src/component/ui/ContextMenu/RenderContextMenu.tsx
|
|
636
|
-
var import_react9 = require("react");
|
|
637
|
-
|
|
638
|
-
// src/component/ui/ContextMenu/ContextMenuItem.tsx
|
|
639
|
-
var import_react_i18next3 = require("react-i18next");
|
|
640
|
-
var import_md = require("react-icons/md");
|
|
641
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
642
|
-
var ContextMenuItem = ({
|
|
643
|
-
currentValue,
|
|
644
|
-
expandValue,
|
|
645
|
-
valueClickItem,
|
|
646
|
-
show,
|
|
647
|
-
isArrow
|
|
648
|
-
}) => {
|
|
649
|
-
const { t } = (0, import_react_i18next3.useTranslation)();
|
|
650
|
-
const Icon = currentValue.Icon;
|
|
651
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
652
|
-
"div",
|
|
653
|
-
{
|
|
654
|
-
className: `cursor-pointer p-2 flex items-center space-x-2 relative ${show ? "bg-[#555] text-white" : "hover:bg-[#555] hover:text-white"}`,
|
|
655
|
-
onClick: () => {
|
|
656
|
-
var _a;
|
|
657
|
-
expandValue && valueClickItem && (currentValue == null ? void 0 : currentValue.onClick) && ((_a = currentValue == null ? void 0 : currentValue.onClick) == null ? void 0 : _a.call(currentValue, valueClickItem, expandValue));
|
|
658
|
-
},
|
|
659
|
-
children: [
|
|
660
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { size: 20 }),
|
|
661
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-sm flex-1", children: t(`${currentValue.action}`) }),
|
|
662
|
-
isArrow && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_md.MdKeyboardArrowRight, { size: 20 })
|
|
663
|
-
]
|
|
664
|
-
}
|
|
665
|
-
);
|
|
666
|
-
};
|
|
667
|
-
var ContextMenuItem_default = ContextMenuItem;
|
|
668
|
-
|
|
669
|
-
// src/component/ui/ContextMenu/DropdownContextChild.tsx
|
|
670
|
-
var import_react7 = __toESM(require("@tippyjs/react"));
|
|
671
|
-
var import_react8 = require("react");
|
|
672
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
673
|
-
var DropdownContextChild = ({ button, children, ...rest }) => {
|
|
674
|
-
const id = (0, import_react8.useId)();
|
|
675
|
-
const instanceRef = (0, import_react8.useRef)(null);
|
|
676
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
677
|
-
import_react7.default,
|
|
678
|
-
{
|
|
679
|
-
theme: "drop-down",
|
|
680
|
-
className: "!bg-transparent !text-inherit !border-r-0 [&>*]:!p-0",
|
|
681
|
-
appendTo: document.body,
|
|
682
|
-
arrow: false,
|
|
683
|
-
placement: "auto",
|
|
684
|
-
interactive: true,
|
|
685
|
-
allowHTML: true,
|
|
686
|
-
content: children,
|
|
687
|
-
...rest,
|
|
688
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
689
|
-
"div",
|
|
690
|
-
{
|
|
691
|
-
id: `div-${id}`,
|
|
692
|
-
onClick: () => {
|
|
693
|
-
var _a;
|
|
694
|
-
(_a = instanceRef == null ? void 0 : instanceRef.current) == null ? void 0 : _a.show();
|
|
695
|
-
},
|
|
696
|
-
children: button
|
|
697
|
-
}
|
|
698
|
-
)
|
|
699
|
-
}
|
|
700
|
-
);
|
|
701
|
-
};
|
|
702
|
-
var DropdownContextChild_default = DropdownContextChild;
|
|
703
|
-
|
|
704
|
-
// src/component/ui/ContextMenu/RenderContextMenu.tsx
|
|
705
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
706
|
-
var RenderContextMenu = ({
|
|
707
|
-
renderData,
|
|
708
|
-
valueClickItem,
|
|
709
|
-
expandValue = {}
|
|
710
|
-
}) => {
|
|
711
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "bg-white shadow-submenu p-1 min-w-[250px] border", children: renderData == null ? void 0 : renderData.map((menuAction, index) => {
|
|
712
|
-
const [isShow, setIsShow] = (0, import_react9.useState)(false);
|
|
713
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react9.Fragment, { children: [
|
|
714
|
-
!(menuAction == null ? void 0 : menuAction.children) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
715
|
-
ContextMenuItem_default,
|
|
716
|
-
{
|
|
717
|
-
currentValue: menuAction,
|
|
718
|
-
expandValue,
|
|
719
|
-
valueClickItem
|
|
720
|
-
}
|
|
721
|
-
),
|
|
722
|
-
(menuAction == null ? void 0 : menuAction.children) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
723
|
-
DropdownContextChild_default,
|
|
724
|
-
{
|
|
725
|
-
appendTo: "parent",
|
|
726
|
-
placement: "right",
|
|
727
|
-
offset: [0, 5],
|
|
728
|
-
onShow: () => setIsShow(true),
|
|
729
|
-
onHide: () => setIsShow(false),
|
|
730
|
-
button: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
731
|
-
ContextMenuItem_default,
|
|
732
|
-
{
|
|
733
|
-
currentValue: menuAction,
|
|
734
|
-
expandValue,
|
|
735
|
-
valueClickItem,
|
|
736
|
-
show: isShow,
|
|
737
|
-
isArrow: true
|
|
738
|
-
}
|
|
739
|
-
),
|
|
740
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "dropdown-context-child absolute -top-[20px] -left-1", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
741
|
-
RenderContextMenu,
|
|
742
|
-
{
|
|
743
|
-
renderData: menuAction == null ? void 0 : menuAction.children,
|
|
744
|
-
expandValue,
|
|
745
|
-
valueClickItem
|
|
746
|
-
}
|
|
747
|
-
) })
|
|
748
|
-
}
|
|
749
|
-
)
|
|
750
|
-
] }, index);
|
|
751
|
-
}) });
|
|
752
|
-
};
|
|
753
|
-
var RenderContextMenu_default = RenderContextMenu;
|
|
754
|
-
|
|
755
|
-
// src/component/ui/Table/TableStyleContextWapper.tsx
|
|
756
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
757
|
-
var TableStyleContextMenuWapper = ({
|
|
758
|
-
children,
|
|
759
|
-
contextMenuProps,
|
|
760
|
-
clsTablecustom,
|
|
761
|
-
renderContext
|
|
762
|
-
}) => {
|
|
763
|
-
const idWapper = (0, import_react10.useId)();
|
|
764
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
765
|
-
"div",
|
|
766
|
-
{
|
|
767
|
-
id: `wapper_menu_context-${idWapper}`,
|
|
768
|
-
className: `border border-[#dedede] rounded-xl overflow-hidden bg-white flex-1 h-full flex flex-col min-h-[360px] ${clsTablecustom != null ? clsTablecustom : ""}`,
|
|
769
|
-
children: [
|
|
770
|
-
(renderContext == null ? void 0 : renderContext.renderData) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
771
|
-
ContextMenu_default,
|
|
772
|
-
{
|
|
773
|
-
selector: `[id="wapper_menu_context-${idWapper}"] .rdg`,
|
|
774
|
-
...contextMenuProps,
|
|
775
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RenderContextMenu_default, { ...renderContext })
|
|
776
|
-
}
|
|
777
|
-
),
|
|
778
|
-
children
|
|
779
|
-
]
|
|
780
|
-
}
|
|
781
|
-
);
|
|
782
|
-
};
|
|
783
|
-
var TableStyleContextWapper = (0, import_react10.memo)(
|
|
784
|
-
TableStyleContextMenuWapper
|
|
785
|
-
);
|
|
786
530
|
// Annotate the CommonJS export names for ESM import in node:
|
|
787
531
|
0 && (module.exports = {
|
|
788
532
|
ReactTableGridCustom,
|
|
789
533
|
ReactTableGridCustomPaginationClient,
|
|
790
|
-
TableStyleContextWapper,
|
|
791
534
|
useShowHideColumn
|
|
792
535
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -493,7 +493,7 @@ var ReactTableGridCustomPaginationClientInner = ({
|
|
|
493
493
|
ReactTableGridCustom,
|
|
494
494
|
{
|
|
495
495
|
data: newDataAccount,
|
|
496
|
-
total: data == null ? void 0 : data.length,
|
|
496
|
+
total: (data == null ? void 0 : data.length) || 0,
|
|
497
497
|
page: configSearch == null ? void 0 : configSearch.page,
|
|
498
498
|
pageSize: configSearch == null ? void 0 : configSearch.pageSize,
|
|
499
499
|
setConfigPagination: setConfigSearch,
|
|
@@ -504,264 +504,8 @@ var ReactTableGridCustomPaginationClientInner = ({
|
|
|
504
504
|
var ReactTableGridCustomPaginationClient = memo2(
|
|
505
505
|
ReactTableGridCustomPaginationClientInner
|
|
506
506
|
);
|
|
507
|
-
|
|
508
|
-
// src/component/ui/Table/TableStyleContextWapper.tsx
|
|
509
|
-
import { memo as memo3, useId as useId2 } from "react";
|
|
510
|
-
|
|
511
|
-
// src/component/ui/ContextMenu/ContextMenu.tsx
|
|
512
|
-
import { useCallback as useCallback4, useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
513
|
-
import { createPortal } from "react-dom";
|
|
514
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
515
|
-
var ContextMenu = ({ selector, children, zIndex = 40 }) => {
|
|
516
|
-
const menuRef = useRef2(null);
|
|
517
|
-
const closeMenu = useCallback4(() => {
|
|
518
|
-
const contextMenuElem = menuRef.current;
|
|
519
|
-
const elementParent = document.querySelector(selector);
|
|
520
|
-
if (contextMenuElem && contextMenuElem.classList.contains("shadow-menu")) {
|
|
521
|
-
contextMenuElem.classList.remove("shadow-menu");
|
|
522
|
-
contextMenuElem.style.opacity = "0";
|
|
523
|
-
contextMenuElem.style.visibility = "hidden";
|
|
524
|
-
}
|
|
525
|
-
if (elementParent) {
|
|
526
|
-
elementParent.style.removeProperty("overflow");
|
|
527
|
-
}
|
|
528
|
-
}, [menuRef.current]);
|
|
529
|
-
useEffect2(() => {
|
|
530
|
-
const elementParent = document.querySelector(selector);
|
|
531
|
-
if (elementParent) {
|
|
532
|
-
const clickMenu = (e) => {
|
|
533
|
-
const contextMenuElem = menuRef.current;
|
|
534
|
-
if (contextMenuElem) {
|
|
535
|
-
contextMenuElem.style.opacity = "1";
|
|
536
|
-
contextMenuElem.style.visibility = "visible";
|
|
537
|
-
const { width: widthContextMenu, height: heightContextMenu } = contextMenuElem.getBoundingClientRect();
|
|
538
|
-
elementParent.style.overflow = "hidden";
|
|
539
|
-
const maxWidth = window.innerWidth;
|
|
540
|
-
const maxHeight = window.innerHeight;
|
|
541
|
-
const remainingLeft = maxWidth - e.clientX;
|
|
542
|
-
const isLeft = remainingLeft >= widthContextMenu;
|
|
543
|
-
const showTop = heightContextMenu + e.clientY <= maxHeight;
|
|
544
|
-
const showBottom = e.clientY - heightContextMenu >= 0;
|
|
545
|
-
const isCenter = !(showTop || showBottom);
|
|
546
|
-
isCenter;
|
|
547
|
-
const styleOrigin = {
|
|
548
|
-
x: "left",
|
|
549
|
-
y: "top"
|
|
550
|
-
};
|
|
551
|
-
if (isLeft) {
|
|
552
|
-
contextMenuElem.style.left = `${e.clientX}px`;
|
|
553
|
-
styleOrigin.x = "left";
|
|
554
|
-
} else {
|
|
555
|
-
contextMenuElem.style.left = `${e.clientX - widthContextMenu}px`;
|
|
556
|
-
styleOrigin.x = "right";
|
|
557
|
-
}
|
|
558
|
-
if (showTop) {
|
|
559
|
-
contextMenuElem.style.top = `${e.clientY}px`;
|
|
560
|
-
styleOrigin.y = "top";
|
|
561
|
-
} else if (showBottom) {
|
|
562
|
-
contextMenuElem.style.top = `${e.clientY - heightContextMenu}px`;
|
|
563
|
-
styleOrigin.y = "bottom";
|
|
564
|
-
} else {
|
|
565
|
-
const HalfHeight = heightContextMenu / 2;
|
|
566
|
-
const calculatorTop = HalfHeight + e.clientY;
|
|
567
|
-
const showTopCenter = calculatorTop <= maxHeight;
|
|
568
|
-
const calculatorBottom = e.clientY - HalfHeight;
|
|
569
|
-
const showBottom2 = calculatorBottom >= 0;
|
|
570
|
-
let topNew = calculatorBottom;
|
|
571
|
-
if (!showBottom2 && showTopCenter) {
|
|
572
|
-
topNew = topNew - calculatorBottom;
|
|
573
|
-
} else if (!showTopCenter && showBottom2) {
|
|
574
|
-
const ts = calculatorTop - maxHeight;
|
|
575
|
-
topNew = topNew - ts;
|
|
576
|
-
}
|
|
577
|
-
contextMenuElem.style.top = `${topNew}px`;
|
|
578
|
-
styleOrigin.y = "center";
|
|
579
|
-
}
|
|
580
|
-
contextMenuElem.style.transformOrigin = `${styleOrigin.y} ${styleOrigin.x}`;
|
|
581
|
-
if (!contextMenuElem.classList.contains("shadow-menu")) {
|
|
582
|
-
contextMenuElem.classList.add("shadow-menu");
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
};
|
|
586
|
-
elementParent.addEventListener("contextmenu", clickMenu);
|
|
587
|
-
window.addEventListener("click", closeMenu);
|
|
588
|
-
return () => {
|
|
589
|
-
elementParent.removeEventListener("contextmenu", clickMenu);
|
|
590
|
-
window.removeEventListener("click", closeMenu);
|
|
591
|
-
};
|
|
592
|
-
}
|
|
593
|
-
return () => {
|
|
594
|
-
};
|
|
595
|
-
}, []);
|
|
596
|
-
return createPortal(
|
|
597
|
-
/* @__PURE__ */ jsx5(
|
|
598
|
-
"div",
|
|
599
|
-
{
|
|
600
|
-
className: "fixed z-40 w-fit",
|
|
601
|
-
ref: menuRef,
|
|
602
|
-
style: { opacity: 0, visibility: "hidden", zIndex },
|
|
603
|
-
children
|
|
604
|
-
}
|
|
605
|
-
),
|
|
606
|
-
document.body
|
|
607
|
-
);
|
|
608
|
-
};
|
|
609
|
-
var ContextMenu_default = ContextMenu;
|
|
610
|
-
|
|
611
|
-
// src/component/ui/ContextMenu/RenderContextMenu.tsx
|
|
612
|
-
import { Fragment as Fragment2, useState as useState4 } from "react";
|
|
613
|
-
|
|
614
|
-
// src/component/ui/ContextMenu/ContextMenuItem.tsx
|
|
615
|
-
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
616
|
-
import { MdKeyboardArrowRight } from "react-icons/md";
|
|
617
|
-
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
618
|
-
var ContextMenuItem = ({
|
|
619
|
-
currentValue,
|
|
620
|
-
expandValue,
|
|
621
|
-
valueClickItem,
|
|
622
|
-
show,
|
|
623
|
-
isArrow
|
|
624
|
-
}) => {
|
|
625
|
-
const { t } = useTranslation3();
|
|
626
|
-
const Icon = currentValue.Icon;
|
|
627
|
-
return /* @__PURE__ */ jsxs3(
|
|
628
|
-
"div",
|
|
629
|
-
{
|
|
630
|
-
className: `cursor-pointer p-2 flex items-center space-x-2 relative ${show ? "bg-[#555] text-white" : "hover:bg-[#555] hover:text-white"}`,
|
|
631
|
-
onClick: () => {
|
|
632
|
-
var _a;
|
|
633
|
-
expandValue && valueClickItem && (currentValue == null ? void 0 : currentValue.onClick) && ((_a = currentValue == null ? void 0 : currentValue.onClick) == null ? void 0 : _a.call(currentValue, valueClickItem, expandValue));
|
|
634
|
-
},
|
|
635
|
-
children: [
|
|
636
|
-
/* @__PURE__ */ jsx6(Icon, { size: 20 }),
|
|
637
|
-
/* @__PURE__ */ jsx6("span", { className: "text-sm flex-1", children: t(`${currentValue.action}`) }),
|
|
638
|
-
isArrow && /* @__PURE__ */ jsx6(MdKeyboardArrowRight, { size: 20 })
|
|
639
|
-
]
|
|
640
|
-
}
|
|
641
|
-
);
|
|
642
|
-
};
|
|
643
|
-
var ContextMenuItem_default = ContextMenuItem;
|
|
644
|
-
|
|
645
|
-
// src/component/ui/ContextMenu/DropdownContextChild.tsx
|
|
646
|
-
import Tippy from "@tippyjs/react";
|
|
647
|
-
import { useId, useRef as useRef3 } from "react";
|
|
648
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
649
|
-
var DropdownContextChild = ({ button, children, ...rest }) => {
|
|
650
|
-
const id = useId();
|
|
651
|
-
const instanceRef = useRef3(null);
|
|
652
|
-
return /* @__PURE__ */ jsx7(
|
|
653
|
-
Tippy,
|
|
654
|
-
{
|
|
655
|
-
theme: "drop-down",
|
|
656
|
-
className: "!bg-transparent !text-inherit !border-r-0 [&>*]:!p-0",
|
|
657
|
-
appendTo: document.body,
|
|
658
|
-
arrow: false,
|
|
659
|
-
placement: "auto",
|
|
660
|
-
interactive: true,
|
|
661
|
-
allowHTML: true,
|
|
662
|
-
content: children,
|
|
663
|
-
...rest,
|
|
664
|
-
children: /* @__PURE__ */ jsx7(
|
|
665
|
-
"div",
|
|
666
|
-
{
|
|
667
|
-
id: `div-${id}`,
|
|
668
|
-
onClick: () => {
|
|
669
|
-
var _a;
|
|
670
|
-
(_a = instanceRef == null ? void 0 : instanceRef.current) == null ? void 0 : _a.show();
|
|
671
|
-
},
|
|
672
|
-
children: button
|
|
673
|
-
}
|
|
674
|
-
)
|
|
675
|
-
}
|
|
676
|
-
);
|
|
677
|
-
};
|
|
678
|
-
var DropdownContextChild_default = DropdownContextChild;
|
|
679
|
-
|
|
680
|
-
// src/component/ui/ContextMenu/RenderContextMenu.tsx
|
|
681
|
-
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
682
|
-
var RenderContextMenu = ({
|
|
683
|
-
renderData,
|
|
684
|
-
valueClickItem,
|
|
685
|
-
expandValue = {}
|
|
686
|
-
}) => {
|
|
687
|
-
return /* @__PURE__ */ jsx8("div", { className: "bg-white shadow-submenu p-1 min-w-[250px] border", children: renderData == null ? void 0 : renderData.map((menuAction, index) => {
|
|
688
|
-
const [isShow, setIsShow] = useState4(false);
|
|
689
|
-
return /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
690
|
-
!(menuAction == null ? void 0 : menuAction.children) && /* @__PURE__ */ jsx8(
|
|
691
|
-
ContextMenuItem_default,
|
|
692
|
-
{
|
|
693
|
-
currentValue: menuAction,
|
|
694
|
-
expandValue,
|
|
695
|
-
valueClickItem
|
|
696
|
-
}
|
|
697
|
-
),
|
|
698
|
-
(menuAction == null ? void 0 : menuAction.children) && /* @__PURE__ */ jsx8(
|
|
699
|
-
DropdownContextChild_default,
|
|
700
|
-
{
|
|
701
|
-
appendTo: "parent",
|
|
702
|
-
placement: "right",
|
|
703
|
-
offset: [0, 5],
|
|
704
|
-
onShow: () => setIsShow(true),
|
|
705
|
-
onHide: () => setIsShow(false),
|
|
706
|
-
button: /* @__PURE__ */ jsx8(
|
|
707
|
-
ContextMenuItem_default,
|
|
708
|
-
{
|
|
709
|
-
currentValue: menuAction,
|
|
710
|
-
expandValue,
|
|
711
|
-
valueClickItem,
|
|
712
|
-
show: isShow,
|
|
713
|
-
isArrow: true
|
|
714
|
-
}
|
|
715
|
-
),
|
|
716
|
-
children: /* @__PURE__ */ jsx8("div", { className: "dropdown-context-child absolute -top-[20px] -left-1", children: /* @__PURE__ */ jsx8(
|
|
717
|
-
RenderContextMenu,
|
|
718
|
-
{
|
|
719
|
-
renderData: menuAction == null ? void 0 : menuAction.children,
|
|
720
|
-
expandValue,
|
|
721
|
-
valueClickItem
|
|
722
|
-
}
|
|
723
|
-
) })
|
|
724
|
-
}
|
|
725
|
-
)
|
|
726
|
-
] }, index);
|
|
727
|
-
}) });
|
|
728
|
-
};
|
|
729
|
-
var RenderContextMenu_default = RenderContextMenu;
|
|
730
|
-
|
|
731
|
-
// src/component/ui/Table/TableStyleContextWapper.tsx
|
|
732
|
-
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
733
|
-
var TableStyleContextMenuWapper = ({
|
|
734
|
-
children,
|
|
735
|
-
contextMenuProps,
|
|
736
|
-
clsTablecustom,
|
|
737
|
-
renderContext
|
|
738
|
-
}) => {
|
|
739
|
-
const idWapper = useId2();
|
|
740
|
-
return /* @__PURE__ */ jsxs5(
|
|
741
|
-
"div",
|
|
742
|
-
{
|
|
743
|
-
id: `wapper_menu_context-${idWapper}`,
|
|
744
|
-
className: `border border-[#dedede] rounded-xl overflow-hidden bg-white flex-1 h-full flex flex-col min-h-[360px] ${clsTablecustom != null ? clsTablecustom : ""}`,
|
|
745
|
-
children: [
|
|
746
|
-
(renderContext == null ? void 0 : renderContext.renderData) && /* @__PURE__ */ jsx9(
|
|
747
|
-
ContextMenu_default,
|
|
748
|
-
{
|
|
749
|
-
selector: `[id="wapper_menu_context-${idWapper}"] .rdg`,
|
|
750
|
-
...contextMenuProps,
|
|
751
|
-
children: /* @__PURE__ */ jsx9(RenderContextMenu_default, { ...renderContext })
|
|
752
|
-
}
|
|
753
|
-
),
|
|
754
|
-
children
|
|
755
|
-
]
|
|
756
|
-
}
|
|
757
|
-
);
|
|
758
|
-
};
|
|
759
|
-
var TableStyleContextWapper = memo3(
|
|
760
|
-
TableStyleContextMenuWapper
|
|
761
|
-
);
|
|
762
507
|
export {
|
|
763
508
|
ReactTableGridCustom,
|
|
764
509
|
ReactTableGridCustomPaginationClient,
|
|
765
|
-
TableStyleContextWapper,
|
|
766
510
|
useShowHideColumn
|
|
767
511
|
};
|