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, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Transition } from 'react-transition-group';
import { mapToCssModules, omit, pick, TransitionTimeouts, TransitionPropTypeKeys, TransitionStatuses, tagPropType } from './utils';
const propTypes = {
...Transition.propTypes,
isOpen: PropTypes.bool,
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node
]),
tag: tagPropType,
className: PropTypes.node,
navbar: PropTypes.bool,
cssModule: PropTypes.object,
innerRef: PropTypes.oneOfType([
PropTypes.func,
PropTypes.string,
PropTypes.object
]),
};
const defaultProps = {
...Transition.defaultProps,
isOpen: false,
appear: false,
enter: true,
exit: true,
tag: 'div',
timeout: TransitionTimeouts.Collapse,
};
const transitionStatusToClassHash = {
[TransitionStatuses.ENTERING]: 'collapsing',
[TransitionStatuses.ENTERED]: 'collapse show',
[TransitionStatuses.EXITING]: 'collapsing',
[TransitionStatuses.EXITED]: 'collapse',
};
function getTransitionClass(status) {
return transitionStatusToClassHash[status] || 'collapse';
}
function getHeight(node) {
return node.scrollHeight;
}
class Collapse extends Component {
constructor(props) {
super(props);
this.state = {
height: null
};
['onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited'].forEach((name) => {
this[name] = this[name].bind(this);
});
}
onEntering(node, isAppearing) {
this.setState({ height: getHeight(node) });
this.props.onEntering(node, isAppearing);
}
onEntered(node, isAppearing) {
this.setState({ height: null });
this.props.onEntered(node, isAppearing);
}
onExit(node) {
this.setState({ height: getHeight(node) });
this.props.onExit(node);
}
onExiting(node) {
// getting this variable triggers a reflow
const _unused = node.offsetHeight; // eslint-disable-line no-unused-vars
this.setState({ height: 0 });
this.props.onExiting(node);
}
onExited(node) {
this.setState({ height: null });
this.props.onExited(node);
}
render() {
const {
tag: Tag,
isOpen,
className,
navbar,
cssModule,
children,
innerRef,
...otherProps
} = this.props;
const { height } = this.state;
const transitionProps = pick(otherProps, TransitionPropTypeKeys);
const childProps = omit(otherProps, TransitionPropTypeKeys);
return (
<Transition
{...transitionProps}
in={isOpen}
onEntering={this.onEntering}
onEntered={this.onEntered}
onExit={this.onExit}
onExiting={this.onExiting}
onExited={this.onExited}
>
{(status) => {
let collapseClass = getTransitionClass(status);
const classes = mapToCssModules(classNames(
className,
collapseClass,
navbar && 'navbar-collapse'
), cssModule);
const style = height === null ? null : { height };
return (
<Tag
{...childProps}
style={{ ...childProps.style, ...style }}
className={classes}
ref={this.props.innerRef}
>
{children}
</Tag>
);
}}
</Transition>
);
}
}
Collapse.propTypes = propTypes;
Collapse.defaultProps = defaultProps;
export default Collapse;
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0261 ]-- |