@campxdev/shared 0.5.21 → 0.5.22
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/.eslintignore +4 -0
- package/.eslintrc.js +34 -0
- package/.prettierrc +10 -0
- package/exports.ts +7 -6
- package/package.json +64 -50
- package/publish.sh +2 -0
- package/src/assets/images/index.ts +8 -8
- package/src/components/Breadcrumbs.tsx +3 -3
- package/src/components/ChangePassword.tsx +147 -147
- package/src/components/DropDownButton.tsx +167 -163
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +22 -22
- package/src/components/ErrorBoundary/ErrorFallback.tsx +215 -215
- package/src/components/ErrorBoundary/GlobalNetworkLoadingIndicator.tsx +6 -6
- package/src/components/ErrorBoundary/index.tsx +1 -1
- package/src/components/FullScreenLoader.tsx +15 -15
- package/src/components/HookForm/AutoCompleteSearch.tsx +0 -30
- package/src/components/HookForm/RadioGroup.tsx +1 -1
- package/src/components/IconButtons/Icons.tsx +1 -2
- package/src/components/Input/AutoCompleteSearch.tsx +0 -30
- package/src/components/Input/SingleSelect.tsx +0 -15
- package/src/components/Layout/Header/AppHeader.tsx +89 -89
- package/src/components/Layout/Header/AppsMenu.tsx +79 -79
- package/src/components/Layout/Header/CogWheelMenu.tsx +27 -27
- package/src/components/Layout/Header/UserBox.tsx +25 -25
- package/src/components/Layout/Header/applications.ts +79 -79
- package/src/components/Layout/Header/assets/index.ts +10 -10
- package/src/components/Layout/Header/styles.tsx +72 -72
- package/src/components/LayoutWrapper.tsx +6 -6
- package/src/components/LinearProgress.tsx +14 -14
- package/src/components/ListItemButton.tsx +79 -79
- package/src/components/LoginForm.tsx +86 -86
- package/src/components/MenuButton.tsx +88 -88
- package/src/components/ModalButtons/DialogButton.tsx +66 -66
- package/src/components/PageContent.tsx +10 -10
- package/src/components/PageNotFound.tsx +12 -12
- package/src/components/PopupConfirm/ConfirmContextProvider.tsx +28 -28
- package/src/components/PopupConfirm/PopupConfirm.tsx +27 -27
- package/src/components/PopupConfirm/useConfirm.ts +41 -41
- package/src/components/SideMenuHeader.tsx +15 -15
- package/src/components/SideNav.tsx +119 -119
- package/src/components/Spinner.tsx +14 -14
- package/src/components/TableComponent/ReactTable.tsx +256 -256
- package/src/components/TableComponent/RenderTableBody.tsx +56 -56
- package/src/components/TableComponent/index.tsx +171 -171
- package/src/components/TableComponent/react-table-config.d.ts +2 -3
- package/src/components/index.ts +54 -54
- package/src/config/axios.ts +50 -50
- package/src/config/axiosXTenant.ts +57 -0
- package/src/constants/isDevelopment.ts +2 -2
- package/src/contexts/LoginFormProvider.tsx +28 -28
- package/src/contexts/Providers.tsx +40 -40
- package/src/contexts/QueryClientProvider.tsx +15 -15
- package/src/hooks/index.ts +2 -2
- package/src/hooks/useAppInit.ts +23 -23
- package/src/hooks/useAuth.ts +78 -77
- package/src/layouts/Components/DashBoardMenu.tsx +77 -77
- package/src/layouts/Components/icons/index.tsx +32 -32
- package/src/layouts/Components/styles.tsx +23 -23
- package/src/permissions/PageWithPermission.tsx +9 -9
- package/src/permissions/PermissionDeniedPage.tsx +13 -13
- package/src/permissions/PermissionsStore.ts +303 -303
- package/src/shared-state/index.ts +3 -3
- package/src/theme/MuiThemeProvider.tsx +9 -9
- package/src/theme/theme.d.ts +72 -72
- package/src/utils/index.ts +7 -7
- package/src/utils/logout.ts +19 -19
- package/src/utils/withLocalization.tsx +8 -8
- package/src/utils/withRouteWrapper.tsx +20 -20
- package/src/utils/withSuspense.tsx +3 -3
|
@@ -1,236 +1,236 @@
|
|
|
1
|
-
import {Alert, Box, Button, Divider, styled, Typography} from '@mui/material'
|
|
2
|
-
import {useEffect, useState} from 'react'
|
|
1
|
+
import { Alert, Box, Button, Divider, styled, Typography } from '@mui/material'
|
|
2
|
+
import { useEffect, useState } from 'react'
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
nointernet,
|
|
5
|
+
pagenotfound,
|
|
6
|
+
permissiondenied,
|
|
7
|
+
unauth,
|
|
8
|
+
internalserver,
|
|
9
9
|
} from '../../assets/images'
|
|
10
10
|
import Cookies from 'js-cookie'
|
|
11
11
|
import LoginForm from '../LoginForm'
|
|
12
|
-
import {useModal} from '../DrawerWrapper/DrawerWrapper'
|
|
13
|
-
import {PermissionsStore} from '../../permissions'
|
|
12
|
+
import { useModal } from '../DrawerWrapper/DrawerWrapper'
|
|
13
|
+
import { PermissionsStore } from '../../permissions'
|
|
14
14
|
import axios from '../../config/axios'
|
|
15
15
|
|
|
16
|
-
const StyledAlert = styled(Alert)(({theme}) => ({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
16
|
+
const StyledAlert = styled(Alert)(({ theme }) => ({
|
|
17
|
+
border: `1px solid ${theme.palette.error.main}`,
|
|
18
|
+
display: 'flex',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
'& .MuiAlert-message': {
|
|
21
|
+
padding: 0,
|
|
22
|
+
},
|
|
23
|
+
'& .MuiTypography-root': {
|
|
24
|
+
margin: 0,
|
|
25
|
+
},
|
|
26
|
+
position: 'relative',
|
|
27
|
+
'& .retryBtn': {
|
|
28
|
+
color: '#661b2a',
|
|
29
|
+
position: 'absolute',
|
|
30
|
+
right: 8,
|
|
31
|
+
top: 8,
|
|
32
|
+
},
|
|
33
33
|
}))
|
|
34
34
|
|
|
35
|
-
const StyledBox = styled(Box)(({theme}) => ({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
const StyledBox = styled(Box)(({ theme }) => ({
|
|
36
|
+
width: '100%',
|
|
37
|
+
display: 'flex',
|
|
38
|
+
flexDirection: 'column',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
justifyContent: 'center',
|
|
41
41
|
}))
|
|
42
42
|
|
|
43
|
-
export default function ErrorFallback({error, resetErrorBoundary}) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
43
|
+
export default function ErrorFallback({ error, resetErrorBoundary }) {
|
|
44
|
+
if (error?.response?.status) {
|
|
45
|
+
switch (error?.response?.status) {
|
|
46
|
+
case 401:
|
|
47
|
+
return <UnAuth resetBoundary={resetErrorBoundary} />
|
|
48
|
+
|
|
49
|
+
case 500:
|
|
50
|
+
return (
|
|
51
|
+
<InternalServer resetBoundary={resetErrorBoundary} error={error} />
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
case 403:
|
|
55
|
+
return <PemissionDenied resetBoundary={resetErrorBoundary} />
|
|
56
|
+
|
|
57
|
+
default:
|
|
58
|
+
return (
|
|
59
|
+
<InternalServer resetBoundary={resetErrorBoundary} error={error} />
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (error?.message === 'Network Error') {
|
|
65
|
+
return <NoInternet resetBoundary={resetErrorBoundary} />
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<Box sx={{ marginTop: '16px', padding: '16px' }}>
|
|
70
|
+
<StyledAlert severity="error">
|
|
71
|
+
{error?.response?.data?.message ?? error?.message}
|
|
72
|
+
<Button
|
|
73
|
+
className="retryBtn"
|
|
74
|
+
onClick={() => resetErrorBoundary()}
|
|
75
|
+
size="small"
|
|
76
|
+
color="error"
|
|
77
|
+
variant="outlined"
|
|
78
|
+
>
|
|
79
|
+
Try Again
|
|
80
|
+
</Button>
|
|
81
|
+
</StyledAlert>
|
|
82
|
+
</Box>
|
|
83
|
+
)
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
export function PageNotFound({resetBoundary}) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
86
|
+
export function PageNotFound({ resetBoundary }) {
|
|
87
|
+
return (
|
|
88
|
+
<>
|
|
89
|
+
<StyledBox>
|
|
90
|
+
<img
|
|
91
|
+
src={pagenotfound}
|
|
92
|
+
alt="page not found"
|
|
93
|
+
width={470}
|
|
94
|
+
style={{ marginTop: '20px' }}
|
|
95
|
+
/>
|
|
96
|
+
<Typography variant="h1">Page Not Found.</Typography>
|
|
97
|
+
<Button sx={{ marginTop: '20px' }} onClick={() => resetBoundary()}>
|
|
98
|
+
Try Again
|
|
99
|
+
</Button>
|
|
100
|
+
</StyledBox>
|
|
101
|
+
</>
|
|
102
|
+
)
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
export function NoInternet({resetBoundary}) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
105
|
+
export function NoInternet({ resetBoundary }) {
|
|
106
|
+
return (
|
|
107
|
+
<>
|
|
108
|
+
<StyledBox>
|
|
109
|
+
<img src={nointernet} alt="No Internet Found" width={470} />
|
|
110
|
+
<Typography variant="h1">No Internet Found.</Typography>
|
|
111
|
+
<Button sx={{ marginTop: '20px' }} onClick={() => resetBoundary()}>
|
|
112
|
+
Try Again
|
|
113
|
+
</Button>
|
|
114
|
+
</StyledBox>
|
|
115
|
+
</>
|
|
116
|
+
)
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
export function PemissionDenied({resetBoundary}) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
119
|
+
export function PemissionDenied({ resetBoundary }) {
|
|
120
|
+
return (
|
|
121
|
+
<>
|
|
122
|
+
<StyledBox>
|
|
123
|
+
<img src={permissiondenied} alt="permission denied" width={470} />
|
|
124
|
+
<Typography variant="h1">Permission Denied.</Typography>
|
|
125
|
+
<Button sx={{ marginTop: '20px' }} onClick={() => resetBoundary()}>
|
|
126
|
+
Try Again
|
|
127
|
+
</Button>
|
|
128
|
+
</StyledBox>
|
|
129
|
+
</>
|
|
130
|
+
)
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
export function InternalServer({resetBoundary, error}) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
133
|
+
export function InternalServer({ resetBoundary, error }) {
|
|
134
|
+
return (
|
|
135
|
+
<>
|
|
136
|
+
<StyledBox>
|
|
137
|
+
<img src={internalserver} alt="internal server error" width={470} />
|
|
138
|
+
<Typography variant="h1" marginTop={'20px'}>
|
|
139
|
+
Internal Server Error.
|
|
140
|
+
</Typography>
|
|
141
|
+
<Typography variant="body1">
|
|
142
|
+
{error?.response?.data?.message}
|
|
143
|
+
</Typography>
|
|
144
|
+
<Button
|
|
145
|
+
size="small"
|
|
146
|
+
variant="outlined"
|
|
147
|
+
sx={{ marginTop: '20px' }}
|
|
148
|
+
onClick={() => resetBoundary()}
|
|
149
|
+
>
|
|
150
|
+
Try Again
|
|
151
|
+
</Button>
|
|
152
|
+
</StyledBox>
|
|
153
|
+
</>
|
|
154
|
+
)
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
export function UnAuth({resetBoundary}) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
157
|
+
export function UnAuth({ resetBoundary }) {
|
|
158
|
+
const modal = useModal()
|
|
159
|
+
const [username, setUsername] = useState('')
|
|
160
|
+
const [loading, setLoading] = useState(false)
|
|
161
|
+
|
|
162
|
+
const url = window.location.origin
|
|
163
|
+
const origin = window?.location?.origin?.split('.')
|
|
164
|
+
const isLocalHost =
|
|
165
|
+
process.env.NODE_ENV === 'development' ||
|
|
166
|
+
origin?.slice(-2).join('.') === 'campx.dev'
|
|
167
|
+
const sessionCookie = Cookies.get('campx_session_key')
|
|
168
|
+
const appinit = async () => {
|
|
169
|
+
setLoading(true)
|
|
170
|
+
await axios
|
|
171
|
+
.get('/auth/my-permissions')
|
|
172
|
+
.then((res) => {
|
|
173
|
+
setUsername(res.data.user.fullName)
|
|
174
|
+
PermissionsStore.update((s) => {
|
|
175
|
+
s.permissions = {
|
|
176
|
+
...res.data?.permissions,
|
|
177
|
+
can_settings_view: 1,
|
|
178
|
+
can_dashboard_view: 1,
|
|
179
|
+
can_individual_pages_view: 1,
|
|
180
|
+
} as any
|
|
181
|
+
})
|
|
182
|
+
setLoading(false)
|
|
183
|
+
})
|
|
184
|
+
.catch((e) => {
|
|
185
|
+
modal({
|
|
186
|
+
title: 'Login',
|
|
187
|
+
content: () => <LoginForm />,
|
|
188
|
+
})
|
|
189
|
+
})
|
|
190
|
+
}
|
|
191
|
+
function LoginPage() {
|
|
192
|
+
if (isLocalHost) {
|
|
193
|
+
if (!sessionCookie) {
|
|
194
|
+
modal({
|
|
195
|
+
title: 'Login',
|
|
196
|
+
content: () => <LoginForm />,
|
|
197
|
+
})
|
|
198
|
+
} else {
|
|
199
|
+
appinit()
|
|
200
|
+
}
|
|
201
|
+
} else {
|
|
202
|
+
if (!sessionCookie) {
|
|
203
|
+
window.location.replace(`https://www.id.campx.in/?redirect_to=${url}`)
|
|
204
|
+
} else {
|
|
205
|
+
appinit()
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return (
|
|
211
|
+
<>
|
|
212
|
+
<StyledBox>
|
|
213
|
+
<img src={unauth} alt="unauthorized" width={470} />
|
|
214
|
+
<Typography variant="h1" marginTop={'20px'}>
|
|
215
|
+
UnAuthorized.
|
|
216
|
+
</Typography>
|
|
217
|
+
<Box
|
|
218
|
+
sx={{
|
|
219
|
+
display: 'flex',
|
|
220
|
+
marginTop: '20px',
|
|
221
|
+
}}
|
|
222
|
+
>
|
|
223
|
+
<Button
|
|
224
|
+
variant="outlined"
|
|
225
|
+
sx={{ marginRight: '10px' }}
|
|
226
|
+
onClick={() => resetBoundary()}
|
|
227
|
+
>
|
|
228
|
+
Try Again
|
|
229
|
+
</Button>
|
|
230
|
+
|
|
231
|
+
<Button onClick={() => LoginPage()}>Click here to Login</Button>
|
|
232
|
+
</Box>
|
|
233
|
+
</StyledBox>
|
|
234
|
+
</>
|
|
235
|
+
)
|
|
236
236
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {Store} from 'pullstate'
|
|
2
|
-
import {LinearProgress} from '../LinearProgress'
|
|
1
|
+
import { Store } from 'pullstate'
|
|
2
|
+
import { LinearProgress } from '../LinearProgress'
|
|
3
3
|
|
|
4
4
|
export const NetworkStore = new Store({
|
|
5
|
-
|
|
5
|
+
loading: false,
|
|
6
6
|
})
|
|
7
7
|
|
|
8
8
|
export default function GlobalNetworkLoadingIndicator() {
|
|
9
|
-
|
|
9
|
+
const { loading } = NetworkStore.useState()
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
if (loading) return <LinearProgress />
|
|
12
|
+
if (loading) return null
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {default} from './ErrorBoundary'
|
|
1
|
+
export { default } from './ErrorBoundary'
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {Box, CircularProgress} from '@mui/material'
|
|
1
|
+
import { Box, CircularProgress } from '@mui/material'
|
|
2
2
|
|
|
3
3
|
const FullScreenLoader = () => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
return (
|
|
5
|
+
<Box
|
|
6
|
+
sx={{
|
|
7
|
+
margin: 0,
|
|
8
|
+
padding: 0,
|
|
9
|
+
height: '100vh',
|
|
10
|
+
width: '100vw',
|
|
11
|
+
display: 'grid',
|
|
12
|
+
placeItems: 'center',
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
15
|
+
<CircularProgress size={60} />
|
|
16
|
+
</Box>
|
|
17
|
+
)
|
|
18
18
|
}
|
|
19
19
|
export default FullScreenLoader
|
|
@@ -111,33 +111,3 @@ export default function FormAutoCompleteSearch({
|
|
|
111
111
|
/>
|
|
112
112
|
)
|
|
113
113
|
}
|
|
114
|
-
|
|
115
|
-
export function MyAutoComplete({
|
|
116
|
-
value,
|
|
117
|
-
onChange,
|
|
118
|
-
options,
|
|
119
|
-
label,
|
|
120
|
-
loading,
|
|
121
|
-
...props
|
|
122
|
-
}) {
|
|
123
|
-
return (
|
|
124
|
-
<Autocomplete
|
|
125
|
-
loading={loading}
|
|
126
|
-
value={value}
|
|
127
|
-
fullWidth
|
|
128
|
-
freeSolo
|
|
129
|
-
onChange={(e, value) => {
|
|
130
|
-
onChange(value.value)
|
|
131
|
-
}}
|
|
132
|
-
options={options || []}
|
|
133
|
-
getOptionLabel={(option: Option) => option?.label || ''}
|
|
134
|
-
renderInput={(params) => (
|
|
135
|
-
<TextField
|
|
136
|
-
{...params}
|
|
137
|
-
variant="outlined"
|
|
138
|
-
label={<FormLabel label={label} required={props.required} />}
|
|
139
|
-
/>
|
|
140
|
-
)}
|
|
141
|
-
/>
|
|
142
|
-
)
|
|
143
|
-
}
|
|
@@ -111,33 +111,3 @@ export default function AutoCompleteSearch({
|
|
|
111
111
|
/>
|
|
112
112
|
)
|
|
113
113
|
}
|
|
114
|
-
|
|
115
|
-
export function MyAutoComplete({
|
|
116
|
-
value,
|
|
117
|
-
onChange,
|
|
118
|
-
options,
|
|
119
|
-
label,
|
|
120
|
-
loading,
|
|
121
|
-
...props
|
|
122
|
-
}) {
|
|
123
|
-
return (
|
|
124
|
-
<Autocomplete
|
|
125
|
-
loading={loading}
|
|
126
|
-
value={value}
|
|
127
|
-
fullWidth
|
|
128
|
-
freeSolo
|
|
129
|
-
onChange={(e, value) => {
|
|
130
|
-
onChange(value.value)
|
|
131
|
-
}}
|
|
132
|
-
options={options || []}
|
|
133
|
-
getOptionLabel={(option: Option) => option?.label || ''}
|
|
134
|
-
renderInput={(params) => (
|
|
135
|
-
<TextField
|
|
136
|
-
{...params}
|
|
137
|
-
variant="outlined"
|
|
138
|
-
label={<FormLabel label={label} required={props.required} />}
|
|
139
|
-
/>
|
|
140
|
-
)}
|
|
141
|
-
/>
|
|
142
|
-
)
|
|
143
|
-
}
|