@selfcommunity/react-ui 0.8.1-alpha.4 → 0.9.0-alpha.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/lib/cjs/components/CreateEventButton/CreateEventButton.d.ts +2 -2
- package/lib/cjs/components/CreateEventButton/CreateEventButton.js +4 -4
- package/lib/cjs/components/EditEventButton/EditEventButton.js +1 -1
- package/lib/cjs/components/EventForm/EventForm.d.ts +7 -12
- package/lib/cjs/components/EventForm/EventForm.js +55 -55
- package/lib/cjs/components/EventFormDialog/EventFormDialog.d.ts +48 -0
- package/lib/cjs/components/EventFormDialog/EventFormDialog.js +56 -0
- package/lib/cjs/components/EventFormDialog/constants.d.ts +1 -0
- package/lib/cjs/components/EventFormDialog/constants.js +4 -0
- package/lib/cjs/components/EventFormDialog/index.d.ts +3 -0
- package/lib/cjs/components/EventFormDialog/index.js +5 -0
- package/lib/cjs/components/EventMediaWidget/EventMediaWidget.d.ts +37 -0
- package/lib/cjs/components/EventMediaWidget/EventMediaWidget.js +242 -0
- package/lib/cjs/components/EventMediaWidget/Skeleton.d.ts +2 -0
- package/lib/cjs/components/EventMediaWidget/Skeleton.js +28 -0
- package/lib/cjs/components/EventMediaWidget/TriggerButton.d.ts +17 -0
- package/lib/cjs/components/EventMediaWidget/TriggerButton.js +66 -0
- package/lib/cjs/components/EventMediaWidget/asUploadButton.d.ts +7 -0
- package/lib/cjs/components/EventMediaWidget/asUploadButton.js +25 -0
- package/lib/cjs/components/EventMediaWidget/constants.d.ts +1 -0
- package/lib/cjs/components/EventMediaWidget/constants.js +4 -0
- package/lib/cjs/components/EventMediaWidget/index.d.ts +4 -0
- package/lib/cjs/components/EventMediaWidget/index.js +8 -0
- package/lib/cjs/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +1 -3
- package/lib/cjs/index.d.ts +8 -5
- package/lib/cjs/index.js +18 -13
- package/lib/cjs/shared/Lightbox/BaseLightbox.d.ts +19 -0
- package/lib/cjs/shared/Lightbox/BaseLightbox.js +35 -0
- package/lib/cjs/shared/Lightbox/Lightbox.d.ts +31 -17
- package/lib/cjs/shared/Lightbox/Lightbox.js +16 -19
- package/lib/cjs/shared/Lightbox/constants.d.ts +1 -0
- package/lib/cjs/shared/Lightbox/constants.js +4 -0
- package/lib/cjs/shared/Lightbox/index.d.ts +4 -2
- package/lib/cjs/shared/Lightbox/index.js +4 -1
- package/lib/cjs/shared/Media/File/DisplayComponent.js +23 -6
- package/lib/cjs/shared/MediaChunkUploader/index.js +13 -11
- package/lib/cjs/utils/hash.d.ts +2 -1
- package/lib/esm/components/CreateEventButton/CreateEventButton.d.ts +2 -2
- package/lib/esm/components/CreateEventButton/CreateEventButton.js +4 -4
- package/lib/esm/components/EditEventButton/EditEventButton.js +1 -1
- package/lib/esm/components/EventForm/EventForm.d.ts +7 -12
- package/lib/esm/components/EventForm/EventForm.js +56 -56
- package/lib/esm/components/EventFormDialog/EventFormDialog.d.ts +48 -0
- package/lib/esm/components/EventFormDialog/EventFormDialog.js +53 -0
- package/lib/esm/components/EventFormDialog/constants.d.ts +1 -0
- package/lib/esm/components/EventFormDialog/constants.js +1 -0
- package/lib/esm/components/EventFormDialog/index.d.ts +3 -0
- package/lib/esm/components/EventFormDialog/index.js +2 -0
- package/lib/esm/components/EventMediaWidget/EventMediaWidget.d.ts +37 -0
- package/lib/esm/components/EventMediaWidget/EventMediaWidget.js +239 -0
- package/lib/esm/components/EventMediaWidget/Skeleton.d.ts +2 -0
- package/lib/esm/components/EventMediaWidget/Skeleton.js +22 -0
- package/lib/esm/components/EventMediaWidget/TriggerButton.d.ts +17 -0
- package/lib/esm/components/EventMediaWidget/TriggerButton.js +64 -0
- package/lib/esm/components/EventMediaWidget/asUploadButton.d.ts +7 -0
- package/lib/esm/components/EventMediaWidget/asUploadButton.js +23 -0
- package/lib/esm/components/EventMediaWidget/constants.d.ts +1 -0
- package/lib/esm/components/EventMediaWidget/constants.js +1 -0
- package/lib/esm/components/EventMediaWidget/index.d.ts +4 -0
- package/lib/esm/components/EventMediaWidget/index.js +4 -0
- package/lib/esm/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +1 -3
- package/lib/esm/index.d.ts +8 -5
- package/lib/esm/index.js +10 -8
- package/lib/esm/shared/Lightbox/BaseLightbox.d.ts +19 -0
- package/lib/esm/shared/Lightbox/BaseLightbox.js +33 -0
- package/lib/esm/shared/Lightbox/Lightbox.d.ts +31 -17
- package/lib/esm/shared/Lightbox/Lightbox.js +15 -19
- package/lib/esm/shared/Lightbox/constants.d.ts +1 -0
- package/lib/esm/shared/Lightbox/constants.js +1 -0
- package/lib/esm/shared/Lightbox/index.d.ts +4 -2
- package/lib/esm/shared/Lightbox/index.js +3 -1
- package/lib/esm/shared/Media/File/DisplayComponent.js +23 -6
- package/lib/esm/shared/MediaChunkUploader/index.js +14 -12
- package/lib/esm/utils/hash.d.ts +2 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +6 -6
- package/lib/cjs/shared/Media/File/Lightbox/index.d.ts +0 -28
- package/lib/cjs/shared/Media/File/Lightbox/index.js +0 -37
- package/lib/esm/shared/Media/File/Lightbox/index.d.ts +0 -28
- package/lib/esm/shared/Media/File/Lightbox/index.js +0 -34
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ButtonProps } from '@mui/material/Button/Button';
|
|
2
|
-
import {
|
|
2
|
+
import { EventFormDialogProps } from '../EventFormDialog';
|
|
3
3
|
export interface CreateEventButtonProps extends ButtonProps {
|
|
4
4
|
/**
|
|
5
5
|
* Overrides or extends the styles applied to the component.
|
|
@@ -10,7 +10,7 @@ export interface CreateEventButtonProps extends ButtonProps {
|
|
|
10
10
|
* Props to spread to CreateGroup component
|
|
11
11
|
* @default empty object
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
EventFormDialogComponentProps?: EventFormDialogProps;
|
|
14
14
|
/**
|
|
15
15
|
* Any other properties
|
|
16
16
|
*/
|
|
@@ -9,7 +9,7 @@ const react_core_1 = require("@selfcommunity/react-core");
|
|
|
9
9
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
10
10
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
11
11
|
const react_intl_1 = require("react-intl");
|
|
12
|
-
const
|
|
12
|
+
const EventFormDialog_1 = tslib_1.__importDefault(require("../EventFormDialog"));
|
|
13
13
|
const types_1 = require("@selfcommunity/types");
|
|
14
14
|
const PREFIX = 'SCCreateEventButton';
|
|
15
15
|
const classes = {
|
|
@@ -40,13 +40,13 @@ const Root = (0, styles_1.styled)(material_1.Button, {
|
|
|
40
40
|
* @param inProps
|
|
41
41
|
*/
|
|
42
42
|
function CreateEventButton(inProps) {
|
|
43
|
-
var _a;
|
|
43
|
+
var _a, _b;
|
|
44
44
|
//PROPS
|
|
45
45
|
const props = (0, system_1.useThemeProps)({
|
|
46
46
|
props: inProps,
|
|
47
47
|
name: PREFIX
|
|
48
48
|
});
|
|
49
|
-
const { className,
|
|
49
|
+
const { className, EventFormDialogComponentProps = {}, children } = props, rest = tslib_1.__rest(props, ["className", "EventFormDialogComponentProps", "children"]);
|
|
50
50
|
// CONTEXT
|
|
51
51
|
const scUserContext = (0, react_1.useContext)(react_core_1.SCUserContext);
|
|
52
52
|
// STATE
|
|
@@ -78,6 +78,6 @@ function CreateEventButton(inProps) {
|
|
|
78
78
|
/**
|
|
79
79
|
* Renders root object
|
|
80
80
|
*/
|
|
81
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), onClick: handleClick, variant: "contained", color: "secondary", startIcon: !
|
|
81
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), onClick: handleClick, variant: "contained", color: "secondary", startIcon: !((_b = EventFormDialogComponentProps.EventFormComponentProps) === null || _b === void 0 ? void 0 : _b.event) && (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: "add" })) }, rest, { children: children !== null && children !== void 0 ? children : (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.createEventButton", defaultMessage: "ui.createEventButton" }) })), open && (0, jsx_runtime_1.jsx)(EventFormDialog_1.default, Object.assign({}, EventFormDialogComponentProps, { open: true, onClose: handleClick }))] }));
|
|
82
82
|
}
|
|
83
83
|
exports.default = CreateEventButton;
|
|
@@ -55,6 +55,6 @@ function EditEventButton(inProps) {
|
|
|
55
55
|
/**
|
|
56
56
|
* Renders root object
|
|
57
57
|
*/
|
|
58
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ variant: "outlined", className: (0, classnames_1.default)(classes.root, className),
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ variant: "outlined", className: (0, classnames_1.default)(classes.root, className), EventFormDialogComponentProps: { EventFormComponentProps: { event: scEvent, onSuccess: handleSuccess } } }, rest, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editEventButton", defaultMessage: "ui.editEventButton" }) })));
|
|
59
59
|
}
|
|
60
60
|
exports.default = EditEventButton;
|
|
@@ -1,21 +1,11 @@
|
|
|
1
|
+
import { BoxProps } from '@mui/material';
|
|
1
2
|
import { SCEventType } from '@selfcommunity/types';
|
|
2
|
-
|
|
3
|
-
export interface EventFormProps extends BaseDialogProps {
|
|
3
|
+
export interface EventFormProps extends BoxProps {
|
|
4
4
|
/**
|
|
5
5
|
* Overrides or extends the styles applied to the component.
|
|
6
6
|
* @default null
|
|
7
7
|
*/
|
|
8
8
|
className?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Open dialog
|
|
11
|
-
* @default true
|
|
12
|
-
*/
|
|
13
|
-
open?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* On dialog close callback function
|
|
16
|
-
* @default null
|
|
17
|
-
*/
|
|
18
|
-
onClose?: () => void;
|
|
19
9
|
/**
|
|
20
10
|
* Event Object
|
|
21
11
|
* @default null
|
|
@@ -26,6 +16,11 @@ export interface EventFormProps extends BaseDialogProps {
|
|
|
26
16
|
* @default null
|
|
27
17
|
*/
|
|
28
18
|
onSuccess?: (data: SCEventType) => void;
|
|
19
|
+
/**
|
|
20
|
+
* On error callback function
|
|
21
|
+
* @default null
|
|
22
|
+
*/
|
|
23
|
+
onError?: (error: any) => void;
|
|
29
24
|
/**
|
|
30
25
|
* Any other properties
|
|
31
26
|
*/
|
|
@@ -21,7 +21,6 @@ const react_intl_1 = require("react-intl");
|
|
|
21
21
|
const Errors_1 = require("../../constants/Errors");
|
|
22
22
|
const Event_1 = require("../../constants/Event");
|
|
23
23
|
const PubSub_1 = require("../../constants/PubSub");
|
|
24
|
-
const BaseDialog_1 = tslib_1.__importDefault(require("../../shared/BaseDialog"));
|
|
25
24
|
const constants_1 = require("./constants");
|
|
26
25
|
const EventAddress_1 = tslib_1.__importDefault(require("./EventAddress"));
|
|
27
26
|
const UploadEventCover_1 = tslib_1.__importDefault(require("./UploadEventCover"));
|
|
@@ -74,11 +73,12 @@ const classes = {
|
|
|
74
73
|
name: `${constants_1.PREFIX}-name`,
|
|
75
74
|
description: `${constants_1.PREFIX}-description`,
|
|
76
75
|
content: `${constants_1.PREFIX}-content`,
|
|
76
|
+
actions: `${constants_1.PREFIX}-actions`,
|
|
77
77
|
privacySection: `${constants_1.PREFIX}-privacy-section`,
|
|
78
78
|
privacySectionInfo: `${constants_1.PREFIX}-privacy-section-info`,
|
|
79
79
|
error: `${constants_1.PREFIX}-error`
|
|
80
80
|
};
|
|
81
|
-
const Root = (0, styles_1.styled)(
|
|
81
|
+
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
82
82
|
name: constants_1.PREFIX,
|
|
83
83
|
slot: 'Root'
|
|
84
84
|
})(() => ({}));
|
|
@@ -120,7 +120,7 @@ function EventForm(inProps) {
|
|
|
120
120
|
props: inProps,
|
|
121
121
|
name: constants_1.PREFIX
|
|
122
122
|
});
|
|
123
|
-
const { className,
|
|
123
|
+
const { className, onSuccess, onError, event = null } = props, rest = tslib_1.__rest(props, ["className", "onSuccess", "onError", "event"]);
|
|
124
124
|
// CONTEXT
|
|
125
125
|
const scContext = (0, react_core_1.useSCContext)();
|
|
126
126
|
// INTL
|
|
@@ -221,10 +221,9 @@ function EventForm(inProps) {
|
|
|
221
221
|
}
|
|
222
222
|
eventService
|
|
223
223
|
.then((data) => {
|
|
224
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data);
|
|
225
224
|
notifyChanges(data);
|
|
226
|
-
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
227
225
|
setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: false })));
|
|
226
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data);
|
|
228
227
|
})
|
|
229
228
|
.catch((e) => {
|
|
230
229
|
const _error = (0, api_services_1.formatHttpErrorCode)(e);
|
|
@@ -238,8 +237,9 @@ function EventForm(inProps) {
|
|
|
238
237
|
}
|
|
239
238
|
setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: false })));
|
|
240
239
|
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, e);
|
|
240
|
+
onError === null || onError === void 0 ? void 0 : onError(e);
|
|
241
241
|
});
|
|
242
|
-
}, [field, privateEnabled, visibilityEnabled]);
|
|
242
|
+
}, [field, privateEnabled, visibilityEnabled, onSuccess, onError]);
|
|
243
243
|
const handleChange = (0, react_1.useCallback)((event) => {
|
|
244
244
|
const { name, value } = event.target;
|
|
245
245
|
setField((prev) => (Object.assign(Object.assign({}, prev), { [name]: value })));
|
|
@@ -284,56 +284,56 @@ function EventForm(inProps) {
|
|
|
284
284
|
/**
|
|
285
285
|
* Renders root object
|
|
286
286
|
*/
|
|
287
|
-
return ((0, jsx_runtime_1.
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
(field.recurring !== types_1.SCEventRecurrenceType.NEVER && !field.endDate && !field.endTime) ||
|
|
295
|
-
Object.keys(error).length !== 0 ||
|
|
296
|
-
field.name.length > Event_1.EVENT_TITLE_MAX_LENGTH ||
|
|
297
|
-
field.description.length > Event_1.EVENT_DESCRIPTION_MAX_LENGTH, variant: "contained", onClick: handleSubmit, color: "secondary" }, { children: event ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.button.edit", defaultMessage: "ui.eventForm.button.edit" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.button.create", defaultMessage: "ui.eventForm.button.create" })) })) }, rest, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: (0, jsx_runtime_1.jsx)(UploadEventCover_1.default, { isCreationMode: true, onChange: handleChangeCover }) })), (0, jsx_runtime_1.jsxs)(material_1.FormGroup, Object.assign({ className: classes.form }, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { required: true, className: classes.name, placeholder: `${intl.formatMessage(messages.name)}`, margin: "normal", value: field.name, name: "name", onChange: handleChange, InputProps: {
|
|
298
|
-
endAdornment: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: Event_1.EVENT_TITLE_MAX_LENGTH - field.name.length }))
|
|
299
|
-
}, error: Boolean(field.name.length > Event_1.EVENT_TITLE_MAX_LENGTH) || Boolean(error['nameError']), helperText: field.name.length > Event_1.EVENT_TITLE_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.name.error.maxLength", defaultMessage: "ui.eventForm.name.error.maxLength" })) : error['nameError'] ? (error['nameError']) : null }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.dateTime }, { children: (0, jsx_runtime_1.jsxs)(x_date_pickers_1.LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns_1.AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? it_1.default : en_US_1.default }, { children: [(0, jsx_runtime_1.jsx)(x_date_pickers_1.MobileDatePicker, { className: classes.picker, disablePast: true, label: field.startDate && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.date.placeholder", defaultMessage: "ui.eventForm.date.placeholder" }), value: field.startDate, slots: {
|
|
300
|
-
textField: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.startDate)}`, startAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "CalendarIcon" }) }) }))) }) })))
|
|
301
|
-
}, slotProps: {
|
|
302
|
-
toolbar: {
|
|
303
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore,@typescript-eslint/ban-ts-comment
|
|
304
|
-
// @ts-ignore
|
|
305
|
-
toolbarTitle: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.date.title", defaultMessage: "ui.eventForm.date.title" })
|
|
306
|
-
}
|
|
307
|
-
}, onChange: (value) => handleChangeDateTime(value, 'startDate') }), (0, jsx_runtime_1.jsx)(x_date_pickers_1.MobileTimePicker, { className: classes.picker, disablePast: disablePastStartTime, label: field.startTime && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.time.placeholder", defaultMessage: "ui.eventForm.time.placeholder" }), value: field.startTime, slots: {
|
|
308
|
-
textField: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.startTime)}`, startAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "access_time" }) }) }))) }) })))
|
|
309
|
-
}, slotProps: {
|
|
310
|
-
toolbar: {
|
|
311
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore,@typescript-eslint/ban-ts-comment
|
|
312
|
-
// @ts-ignore
|
|
313
|
-
toolbarTitle: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.time.title", defaultMessage: "ui.eventForm.time.title" })
|
|
314
|
-
}
|
|
315
|
-
}, onChange: (value) => handleChangeDateTime(value, 'startTime') })] })) })), (0, jsx_runtime_1.jsxs)(material_1.FormControl, Object.assign({ className: classes.frequency }, { children: [field.recurring !== types_1.SCEventRecurrenceType.NEVER && (0, jsx_runtime_1.jsx)(material_1.InputLabel, Object.assign({ id: "recurring" }, { children: `${intl.formatMessage(messages.frequency)}` })), (0, jsx_runtime_1.jsx)(material_1.Select, Object.assign({ name: "recurring", label: field.recurring !== types_1.SCEventRecurrenceType.NEVER && `${intl.formatMessage(messages.frequency)}`, labelId: "recurring", value: field.recurring, onChange: handleChange, displayEmpty: true, renderValue: (selected) => {
|
|
316
|
-
if (!selected) {
|
|
317
|
-
return (0, jsx_runtime_1.jsx)("em", { children: `${intl.formatMessage(messages.frequencyPlaceholder)}` });
|
|
318
|
-
}
|
|
319
|
-
return ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventForm.frequency.${selected}.placeholder`, defaultMessage: `ui.eventForm.frequency.${selected}.placeholder` }));
|
|
320
|
-
}, startAdornment: (0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "frequency" }) }) })) }, { children: Object.values(types_1.SCEventRecurrenceType).map((f) => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ value: f }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventForm.frequency.${f}.placeholder`, defaultMessage: `ui.eventForm.frequency.${f}.placeholder` }) }), f))) }))] })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.dateTime }, { children: (0, jsx_runtime_1.jsxs)(x_date_pickers_1.LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns_1.AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? it_1.default : en_US_1.default }, { children: [(0, jsx_runtime_1.jsx)(x_date_pickers_1.MobileDatePicker, { className: classes.picker, disablePast: true, minDate: field.startDate, label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.date.end.placeholder", defaultMessage: "ui.eventForm.date.end.placeholder" }), value: field.endDate, slots: {
|
|
321
|
-
textField: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.endDate)}`, startAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "calendar_off" }) }) }))) }) })))
|
|
322
|
-
}, onChange: (value) => handleChangeDateTime(value, 'endDate'), shouldDisableDate: shouldDisabledDate }), (0, jsx_runtime_1.jsx)(x_date_pickers_1.MobileTimePicker, { className: classes.picker, disablePast: disablePastEndTime, label: field.endTime && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.time.end.placeholder", defaultMessage: "ui.eventForm.time.end.placeholder" }), value: field.endTime, slots: {
|
|
323
|
-
textField: (params) => {
|
|
324
|
-
var _a;
|
|
325
|
-
return ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.endTime)}`, startAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "access_time" }) }) }))) }), error: Boolean(error['endDateError']), helperText: ((_a = error['endDateError']) === null || _a === void 0 ? void 0 : _a.error) ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.time.end.error.invalid", defaultMessage: "ui.eventForm.time.end.error.invalid" })) : null })));
|
|
326
|
-
}
|
|
327
|
-
}, onChange: (value) => handleChangeDateTime(value, 'endTime'), shouldDisableTime: shouldDisabledTime })] })) })), (0, jsx_runtime_1.jsx)(EventAddress_1.default, { forwardGeolocationData: handleGeoData, event: event !== null && event !== void 0 ? event : null }), privateEnabled && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.privacySection }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center", justifyContent: "center" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.switchLabel, { [classes.active]: !field.isPublic }) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.private", defaultMessage: "ui.eventForm.privacy.private" })] })), (0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: field.isPublic, onChange: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['isPublic']: !field.isPublic }))), disabled: event && !field.isPublic }), (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.switchLabel, { [classes.active]: field.isPublic }) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.public", defaultMessage: "ui.eventForm.privacy.public" })] }))] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", textAlign: "center", className: classes.privacySectionInfo }, { children: field.isPublic ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.public.info", defaultMessage: "ui.eventForm.privacy.public.info", values: {
|
|
328
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
287
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: (0, jsx_runtime_1.jsx)(UploadEventCover_1.default, { isCreationMode: true, onChange: handleChangeCover }) })), (0, jsx_runtime_1.jsxs)(material_1.FormGroup, Object.assign({ className: classes.form }, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { required: true, className: classes.name, placeholder: `${intl.formatMessage(messages.name)}`, margin: "normal", value: field.name, name: "name", onChange: handleChange, InputProps: {
|
|
288
|
+
endAdornment: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: Event_1.EVENT_TITLE_MAX_LENGTH - field.name.length }))
|
|
289
|
+
}, error: Boolean(field.name.length > Event_1.EVENT_TITLE_MAX_LENGTH) || Boolean(error['nameError']), helperText: field.name.length > Event_1.EVENT_TITLE_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.name.error.maxLength", defaultMessage: "ui.eventForm.name.error.maxLength" })) : error['nameError'] ? (error['nameError']) : null }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.dateTime }, { children: (0, jsx_runtime_1.jsxs)(x_date_pickers_1.LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns_1.AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? it_1.default : en_US_1.default }, { children: [(0, jsx_runtime_1.jsx)(x_date_pickers_1.MobileDatePicker, { className: classes.picker, disablePast: true, label: field.startDate && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.date.placeholder", defaultMessage: "ui.eventForm.date.placeholder" }), value: field.startDate, slots: {
|
|
290
|
+
textField: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.startDate)}`, startAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "CalendarIcon" }) }) }))) }) })))
|
|
291
|
+
}, slotProps: {
|
|
292
|
+
toolbar: {
|
|
293
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore,@typescript-eslint/ban-ts-comment
|
|
329
294
|
// @ts-ignore
|
|
330
|
-
|
|
331
|
-
}
|
|
332
|
-
|
|
295
|
+
toolbarTitle: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.date.title", defaultMessage: "ui.eventForm.date.title" })
|
|
296
|
+
}
|
|
297
|
+
}, onChange: (value) => handleChangeDateTime(value, 'startDate') }), (0, jsx_runtime_1.jsx)(x_date_pickers_1.MobileTimePicker, { className: classes.picker, disablePast: disablePastStartTime, label: field.startTime && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.time.placeholder", defaultMessage: "ui.eventForm.time.placeholder" }), value: field.startTime, slots: {
|
|
298
|
+
textField: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.startTime)}`, startAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "access_time" }) }) }))) }) })))
|
|
299
|
+
}, slotProps: {
|
|
300
|
+
toolbar: {
|
|
301
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore,@typescript-eslint/ban-ts-comment
|
|
333
302
|
// @ts-ignore
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
|
|
303
|
+
toolbarTitle: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.time.title", defaultMessage: "ui.eventForm.time.title" })
|
|
304
|
+
}
|
|
305
|
+
}, onChange: (value) => handleChangeDateTime(value, 'startTime') })] })) })), (0, jsx_runtime_1.jsxs)(material_1.FormControl, Object.assign({ className: classes.frequency }, { children: [field.recurring !== types_1.SCEventRecurrenceType.NEVER && (0, jsx_runtime_1.jsx)(material_1.InputLabel, Object.assign({ id: "recurring" }, { children: `${intl.formatMessage(messages.frequency)}` })), (0, jsx_runtime_1.jsx)(material_1.Select, Object.assign({ name: "recurring", label: field.recurring !== types_1.SCEventRecurrenceType.NEVER && `${intl.formatMessage(messages.frequency)}`, labelId: "recurring", value: field.recurring, onChange: handleChange, displayEmpty: true, renderValue: (selected) => {
|
|
306
|
+
if (!selected) {
|
|
307
|
+
return (0, jsx_runtime_1.jsx)("em", { children: `${intl.formatMessage(messages.frequencyPlaceholder)}` });
|
|
308
|
+
}
|
|
309
|
+
return ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventForm.frequency.${selected}.placeholder`, defaultMessage: `ui.eventForm.frequency.${selected}.placeholder` }));
|
|
310
|
+
}, startAdornment: (0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "frequency" }) }) })) }, { children: Object.values(types_1.SCEventRecurrenceType).map((f) => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ value: f }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventForm.frequency.${f}.placeholder`, defaultMessage: `ui.eventForm.frequency.${f}.placeholder` }) }), f))) }))] })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.dateTime }, { children: (0, jsx_runtime_1.jsxs)(x_date_pickers_1.LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns_1.AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? it_1.default : en_US_1.default }, { children: [(0, jsx_runtime_1.jsx)(x_date_pickers_1.MobileDatePicker, { className: classes.picker, disablePast: true, minDate: field.startDate, label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.date.end.placeholder", defaultMessage: "ui.eventForm.date.end.placeholder" }), value: field.endDate, slots: {
|
|
311
|
+
textField: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.endDate)}`, startAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "calendar_off" }) }) }))) }) })))
|
|
312
|
+
}, onChange: (value) => handleChangeDateTime(value, 'endDate'), shouldDisableDate: shouldDisabledDate }), (0, jsx_runtime_1.jsx)(x_date_pickers_1.MobileTimePicker, { className: classes.picker, disablePast: disablePastEndTime, label: field.endTime && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.time.end.placeholder", defaultMessage: "ui.eventForm.time.end.placeholder" }), value: field.endTime, slots: {
|
|
313
|
+
textField: (params) => {
|
|
314
|
+
var _a;
|
|
315
|
+
return ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.endTime)}`, startAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "access_time" }) }) }))) }), error: Boolean(error['endDateError']), helperText: ((_a = error['endDateError']) === null || _a === void 0 ? void 0 : _a.error) ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.time.end.error.invalid", defaultMessage: "ui.eventForm.time.end.error.invalid" })) : null })));
|
|
316
|
+
}
|
|
317
|
+
}, onChange: (value) => handleChangeDateTime(value, 'endTime'), shouldDisableTime: shouldDisabledTime })] })) })), (0, jsx_runtime_1.jsx)(EventAddress_1.default, { forwardGeolocationData: handleGeoData, event: event !== null && event !== void 0 ? event : null }), privateEnabled && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.privacySection }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center", justifyContent: "center" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.switchLabel, { [classes.active]: !field.isPublic }) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.private", defaultMessage: "ui.eventForm.privacy.private" })] })), (0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: field.isPublic, onChange: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['isPublic']: !field.isPublic }))), disabled: event && !field.isPublic }), (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.switchLabel, { [classes.active]: field.isPublic }) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.public", defaultMessage: "ui.eventForm.privacy.public" })] }))] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", textAlign: "center", className: classes.privacySectionInfo }, { children: field.isPublic ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.public.info", defaultMessage: "ui.eventForm.privacy.public.info", values: {
|
|
318
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
319
|
+
// @ts-ignore
|
|
320
|
+
b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
|
|
321
|
+
} })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.private.info", defaultMessage: "ui.eventForm.private.public.info", values: {
|
|
322
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
323
|
+
// @ts-ignore
|
|
324
|
+
b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
|
|
325
|
+
} })) }))] }))), (0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
|
|
326
|
+
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((_b = field.description) === null || _b === void 0 ? void 0 : _b.length) ? Event_1.EVENT_DESCRIPTION_MAX_LENGTH - field.description.length : Event_1.EVENT_DESCRIPTION_MAX_LENGTH })))
|
|
327
|
+
}, error: Boolean(((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) > Event_1.EVENT_DESCRIPTION_MAX_LENGTH), helperText: ((_d = field.description) === null || _d === void 0 ? void 0 : _d.length) > Event_1.EVENT_DESCRIPTION_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.description.error.maxLength", defaultMessage: "ui.eventForm.description.error.maxLength" })) : null }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.actions }, { children: (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ loading: field.isSubmitting, disabled: !field.name ||
|
|
328
|
+
!field.startDate ||
|
|
329
|
+
!field.startTime ||
|
|
330
|
+
!field.endDate ||
|
|
331
|
+
!field.endTime ||
|
|
332
|
+
(field.location === types_1.SCEventLocationType.ONLINE && !field.link) ||
|
|
333
|
+
(field.location === types_1.SCEventLocationType.PERSON && !field.geolocation) ||
|
|
334
|
+
(field.recurring !== types_1.SCEventRecurrenceType.NEVER && !field.endDate && !field.endTime) ||
|
|
335
|
+
Object.keys(error).length !== 0 ||
|
|
336
|
+
field.name.length > Event_1.EVENT_TITLE_MAX_LENGTH ||
|
|
337
|
+
field.description.length > Event_1.EVENT_DESCRIPTION_MAX_LENGTH, variant: "contained", onClick: handleSubmit, color: "secondary" }, { children: event ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.button.edit", defaultMessage: "ui.eventForm.button.edit" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.button.create", defaultMessage: "ui.eventForm.button.create" })) })) }))] }))] })));
|
|
338
338
|
}
|
|
339
339
|
exports.default = EventForm;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { BaseDialogProps } from '../../shared/BaseDialog';
|
|
2
|
+
import { EventFormProps } from '../EventForm';
|
|
3
|
+
export interface EventFormDialogProps extends BaseDialogProps {
|
|
4
|
+
/**
|
|
5
|
+
* Overrides or extends the styles applied to the component.
|
|
6
|
+
* @default null
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Open dialog
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
open?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* On dialog close callback function
|
|
16
|
+
* @default null
|
|
17
|
+
*/
|
|
18
|
+
onClose?: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Props to spread to EventForm component
|
|
21
|
+
* @default {}
|
|
22
|
+
*/
|
|
23
|
+
EventFormComponentProps?: EventFormProps;
|
|
24
|
+
/**
|
|
25
|
+
* Any other properties
|
|
26
|
+
*/
|
|
27
|
+
[p: string]: any;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
*> API documentation for the Community-JS EventFormDialog component. Learn about the available props and the CSS API.
|
|
31
|
+
*
|
|
32
|
+
#### Import
|
|
33
|
+
```jsx
|
|
34
|
+
import {EventFormDialog} from '@selfcommunity/react-ui';
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
#### Component Name
|
|
38
|
+
The name `SCEventFormDialog` can be used when providing style overrides in the theme.
|
|
39
|
+
|
|
40
|
+
#### CSS
|
|
41
|
+
|
|
42
|
+
|Rule Name|Global class|Description|
|
|
43
|
+
|---|---|---|
|
|
44
|
+
|root|.SCEventFormDialog-root|Styles applied to the root element.|
|
|
45
|
+
|
|
46
|
+
* @param inProps
|
|
47
|
+
*/
|
|
48
|
+
export default function EventFormDialog(inProps: EventFormDialogProps): JSX.Element;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const system_1 = require("@mui/system");
|
|
7
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
8
|
+
const react_intl_1 = require("react-intl");
|
|
9
|
+
const BaseDialog_1 = tslib_1.__importDefault(require("../../shared/BaseDialog"));
|
|
10
|
+
const constants_1 = require("./constants");
|
|
11
|
+
const EventForm_1 = tslib_1.__importDefault(require("../EventForm"));
|
|
12
|
+
const react_1 = require("react");
|
|
13
|
+
const classes = {
|
|
14
|
+
root: `${constants_1.PREFIX}-root`
|
|
15
|
+
};
|
|
16
|
+
const Root = (0, styles_1.styled)(BaseDialog_1.default, {
|
|
17
|
+
name: constants_1.PREFIX,
|
|
18
|
+
slot: 'Root'
|
|
19
|
+
})(() => ({}));
|
|
20
|
+
/**
|
|
21
|
+
*> API documentation for the Community-JS EventFormDialog component. Learn about the available props and the CSS API.
|
|
22
|
+
*
|
|
23
|
+
#### Import
|
|
24
|
+
```jsx
|
|
25
|
+
import {EventFormDialog} from '@selfcommunity/react-ui';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
#### Component Name
|
|
29
|
+
The name `SCEventFormDialog` can be used when providing style overrides in the theme.
|
|
30
|
+
|
|
31
|
+
#### CSS
|
|
32
|
+
|
|
33
|
+
|Rule Name|Global class|Description|
|
|
34
|
+
|---|---|---|
|
|
35
|
+
|root|.SCEventFormDialog-root|Styles applied to the root element.|
|
|
36
|
+
|
|
37
|
+
* @param inProps
|
|
38
|
+
*/
|
|
39
|
+
function EventFormDialog(inProps) {
|
|
40
|
+
//PROPS
|
|
41
|
+
const props = (0, system_1.useThemeProps)({
|
|
42
|
+
props: inProps,
|
|
43
|
+
name: constants_1.PREFIX
|
|
44
|
+
});
|
|
45
|
+
const { className, open = true, onClose, EventFormComponentProps = {} } = props, rest = tslib_1.__rest(props, ["className", "open", "onClose", "EventFormComponentProps"]);
|
|
46
|
+
const handleSuccess = (0, react_1.useCallback)((event) => {
|
|
47
|
+
var _a;
|
|
48
|
+
(_a = EventFormComponentProps.onSuccess) === null || _a === void 0 ? void 0 : _a.call(EventFormComponentProps, event);
|
|
49
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
50
|
+
}, [onClose, EventFormComponentProps]);
|
|
51
|
+
/**
|
|
52
|
+
* Renders root object
|
|
53
|
+
*/
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ DialogContentProps: { dividers: false }, title: (EventFormComponentProps === null || EventFormComponentProps === void 0 ? void 0 : EventFormComponentProps.event) ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.title.edit", defaultMessage: "ui.eventForm.title.edit" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.title", defaultMessage: "ui.eventForm.title" })), open: open, onClose: onClose, className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsx)(EventForm_1.default, Object.assign({}, EventFormComponentProps, { onSuccess: handleSuccess })) })));
|
|
55
|
+
}
|
|
56
|
+
exports.default = EventFormDialog;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PREFIX = "SCEventFormDialog";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SCEventType } from '@selfcommunity/types';
|
|
2
|
+
import { CacheStrategies } from '@selfcommunity/utils';
|
|
3
|
+
import { BaseDialogProps } from '../../shared/BaseDialog';
|
|
4
|
+
import { WidgetProps } from '../Widget';
|
|
5
|
+
export interface EventMediaWidgetProps extends WidgetProps {
|
|
6
|
+
/**
|
|
7
|
+
* Event Object
|
|
8
|
+
* @default null
|
|
9
|
+
*/
|
|
10
|
+
event?: SCEventType;
|
|
11
|
+
/**
|
|
12
|
+
* Id of event object
|
|
13
|
+
* @default null
|
|
14
|
+
*/
|
|
15
|
+
eventId?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Feed API Query Params
|
|
18
|
+
* @default [{'limit': 20, 'offset': 0}]
|
|
19
|
+
*/
|
|
20
|
+
endpointQueryParams?: Record<string, string | number>;
|
|
21
|
+
/**
|
|
22
|
+
* Caching strategies
|
|
23
|
+
* @default CacheStrategies.CACHE_FIRST
|
|
24
|
+
*/
|
|
25
|
+
cacheStrategy?: CacheStrategies;
|
|
26
|
+
/**
|
|
27
|
+
* Props to spread to users suggestion dialog
|
|
28
|
+
* @default {}
|
|
29
|
+
*/
|
|
30
|
+
dialogProps?: BaseDialogProps;
|
|
31
|
+
limit?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Other props
|
|
34
|
+
*/
|
|
35
|
+
[p: string]: any;
|
|
36
|
+
}
|
|
37
|
+
export default function EventMediaWidget(inProps: EventMediaWidgetProps): JSX.Element;
|