@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
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sheinoutmobile/shineoutmobile",
|
|
3
|
+
"version": "1.8.2",
|
|
4
|
+
"main": "lib/index.js",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"config": {
|
|
7
|
+
"lib": "ShineoutMobile"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "npx rct lib",
|
|
11
|
+
"test": "npx rct test",
|
|
12
|
+
"doc": "npx rct doc",
|
|
13
|
+
"doc:dev": "npx rct doc --dev",
|
|
14
|
+
"lint": "npx eslint . --ext js,jsx --fix",
|
|
15
|
+
"postinstall": "rm -rf node_modules/rollup-plugin-babel/node_modules/rollup-pluginutils",
|
|
16
|
+
"preinstall": "node src/index.js"
|
|
17
|
+
},
|
|
18
|
+
"husky": {
|
|
19
|
+
"hooks": {
|
|
20
|
+
"pre-commit": "lint-staged"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"lint-staged": {
|
|
24
|
+
"*.{js,jsx}": "npx eslint . --ext js,jsx"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">= 8.0.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@shein/eslint-config": "latest",
|
|
31
|
+
"@shein/react-component-tool": "^0.2.64",
|
|
32
|
+
"husky": "^1.3.1",
|
|
33
|
+
"lint-staged": "^8.1.3",
|
|
34
|
+
"webpack-dev-server": "^3.1.8"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"prop-types": "*",
|
|
38
|
+
"react": ">=16",
|
|
39
|
+
"react-dom": ">=16"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"classnames": ">=2",
|
|
43
|
+
"lodash-es": "^4.17.15",
|
|
44
|
+
"react-photo-view": "^0.3.7",
|
|
45
|
+
"react-transition-group": "^4.3.0"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React, { PureComponent, Children } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styles from './style.less';
|
|
4
|
+
|
|
5
|
+
import mergeClassName from '../../tools/merge-class-name';
|
|
6
|
+
import Loading from '../loading';
|
|
7
|
+
|
|
8
|
+
class Button extends PureComponent {
|
|
9
|
+
getChildren() {
|
|
10
|
+
const { title, children, loading, loadingText } = this.props;
|
|
11
|
+
// if (!loading) return title || children;
|
|
12
|
+
if (loading) return loadingText;
|
|
13
|
+
|
|
14
|
+
const filtered = Children
|
|
15
|
+
.toArray(children)
|
|
16
|
+
.filter(child => child !== null);
|
|
17
|
+
return title || filtered;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
render() {
|
|
21
|
+
const {
|
|
22
|
+
type, size, plain, href, loading, disabled,
|
|
23
|
+
className, children, htmlType, round,
|
|
24
|
+
...others
|
|
25
|
+
} = this.props;
|
|
26
|
+
|
|
27
|
+
const finallyClassName = mergeClassName([
|
|
28
|
+
styles['sm-button'],
|
|
29
|
+
styles[`sm-button-${type || 'default'}`],
|
|
30
|
+
styles[`sm-button-size-${size || 'default'}`],
|
|
31
|
+
round && styles['sm-button-round'],
|
|
32
|
+
plain && styles['sm-button-plain'],
|
|
33
|
+
disabled && styles['sm-button-disabled'],
|
|
34
|
+
loading && styles['sm-button-loading'],
|
|
35
|
+
className,
|
|
36
|
+
]);
|
|
37
|
+
|
|
38
|
+
if (href) {
|
|
39
|
+
return (
|
|
40
|
+
<a href={href} {...others} className={finallyClassName}>
|
|
41
|
+
{children}
|
|
42
|
+
</a>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const finallyChildren = this.getChildren();
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<button
|
|
50
|
+
// type={htmlType}
|
|
51
|
+
type="button"
|
|
52
|
+
className={finallyClassName}
|
|
53
|
+
disabled={disabled || loading}
|
|
54
|
+
{...others}
|
|
55
|
+
>
|
|
56
|
+
{loading && (<Loading className={styles['sm-button-loading-spinner']} />)}
|
|
57
|
+
{finallyChildren}
|
|
58
|
+
</button>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
Button.propTypes = {
|
|
64
|
+
title: PropTypes.node,
|
|
65
|
+
children: PropTypes.node,
|
|
66
|
+
type: PropTypes.oneOf(['default', 'primary', 'info', 'danger']),
|
|
67
|
+
size: PropTypes.oneOf(['mini', 'small', 'large']),
|
|
68
|
+
plain: PropTypes.bool,
|
|
69
|
+
href: PropTypes.string,
|
|
70
|
+
round: PropTypes.bool,
|
|
71
|
+
className: PropTypes.string,
|
|
72
|
+
loading: PropTypes.bool,
|
|
73
|
+
disabled: PropTypes.bool,
|
|
74
|
+
htmlType: PropTypes.string,
|
|
75
|
+
loadingText: PropTypes.node,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
Button.defaultProps = {
|
|
79
|
+
htmlType: 'button',
|
|
80
|
+
type: 'default',
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export default Button;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
@import "../../styles/var";
|
|
2
|
+
|
|
3
|
+
.sm-button {
|
|
4
|
+
display: inline-block;
|
|
5
|
+
position: relative;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
height: 35px;
|
|
8
|
+
line-height: 35px;
|
|
9
|
+
|
|
10
|
+
font-size: @size-big;
|
|
11
|
+
text-align: center;
|
|
12
|
+
border-radius: @button-border-radius;
|
|
13
|
+
outline:none;
|
|
14
|
+
-webkit-appearance: none;
|
|
15
|
+
-webkit-text-size-adjust: 100%;
|
|
16
|
+
|
|
17
|
+
&::before {
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 50%;
|
|
20
|
+
left: 50%;
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
background-color: @black;
|
|
24
|
+
border-color: @black;
|
|
25
|
+
border-radius: inherit;
|
|
26
|
+
-webkit-transform: translate(-50%, -50%);
|
|
27
|
+
transform: translate(-50%, -50%);
|
|
28
|
+
opacity: 0;
|
|
29
|
+
content: ' ';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:active::before {
|
|
33
|
+
opacity: .1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// type
|
|
37
|
+
&-default {
|
|
38
|
+
color: @text-color;
|
|
39
|
+
background-color: @white;
|
|
40
|
+
border: 1px solid @border-color;
|
|
41
|
+
}
|
|
42
|
+
&-primary {
|
|
43
|
+
color: @white;
|
|
44
|
+
background-color: @blue;
|
|
45
|
+
border: 1px solid @blue;
|
|
46
|
+
}
|
|
47
|
+
&-success {
|
|
48
|
+
color: @white;
|
|
49
|
+
background-color: @green;
|
|
50
|
+
border: 1px solid @green;
|
|
51
|
+
}
|
|
52
|
+
&-danger {
|
|
53
|
+
color: @white;
|
|
54
|
+
background-color: @red;
|
|
55
|
+
border: 1px solid @red;
|
|
56
|
+
}
|
|
57
|
+
&-warning {
|
|
58
|
+
color: @white;
|
|
59
|
+
background-color: @orange;
|
|
60
|
+
border: 1px solid @orange;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// plain
|
|
64
|
+
&-plain {
|
|
65
|
+
background-color: @white;
|
|
66
|
+
&.sm-button-primary{
|
|
67
|
+
color: @blue;
|
|
68
|
+
}
|
|
69
|
+
&.sm-button-success{
|
|
70
|
+
color: @green;
|
|
71
|
+
}
|
|
72
|
+
&.sm-button-danger{
|
|
73
|
+
color: @red;
|
|
74
|
+
}
|
|
75
|
+
&.sm-button-warning{
|
|
76
|
+
color: @orange;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// size
|
|
81
|
+
&-size-default {
|
|
82
|
+
padding: 0 15px;
|
|
83
|
+
font-size: @size-normal;
|
|
84
|
+
}
|
|
85
|
+
&-size-small {
|
|
86
|
+
min-width: 60px;
|
|
87
|
+
height: 30px;
|
|
88
|
+
padding: 0 8px;
|
|
89
|
+
font-size: 12px;
|
|
90
|
+
line-height: 28px;
|
|
91
|
+
}
|
|
92
|
+
&-size-large {
|
|
93
|
+
width: 100%;
|
|
94
|
+
height: 50px;
|
|
95
|
+
line-height: 48px;
|
|
96
|
+
}
|
|
97
|
+
&-size-mini {
|
|
98
|
+
display: inline-block;
|
|
99
|
+
min-width: 50px;
|
|
100
|
+
height: 22px;
|
|
101
|
+
line-height: 20px;
|
|
102
|
+
|
|
103
|
+
font-size: 10px;
|
|
104
|
+
border-radius: @button-mini-border-radius;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// disabled
|
|
108
|
+
&-disabled {
|
|
109
|
+
opacity: @button-disabled-opacity;
|
|
110
|
+
background-color: @button-disabled-background-color;
|
|
111
|
+
color: @text-color-light;
|
|
112
|
+
border: 1px solid @button-disabled-background-color;;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// 圆角button
|
|
116
|
+
&-round {
|
|
117
|
+
border-radius: @button-round-border-radius;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&-loading{
|
|
121
|
+
opacity: @button-loading-opacity;
|
|
122
|
+
|
|
123
|
+
& &-spinner{
|
|
124
|
+
display: inline-block;
|
|
125
|
+
width: auto;
|
|
126
|
+
margin-right: 4px;
|
|
127
|
+
|
|
128
|
+
vertical-align: top;
|
|
129
|
+
color: @white;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styles from './style.less';
|
|
4
|
+
import Icon from '../icons/mrp';
|
|
5
|
+
|
|
6
|
+
const Cell = (args) => {
|
|
7
|
+
const { label, value, onClick, isLink, leftIcon, rightIcon, children } = args;
|
|
8
|
+
|
|
9
|
+
const LeftIcon = React.isValidElement(leftIcon) ? leftIcon :
|
|
10
|
+
leftIcon && <Icon className={styles.leftIcon} name={leftIcon} fontSize={16} />;
|
|
11
|
+
|
|
12
|
+
const Title = (label || leftIcon) && (
|
|
13
|
+
<div
|
|
14
|
+
style={args.titleStyle}
|
|
15
|
+
className={[styles.cellTitle, (children && styles.cellChildrenTittle)].join(' ')}
|
|
16
|
+
>
|
|
17
|
+
<span className={args.required ? styles.redStar : styles.placeholderStar}>*</span>
|
|
18
|
+
{label && <span>{label}</span>}
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const Value = (
|
|
23
|
+
<div
|
|
24
|
+
className={[
|
|
25
|
+
styles.cellValue,
|
|
26
|
+
(!label && styles.cellValueAlone),
|
|
27
|
+
(!React.isValidElement(value) && styles.strValue),
|
|
28
|
+
].join(' ')}
|
|
29
|
+
style={args.valueStyle}
|
|
30
|
+
>
|
|
31
|
+
{ value }
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const RightIcon = (isLink || rightIcon) && (
|
|
36
|
+
<Icon
|
|
37
|
+
className={styles.rightIcon}
|
|
38
|
+
name={rightIcon || 'towardstheright'}
|
|
39
|
+
fontSize={16}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div onClick={onClick} className={styles.cell}>
|
|
45
|
+
<div className={styles.row}>
|
|
46
|
+
{LeftIcon}
|
|
47
|
+
{Title}
|
|
48
|
+
{Value}
|
|
49
|
+
{RightIcon}
|
|
50
|
+
</div>
|
|
51
|
+
{children}
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
Cell.propTypes = {
|
|
57
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
58
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
59
|
+
onClick: PropTypes.func,
|
|
60
|
+
required: PropTypes.bool,
|
|
61
|
+
isLink: PropTypes.bool,
|
|
62
|
+
labelStyle: PropTypes.object,
|
|
63
|
+
titleStyle: PropTypes.object,
|
|
64
|
+
valueStyle: PropTypes.object,
|
|
65
|
+
leftIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
66
|
+
rightIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
Cell.defaultProps = {};
|
|
70
|
+
|
|
71
|
+
export default Cell;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
@import "../../styles/var";
|
|
2
|
+
|
|
3
|
+
.cell{
|
|
4
|
+
position: relative;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
width: 100%;
|
|
9
|
+
padding: 10px 15px;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
color: @text-color;
|
|
12
|
+
font-size: @size-normal;
|
|
13
|
+
line-height: 24px;
|
|
14
|
+
background-color: #fff;
|
|
15
|
+
}
|
|
16
|
+
.row {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
justify-content: flex-start;
|
|
20
|
+
align-items: center;
|
|
21
|
+
}
|
|
22
|
+
.cell:not(:last-child)::after {
|
|
23
|
+
position: absolute;
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
content: ' ';
|
|
26
|
+
pointer-events: none;
|
|
27
|
+
right: 0;
|
|
28
|
+
bottom: 0;
|
|
29
|
+
left: 0;
|
|
30
|
+
border-bottom: 1px solid @border-color;
|
|
31
|
+
transform: scaleY(0.5);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.cellTitle {
|
|
35
|
+
//flex: 1;
|
|
36
|
+
width: 140px;
|
|
37
|
+
}
|
|
38
|
+
.cellChildrenTittle {
|
|
39
|
+
flex: none;
|
|
40
|
+
}
|
|
41
|
+
.cellValue {
|
|
42
|
+
flex: 1;
|
|
43
|
+
position: relative;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
color: @text-color;
|
|
46
|
+
vertical-align: middle;
|
|
47
|
+
word-wrap: break-word;
|
|
48
|
+
min-height: 24px;
|
|
49
|
+
}
|
|
50
|
+
.cellValueAlone {
|
|
51
|
+
color: @text-color;
|
|
52
|
+
text-align: left;
|
|
53
|
+
}
|
|
54
|
+
.strValue {
|
|
55
|
+
padding: 2px 4px;
|
|
56
|
+
}
|
|
57
|
+
.leftIcon, .rightIcon {
|
|
58
|
+
margin-left:5px;
|
|
59
|
+
color: #A5ACB8
|
|
60
|
+
}
|
|
61
|
+
.cellControl {
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
box-sizing: border-box;
|
|
65
|
+
min-width: 0;
|
|
66
|
+
margin: 0;
|
|
67
|
+
padding: 0;
|
|
68
|
+
color: @text-color;
|
|
69
|
+
text-align: left;
|
|
70
|
+
background-color: transparent;
|
|
71
|
+
border: 0;
|
|
72
|
+
resize: none;
|
|
73
|
+
}
|
|
74
|
+
/*必填项的星号*/
|
|
75
|
+
.redStar {
|
|
76
|
+
color: #F06156;
|
|
77
|
+
font-size: 18px;
|
|
78
|
+
vertical-align: middle;
|
|
79
|
+
margin-left: 5px;
|
|
80
|
+
}
|
|
81
|
+
.placeholderStar {
|
|
82
|
+
color: transparent;
|
|
83
|
+
font-size: 18px;
|
|
84
|
+
vertical-align: middle;
|
|
85
|
+
margin-left: 5px;
|
|
86
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styles from './style.less';
|
|
4
|
+
|
|
5
|
+
const CellGroup = (props) => {
|
|
6
|
+
const { title, children } = props;
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<div className={styles.group}>
|
|
10
|
+
{title && <div className={styles.blockTitle}>{title}</div>}
|
|
11
|
+
{children}
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
CellGroup.propTypes = {
|
|
17
|
+
style: PropTypes.object,
|
|
18
|
+
className: PropTypes.string,
|
|
19
|
+
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
CellGroup.defaultProps = {
|
|
23
|
+
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default CellGroup;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@import "../../styles/var";
|
|
2
|
+
|
|
3
|
+
.group {
|
|
4
|
+
background: @white;
|
|
5
|
+
position: relative;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
div > .group:not(:last-child) {
|
|
9
|
+
margin-bottom: 12px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.blockTitle {
|
|
13
|
+
height: 50px;
|
|
14
|
+
display: flex;
|
|
15
|
+
justify-content: flex-start;
|
|
16
|
+
align-items: center;
|
|
17
|
+
padding-left: 15px;
|
|
18
|
+
color: #35383D;
|
|
19
|
+
font-weight: normal;
|
|
20
|
+
font-size: @size-big;
|
|
21
|
+
background: @background-color;
|
|
22
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styles from './style.less';
|
|
4
|
+
import Icon from '../icons/mrp';
|
|
5
|
+
import mergeClassName from "../../tools/merge-class-name";
|
|
6
|
+
|
|
7
|
+
import CheckboxButton from './kind/checkbox-button';
|
|
8
|
+
|
|
9
|
+
const icons = {
|
|
10
|
+
square: ['select_selected', 'select_unselected'],
|
|
11
|
+
round: ['select_selected', 'select_unselected'],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const name = 'sm-checkbox';
|
|
15
|
+
|
|
16
|
+
class Checkbox extends React.Component {
|
|
17
|
+
handleClick = (e) => {
|
|
18
|
+
const { value, onChange } = this.props;
|
|
19
|
+
if(onChange instanceof Function) {
|
|
20
|
+
onChange(!value);
|
|
21
|
+
}
|
|
22
|
+
e.stopPropagation();
|
|
23
|
+
e.nativeEvent && e.nativeEvent.stopImmediatePropagation();
|
|
24
|
+
}
|
|
25
|
+
render() {
|
|
26
|
+
const {
|
|
27
|
+
style,
|
|
28
|
+
className,
|
|
29
|
+
value,
|
|
30
|
+
shape,
|
|
31
|
+
color,
|
|
32
|
+
size,
|
|
33
|
+
disabled,
|
|
34
|
+
label,
|
|
35
|
+
labelPosition,
|
|
36
|
+
labelStyle,
|
|
37
|
+
...otherProps
|
|
38
|
+
} = this.props;
|
|
39
|
+
|
|
40
|
+
const labelComponent = React.isValidElement(label)
|
|
41
|
+
? label : <div style={labelStyle}>{label}</div>;
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div
|
|
45
|
+
style={style}
|
|
46
|
+
className={
|
|
47
|
+
mergeClassName([
|
|
48
|
+
styles[name],
|
|
49
|
+
className,
|
|
50
|
+
])
|
|
51
|
+
}
|
|
52
|
+
{...otherProps}
|
|
53
|
+
onClick={this.handleClick}
|
|
54
|
+
>
|
|
55
|
+
{labelPosition==='left' ? labelComponent : null}
|
|
56
|
+
<Icon
|
|
57
|
+
className={styles[`${name}-icon-${labelPosition}`]}
|
|
58
|
+
name={value ? icons[shape][0] : icons[shape][1]}
|
|
59
|
+
fontSize={size}
|
|
60
|
+
style={value && !disabled ? { color } : {}}
|
|
61
|
+
/>
|
|
62
|
+
{labelPosition==='right' ? labelComponent : null}
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
Checkbox.propTypes = {
|
|
69
|
+
style: PropTypes.object,
|
|
70
|
+
className: PropTypes.string,
|
|
71
|
+
shape: PropTypes.oneOf(['square', 'round']),
|
|
72
|
+
color: PropTypes.string,
|
|
73
|
+
label: PropTypes.string,
|
|
74
|
+
labelPosition: PropTypes.oneOf(['left', 'right']),
|
|
75
|
+
labelStyle: PropTypes.object,
|
|
76
|
+
size: PropTypes.number,
|
|
77
|
+
disabled: PropTypes.bool,
|
|
78
|
+
onChange: PropTypes.func,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
Checkbox.defaultProps = {
|
|
82
|
+
shape: 'square',
|
|
83
|
+
color: '#1989fa',
|
|
84
|
+
labelPosition: 'right',
|
|
85
|
+
size: 24,
|
|
86
|
+
disabled: false,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// 类似button样式的checkbox
|
|
90
|
+
Checkbox.CheckboxButton = CheckboxButton;
|
|
91
|
+
|
|
92
|
+
export default Checkbox;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styles from '../style.less';
|
|
4
|
+
import mergeClassName from "../../../tools/merge-class-name";
|
|
5
|
+
import checkKey from "../../../tools/object-key-check";
|
|
6
|
+
|
|
7
|
+
const name = 'sm-checkbox-button';
|
|
8
|
+
|
|
9
|
+
class Checkbox extends React.Component{
|
|
10
|
+
constructor(props) {
|
|
11
|
+
super(props);
|
|
12
|
+
this.state = { checkedState: false };
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
const { checkedState } = this.state;
|
|
16
|
+
const { children, className, value, onChange, ...other } = this.props;
|
|
17
|
+
|
|
18
|
+
let realChecked = checkKey(this.props, 'value') ? value : checkedState; // 判断value是否从外部传入
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
className={mergeClassName([className, styles[name], realChecked && styles[`${name}-checked`]])}
|
|
24
|
+
{...other}
|
|
25
|
+
onClick={() => typeof onChange === 'function'
|
|
26
|
+
? onChange(!realChecked)
|
|
27
|
+
: this.setState({checkedState: !realChecked})
|
|
28
|
+
}
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
</button>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
Checkbox.propTypes = {
|
|
37
|
+
value: PropTypes.bool,
|
|
38
|
+
onChange: PropTypes.func,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default Checkbox;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@import "../../styles/color";
|
|
2
|
+
@import "../../styles/font";
|
|
3
|
+
@import "../../styles/spacing";
|
|
4
|
+
|
|
5
|
+
.sm-checkbox {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
align-items: center;
|
|
10
|
+
font-size: @size-normal;
|
|
11
|
+
color: #A5ACB8;
|
|
12
|
+
|
|
13
|
+
&-icon-left {
|
|
14
|
+
margin-left: 8px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&-icon-right {
|
|
18
|
+
margin-right: 8px;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.sm-checkbox-button{
|
|
23
|
+
height: 40px;
|
|
24
|
+
|
|
25
|
+
display: inline-block;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
|
|
28
|
+
background: @blue-min;
|
|
29
|
+
color: @text-color;
|
|
30
|
+
|
|
31
|
+
font-size: @size-small;
|
|
32
|
+
text-align: center;
|
|
33
|
+
border-radius: @radius;
|
|
34
|
+
outline:none;
|
|
35
|
+
-webkit-appearance: none;
|
|
36
|
+
-webkit-text-size-adjust: 100%;
|
|
37
|
+
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
text-overflow: ellipsis;
|
|
40
|
+
white-space: nowrap;
|
|
41
|
+
|
|
42
|
+
border: 1px solid @border-color;
|
|
43
|
+
|
|
44
|
+
&-checked{
|
|
45
|
+
background: @blue;
|
|
46
|
+
color: @white;
|
|
47
|
+
border-color: @blue;
|
|
48
|
+
}
|
|
49
|
+
}
|