rsuite 4.10.0 → 4.10.4
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 +51 -5
- package/dist/rsuite.js +65 -172
- package/dist/rsuite.min.js +2 -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/CheckTreePicker/CheckTreePicker.js +8 -7
- 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/Modal.js +1 -2
- package/es/Modal/ModalDialog.js +1 -2
- package/es/MultiCascader/MultiCascader.js +14 -1
- package/es/Nav/Nav.js +1 -2
- package/es/Navbar/Navbar.js +1 -2
- package/es/Overlay/OverlayTrigger.d.ts +1 -1
- package/es/Overlay/OverlayTrigger.js +12 -1
- 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 +1 -2
- package/es/utils/defaultProps.js +1 -1
- package/es/utils/index.js +1 -0
- package/es/utils/recompose.js +42 -0
- package/es/utils/treeUtils.js +5 -1
- 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/CheckTreePicker/CheckTreePicker.js +8 -7
- 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/Modal.js +5 -7
- package/lib/Modal/ModalDialog.js +1 -3
- package/lib/MultiCascader/MultiCascader.js +14 -1
- package/lib/Nav/Nav.js +1 -3
- package/lib/Navbar/Navbar.js +2 -4
- package/lib/Overlay/OverlayTrigger.d.ts +1 -1
- package/lib/Overlay/OverlayTrigger.js +12 -1
- 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 +1 -3
- package/lib/utils/defaultProps.js +1 -1
- package/lib/utils/index.js +8 -0
- package/lib/utils/recompose.js +57 -0
- package/lib/utils/treeUtils.js +5 -1
- 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/CheckTreePicker/CheckTreePicker.tsx +15 -7
- package/src/CheckTreePicker/test/CheckTreePickerSpec.js +184 -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/Modal.tsx +1 -2
- package/src/Modal/ModalDialog.tsx +1 -2
- package/src/MultiCascader/MultiCascader.tsx +17 -1
- package/src/Nav/Nav.tsx +1 -1
- package/src/Navbar/Navbar.tsx +1 -2
- package/src/Overlay/OverlayTrigger.d.ts +1 -1
- package/src/Overlay/OverlayTrigger.tsx +22 -1
- package/src/Overlay/test/OverlayTriggerSpec.js +155 -0
- 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/TreePicker/test/TreePickerSpec.js +43 -15
- package/src/Uploader/Uploader.tsx +1 -2
- 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/treeUtils.ts +4 -1
- package/src/utils/withStyleProps.tsx +1 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// Ref: https://github.com/acdlite/recompose/tree/master/src/packages/recompose/__tests__
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import {
|
|
5
|
+
compose,
|
|
6
|
+
setStatic,
|
|
7
|
+
setDisplayName,
|
|
8
|
+
getDisplayName,
|
|
9
|
+
wrapDisplayName,
|
|
10
|
+
setPropTypes
|
|
11
|
+
} from '../recompose';
|
|
12
|
+
|
|
13
|
+
describe('compose', function() {
|
|
14
|
+
it('composes from right to left', () => {
|
|
15
|
+
const double = x => x * 2;
|
|
16
|
+
const square = x => x * x;
|
|
17
|
+
expect(compose(square)(5)).to.equal(25);
|
|
18
|
+
expect(compose(square, double)(5)).to.equal(100);
|
|
19
|
+
expect(compose(double, square, double)(5)).to.equal(200);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('can be seeded with multiple arguments', () => {
|
|
23
|
+
const square = x => x * x;
|
|
24
|
+
const add = (x, y) => x + y;
|
|
25
|
+
expect(compose(square, add)(1, 2)).to.equal(9);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('returns the identity function if given no arguments', () => {
|
|
29
|
+
expect(compose()(1, 2)).to.equal(1);
|
|
30
|
+
expect(compose()(3)).to.equal(3);
|
|
31
|
+
expect(compose()()).to.equal(undefined);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('the first function if given only one', () => {
|
|
35
|
+
const fn = x => x * x;
|
|
36
|
+
expect(compose(fn)(3)).to.equal(fn(3));
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('setStatic', () => {
|
|
41
|
+
it('sets a static property on the base component', () => {
|
|
42
|
+
const BaseComponent = () => <div />;
|
|
43
|
+
const NewComponent = setStatic('propTypes', { foo: PropTypes.object })(BaseComponent);
|
|
44
|
+
|
|
45
|
+
expect(NewComponent.propTypes).to.eql({
|
|
46
|
+
foo: PropTypes.object
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe('setDisplayName', () => {
|
|
52
|
+
it('sets a static property on the base component', () => {
|
|
53
|
+
const BaseComponent = () => <div />;
|
|
54
|
+
const NewComponent = setDisplayName('Foo')(BaseComponent);
|
|
55
|
+
expect(NewComponent.displayName).to.equal('Foo');
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe('getDisplayName', () => {
|
|
60
|
+
it('gets the display name of a React component', () => {
|
|
61
|
+
class SomeComponent extends React.Component {
|
|
62
|
+
render() {
|
|
63
|
+
return <div />;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
class SomeOtherComponent extends React.Component {
|
|
68
|
+
static displayName = 'CustomDisplayName';
|
|
69
|
+
render() {
|
|
70
|
+
return <div />;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function YetAnotherComponent() {
|
|
75
|
+
return <div />;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
expect(getDisplayName(SomeComponent)).to.equal('SomeComponent');
|
|
79
|
+
expect(getDisplayName(SomeOtherComponent)).to.equal('CustomDisplayName');
|
|
80
|
+
expect(getDisplayName(YetAnotherComponent)).to.equal('YetAnotherComponent');
|
|
81
|
+
expect(getDisplayName(() => <div />)).to.equal('Component');
|
|
82
|
+
expect(getDisplayName('div')).to.equal('div');
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe('wrapDisplayName', () => {
|
|
87
|
+
it('wraps the display name of a React component with the name of an HoC, Relay-style', () => {
|
|
88
|
+
class SomeComponent extends React.Component {
|
|
89
|
+
render() {
|
|
90
|
+
return <div />;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
expect(wrapDisplayName(SomeComponent, 'someHoC')).to.equal('someHoC(SomeComponent)');
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
describe('setPropTypes', () => {
|
|
99
|
+
it(' sets a static property on the base component', () => {
|
|
100
|
+
const BaseComponent = () => <div />;
|
|
101
|
+
const NewComponent = setPropTypes({ foo: PropTypes.object })(BaseComponent);
|
|
102
|
+
|
|
103
|
+
expect(NewComponent.propTypes).to.eql({
|
|
104
|
+
foo: PropTypes.object
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
});
|
package/src/utils/treeUtils.ts
CHANGED
|
@@ -123,7 +123,10 @@ export function treeDeprecatedWarning(
|
|
|
123
123
|
* @param b
|
|
124
124
|
*/
|
|
125
125
|
export function compareArray(a: any[], b: any[]) {
|
|
126
|
-
|
|
126
|
+
if (!(_.isArray(a) && _.isArray(b))) {
|
|
127
|
+
return a !== b;
|
|
128
|
+
}
|
|
129
|
+
return !shallowEqualArray(a, b);
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import { setDisplayName, wrapDisplayName, setPropTypes } from 'recompose';
|
|
4
|
+
import { setDisplayName, wrapDisplayName, setPropTypes } from './recompose';
|
|
5
5
|
|
|
6
6
|
import { TypeAttributes } from '../@types/common';
|
|
7
7
|
import prefix from './prefix';
|