@sheinoutmobile/shineoutmobile 1.8.2
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.
Potentially problematic release.
This version of @sheinoutmobile/shineoutmobile might be problematic. Click here for more details.
- package/.eslintignore +20 -0
- package/.eslintrc +8 -0
- package/.gitlab-ci.yml +53 -0
- package/.yarnrc +1 -0
- package/CHANGELOG.md +8 -0
- package/README.md +14 -0
- package/build.config.js +6 -0
- package/doc.config.js +16 -0
- package/lib/index.esm.js +5414 -0
- package/lib/index.esm.js.map +1 -0
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -0
- package/package.json +47 -0
- package/src/component/button/button.jsx +83 -0
- package/src/component/button/index.jsx +3 -0
- package/src/component/button/style.less +132 -0
- package/src/component/cell/cell.jsx +71 -0
- package/src/component/cell/index.jsx +3 -0
- package/src/component/cell/style.less +86 -0
- package/src/component/cell-group/cell-group.jsx +26 -0
- package/src/component/cell-group/index.jsx +3 -0
- package/src/component/cell-group/style.less +22 -0
- package/src/component/checkbox/checkbox.jsx +92 -0
- package/src/component/checkbox/index.js +3 -0
- package/src/component/checkbox/kind/checkbox-button.jsx +41 -0
- package/src/component/checkbox/style.less +49 -0
- package/src/component/dialog/dialog.jsx +58 -0
- package/src/component/dialog/index.js +3 -0
- package/src/component/dialog/kind/dialog-alert.jsx +22 -0
- package/src/component/dialog/kind/dialog-confirm.jsx +54 -0
- package/src/component/dialog/style.less +80 -0
- package/src/component/drawer/drawer.jsx +151 -0
- package/src/component/drawer/index.jsx +3 -0
- package/src/component/drawer/js/tools.js +1 -0
- package/src/component/drawer/style.less +17 -0
- package/src/component/field/field.jsx +49 -0
- package/src/component/field/index.js +3 -0
- package/src/component/icon/icon.jsx +55 -0
- package/src/component/icon/index.jsx +19 -0
- package/src/component/icon/style.less +9 -0
- package/src/component/icons/index.js +3 -0
- package/src/component/icons/mrp.js +3 -0
- package/src/component/image-previewer/image-previewer.jsx +54 -0
- package/src/component/image-previewer/index.js +3 -0
- package/src/component/index-sort-list/group.jsx +49 -0
- package/src/component/index-sort-list/index-bar.jsx +34 -0
- package/src/component/index-sort-list/index.js +3 -0
- package/src/component/index-sort-list/js/rules.js +14 -0
- package/src/component/index-sort-list/js/sort-rule.js +41 -0
- package/src/component/index-sort-list/list.jsx +110 -0
- package/src/component/index-sort-list/style.less +109 -0
- package/src/component/input/index.js +3 -0
- package/src/component/input/input.jsx +285 -0
- package/src/component/input/style.less +77 -0
- package/src/component/list-view/index.js +3 -0
- package/src/component/list-view/jsx/empty.jsx +23 -0
- package/src/component/list-view/list-view.jsx +165 -0
- package/src/component/list-view/style.less +79 -0
- package/src/component/loading/index.js +3 -0
- package/src/component/loading/loading.jsx +97 -0
- package/src/component/loading/styles.less +128 -0
- package/src/component/multiple-selector/index.jsx +3 -0
- package/src/component/multiple-selector/item.jsx +23 -0
- package/src/component/multiple-selector/multiple-selector.jsx +116 -0
- package/src/component/multiple-selector/selector.jsx +41 -0
- package/src/component/multiple-selector/style.less +78 -0
- package/src/component/notice-bar/index.jsx +3 -0
- package/src/component/notice-bar/notice-bar.jsx +86 -0
- package/src/component/notice-bar/style.less +72 -0
- package/src/component/notify/index.js +37 -0
- package/src/component/notify/notify.jsx +125 -0
- package/src/component/notify/style.less +48 -0
- package/src/component/picker/drawPicker.jsx +110 -0
- package/src/component/picker/index.js +3 -0
- package/src/component/picker/picker.jsx +380 -0
- package/src/component/picker/pickerItem.jsx +31 -0
- package/src/component/picker/style.less +80 -0
- package/src/component/pull-refresh/index.js +3 -0
- package/src/component/pull-refresh/pull-refresh.jsx +46 -0
- package/src/component/search-bar/index.jsx +3 -0
- package/src/component/search-bar/search-bar.jsx +97 -0
- package/src/component/search-bar/style.less +52 -0
- package/src/component/sign/index.jsx +3 -0
- package/src/component/sign/sign.jsx +33 -0
- package/src/component/sign/style.less +56 -0
- package/src/component/sort-item/index.jsx +3 -0
- package/src/component/sort-item/sort-item.jsx +52 -0
- package/src/component/sort-item/style.less +52 -0
- package/src/component/subscript/index.js +3 -0
- package/src/component/subscript/style.less +63 -0
- package/src/component/subscript/subscript.jsx +77 -0
- package/src/component/tab/index.jsx +6 -0
- package/src/component/tab/nav-child.jsx +63 -0
- package/src/component/tab/panel.jsx +22 -0
- package/src/component/tab/style.less +87 -0
- package/src/component/tab/tab.jsx +195 -0
- package/src/component/tag/index.jsx +3 -0
- package/src/component/tag/style.less +56 -0
- package/src/component/tag/tag.jsx +52 -0
- package/src/component/toast/content.jsx +31 -0
- package/src/component/toast/index.js +3 -0
- package/src/component/toast/style.less +50 -0
- package/src/component/toast/toast.jsx +62 -0
- package/src/component/touchable/index.js +3 -0
- package/src/component/touchable/style.less +33 -0
- package/src/component/touchable/touchable.jsx +43 -0
- package/src/component/uploader/index.jsx +445 -0
- package/src/component/uploader/js/get-image-base64.js +31 -0
- package/src/component/uploader/js/get-image-detail.js +26 -0
- package/src/component/uploader/js/index.js +77 -0
- package/src/component/uploader/js/merge-class-name.js +14 -0
- package/src/component/uploader/js/old-compress-function.js +64 -0
- package/src/component/uploader/js/request.js +62 -0
- package/src/component/uploader/js/tools.js +115 -0
- package/src/component/uploader/jsx/config.jsx +36 -0
- package/src/component/uploader/jsx/img-preview.jsx +41 -0
- package/src/component/uploader/jsx/thumbnails.jsx +27 -0
- package/src/component/uploader/styles/index.less +158 -0
- package/src/index.js +1 -0
- package/src/index.jsx +64 -0
- package/src/styles/color.less +51 -0
- package/src/styles/font.less +14 -0
- package/src/styles/format-theme.less +27 -0
- package/src/styles/index.less +26 -0
- package/src/styles/spacing.less +3 -0
- package/src/styles/var.less +3 -0
- package/src/tools/create-body-container.js +47 -0
- package/src/tools/limit-body-scroll.js +17 -0
- package/src/tools/limit-document-scroll.js +12 -0
- package/src/tools/merge-class-name.js +14 -0
- package/src/tools/object-key-check.js +3 -0
- package/src/tools/pinyin.js +6 -0
- package/src/tools/proptypes.js +51 -0
- package/src/tools/style.less +14 -0
- package/test/cases/case-button01.assert.js +6 -0
- package/test/cases/case-button01.source.jsx +28 -0
- package/test/cases/case-checkbox01.assert.js +6 -0
- package/test/cases/case-checkbox01.source.jsx +20 -0
- package/test/cases/case-dialog01.assert.js +6 -0
- package/test/cases/case-dialog01.source.jsx +45 -0
- package/test/cases/case-drawer01.assert.js +6 -0
- package/test/cases/case-drawer01.source.jsx +85 -0
- package/test/cases/case-icons01.assert.js +6 -0
- package/test/cases/case-icons01.source.jsx +25 -0
- package/test/cases/case-indexSortList01.assert.js +6 -0
- package/test/cases/case-indexSortList01.source.jsx +74 -0
- package/test/cases/case-input01.assert.js +6 -0
- package/test/cases/case-input01.source.jsx +24 -0
- package/test/cases/case-listView01.assert.js +6 -0
- package/test/cases/case-listView01.source.jsx +64 -0
- package/test/cases/case-multiplePicker01.assert.js +6 -0
- package/test/cases/case-multiplePicker01.source.jsx +60 -0
- package/test/cases/case-multipleSelector01.assert.js +6 -0
- package/test/cases/case-multipleSelector01.source.jsx +49 -0
- package/test/cases/case-noticebar01.assert.js +6 -0
- package/test/cases/case-noticebar01.source.jsx +21 -0
- package/test/cases/case-picker01.assert.js +6 -0
- package/test/cases/case-picker01.source.jsx +61 -0
- package/test/cases/case-refresh01.assert.js +6 -0
- package/test/cases/case-refresh01.source.jsx +33 -0
- package/test/cases/case-sign01.assert.js +6 -0
- package/test/cases/case-sign01.source.jsx +21 -0
- package/test/cases/case-subscript01.assert.js +6 -0
- package/test/cases/case-subscript01.source.jsx +30 -0
- package/test/cases/case-tab01.assert.js +6 -0
- package/test/cases/case-tab01.source.jsx +51 -0
- package/test/cases/case-toast01.assert.js +6 -0
- package/test/cases/case-toast01.source.jsx +32 -0
- package/test/cases/case-uploader01.assert.js +6 -0
- package/test/cases/case-uploader01.source.jsx +45 -0
- package/test.config.js +25 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
@import "../../styles/color";
|
|
2
|
+
@import "../../styles/font";
|
|
3
|
+
@import "../../styles/format-theme";
|
|
4
|
+
|
|
5
|
+
.drawer{
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.normal-title{
|
|
11
|
+
line-height: @multiple-title-line-height;
|
|
12
|
+
//font-family: @medium;
|
|
13
|
+
font-size: @size-big;
|
|
14
|
+
font-weight: @weight-bold;
|
|
15
|
+
text-align: center;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.container{
|
|
19
|
+
display: flex;
|
|
20
|
+
width: 200%;
|
|
21
|
+
flex: 1;
|
|
22
|
+
|
|
23
|
+
overflow: auto;
|
|
24
|
+
transition: 0.3s;
|
|
25
|
+
|
|
26
|
+
&-content{
|
|
27
|
+
flex: 1;
|
|
28
|
+
margin: 0;
|
|
29
|
+
padding: 0;
|
|
30
|
+
|
|
31
|
+
overflow: auto;
|
|
32
|
+
border-top: 1px solid @border-color;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.selector{
|
|
37
|
+
height: 44px;
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: space-between;
|
|
41
|
+
|
|
42
|
+
padding: 0 15px;
|
|
43
|
+
|
|
44
|
+
border-bottom: 1px solid @border-color;
|
|
45
|
+
|
|
46
|
+
list-style: none;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
|
|
49
|
+
&-result-text {
|
|
50
|
+
margin-right: 8px;
|
|
51
|
+
|
|
52
|
+
color: @gray-darker;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&-right-icon {
|
|
56
|
+
color: @gray-dark;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:active{
|
|
60
|
+
background: rgba(229, 229, 229, 0.5);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.item{
|
|
65
|
+
height: 44px;
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
|
|
69
|
+
padding: 0 15px;
|
|
70
|
+
|
|
71
|
+
border-bottom: 1px solid @border-color;
|
|
72
|
+
|
|
73
|
+
list-style: none;
|
|
74
|
+
|
|
75
|
+
&:active{
|
|
76
|
+
background: rgba(229, 229, 229, 0.5);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React, { PureComponent, isValidElement } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styles from './style.less';
|
|
4
|
+
import Icon from '../icons';
|
|
5
|
+
|
|
6
|
+
import mergeClassName from '../../tools/merge-class-name';
|
|
7
|
+
|
|
8
|
+
const classname = 'sm-notice-bar';
|
|
9
|
+
|
|
10
|
+
class NoticeBar extends PureComponent {
|
|
11
|
+
constructor(props) {
|
|
12
|
+
super(props);
|
|
13
|
+
this.state = {
|
|
14
|
+
animationStyle: {},
|
|
15
|
+
};
|
|
16
|
+
this.container = React.createRef();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
componentDidMount() {
|
|
20
|
+
this.createStyle();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
leftIcon() {
|
|
24
|
+
const { icon } = this.props;
|
|
25
|
+
if (isValidElement(icon)) return icon;
|
|
26
|
+
if (typeof icon === 'string') return (<Icon name={icon} className={styles[`${classname}-left-icon`]} />);
|
|
27
|
+
if (icon) return (<Icon name="inform" className={styles[`${classname}-left-icon`]} />);
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// 构建动画的起点、延迟、速率
|
|
32
|
+
createStyle() {
|
|
33
|
+
const { delay, speed, scrollable } = this.props;
|
|
34
|
+
const animationStyle = {};
|
|
35
|
+
|
|
36
|
+
if (scrollable) {
|
|
37
|
+
animationStyle.paddingLeft = this.container.current.clientWidth;
|
|
38
|
+
animationStyle.animationDelay = `${delay}s`;
|
|
39
|
+
animationStyle.animationDuration = `${this.container.current.clientWidth / speed}s`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
this.setState({ animationStyle });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
render() {
|
|
46
|
+
const { text, className, style } = this.props;
|
|
47
|
+
const { animationStyle } = this.state;
|
|
48
|
+
|
|
49
|
+
const textClassName = mergeClassName([
|
|
50
|
+
styles[`${classname}-content`],
|
|
51
|
+
styles[`${classname}-play-infinite`],
|
|
52
|
+
]);
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<div
|
|
56
|
+
ref={this.container}
|
|
57
|
+
role="alert"
|
|
58
|
+
className={mergeClassName([styles[classname], className])}
|
|
59
|
+
style={style}
|
|
60
|
+
>
|
|
61
|
+
{this.leftIcon()}
|
|
62
|
+
<div className={styles[`${classname}-wrap`]}>
|
|
63
|
+
<div className={textClassName} style={animationStyle}>{text}</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
NoticeBar.propTypes = {
|
|
71
|
+
text: PropTypes.node,
|
|
72
|
+
icon: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
|
|
73
|
+
delay: PropTypes.number,
|
|
74
|
+
speed: PropTypes.number,
|
|
75
|
+
scrollable: PropTypes.bool,
|
|
76
|
+
className: PropTypes.string,
|
|
77
|
+
style: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
NoticeBar.defaultProps = {
|
|
81
|
+
delay: 1,
|
|
82
|
+
speed: 50,
|
|
83
|
+
scrollable: true,
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default NoticeBar;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
@import "../../styles/color";
|
|
2
|
+
@import "../../styles/font";
|
|
3
|
+
@import "../../styles/format-theme";
|
|
4
|
+
|
|
5
|
+
.sm-notice-bar {
|
|
6
|
+
position: relative;
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
height: @notice-bar-height;
|
|
10
|
+
padding: @notice-bar-padding;
|
|
11
|
+
color: @orange-dark;
|
|
12
|
+
font-size: @size-normal;
|
|
13
|
+
line-height: @notice-bar-line-height;
|
|
14
|
+
background-color: @orange-light;
|
|
15
|
+
|
|
16
|
+
&-left-icon {
|
|
17
|
+
min-width: @notice-bar-icon-min-width;
|
|
18
|
+
font-size: @notice-bar-icon-size;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&-wrap {
|
|
22
|
+
position: relative;
|
|
23
|
+
flex: 1;
|
|
24
|
+
height: @notice-bar-line-height;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&-content {
|
|
29
|
+
position: absolute;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
|
|
32
|
+
&.sm-ellipsis {
|
|
33
|
+
max-width: 100%;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&-play {
|
|
38
|
+
animation: sm-notice-bar-play linear both;
|
|
39
|
+
|
|
40
|
+
&-infinite {
|
|
41
|
+
animation: sm-notice-bar-play-infinite linear infinite both;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&-wrapable {
|
|
46
|
+
height: auto;
|
|
47
|
+
//padding: @notice-bar-wrapable-padding;
|
|
48
|
+
|
|
49
|
+
.sm-notice-bar {
|
|
50
|
+
&-wrap {
|
|
51
|
+
height: auto;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&-content {
|
|
55
|
+
position: relative;
|
|
56
|
+
white-space: normal;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Declare two same keyframes
|
|
64
|
+
* In case that some mobile browsers can continue animation when className changed
|
|
65
|
+
*/
|
|
66
|
+
@keyframes sm-notice-bar-play {
|
|
67
|
+
to { transform: translate3d(-100%, 0, 0); }
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@keyframes sm-notice-bar-play-infinite {
|
|
71
|
+
to { transform: translate3d(-100%, 0, 0); }
|
|
72
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import Notify from './notify';
|
|
4
|
+
|
|
5
|
+
Notify.show = function(args) {
|
|
6
|
+
const container = document.createElement('div');
|
|
7
|
+
document.body.appendChild(container);
|
|
8
|
+
const props = typeof args === 'string' ? { content: args } : args;
|
|
9
|
+
const onClose = props.onClose;
|
|
10
|
+
const component = React.createElement(Notify, Object.assign(props, {
|
|
11
|
+
onClose: () => {
|
|
12
|
+
if (onClose instanceof Function) {
|
|
13
|
+
onClose();
|
|
14
|
+
}
|
|
15
|
+
ReactDOM.unmountComponentAtNode(container);
|
|
16
|
+
document.body.removeChild(container);
|
|
17
|
+
}
|
|
18
|
+
}));
|
|
19
|
+
ReactDOM.render(component, container);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
Notify.success = function (args) {
|
|
23
|
+
const props = typeof args === 'string' ? { content: args } : args;
|
|
24
|
+
this.show({ ...props, type: 'success' })
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
Notify.warning = function (args) {
|
|
28
|
+
const props = typeof args === 'string' ? { content: args } : args;
|
|
29
|
+
this.show({ ...props, type: 'warning' })
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
Notify.danger = function (args) {
|
|
33
|
+
const props = typeof args === 'string' ? { content: args } : args;
|
|
34
|
+
this.show({ ...props, type: 'danger' })
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default Notify;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import {CSSTransition} from 'react-transition-group';
|
|
4
|
+
import styles from './style.less';
|
|
5
|
+
import mergeClassName from "../../tools/merge-class-name";
|
|
6
|
+
|
|
7
|
+
class Notify extends React.Component {
|
|
8
|
+
constructor(props, context) {
|
|
9
|
+
super(props, context);
|
|
10
|
+
this.state = {
|
|
11
|
+
visible: true,
|
|
12
|
+
display: props.visible ? 'block' : 'none',
|
|
13
|
+
};
|
|
14
|
+
this.startTimer();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
componentWillUnmount() {
|
|
18
|
+
this.stopTimer();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
startTimer() {
|
|
22
|
+
const { duration } = this.props;
|
|
23
|
+
if (duration > 0) {
|
|
24
|
+
this.timeout = setTimeout(() => {
|
|
25
|
+
this.onClose();
|
|
26
|
+
}, duration)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
stopTimer() {
|
|
31
|
+
clearTimeout(this.timeout);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
onClose() {
|
|
35
|
+
this.stopTimer();
|
|
36
|
+
|
|
37
|
+
this.setState({
|
|
38
|
+
visible: false
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
setDisplay(show) {
|
|
43
|
+
this.setState({
|
|
44
|
+
display: show ? 'block' : 'none'
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
render() {
|
|
49
|
+
const { visible, display } = this.state;
|
|
50
|
+
const {
|
|
51
|
+
style,
|
|
52
|
+
className,
|
|
53
|
+
type,
|
|
54
|
+
content,
|
|
55
|
+
animationDuration,
|
|
56
|
+
singleton,
|
|
57
|
+
children,
|
|
58
|
+
color,
|
|
59
|
+
textColor,
|
|
60
|
+
onClose,
|
|
61
|
+
} = this.props;
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<CSSTransition
|
|
65
|
+
in={visible}
|
|
66
|
+
timeout={{
|
|
67
|
+
appear: 0,
|
|
68
|
+
enter: 0,
|
|
69
|
+
exit: animationDuration,
|
|
70
|
+
}}
|
|
71
|
+
classNames="notify-popup"
|
|
72
|
+
onEnter={() => this.setDisplay(true)}
|
|
73
|
+
onExited={() => {
|
|
74
|
+
this.setDisplay(false)
|
|
75
|
+
if (onClose instanceof Function) {
|
|
76
|
+
onClose();
|
|
77
|
+
}
|
|
78
|
+
}}
|
|
79
|
+
appear={true}
|
|
80
|
+
unmountOnExit={!singleton}
|
|
81
|
+
>
|
|
82
|
+
<div
|
|
83
|
+
className={
|
|
84
|
+
mergeClassName([
|
|
85
|
+
styles.notify,
|
|
86
|
+
styles['notify-popup'],
|
|
87
|
+
styles[`notify--${type}`],
|
|
88
|
+
className,
|
|
89
|
+
])
|
|
90
|
+
}
|
|
91
|
+
style={{
|
|
92
|
+
background: color,
|
|
93
|
+
color: textColor,
|
|
94
|
+
...style,
|
|
95
|
+
display,
|
|
96
|
+
transitionDuration: `${animationDuration}ms`
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
{content || children}
|
|
100
|
+
</div>
|
|
101
|
+
</CSSTransition>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
Notify.propTypes = {
|
|
107
|
+
style: PropTypes.object,
|
|
108
|
+
className: PropTypes.string,
|
|
109
|
+
type: PropTypes.oneOf(['primary', 'success', 'warning', 'danger']),
|
|
110
|
+
content: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
|
|
111
|
+
duration: PropTypes.number,
|
|
112
|
+
animationDuration: PropTypes.number,
|
|
113
|
+
color: PropTypes.string,
|
|
114
|
+
textColor: PropTypes.string,
|
|
115
|
+
onClose: PropTypes.func,
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
Notify.defaultProps = {
|
|
119
|
+
type: 'primary',
|
|
120
|
+
duration: 2000,
|
|
121
|
+
animationDuration: 350,
|
|
122
|
+
singleton: false,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export default Notify
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@import "../../styles/var";
|
|
2
|
+
|
|
3
|
+
.notify {
|
|
4
|
+
display: none;
|
|
5
|
+
width: 100%;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
padding: 8px 16px;
|
|
8
|
+
font-size: 14px;
|
|
9
|
+
line-height: 20px;
|
|
10
|
+
white-space: pre-wrap;
|
|
11
|
+
word-wrap: break-word;
|
|
12
|
+
font-size: @size-normal;
|
|
13
|
+
color: @white;
|
|
14
|
+
|
|
15
|
+
&-popup {
|
|
16
|
+
position: fixed;
|
|
17
|
+
max-height: 100%;
|
|
18
|
+
overflow-y: auto;
|
|
19
|
+
top: 0;
|
|
20
|
+
left: 0;
|
|
21
|
+
}
|
|
22
|
+
&--primary {
|
|
23
|
+
background-color: @notify-primary-background-color;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&--success {
|
|
27
|
+
background-color: @notify-success-background-color;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&--danger {
|
|
31
|
+
background-color: @notify-danger-background-color;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&--warning {
|
|
35
|
+
background-color: @notify-warning-background-color;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
:global {
|
|
39
|
+
.notify-popup-appear, .notify-popup-appear-active {
|
|
40
|
+
transform: translate3d(0, -100%, 0);
|
|
41
|
+
}
|
|
42
|
+
.notify-popup-enter, .notify-popup-enter-active {
|
|
43
|
+
transform: translate3d(0, -100%, 0);
|
|
44
|
+
}
|
|
45
|
+
.notify-popup-exit, .notify-popup-exit-active {
|
|
46
|
+
transform: translate3d(0, -100%, 0);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import Picker from './picker';
|
|
5
|
+
import Drawer from '../drawer';
|
|
6
|
+
import PickerItem from './pickerItem';
|
|
7
|
+
|
|
8
|
+
import styles from './style.less';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 抽屉类型选择器
|
|
12
|
+
*/
|
|
13
|
+
class DrawPicker extends Component {
|
|
14
|
+
constructor(props) {
|
|
15
|
+
super(props);
|
|
16
|
+
|
|
17
|
+
this.state = {
|
|
18
|
+
selected: '',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
this.onPickerValueChange = this.onPickerValueChange.bind(this);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
onPickerValueChange(value) {
|
|
25
|
+
this.setState({
|
|
26
|
+
selected: value,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
render() {
|
|
32
|
+
const {
|
|
33
|
+
visible,
|
|
34
|
+
onCancel,
|
|
35
|
+
onConfirm,
|
|
36
|
+
data,
|
|
37
|
+
title,
|
|
38
|
+
height,
|
|
39
|
+
defaultValue,
|
|
40
|
+
...others
|
|
41
|
+
} = this.props;
|
|
42
|
+
let { selected } = this.state;
|
|
43
|
+
if (selected === undefined || selected === '') {
|
|
44
|
+
selected = defaultValue;
|
|
45
|
+
}
|
|
46
|
+
return (
|
|
47
|
+
<Drawer
|
|
48
|
+
visible={visible}
|
|
49
|
+
onClose={onCancel}
|
|
50
|
+
position="bottom"
|
|
51
|
+
height={height}
|
|
52
|
+
drawerClass={styles['draw-picker']}
|
|
53
|
+
>
|
|
54
|
+
<div className={styles['sm-picker-header']}>
|
|
55
|
+
<div
|
|
56
|
+
className={styles['header-left']}
|
|
57
|
+
onClick={onCancel}
|
|
58
|
+
>
|
|
59
|
+
取消
|
|
60
|
+
</div>
|
|
61
|
+
<div className={styles['header-center']}>{title}</div>
|
|
62
|
+
<div
|
|
63
|
+
className={styles['header-right']}
|
|
64
|
+
onClick={() => onConfirm(selected)}
|
|
65
|
+
>
|
|
66
|
+
确定
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
<div className={styles['sm-picker']}>
|
|
70
|
+
{visible ? (
|
|
71
|
+
<Picker
|
|
72
|
+
value={selected}
|
|
73
|
+
onValueChange={this.onPickerValueChange}
|
|
74
|
+
{...others}
|
|
75
|
+
>
|
|
76
|
+
{data.map(item => (
|
|
77
|
+
<PickerItem key={item.value} value={item.value}>{item.label}</PickerItem>
|
|
78
|
+
))}
|
|
79
|
+
</Picker>
|
|
80
|
+
) : ''}
|
|
81
|
+
</div>
|
|
82
|
+
</Drawer>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
DrawPicker.propTypes = {
|
|
89
|
+
onCancel: PropTypes.func,
|
|
90
|
+
onConfirm: PropTypes.func,
|
|
91
|
+
title: PropTypes.string, // 标题
|
|
92
|
+
height: PropTypes.oneOfType([
|
|
93
|
+
PropTypes.string,
|
|
94
|
+
PropTypes.number,
|
|
95
|
+
]),
|
|
96
|
+
visible: PropTypes.bool,
|
|
97
|
+
data: PropTypes.arrayOf(PropTypes.any),
|
|
98
|
+
defaultValue: PropTypes.oneOfType([
|
|
99
|
+
PropTypes.string,
|
|
100
|
+
PropTypes.number,
|
|
101
|
+
PropTypes.object,
|
|
102
|
+
]),
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
DrawPicker.defaultProps = {
|
|
106
|
+
height: 400,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
export default DrawPicker;
|