@semapps/date-components 1.1.7 → 1.2.1
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.cjs.js +224 -224
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.ts +276 -0
- package/dist/index.d.ts +21 -47
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +218 -229
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.ts +275 -0
- package/package.json +12 -13
package/dist/index.cjs.js
CHANGED
|
@@ -1,244 +1,244 @@
|
|
|
1
|
-
var $3RhHq$reactjsxruntime = require(
|
|
2
|
-
require(
|
|
3
|
-
var $3RhHq$muixdatepickersDatePicker = require(
|
|
4
|
-
var $3RhHq$muixdatepickersTimePicker = require(
|
|
5
|
-
var $3RhHq$muixdatepickersDateTimePicker = require(
|
|
6
|
-
var $3RhHq$react = require(
|
|
7
|
-
var $3RhHq$reactadmin = require(
|
|
8
|
-
var $3RhHq$muixdatepickersLocalizationProvider = require(
|
|
9
|
-
var $3RhHq$muixdatepickersAdapterDateFns = require(
|
|
10
|
-
var $3RhHq$fullcalendarreact = require(
|
|
11
|
-
var $3RhHq$fullcalendardaygrid = require(
|
|
12
|
-
var $3RhHq$muimaterial = require(
|
|
13
|
-
var $3RhHq$
|
|
14
|
-
var $3RhHq$
|
|
15
|
-
|
|
1
|
+
var $3RhHq$reactjsxruntime = require("react/jsx-runtime");
|
|
2
|
+
require("@fullcalendar/react/dist/vdom");
|
|
3
|
+
var $3RhHq$muixdatepickersDatePicker = require("@mui/x-date-pickers/DatePicker");
|
|
4
|
+
var $3RhHq$muixdatepickersTimePicker = require("@mui/x-date-pickers/TimePicker");
|
|
5
|
+
var $3RhHq$muixdatepickersDateTimePicker = require("@mui/x-date-pickers/DateTimePicker");
|
|
6
|
+
var $3RhHq$react = require("react");
|
|
7
|
+
var $3RhHq$reactadmin = require("react-admin");
|
|
8
|
+
var $3RhHq$muixdatepickersLocalizationProvider = require("@mui/x-date-pickers/LocalizationProvider");
|
|
9
|
+
var $3RhHq$muixdatepickersAdapterDateFns = require("@mui/x-date-pickers/AdapterDateFns");
|
|
10
|
+
var $3RhHq$fullcalendarreact = require("@fullcalendar/react");
|
|
11
|
+
var $3RhHq$fullcalendardaygrid = require("@fullcalendar/daygrid");
|
|
12
|
+
var $3RhHq$muimaterial = require("@mui/material");
|
|
13
|
+
var $3RhHq$reactrouterdom = require("react-router-dom");
|
|
14
|
+
var $3RhHq$fullcalendarlist = require("@fullcalendar/list");
|
|
15
|
+
|
|
16
16
|
|
|
17
17
|
function $parcel$export(e, n, v, s) {
|
|
18
|
-
Object.defineProperty(e, n, {
|
|
18
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
function $parcel$interopDefault(a) {
|
|
22
22
|
return a && a.__esModule ? a.default : a;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
$parcel$export(module.exports,
|
|
26
|
-
$parcel$export(module.exports,
|
|
27
|
-
$parcel$export(module.exports,
|
|
28
|
-
$parcel$export(module.exports,
|
|
29
|
-
$parcel$export(module.exports,
|
|
30
|
-
$parcel$export(module.exports,
|
|
25
|
+
$parcel$export(module.exports, "DateInput", () => $0ec82123656742c1$export$7edc06cf1783b30f);
|
|
26
|
+
$parcel$export(module.exports, "TimeInput", () => $0ec82123656742c1$export$a1af6f79df847fac);
|
|
27
|
+
$parcel$export(module.exports, "DateTimeInput", () => $0ec82123656742c1$export$183478aa40b5df1);
|
|
28
|
+
$parcel$export(module.exports, "CalendarList", () => $7d9b1d3645bfb046$export$2e2bcd8739ae039);
|
|
29
|
+
$parcel$export(module.exports, "DaysList", () => $f30a06264cfbf3f1$export$2e2bcd8739ae039);
|
|
30
|
+
$parcel$export(module.exports, "useFullCalendarProps", () => $270c79206b8dbb68$export$2e2bcd8739ae039);
|
|
31
31
|
/* eslint-disable react/react-in-jsx-scope */ /* eslint-disable react/jsx-props-no-spreading */ // Solves bug with Vite in dev mode. Can be removed when we upgrade to FullCalendar v6
|
|
32
32
|
// See https://github.com/fullcalendar/fullcalendar-vue/issues/152
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
else field.onChange(null);
|
|
71
|
-
},
|
|
72
|
-
[field, stringFormat]
|
|
73
|
-
);
|
|
74
|
-
const translateLabel = (0, $3RhHq$reactadmin.useTranslateLabel)();
|
|
75
|
-
const translatedLabel = /*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsxs)('span', {
|
|
76
|
-
children: [
|
|
77
|
-
translateLabel({
|
|
78
|
-
label: label,
|
|
79
|
-
source: source
|
|
80
|
-
}),
|
|
81
|
-
isRequired &&
|
|
82
|
-
/*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsx)('span', {
|
|
83
|
-
'aria-hidden': 'true',
|
|
84
|
-
children: '\u2009*'
|
|
85
|
-
})
|
|
86
|
-
]
|
|
87
|
-
});
|
|
88
|
-
return /*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsx)(
|
|
89
|
-
(0, $3RhHq$muixdatepickersLocalizationProvider.LocalizationProvider),
|
|
90
|
-
{
|
|
91
|
-
dateAdapter: (0, $3RhHq$muixdatepickersAdapterDateFns.AdapterDateFns),
|
|
92
|
-
adapterLocale: locale,
|
|
93
|
-
localeText: translations?.components.MuiLocalizationProvider.defaultProps.localeText,
|
|
94
|
-
children: /*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsx)(PickerComponent, {
|
|
95
|
-
label: translatedLabel,
|
|
96
|
-
slotProps: {
|
|
97
|
-
textField: {
|
|
98
|
-
error: (isTouched || isSubmitted) && invalid,
|
|
99
|
-
size: 'small',
|
|
100
|
-
fullWidth: fullWidth,
|
|
101
|
-
helperText: /*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsx)((0, $3RhHq$reactadmin.InputHelperText), {
|
|
102
|
-
touched: isTouched || isSubmitted,
|
|
103
|
-
error: error?.message,
|
|
104
|
-
helperText: helperText
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/* eslint-disable react/react-in-jsx-scope */ /* eslint-disable react/require-default-props */
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
const $c332daa71b957685$var$Picker = ({ PickerComponent: PickerComponent, label: label, source: source, helperText: helperText, fullWidth: fullWidth, onBlur: onBlur, onChange: onChange, format: format, parse: parse, validate: validate, defaultValue: defaultValue, locale: locale, translations: translations, stringFormat: stringFormat = 'ISO', ...rest })=>{
|
|
44
|
+
const { field: field, isRequired: isRequired, fieldState: { error: error, isTouched: isTouched, invalid: invalid }, formState: { isSubmitted: isSubmitted } } = (0, $3RhHq$reactadmin.useInput)({
|
|
45
|
+
format: format,
|
|
46
|
+
onBlur: onBlur,
|
|
47
|
+
onChange: onChange,
|
|
48
|
+
parse: parse,
|
|
49
|
+
source: source,
|
|
50
|
+
validate: validate,
|
|
51
|
+
defaultValue: defaultValue
|
|
52
|
+
});
|
|
53
|
+
const handleChange = (0, $3RhHq$react.useCallback)((value)=>{
|
|
54
|
+
if (value instanceof Date) field.onChange(stringFormat === 'ISO' ? value.toISOString() : value.toString());
|
|
55
|
+
else field.onChange(null);
|
|
56
|
+
}, [
|
|
57
|
+
field,
|
|
58
|
+
stringFormat
|
|
59
|
+
]);
|
|
60
|
+
const translateLabel = (0, $3RhHq$reactadmin.useTranslateLabel)();
|
|
61
|
+
const translatedLabel = /*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsxs)("span", {
|
|
62
|
+
children: [
|
|
63
|
+
translateLabel({
|
|
64
|
+
label: label,
|
|
65
|
+
source: source
|
|
66
|
+
}),
|
|
67
|
+
isRequired && /*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsx)("span", {
|
|
68
|
+
"aria-hidden": "true",
|
|
69
|
+
children: "\u2009*"
|
|
105
70
|
})
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
71
|
+
]
|
|
72
|
+
});
|
|
73
|
+
return /*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsx)((0, $3RhHq$muixdatepickersLocalizationProvider.LocalizationProvider), {
|
|
74
|
+
dateAdapter: (0, $3RhHq$muixdatepickersAdapterDateFns.AdapterDateFns),
|
|
75
|
+
adapterLocale: locale,
|
|
76
|
+
localeText: translations?.components.MuiLocalizationProvider.defaultProps.localeText,
|
|
77
|
+
children: /*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsx)(PickerComponent, {
|
|
78
|
+
label: translatedLabel,
|
|
79
|
+
slotProps: {
|
|
80
|
+
textField: {
|
|
81
|
+
error: (isTouched || isSubmitted) && invalid,
|
|
82
|
+
size: 'small',
|
|
83
|
+
fullWidth: fullWidth,
|
|
84
|
+
helperText: // @ts-expect-error TS(2322): Type '{ touched: boolean; error: string | undefine... Remove this comment to see the full error message
|
|
85
|
+
/*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsx)((0, $3RhHq$reactadmin.InputHelperText), {
|
|
86
|
+
touched: isTouched || isSubmitted,
|
|
87
|
+
error: error?.message,
|
|
88
|
+
helperText: helperText
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
value: field.value ? new Date(field.value) : null,
|
|
93
|
+
onChange: handleChange,
|
|
94
|
+
...rest
|
|
95
|
+
})
|
|
96
|
+
});
|
|
114
97
|
};
|
|
115
98
|
var $c332daa71b957685$export$2e2bcd8739ae039 = $c332daa71b957685$var$Picker;
|
|
116
99
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
.map(record
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
'@global': {
|
|
173
|
-
'.fc-button': {
|
|
174
|
-
backgroundColor: `${theme.palette.primary.main} !important`,
|
|
175
|
-
border: 'none !important',
|
|
176
|
-
opacity: '1 !important'
|
|
177
|
-
},
|
|
178
|
-
'.fc-day-today': {
|
|
179
|
-
backgroundColor: `${theme.palette.secondary.light} !important`
|
|
180
|
-
},
|
|
181
|
-
// Overwrite violet color of links
|
|
182
|
-
'a.fc-daygrid-dot-event': {
|
|
183
|
-
color: 'black !important'
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}));
|
|
187
|
-
const $563c84827e91e322$var$CalendarList = props => {
|
|
188
|
-
const theme = (0, $3RhHq$muimaterial.useTheme)();
|
|
189
|
-
const fullCalendarProps = (0, $c8dbd8ec3b8f34cc$export$2e2bcd8739ae039)(props);
|
|
190
|
-
$563c84827e91e322$var$useGlobalStyles();
|
|
191
|
-
return /*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsx)((0, $parcel$interopDefault($3RhHq$fullcalendarreact)), {
|
|
192
|
-
plugins: [(0, $parcel$interopDefault($3RhHq$fullcalendardaygrid))],
|
|
193
|
-
locale: props.locale,
|
|
194
|
-
initialView: 'dayGridMonth',
|
|
195
|
-
eventBackgroundColor: theme.palette.primary.main,
|
|
196
|
-
...fullCalendarProps
|
|
197
|
-
});
|
|
198
|
-
};
|
|
199
|
-
$563c84827e91e322$var$CalendarList.defaultProps = {
|
|
200
|
-
linkType: 'edit'
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
const $270c79206b8dbb68$var$useFullCalendarProps = ({ label: label, startDate: startDate, endDate: endDate, linkType: linkType = 'edit' })=>{
|
|
110
|
+
const { data: data, isLoading: isLoading, resource: resource } = (0, $3RhHq$reactadmin.useListContext)();
|
|
111
|
+
const [searchParams, setSearchParams] = (0, $3RhHq$reactrouterdom.useSearchParams)();
|
|
112
|
+
const navigate = (0, $3RhHq$reactrouterdom.useNavigate)();
|
|
113
|
+
const createPath = (0, $3RhHq$reactadmin.useCreatePath)();
|
|
114
|
+
const query = new URLSearchParams(location.search);
|
|
115
|
+
// Bypass the link in order to use React-Router
|
|
116
|
+
const eventClick = (0, $3RhHq$react.useCallback)(({ event: event, jsEvent: jsEvent })=>{
|
|
117
|
+
jsEvent.preventDefault();
|
|
118
|
+
navigate(event.url);
|
|
119
|
+
}, []);
|
|
120
|
+
// Change the query string when month change
|
|
121
|
+
const datesSet = (0, $3RhHq$react.useCallback)(({ view: view })=>{
|
|
122
|
+
// @ts-expect-error TS(2345): Argument of type '(params: URLSearchParams) => { m... Remove this comment to see the full error message
|
|
123
|
+
setSearchParams((params)=>({
|
|
124
|
+
...params,
|
|
125
|
+
month: view.currentStart.getMonth() + 1,
|
|
126
|
+
year: view.currentStart.getFullYear()
|
|
127
|
+
}));
|
|
128
|
+
}, [
|
|
129
|
+
setSearchParams
|
|
130
|
+
]);
|
|
131
|
+
const events = (0, $3RhHq$react.useMemo)(()=>!isLoading && // @ts-expect-error TS(2532): Object is possibly 'undefined'.
|
|
132
|
+
data.filter((record)=>record).map((record)=>({
|
|
133
|
+
id: record.id,
|
|
134
|
+
title: typeof label === 'string' ? record[label] : label(record),
|
|
135
|
+
start: typeof startDate === 'string' ? record[startDate] : startDate(record),
|
|
136
|
+
end: typeof endDate === 'string' ? record[endDate] : endDate(record),
|
|
137
|
+
url: createPath({
|
|
138
|
+
resource: resource,
|
|
139
|
+
id: record.id,
|
|
140
|
+
type: linkType
|
|
141
|
+
})
|
|
142
|
+
})), [
|
|
143
|
+
isLoading,
|
|
144
|
+
data,
|
|
145
|
+
resource,
|
|
146
|
+
createPath
|
|
147
|
+
]);
|
|
148
|
+
return {
|
|
149
|
+
// @ts-expect-error TS(2345): Argument of type 'string | null' is not assignable... Remove this comment to see the full error message
|
|
150
|
+
initialDate: query.has('month') ? new Date(query.get('year'), query.get('month') - 1) : new Date(),
|
|
151
|
+
events: events,
|
|
152
|
+
datesSet: datesSet,
|
|
153
|
+
eventClick: eventClick
|
|
154
|
+
};
|
|
201
155
|
};
|
|
202
|
-
var $
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
156
|
+
var $270c79206b8dbb68$export$2e2bcd8739ae039 = $270c79206b8dbb68$var$useFullCalendarProps;
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
const $7d9b1d3645bfb046$var$CalendarList = (props)=>{
|
|
160
|
+
const theme = (0, $3RhHq$muimaterial.useTheme)();
|
|
161
|
+
const fullCalendarProps = (0, $270c79206b8dbb68$export$2e2bcd8739ae039)(props);
|
|
162
|
+
return /*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsxs)((0, $3RhHq$reactjsxruntime.Fragment), {
|
|
163
|
+
children: [
|
|
164
|
+
/*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsx)((0, $3RhHq$muimaterial.GlobalStyles), {
|
|
165
|
+
styles: (theme)=>({
|
|
166
|
+
'.fc-button': {
|
|
167
|
+
backgroundColor: `${theme.palette.primary.main} !important`,
|
|
168
|
+
border: 'none !important',
|
|
169
|
+
opacity: '1 !important'
|
|
170
|
+
},
|
|
171
|
+
'.fc-day-today': {
|
|
172
|
+
backgroundColor: `${theme.palette.secondary.light} !important`
|
|
173
|
+
},
|
|
174
|
+
// Overwrite violet color of links
|
|
175
|
+
'a.fc-daygrid-dot-event': {
|
|
176
|
+
color: 'black !important'
|
|
177
|
+
}
|
|
178
|
+
})
|
|
179
|
+
}),
|
|
180
|
+
/*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsx)((0, ($parcel$interopDefault($3RhHq$fullcalendarreact))), {
|
|
181
|
+
plugins: [
|
|
182
|
+
(0, ($parcel$interopDefault($3RhHq$fullcalendardaygrid)))
|
|
183
|
+
],
|
|
184
|
+
locale: props.locale,
|
|
185
|
+
initialView: "dayGridMonth",
|
|
186
|
+
eventBackgroundColor: theme.palette.primary.main,
|
|
187
|
+
...fullCalendarProps
|
|
188
|
+
})
|
|
189
|
+
]
|
|
190
|
+
});
|
|
222
191
|
};
|
|
223
|
-
$
|
|
224
|
-
|
|
192
|
+
var $7d9b1d3645bfb046$export$2e2bcd8739ae039 = $7d9b1d3645bfb046$var$CalendarList;
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
const $f30a06264cfbf3f1$var$DaysList = (props)=>{
|
|
202
|
+
const fullCalendarProps = (0, $270c79206b8dbb68$export$2e2bcd8739ae039)(props);
|
|
203
|
+
return /*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsxs)((0, $3RhHq$reactjsxruntime.Fragment), {
|
|
204
|
+
children: [
|
|
205
|
+
/*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsx)((0, $3RhHq$muimaterial.GlobalStyles), {
|
|
206
|
+
styles: (theme)=>({
|
|
207
|
+
'.fc-button': {
|
|
208
|
+
backgroundColor: `${theme.palette.primary.main} !important`,
|
|
209
|
+
border: 'none !important',
|
|
210
|
+
opacity: '1 !important'
|
|
211
|
+
}
|
|
212
|
+
})
|
|
213
|
+
}),
|
|
214
|
+
/*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsx)((0, ($parcel$interopDefault($3RhHq$fullcalendarreact))), {
|
|
215
|
+
plugins: [
|
|
216
|
+
(0, ($parcel$interopDefault($3RhHq$fullcalendarlist)))
|
|
217
|
+
],
|
|
218
|
+
locale: props.locale,
|
|
219
|
+
initialView: "listMonth",
|
|
220
|
+
...fullCalendarProps
|
|
221
|
+
}),
|
|
222
|
+
";"
|
|
223
|
+
]
|
|
224
|
+
});
|
|
225
225
|
};
|
|
226
|
-
var $
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
const $0ec82123656742c1$export$183478aa40b5df1 = props
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
226
|
+
var $f30a06264cfbf3f1$export$2e2bcd8739ae039 = $f30a06264cfbf3f1$var$DaysList;
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
const $0ec82123656742c1$export$7edc06cf1783b30f = (props)=>/*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsx)((0, $c332daa71b957685$export$2e2bcd8739ae039), {
|
|
231
|
+
PickerComponent: (0, $3RhHq$muixdatepickersDatePicker.DatePicker),
|
|
232
|
+
...props
|
|
233
|
+
});
|
|
234
|
+
const $0ec82123656742c1$export$a1af6f79df847fac = (props)=>/*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsx)((0, $c332daa71b957685$export$2e2bcd8739ae039), {
|
|
235
|
+
PickerComponent: (0, $3RhHq$muixdatepickersTimePicker.TimePicker),
|
|
236
|
+
...props
|
|
237
|
+
});
|
|
238
|
+
const $0ec82123656742c1$export$183478aa40b5df1 = (props)=>/*#__PURE__*/ (0, $3RhHq$reactjsxruntime.jsx)((0, $c332daa71b957685$export$2e2bcd8739ae039), {
|
|
239
|
+
PickerComponent: (0, $3RhHq$muixdatepickersDateTimePicker.DateTimePicker),
|
|
240
|
+
...props
|
|
241
|
+
});
|
|
242
|
+
|
|
243
243
|
|
|
244
244
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA2C,GAC3C,+CAA+C,GAE/C,sFAAsF;AACtF,kEAAkE;;;;;;ACJlE,2CAA2C,GAC3C,8CAA8C;;;;;AAgB9C,MAAM,+BAAS,CAAe,mBAC5B,eAAe,SACf,KAAK,UACL,MAAM,cACN,UAAU,aACV,SAAS,UACT,MAAM,YACN,QAAQ,UACR,MAAM,SACN,KAAK,YACL,QAAQ,gBACR,YAAY,UACZ,MAAM,gBACN,YAAY,gBACZ,eAAe,OACf,GAAG,MACgB;IACnB,MAAM,SACJ,KAAK,cACL,UAAU,EACV,YAAY,SAAE,KAAK,aAAE,SAAS,WAAE,OAAO,EAAE,EACzC,W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K;QAAE,iBAAiB,CAAA,GAAA,2CAAS;QAAI,GAAG,KAAK;;AAEhD,MAAM,2CAAgB,CAAS,sBAC7B,gCAAC,CAAA,GAAA,wCAAK;QAAE,iBAAiB,CAAA,GAAA,mDAAa;QAAI,GAAG,KAAK","sources":["packages/date-components/src/index.tsx","packages/date-components/src/Picker.tsx","packages/date-components/src/CalendarList.js","packages/date-components/src/useFullCalendarProps.js","packages/date-components/src/DaysList.js"],"sourcesContent":["/* eslint-disable react/react-in-jsx-scope */\n/* eslint-disable react/jsx-props-no-spreading */\n\n// Solves bug with Vite in dev mode. Can be removed when we upgrade to FullCalendar v6\n// See https://github.com/fullcalendar/fullcalendar-vue/issues/152\nimport '@fullcalendar/core/vdom';\n\nimport { DatePicker, DatePickerProps } from '@mui/x-date-pickers/DatePicker';\nimport { TimePicker, TimePickerProps } from '@mui/x-date-pickers/TimePicker';\nimport { DateTimePicker, DateTimePickerProps } from '@mui/x-date-pickers/DateTimePicker';\nimport Picker, { Props as PickerProps } from './Picker';\n\nconst DateInput = <TDate,>(props: Omit<PickerProps<DatePickerProps<TDate>>, 'PickerComponent'>) => (\n <Picker PickerComponent={DatePicker} {...props} />\n);\nconst TimeInput = <TDate,>(props: Omit<PickerProps<TimePickerProps<TDate>>, 'PickerComponent'>) => (\n <Picker PickerComponent={TimePicker} {...props} />\n);\nconst DateTimeInput = <TDate,>(props: Omit<PickerProps<DateTimePickerProps<TDate>>, 'PickerComponent'>) => (\n <Picker PickerComponent={DateTimePicker} {...props} />\n);\n\nexport { DateInput, TimeInput, DateTimeInput };\n\nexport { default as CalendarList } from './CalendarList';\nexport { default as DaysList } from './DaysList';\nexport { default as useFullCalendarProps } from './useFullCalendarProps';\n","/* eslint-disable react/react-in-jsx-scope */\n/* eslint-disable react/require-default-props */\nimport { useCallback, ComponentType } from 'react';\nimport { useInput, InputHelperText, TextInputProps, useTranslateLabel } from 'react-admin';\nimport { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';\nimport { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';\nimport { getPickersLocalization } from '@mui/x-date-pickers/locales/utils/getPickersLocalization';\nimport { Locale } from 'date-fns';\n\nexport type Props<PickerProps> = TextInputProps &\n Omit<PickerProps, 'format'> & {\n PickerComponent: ComponentType;\n locale?: Locale;\n translations?: ReturnType<typeof getPickersLocalization>;\n stringFormat?: string;\n };\n\nconst Picker = <PickerProps,>({\n PickerComponent,\n label,\n source,\n helperText,\n fullWidth,\n onBlur,\n onChange,\n format,\n parse,\n validate,\n defaultValue,\n locale,\n translations,\n stringFormat = 'ISO',\n ...rest\n}: Props<PickerProps>) => {\n const {\n field,\n isRequired,\n fieldState: { error, isTouched, invalid },\n formState: { isSubmitted }\n } = useInput({\n format,\n onBlur,\n onChange,\n parse,\n source,\n validate,\n defaultValue\n });\n\n const handleChange = useCallback(\n (value: Date) => {\n if (value instanceof Date) {\n field.onChange(stringFormat === 'ISO' ? value.toISOString() : value.toString());\n } else {\n field.onChange(null);\n }\n },\n [field, stringFormat]\n );\n\n const translateLabel = useTranslateLabel();\n const translatedLabel = (\n <span>\n {translateLabel({\n label,\n source\n })}\n {isRequired && <span aria-hidden=\"true\"> *</span>}\n </span>\n );\n\n return (\n <LocalizationProvider\n dateAdapter={AdapterDateFns}\n adapterLocale={locale}\n localeText={translations?.components.MuiLocalizationProvider.defaultProps.localeText}\n >\n <PickerComponent\n label={translatedLabel}\n slotProps={{\n textField: {\n error: (isTouched || isSubmitted) && invalid,\n size: 'small',\n fullWidth,\n helperText: (\n <InputHelperText touched={isTouched || isSubmitted} error={error?.message} helperText={helperText} />\n )\n }\n }}\n value={field.value ? new Date(field.value) : null}\n onChange={handleChange}\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n {...rest}\n />\n </LocalizationProvider>\n );\n};\n\nexport default Picker;\n","import React from 'react';\nimport FullCalendar from '@fullcalendar/react';\nimport dayGridPlugin from '@fullcalendar/daygrid';\nimport { useTheme } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport useFullCalendarProps from './useFullCalendarProps';\n\nconst useGlobalStyles = makeStyles(theme => ({\n '@global': {\n '.fc-button': {\n backgroundColor: `${theme.palette.primary.main} !important`,\n border: 'none !important',\n opacity: '1 !important'\n },\n '.fc-day-today': {\n backgroundColor: `${theme.palette.secondary.light} !important`\n },\n // Overwrite violet color of links\n 'a.fc-daygrid-dot-event': {\n color: 'black !important'\n }\n }\n}));\n\nconst CalendarList = props => {\n const theme = useTheme();\n const fullCalendarProps = useFullCalendarProps(props);\n useGlobalStyles();\n\n return (\n <FullCalendar\n plugins={[dayGridPlugin]}\n locale={props.locale}\n initialView=\"dayGridMonth\"\n eventBackgroundColor={theme.palette.primary.main}\n {...fullCalendarProps}\n />\n );\n};\n\nCalendarList.defaultProps = {\n linkType: 'edit'\n};\n\nexport default CalendarList;\n","import React, { useMemo, useCallback } from 'react';\nimport { useSearchParams, useNavigate } from 'react-router-dom';\nimport { useListContext, useCreatePath } from 'react-admin';\n\nconst useFullCalendarProps = ({ label, startDate, endDate, linkType }) => {\n const { data, isLoading, resource } = useListContext();\n const [searchParams, setSearchParams] = useSearchParams();\n const navigate = useNavigate();\n const createPath = useCreatePath();\n\n const query = new URLSearchParams(location.search);\n\n // Bypass the link in order to use React-Router\n const eventClick = useCallback(({ event, jsEvent }) => {\n jsEvent.preventDefault();\n navigate(event.url);\n }, []);\n\n // Change the query string when month change\n const datesSet = useCallback(\n ({ view }) => {\n setSearchParams(params => ({\n ...params,\n month: view.currentStart.getMonth() + 1,\n year: view.currentStart.getFullYear()\n }));\n },\n [setSearchParams]\n );\n\n const events = useMemo(\n () =>\n !isLoading &&\n data\n .filter(record => record)\n .map(record => ({\n id: record.id,\n title: typeof label === 'string' ? record[label] : label(record),\n start: typeof startDate === 'string' ? record[startDate] : startDate(record),\n end: typeof endDate === 'string' ? record[endDate] : endDate(record),\n url: createPath({ resource, id: record.id, type: linkType })\n })),\n [isLoading, data, resource, createPath]\n );\n\n return {\n initialDate: query.has('month') ? new Date(query.get('year'), query.get('month') - 1) : new Date(),\n events,\n datesSet,\n eventClick\n };\n};\n\nexport default useFullCalendarProps;\n","import React from 'react';\nimport FullCalendar from '@fullcalendar/react';\nimport listPlugin from '@fullcalendar/list';\nimport makeStyles from '@mui/styles/makeStyles';\nimport useFullCalendarProps from './useFullCalendarProps';\n\nconst useGlobalStyles = makeStyles(theme => ({\n '@global': {\n '.fc-button': {\n backgroundColor: `${theme.palette.primary.main} !important`,\n border: 'none !important',\n opacity: '1 !important'\n }\n }\n}));\n\nconst DaysList = props => {\n const fullCalendarProps = useFullCalendarProps(props);\n useGlobalStyles();\n\n return <FullCalendar plugins={[listPlugin]} locale={props.locale} initialView=\"listMonth\" {...fullCalendarProps} />;\n};\n\nDaysList.defaultProps = {\n linkType: 'edit'\n};\n\nexport default DaysList;\n"],"names":[],"version":3,"file":"index.cjs.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA2C,GAC3C,+CAA+C,GAE/C,sFAAsF;AACtF,kEAAkE;;;;;;ACJlE,2CAA2C,GAC3C,8CAA8C;;;;;AAgB9C,MAAM,+BAAS,CAAe,mBAC5B,eAAe,SACf,KAAK,UACL,MAAM,cACN,UAAU,aACV,SAAS,UACT,MAAM,YACN,QAAQ,UACR,MAAM,SACN,KAAK,YACL,QAAQ,gBACR,YAAY,UACZ,MAAM,gBACN,YAAY,gBACZ,eAAe,OACf,GAAG,MACgB;IACnB,MAAM,SACJ,KAAK,cACL,UAAU,EACV,YAAY,SAAE,KAAK,aAAE,SAAS,WAAE,OAAO,EAAE,EACzC,WAAW,eAAE,WAAW,EAAE,EAC3B,GAAG,CAAA,GAAA,0BAAO,EAAE;gBACX;gBACA;kBACA;eACA;gBACA;kBACA;sBACA;IACF;IAEA,MAAM,eAAe,CAAA,GAAA,wBAAU,EAC7B,CAAC;QACC,IAAI,iBAAiB,MACnB,MAAM,QAAQ,CAAC,iBAAiB,QAAQ,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,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC;wBAChE;wBACA,kCAAkC;wBAClC,0BAA0B;4BACxB,OAAO;wBACT;oBACF,CAAA;;0BAGF,gCAAC,CAAA,GAAA,kDAAW;gBACV,SAAS;oBAAC,CAAA,GAAA,oDAAY;iBAAE;gBACxB,QAAQ,MAAM,MAAM;gBACpB,aAAY;gBACZ,sBAAsB,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI;gBAC/C,GAAG,iBAAiB;;;;AAI7B;IAEA,2CAAe;;;;;;;;;AElCf,MAAM,iCAAW,CAAC;IAChB,MAAM,oBAAoB,CAAA,GAAA,wCAAmB,EAAE;IAE/C,qBACE;;0BACE,gCAAC,CAAA,GAAA,+BAAW;gBACV,QAAQ,CAAA,QAAU,CAAA;wBAChB,cAAc;4BACZ,iBAAiB,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;4BAC3D,QAAQ;4BACR,SAAS;wBACX;oBACF,CAAA;;0BAEF,gCAAC,CAAA,GAAA,kDAAW;gBAAE,SAAS;oBAAC,CAAA,GAAA,iDAAS;iBAAE;gBAAE,QAAQ,MAAM,MAAM;gBAAE,aAAY;gBAAa,GAAG,iBAAiB;;YAAI;;;AAGlH;IAEA,2CAAe;;;;AJdf,MAAM,4CAAY,CAAS,sBACzB,gCAAC,CAAA,GAAA,wCAAK;QAAE,iBAAiB,CAAA,GAAA,2CAAS;QAAI,GAAG,KAAK;;AAEhD,MAAM,4CAAY,CAAS,sBACzB,gCAAC,CAAA,GAAA,wCAAK;QAAE,iBAAiB,CAAA,GAAA,2CAAS;QAAI,GAAG,KAAK;;AAEhD,MAAM,2CAAgB,CAAS,sBAC7B,gCAAC,CAAA,GAAA,wCAAK;QAAE,iBAAiB,CAAA,GAAA,mDAAa;QAAI,GAAG,KAAK","sources":["packages/date-components/src/index.tsx","packages/date-components/src/Picker.tsx","packages/date-components/src/CalendarList.tsx","packages/date-components/src/useFullCalendarProps.ts","packages/date-components/src/DaysList.tsx"],"sourcesContent":["/* eslint-disable react/react-in-jsx-scope */\n/* eslint-disable react/jsx-props-no-spreading */\n\n// Solves bug with Vite in dev mode. Can be removed when we upgrade to FullCalendar v6\n// See https://github.com/fullcalendar/fullcalendar-vue/issues/152\nimport '@fullcalendar/react/dist/vdom';\n\nimport { DatePicker, DatePickerProps } from '@mui/x-date-pickers/DatePicker';\nimport { TimePicker, TimePickerProps } from '@mui/x-date-pickers/TimePicker';\nimport { DateTimePicker, DateTimePickerProps } from '@mui/x-date-pickers/DateTimePicker';\nimport Picker, { Props as PickerProps } from './Picker';\n\nconst DateInput = <TDate,>(props: Omit<PickerProps<DatePickerProps<TDate>>, 'PickerComponent'>) => (\n <Picker PickerComponent={DatePicker} {...props} />\n);\nconst TimeInput = <TDate,>(props: Omit<PickerProps<TimePickerProps<TDate>>, 'PickerComponent'>) => (\n <Picker PickerComponent={TimePicker} {...props} />\n);\nconst DateTimeInput = <TDate,>(props: Omit<PickerProps<DateTimePickerProps<TDate>>, 'PickerComponent'>) => (\n <Picker PickerComponent={DateTimePicker} {...props} />\n);\n\nexport { DateInput, TimeInput, DateTimeInput };\n\nexport { default as CalendarList } from './CalendarList';\nexport { default as DaysList } from './DaysList';\nexport { default as useFullCalendarProps } from './useFullCalendarProps';\n","/* eslint-disable react/react-in-jsx-scope */\n/* eslint-disable react/require-default-props */\nimport { useCallback, ComponentType } from 'react';\nimport { useInput, InputHelperText, TextInputProps, useTranslateLabel } from 'react-admin';\nimport { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';\nimport { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';\nimport { getPickersLocalization } from '@mui/x-date-pickers/locales/utils/getPickersLocalization';\nimport { Locale } from 'date-fns';\n\nexport type Props<PickerProps> = TextInputProps &\n Omit<PickerProps, 'format'> & {\n PickerComponent: ComponentType;\n locale?: Locale;\n translations?: ReturnType<typeof getPickersLocalization>;\n stringFormat?: string;\n };\n\nconst Picker = <PickerProps,>({\n PickerComponent,\n label,\n source,\n helperText,\n fullWidth,\n onBlur,\n onChange,\n format,\n parse,\n validate,\n defaultValue,\n locale,\n translations,\n stringFormat = 'ISO',\n ...rest\n}: Props<PickerProps>) => {\n const {\n field,\n isRequired,\n fieldState: { error, isTouched, invalid },\n formState: { isSubmitted }\n } = useInput({\n format,\n onBlur,\n onChange,\n parse,\n source,\n validate,\n defaultValue\n });\n\n const handleChange = useCallback(\n (value: Date) => {\n if (value instanceof Date) {\n field.onChange(stringFormat === 'ISO' ? value.toISOString() : value.toString());\n } else {\n field.onChange(null);\n }\n },\n [field, stringFormat]\n );\n\n const translateLabel = useTranslateLabel();\n const translatedLabel = (\n <span>\n {translateLabel({\n label,\n source\n })}\n {isRequired && <span aria-hidden=\"true\"> *</span>}\n </span>\n );\n\n return (\n <LocalizationProvider\n dateAdapter={AdapterDateFns}\n adapterLocale={locale}\n localeText={translations?.components.MuiLocalizationProvider.defaultProps.localeText}\n >\n <PickerComponent\n label={translatedLabel}\n slotProps={{\n textField: {\n error: (isTouched || isSubmitted) && invalid,\n size: 'small',\n fullWidth,\n helperText: (\n // @ts-expect-error TS(2322): Type '{ touched: boolean; error: string | undefine... Remove this comment to see the full error message\n <InputHelperText touched={isTouched || isSubmitted} error={error?.message} helperText={helperText} />\n )\n }\n }}\n value={field.value ? new Date(field.value) : null}\n onChange={handleChange}\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n {...rest}\n />\n </LocalizationProvider>\n );\n};\n\nexport default Picker;\n","import React from 'react';\nimport FullCalendar from '@fullcalendar/react';\nimport dayGridPlugin from '@fullcalendar/daygrid';\nimport { GlobalStyles, useTheme } from '@mui/material';\nimport useFullCalendarProps from './useFullCalendarProps';\nimport { makeStyles } from 'tss-react/mui';\n\nconst CalendarList = (props: any) => {\n const theme = useTheme();\n const fullCalendarProps = useFullCalendarProps(props);\n\n return (\n <>\n <GlobalStyles\n styles={theme => ({\n '.fc-button': {\n backgroundColor: `${theme.palette.primary.main} !important`,\n border: 'none !important',\n opacity: '1 !important'\n },\n '.fc-day-today': {\n backgroundColor: `${theme.palette.secondary.light} !important`\n },\n // Overwrite violet color of links\n 'a.fc-daygrid-dot-event': {\n color: 'black !important'\n }\n })}\n />\n\n <FullCalendar\n plugins={[dayGridPlugin]}\n locale={props.locale}\n initialView=\"dayGridMonth\"\n eventBackgroundColor={theme.palette.primary.main}\n {...fullCalendarProps}\n />\n </>\n );\n};\n\nexport default CalendarList;\n","import React, { useMemo, useCallback } from 'react';\nimport { useSearchParams, useNavigate } from 'react-router-dom';\nimport { useListContext, useCreatePath } from 'react-admin';\n\nconst useFullCalendarProps = ({\n label,\n startDate,\n endDate,\n linkType = 'edit'\n}: any) => {\n const { data, isLoading, resource } = useListContext();\n const [searchParams, setSearchParams] = useSearchParams();\n const navigate = useNavigate();\n const createPath = useCreatePath();\n\n const query = new URLSearchParams(location.search);\n\n // Bypass the link in order to use React-Router\n const eventClick = useCallback(({\n event,\n jsEvent\n }: any) => {\n jsEvent.preventDefault();\n navigate(event.url);\n }, []);\n\n // Change the query string when month change\n const datesSet = useCallback(\n ({\n view\n }: any) => {\n // @ts-expect-error TS(2345): Argument of type '(params: URLSearchParams) => { m... Remove this comment to see the full error message\n setSearchParams(params => ({\n ...params,\n month: view.currentStart.getMonth() + 1,\n year: view.currentStart.getFullYear()\n }));\n },\n [setSearchParams]\n );\n\n const events = useMemo(\n () =>\n !isLoading &&\n // @ts-expect-error TS(2532): Object is possibly 'undefined'.\n data\n .filter(record => record)\n .map(record => ({\n id: record.id,\n title: typeof label === 'string' ? record[label] : label(record),\n start: typeof startDate === 'string' ? record[startDate] : startDate(record),\n end: typeof endDate === 'string' ? record[endDate] : endDate(record),\n url: createPath({ resource, id: record.id, type: linkType })\n })),\n [isLoading, data, resource, createPath]\n );\n\n return {\n // @ts-expect-error TS(2345): Argument of type 'string | null' is not assignable... Remove this comment to see the full error message\n initialDate: query.has('month') ? new Date(query.get('year'), query.get('month') - 1) : new Date(),\n events,\n datesSet,\n eventClick\n };\n};\n\nexport default useFullCalendarProps;\n","import React from 'react';\nimport FullCalendar from '@fullcalendar/react';\nimport listPlugin from '@fullcalendar/list';\nimport { makeStyles } from 'tss-react/mui';\nimport useFullCalendarProps from './useFullCalendarProps';\nimport { GlobalStyles } from '@mui/material';\n\nconst DaysList = (props: any) => {\n const fullCalendarProps = useFullCalendarProps(props);\n\n return (\n <>\n <GlobalStyles\n styles={theme => ({\n '.fc-button': {\n backgroundColor: `${theme.palette.primary.main} !important`,\n border: 'none !important',\n opacity: '1 !important'\n }\n })}\n />\n <FullCalendar plugins={[listPlugin]} locale={props.locale} initialView=\"listMonth\" {...fullCalendarProps} />;\n </>\n );\n};\n\nexport default DaysList;\n"],"names":[],"version":3,"file":"index.cjs.js.map"}
|