Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/reactstrap/src/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { DropdownContext } from './DropdownContext';
import { mapToCssModules, omit, tagPropType } from './utils';
const propTypes = {
children: PropTypes.node,
active: PropTypes.bool,
disabled: PropTypes.bool,
divider: PropTypes.bool,
tag: tagPropType,
header: PropTypes.bool,
onClick: PropTypes.func,
className: PropTypes.string,
cssModule: PropTypes.object,
toggle: PropTypes.bool
};
const defaultProps = {
tag: 'button',
toggle: true
};
class DropdownItem extends React.Component {
constructor(props) {
super(props);
this.onClick = this.onClick.bind(this);
this.getTabIndex = this.getTabIndex.bind(this);
}
onClick(e) {
if (this.props.disabled || this.props.header || this.props.divider) {
e.preventDefault();
return;
}
if (this.props.onClick) {
this.props.onClick(e);
}
if (this.props.toggle) {
this.context.toggle(e);
}
}
getTabIndex() {
if (this.props.disabled || this.props.header || this.props.divider) {
return '-1';
}
return '0';
}
render() {
const tabIndex = this.getTabIndex();
const role = tabIndex > -1 ? 'menuitem' : undefined;
let {
className,
cssModule,
divider,
tag: Tag,
header,
active,
...props } = omit(this.props, ['toggle']);
const classes = mapToCssModules(classNames(
className,
{
disabled: props.disabled,
'dropdown-item': !divider && !header,
active: active,
'dropdown-header': header,
'dropdown-divider': divider
}
), cssModule);
if (Tag === 'button') {
if (header) {
Tag = 'h6';
} else if (divider) {
Tag = 'div';
} else if (props.href) {
Tag = 'a';
}
}
return (
<Tag
type={(Tag === 'button' && (props.onClick || this.props.toggle)) ? 'button' : undefined}
{...props}
tabIndex={tabIndex}
role={role}
className={classes}
onClick={this.onClick}
/>
);
}
}
DropdownItem.propTypes = propTypes;
DropdownItem.defaultProps = defaultProps;
DropdownItem.contextType = DropdownContext;
export default DropdownItem;
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0058 ]-- |