Web:People:Components: refactoring group selector

This commit is contained in:
Timofey 2022-02-16 17:05:56 +08:00
parent 63568d0c4a
commit 908122694d

View File

@ -90,13 +90,23 @@ class GroupSelector extends React.Component {
onCancel, onCancel,
t, t,
searchPlaceHolderLabel, searchPlaceHolderLabel,
displayType, headerLabel,
onArrowClick,
withoutAside, withoutAside,
embeddedComponent, embeddedComponent,
showCounter, showCounter,
theme, theme,
} = this.props; } = this.props;
const groups = [
{
key: "all",
id: "all",
label: t("AllGroups"),
total: 0,
},
];
return ( return (
<AdvancedSelector <AdvancedSelector
theme={theme} theme={theme}
@ -104,11 +114,11 @@ class GroupSelector extends React.Component {
className={className} className={className}
style={style} style={style}
options={options} options={options}
groups={groups}
hasNextPage={hasNextPage} hasNextPage={hasNextPage}
isNextPageLoading={isNextPageLoading} isNextPageLoading={isNextPageLoading}
loadNextPage={this.loadNextPage} loadNextPage={this.loadNextPage}
size={"compact"} size={"compact"}
displayType={displayType}
selectedOptions={selectedOptions} selectedOptions={selectedOptions}
isOpen={isOpen} isOpen={isOpen}
isMultiSelect={isMultiSelect} isMultiSelect={isMultiSelect}
@ -129,13 +139,15 @@ class GroupSelector extends React.Component {
withoutAside={withoutAside} withoutAside={withoutAside}
embeddedComponent={embeddedComponent} embeddedComponent={embeddedComponent}
showCounter={showCounter} showCounter={showCounter}
headerLabel={headerLabel ? headerLabel : t("AddDepartmentsButtonLabel")}
onArrowClick={onArrowClick}
/> />
); );
} }
} }
GroupSelector.propTypes = { GroupSelector.propTypes = {
className: PropTypes.oneOf([PropTypes.string, PropTypes.array]), className: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
id: PropTypes.string, id: PropTypes.string,
isDisabled: PropTypes.bool, isDisabled: PropTypes.bool,
isMultiSelect: PropTypes.bool, isMultiSelect: PropTypes.bool,
@ -147,14 +159,12 @@ GroupSelector.propTypes = {
style: PropTypes.object, style: PropTypes.object,
t: PropTypes.func, t: PropTypes.func,
useFake: PropTypes.bool, useFake: PropTypes.bool,
displayType: PropTypes.oneOf(["auto", "aside", "dropdown"]),
withoutAside: PropTypes.bool, withoutAside: PropTypes.bool,
embeddedComponent: PropTypes.any, embeddedComponent: PropTypes.any,
}; };
GroupSelector.defaultProps = { GroupSelector.defaultProps = {
useFake: false, useFake: false,
displayType: "auto",
withoutAside: false, withoutAside: false,
}; };