@selfcommunity/react-ui 0.7.9-alpha.2 → 0.7.9-alpha.20
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/BottomNavigation/BottomNavigation.js +3 -1
- package/lib/cjs/components/ChangeGroupCover/ChangeGroupCover.js +24 -1
- package/lib/cjs/components/ChangeGroupPicture/ChangeGroupPicture.js +32 -11
- package/lib/cjs/components/Composer/Attributes/Attributes.d.ts +1 -1
- package/lib/cjs/components/Composer/Attributes/Attributes.js +9 -2
- package/lib/cjs/components/Composer/Composer.d.ts +2 -1
- package/lib/cjs/components/Composer/Composer.js +39 -12
- package/lib/cjs/components/Composer/Content/ContentDiscussion/ContentDiscussion.js +7 -3
- package/lib/cjs/components/Composer/Content/ContentPost/ContentPost.js +4 -3
- package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +7 -1
- package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.js +46 -12
- package/lib/cjs/components/CreateGroupButton/CreateGroupButton.d.ts +2 -2
- package/lib/cjs/components/CreateGroupButton/CreateGroupButton.js +5 -6
- package/lib/cjs/components/CustomAdv/CustomAdv.d.ts +4 -0
- package/lib/cjs/components/{CreateGroup/CreateGroup.d.ts → EditGroupButton/EditGroupButton.d.ts} +11 -16
- package/lib/cjs/components/EditGroupButton/EditGroupButton.js +61 -0
- package/lib/cjs/components/EditGroupButton/index.d.ts +3 -0
- package/lib/cjs/components/EditGroupButton/index.js +5 -0
- package/lib/cjs/components/FeedObject/FeedObject.d.ts +1 -0
- package/lib/cjs/components/FeedObject/FeedObject.js +23 -6
- package/lib/cjs/components/Group/Group.d.ts +4 -3
- package/lib/cjs/components/Group/Group.js +5 -4
- package/lib/cjs/components/Group/Skeleton.js +1 -1
- package/lib/cjs/components/GroupAutocomplete/GroupAutocomplete.d.ts +49 -0
- package/lib/cjs/components/GroupAutocomplete/GroupAutocomplete.js +101 -0
- package/lib/cjs/components/GroupAutocomplete/index.d.ts +3 -0
- package/lib/cjs/components/GroupAutocomplete/index.js +5 -0
- package/lib/cjs/components/GroupForm/GroupForm.d.ts +70 -0
- package/lib/cjs/components/GroupForm/GroupForm.js +239 -0
- package/lib/cjs/components/GroupForm/constants.d.ts +1 -0
- package/lib/cjs/components/{CreateGroup → GroupForm}/constants.js +1 -1
- package/lib/cjs/components/GroupForm/index.d.ts +3 -0
- package/lib/cjs/components/GroupForm/index.js +5 -0
- package/lib/cjs/components/GroupHeader/GroupHeader.d.ts +6 -5
- package/lib/cjs/components/GroupHeader/GroupHeader.js +21 -11
- package/lib/cjs/components/GroupHeader/Skeleton.d.ts +2 -4
- package/lib/cjs/components/GroupHeader/Skeleton.js +10 -10
- package/lib/cjs/components/GroupInfoWidget/GroupInfoWidget.js +8 -8
- package/lib/cjs/components/GroupInviteButton/GroupInviteButton.js +9 -6
- package/lib/cjs/components/GroupMembersButton/GroupMembersButton.d.ts +5 -0
- package/lib/cjs/components/GroupMembersButton/GroupMembersButton.js +3 -2
- package/lib/cjs/components/GroupMembersWidget/GroupMembersWidget.js +29 -14
- package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.d.ts +0 -5
- package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.js +17 -7
- package/lib/cjs/components/GroupSettingsIconButton/GroupSettingsIconButton.d.ts +56 -0
- package/lib/cjs/components/GroupSettingsIconButton/GroupSettingsIconButton.js +137 -0
- package/lib/cjs/components/GroupSettingsIconButton/index.d.ts +3 -0
- package/lib/cjs/components/GroupSettingsIconButton/index.js +5 -0
- package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.d.ts +7 -2
- package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.js +24 -9
- package/lib/cjs/components/Groups/Groups.d.ts +65 -0
- package/lib/cjs/components/Groups/Groups.js +135 -0
- package/lib/cjs/components/Groups/Skeleton.d.ts +34 -0
- package/lib/cjs/components/Groups/Skeleton.js +45 -0
- package/lib/cjs/components/Groups/constants.d.ts +1 -0
- package/lib/cjs/components/Groups/constants.js +4 -0
- package/lib/cjs/components/Groups/index.d.ts +4 -0
- package/lib/cjs/components/Groups/index.js +8 -0
- package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.d.ts +2 -1
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.js +1 -1
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +5 -1
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +4 -0
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +2 -3
- package/lib/cjs/components/PrivateMessageComponent/PrivateMessageComponent.d.ts +1 -1
- package/lib/cjs/components/PrivateMessageComponent/PrivateMessageComponent.js +10 -7
- package/lib/cjs/components/PrivateMessageSnippetItem/PrivateMessageSnippetItem.js +11 -6
- package/lib/cjs/components/PrivateMessageSnippets/PrivateMessageSnippets.d.ts +3 -3
- package/lib/cjs/components/PrivateMessageSnippets/PrivateMessageSnippets.js +24 -6
- package/lib/cjs/components/PrivateMessageThread/PrivateMessageThread.d.ts +6 -1
- package/lib/cjs/components/PrivateMessageThread/PrivateMessageThread.js +45 -20
- package/lib/cjs/index.d.ts +7 -3
- package/lib/cjs/index.js +14 -4
- package/lib/esm/components/BottomNavigation/BottomNavigation.js +3 -1
- package/lib/esm/components/ChangeGroupCover/ChangeGroupCover.js +24 -1
- package/lib/esm/components/ChangeGroupPicture/ChangeGroupPicture.js +32 -11
- package/lib/esm/components/Composer/Attributes/Attributes.d.ts +1 -1
- package/lib/esm/components/Composer/Attributes/Attributes.js +9 -2
- package/lib/esm/components/Composer/Composer.d.ts +2 -1
- package/lib/esm/components/Composer/Composer.js +39 -12
- package/lib/esm/components/Composer/Content/ContentDiscussion/ContentDiscussion.js +7 -3
- package/lib/esm/components/Composer/Content/ContentPost/ContentPost.js +4 -3
- package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +7 -1
- package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.js +45 -12
- package/lib/esm/components/CreateGroupButton/CreateGroupButton.d.ts +2 -2
- package/lib/esm/components/CreateGroupButton/CreateGroupButton.js +5 -6
- package/lib/esm/components/CustomAdv/CustomAdv.d.ts +4 -0
- package/lib/esm/components/{CreateGroup/CreateGroup.d.ts → EditGroupButton/EditGroupButton.d.ts} +11 -16
- package/lib/esm/components/EditGroupButton/EditGroupButton.js +58 -0
- package/lib/esm/components/EditGroupButton/index.d.ts +3 -0
- package/lib/esm/components/EditGroupButton/index.js +2 -0
- package/lib/esm/components/FeedObject/FeedObject.d.ts +1 -0
- package/lib/esm/components/FeedObject/FeedObject.js +24 -7
- package/lib/esm/components/Group/Group.d.ts +4 -3
- package/lib/esm/components/Group/Group.js +5 -4
- package/lib/esm/components/Group/Skeleton.js +1 -1
- package/lib/esm/components/GroupAutocomplete/GroupAutocomplete.d.ts +49 -0
- package/lib/esm/components/GroupAutocomplete/GroupAutocomplete.js +99 -0
- package/lib/esm/components/GroupAutocomplete/index.d.ts +3 -0
- package/lib/esm/components/GroupAutocomplete/index.js +2 -0
- package/lib/esm/components/GroupForm/GroupForm.d.ts +70 -0
- package/lib/esm/components/GroupForm/GroupForm.js +236 -0
- package/lib/esm/components/GroupForm/constants.d.ts +1 -0
- package/lib/esm/components/GroupForm/constants.js +1 -0
- package/lib/esm/components/GroupForm/index.d.ts +3 -0
- package/lib/esm/components/GroupForm/index.js +2 -0
- package/lib/esm/components/GroupHeader/GroupHeader.d.ts +6 -5
- package/lib/esm/components/GroupHeader/GroupHeader.js +21 -11
- package/lib/esm/components/GroupHeader/Skeleton.d.ts +2 -4
- package/lib/esm/components/GroupHeader/Skeleton.js +10 -10
- package/lib/esm/components/GroupInfoWidget/GroupInfoWidget.js +8 -8
- package/lib/esm/components/GroupInviteButton/GroupInviteButton.js +9 -6
- package/lib/esm/components/GroupMembersButton/GroupMembersButton.d.ts +5 -0
- package/lib/esm/components/GroupMembersButton/GroupMembersButton.js +4 -3
- package/lib/esm/components/GroupMembersWidget/GroupMembersWidget.js +31 -16
- package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.d.ts +0 -5
- package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.js +17 -7
- package/lib/esm/components/GroupSettingsIconButton/GroupSettingsIconButton.d.ts +56 -0
- package/lib/esm/components/GroupSettingsIconButton/GroupSettingsIconButton.js +134 -0
- package/lib/esm/components/GroupSettingsIconButton/index.d.ts +3 -0
- package/lib/esm/components/GroupSettingsIconButton/index.js +2 -0
- package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.d.ts +7 -2
- package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.js +25 -10
- package/lib/esm/components/Groups/Groups.d.ts +65 -0
- package/lib/esm/components/Groups/Groups.js +132 -0
- package/lib/esm/components/Groups/Skeleton.d.ts +34 -0
- package/lib/esm/components/Groups/Skeleton.js +42 -0
- package/lib/esm/components/Groups/constants.d.ts +1 -0
- package/lib/esm/components/Groups/constants.js +1 -0
- package/lib/esm/components/Groups/index.d.ts +4 -0
- package/lib/esm/components/Groups/index.js +4 -0
- package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.d.ts +2 -1
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.js +1 -1
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +5 -1
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +4 -0
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +2 -3
- package/lib/esm/components/PrivateMessageComponent/PrivateMessageComponent.d.ts +1 -1
- package/lib/esm/components/PrivateMessageComponent/PrivateMessageComponent.js +11 -8
- package/lib/esm/components/PrivateMessageSnippetItem/PrivateMessageSnippetItem.js +11 -6
- package/lib/esm/components/PrivateMessageSnippets/PrivateMessageSnippets.d.ts +3 -3
- package/lib/esm/components/PrivateMessageSnippets/PrivateMessageSnippets.js +26 -8
- package/lib/esm/components/PrivateMessageThread/PrivateMessageThread.d.ts +6 -1
- package/lib/esm/components/PrivateMessageThread/PrivateMessageThread.js +47 -22
- package/lib/esm/index.d.ts +7 -3
- package/lib/esm/index.js +8 -4
- package/lib/umd/react-ui.js +1 -1
- package/package.json +6 -6
- package/lib/cjs/components/CreateGroup/CreateGroup.js +0 -187
- package/lib/cjs/components/CreateGroup/constants.d.ts +0 -1
- package/lib/cjs/components/CreateGroup/index.d.ts +0 -3
- package/lib/cjs/components/CreateGroup/index.js +0 -5
- package/lib/esm/components/CreateGroup/CreateGroup.js +0 -184
- package/lib/esm/components/CreateGroup/constants.d.ts +0 -1
- package/lib/esm/components/CreateGroup/constants.js +0 -1
- package/lib/esm/components/CreateGroup/index.d.ts +0 -3
- package/lib/esm/components/CreateGroup/index.js +0 -2
|
@@ -23,6 +23,7 @@ const Root = styled(Box, {
|
|
|
23
23
|
const DEFAULT_DISCUSSION = {
|
|
24
24
|
title: '',
|
|
25
25
|
categories: [],
|
|
26
|
+
group: null,
|
|
26
27
|
medias: [],
|
|
27
28
|
html: '',
|
|
28
29
|
addressing: []
|
|
@@ -42,9 +43,12 @@ export default (props) => {
|
|
|
42
43
|
}, [value]);
|
|
43
44
|
// RENDER
|
|
44
45
|
return (React.createElement(Root, { className: classNames(classes.root, className) },
|
|
45
|
-
generalError && React.createElement(Typography, { className: classes.generalError },
|
|
46
|
-
React.createElement(FormattedMessage, { id: `ui.composer.error.${generalError}`, defaultMessage: `ui.composer.error.${generalError}` })),
|
|
47
|
-
React.createElement(TextField, { className: classes.title, placeholder: intl.formatMessage({
|
|
46
|
+
generalError && (React.createElement(Typography, { className: classes.generalError },
|
|
47
|
+
React.createElement(FormattedMessage, { id: `ui.composer.error.${generalError}`, defaultMessage: `ui.composer.error.${generalError}` }))),
|
|
48
|
+
React.createElement(TextField, { className: classes.title, placeholder: intl.formatMessage({
|
|
49
|
+
id: 'ui.composer.content.discussion.title.label',
|
|
50
|
+
defaultMessage: 'ui.composer.content.discussion.title.label'
|
|
51
|
+
}), autoFocus: true, fullWidth: true, variant: "outlined", value: value.title, multiline: true, onChange: handleChangeTitle, InputProps: {
|
|
48
52
|
endAdornment: React.createElement(Typography, { variant: "body2" }, COMPOSER_TITLE_MAX_LENGTH - value.title.length)
|
|
49
53
|
}, error: Boolean(titleError), helperText: titleError, disabled: disabled }),
|
|
50
54
|
React.createElement(Editor, Object.assign({}, EditorProps, { editable: !disabled, className: classes.editor, onChange: handleChangeHtml, defaultValue: value.html }))));
|
|
@@ -22,7 +22,8 @@ const DEFAULT_POST = {
|
|
|
22
22
|
categories: [],
|
|
23
23
|
medias: [],
|
|
24
24
|
html: '',
|
|
25
|
-
addressing: []
|
|
25
|
+
addressing: [],
|
|
26
|
+
group: null
|
|
26
27
|
};
|
|
27
28
|
export default (props) => {
|
|
28
29
|
// PROPS
|
|
@@ -40,7 +41,7 @@ export default (props) => {
|
|
|
40
41
|
}, [value]);
|
|
41
42
|
// RENDER
|
|
42
43
|
return (React.createElement(Root, { className: classNames(classes.root, className) },
|
|
43
|
-
generalError && React.createElement(Typography, { className: classes.generalError },
|
|
44
|
-
React.createElement(FormattedMessage, { id: `ui.composer.error.${generalError}`, defaultMessage: `ui.composer.error.${generalError}` })),
|
|
44
|
+
generalError && (React.createElement(Typography, { className: classes.generalError },
|
|
45
|
+
React.createElement(FormattedMessage, { id: `ui.composer.error.${generalError}`, defaultMessage: `ui.composer.error.${generalError}` }))),
|
|
45
46
|
React.createElement(Editor, Object.assign({ ref: editorRef }, EditorProps, { editable: !disabled, className: classes.editor, onChange: handleChangeHtml, defaultValue: value.html }))));
|
|
46
47
|
};
|
|
@@ -3,8 +3,14 @@ import { TextFieldProps } from '@mui/material/TextField';
|
|
|
3
3
|
import { BoxProps } from '@mui/material';
|
|
4
4
|
import { SCTagType } from '@selfcommunity/types/src/index';
|
|
5
5
|
import { ComposerLayerProps } from '../../../../types/composer';
|
|
6
|
+
import { SCGroupType } from '@selfcommunity/types';
|
|
7
|
+
export declare enum AudienceTypes {
|
|
8
|
+
AUDIENCE_ALL = "all",
|
|
9
|
+
AUDIENCE_TAG = "tag",
|
|
10
|
+
AUDIENCE_GROUP = "group"
|
|
11
|
+
}
|
|
6
12
|
export interface AudienceLayerProps extends Omit<BoxProps, 'defaultValue'>, ComposerLayerProps {
|
|
7
|
-
defaultValue: SCTagType[];
|
|
13
|
+
defaultValue: SCTagType[] | SCGroupType;
|
|
8
14
|
TextFieldProps?: TextFieldProps;
|
|
9
15
|
}
|
|
10
16
|
declare const AudienceLayer: React.ForwardRefExoticComponent<Pick<AudienceLayerProps, "p" | "slot" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "component" | "sx" | "classes" | "onClose" | "TextFieldProps" | "onSave"> & React.RefAttributes<unknown>>;
|
|
@@ -12,8 +12,13 @@ import Icon from '@mui/material/Icon';
|
|
|
12
12
|
import DialogContent from '@mui/material/DialogContent';
|
|
13
13
|
import { useSCFetchAddressingTagList } from '@selfcommunity/react-core';
|
|
14
14
|
import { PREFIX } from '../../constants';
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
import GroupAutocomplete from '../../../GroupAutocomplete';
|
|
16
|
+
export var AudienceTypes;
|
|
17
|
+
(function (AudienceTypes) {
|
|
18
|
+
AudienceTypes["AUDIENCE_ALL"] = "all";
|
|
19
|
+
AudienceTypes["AUDIENCE_TAG"] = "tag";
|
|
20
|
+
AudienceTypes["AUDIENCE_GROUP"] = "group";
|
|
21
|
+
})(AudienceTypes || (AudienceTypes = {}));
|
|
17
22
|
const classes = {
|
|
18
23
|
root: `${PREFIX}-layer-audience-root`,
|
|
19
24
|
title: `${PREFIX}-layer-title`,
|
|
@@ -27,23 +32,36 @@ const Root = styled(Box, {
|
|
|
27
32
|
})(() => ({}));
|
|
28
33
|
const AudienceLayer = React.forwardRef((props, ref) => {
|
|
29
34
|
// Props
|
|
30
|
-
const { className, onClose, onSave, defaultValue = [], TextFieldProps = {
|
|
35
|
+
const { className, onClose, onSave, defaultValue = AudienceTypes.AUDIENCE_TAG ? [] : null, TextFieldProps = {
|
|
31
36
|
variant: 'outlined',
|
|
32
37
|
label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.tags.label", defaultMessage: "ui.composer.layer.audience.tags.label" })
|
|
33
38
|
} } = props, rest = __rest(props, ["className", "onClose", "onSave", "defaultValue", "TextFieldProps"]);
|
|
34
39
|
// STATE
|
|
35
40
|
const [autocompleteOpen, setAutocompleteOpen] = useState(false);
|
|
36
|
-
const [audience, setAudience] = useState(
|
|
41
|
+
const [audience, setAudience] = useState(
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
defaultValue === null || defaultValue.length === 0
|
|
45
|
+
? AudienceTypes.AUDIENCE_ALL
|
|
46
|
+
: defaultValue && typeof defaultValue === 'object'
|
|
47
|
+
? AudienceTypes.AUDIENCE_GROUP
|
|
48
|
+
: AudienceTypes.AUDIENCE_TAG);
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
50
|
+
// @ts-ignore
|
|
37
51
|
const [value, setValue] = useState(defaultValue || undefined);
|
|
38
52
|
// HOOKS
|
|
39
53
|
const { scAddressingTags } = useSCFetchAddressingTagList({ fetch: autocompleteOpen });
|
|
40
54
|
// HANDLERS
|
|
41
|
-
const handleSave = useCallback(
|
|
55
|
+
const handleSave = useCallback(
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
57
|
+
// @ts-ignore
|
|
58
|
+
() => (audience === AudienceTypes.AUDIENCE_GROUP ? onSave(value) : onSave((value === null || value === void 0 ? void 0 : value.length) && (value === null || value === void 0 ? void 0 : value.length) > 0 ? value : null)), [value, onSave, audience]);
|
|
42
59
|
const handleChange = useCallback((event, tags) => setValue(tags), []);
|
|
60
|
+
const handleGroupChange = useCallback((group) => setValue(group), []);
|
|
43
61
|
const handleChangeAudience = useCallback((event, data) => setAudience(data), []);
|
|
44
62
|
const handleAutocompleteOpen = useCallback(() => setAutocompleteOpen(true), []);
|
|
45
63
|
const handleAutocompleteClose = useCallback(() => setAutocompleteOpen(false), []);
|
|
46
|
-
return React.createElement(Root, Object.assign({ ref: ref, className: classNames(className, classes.root) }, rest),
|
|
64
|
+
return (React.createElement(Root, Object.assign({ ref: ref, className: classNames(className, classes.root) }, rest),
|
|
47
65
|
React.createElement(DialogTitle, { className: classes.title },
|
|
48
66
|
React.createElement(IconButton, { onClick: onClose },
|
|
49
67
|
React.createElement(Icon, null, "arrow_back")),
|
|
@@ -53,12 +71,26 @@ const AudienceLayer = React.forwardRef((props, ref) => {
|
|
|
53
71
|
React.createElement(FormattedMessage, { id: "ui.composer.layer.save", defaultMessage: "ui.composer.layer.save" }))),
|
|
54
72
|
React.createElement(DialogContent, { className: classes.content },
|
|
55
73
|
React.createElement(Tabs, { value: audience, onChange: handleChangeAudience, "aria-label": "audience type" },
|
|
56
|
-
React.createElement(Tab, { value: AUDIENCE_ALL, icon: React.createElement(Icon, null, "public"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.all", defaultMessage: "ui.composer.layer.audience.all" }) }),
|
|
57
|
-
React.createElement(Tab
|
|
74
|
+
React.createElement(Tab, { value: AudienceTypes.AUDIENCE_ALL, icon: React.createElement(Icon, null, "public"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.all", defaultMessage: "ui.composer.layer.audience.all" }) }),
|
|
75
|
+
React.createElement(Tab
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
77
|
+
// @ts-ignore
|
|
78
|
+
, {
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
80
|
+
// @ts-ignore
|
|
81
|
+
disabled: defaultValue && typeof defaultValue !== 'object', value: AudienceTypes.AUDIENCE_GROUP, icon: React.createElement(Icon, null, "groups"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.group", defaultMessage: "ui.composer.layer.audience.group" }) }),
|
|
82
|
+
React.createElement(Tab
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
, {
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
87
|
+
// @ts-ignore
|
|
88
|
+
disabled: value && typeof defaultValue === 'object', value: AudienceTypes.AUDIENCE_TAG, icon: React.createElement(Icon, null, "label"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.tag", defaultMessage: "ui.composer.layer.audience.tag" }) })),
|
|
58
89
|
React.createElement(Typography, { className: classes.message },
|
|
59
|
-
audience === AUDIENCE_ALL && (React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.all.message", defaultMessage: "ui.composer.audience.layer.all.message" })),
|
|
60
|
-
audience ===
|
|
61
|
-
|
|
90
|
+
audience === AudienceTypes.AUDIENCE_ALL && (React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.all.message", defaultMessage: "ui.composer.audience.layer.all.message" })),
|
|
91
|
+
audience === AudienceTypes.AUDIENCE_GROUP && (React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.group.message", defaultMessage: "ui.composer.audience.layer.group.message" })),
|
|
92
|
+
audience === AudienceTypes.AUDIENCE_TAG && (React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.tag.message", defaultMessage: "ui.composer.audience.layer.tag.message" }))),
|
|
93
|
+
audience === AudienceTypes.AUDIENCE_TAG && (React.createElement(Autocomplete, { className: classes.autocomplete, open: autocompleteOpen, onOpen: handleAutocompleteOpen, onClose: handleAutocompleteClose, multiple: true, options: scAddressingTags || [], getOptionLabel: (option) => option.name || '', value: value, selectOnFocus: true, clearOnBlur: true, handleHomeEndKeys: true, clearIcon: null, noOptionsText: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.tags.empty", defaultMessage: "ui.composer.layer.audience.tags.empty" }), onChange: handleChange, isOptionEqualToValue: (option, value) => value.id === option.id, renderTags: (value, getTagProps) => {
|
|
62
94
|
return value.map((option, index) => React.createElement(TagChip, Object.assign({ key: option.id, tag: option }, getTagProps({ index }))));
|
|
63
95
|
}, renderOption: (props, option, { selected, inputValue }) => {
|
|
64
96
|
const matches = match(option.name, inputValue);
|
|
@@ -67,6 +99,7 @@ const AudienceLayer = React.forwardRef((props, ref) => {
|
|
|
67
99
|
React.createElement(TagChip, { key: option.id, tag: option, label: React.createElement(React.Fragment, null, parts.map((part, index) => (React.createElement("span", { key: index, style: { fontWeight: part.highlight ? 700 : 400 } }, part.text)))) })));
|
|
68
100
|
}, renderInput: (params) => {
|
|
69
101
|
return (React.createElement(TextField, Object.assign({}, params, TextFieldProps, { InputProps: Object.assign(Object.assign({}, params.InputProps), { autoComplete: 'addressing', endAdornment: React.createElement(React.Fragment, null, params.InputProps.endAdornment) }) })));
|
|
70
|
-
} }))
|
|
102
|
+
} })),
|
|
103
|
+
audience === AudienceTypes.AUDIENCE_GROUP && React.createElement(GroupAutocomplete, { onChange: handleGroupChange, defaultValue: defaultValue }))));
|
|
71
104
|
});
|
|
72
105
|
export default AudienceLayer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ButtonProps } from '@mui/material/Button/Button';
|
|
2
|
-
import {
|
|
2
|
+
import { GroupFormProps } from '../GroupForm';
|
|
3
3
|
export interface CreateGroupButtonProps extends ButtonProps {
|
|
4
4
|
/**
|
|
5
5
|
* Overrides or extends the styles applied to the component.
|
|
@@ -10,7 +10,7 @@ export interface CreateGroupButtonProps extends ButtonProps {
|
|
|
10
10
|
* Props to spread to CreateGroup component
|
|
11
11
|
* @default empty object
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
GroupFormProps?: GroupFormProps;
|
|
14
14
|
/**
|
|
15
15
|
* Any other properties
|
|
16
16
|
*/
|
|
@@ -6,7 +6,7 @@ import { Button, Icon } from '@mui/material';
|
|
|
6
6
|
import { FormattedMessage } from 'react-intl';
|
|
7
7
|
import { SCUserContext } from '@selfcommunity/react-core';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
|
-
import
|
|
9
|
+
import GroupForm from '../GroupForm';
|
|
10
10
|
const PREFIX = 'SCCreateGroupButton';
|
|
11
11
|
const classes = {
|
|
12
12
|
root: `${PREFIX}-root`
|
|
@@ -41,7 +41,7 @@ export default function CreateGroupButton(inProps) {
|
|
|
41
41
|
props: inProps,
|
|
42
42
|
name: PREFIX
|
|
43
43
|
});
|
|
44
|
-
const { className,
|
|
44
|
+
const { className, GroupFormProps = {}, children } = props, rest = __rest(props, ["className", "GroupFormProps", "children"]);
|
|
45
45
|
// CONTEXT
|
|
46
46
|
const scUserContext = useContext(SCUserContext);
|
|
47
47
|
// STATE
|
|
@@ -52,7 +52,7 @@ export default function CreateGroupButton(inProps) {
|
|
|
52
52
|
* Handle click on button
|
|
53
53
|
*/
|
|
54
54
|
const handleClick = () => {
|
|
55
|
-
setOpen((
|
|
55
|
+
setOpen((o) => !o);
|
|
56
56
|
};
|
|
57
57
|
/**
|
|
58
58
|
* If there's no authUserId, component is hidden.
|
|
@@ -64,7 +64,6 @@ export default function CreateGroupButton(inProps) {
|
|
|
64
64
|
* Renders root object
|
|
65
65
|
*/
|
|
66
66
|
return (React.createElement(React.Fragment, null,
|
|
67
|
-
React.createElement(Root, Object.assign({ className: classNames(classes.root, className), onClick: handleClick,
|
|
68
|
-
|
|
69
|
-
open && React.createElement(CreateGroup, Object.assign({}, CreateGroupProps, { open: true, onClose: handleClick }))));
|
|
67
|
+
React.createElement(Root, Object.assign({ className: classNames(classes.root, className), onClick: handleClick, variant: "contained", startIcon: React.createElement(Icon, { fontSize: "small" }, "add") }, rest), children !== null && children !== void 0 ? children : React.createElement(FormattedMessage, { id: "ui.createGroupButton", defaultMessage: "ui.createGroupButton" })),
|
|
68
|
+
open && React.createElement(GroupForm, Object.assign({}, GroupFormProps, { open: true, onClose: handleClick }))));
|
|
70
69
|
}
|
|
@@ -23,6 +23,10 @@ export interface CustomAdvProps extends VirtualScrollerItemProps {
|
|
|
23
23
|
* Category ids if the adv must be related to specific categories
|
|
24
24
|
*/
|
|
25
25
|
categoriesId?: Array<number> | null;
|
|
26
|
+
/**
|
|
27
|
+
* Group ids if the adv must be related to specific groups
|
|
28
|
+
*/
|
|
29
|
+
groupsId?: Array<number> | null;
|
|
26
30
|
/**
|
|
27
31
|
* Prefixed height. Usefull to re-mount item on scroll feed.
|
|
28
32
|
*/
|
package/lib/esm/components/{CreateGroup/CreateGroup.d.ts → EditGroupButton/EditGroupButton.d.ts}
RENAMED
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CreateGroupButtonProps } from '../CreateGroupButton';
|
|
2
2
|
import { SCGroupType } from '@selfcommunity/types';
|
|
3
|
-
export interface
|
|
3
|
+
export interface EditGroupButtonProps extends CreateGroupButtonProps {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Group Object
|
|
6
6
|
* @default null
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Open dialog
|
|
11
|
-
* @default true
|
|
12
|
-
*/
|
|
13
|
-
open?: boolean;
|
|
8
|
+
group?: SCGroupType;
|
|
14
9
|
/**
|
|
15
|
-
*
|
|
10
|
+
* Id of the group
|
|
16
11
|
* @default null
|
|
17
12
|
*/
|
|
18
|
-
|
|
13
|
+
groupId?: number | string;
|
|
19
14
|
/**
|
|
20
|
-
*
|
|
15
|
+
* On edit success callback function
|
|
21
16
|
* @default null
|
|
22
17
|
*/
|
|
23
|
-
|
|
18
|
+
onEditSuccess?: (data: SCGroupType) => void;
|
|
24
19
|
/**
|
|
25
20
|
* Any other properties
|
|
26
21
|
*/
|
|
@@ -35,14 +30,14 @@ export interface CreateGroupProps extends BaseDialogProps {
|
|
|
35
30
|
```
|
|
36
31
|
|
|
37
32
|
#### Component Name
|
|
38
|
-
The name `
|
|
33
|
+
The name `SCEditGroupButton` can be used when providing style overrides in the theme.
|
|
39
34
|
|
|
40
35
|
#### CSS
|
|
41
36
|
|
|
42
37
|
|Rule Name|Global class|Description|
|
|
43
38
|
|---|---|---|
|
|
44
|
-
|root|.
|
|
39
|
+
|root|.SCEditGroupButton-root|Styles applied to the root element.|
|
|
45
40
|
|
|
46
41
|
* @param inProps
|
|
47
42
|
*/
|
|
48
|
-
export default function
|
|
43
|
+
export default function EditGroupButton(inProps: EditGroupButtonProps): JSX.Element;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useThemeProps } from '@mui/system';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { FormattedMessage } from 'react-intl';
|
|
6
|
+
import { useSCFetchGroup, useSCUser } from '@selfcommunity/react-core';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
import CreateGroupButton from '../CreateGroupButton';
|
|
9
|
+
const PREFIX = 'SCEditGroupButton';
|
|
10
|
+
const classes = {
|
|
11
|
+
root: `${PREFIX}-root`
|
|
12
|
+
};
|
|
13
|
+
const Root = styled(CreateGroupButton, {
|
|
14
|
+
name: PREFIX,
|
|
15
|
+
slot: 'Root',
|
|
16
|
+
overridesResolver: (props, styles) => styles.root
|
|
17
|
+
})(({ theme }) => ({}));
|
|
18
|
+
/**
|
|
19
|
+
*> API documentation for the Community-JS Create Group Button component. Learn about the available props and the CSS API.
|
|
20
|
+
*
|
|
21
|
+
#### Import
|
|
22
|
+
```jsx
|
|
23
|
+
import {CreateGroupButton} from '@selfcommunity/react-ui';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
#### Component Name
|
|
27
|
+
The name `SCEditGroupButton` can be used when providing style overrides in the theme.
|
|
28
|
+
|
|
29
|
+
#### CSS
|
|
30
|
+
|
|
31
|
+
|Rule Name|Global class|Description|
|
|
32
|
+
|---|---|---|
|
|
33
|
+
|root|.SCEditGroupButton-root|Styles applied to the root element.|
|
|
34
|
+
|
|
35
|
+
* @param inProps
|
|
36
|
+
*/
|
|
37
|
+
export default function EditGroupButton(inProps) {
|
|
38
|
+
//PROPS
|
|
39
|
+
const props = useThemeProps({
|
|
40
|
+
props: inProps,
|
|
41
|
+
name: PREFIX
|
|
42
|
+
});
|
|
43
|
+
const { className, groupId, group, onEditSuccess } = props, rest = __rest(props, ["className", "groupId", "group", "onEditSuccess"]);
|
|
44
|
+
const { scGroup, setSCGroup } = useSCFetchGroup({ id: groupId, group });
|
|
45
|
+
const scUserContext = useSCUser();
|
|
46
|
+
const handleSuccess = (data) => {
|
|
47
|
+
setSCGroup(data);
|
|
48
|
+
onEditSuccess && onEditSuccess(data);
|
|
49
|
+
};
|
|
50
|
+
if (!scUserContext.user) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Renders root object
|
|
55
|
+
*/
|
|
56
|
+
return (React.createElement(Root, Object.assign({ variant: "outlined", className: classNames(classes.root, className), GroupFormProps: { group: scGroup, onSuccess: handleSuccess } }, rest),
|
|
57
|
+
React.createElement(FormattedMessage, { id: "ui.editGroupButton", defaultMessage: "ui.editGroupButton" })));
|
|
58
|
+
}
|
|
@@ -188,6 +188,7 @@ export interface FeedObjectProps extends CardProps, VirtualScrollerItemProps {
|
|
|
188
188
|
|deleted|.SCFeedObject-deleted|Styles applied to the feed obj when is deleted (visible only for admin and moderator).|
|
|
189
189
|
|header|.SCFeedObject-header|Styles applied to the header of the card.|
|
|
190
190
|
|category|.SCFeedObject-category|Styles applied to the category element.|
|
|
191
|
+
|group|.SCFeedObject-group|Styles applied to the group element.|
|
|
191
192
|
|avatar|.SCFeedObject-avatar|Styles applied to the avatar element.|
|
|
192
193
|
|username|.SCFeedObject-username|Styles applied to the username element.|
|
|
193
194
|
|activityAt|.SCFeedObject-activity-at|Styles applied to the activity at section.|
|
|
@@ -2,7 +2,7 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import CardContent from '@mui/material/CardContent';
|
|
5
|
-
import { Avatar, Box, Button, CardActions, CardHeader, Collapse, Stack, Tooltip, Typography } from '@mui/material';
|
|
5
|
+
import { Avatar, Box, Button, CardActions, CardHeader, Chip, Collapse, Stack, Tooltip, Typography } from '@mui/material';
|
|
6
6
|
import FeedObjectSkeleton from './Skeleton';
|
|
7
7
|
import DateTimeAgo from '../../shared/DateTimeAgo';
|
|
8
8
|
import Bullet from '../../shared/Bullet';
|
|
@@ -40,6 +40,10 @@ const messages = defineMessages({
|
|
|
40
40
|
visibleToAll: {
|
|
41
41
|
id: 'ui.feedObject.visibleToAll',
|
|
42
42
|
defaultMessage: 'ui.feedObject.visibleToAll'
|
|
43
|
+
},
|
|
44
|
+
visibleToGroup: {
|
|
45
|
+
id: 'ui.feedObject.visibleToGroup',
|
|
46
|
+
defaultMessage: 'ui.feedObject.visibleToGroup'
|
|
43
47
|
}
|
|
44
48
|
});
|
|
45
49
|
const classes = {
|
|
@@ -47,6 +51,7 @@ const classes = {
|
|
|
47
51
|
deleted: `${PREFIX}-deleted`,
|
|
48
52
|
header: `${PREFIX}-header`,
|
|
49
53
|
category: `${PREFIX}-category`,
|
|
54
|
+
group: `${PREFIX}-group`,
|
|
50
55
|
avatar: `${PREFIX}-avatar`,
|
|
51
56
|
username: `${PREFIX}-username`,
|
|
52
57
|
activityAt: `${PREFIX}-activity-at`,
|
|
@@ -100,6 +105,7 @@ const Root = styled(Widget, {
|
|
|
100
105
|
|deleted|.SCFeedObject-deleted|Styles applied to the feed obj when is deleted (visible only for admin and moderator).|
|
|
101
106
|
|header|.SCFeedObject-header|Styles applied to the header of the card.|
|
|
102
107
|
|category|.SCFeedObject-category|Styles applied to the category element.|
|
|
108
|
+
|group|.SCFeedObject-group|Styles applied to the group element.|
|
|
103
109
|
|avatar|.SCFeedObject-avatar|Styles applied to the avatar element.|
|
|
104
110
|
|username|.SCFeedObject-username|Styles applied to the username element.|
|
|
105
111
|
|activityAt|.SCFeedObject-activity-at|Styles applied to the activity at section.|
|
|
@@ -167,7 +173,7 @@ export default function FeedObject(inProps) {
|
|
|
167
173
|
}, [onStateChange, onHeightChange]);
|
|
168
174
|
/**
|
|
169
175
|
* Update state object
|
|
170
|
-
* @param
|
|
176
|
+
* @param newObj
|
|
171
177
|
*/
|
|
172
178
|
const updateObject = (newObj) => {
|
|
173
179
|
setObj(newObj);
|
|
@@ -424,8 +430,13 @@ export default function FeedObject(inProps) {
|
|
|
424
430
|
template === SCFeedObjectTemplateType.DETAIL ||
|
|
425
431
|
template === SCFeedObjectTemplateType.SEARCH) {
|
|
426
432
|
objElement = (React.createElement(React.Fragment, null, obj ? (React.createElement(Box, { className: classNames({ [classes.deleted]: obj && obj.deleted }) },
|
|
427
|
-
obj.categories.length > 0 && (React.createElement("div", { className: classes.category },
|
|
428
|
-
React.createElement(
|
|
433
|
+
obj.categories.length > 0 && (React.createElement("div", { className: classes.category },
|
|
434
|
+
React.createElement(React.Fragment, null, obj.group && (React.createElement("div", { className: classes.group },
|
|
435
|
+
React.createElement(Chip, { color: "secondary", size: "small", key: obj.group.id, icon: React.createElement(Icon, null, "groups"), component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true })))),
|
|
436
|
+
obj.categories.map((c) => (React.createElement(Link, { to: scRoutingContext.url(SCRoutes.CATEGORY_ROUTE_NAME, c), key: c.id },
|
|
437
|
+
React.createElement(Typography, { variant: "overline" }, c.name)))))),
|
|
438
|
+
obj.group && !obj.categories.length && (React.createElement("div", { className: classes.group },
|
|
439
|
+
React.createElement(Chip, { color: "secondary", size: "small", key: obj.group.id, icon: React.createElement(Icon, null, "groups"), label: obj.group.name, component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true }))),
|
|
429
440
|
React.createElement(CardHeader, { className: classes.header, avatar: React.createElement(Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null }),
|
|
430
441
|
React.createElement(UserAvatar, { hide: !obj.author.community_badge },
|
|
431
442
|
React.createElement(Avatar, { "aria-label": "recipe", src: obj.author.avatar, className: classes.avatar }, obj.author.username))), title: React.createElement(Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }), obj.author.username), subheader: React.createElement(React.Fragment, null,
|
|
@@ -437,7 +448,8 @@ export default function FeedObject(inProps) {
|
|
|
437
448
|
React.createElement(Icon, null, "add_location_alt"), (_a = obj.location) === null || _a === void 0 ? void 0 :
|
|
438
449
|
_a.location))),
|
|
439
450
|
React.createElement(Bullet, null),
|
|
440
|
-
React.createElement(Box, { className: classes.tag }, obj.addressing.length > 0 ? (React.createElement(Tags, { tags: obj.addressing, TagChipProps: { disposable: false, clickable: false } })) : (React.createElement(Tooltip, { title: `${intl.formatMessage(messages.
|
|
451
|
+
React.createElement(Box, { className: classes.tag }, obj.addressing.length > 0 ? (React.createElement(Tags, { tags: obj.addressing, TagChipProps: { disposable: false, clickable: false } })) : obj.group ? (React.createElement(Tooltip, { title: `${intl.formatMessage(messages.visibleToGroup, { group: obj.group.name })}` },
|
|
452
|
+
React.createElement(Icon, { color: "disabled", fontSize: "small" }, "groups"))) : (React.createElement(Tooltip, { title: `${intl.formatMessage(messages.visibleToAll)}` },
|
|
441
453
|
React.createElement(Icon, { color: "disabled", fontSize: "small" }, "public"))))), action: renderHeaderAction() }),
|
|
442
454
|
React.createElement(CardContent, { classes: { root: classes.content } },
|
|
443
455
|
React.createElement(Box, { className: classes.titleSection }, 'title' in obj && (React.createElement(React.Fragment, null, template === SCFeedObjectTemplateType.DETAIL ? (React.createElement(Typography, { variant: "body1", gutterBottom: true, className: classes.title }, obj.title)) : (React.createElement(Link, { to: scRoutingContext.url(getContributionRouteName(obj), getRouteData(obj)) },
|
|
@@ -466,8 +478,13 @@ export default function FeedObject(inProps) {
|
|
|
466
478
|
}
|
|
467
479
|
else if (template === SCFeedObjectTemplateType.SHARE) {
|
|
468
480
|
objElement = (React.createElement(React.Fragment, null, obj ? (React.createElement(React.Fragment, null,
|
|
469
|
-
obj.categories.length > 0 && (React.createElement("div", { className: classes.category },
|
|
470
|
-
React.createElement(
|
|
481
|
+
obj.categories.length > 0 && (React.createElement("div", { className: classes.category },
|
|
482
|
+
React.createElement(React.Fragment, null, obj.group && (React.createElement("div", { className: classes.group },
|
|
483
|
+
React.createElement(Chip, { color: "secondary", size: "small", key: obj.group.id, icon: React.createElement(Icon, null, "groups"), component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true })))),
|
|
484
|
+
obj.categories.map((c) => (React.createElement(Link, { to: scRoutingContext.url(SCRoutes.CATEGORY_ROUTE_NAME, c), key: c.id },
|
|
485
|
+
React.createElement(Typography, { variant: "overline" }, c.name)))))),
|
|
486
|
+
obj.group && !obj.categories.length && (React.createElement("div", { className: classes.group },
|
|
487
|
+
React.createElement(Chip, { color: "secondary", size: "small", key: obj.group.id, icon: React.createElement(Icon, null, "groups"), label: obj.group.name, component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true }))),
|
|
471
488
|
React.createElement(CardHeader, { classes: { root: classes.header }, avatar: React.createElement(Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }),
|
|
472
489
|
React.createElement(UserAvatar, { hide: !obj.author.community_badge },
|
|
473
490
|
React.createElement(Avatar, { "aria-label": "recipe", src: obj.author.avatar, className: classes.avatar }, obj.author.username))), title: React.createElement(Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }), obj.author.username), subheader: React.createElement(Link, { to: scRoutingContext.url(getContributionRouteName(obj), getRouteData(obj)), className: classes.activityAt },
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ButtonBaseProps } from '@mui/material';
|
|
2
2
|
import { SCGroupType } from '@selfcommunity/types';
|
|
3
3
|
import { WidgetProps } from '../Widget';
|
|
4
|
+
import { GroupSubscribeButtonProps } from '../GroupSubscribeButton';
|
|
4
5
|
export interface GroupProps extends WidgetProps {
|
|
5
6
|
/**
|
|
6
7
|
* Group Object
|
|
@@ -13,10 +14,10 @@ export interface GroupProps extends WidgetProps {
|
|
|
13
14
|
*/
|
|
14
15
|
groupId?: number;
|
|
15
16
|
/**
|
|
16
|
-
*
|
|
17
|
-
* @default
|
|
17
|
+
* Props to spread to group subscribe/unsubscribe button
|
|
18
|
+
* @default {}
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
|
+
groupSubscribeButtonProps?: GroupSubscribeButtonProps;
|
|
20
21
|
/**
|
|
21
22
|
* Badge content to show as group avatar badge if show reaction is true.
|
|
22
23
|
*/
|
|
@@ -2,6 +2,7 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { Avatar, Icon, Stack } from '@mui/material';
|
|
5
|
+
import { SCGroupPrivacyType } from '@selfcommunity/types';
|
|
5
6
|
import { Link, SCRoutes, useSCFetchGroup, useSCRouting } from '@selfcommunity/react-core';
|
|
6
7
|
import { defineMessages, useIntl } from 'react-intl';
|
|
7
8
|
import classNames from 'classnames';
|
|
@@ -61,7 +62,7 @@ export default function Group(inProps) {
|
|
|
61
62
|
props: inProps,
|
|
62
63
|
name: PREFIX
|
|
63
64
|
});
|
|
64
|
-
const { groupId = null, group = null,
|
|
65
|
+
const { groupId = null, group = null, className = null, elevation, hideActions = false, groupSubscribeButtonProps = {} } = props, rest = __rest(props, ["groupId", "group", "className", "elevation", "hideActions", "groupSubscribeButtonProps"]);
|
|
65
66
|
// STATE
|
|
66
67
|
const { scGroup } = useSCFetchGroup({ id: groupId, group });
|
|
67
68
|
// CONTEXT
|
|
@@ -75,8 +76,8 @@ export default function Group(inProps) {
|
|
|
75
76
|
*/
|
|
76
77
|
function renderAuthenticatedActions() {
|
|
77
78
|
return (React.createElement(Stack, { className: classes.actions, direction: "row", alignItems: "center", justifyContent: "center", spacing: 2 },
|
|
78
|
-
React.createElement(Icon, null,
|
|
79
|
-
React.createElement(GroupSubscribeButton, { group: group, groupId: groupId })));
|
|
79
|
+
React.createElement(Icon, null, (group === null || group === void 0 ? void 0 : group.privacy) === SCGroupPrivacyType.PRIVATE ? 'private' : 'public'),
|
|
80
|
+
React.createElement(GroupSubscribeButton, Object.assign({ group: group, groupId: groupId }, groupSubscribeButtonProps))));
|
|
80
81
|
}
|
|
81
82
|
/**
|
|
82
83
|
* Renders group object
|
|
@@ -88,6 +89,6 @@ export default function Group(inProps) {
|
|
|
88
89
|
* Renders root object
|
|
89
90
|
*/
|
|
90
91
|
return (React.createElement(React.Fragment, null,
|
|
91
|
-
React.createElement(Root, Object.assign({ elevation: elevation }, rest, { className: classNames(classes.root, className), ButtonBaseProps:
|
|
92
|
+
React.createElement(Root, Object.assign({ elevation: elevation }, rest, { className: classNames(classes.root, className), ButtonBaseProps: { component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, scGroup) }, image: React.createElement(Avatar, { alt: scGroup.name, src: scGroup.image_medium, className: classes.avatar }), primary: scGroup.name, secondary: `${intl.formatMessage(messages.groupMembers, { total: scGroup.subscribers_counter })}`, actions: hideActions ? null : renderAuthenticatedActions() })),
|
|
92
93
|
openAlert && React.createElement(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })));
|
|
93
94
|
}
|
|
@@ -33,6 +33,6 @@ const Root = styled(BaseItem, {
|
|
|
33
33
|
*/
|
|
34
34
|
export default function GroupSkeleton(props) {
|
|
35
35
|
const theme = useTheme();
|
|
36
|
-
return (React.createElement(Root, Object.assign({ className: classes.root }, props, { image: React.createElement(Skeleton, { animation: "wave", variant: "circular", width: theme.selfcommunity.
|
|
36
|
+
return (React.createElement(Root, Object.assign({ className: classes.root }, props, { image: React.createElement(Skeleton, { animation: "wave", variant: "circular", width: theme.selfcommunity.group.avatar.sizeSmall, height: theme.selfcommunity.group.avatar.sizeSmall }), primary: React.createElement(Skeleton, { animation: "wave", height: 10, width: 120, style: { marginBottom: 10 } }), secondary: React.createElement(Skeleton, { animation: "wave", height: 10, width: 70, style: { marginBottom: 10 } }), actions: React.createElement(Button, { size: "small", variant: "outlined", disabled: true },
|
|
37
37
|
React.createElement(Skeleton, { animation: "wave", height: 10, width: 30, style: { marginTop: 5, marginBottom: 5 } })) })));
|
|
38
38
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { TextFieldProps } from '@mui/material/TextField';
|
|
2
|
+
import { AutocompleteProps } from '@mui/material';
|
|
3
|
+
import { SCGroupType } from '@selfcommunity/types/src/index';
|
|
4
|
+
export interface GroupAutocompleteProps extends Pick<AutocompleteProps<SCGroupType | null, any, any, any>, Exclude<keyof AutocompleteProps<SCGroupType | null, any, any, any>, 'open' | 'onOpen' | 'onClose' | 'onChange' | 'filterSelectedOptions' | 'disableCloseOnSelect' | 'options' | 'getOptionLabel' | 'value' | 'selectOnFocus' | 'clearOnBlur' | 'blurOnSelect' | 'handleHomeEndKeys' | 'clearIcon' | 'noOptionsText' | 'isOptionEqualToValue' | 'renderTags' | 'renderOption' | 'renderInput'>> {
|
|
5
|
+
/**
|
|
6
|
+
* The maximum number of groups that will be visible when not focused.
|
|
7
|
+
* @default 0
|
|
8
|
+
*/
|
|
9
|
+
limitCountGroups?: number;
|
|
10
|
+
/**
|
|
11
|
+
* If checkbox is selected
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
checkboxSelect?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The props applied to text field
|
|
17
|
+
* @default {variant: 'outlined, label: groups_label}
|
|
18
|
+
*/
|
|
19
|
+
TextFieldProps?: TextFieldProps;
|
|
20
|
+
/**
|
|
21
|
+
* Callback for change event on poll object
|
|
22
|
+
* @param value
|
|
23
|
+
*/
|
|
24
|
+
onChange?: (value: any) => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* > API documentation for the Community-JS Group Autocomplete component. Learn about the available props and the CSS API.
|
|
28
|
+
*
|
|
29
|
+
*
|
|
30
|
+
* This component renders a bar that allows users to search (with autocomplete) for all the groups available in the application.
|
|
31
|
+
* Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/GroupAutocomplete)
|
|
32
|
+
*
|
|
33
|
+
* #### Import
|
|
34
|
+
* ```jsx
|
|
35
|
+
* import {GroupAutocomplete} from '@selfcommunity/react-ui';
|
|
36
|
+
* ```
|
|
37
|
+
* #### Component Name
|
|
38
|
+
* The name `SCGroupAutocomplete` can be used when providing style overrides in the theme.
|
|
39
|
+
*
|
|
40
|
+
* #### CSS
|
|
41
|
+
*
|
|
42
|
+
* |Rule Name|Global class|Description|
|
|
43
|
+
* |---|---|---|
|
|
44
|
+
* |root|.SCGroupAutocomplete-root|Styles applied to the root element.|
|
|
45
|
+
*
|
|
46
|
+
* @param inProps
|
|
47
|
+
*/
|
|
48
|
+
declare const GroupAutocomplete: (inProps: GroupAutocompleteProps) => JSX.Element;
|
|
49
|
+
export default GroupAutocomplete;
|