@campxdev/shared 1.11.1 → 1.11.3
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/package.json +1 -1
- package/src/components/HookForm/AutoCompleteSearch.tsx +6 -0
- package/src/components/HookForm/MultiCheckbox.tsx +9 -6
- package/src/components/HookForm/MultiSelect.tsx +3 -0
- package/src/components/HookForm/RadioGroup.tsx +3 -0
- package/src/components/Input/MultiCheckbox.tsx +4 -2
- package/src/components/Input/MultiSelect.tsx +4 -0
- package/src/components/Input/RadioGroup.tsx +2 -2
- package/src/components/ReportHeader.tsx +18 -5
- package/src/config/axios.ts +6 -1
package/package.json
CHANGED
|
@@ -23,6 +23,7 @@ interface MultiSelectProps {
|
|
|
23
23
|
loading?: boolean
|
|
24
24
|
[key: string]: any
|
|
25
25
|
multiple?: boolean
|
|
26
|
+
disabled?: boolean
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export default function FormAutoCompleteSearch({
|
|
@@ -33,6 +34,7 @@ export default function FormAutoCompleteSearch({
|
|
|
33
34
|
loading, // pass this variable when options are from an async operation
|
|
34
35
|
hookForm = true,
|
|
35
36
|
multiple = false,
|
|
37
|
+
disabled = false,
|
|
36
38
|
...props
|
|
37
39
|
}: MultiSelectProps) {
|
|
38
40
|
if (!hookForm) {
|
|
@@ -44,12 +46,14 @@ export default function FormAutoCompleteSearch({
|
|
|
44
46
|
onChange={(e, value) => {
|
|
45
47
|
props.onChange(value)
|
|
46
48
|
}}
|
|
49
|
+
disabled={disabled}
|
|
47
50
|
options={options || []}
|
|
48
51
|
getOptionLabel={(option: Option) => option?.label || ''}
|
|
49
52
|
renderInput={(params) => (
|
|
50
53
|
<TextField
|
|
51
54
|
variant="outlined"
|
|
52
55
|
label={<FormLabel label={label} required={props.required} />}
|
|
56
|
+
disabled={disabled}
|
|
53
57
|
{...params}
|
|
54
58
|
/>
|
|
55
59
|
)}
|
|
@@ -74,11 +78,13 @@ export default function FormAutoCompleteSearch({
|
|
|
74
78
|
}}
|
|
75
79
|
options={options || []}
|
|
76
80
|
getOptionLabel={(option: Option) => option?.label || ''}
|
|
81
|
+
disabled={disabled}
|
|
77
82
|
renderInput={(params) => (
|
|
78
83
|
<TextField
|
|
79
84
|
error={Boolean(error)}
|
|
80
85
|
variant="outlined"
|
|
81
86
|
label={<FormLabel label={label} required={props.required} />}
|
|
87
|
+
disabled={disabled}
|
|
82
88
|
InputProps={{
|
|
83
89
|
...params.InputProps,
|
|
84
90
|
endAdornment: (
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
import { ReactNode } from 'react'
|
|
9
9
|
import { Controller } from 'react-hook-form'
|
|
10
10
|
import { FormLabel, SingleCheckbox } from '../Input'
|
|
11
|
-
import { IOption } from '../Input/types'
|
|
12
11
|
|
|
13
12
|
interface Props extends FormGroupProps {
|
|
14
13
|
label?: ReactNode
|
|
15
14
|
name: string
|
|
16
15
|
control: any
|
|
17
|
-
options:
|
|
16
|
+
options: { label: ReactNode; value: any; disabled?: boolean }[]
|
|
18
17
|
required?: boolean
|
|
18
|
+
disabled?: boolean
|
|
19
19
|
row?: boolean
|
|
20
20
|
containerProps?: BoxProps
|
|
21
21
|
disableSelected?: boolean
|
|
@@ -29,6 +29,7 @@ export default function FormMultiCheckbox({
|
|
|
29
29
|
required = false,
|
|
30
30
|
row = true,
|
|
31
31
|
disableSelected = false,
|
|
32
|
+
disabled = false,
|
|
32
33
|
containerProps,
|
|
33
34
|
...rest
|
|
34
35
|
}: Props) {
|
|
@@ -45,10 +46,12 @@ export default function FormMultiCheckbox({
|
|
|
45
46
|
key={index}
|
|
46
47
|
name={name}
|
|
47
48
|
disabled={
|
|
48
|
-
disableSelected &&
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
(disableSelected &&
|
|
50
|
+
field?.value
|
|
51
|
+
?.map((item: any) => item?.value)
|
|
52
|
+
?.includes(item?.value)) ||
|
|
53
|
+
disabled ||
|
|
54
|
+
item?.disabled
|
|
52
55
|
}
|
|
53
56
|
checked={field?.value
|
|
54
57
|
?.map((item: any) => item?.value)
|
|
@@ -17,6 +17,7 @@ interface MultiSelectProps {
|
|
|
17
17
|
reason: AutocompleteInputChangeReason,
|
|
18
18
|
) => void
|
|
19
19
|
required?: boolean
|
|
20
|
+
disabled?: boolean
|
|
20
21
|
value?: IOption[] | IOption
|
|
21
22
|
onChange?: (value: IOption[] | IOption) => void
|
|
22
23
|
multiple?: boolean
|
|
@@ -31,6 +32,7 @@ export default function FormMultiSelect({
|
|
|
31
32
|
label,
|
|
32
33
|
loading,
|
|
33
34
|
required,
|
|
35
|
+
disabled = false,
|
|
34
36
|
multiple = true,
|
|
35
37
|
noOptionsText,
|
|
36
38
|
onInputChange,
|
|
@@ -56,6 +58,7 @@ export default function FormMultiSelect({
|
|
|
56
58
|
error={!!error}
|
|
57
59
|
noOptionsText={noOptionsText}
|
|
58
60
|
required={required}
|
|
61
|
+
disabled={disabled}
|
|
59
62
|
helperText={error ? error.message : null}
|
|
60
63
|
limitTags={limitTags}
|
|
61
64
|
{...props}
|
|
@@ -10,6 +10,7 @@ interface Props extends RadioGroupProps {
|
|
|
10
10
|
sx?: any
|
|
11
11
|
row?: boolean
|
|
12
12
|
required?: boolean
|
|
13
|
+
disabled?: boolean
|
|
13
14
|
options: { value: any; label: string | ReactNode; disabled?: boolean }[]
|
|
14
15
|
containerProps?: BoxProps
|
|
15
16
|
}
|
|
@@ -21,6 +22,7 @@ export default function FormRadioGroup({
|
|
|
21
22
|
options = [],
|
|
22
23
|
row = false,
|
|
23
24
|
containerProps,
|
|
25
|
+
disabled = false,
|
|
24
26
|
...rest
|
|
25
27
|
}: Props) {
|
|
26
28
|
return (
|
|
@@ -36,6 +38,7 @@ export default function FormRadioGroup({
|
|
|
36
38
|
options={options}
|
|
37
39
|
value={field.value}
|
|
38
40
|
onChange={field.onChange}
|
|
41
|
+
disabled={disabled}
|
|
39
42
|
error={error ? true : false}
|
|
40
43
|
helperText={error ? error?.message : null}
|
|
41
44
|
{...rest}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Box, BoxProps, FormGroup, FormHelperText } from '@mui/material'
|
|
2
2
|
import { ReactNode } from 'react'
|
|
3
|
-
import { Controller } from 'react-hook-form'
|
|
4
3
|
import FormLabel from './FormLabel'
|
|
5
4
|
import SingleCheckbox from './SingleCheckbox'
|
|
6
5
|
|
|
@@ -8,8 +7,9 @@ interface Props {
|
|
|
8
7
|
label?: ReactNode
|
|
9
8
|
name: string
|
|
10
9
|
size?: 'small' | 'medium'
|
|
11
|
-
options: Array<{ label: ReactNode; value: any }>
|
|
10
|
+
options: Array<{ label: ReactNode; value: any; disabled?: boolean }>
|
|
12
11
|
required?: boolean
|
|
12
|
+
disabled?: boolean
|
|
13
13
|
row?: boolean
|
|
14
14
|
error?: boolean
|
|
15
15
|
helperText?: ReactNode
|
|
@@ -23,6 +23,7 @@ export default function MultiCheckbox({
|
|
|
23
23
|
label,
|
|
24
24
|
options = [],
|
|
25
25
|
required = false,
|
|
26
|
+
disabled = false,
|
|
26
27
|
value = [],
|
|
27
28
|
onChange,
|
|
28
29
|
error,
|
|
@@ -43,6 +44,7 @@ export default function MultiCheckbox({
|
|
|
43
44
|
checked={value
|
|
44
45
|
?.map((item: any) => item?.value)
|
|
45
46
|
?.includes(item?.value)}
|
|
47
|
+
disabled={disabled || item?.disabled}
|
|
46
48
|
onChange={(e) => {
|
|
47
49
|
if (e.target.checked) {
|
|
48
50
|
let newValue = [...value, item]
|
|
@@ -83,6 +83,7 @@ interface MultiSelectProps {
|
|
|
83
83
|
reason: AutocompleteInputChangeReason,
|
|
84
84
|
) => void
|
|
85
85
|
required?: boolean
|
|
86
|
+
disabled?: boolean
|
|
86
87
|
error?: boolean
|
|
87
88
|
helperText?: string
|
|
88
89
|
multiple?: boolean
|
|
@@ -99,6 +100,7 @@ export default function MultiSelect({
|
|
|
99
100
|
onChange,
|
|
100
101
|
onInputChange,
|
|
101
102
|
required,
|
|
103
|
+
disabled = false,
|
|
102
104
|
error,
|
|
103
105
|
noOptionsText,
|
|
104
106
|
helperText,
|
|
@@ -126,6 +128,7 @@ export default function MultiSelect({
|
|
|
126
128
|
option?.value === value?.value
|
|
127
129
|
}
|
|
128
130
|
disableCloseOnSelect
|
|
131
|
+
disabled={disabled}
|
|
129
132
|
PopperComponent={StyledPopper}
|
|
130
133
|
renderOption={(props, option: any, { selected }) => (
|
|
131
134
|
<li {...props}>
|
|
@@ -145,6 +148,7 @@ export default function MultiSelect({
|
|
|
145
148
|
helperText={helperText}
|
|
146
149
|
label={label}
|
|
147
150
|
required={required}
|
|
151
|
+
disabled={disabled}
|
|
148
152
|
InputProps={{
|
|
149
153
|
...params.InputProps,
|
|
150
154
|
endAdornment: (
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
BoxProps,
|
|
4
4
|
FormControlLabel,
|
|
5
5
|
FormHelperText,
|
|
6
|
-
Radio,
|
|
7
6
|
RadioGroup as MuiRadioGroup,
|
|
7
|
+
Radio,
|
|
8
8
|
RadioGroupProps,
|
|
9
9
|
styled,
|
|
10
10
|
} from '@mui/material'
|
|
@@ -97,7 +97,7 @@ export default function RadioGroup(props: Props) {
|
|
|
97
97
|
<Radio
|
|
98
98
|
checkedIcon={<BpCheckedIcon />}
|
|
99
99
|
icon={<BpIcon />}
|
|
100
|
-
disabled={disabled || item.disabled}
|
|
100
|
+
disabled={disabled || item.disabled}
|
|
101
101
|
/>
|
|
102
102
|
}
|
|
103
103
|
label={item.label}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box, SxProps, Typography } from '@mui/material'
|
|
1
|
+
import { Box, Divider, SxProps, Typography } from '@mui/material'
|
|
2
2
|
import { Variant } from '@mui/material/styles/createTypography'
|
|
3
3
|
import _ from 'lodash'
|
|
4
4
|
import { PermissionsStore } from '../shared-state'
|
|
@@ -44,12 +44,14 @@ export interface ReportHeaderProps {
|
|
|
44
44
|
headerType?: ReportHeaderType
|
|
45
45
|
reportHeaderImageUrl?: string
|
|
46
46
|
reportHeaderImageCSS?: any
|
|
47
|
-
typographyList?: ReportHeaderTypographyProps[]
|
|
48
47
|
logoImageUrl?: string
|
|
49
48
|
logoImageCSS?: any
|
|
50
|
-
address?: ReportHeaderOptionalTypographyProps
|
|
51
49
|
recognitionDetails?: ReportHeaderOptionalTypographyProps
|
|
50
|
+
address?: ReportHeaderOptionalTypographyProps
|
|
52
51
|
phone?: ReportHeaderOptionalTypographyProps
|
|
52
|
+
showDivider?: boolean
|
|
53
|
+
dividerSx?: SxProps
|
|
54
|
+
typographyList?: ReportHeaderTypographyProps[]
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
export default function ReportHeader({
|
|
@@ -57,7 +59,6 @@ export default function ReportHeader({
|
|
|
57
59
|
headerType,
|
|
58
60
|
reportHeaderImageUrl,
|
|
59
61
|
reportHeaderImageCSS,
|
|
60
|
-
typographyList,
|
|
61
62
|
logoImageUrl,
|
|
62
63
|
logoImageCSS,
|
|
63
64
|
address: {
|
|
@@ -78,6 +79,9 @@ export default function ReportHeader({
|
|
|
78
79
|
text: phoneText,
|
|
79
80
|
sx: phoneSx,
|
|
80
81
|
},
|
|
82
|
+
showDivider = false,
|
|
83
|
+
dividerSx,
|
|
84
|
+
typographyList,
|
|
81
85
|
}: ReportHeaderProps) {
|
|
82
86
|
const { masterInstitutionUniqueId, institutionType } =
|
|
83
87
|
PermissionsStore.useState((s) => ({
|
|
@@ -98,6 +102,7 @@ export default function ReportHeader({
|
|
|
98
102
|
flexDirection: 'column',
|
|
99
103
|
alignItems: 'center',
|
|
100
104
|
gap: '5px',
|
|
105
|
+
marginBottom: '15px',
|
|
101
106
|
...containerSx,
|
|
102
107
|
}}
|
|
103
108
|
>
|
|
@@ -107,7 +112,7 @@ export default function ReportHeader({
|
|
|
107
112
|
style={{
|
|
108
113
|
objectFit: 'contain',
|
|
109
114
|
width: '100%',
|
|
110
|
-
height: '
|
|
115
|
+
height: '100px',
|
|
111
116
|
...reportHeaderImageCSS,
|
|
112
117
|
}}
|
|
113
118
|
src={
|
|
@@ -154,6 +159,14 @@ export default function ReportHeader({
|
|
|
154
159
|
)}
|
|
155
160
|
</>
|
|
156
161
|
)}
|
|
162
|
+
|
|
163
|
+
{showDivider && (
|
|
164
|
+
<Divider
|
|
165
|
+
flexItem
|
|
166
|
+
variant="middle"
|
|
167
|
+
sx={{ m: '15px', borderColor: '#000000', ...dividerSx }}
|
|
168
|
+
/>
|
|
169
|
+
)}
|
|
157
170
|
{typographyList &&
|
|
158
171
|
typographyList.map((s) => (
|
|
159
172
|
<Typography variant={s.variant || 'body1'} sx={s.sx}>
|
package/src/config/axios.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { InstitutionsStore } from '../shared-state/InstitutionsStore'
|
|
|
8
8
|
const sessionKey = Cookies.get('campx_session_key')
|
|
9
9
|
const clientId = window.location.pathname.split('/')[1] ?? 'campx_dev'
|
|
10
10
|
const institutionId = window.location.pathname.split('/')[2] ?? 'campx_dev'
|
|
11
|
+
const openPaymentsKey = Cookies.get('campx_open_payments_key')
|
|
11
12
|
|
|
12
13
|
export const formatParams = (params) => {
|
|
13
14
|
return Object.fromEntries(
|
|
@@ -23,9 +24,13 @@ let axios = Axios.create({
|
|
|
23
24
|
withCredentials: true,
|
|
24
25
|
headers: {
|
|
25
26
|
'x-tenant-id': clientId,
|
|
26
|
-
...(isDevelopment ||
|
|
27
|
+
...((isDevelopment || isSetup) && sessionKey
|
|
27
28
|
? { campx_session_key: sessionKey }
|
|
28
29
|
: {}),
|
|
30
|
+
|
|
31
|
+
...(openPaymentsKey && {
|
|
32
|
+
campx_open_payments_key: openPaymentsKey,
|
|
33
|
+
}),
|
|
29
34
|
},
|
|
30
35
|
})
|
|
31
36
|
|