Dashboard sipadu mbip
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ListGroupItem.js 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import _extends from "@babel/runtime/helpers/esm/extends";
  2. import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
  3. import classNames from 'classnames';
  4. import React, { useCallback } from 'react';
  5. import AbstractNavItem from './AbstractNavItem';
  6. import { makeEventKey } from './SelectableContext';
  7. import { useBootstrapPrefix } from './ThemeProvider';
  8. var defaultProps = {
  9. variant: null,
  10. active: false,
  11. disabled: false
  12. };
  13. var ListGroupItem = React.forwardRef(function (_ref, ref) {
  14. var bsPrefix = _ref.bsPrefix,
  15. active = _ref.active,
  16. disabled = _ref.disabled,
  17. className = _ref.className,
  18. variant = _ref.variant,
  19. action = _ref.action,
  20. as = _ref.as,
  21. eventKey = _ref.eventKey,
  22. onClick = _ref.onClick,
  23. props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "active", "disabled", "className", "variant", "action", "as", "eventKey", "onClick"]);
  24. bsPrefix = useBootstrapPrefix(bsPrefix, 'list-group-item');
  25. var handleClick = useCallback(function (event) {
  26. if (disabled) {
  27. event.preventDefault();
  28. event.stopPropagation();
  29. return;
  30. }
  31. if (onClick) onClick(event);
  32. }, [disabled, onClick]);
  33. return React.createElement(AbstractNavItem, _extends({
  34. ref: ref
  35. }, props, {
  36. eventKey: makeEventKey(eventKey, props.href) // eslint-disable-next-line
  37. ,
  38. as: as || (action ? props.href ? 'a' : 'button' : 'div'),
  39. onClick: handleClick,
  40. className: classNames(className, bsPrefix, active && 'active', disabled && 'disabled', variant && bsPrefix + "-" + variant, action && bsPrefix + "-action")
  41. }));
  42. });
  43. ListGroupItem.defaultProps = defaultProps;
  44. ListGroupItem.displayName = 'ListGroupItem';
  45. export default ListGroupItem;