@selfcommunity/react-ui 0.11.0-mui7.24 → 0.11.0-mui7.27
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/Composer/Layer/ScheduledLayer/ScheduledLayer.js +1 -1
- package/lib/cjs/components/EventForm/EventAddress.js +3 -3
- package/lib/cjs/components/EventForm/EventForm.js +75 -56
- package/lib/cjs/components/EventLocationWidget/EventLocationWidget.js +4 -9
- package/lib/cjs/components/EventLocationWidget/EventMap.d.ts +8 -0
- package/lib/cjs/components/EventLocationWidget/EventMap.js +22 -0
- package/lib/cjs/components/LessonReleaseMenu/LessonReleaseMenu.js +13 -14
- package/lib/cjs/components/LocationAutocomplete/LocationAutocomplete.js +10 -9
- package/lib/cjs/components/PaymentOrders/PaymentOrders.js +27 -25
- package/lib/cjs/components/UserProfileEdit/Section/PublicInfo.js +5 -15
- package/lib/cjs/shared/Media/File/DocComponent.d.ts +2 -0
- package/lib/cjs/shared/Media/File/DocComponent.js +3 -2
- package/lib/cjs/shared/Media/File/PreviewComponent.js +4 -3
- package/lib/esm/components/Composer/Layer/ScheduledLayer/ScheduledLayer.js +1 -1
- package/lib/esm/components/EventForm/EventAddress.js +3 -3
- package/lib/esm/components/EventForm/EventForm.js +76 -57
- package/lib/esm/components/EventLocationWidget/EventLocationWidget.js +5 -10
- package/lib/esm/components/EventLocationWidget/EventMap.d.ts +8 -0
- package/lib/esm/components/EventLocationWidget/EventMap.js +19 -0
- package/lib/esm/components/LessonReleaseMenu/LessonReleaseMenu.js +13 -14
- package/lib/esm/components/LocationAutocomplete/LocationAutocomplete.js +2 -1
- package/lib/esm/components/PaymentOrders/PaymentOrders.js +27 -25
- package/lib/esm/components/UserProfileEdit/Section/PublicInfo.js +8 -18
- package/lib/esm/shared/Media/File/DocComponent.d.ts +2 -0
- package/lib/esm/shared/Media/File/DocComponent.js +3 -2
- package/lib/esm/shared/Media/File/PreviewComponent.js +4 -3
- package/lib/umd/484.js +1 -1
- package/lib/umd/484.js.LICENSE.txt +1 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +11 -11
- package/lib/cjs/shared/UpScalingTierBadge/UpScalingTierBadge.d.ts +0 -5
- package/lib/cjs/shared/UpScalingTierBadge/UpScalingTierBadge.js +0 -14
- package/lib/esm/shared/UpScalingTierBadge/UpScalingTierBadge.d.ts +0 -5
- package/lib/esm/shared/UpScalingTierBadge/UpScalingTierBadge.js +0 -10
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { SCMediaType } from '@selfcommunity/types';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
2
3
|
interface DocComponentProps {
|
|
3
4
|
document: SCMediaType;
|
|
4
5
|
index?: number;
|
|
5
6
|
onDelete?: (id: number) => void;
|
|
6
7
|
handleDownload?: (id: number) => void;
|
|
7
8
|
onMediaClick?: (media: SCMediaType) => void;
|
|
9
|
+
className?: HTMLAttributes<HTMLDivElement>['className'];
|
|
8
10
|
}
|
|
9
11
|
export default function DocComponent(props: DocComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export {};
|
|
@@ -4,6 +4,7 @@ import { PREFIX } from './constants';
|
|
|
4
4
|
import { Link } from '@selfcommunity/react-core';
|
|
5
5
|
import { SCMimeTypes } from '@selfcommunity/types';
|
|
6
6
|
import { useCallback } from 'react';
|
|
7
|
+
import classNames from 'classnames';
|
|
7
8
|
import txt from '../../../assets/composer/txt';
|
|
8
9
|
import pdf from '../../../assets/composer/pdf';
|
|
9
10
|
import doc from '../../../assets/composer/doc';
|
|
@@ -33,7 +34,7 @@ function formatBytes(bytes, decimals = 2) {
|
|
|
33
34
|
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
34
35
|
}
|
|
35
36
|
export default function DocComponent(props) {
|
|
36
|
-
const { document, index, onDelete, handleDownload, onMediaClick } = props;
|
|
37
|
+
const { document, index, onDelete, handleDownload, onMediaClick, className } = props;
|
|
37
38
|
const getImage = useCallback(() => {
|
|
38
39
|
switch (document.mimetype) {
|
|
39
40
|
case SCMimeTypes.PLAIN_TEXT:
|
|
@@ -68,5 +69,5 @@ export default function DocComponent(props) {
|
|
|
68
69
|
return fallback;
|
|
69
70
|
}
|
|
70
71
|
}, [document.mimetype]);
|
|
71
|
-
return (_jsxs(Root, Object.assign({ className: classes.docRoot }, { children: [_jsx(Box, { component: "img", alt: document.title, src: getImage() }), _jsxs(Stack, Object.assign({ className: classes.textWrapper }, { children: [_jsx(Typography, Object.assign({ className: classes.title }, { children: document.title })), document.size && _jsx(Typography, Object.assign({ className: classes.subtitle }, { children: formatBytes(document.size) }))] })), (handleDownload || onDelete) && (_jsxs(Stack, Object.assign({ className: classes.actionWrapper }, { children: [onDelete && (_jsx(IconButton, Object.assign({ className: classes.action, onClick: () => onDelete(document.id) }, { children: _jsx(Icon, { children: "delete" }) }))), handleDownload && (_jsxs(_Fragment, { children: [document.mimetype === SCMimeTypes.PDF && (_jsx(IconButton, Object.assign({ className: classes.action, component: Link, to: document.url, target: "_blank", onClick: () => onMediaClick === null || onMediaClick === void 0 ? void 0 : onMediaClick(document) }, { children: _jsx(Icon, { children: "visibility" }) }))), _jsx(IconButton, Object.assign({ className: classes.action, onClick: () => handleDownload(index) }, { children: _jsx(Icon, { children: "download" }) }))] }))] })))] })));
|
|
72
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.docRoot, className) }, { children: [_jsx(Box, { component: "img", alt: document.title, src: getImage() }), _jsxs(Stack, Object.assign({ className: classes.textWrapper }, { children: [_jsx(Typography, Object.assign({ className: classes.title }, { children: document.title })), document.size && _jsx(Typography, Object.assign({ className: classes.subtitle }, { children: formatBytes(document.size) }))] })), (handleDownload || onDelete) && (_jsxs(Stack, Object.assign({ className: classes.actionWrapper }, { children: [onDelete && (_jsx(IconButton, Object.assign({ className: classes.action, onClick: () => onDelete(document.id) }, { children: _jsx(Icon, { children: "delete" }) }))), handleDownload && (_jsxs(_Fragment, { children: [document.mimetype === SCMimeTypes.PDF && (_jsx(IconButton, Object.assign({ className: classes.action, component: Link, to: document.url, target: "_blank", onClick: () => onMediaClick === null || onMediaClick === void 0 ? void 0 : onMediaClick(document) }, { children: _jsx(Icon, { children: "visibility" }) }))), _jsx(IconButton, Object.assign({ className: classes.action, onClick: () => handleDownload(index) }, { children: _jsx(Icon, { children: "download" }) }))] }))] })))] })));
|
|
72
73
|
}
|
|
@@ -12,7 +12,8 @@ const classes = {
|
|
|
12
12
|
media: `${PREFIX}-media`,
|
|
13
13
|
delete: `${PREFIX}-delete`,
|
|
14
14
|
title: `${PREFIX}-title`,
|
|
15
|
-
docsWrapper: `${PREFIX}-docs-wrapper
|
|
15
|
+
docsWrapper: `${PREFIX}-docs-wrapper`,
|
|
16
|
+
doc: `${PREFIX}-doc`
|
|
16
17
|
};
|
|
17
18
|
const Root = styled(Box, {
|
|
18
19
|
name: PREFIX,
|
|
@@ -41,7 +42,7 @@ const PreviewComponent = forwardRef((props, ref) => {
|
|
|
41
42
|
const handleDelete = useCallback((id) => onChange && onChange(value.filter((media) => media.id !== id)), [onChange, value]);
|
|
42
43
|
// RENDER
|
|
43
44
|
const imageElements = useMemo(() => images.map((media) => (_jsxs(Box, Object.assign({ className: classes.media, sx: { backgroundImage: `url(${(media === null || media === void 0 ? void 0 : media.image_thumbnail) ? media.image_thumbnail.url : media.image})` } }, { children: [_jsx(IconButton, Object.assign({ className: classes.delete, onClick: () => handleDelete(media.id), size: "small" }, { children: _jsx(Icon, { children: "delete" }) })), media.title && _jsx(Typography, Object.assign({ className: classes.title }, { children: media.title }))] }), media.id))), [images]);
|
|
44
|
-
const docElements = useMemo(() => docs.map((doc) => _jsx(DocComponent, { document: doc, onDelete: handleDelete }, doc.id)), [docs]);
|
|
45
|
-
return (_jsx(Root, Object.assign({ ref: ref, className: classNames(
|
|
45
|
+
const docElements = useMemo(() => docs.map((doc) => _jsx(DocComponent, { document: doc, onDelete: handleDelete, className: classes.doc }, doc.id)), [docs]);
|
|
46
|
+
return (_jsx(Root, Object.assign({ ref: ref, className: classNames(classes.previewRoot, className) }, rest, { children: mediasLength > 0 && (_jsxs(_Fragment, { children: [_jsx(ReactSortable, Object.assign({ list: images, setList: handleSort, scroll: true, animation: 200, scrollSensitivity: 50 }, { children: imageElements })), _jsx(ReactSortable, Object.assign({ list: docs, setList: handleSort, animation: 200, direction: "vertical", className: classes.docsWrapper }, { children: docElements }))] })) })));
|
|
46
47
|
});
|
|
47
48
|
export default PreviewComponent;
|