@cniot/android-pda-components 0.2.20 → 0.2.21
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/README.md +4 -21
- package/build/assets/index.51a8714a.css +1 -0
- package/build/assets/{index.66cd7994.js → index.b428d9a3.js} +16 -16
- package/build/assets/vendor.999402d8.js +40 -0
- package/build/index.html +3 -3
- package/package.json +1 -1
- package/packages/AppList/doc.jsx +138 -0
- package/packages/AppList/index.jsx +33 -0
- package/packages/AppList/index.less +52 -0
- package/packages/BaseLayout/BarcodeScan.jsx +88 -0
- package/packages/BaseLayout/BaseLayoutContainer.jsx +208 -0
- package/packages/BaseLayout/RfidOnce.jsx +106 -0
- package/packages/BaseLayout/RfidScan.jsx +118 -0
- package/packages/BaseLayout/doc.jsx +177 -0
- package/packages/BaseLayout/index.jsx +52 -0
- package/packages/BaseLayout/index.less +47 -0
- package/packages/Button/doc.jsx +62 -0
- package/packages/Button/index.jsx +27 -0
- package/packages/Button/index.less +62 -0
- package/packages/Confirm/doc.jsx +147 -0
- package/packages/Confirm/index.jsx +71 -0
- package/packages/Confirm/index.less +55 -0
- package/packages/Header/doc.jsx +171 -0
- package/packages/Header/index.jsx +191 -0
- package/packages/Header/index.less +71 -0
- package/packages/InfoCard/doc.jsx +244 -0
- package/packages/InfoCard/index.jsx +67 -0
- package/packages/InfoCard/index.less +111 -0
- package/packages/List/doc.jsx +89 -0
- package/packages/List/index.jsx +54 -0
- package/packages/List/index.less +43 -0
- package/packages/Overlay/doc.jsx +103 -0
- package/packages/Overlay/index.jsx +42 -0
- package/packages/Overlay/index.less +28 -0
- package/packages/PdaActionSheet/doc.jsx +193 -0
- package/packages/PdaActionSheet/index.jsx +44 -0
- package/packages/PdaActionSheet/index.less +65 -0
- package/packages/PdaDistanceCard/doc.jsx +62 -0
- package/packages/PdaDistanceCard/index.jsx +35 -0
- package/packages/PdaDistanceCard/index.less +42 -0
- package/packages/PdaFinishCard/doc.jsx +111 -0
- package/packages/PdaFinishCard/index.jsx +62 -0
- package/packages/PdaFinishCard/index.less +62 -0
- package/packages/PdaInfiniteScroll/doc.jsx +121 -0
- package/packages/PdaInfiniteScroll/index.jsx +114 -0
- package/packages/PdaInfiniteScroll/index.less +12 -0
- package/packages/PdaInfiniteScroll/utils.jsx +25 -0
- package/packages/PdaSteps/PdaStep/index.jsx +38 -0
- package/packages/PdaSteps/PdaStep/index.less +70 -0
- package/packages/PdaSteps/PdaSteps/index.jsx +33 -0
- package/packages/PdaSteps/PdaSteps/index.less +0 -0
- package/packages/PdaSteps/doc.jsx +131 -0
- package/packages/PdaSteps/index.jsx +5 -0
- package/packages/PdaTitle/doc.jsx +102 -0
- package/packages/PdaTitle/index.jsx +51 -0
- package/packages/Presentation/doc.jsx +72 -0
- package/packages/Presentation/index.jsx +25 -0
- package/packages/Presentation/index.less +31 -0
- package/packages/SelectCard/doc.jsx +57 -0
- package/packages/SelectCard/index.jsx +13 -0
- package/packages/SelectCard/index.less +30 -0
- package/packages/SimpleCard/doc.jsx +59 -0
- package/packages/SimpleCard/index.jsx +13 -0
- package/packages/SimpleCard/index.less +38 -0
- package/packages/SimpleCardBlock/doc.jsx +77 -0
- package/packages/SimpleCardBlock/index.jsx +43 -0
- package/packages/SimpleCardBlock/index.less +26 -0
- package/packages/SubCard/doc.jsx +63 -0
- package/packages/SubCard/index.jsx +28 -0
- package/packages/SubCard/index.less +64 -0
- package/packages/Tag/doc.jsx +47 -0
- package/packages/Tag/index.jsx +12 -0
- package/packages/Tag/index.less +22 -0
- package/packages/TaskCard/doc.jsx +151 -0
- package/packages/TaskCard/index.jsx +65 -0
- package/packages/TaskCard/index.less +101 -0
- package/packages/Toast/doc.jsx +112 -0
- package/packages/Toast/index.jsx +7 -0
- package/packages/Toast/index.less +23 -0
- package/packages/Toast/methods.jsx +77 -0
- package/packages/Toast/toast.jsx +96 -0
- package/packages/WakeKeyborard/doc.jsx +170 -0
- package/packages/WakeKeyborard/index.jsx +61 -0
- package/packages/WakeKeyborard/index.less +55 -0
- package/packages/WakeKeyborard/keyborard.jsx +61 -0
- package/packages/doc.jsx +19 -0
- package/packages/global.less +7 -0
- package/packages/index.jsx +60 -0
- package/packages/index.less +3 -0
- package/packages/pageflow-system-pages/alert/doc.jsx +70 -0
- package/packages/pageflow-system-pages/alert/index.jsx +22 -0
- package/packages/pageflow-system-pages/confirm/doc.jsx +118 -0
- package/packages/pageflow-system-pages/confirm/index.jsx +31 -0
- package/packages/pageflow-system-pages/debug/index.jsx +27 -0
- package/packages/pageflow-system-pages/debug/index.less +5 -0
- package/packages/pageflow-system-pages/index.jsx +38 -0
- package/packages/pageflow-system-pages/loading/index.jsx +37 -0
- package/packages/pageflow-system-pages/not-found/index.jsx +12 -0
- package/packages/pageflow-system-pages/not-found/index.less +26 -0
- package/packages/pageflow-system-pages/prompt/doc.jsx +95 -0
- package/packages/pageflow-system-pages/prompt/index.jsx +43 -0
- package/packages/pageflow-system-pages/prompt/index.less +44 -0
- package/packages/pageflow-system-pages/start/index.jsx +28 -0
- package/packages/pageflow-system-pages/start/index.less +12 -0
- package/packages/pageflow-system-pages/toast/doc.jsx +76 -0
- package/packages/pageflow-system-pages/toast/index.jsx +42 -0
- package/packages/utils/index.js +56 -0
- package/packages/variable.less +4 -0
- package/build/assets/index.b8d6d64c.css +0 -1
- package/build/assets/vendor.5080796b.js +0 -40
- package/es/index.cjs.js +0 -7
- package/es/index.es.js +0 -2194
- package/es/style.css +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import List from "./index";
|
|
3
|
+
const dataSource = [{
|
|
4
|
+
title: "hello world",
|
|
5
|
+
subTitle:"sub title",
|
|
6
|
+
extra:"11111",
|
|
7
|
+
tags:[1,2,3,4]
|
|
8
|
+
},{
|
|
9
|
+
title: "hello world",
|
|
10
|
+
subTitle:"sub title",
|
|
11
|
+
extra:"",
|
|
12
|
+
tags:[1,2,3,4]
|
|
13
|
+
},{
|
|
14
|
+
title: "hello world",
|
|
15
|
+
subTitle:"sub title",
|
|
16
|
+
},{
|
|
17
|
+
title: "hello world",
|
|
18
|
+
subTitle:"sub title",
|
|
19
|
+
extra:"11111",
|
|
20
|
+
}];
|
|
21
|
+
|
|
22
|
+
export default function () {
|
|
23
|
+
return (
|
|
24
|
+
<div>
|
|
25
|
+
<h1>List</h1>
|
|
26
|
+
<p>列表组件,通常要配合不同的 List Item 来使用</p>
|
|
27
|
+
<h2>示例</h2>
|
|
28
|
+
<div className="light-block">
|
|
29
|
+
<List
|
|
30
|
+
onClickItem={console.log}
|
|
31
|
+
dataSource={dataSource}
|
|
32
|
+
>
|
|
33
|
+
</List>
|
|
34
|
+
</div>
|
|
35
|
+
<code className="code">{`
|
|
36
|
+
const dataSource = [{
|
|
37
|
+
title: "hello world",
|
|
38
|
+
subTitle:"sub title",
|
|
39
|
+
extra:"11111",
|
|
40
|
+
tags:[1,2,3,4]
|
|
41
|
+
},{
|
|
42
|
+
title: "hello world",
|
|
43
|
+
subTitle:"sub title",
|
|
44
|
+
extra:"",
|
|
45
|
+
tags:[1,2,3,4]
|
|
46
|
+
},{
|
|
47
|
+
title: "hello world",
|
|
48
|
+
subTitle:"sub title",
|
|
49
|
+
},{
|
|
50
|
+
title: "hello world",
|
|
51
|
+
subTitle:"sub title",
|
|
52
|
+
extra:"11111",
|
|
53
|
+
}];
|
|
54
|
+
<List
|
|
55
|
+
onClickItem={console.log}
|
|
56
|
+
tabIndex={0}
|
|
57
|
+
dataSource={dataSource}
|
|
58
|
+
>
|
|
59
|
+
</List>
|
|
60
|
+
`}</code>
|
|
61
|
+
|
|
62
|
+
<h2>List</h2>
|
|
63
|
+
<table className="pure-table pure-table-bordered">
|
|
64
|
+
<thead>
|
|
65
|
+
<tr>
|
|
66
|
+
<th>属性</th>
|
|
67
|
+
<th>说明</th>
|
|
68
|
+
<th>类型</th>
|
|
69
|
+
<th>默认值</th>
|
|
70
|
+
</tr>
|
|
71
|
+
</thead>
|
|
72
|
+
<tbody>
|
|
73
|
+
<tr>
|
|
74
|
+
<td>onClickItem</td>
|
|
75
|
+
<td>Item 点击回调,参数 dataSource[i]</td>
|
|
76
|
+
<td>Function</td>
|
|
77
|
+
<td>-</td>
|
|
78
|
+
</tr>
|
|
79
|
+
<tr>
|
|
80
|
+
<td>dataSource</td>
|
|
81
|
+
<td>{`Array({title, subTitle, extra, tags})`}</td>
|
|
82
|
+
<td>Array</td>
|
|
83
|
+
<td>-</td>
|
|
84
|
+
</tr>
|
|
85
|
+
</tbody>
|
|
86
|
+
</table>
|
|
87
|
+
</div>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
|
|
4
|
+
function empty(){}
|
|
5
|
+
|
|
6
|
+
export default function List(props) {
|
|
7
|
+
// onItemClick 兼容老的方法
|
|
8
|
+
const { dataSource=[], onClickItem, onItemClick=empty} = props;
|
|
9
|
+
return (
|
|
10
|
+
<div className="android-pda-list" >
|
|
11
|
+
{
|
|
12
|
+
dataSource.map((item, index)=>{
|
|
13
|
+
return <DefaultItem key={item.key || index} dataSource={item} onClick={onClickItem || onItemClick} ></DefaultItem>
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
{
|
|
17
|
+
props.children
|
|
18
|
+
}
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
// 默认 item
|
|
25
|
+
function DefaultItem(props){
|
|
26
|
+
// 兼容老的用法,直接用 List.Item
|
|
27
|
+
const dataSource = props.dataSource || {
|
|
28
|
+
title: props.title,
|
|
29
|
+
subTitle: props.subTitle,
|
|
30
|
+
extra: props.extra,
|
|
31
|
+
tags: props.tags
|
|
32
|
+
};
|
|
33
|
+
const { title, subTitle, extra, tags=[], tabIndex} = dataSource;
|
|
34
|
+
const { onClick } = props;
|
|
35
|
+
return <div className="default-item" onClick={()=>{ onClick(props.dataSource) }} tabIndex={tabIndex} >
|
|
36
|
+
<div className="text">
|
|
37
|
+
<div>{title}</div>
|
|
38
|
+
<div className="sub-text">
|
|
39
|
+
{subTitle}
|
|
40
|
+
</div>
|
|
41
|
+
<div className="sub-tags">
|
|
42
|
+
{
|
|
43
|
+
tags.map((text)=>{
|
|
44
|
+
return <div className="sub-tag-item" key={text} >{text}</div>
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<div className="extra">{extra}</div>
|
|
50
|
+
</div>
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//
|
|
54
|
+
List.Item = DefaultItem;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.android-pda-list{
|
|
2
|
+
.default-item{
|
|
3
|
+
background-color:#282828;
|
|
4
|
+
font-size:36px;
|
|
5
|
+
padding:10px 10px;
|
|
6
|
+
border-radius: 6px;
|
|
7
|
+
color:#ffffff;
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
align-items:center;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
margin-bottom:10px;
|
|
13
|
+
&:hover,&:active,&:focus{
|
|
14
|
+
background-color:#686868;
|
|
15
|
+
}
|
|
16
|
+
.text{
|
|
17
|
+
flex:1;
|
|
18
|
+
}
|
|
19
|
+
.sub-text{
|
|
20
|
+
font-size:80%;
|
|
21
|
+
opacity:0.7;
|
|
22
|
+
}
|
|
23
|
+
.sub-tags{
|
|
24
|
+
display: flex;
|
|
25
|
+
.sub-tag-item{
|
|
26
|
+
background-color:#00FF00;
|
|
27
|
+
padding:2px;
|
|
28
|
+
font-size:60%;
|
|
29
|
+
margin-right:3px;
|
|
30
|
+
border-radius:2px;
|
|
31
|
+
color:#000000;
|
|
32
|
+
line-height:1em;
|
|
33
|
+
}
|
|
34
|
+
.sub-tag-item:first-child{
|
|
35
|
+
margin-left:0;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
.extra{
|
|
39
|
+
font-size:80%;
|
|
40
|
+
opacity:0.7;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Overlay from "./index";
|
|
3
|
+
import Toast from '../Toast/index';
|
|
4
|
+
import Confirm from '../Confirm/index';
|
|
5
|
+
// import './doc.less';
|
|
6
|
+
|
|
7
|
+
export default function () {
|
|
8
|
+
return (
|
|
9
|
+
<div>
|
|
10
|
+
<h1>Overlay</h1>
|
|
11
|
+
<p>统一处理模态遮罩样式</p>
|
|
12
|
+
<h2>示例</h2>
|
|
13
|
+
<div className="light-block light-block-overlay" >
|
|
14
|
+
<Overlay verticalPosition="top">
|
|
15
|
+
<Toast
|
|
16
|
+
title="111111"
|
|
17
|
+
message="22222"
|
|
18
|
+
type="success"
|
|
19
|
+
></Toast>
|
|
20
|
+
</Overlay>
|
|
21
|
+
</div>
|
|
22
|
+
<br />
|
|
23
|
+
<div className="light-block light-block-overlay" >
|
|
24
|
+
<Overlay verticalPosition="center" >
|
|
25
|
+
<Toast
|
|
26
|
+
title="111111"
|
|
27
|
+
message="22222"
|
|
28
|
+
type="warning"
|
|
29
|
+
></Toast>
|
|
30
|
+
</Overlay>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<br />
|
|
34
|
+
<div className="light-block light-block-overlay" >
|
|
35
|
+
<Overlay verticalPosition="bottom" closable={true}>
|
|
36
|
+
<Confirm
|
|
37
|
+
title="111111"
|
|
38
|
+
message="22222"
|
|
39
|
+
type="error"
|
|
40
|
+
></Confirm>
|
|
41
|
+
</Overlay>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<code className="code">{`
|
|
45
|
+
<Overlay verticalPosition="top" >
|
|
46
|
+
<Toast
|
|
47
|
+
title="111111"
|
|
48
|
+
message="22222"
|
|
49
|
+
type="success"
|
|
50
|
+
></Toast>
|
|
51
|
+
</Overlay>
|
|
52
|
+
|
|
53
|
+
<Overlay verticalPosition="center" >
|
|
54
|
+
<Toast
|
|
55
|
+
title="111111"
|
|
56
|
+
message="22222"
|
|
57
|
+
type="success"
|
|
58
|
+
></Toast>
|
|
59
|
+
</Overlay>
|
|
60
|
+
|
|
61
|
+
<Overlay verticalPosition="bottom" >
|
|
62
|
+
<Toast
|
|
63
|
+
title="111111"
|
|
64
|
+
message="22222"
|
|
65
|
+
type="success"
|
|
66
|
+
></Toast>
|
|
67
|
+
</Overlay>
|
|
68
|
+
|
|
69
|
+
`}</code>
|
|
70
|
+
<h2>参数</h2>
|
|
71
|
+
<table className="pure-table pure-table-bordered">
|
|
72
|
+
<thead>
|
|
73
|
+
<tr>
|
|
74
|
+
<th>属性</th>
|
|
75
|
+
<th>说明</th>
|
|
76
|
+
<th>类型</th>
|
|
77
|
+
<th>默认值</th>
|
|
78
|
+
</tr>
|
|
79
|
+
</thead>
|
|
80
|
+
<tbody>
|
|
81
|
+
<tr>
|
|
82
|
+
<td>verticalPosition</td>
|
|
83
|
+
<td>垂直方向位置</td>
|
|
84
|
+
<td>string</td>
|
|
85
|
+
<td>top|center|bottom</td>
|
|
86
|
+
</tr>
|
|
87
|
+
<tr>
|
|
88
|
+
<td>closable</td>
|
|
89
|
+
<td>点击空白关闭</td>
|
|
90
|
+
<td>boolean</td>
|
|
91
|
+
<td>false</td>
|
|
92
|
+
</tr>
|
|
93
|
+
<tr>
|
|
94
|
+
<td>visible</td>
|
|
95
|
+
<td>可见</td>
|
|
96
|
+
<td>boolean</td>
|
|
97
|
+
<td>true</td>
|
|
98
|
+
</tr>
|
|
99
|
+
</tbody>
|
|
100
|
+
</table>
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
|
|
4
|
+
function getTypeClass(type){
|
|
5
|
+
return {
|
|
6
|
+
"center" : "op-overlay center",
|
|
7
|
+
"top" : "op-overlay top",
|
|
8
|
+
"bottom" : "op-overlay bottom",
|
|
9
|
+
}[type] || "op-overlay"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function Overlay(props) {
|
|
13
|
+
const {verticalPosition = "center", visible=true, closable = false, onClosed = () => {}} = props;
|
|
14
|
+
const [hidden, setHidden] = useState(!visible);
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
setHidden(!visible);
|
|
18
|
+
// return () => {
|
|
19
|
+
// cleanup
|
|
20
|
+
// }
|
|
21
|
+
}, [visible])
|
|
22
|
+
|
|
23
|
+
const option = {};
|
|
24
|
+
if(closable) {
|
|
25
|
+
option.onClick = e => {
|
|
26
|
+
setHidden(true);
|
|
27
|
+
onClosed();
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setHidden(!visible);
|
|
32
|
+
}, [visible])
|
|
33
|
+
|
|
34
|
+
return !hidden ? (
|
|
35
|
+
<div
|
|
36
|
+
className={getTypeClass(verticalPosition)}
|
|
37
|
+
{...option}
|
|
38
|
+
>
|
|
39
|
+
{props.children}
|
|
40
|
+
</div>
|
|
41
|
+
) : null;
|
|
42
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.op-overlay {
|
|
2
|
+
top: 0;
|
|
3
|
+
left: 0;
|
|
4
|
+
position: fixed;
|
|
5
|
+
right: 0;
|
|
6
|
+
bottom: 0;
|
|
7
|
+
// width: 100vw;
|
|
8
|
+
// height: 100vh;
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
13
|
+
z-index: 100;
|
|
14
|
+
|
|
15
|
+
&.center{
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
}
|
|
19
|
+
&.top{
|
|
20
|
+
align-items: flex-start;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
}
|
|
23
|
+
&.bottom{
|
|
24
|
+
align-items: flex-end;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import ActionSheet from "./index";
|
|
3
|
+
import Button from "../Button"
|
|
4
|
+
export default function () {
|
|
5
|
+
const [visible, setVisible] = useState(false);
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<h1>ActionSheet</h1>
|
|
9
|
+
<p>弹窗组件</p>
|
|
10
|
+
<h2>示例</h2>
|
|
11
|
+
<div className="light-block">
|
|
12
|
+
<div style={{ height: "600px", width: "300px", position: "relative", backgroundColor: "#fff", display: "flex", alignItems: "flex-end", overflow: "hidden" }}>
|
|
13
|
+
<Button type="dark" style={{ margin: '12px' }} onClick={() => { setVisible(!visible) }}>切换模式</Button>
|
|
14
|
+
<ActionSheet
|
|
15
|
+
visible={visible}
|
|
16
|
+
infiniteScroll={{
|
|
17
|
+
hasMore: true,
|
|
18
|
+
loadMore: () => {console.log("loadMore!")}
|
|
19
|
+
}}
|
|
20
|
+
actions={[
|
|
21
|
+
{
|
|
22
|
+
key: "total",
|
|
23
|
+
title: "切换为整箱识别",
|
|
24
|
+
onClick: () => { }
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
key: "seperate",
|
|
28
|
+
title: "切换为散箱识别",
|
|
29
|
+
onClick: () => { }
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: "cancel",
|
|
33
|
+
title: "取消",
|
|
34
|
+
onClick: () => {
|
|
35
|
+
setVisible(false)
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: "total",
|
|
40
|
+
title: "切换为整箱识别",
|
|
41
|
+
onClick: () => { }
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
key: "seperate",
|
|
45
|
+
title: "切换为散箱识别",
|
|
46
|
+
onClick: () => { }
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
key: "cancel",
|
|
50
|
+
title: "取消",
|
|
51
|
+
onClick: () => {
|
|
52
|
+
setVisible(false)
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: "total",
|
|
57
|
+
title: "切换为整箱识别",
|
|
58
|
+
onClick: () => { }
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
key: "seperate",
|
|
62
|
+
title: "切换为散箱识别",
|
|
63
|
+
onClick: () => { }
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: "cancel",
|
|
67
|
+
title: "取消",
|
|
68
|
+
onClick: () => {
|
|
69
|
+
setVisible(false)
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
key: "total",
|
|
74
|
+
title: "切换为整箱识别",
|
|
75
|
+
onClick: () => { }
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
key: "seperate",
|
|
79
|
+
title: "切换为散箱识别",
|
|
80
|
+
onClick: () => { }
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
key: "cancel",
|
|
84
|
+
title: "取消",
|
|
85
|
+
onClick: () => {
|
|
86
|
+
setVisible(false)
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
]}
|
|
90
|
+
stickyToBottomActions={[
|
|
91
|
+
{
|
|
92
|
+
key: "cancel",
|
|
93
|
+
title: "取消",
|
|
94
|
+
onClick: () => {
|
|
95
|
+
setVisible(false)
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
key: "cancel",
|
|
100
|
+
title: "取消",
|
|
101
|
+
onClick: () => {
|
|
102
|
+
setVisible(false)
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
]}
|
|
106
|
+
/>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
<code className="code">{`
|
|
110
|
+
<div style={{height: "600px", width: "300px", position: "relative", backgroundColor: "#fff", display: "flex", alignItems: "flex-end"}}>
|
|
111
|
+
<Button type="dark" style={{margin: '12px'}} onClick={() => {setVisible(!visible)}}>切换模式</Button>
|
|
112
|
+
<ActionSheet
|
|
113
|
+
visible = {visible}
|
|
114
|
+
actions = {[{
|
|
115
|
+
key: "total",
|
|
116
|
+
title: "切换为整箱识别",
|
|
117
|
+
onClick: () => {}
|
|
118
|
+
}, {
|
|
119
|
+
key: "seperate",
|
|
120
|
+
title: "切换为散箱识别",
|
|
121
|
+
onClick: () => {}
|
|
122
|
+
}, {
|
|
123
|
+
key: "cancel",
|
|
124
|
+
title: "取消",
|
|
125
|
+
onClick: () => {
|
|
126
|
+
setVisible(false)
|
|
127
|
+
}
|
|
128
|
+
}]}
|
|
129
|
+
infiniteScroll={{
|
|
130
|
+
hasMore: true,
|
|
131
|
+
loadMore: () => {console.log("loadMore!")}
|
|
132
|
+
}}
|
|
133
|
+
stickyToBottomActions={[
|
|
134
|
+
{
|
|
135
|
+
key: "cancel",
|
|
136
|
+
title: "取消",
|
|
137
|
+
onClick: () => {
|
|
138
|
+
setVisible(false)
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
key: "cancel",
|
|
143
|
+
title: "取消",
|
|
144
|
+
onClick: () => {
|
|
145
|
+
setVisible(false)
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
]}
|
|
149
|
+
/>
|
|
150
|
+
`}</code>
|
|
151
|
+
<h2>参数</h2>
|
|
152
|
+
<table className="pure-table pure-table-bordered">
|
|
153
|
+
<thead>
|
|
154
|
+
<tr>
|
|
155
|
+
<th>属性</th>
|
|
156
|
+
<th>说明</th>
|
|
157
|
+
<th>类型</th>
|
|
158
|
+
<th>默认值</th>
|
|
159
|
+
</tr>
|
|
160
|
+
</thead>
|
|
161
|
+
<tbody>
|
|
162
|
+
<tr>
|
|
163
|
+
<td>visible</td>
|
|
164
|
+
<td>是否显示</td>
|
|
165
|
+
<td>boolean</td>
|
|
166
|
+
<td>false</td>
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
</tr>
|
|
170
|
+
<tr>
|
|
171
|
+
<td>actions</td>
|
|
172
|
+
<td>操作列表</td>
|
|
173
|
+
<td>object[]</td>
|
|
174
|
+
<td></td>
|
|
175
|
+
</tr>
|
|
176
|
+
<tr>
|
|
177
|
+
<td>stickyToBottomActions</td>
|
|
178
|
+
<td>吸底操作列表</td>
|
|
179
|
+
<td>object[]</td>
|
|
180
|
+
<td></td>
|
|
181
|
+
</tr>
|
|
182
|
+
<tr>
|
|
183
|
+
<td>infiniteScroll</td>
|
|
184
|
+
<td>是否下拉加载更多</td>
|
|
185
|
+
<td>{JSON.stringify({})}</td>
|
|
186
|
+
<td><a href="/#InfiniteScroll">参考 InfiniteScroll</a></td>
|
|
187
|
+
</tr>
|
|
188
|
+
|
|
189
|
+
</tbody>
|
|
190
|
+
</table>
|
|
191
|
+
</div>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import InfiniteScroll from "../PdaInfiniteScroll";
|
|
5
|
+
|
|
6
|
+
export default function ActionSheet(props) {
|
|
7
|
+
const { className = "", visible, actions = [], stickyToBottomActions = [], stickyToBottomDirection = 'column', infiniteScroll = null, } = props;
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<div className={classNames({ [className]: true, 'action-sheet': true, 'show': visible })} >
|
|
11
|
+
<div className="action-sheet-container">
|
|
12
|
+
{/* {
|
|
13
|
+
actions.length > 0 ? (
|
|
14
|
+
|
|
15
|
+
) : null
|
|
16
|
+
} */}
|
|
17
|
+
<div className="action-sheet-body">
|
|
18
|
+
{
|
|
19
|
+
actions.map((item, index) => {
|
|
20
|
+
return <div onClick={() => { item.onClick(item.key) }} className="action-sheet-item" key={index}>{item.title}</div>
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
{
|
|
24
|
+
infiniteScroll ? (
|
|
25
|
+
<InfiniteScroll {...infiniteScroll} />
|
|
26
|
+
) : null
|
|
27
|
+
}
|
|
28
|
+
</div>
|
|
29
|
+
{
|
|
30
|
+
stickyToBottomActions.length > 0 ? (
|
|
31
|
+
<div className={classNames({"action-sheet-sticky-bottom": true, ['action-sheet-sticky-bottom-' + stickyToBottomDirection]: true})}>
|
|
32
|
+
{
|
|
33
|
+
stickyToBottomActions.map((item, index) => {
|
|
34
|
+
return <div onClick={() => { item.onClick(item.key) }} className="action-sheet-item" key={index}>{item.title}</div>
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
</div>
|
|
38
|
+
) : null
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
.action-sheet {
|
|
2
|
+
position: absolute;
|
|
3
|
+
z-index: 1000;
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100%;
|
|
6
|
+
background-color: rgba(0, 0, 0, 0.35);
|
|
7
|
+
display: none;
|
|
8
|
+
.action-sheet-container {
|
|
9
|
+
position: absolute;
|
|
10
|
+
background-color: #ffffff;
|
|
11
|
+
z-index: 1010;
|
|
12
|
+
width: 100%;
|
|
13
|
+
bottom: 0;
|
|
14
|
+
left: 0;
|
|
15
|
+
max-height: 80%;
|
|
16
|
+
border-radius: 15px * 0.66 15px * 0.66 0 0;
|
|
17
|
+
padding-bottom: 16px * 0.66;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
|
|
21
|
+
.action-sheet-body {
|
|
22
|
+
flex: 1;
|
|
23
|
+
overflow-y: auto;
|
|
24
|
+
}
|
|
25
|
+
.action-sheet-sticky-bottom {
|
|
26
|
+
border-top: 2px solid #F2F2F2;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.action-sheet-item {
|
|
30
|
+
margin: 16px * 0.66 24px * 0.66 0 24px * 0.66;
|
|
31
|
+
background-color: #f3f4f8;
|
|
32
|
+
height: 54px;
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
font-size: 24px;
|
|
37
|
+
border-radius: 15px * 0.66;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.action-sheet-sticky-bottom-row {
|
|
41
|
+
display: flex;
|
|
42
|
+
&>* {
|
|
43
|
+
// width: ;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.show {
|
|
49
|
+
display: block;
|
|
50
|
+
.action-sheet-container {
|
|
51
|
+
animation: slide-in 0.3s ease-out;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@keyframes slide-in {
|
|
57
|
+
0% {
|
|
58
|
+
transform: translateY(100%);
|
|
59
|
+
opacity: 0;
|
|
60
|
+
}
|
|
61
|
+
100% {
|
|
62
|
+
transform: translateY(0%);
|
|
63
|
+
opacity: 1;
|
|
64
|
+
}
|
|
65
|
+
}
|