@arquimedes.co/eureka-forms 3.0.35-test → 3.0.36-test
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.
|
@@ -7,11 +7,11 @@ import CalendarIcon from '../../Icons/CalendarIcon';
|
|
|
7
7
|
import { renderTimeViewClock } from '@mui/x-date-pickers/timeViewRenderers';
|
|
8
8
|
const StyledDateTimePicker = styled(MuiDateTimePicker, {
|
|
9
9
|
shouldForwardProp: (propName) => propName !== 'size',
|
|
10
|
-
})(({ disabled, size }) => ({
|
|
10
|
+
})(({ disabled, readOnly, size }) => ({
|
|
11
11
|
'& .Erk-MuiInputBase-root': {
|
|
12
|
-
cursor: disabled ? 'default' : 'pointer',
|
|
12
|
+
cursor: (disabled || readOnly) ? 'default' : 'pointer',
|
|
13
13
|
'& input': {
|
|
14
|
-
cursor: disabled ? 'default' : 'pointer',
|
|
14
|
+
cursor: (disabled || readOnly) ? 'default' : 'pointer',
|
|
15
15
|
paddingRight: '0px',
|
|
16
16
|
},
|
|
17
17
|
},
|
|
@@ -20,6 +20,7 @@ const StyledDateTimePicker = styled(MuiDateTimePicker, {
|
|
|
20
20
|
},
|
|
21
21
|
'& .Erk-MuiInputAdornment-root': {
|
|
22
22
|
minWidth: size === 'small' ? 24 : 26,
|
|
23
|
+
pointerEvents: readOnly ? 'none' : undefined,
|
|
23
24
|
'& .Erk-MuiButtonBase-root': {
|
|
24
25
|
margin: '-2px',
|
|
25
26
|
padding: 3,
|
|
@@ -33,11 +34,11 @@ const StyledDateTimePicker = styled(MuiDateTimePicker, {
|
|
|
33
34
|
}));
|
|
34
35
|
const StyledDatePicker = styled(MuiDatePicker, {
|
|
35
36
|
shouldForwardProp: (propName) => propName !== 'size',
|
|
36
|
-
})(({ disabled, size }) => ({
|
|
37
|
+
})(({ disabled, readOnly, size }) => ({
|
|
37
38
|
'& .Erk-MuiInputBase-root': {
|
|
38
|
-
cursor: disabled ? 'default' : 'pointer',
|
|
39
|
+
cursor: (disabled || readOnly) ? 'default' : 'pointer',
|
|
39
40
|
'& input': {
|
|
40
|
-
cursor: disabled ? 'default' : 'pointer',
|
|
41
|
+
cursor: (disabled || readOnly) ? 'default' : 'pointer',
|
|
41
42
|
},
|
|
42
43
|
},
|
|
43
44
|
'& .Erk-MuiInputBase-adornedEnd': {
|
|
@@ -45,6 +46,7 @@ const StyledDatePicker = styled(MuiDatePicker, {
|
|
|
45
46
|
},
|
|
46
47
|
'& .Erk-MuiInputAdornment-root': {
|
|
47
48
|
minWidth: size === 'small' ? 24 : 26,
|
|
49
|
+
pointerEvents: readOnly ? 'none' : undefined,
|
|
48
50
|
'& .Erk-MuiButtonBase-root': {
|
|
49
51
|
margin: '-2px',
|
|
50
52
|
padding: 3,
|
|
@@ -137,11 +139,16 @@ const StyledDay = styled(MuiPickerDay)(({ theme }) => ({
|
|
|
137
139
|
// eslint-disable-next-line react/display-name
|
|
138
140
|
const CustomTextField = forwardRef((props, ref) => {
|
|
139
141
|
const pickerContext = usePickerContext();
|
|
140
|
-
|
|
142
|
+
const handleClick = () => {
|
|
143
|
+
if (!props.disabled && !props.readOnly) {
|
|
144
|
+
pickerContext.setOpen((prev) => !prev);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
return _jsx(StyledTextField, { ...props, inputRef: ref, onClick: handleClick });
|
|
141
148
|
});
|
|
142
149
|
function CustomDatePicker({ error, required, disabled, readOnly, helperText, size = 'small', labelMargin = 5, pickTime = false, ...others }) {
|
|
143
150
|
if (pickTime) {
|
|
144
|
-
return (_jsx(StyledDateTimePicker, { ampm: true, size: size, reduceAnimations: true, ...others, disabled: disabled
|
|
151
|
+
return (_jsx(StyledDateTimePicker, { ampm: true, size: size, reduceAnimations: true, ...others, disabled: disabled, readOnly: readOnly, defaultValue: required ? new Date() : undefined, showDaysOutsideCurrentMonth: true, slotProps: {
|
|
145
152
|
actionBar: {
|
|
146
153
|
actions: ['clear', 'accept'],
|
|
147
154
|
},
|
|
@@ -184,12 +191,13 @@ function CustomDatePicker({ error, required, disabled, readOnly, helperText, siz
|
|
|
184
191
|
error,
|
|
185
192
|
size,
|
|
186
193
|
disabled,
|
|
194
|
+
readOnly: !disabled && readOnly,
|
|
187
195
|
helperText,
|
|
188
196
|
labelMargin,
|
|
189
197
|
placeholder: '',
|
|
190
198
|
fullWidth: true,
|
|
191
199
|
InputProps: {
|
|
192
|
-
|
|
200
|
+
readOnly: !disabled && readOnly,
|
|
193
201
|
},
|
|
194
202
|
},
|
|
195
203
|
}, viewRenderers: {
|
|
@@ -205,7 +213,7 @@ function CustomDatePicker({ error, required, disabled, readOnly, helperText, siz
|
|
|
205
213
|
}, enableAccessibleFieldDOMStructure: false }));
|
|
206
214
|
}
|
|
207
215
|
else {
|
|
208
|
-
return (_jsx(StyledDatePicker, { ...others, size: size, reduceAnimations: true, readOnly: readOnly, disabled: disabled
|
|
216
|
+
return (_jsx(StyledDatePicker, { ...others, size: size, reduceAnimations: true, readOnly: readOnly, disabled: disabled, defaultValue: required ? new Date() : undefined, showDaysOutsideCurrentMonth: true, views: ['year', 'month', 'day'], slotProps: {
|
|
209
217
|
actionBar: {
|
|
210
218
|
actions: ['clear', 'accept'],
|
|
211
219
|
},
|
|
@@ -238,12 +246,13 @@ function CustomDatePicker({ error, required, disabled, readOnly, helperText, siz
|
|
|
238
246
|
size,
|
|
239
247
|
error,
|
|
240
248
|
disabled,
|
|
249
|
+
readOnly: !disabled && readOnly,
|
|
241
250
|
helperText,
|
|
242
251
|
labelMargin,
|
|
243
252
|
fullWidth: true,
|
|
244
253
|
placeholder: '',
|
|
245
254
|
InputProps: {
|
|
246
|
-
|
|
255
|
+
readOnly: !disabled && readOnly,
|
|
247
256
|
},
|
|
248
257
|
},
|
|
249
258
|
}, slots: {
|
|
@@ -10,11 +10,11 @@ import { StyledTextField } from '../ErkTextField/ErkTextField';
|
|
|
10
10
|
import CalendarIcon from '../../Icons/CalendarIcon';
|
|
11
11
|
const StyledDateRangePicker = styled(MuiDateRangePicker, {
|
|
12
12
|
shouldForwardProp: (propName) => propName !== 'size',
|
|
13
|
-
})(({ disabled, size }) => ({
|
|
13
|
+
})(({ disabled, readOnly, size }) => ({
|
|
14
14
|
'& .Erk-MuiInputBase-root': {
|
|
15
|
-
cursor: disabled ? 'default' : 'pointer',
|
|
15
|
+
cursor: disabled || readOnly ? 'default' : 'pointer',
|
|
16
16
|
'& input': {
|
|
17
|
-
cursor: disabled ? 'default' : 'pointer',
|
|
17
|
+
cursor: disabled || readOnly ? 'default' : 'pointer',
|
|
18
18
|
paddingRight: '0px',
|
|
19
19
|
},
|
|
20
20
|
},
|
|
@@ -23,6 +23,7 @@ const StyledDateRangePicker = styled(MuiDateRangePicker, {
|
|
|
23
23
|
},
|
|
24
24
|
'& .Erk-MuiInputAdornment-root': {
|
|
25
25
|
minWidth: size === 'small' ? 24 : 26,
|
|
26
|
+
pointerEvents: readOnly ? 'none' : undefined,
|
|
26
27
|
'& .Erk-MuiButtonBase-root': {
|
|
27
28
|
margin: '-2px',
|
|
28
29
|
padding: 3,
|
|
@@ -87,7 +88,12 @@ const StyledDay = styled(MuiDateRangePickerDay)(({ theme }) => ({
|
|
|
87
88
|
// eslint-disable-next-line react/display-name
|
|
88
89
|
const CustomTextField = React.forwardRef((props, ref) => {
|
|
89
90
|
const pickerContext = usePickerContext();
|
|
90
|
-
|
|
91
|
+
const handleClick = () => {
|
|
92
|
+
if (!props.disabled && !props.readOnly) {
|
|
93
|
+
pickerContext.setOpen((prev) => !prev);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
return _jsx(StyledTextField, { ...props, inputRef: ref, onClick: handleClick });
|
|
91
97
|
});
|
|
92
98
|
const formatDate = (date, showYear) => {
|
|
93
99
|
if (!date || !isValid(date))
|
|
@@ -105,7 +111,7 @@ function CustomDatePickerRange({ error, disabled, readOnly, helperText, size = '
|
|
|
105
111
|
const formattedStartDate = formatDate(startDate, Boolean(showYear));
|
|
106
112
|
const formattedEndDate = formatDate(endDate, Boolean(showYear));
|
|
107
113
|
const toolbarText = hasCompleteRange ? `${formattedStartDate} – ${formattedEndDate}` : '– –';
|
|
108
|
-
return (_jsx(StyledDateRangePicker, { ...others, value: value, onChange: onChange, size: size, disabled: disabled
|
|
114
|
+
return (_jsx(StyledDateRangePicker, { ...others, value: value, onChange: onChange, size: size, disabled: disabled, readOnly: readOnly, reduceAnimations: true, showDaysOutsideCurrentMonth: true, enableAccessibleFieldDOMStructure: false, slots: {
|
|
109
115
|
//TODO: create system for shortcuts customs or default (enums)
|
|
110
116
|
shortcuts: undefined,
|
|
111
117
|
field: SingleInputDateRangeField,
|
|
@@ -152,12 +158,13 @@ function CustomDatePickerRange({ error, disabled, readOnly, helperText, size = '
|
|
|
152
158
|
size,
|
|
153
159
|
error,
|
|
154
160
|
disabled,
|
|
161
|
+
readOnly: !disabled && readOnly,
|
|
155
162
|
helperText,
|
|
156
163
|
labelMargin,
|
|
157
164
|
fullWidth: true,
|
|
158
165
|
placeholder: '',
|
|
159
166
|
InputProps: {
|
|
160
|
-
|
|
167
|
+
readOnly: !disabled && readOnly,
|
|
161
168
|
},
|
|
162
169
|
},
|
|
163
170
|
} }));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arquimedes.co/eureka-forms",
|
|
3
3
|
"repository": "git://github.com/Arquimede5/Eureka-Forms.git",
|
|
4
|
-
"version":"3.0.
|
|
4
|
+
"version":"3.0.36-test",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"watch": "tsgo --noEmit --watch --project tsconfig.app.json",
|
|
7
7
|
"start": "vite",
|
|
@@ -111,4 +111,4 @@
|
|
|
111
111
|
"files": [
|
|
112
112
|
"/dist"
|
|
113
113
|
]
|
|
114
|
-
}
|
|
114
|
+
}
|