Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | 1x 1x 1x 1x 1x 1x 1x 1x | import React, { Component } from 'react';
import { defaultProps } from './props/defaultProps';
import { propTypes } from './props/propTypes';
import ToggleDropDown from '../../dropdown/ToggleDropDown/ToggleDropDown';
import { DepartmentText } from '../SecondaryText';
import style from './DepartmentDropDown.module.css';
class DepartmentDropDown extends Component {
constructor(props) {
super(props);
this.onClick = this.onClick.bind(this);
this.onMoveDepartment = this.onMoveDepartment.bind(this);
}
onClick(e) {
let { getDepartment, onSearch } = this.props;
if (getDepartment) {
getDepartment(e);
}
onSearch('');
}
onMoveDepartment(deptId) {
let { onSearch, onMoveDepartment } = this.props;
onSearch('');
onMoveDepartment(deptId);
}
render() {
let {
departmentName,
departmentList = [],
onSelectLabel,
isEditable,
dataId,
isFetching,
isPopupActive,
getNextOptions,
isNextOptions,
onSearch,
needSearchFetching,
searchStr,
i18nKeys
} = this.props;
let {
title = 'Move Department',
searchEmptyText = 'No results found',
searchErrorText = 'No results',
placeholder = 'Search Department'
} = i18nKeys;
return (
<ToggleDropDown
title={title}
options={departmentList}
value={<DepartmentText text={departmentName} dataTitle={departmentName} />}
keyName='name'
idName='id'
onClick={this.onMoveDepartment}
isArrow={false}
isEditable={isEditable}
onSelectLabel={onSelectLabel}
isPopupActive={isPopupActive}
needExternalPopupState
isSearch={departmentList.length > 5 || searchStr.length !== 0}
boxSize='small'
dataId={dataId}
isDataLoaded={!isFetching}
isPadding={false}
searchErrorText={searchErrorText}
searchEmptyHint={searchEmptyText}
isNeedEffect={false}
className={style.departmentBox}
placeHolderText={placeholder}
getNextOptions={getNextOptions}
isNextOptions={isNextOptions}
onSearch={onSearch}
needSearchFetching={needSearchFetching}
/>
);
}
}
DepartmentDropDown.defaultProps = defaultProps;
DepartmentDropDown.propTypes = propTypes;
export default DepartmentDropDown;
// if (__DOCS__) {
// DepartmentDropDown.docs = {
// folderName: 'List',
// componentGroup: 'DepartmentDropDown'
// };
// }
|