()
| 6932 | _inheritsLoose(Modal, _React$Component); |
| 6933 | |
| 6934 | function Modal() { |
| 6935 | var _this; |
| 6936 | |
| 6937 | for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) { |
| 6938 | _args[_key] = arguments[_key]; |
| 6939 | } |
| 6940 | |
| 6941 | _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this; |
| 6942 | _this.state = { |
| 6943 | exited: !_this.props.show |
| 6944 | }; |
| 6945 | |
| 6946 | _this.onPortalRendered = function () { |
| 6947 | if (_this.props.onShow) { |
| 6948 | _this.props.onShow(); |
| 6949 | } // autofocus after onShow, to not trigger a focus event for previous |
| 6950 | // modals before this one is shown. |
| 6951 | |
| 6952 | |
| 6953 | _this.autoFocus(); |
| 6954 | }; |
| 6955 | |
| 6956 | _this.onShow = function () { |
| 6957 | var doc = (0, _ownerDocument.default)(_assertThisInitialized(_assertThisInitialized(_this))); |
| 6958 | var container = (0, _getContainer.default)(_this.props.container, doc.body); |
| 6959 | |
| 6960 | _this.props.manager.add(_assertThisInitialized(_assertThisInitialized(_this)), container, _this.props.containerClassName); |
| 6961 | |
| 6962 | _this.removeKeydownListener = (0, _listen.default)(doc, 'keydown', _this.handleDocumentKeyDown); |
| 6963 | _this.removeFocusListener = (0, _listen.default)(doc, 'focus', // the timeout is necessary b/c this will run before the new modal is mounted |
| 6964 | // and so steals focus from it |
| 6965 | function () { |
| 6966 | return setTimeout(_this.enforceFocus); |
| 6967 | }, true); |
| 6968 | }; |
| 6969 | |
| 6970 | _this.onHide = function () { |
| 6971 | _this.props.manager.remove(_assertThisInitialized(_assertThisInitialized(_this))); |
| 6972 | |
| 6973 | _this.removeKeydownListener(); |
| 6974 | |
| 6975 | _this.removeFocusListener(); |
| 6976 | |
| 6977 | if (_this.props.restoreFocus) { |
| 6978 | _this.restoreLastFocus(); |
| 6979 | } |
| 6980 | }; |
| 6981 | |
| 6982 | _this.setDialogRef = function (ref) { |
| 6983 | _this.dialog = ref; |
| 6984 | }; |
| 6985 | |
| 6986 | _this.setBackdropRef = function (ref) { |
| 6987 | _this.backdrop = ref && _reactDom.default.findDOMNode(ref); |
| 6988 | }; |
| 6989 | |
| 6990 | _this.handleHidden = function () { |
| 6991 | _this.setState({ |
nothing calls this directly
no test coverage detected
searching dependent graphs…