rsuite 4.10.2 → 4.10.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/dist/rsuite.js +75 -158
- package/dist/rsuite.min.js +10 -2
- package/dist/rsuite.min.js.map +1 -1
- package/es/AutoComplete/AutoComplete.js +1 -1
- package/es/Avatar/Avatar.js +1 -2
- package/es/Breadcrumb/Breadcrumb.js +1 -2
- package/es/Button/Button.js +1 -2
- package/es/ButtonGroup/ButtonGroup.js +1 -2
- package/es/Calendar/TimeDropdown.js +3 -3
- package/es/Cascader/Cascader.js +23 -6
- package/es/Drawer/index.js +1 -2
- package/es/Dropdown/Dropdown.js +1 -2
- package/es/FlexboxGrid/FlexboxGrid.js +1 -2
- package/es/FormGroup/FormGroup.js +1 -2
- package/es/Input/Input.js +1 -2
- package/es/InputGroup/InputGroup.js +1 -2
- package/es/IntlProvider/withLocale.js +1 -1
- package/es/List/List.js +1 -2
- package/es/List/ListItem.js +1 -2
- package/es/Loader/Loader.js +1 -2
- package/es/Modal/BaseModal.js +24 -4
- package/es/Modal/Modal.js +1 -2
- package/es/Modal/ModalDialog.js +2 -2
- package/es/MultiCascader/MultiCascader.js +14 -1
- package/es/Nav/Nav.js +1 -2
- package/es/Navbar/Navbar.js +1 -2
- package/es/Pagination/Pagination.js +1 -2
- package/es/Rate/Rate.js +1 -2
- package/es/Sidenav/Sidenav.js +1 -2
- package/es/Slider/Slider.d.ts +4 -11
- package/es/Steps/Steps.js +1 -2
- package/es/Table/Table.js +1 -2
- package/es/Table/TablePagination.js +1 -2
- package/es/Tag/Tag.js +1 -2
- package/es/TagPicker/index.js +1 -2
- package/es/Timeline/Timeline.js +1 -2
- package/es/Timeline/TimelineItem.js +1 -2
- package/es/Toggle/Toggle.js +1 -2
- package/es/Uploader/Uploader.js +2 -3
- package/es/utils/defaultProps.js +1 -1
- package/es/utils/index.js +1 -0
- package/es/utils/recompose.js +42 -0
- package/es/utils/withStyleProps.js +1 -1
- package/lib/AutoComplete/AutoComplete.js +2 -4
- package/lib/Avatar/Avatar.js +1 -3
- package/lib/Breadcrumb/Breadcrumb.js +1 -3
- package/lib/Button/Button.js +1 -3
- package/lib/ButtonGroup/ButtonGroup.js +1 -3
- package/lib/Calendar/TimeDropdown.js +3 -3
- package/lib/Cascader/Cascader.js +23 -6
- package/lib/Drawer/index.js +4 -6
- package/lib/Dropdown/Dropdown.js +2 -4
- package/lib/FlexboxGrid/FlexboxGrid.js +1 -3
- package/lib/FormGroup/FormGroup.js +1 -3
- package/lib/Input/Input.js +1 -3
- package/lib/InputGroup/InputGroup.js +3 -5
- package/lib/IntlProvider/withLocale.js +3 -3
- package/lib/List/List.js +1 -3
- package/lib/List/ListItem.js +1 -3
- package/lib/Loader/Loader.js +1 -3
- package/lib/Modal/BaseModal.js +24 -4
- package/lib/Modal/Modal.js +5 -7
- package/lib/Modal/ModalDialog.js +2 -3
- package/lib/MultiCascader/MultiCascader.js +14 -1
- package/lib/Nav/Nav.js +1 -3
- package/lib/Navbar/Navbar.js +2 -4
- package/lib/Pagination/Pagination.js +1 -3
- package/lib/Rate/Rate.js +1 -3
- package/lib/Sidenav/Sidenav.js +3 -5
- package/lib/Slider/Slider.d.ts +4 -11
- package/lib/Steps/Steps.js +1 -3
- package/lib/Table/Table.js +6 -8
- package/lib/Table/TablePagination.js +1 -3
- package/lib/Tag/Tag.js +1 -3
- package/lib/TagPicker/index.js +1 -3
- package/lib/Timeline/Timeline.js +1 -3
- package/lib/Timeline/TimelineItem.js +1 -3
- package/lib/Toggle/Toggle.js +1 -3
- package/lib/Uploader/Uploader.js +2 -4
- package/lib/utils/defaultProps.js +1 -1
- package/lib/utils/index.js +8 -0
- package/lib/utils/recompose.js +57 -0
- package/lib/utils/withStyleProps.js +1 -1
- package/package.json +5 -6
- package/src/AutoComplete/AutoComplete.tsx +1 -1
- package/src/Avatar/Avatar.tsx +1 -2
- package/src/Breadcrumb/Breadcrumb.tsx +1 -2
- package/src/Button/Button.tsx +8 -2
- package/src/ButtonGroup/ButtonGroup.tsx +1 -2
- package/src/Calendar/TimeDropdown.tsx +2 -3
- package/src/Cascader/Cascader.tsx +24 -5
- package/src/Cascader/test/CascaderSpec.js +56 -1
- package/src/DatePicker/test/DatePickerSpec.js +20 -0
- package/src/Drawer/index.tsx +1 -3
- package/src/Dropdown/Dropdown.tsx +1 -1
- package/src/FlexboxGrid/FlexboxGrid.tsx +1 -2
- package/src/FormGroup/FormGroup.tsx +1 -2
- package/src/Input/Input.tsx +1 -1
- package/src/InputGroup/InputGroup.tsx +1 -2
- package/src/IntlProvider/withLocale.tsx +1 -1
- package/src/List/List.tsx +1 -2
- package/src/List/ListItem.tsx +1 -2
- package/src/Loader/Loader.tsx +1 -2
- package/src/Modal/BaseModal.tsx +26 -4
- package/src/Modal/Modal.tsx +1 -2
- package/src/Modal/ModalDialog.tsx +2 -2
- package/src/Modal/test/ModalSpec.js +5 -0
- package/src/MultiCascader/MultiCascader.tsx +17 -1
- package/src/Nav/Nav.tsx +1 -1
- package/src/Navbar/Navbar.tsx +1 -2
- package/src/Pagination/Pagination.tsx +1 -2
- package/src/Rate/Rate.tsx +1 -2
- package/src/Sidenav/Sidenav.tsx +1 -2
- package/src/Slider/Slider.d.ts +4 -11
- package/src/Steps/Steps.tsx +1 -2
- package/src/Table/Table.tsx +1 -2
- package/src/Table/TablePagination.tsx +1 -2
- package/src/Tag/Tag.tsx +1 -2
- package/src/TagPicker/index.tsx +1 -3
- package/src/Timeline/Timeline.tsx +1 -2
- package/src/Timeline/TimelineItem.tsx +1 -2
- package/src/Toggle/Toggle.tsx +1 -2
- package/src/Uploader/Uploader.tsx +2 -3
- package/src/utils/defaultProps.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/recompose.ts +52 -0
- package/src/utils/test/recomposeSpec.js +107 -0
- package/src/utils/withStyleProps.tsx +1 -1
|
@@ -6,7 +6,7 @@ import _isUndefined from "lodash/isUndefined";
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
|
-
import { setStatic } from '
|
|
9
|
+
import { setStatic } from '../utils';
|
|
10
10
|
import shallowEqual from '../utils/shallowEqual';
|
|
11
11
|
import Input from '../Input';
|
|
12
12
|
import AutoCompleteItem from './AutoCompleteItem';
|
package/es/Avatar/Avatar.js
CHANGED
|
@@ -4,8 +4,7 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { compose } from '
|
|
8
|
-
import { defaultProps, prefix, withStyleProps } from '../utils';
|
|
7
|
+
import { compose, defaultProps, prefix, withStyleProps } from '../utils';
|
|
9
8
|
import { SIZE } from '../constants';
|
|
10
9
|
|
|
11
10
|
var Avatar =
|
|
@@ -4,9 +4,8 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { setStatic } from 'recompose';
|
|
8
7
|
import BreadcrumbItem from './BreadcrumbItem';
|
|
9
|
-
import { defaultProps, prefix, getUnhandledProps } from '../utils';
|
|
8
|
+
import { setStatic, defaultProps, prefix, getUnhandledProps } from '../utils';
|
|
10
9
|
|
|
11
10
|
var Breadcrumb =
|
|
12
11
|
/*#__PURE__*/
|
package/es/Button/Button.js
CHANGED
|
@@ -4,10 +4,9 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { compose } from 'recompose';
|
|
8
7
|
import SafeAnchor from '../SafeAnchor';
|
|
9
8
|
import Ripple from '../Ripple';
|
|
10
|
-
import { withStyleProps, getUnhandledProps, defaultProps, prefix, isOneOf } from '../utils';
|
|
9
|
+
import { compose, withStyleProps, getUnhandledProps, defaultProps, prefix, isOneOf } from '../utils';
|
|
11
10
|
|
|
12
11
|
var Button =
|
|
13
12
|
/*#__PURE__*/
|
|
@@ -4,8 +4,7 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { compose } from '
|
|
8
|
-
import { withStyleProps, defaultProps, prefix } from '../utils';
|
|
7
|
+
import { compose, withStyleProps, defaultProps, prefix } from '../utils';
|
|
9
8
|
|
|
10
9
|
var ButtonGroup =
|
|
11
10
|
/*#__PURE__*/
|
|
@@ -70,13 +70,13 @@ function (_React$PureComponent) {
|
|
|
70
70
|
_this.handleClick = function (type, d, event) {
|
|
71
71
|
var _this$props = _this.props,
|
|
72
72
|
onSelect = _this$props.onSelect,
|
|
73
|
-
date = _this$props.date
|
|
74
|
-
|
|
73
|
+
date = _this$props.date,
|
|
74
|
+
showMeridian = _this$props.showMeridian;
|
|
75
75
|
var nextDate = date || new Date();
|
|
76
76
|
|
|
77
77
|
switch (type) {
|
|
78
78
|
case 'hours':
|
|
79
|
-
nextDate = setHours(date, d);
|
|
79
|
+
nextDate = setHours(date, showMeridian && getHours(nextDate) >= 12 ? d + 12 : d);
|
|
80
80
|
break;
|
|
81
81
|
|
|
82
82
|
case 'minutes':
|
package/es/Cascader/Cascader.js
CHANGED
|
@@ -32,9 +32,11 @@ function (_React$Component) {
|
|
|
32
32
|
var _this;
|
|
33
33
|
|
|
34
34
|
_this = _React$Component.call(this, props) || this;
|
|
35
|
+
_this.toggleRef = void 0;
|
|
35
36
|
_this.triggerRef = void 0;
|
|
36
37
|
_this.containerRef = void 0;
|
|
37
38
|
_this.positionRef = void 0;
|
|
39
|
+
_this.menuWrapperRef = void 0;
|
|
38
40
|
_this.menuContainerRef = void 0;
|
|
39
41
|
_this.isControlled = void 0;
|
|
40
42
|
|
|
@@ -264,6 +266,14 @@ function (_React$Component) {
|
|
|
264
266
|
}));
|
|
265
267
|
};
|
|
266
268
|
|
|
269
|
+
_this.getPositionInstance = function () {
|
|
270
|
+
return _this.positionRef.current;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
_this.getToggleInstance = function () {
|
|
274
|
+
return _this.toggleRef.current;
|
|
275
|
+
};
|
|
276
|
+
|
|
267
277
|
var initState = {
|
|
268
278
|
searchKeyword: '',
|
|
269
279
|
selectNode: null,
|
|
@@ -282,13 +292,15 @@ function (_React$Component) {
|
|
|
282
292
|
items: []
|
|
283
293
|
};
|
|
284
294
|
_this.state = _extends({}, initState, {}, getDerivedStateForCascade(props, initState), {
|
|
285
|
-
flattenData: flattenTree(props.data)
|
|
295
|
+
flattenData: flattenTree(props.data, props.childrenKey)
|
|
286
296
|
});
|
|
287
297
|
_this.isControlled = !_isUndefined(props.value);
|
|
288
298
|
_this.triggerRef = React.createRef();
|
|
289
299
|
_this.containerRef = React.createRef();
|
|
290
|
-
_this.positionRef = React.createRef();
|
|
300
|
+
_this.positionRef = React.createRef();
|
|
301
|
+
_this.toggleRef = React.createRef(); // for test
|
|
291
302
|
|
|
303
|
+
_this.menuWrapperRef = React.createRef();
|
|
292
304
|
_this.menuContainerRef = React.createRef();
|
|
293
305
|
return _this;
|
|
294
306
|
}
|
|
@@ -297,7 +309,8 @@ function (_React$Component) {
|
|
|
297
309
|
var value = nextProps.value,
|
|
298
310
|
data = nextProps.data,
|
|
299
311
|
labelKey = nextProps.labelKey,
|
|
300
|
-
valueKey = nextProps.valueKey
|
|
312
|
+
valueKey = nextProps.valueKey,
|
|
313
|
+
childrenKey = nextProps.childrenKey;
|
|
301
314
|
|
|
302
315
|
if (data !== prevState.data) {
|
|
303
316
|
var _prevState$selectNode;
|
|
@@ -315,12 +328,12 @@ function (_React$Component) {
|
|
|
315
328
|
return _stringToObject(item, labelKey, valueKey);
|
|
316
329
|
})), {
|
|
317
330
|
data: data,
|
|
318
|
-
flattenData: flattenTree(data)
|
|
331
|
+
flattenData: flattenTree(data, childrenKey)
|
|
319
332
|
});
|
|
320
333
|
}
|
|
321
334
|
|
|
322
335
|
return _extends({}, getDerivedStateForCascade(nextProps, prevState), {
|
|
323
|
-
flattenData: flattenTree(data),
|
|
336
|
+
flattenData: flattenTree(data, childrenKey),
|
|
324
337
|
data: data
|
|
325
338
|
});
|
|
326
339
|
}
|
|
@@ -431,8 +444,11 @@ function (_React$Component) {
|
|
|
431
444
|
var menuProps = _pick(this.props, Object.keys(_omit(dropdownMenuPropTypes, ['classPrefix'])));
|
|
432
445
|
|
|
433
446
|
return React.createElement(MenuWrapper, {
|
|
447
|
+
ref: this.menuWrapperRef,
|
|
434
448
|
className: classes,
|
|
435
|
-
style: menuStyle
|
|
449
|
+
style: menuStyle,
|
|
450
|
+
getToggleInstance: this.getToggleInstance,
|
|
451
|
+
getPositionInstance: this.getPositionInstance
|
|
436
452
|
}, searchable && React.createElement(SearchBar, {
|
|
437
453
|
placeholder: locale.searchPlaceholder,
|
|
438
454
|
onChange: this.handleSearch,
|
|
@@ -526,6 +542,7 @@ function (_React$Component) {
|
|
|
526
542
|
onExited: createChainedFunction(this.handleExit, onExited),
|
|
527
543
|
speaker: this.renderDropdownMenu()
|
|
528
544
|
}, React.createElement(PickerToggle, _extends({}, unhandled, {
|
|
545
|
+
ref: this.toggleRef,
|
|
529
546
|
componentClass: toggleComponentClass,
|
|
530
547
|
onClean: createChainedFunction(this.handleClean, onClean),
|
|
531
548
|
cleanable: cleanable && !disabled,
|
package/es/Drawer/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { setStatic, setDisplayName } from '
|
|
2
|
-
import { defaultProps } from '../utils';
|
|
1
|
+
import { setStatic, setDisplayName, defaultProps } from '../utils';
|
|
3
2
|
import Drawer from './Drawer';
|
|
4
3
|
import ModalBody from '../Modal/ModalBody';
|
|
5
4
|
import ModalHeader from '../Modal/ModalHeader';
|
package/es/Dropdown/Dropdown.js
CHANGED
|
@@ -6,14 +6,13 @@ import _isUndefined from "lodash/isUndefined";
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
|
-
import { setStatic } from 'recompose';
|
|
10
9
|
import { contains } from 'dom-lib';
|
|
11
10
|
import RootCloseWrapper from '../Overlay/RootCloseWrapper';
|
|
12
11
|
import shallowEqual from '../utils/shallowEqual';
|
|
13
12
|
import DropdownToggle from './DropdownToggle';
|
|
14
13
|
import DropdownMenu from './DropdownMenu';
|
|
15
14
|
import DropdownMenuItem from './DropdownMenuItem';
|
|
16
|
-
import { createChainedFunction, prefix, isOneOf, getUnhandledProps, defaultProps, placementPolyfill, getDOMNode } from '../utils';
|
|
15
|
+
import { setStatic, createChainedFunction, prefix, isOneOf, getUnhandledProps, defaultProps, placementPolyfill, getDOMNode } from '../utils';
|
|
17
16
|
import { SidenavContext } from '../Sidenav/Sidenav';
|
|
18
17
|
import { PLACEMENT_8 } from '../constants';
|
|
19
18
|
|
|
@@ -4,8 +4,7 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { setStatic } from '
|
|
8
|
-
import { defaultProps, prefix } from '../utils';
|
|
7
|
+
import { setStatic, defaultProps, prefix } from '../utils';
|
|
9
8
|
import FlexboxGridItem from './FlexboxGridItem';
|
|
10
9
|
|
|
11
10
|
var FlexboxGrid =
|
|
@@ -5,8 +5,7 @@ import _isUndefined from "lodash/isUndefined";
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
|
-
import { compose } from '
|
|
9
|
-
import { withStyleProps, defaultProps, prefix, createContext } from '../utils';
|
|
8
|
+
import { compose, withStyleProps, defaultProps, prefix, createContext } from '../utils';
|
|
10
9
|
export var FormGroupContext = createContext(null);
|
|
11
10
|
|
|
12
11
|
var FormGroup =
|
package/es/Input/Input.js
CHANGED
|
@@ -6,8 +6,7 @@ import _get from "lodash/get";
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
|
-
import { compose } from '
|
|
10
|
-
import { withStyleProps, defaultProps, createChainedFunction, getUnhandledProps, refType } from '../utils';
|
|
9
|
+
import { compose, withStyleProps, defaultProps, createChainedFunction, getUnhandledProps, refType } from '../utils';
|
|
11
10
|
import { FormPlaintextContext } from '../Form/FormContext';
|
|
12
11
|
import { FormGroupContext } from '../FormGroup/FormGroup';
|
|
13
12
|
import { InputGroupContext } from '../InputGroup/InputGroup';
|
|
@@ -4,10 +4,9 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { setStatic, compose } from 'recompose';
|
|
8
7
|
import InputGroupAddon from './InputGroupAddon';
|
|
9
8
|
import InputGroupButton from './InputGroupButton';
|
|
10
|
-
import { prefix, withStyleProps, defaultProps, createContext } from '../utils';
|
|
9
|
+
import { setStatic, compose, prefix, withStyleProps, defaultProps, createContext } from '../utils';
|
|
11
10
|
export var InputGroupContext = createContext(null);
|
|
12
11
|
|
|
13
12
|
var InputGroup =
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _get from "lodash/get";
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { setDisplayName, wrapDisplayName } from '
|
|
4
|
+
import { setDisplayName, wrapDisplayName } from '../utils';
|
|
5
5
|
import format from 'date-fns/format';
|
|
6
6
|
import defaultLocale from './locales/default';
|
|
7
7
|
import extendReactStatics from '../utils/extendReactStatics';
|
package/es/List/List.js
CHANGED
|
@@ -5,11 +5,10 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
5
5
|
import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { setStatic } from 'recompose';
|
|
9
8
|
import classNames from 'classnames';
|
|
10
9
|
import { on } from 'dom-lib';
|
|
11
10
|
import { setInlineStyles, setTranslate3d, setTransitionDuration, closest, getPosition, getEdgeOffset, getScrollingParent } from './utils';
|
|
12
|
-
import { prefix, defaultProps, getUnhandledProps } from '../utils';
|
|
11
|
+
import { setStatic, prefix, defaultProps, getUnhandledProps } from '../utils';
|
|
13
12
|
import ListItem from './ListItem';
|
|
14
13
|
import Manager from './Manager';
|
|
15
14
|
import AutoScroller from './AutoScroller';
|
package/es/List/ListItem.js
CHANGED
|
@@ -3,9 +3,8 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { setDisplayName } from 'recompose';
|
|
7
6
|
import classNames from 'classnames';
|
|
8
|
-
import { defaultProps, getUnhandledProps, prefix } from '../utils';
|
|
7
|
+
import { setDisplayName, defaultProps, getUnhandledProps, prefix } from '../utils';
|
|
9
8
|
import ListContext from './ListContext';
|
|
10
9
|
|
|
11
10
|
var ListItem =
|
package/es/Loader/Loader.js
CHANGED
|
@@ -4,8 +4,7 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { compose } from '
|
|
8
|
-
import { withStyleProps, defaultProps, prefix } from '../utils';
|
|
7
|
+
import { compose, withStyleProps, defaultProps, prefix } from '../utils';
|
|
9
8
|
|
|
10
9
|
var Loader =
|
|
11
10
|
/*#__PURE__*/
|
package/es/Modal/BaseModal.js
CHANGED
|
@@ -48,6 +48,7 @@ function (_React$Component2) {
|
|
|
48
48
|
_this.lastFocus = null;
|
|
49
49
|
_this.onDocumentKeyupListener = null;
|
|
50
50
|
_this.onFocusinListener = null;
|
|
51
|
+
_this._isMounted = null;
|
|
51
52
|
|
|
52
53
|
_this.setMountNodeRef = function (ref) {
|
|
53
54
|
var _ref$getMountNode;
|
|
@@ -95,15 +96,30 @@ function (_React$Component2) {
|
|
|
95
96
|
_this.enforceFocus = function () {
|
|
96
97
|
var enforceFocus = _this.props.enforceFocus;
|
|
97
98
|
|
|
98
|
-
if (!enforceFocus || !_this.isTopModal()) {
|
|
99
|
+
if (!enforceFocus || !_this._isMounted || !_this.isTopModal()) {
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
102
|
|
|
102
|
-
var
|
|
103
|
+
var currentActiveElement = activeElement(ownerDocument(_assertThisInitialized(_this)));
|
|
103
104
|
|
|
104
105
|
var modal = _this.getDialogElement();
|
|
105
106
|
|
|
106
|
-
if (modal && modal !==
|
|
107
|
+
if (modal && modal !== currentActiveElement && !contains(modal, currentActiveElement)) {
|
|
108
|
+
modal.focus();
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
_this.handlePortalRendered = function () {
|
|
113
|
+
if (!_this.props.autoFocus) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
var modal = _this.getDialogElement();
|
|
118
|
+
|
|
119
|
+
var currentActiveElement = activeElement(ownerDocument(_assertThisInitialized(_this)));
|
|
120
|
+
|
|
121
|
+
if (modal && modal !== currentActiveElement && !contains(modal, currentActiveElement)) {
|
|
122
|
+
_this.lastFocus = currentActiveElement;
|
|
107
123
|
modal.focus();
|
|
108
124
|
}
|
|
109
125
|
};
|
|
@@ -120,6 +136,8 @@ function (_React$Component2) {
|
|
|
120
136
|
var _proto2 = BaseModal.prototype;
|
|
121
137
|
|
|
122
138
|
_proto2.componentDidMount = function componentDidMount() {
|
|
139
|
+
this._isMounted = true;
|
|
140
|
+
|
|
123
141
|
if (this.props.show) {
|
|
124
142
|
this.onShow();
|
|
125
143
|
}
|
|
@@ -163,6 +181,7 @@ function (_React$Component2) {
|
|
|
163
181
|
var _this$props4 = this.props,
|
|
164
182
|
show = _this$props4.show,
|
|
165
183
|
transition = _this$props4.transition;
|
|
184
|
+
this._isMounted = false;
|
|
166
185
|
|
|
167
186
|
if (show || transition && !this.state.exited) {
|
|
168
187
|
this.onHide();
|
|
@@ -293,7 +312,8 @@ function (_React$Component2) {
|
|
|
293
312
|
|
|
294
313
|
return React.createElement(Portal, {
|
|
295
314
|
ref: this.setMountNodeRef,
|
|
296
|
-
container: container
|
|
315
|
+
container: container,
|
|
316
|
+
onRendered: this.handlePortalRendered
|
|
297
317
|
}, React.createElement("div", {
|
|
298
318
|
ref: this.modalNodeRef,
|
|
299
319
|
role: rest.role,
|
package/es/Modal/Modal.js
CHANGED
|
@@ -5,12 +5,11 @@ import _pick from "lodash/pick";
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
|
-
import { setStatic } from 'recompose';
|
|
9
8
|
import bindElementResize, { unbind as unbindElementResize } from 'element-resize-event';
|
|
10
9
|
import BaseModal from './BaseModal';
|
|
11
10
|
import Bounce from '../Animation/Bounce';
|
|
12
11
|
import { on, getHeight } from 'dom-lib';
|
|
13
|
-
import { prefix, defaultProps, createChainedFunction } from '../utils';
|
|
12
|
+
import { setStatic, prefix, defaultProps, createChainedFunction } from '../utils';
|
|
14
13
|
import ModalDialog, { modalDialogPropTypes } from './ModalDialog';
|
|
15
14
|
import ModalBody from './ModalBody';
|
|
16
15
|
import ModalHeader from './ModalHeader';
|
package/es/Modal/ModalDialog.js
CHANGED
|
@@ -4,8 +4,7 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { compose } from '
|
|
8
|
-
import { withStyleProps, defaultProps, prefix, refType } from '../utils';
|
|
7
|
+
import { compose, withStyleProps, defaultProps, prefix, refType } from '../utils';
|
|
9
8
|
import mergeRefs from '../utils/mergeRefs';
|
|
10
9
|
export var modalDialogPropTypes = {
|
|
11
10
|
className: PropTypes.string,
|
|
@@ -67,6 +66,7 @@ function (_React$Component) {
|
|
|
67
66
|
return React.createElement("div", _extends({}, props, {
|
|
68
67
|
title: null,
|
|
69
68
|
role: "dialog",
|
|
69
|
+
tabIndex: -1,
|
|
70
70
|
ref: mergeRefs(this.bindHtmlRef, dialogRef),
|
|
71
71
|
className: classNames(classPrefix, className),
|
|
72
72
|
style: modalStyle
|
|
@@ -33,6 +33,7 @@ function (_React$Component) {
|
|
|
33
33
|
_this.menuContainerRef = void 0;
|
|
34
34
|
_this.positionRef = void 0;
|
|
35
35
|
_this.triggerRef = void 0;
|
|
36
|
+
_this.toggleRef = void 0;
|
|
36
37
|
|
|
37
38
|
_this.handleCheck = function (item, event, checked) {
|
|
38
39
|
var _this$props = _this.props,
|
|
@@ -178,6 +179,14 @@ function (_React$Component) {
|
|
|
178
179
|
return prefix(_this.props.classPrefix)(name);
|
|
179
180
|
};
|
|
180
181
|
|
|
182
|
+
_this.getPositionInstance = function () {
|
|
183
|
+
return _this.positionRef.current;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
_this.getToggleInstance = function () {
|
|
187
|
+
return _this.toggleRef.current;
|
|
188
|
+
};
|
|
189
|
+
|
|
181
190
|
_this.renderSearchRow = function (item, key) {
|
|
182
191
|
var _extends2, _classNames;
|
|
183
192
|
|
|
@@ -275,6 +284,7 @@ function (_React$Component) {
|
|
|
275
284
|
_this.menuContainerRef = React.createRef();
|
|
276
285
|
_this.positionRef = React.createRef();
|
|
277
286
|
_this.triggerRef = React.createRef();
|
|
287
|
+
_this.toggleRef = React.createRef();
|
|
278
288
|
return _this;
|
|
279
289
|
}
|
|
280
290
|
|
|
@@ -426,7 +436,9 @@ function (_React$Component) {
|
|
|
426
436
|
|
|
427
437
|
return React.createElement(MenuWrapper, {
|
|
428
438
|
className: classes,
|
|
429
|
-
style: menuStyle
|
|
439
|
+
style: menuStyle,
|
|
440
|
+
getToggleInstance: this.getToggleInstance,
|
|
441
|
+
getPositionInstance: this.getPositionInstance
|
|
430
442
|
}, searchable && React.createElement(SearchBar, {
|
|
431
443
|
placeholder: locale.searchPlaceholder,
|
|
432
444
|
onChange: this.handleSearch,
|
|
@@ -522,6 +534,7 @@ function (_React$Component) {
|
|
|
522
534
|
onExited: createChainedFunction(this.handleExit, onExited),
|
|
523
535
|
speaker: this.renderDropdownMenu()
|
|
524
536
|
}, React.createElement(PickerToggle, _extends({}, unhandled, {
|
|
537
|
+
ref: this.toggleRef,
|
|
525
538
|
componentClass: toggleComponentClass,
|
|
526
539
|
onClean: createChainedFunction(this.handleClean, onClean),
|
|
527
540
|
cleanable: cleanable && !disabled,
|
package/es/Nav/Nav.js
CHANGED
|
@@ -4,10 +4,9 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { setStatic } from 'recompose';
|
|
8
7
|
import shallowEqual from '../utils/shallowEqual';
|
|
9
8
|
import NavItem from './NavItem';
|
|
10
|
-
import { prefix, getUnhandledProps, defaultProps, ReactChildren, createChainedFunction } from '../utils';
|
|
9
|
+
import { setStatic, prefix, getUnhandledProps, defaultProps, ReactChildren, createChainedFunction } from '../utils';
|
|
11
10
|
import { getClassNamePrefix } from '../utils/prefix';
|
|
12
11
|
import { NavbarContext } from '../Navbar/Navbar';
|
|
13
12
|
import { SidenavContext } from '../Sidenav/Sidenav';
|
package/es/Navbar/Navbar.js
CHANGED
|
@@ -4,10 +4,9 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { setStatic } from 'recompose';
|
|
8
7
|
import NavbarBody from './NavbarBody';
|
|
9
8
|
import NavbarHeader from './NavbarHeader';
|
|
10
|
-
import { prefix, defaultProps, createContext } from '../utils';
|
|
9
|
+
import { setStatic, prefix, defaultProps, createContext } from '../utils';
|
|
11
10
|
export var NavbarContext = createContext(null);
|
|
12
11
|
|
|
13
12
|
var Navbar =
|
|
@@ -4,11 +4,10 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { compose } from 'recompose';
|
|
8
7
|
import PaginationButton from './PaginationButton';
|
|
9
8
|
import SafeAnchor from '../SafeAnchor';
|
|
10
9
|
import Icon from '../Icon';
|
|
11
|
-
import { withStyleProps, defaultProps, getUnhandledProps } from '../utils';
|
|
10
|
+
import { compose, withStyleProps, defaultProps, getUnhandledProps } from '../utils';
|
|
12
11
|
import { PAGINATION_ICON_NAMES } from '../constants';
|
|
13
12
|
|
|
14
13
|
var Pagination =
|
package/es/Rate/Rate.js
CHANGED
|
@@ -4,8 +4,7 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { compose } from '
|
|
8
|
-
import { defaultProps, prefix, getUnhandledProps, withStyleProps } from '../utils';
|
|
7
|
+
import { compose, defaultProps, prefix, getUnhandledProps, withStyleProps } from '../utils';
|
|
9
8
|
import { transformValueToCharacterMap, transformCharacterMapToValue } from './utils';
|
|
10
9
|
import shallowEqualArray from '../utils/shallowEqualArray';
|
|
11
10
|
import Icon from '../Icon';
|
package/es/Sidenav/Sidenav.js
CHANGED
|
@@ -7,13 +7,12 @@ import _isUndefined from "lodash/isUndefined";
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import classNames from 'classnames';
|
|
10
|
-
import { setStatic } from 'recompose';
|
|
11
10
|
import Transition from '../Animation/Transition';
|
|
12
11
|
import shallowEqual from '../utils/shallowEqual';
|
|
13
12
|
import SidenavBody from './SidenavBody';
|
|
14
13
|
import SidenavHeader from './SidenavHeader';
|
|
15
14
|
import SidenavToggle from './SidenavToggle';
|
|
16
|
-
import { prefix, defaultProps, getUnhandledProps, createContext } from '../utils';
|
|
15
|
+
import { setStatic, prefix, defaultProps, getUnhandledProps, createContext } from '../utils';
|
|
17
16
|
export var SidenavContext = createContext(null);
|
|
18
17
|
|
|
19
18
|
var Sidenav =
|
package/es/Slider/Slider.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { StandardProps } from '../@types/common';
|
|
2
|
+
import { StandardProps, FormControlBaseProps } from '../@types/common';
|
|
3
3
|
|
|
4
|
-
export interface SliderProps<ValueType = number>
|
|
4
|
+
export interface SliderProps<ValueType = number>
|
|
5
|
+
extends StandardProps,
|
|
6
|
+
FormControlBaseProps<ValueType> {
|
|
5
7
|
/** Minimum value of sliding range */
|
|
6
8
|
min?: number;
|
|
7
9
|
|
|
@@ -11,12 +13,6 @@ export interface SliderProps<ValueType = number> extends StandardProps {
|
|
|
11
13
|
/** Slide the value of one step */
|
|
12
14
|
step?: number;
|
|
13
15
|
|
|
14
|
-
/** Value (Controlled) */
|
|
15
|
-
value?: ValueType;
|
|
16
|
-
|
|
17
|
-
/** Default value */
|
|
18
|
-
defaultValue?: ValueType;
|
|
19
|
-
|
|
20
16
|
/** A css class to apply to the Handle node. */
|
|
21
17
|
handleClassName?: string;
|
|
22
18
|
|
|
@@ -44,9 +40,6 @@ export interface SliderProps<ValueType = number> extends StandardProps {
|
|
|
44
40
|
/** Vertical Slide */
|
|
45
41
|
vertical?: boolean;
|
|
46
42
|
|
|
47
|
-
/** Callback function that changes data */
|
|
48
|
-
onChange?: (value: ValueType, event: React.MouseEvent) => void;
|
|
49
|
-
|
|
50
43
|
/** Customize labels on the render ruler */
|
|
51
44
|
renderMark?: (mark: number) => React.ReactNode;
|
|
52
45
|
}
|
package/es/Steps/Steps.js
CHANGED
|
@@ -6,9 +6,8 @@ import _get from "lodash/get";
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
|
-
import { setStatic } from 'recompose';
|
|
10
9
|
import StepItem from './StepItem';
|
|
11
|
-
import { prefix, defaultProps, ReactChildren, isIE10 } from '../utils';
|
|
10
|
+
import { setStatic, prefix, defaultProps, ReactChildren, isIE10 } from '../utils';
|
|
12
11
|
|
|
13
12
|
var Steps =
|
|
14
13
|
/*#__PURE__*/
|
package/es/Table/Table.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { setStatic, compose } from 'recompose';
|
|
2
1
|
import { Table, Column, Cell, HeaderCell, ColumnGroup } from 'rsuite-table';
|
|
3
|
-
import { defaultProps } from '../utils';
|
|
2
|
+
import { setStatic, compose, defaultProps } from '../utils';
|
|
4
3
|
import withLocale from '../IntlProvider/withLocale';
|
|
5
4
|
import TablePagination from './TablePagination';
|
|
6
5
|
var EnhancedLocaleTable = compose(withLocale(['Table']), defaultProps({
|
|
@@ -4,11 +4,10 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { compose } from 'recompose';
|
|
8
7
|
import Pagination from '../Pagination';
|
|
9
8
|
import SelectPicker from '../SelectPicker';
|
|
10
9
|
import Divider from '../Divider';
|
|
11
|
-
import { prefix, tplTransform, getUnhandledProps, defaultProps } from '../utils';
|
|
10
|
+
import { compose, prefix, tplTransform, getUnhandledProps, defaultProps } from '../utils';
|
|
12
11
|
import withLocale from '../IntlProvider/withLocale';
|
|
13
12
|
|
|
14
13
|
var TablePagination =
|
package/es/Tag/Tag.js
CHANGED
|
@@ -4,8 +4,7 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classnames from 'classnames';
|
|
7
|
-
import { compose } from '
|
|
8
|
-
import { prefix, withStyleProps, defaultProps } from '../utils';
|
|
7
|
+
import { compose, prefix, withStyleProps, defaultProps } from '../utils';
|
|
9
8
|
|
|
10
9
|
var Tag =
|
|
11
10
|
/*#__PURE__*/
|
package/es/TagPicker/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { compose } from '
|
|
2
|
-
import { defaultProps } from '../utils';
|
|
1
|
+
import { compose, defaultProps } from '../utils';
|
|
3
2
|
import InputPicker from '../InputPicker/InputPicker';
|
|
4
3
|
import withLocale from '../IntlProvider/withLocale';
|
|
5
4
|
export default compose(withLocale(['Picker', 'InputPicker']), defaultProps({
|
package/es/Timeline/Timeline.js
CHANGED
|
@@ -5,9 +5,8 @@ import _some from "lodash/some";
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
|
-
import { setStatic } from 'recompose';
|
|
9
8
|
import TimelineItem from './TimelineItem';
|
|
10
|
-
import { defaultProps, prefix, ReactChildren } from '../utils';
|
|
9
|
+
import { setStatic, defaultProps, prefix, ReactChildren } from '../utils';
|
|
11
10
|
|
|
12
11
|
var Timeline =
|
|
13
12
|
/*#__PURE__*/
|
|
@@ -4,8 +4,7 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { compose } from '
|
|
8
|
-
import { prefix, defaultProps, withStyleProps } from '../utils';
|
|
7
|
+
import { compose, prefix, defaultProps, withStyleProps } from '../utils';
|
|
9
8
|
|
|
10
9
|
var TimelineItem =
|
|
11
10
|
/*#__PURE__*/
|
package/es/Toggle/Toggle.js
CHANGED
|
@@ -4,8 +4,7 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { compose } from '
|
|
8
|
-
import { prefix, withStyleProps, defaultProps, getUnhandledProps } from '../utils';
|
|
7
|
+
import { compose, prefix, withStyleProps, defaultProps, getUnhandledProps } from '../utils';
|
|
9
8
|
|
|
10
9
|
var Toggle =
|
|
11
10
|
/*#__PURE__*/
|