@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,62 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DistanceCard from "./index";
|
|
3
|
+
export default function () {
|
|
4
|
+
return (
|
|
5
|
+
<div>
|
|
6
|
+
<h1>DistanceCard</h1>
|
|
7
|
+
<p>距离组件</p>
|
|
8
|
+
<h2>示例</h2>
|
|
9
|
+
<div className="light-block" style={{display: 'flex', flexDirection: 'row'}}>
|
|
10
|
+
<DistanceCard
|
|
11
|
+
title="货物在附近.."
|
|
12
|
+
infoText="离目标货距离"
|
|
13
|
+
style={{
|
|
14
|
+
width: '400px'
|
|
15
|
+
}}
|
|
16
|
+
percentage={0.56}
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
<code className="code">{`
|
|
20
|
+
<DistanceCard
|
|
21
|
+
title="货物在附近.."
|
|
22
|
+
infoText="离目标货距离"
|
|
23
|
+
style={{
|
|
24
|
+
width: '400px'
|
|
25
|
+
}}
|
|
26
|
+
percentage={0.56}
|
|
27
|
+
/>
|
|
28
|
+
`}</code>
|
|
29
|
+
<h2>参数</h2>
|
|
30
|
+
<table className="pure-table pure-table-bordered">
|
|
31
|
+
<thead>
|
|
32
|
+
<tr>
|
|
33
|
+
<th>属性</th>
|
|
34
|
+
<th>说明</th>
|
|
35
|
+
<th>类型</th>
|
|
36
|
+
<th>默认值</th>
|
|
37
|
+
</tr>
|
|
38
|
+
</thead>
|
|
39
|
+
<tbody>
|
|
40
|
+
<tr>
|
|
41
|
+
<td>title</td>
|
|
42
|
+
<td>标题</td>
|
|
43
|
+
<td>string</td>
|
|
44
|
+
<td></td>
|
|
45
|
+
</tr>
|
|
46
|
+
<tr>
|
|
47
|
+
<td>infoText</td>
|
|
48
|
+
<td>提示文本</td>
|
|
49
|
+
<td>string</td>
|
|
50
|
+
<td></td>
|
|
51
|
+
</tr>
|
|
52
|
+
<tr>
|
|
53
|
+
<td>percentage</td>
|
|
54
|
+
<td>进度条百分比</td>
|
|
55
|
+
<td>number</td>
|
|
56
|
+
<td></td>
|
|
57
|
+
</tr>
|
|
58
|
+
</tbody>
|
|
59
|
+
</table>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
|
|
5
|
+
export default class PdaDistanceCard extends React.Component {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
render() {
|
|
11
|
+
const { className, title, infoText, percentage = 0, style={} } = this.props;
|
|
12
|
+
const distanceImg= 'https://img.alicdn.com/imgextra/i3/O1CN01EFksWL1DBZCu0H1JH_!!6000000000178-2-tps-21-30.png'
|
|
13
|
+
const indictorImg= 'https://img.alicdn.com/imgextra/i1/O1CN01YEhCSg1aObe8UZq7K_!!6000000003320-2-tps-379-17.png'
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div className={classNames({[className]: true, 'pda-distance-card': true})} style={style}>
|
|
17
|
+
<p className="pda-distance-card-highlight">
|
|
18
|
+
<span className="pda-distance-card-highlight1">{title}</span>
|
|
19
|
+
</p>
|
|
20
|
+
<div className="pda-distance-indictor">
|
|
21
|
+
<img src={distanceImg} width={20} height={29} />
|
|
22
|
+
<p>{infoText}</p>
|
|
23
|
+
</div>
|
|
24
|
+
<div className="pda-distance-card-progress">
|
|
25
|
+
<div className="pda-distance-card-progress-inside" style={{width: `${percentage * 100}%`}}/>
|
|
26
|
+
<img className="pda-distance-card-progress-indictor" src={indictorImg} />
|
|
27
|
+
</div>
|
|
28
|
+
<div className="pda-distance-label">
|
|
29
|
+
<p>远</p>
|
|
30
|
+
<p>近</p>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.pda-distance-card {
|
|
2
|
+
border-radius: 16px;
|
|
3
|
+
padding: 36px 16px;
|
|
4
|
+
background-color: #fff;
|
|
5
|
+
& p {
|
|
6
|
+
margin: 0;
|
|
7
|
+
font-size: 28px;
|
|
8
|
+
color: #738399;
|
|
9
|
+
}
|
|
10
|
+
.pda-distance-card-highlight {
|
|
11
|
+
font-size: 60px;
|
|
12
|
+
line-height: 64px;
|
|
13
|
+
color: #0091EA;
|
|
14
|
+
}
|
|
15
|
+
.pda-distance-indictor {
|
|
16
|
+
margin-top: 36px;
|
|
17
|
+
display: flex;
|
|
18
|
+
}
|
|
19
|
+
.pda-distance-card-progress {
|
|
20
|
+
background-color: #EBECF2;
|
|
21
|
+
height: 34px;
|
|
22
|
+
border-radius: 6px;
|
|
23
|
+
border: 4px solid #D9D9D9;
|
|
24
|
+
margin-top: 8px;
|
|
25
|
+
position: relative;
|
|
26
|
+
|
|
27
|
+
.pda-distance-card-progress-indictor{
|
|
28
|
+
position: absolute;
|
|
29
|
+
bottom: 0;
|
|
30
|
+
left: 5px;
|
|
31
|
+
}
|
|
32
|
+
.pda-distance-card-progress-inside {
|
|
33
|
+
background-color: #0091EA;
|
|
34
|
+
height: 26px;
|
|
35
|
+
border-radius: 6px 0px 0px 6px;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
.pda-distance-label {
|
|
39
|
+
display: flex;
|
|
40
|
+
justify-content: space-between;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import FinishCard from "./index";
|
|
3
|
+
export default function () {
|
|
4
|
+
return (
|
|
5
|
+
<div>
|
|
6
|
+
<h1>FinishCard</h1>
|
|
7
|
+
<p> 完成组件</p>
|
|
8
|
+
<h2>示例</h2>
|
|
9
|
+
<div className="dark-block" style={{display: 'flex', flexDirection: 'row', position: 'relative', width: 480, height: 800}}>
|
|
10
|
+
<FinishCard
|
|
11
|
+
title="更换栈板码完成"
|
|
12
|
+
isError
|
|
13
|
+
infoList={
|
|
14
|
+
[
|
|
15
|
+
{label: '新栈板码:', content: '234982093'},
|
|
16
|
+
{label: '新栈板码:', content: '23498209323498209123'},
|
|
17
|
+
{label: '原栈板码:', content: '234982093'},
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
okText="返回首页"
|
|
21
|
+
onClick={(isConfirm)=>{
|
|
22
|
+
console.log("isConfirm", isConfirm);
|
|
23
|
+
}}
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
<div className="dark-block" style={{display: 'flex', flexDirection: 'row', position: 'relative', width: 480, height: 800}}>
|
|
27
|
+
<FinishCard
|
|
28
|
+
title="更换栈板码完成更换栈板码完成更换栈板码完成"
|
|
29
|
+
infoList={
|
|
30
|
+
[
|
|
31
|
+
{label: '新栈板码:', content: '234982093'},
|
|
32
|
+
{label: '原栈板码:', content: '234982093'},
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
buttonMultiLines
|
|
36
|
+
okText="返回首页"
|
|
37
|
+
cancelText={<span>返回<br />暂存任务</span>}
|
|
38
|
+
onClick={(isConfirm)=>{
|
|
39
|
+
console.log("isConfirm", isConfirm);
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
<code className="code">{`
|
|
44
|
+
<FinishCard
|
|
45
|
+
title="更换栈板码完成"
|
|
46
|
+
infoList={
|
|
47
|
+
[
|
|
48
|
+
{label: '新栈板码:', content: '234982093'},
|
|
49
|
+
{label: '原栈板码:', content: '234982093'},
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
buttonMultiLines
|
|
53
|
+
okText="返回首页"
|
|
54
|
+
cancelText={<span>返回<br />暂存任务</span>}
|
|
55
|
+
onClick={(isConfirm)=>{
|
|
56
|
+
console.log("isConfirm", isConfirm);
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
`}</code>
|
|
60
|
+
<h2>参数</h2>
|
|
61
|
+
<table className="pure-table pure-table-bordered">
|
|
62
|
+
<thead>
|
|
63
|
+
<tr>
|
|
64
|
+
<th>属性</th>
|
|
65
|
+
<th>说明</th>
|
|
66
|
+
<th>类型</th>
|
|
67
|
+
<th>默认值</th>
|
|
68
|
+
</tr>
|
|
69
|
+
</thead>
|
|
70
|
+
<tbody>
|
|
71
|
+
<tr>
|
|
72
|
+
<td>title</td>
|
|
73
|
+
<td>标题</td>
|
|
74
|
+
<td>string</td>
|
|
75
|
+
<td></td>
|
|
76
|
+
</tr>
|
|
77
|
+
<tr>
|
|
78
|
+
<td>isError</td>
|
|
79
|
+
<td>是否异常完成</td>
|
|
80
|
+
<td>Boolean</td>
|
|
81
|
+
<td>false</td>
|
|
82
|
+
</tr>
|
|
83
|
+
<tr>
|
|
84
|
+
<td>infoList</td>
|
|
85
|
+
<td>更多信息</td>
|
|
86
|
+
<td>object[]</td>
|
|
87
|
+
<td></td>
|
|
88
|
+
</tr>
|
|
89
|
+
<tr>
|
|
90
|
+
<td>okText</td>
|
|
91
|
+
<td>确认按钮文本</td>
|
|
92
|
+
<td>string</td>
|
|
93
|
+
<td>返回首页</td>
|
|
94
|
+
</tr>
|
|
95
|
+
<tr>
|
|
96
|
+
<td>buttonMultiLines</td>
|
|
97
|
+
<td>按钮是否多行</td>
|
|
98
|
+
<td>boolean</td>
|
|
99
|
+
<td>false</td>
|
|
100
|
+
</tr>
|
|
101
|
+
<tr>
|
|
102
|
+
<td>onClick</td>
|
|
103
|
+
<td>按钮点击回调</td>
|
|
104
|
+
<td>(isConfirm) => </td>
|
|
105
|
+
<td></td>
|
|
106
|
+
</tr>
|
|
107
|
+
</tbody>
|
|
108
|
+
</table>
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
// import OPInput from "../OPInput";
|
|
3
|
+
import "./index.less";
|
|
4
|
+
import classNames from "classnames";
|
|
5
|
+
import BaseLayout from '../BaseLayout'
|
|
6
|
+
import Button from "../Button";
|
|
7
|
+
import { playSound } from "../utils";
|
|
8
|
+
|
|
9
|
+
export default class PdaFinishCard extends React.Component {
|
|
10
|
+
constructor(props) {
|
|
11
|
+
super(props);
|
|
12
|
+
}
|
|
13
|
+
componentDidMount() {
|
|
14
|
+
if(this.props.isError) {
|
|
15
|
+
playSound('success3');
|
|
16
|
+
} else {
|
|
17
|
+
playSound('success2');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
render() {
|
|
22
|
+
const { className, title, infoList = [], isError=false, buttonMultiLines = false, style={}, onClick=()=>{}, okText="返回首页", cancelText = null } = this.props;
|
|
23
|
+
const footer = (
|
|
24
|
+
<Button.Group>
|
|
25
|
+
{
|
|
26
|
+
cancelText ? <Button style={buttonMultiLines ? {height: "auto", lineHeight: "50px"} : {}} type='dark' onClick={()=> onClick(false)}>{cancelText}</Button> : null
|
|
27
|
+
}
|
|
28
|
+
<Button type="primary" style={buttonMultiLines ? {height: "auto", lineHeight: "normal"} : {}} onClick={()=> onClick(true)}>{okText}</Button>
|
|
29
|
+
</Button.Group>
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<BaseLayout
|
|
34
|
+
footer={footer}
|
|
35
|
+
>
|
|
36
|
+
<div className="pda-finish-card-top">
|
|
37
|
+
<img
|
|
38
|
+
className="pda-finish-card-img"
|
|
39
|
+
// width={isError? 370 : 400}
|
|
40
|
+
// height={269}
|
|
41
|
+
src={isError ? PdaFinishCard.ERROR_SUCCESS : PdaFinishCard.SUCCESS}
|
|
42
|
+
/>
|
|
43
|
+
<p className="pda-finish-card-title">{title}</p>
|
|
44
|
+
{
|
|
45
|
+
infoList.map((item, index) => {
|
|
46
|
+
return (
|
|
47
|
+
<p key={index} className="pda-finish-card-list">
|
|
48
|
+
<span>{item.label || ''}</span>
|
|
49
|
+
<span>{item.content || ''}</span>
|
|
50
|
+
</p>
|
|
51
|
+
)
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
</div>
|
|
55
|
+
</BaseLayout>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// PdaFinishCard.SUCCESS="https://img.alicdn.com/imgextra/i2/O1CN01yYwwSx1uNV0M1gHlQ_!!6000000006025-1-tps-630-436.gif"
|
|
61
|
+
PdaFinishCard.SUCCESS="https://img.alicdn.com/imgextra/i3/O1CN01OL2UYg24792knbTtC_!!6000000007343-1-tps-506-415.gif"
|
|
62
|
+
PdaFinishCard.ERROR_SUCCESS="https://img.alicdn.com/imgextra/i3/O1CN01p5Oc5t1VMFWtBomQc_!!6000000002638-1-tps-600-456.gif"
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// .pda-finish-card {
|
|
2
|
+
// display: flex;
|
|
3
|
+
// flex-direction: column;
|
|
4
|
+
// align-items: center;
|
|
5
|
+
// justify-content: space-between;
|
|
6
|
+
// padding: 24px;
|
|
7
|
+
// background-color: #000;
|
|
8
|
+
// & p {
|
|
9
|
+
// margin: 0;
|
|
10
|
+
// }
|
|
11
|
+
// .pda-finish-card-top{
|
|
12
|
+
// display: flex;
|
|
13
|
+
// flex-direction: column;
|
|
14
|
+
// align-items: center;
|
|
15
|
+
// .pda-finish-card-img {
|
|
16
|
+
// margin-top: 60px;
|
|
17
|
+
// }
|
|
18
|
+
// .pda-finish-card-title {
|
|
19
|
+
// font-size: 32px;
|
|
20
|
+
// color: #fff;
|
|
21
|
+
// font-weight: 500;
|
|
22
|
+
// margin-bottom: 16px;
|
|
23
|
+
// }
|
|
24
|
+
// }
|
|
25
|
+
|
|
26
|
+
// .pda-finish-card-list {
|
|
27
|
+
// margin-top: 16px;
|
|
28
|
+
// color: #FFFFFF80;
|
|
29
|
+
// font-size: 32px;
|
|
30
|
+
// line-height: 32px;
|
|
31
|
+
// }
|
|
32
|
+
// }
|
|
33
|
+
.pda-finish-card-top {
|
|
34
|
+
// height: 100%;
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
align-items: center;
|
|
38
|
+
color: white;
|
|
39
|
+
|
|
40
|
+
.pda-finish-card-img {
|
|
41
|
+
width: 100%;
|
|
42
|
+
// margin-top: 100px;
|
|
43
|
+
margin: 50px auto 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.pda-finish-card-title {
|
|
47
|
+
font-size: 50px;
|
|
48
|
+
line-height: 50px;
|
|
49
|
+
color: #fff;
|
|
50
|
+
font-weight: 500;
|
|
51
|
+
margin-bottom: 16px;
|
|
52
|
+
text-align: center;
|
|
53
|
+
}
|
|
54
|
+
.pda-finish-card-list {
|
|
55
|
+
margin-top: 12px;
|
|
56
|
+
// color: #FFFFFF80;
|
|
57
|
+
color: #999999;
|
|
58
|
+
font-size: 32px;
|
|
59
|
+
line-height: 30px;
|
|
60
|
+
text-align: center;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import InfiniteScroll from "./index";
|
|
3
|
+
import { List } from "..";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const dataSource = [{
|
|
7
|
+
title: "hello world",
|
|
8
|
+
subTitle:"sub title",
|
|
9
|
+
extra:"11111",
|
|
10
|
+
tags:[1,2,3,4]
|
|
11
|
+
},{
|
|
12
|
+
title: "hello world",
|
|
13
|
+
subTitle:"sub title",
|
|
14
|
+
extra:"",
|
|
15
|
+
tags:[1,2,3,4]
|
|
16
|
+
},{
|
|
17
|
+
title: "hello world",
|
|
18
|
+
subTitle:"sub title",
|
|
19
|
+
},{
|
|
20
|
+
title: "hello world",
|
|
21
|
+
subTitle:"sub title",
|
|
22
|
+
extra:"11111",
|
|
23
|
+
}];
|
|
24
|
+
|
|
25
|
+
export default function () {
|
|
26
|
+
return (
|
|
27
|
+
<div>
|
|
28
|
+
<h1>InfiniteScroll</h1>
|
|
29
|
+
<p>滚动加载组件</p>
|
|
30
|
+
<h2>示例</h2>
|
|
31
|
+
<div className="light-block">
|
|
32
|
+
<div style={{
|
|
33
|
+
width: '432px',
|
|
34
|
+
height: '425px',
|
|
35
|
+
overflow: 'scroll'
|
|
36
|
+
}}>
|
|
37
|
+
<List
|
|
38
|
+
onItemClick={console.log}
|
|
39
|
+
tabIndex={0}
|
|
40
|
+
dataSource={dataSource}
|
|
41
|
+
>
|
|
42
|
+
</List>
|
|
43
|
+
<InfiniteScroll
|
|
44
|
+
hasMore={true}
|
|
45
|
+
loadMore={() => {console.log("loadMore!")}}
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<code className="code">{`
|
|
50
|
+
|
|
51
|
+
const dataSource = [{
|
|
52
|
+
title: "hello world",
|
|
53
|
+
subTitle:"sub title",
|
|
54
|
+
extra:"11111",
|
|
55
|
+
tags:[1,2,3,4]
|
|
56
|
+
},{
|
|
57
|
+
title: "hello world",
|
|
58
|
+
subTitle:"sub title",
|
|
59
|
+
extra:"",
|
|
60
|
+
tags:[1,2,3,4]
|
|
61
|
+
},{
|
|
62
|
+
title: "hello world",
|
|
63
|
+
subTitle:"sub title",
|
|
64
|
+
},{
|
|
65
|
+
title: "hello world",
|
|
66
|
+
subTitle:"sub title",
|
|
67
|
+
extra:"11111",
|
|
68
|
+
}];
|
|
69
|
+
|
|
70
|
+
<div style={{
|
|
71
|
+
width: '432px',
|
|
72
|
+
height: '425px',
|
|
73
|
+
overflow: 'scroll'
|
|
74
|
+
}}>
|
|
75
|
+
|
|
76
|
+
<List
|
|
77
|
+
onItemClick={console.log}
|
|
78
|
+
tabIndex={0}
|
|
79
|
+
dataSource={dataSource}
|
|
80
|
+
>
|
|
81
|
+
</List>
|
|
82
|
+
<InfiniteScroll
|
|
83
|
+
hasMore={true}
|
|
84
|
+
loadMore={() => {console.log("loadMore!")}}
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
`}</code>
|
|
88
|
+
<h2>参数</h2>
|
|
89
|
+
<table className="pure-table pure-table-bordered">
|
|
90
|
+
<thead>
|
|
91
|
+
<tr>
|
|
92
|
+
<th>属性</th>
|
|
93
|
+
<th>说明</th>
|
|
94
|
+
<th>类型</th>
|
|
95
|
+
<th>默认值</th>
|
|
96
|
+
</tr>
|
|
97
|
+
</thead>
|
|
98
|
+
<tbody>
|
|
99
|
+
<tr>
|
|
100
|
+
<td>hasMore</td>
|
|
101
|
+
<td>是否还有更多</td>
|
|
102
|
+
<td>boolean</td>
|
|
103
|
+
<td>false</td>
|
|
104
|
+
</tr>
|
|
105
|
+
<tr>
|
|
106
|
+
<td>loadMore</td>
|
|
107
|
+
<td>更多加载方法,当 hasMore 是 true 且拉到底部时会调用该方法</td>
|
|
108
|
+
<td>()=></td>
|
|
109
|
+
<td></td>
|
|
110
|
+
</tr>
|
|
111
|
+
<tr>
|
|
112
|
+
<td>threshold</td>
|
|
113
|
+
<td>阈值,底部距离页面多少的时候调用 loadMore 方法</td>
|
|
114
|
+
<td>number</td>
|
|
115
|
+
<td>0</td>
|
|
116
|
+
</tr>
|
|
117
|
+
</tbody>
|
|
118
|
+
</table>
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import React, {useEffect, useRef} from "react";
|
|
2
|
+
// import OPInput from "../OPInput";
|
|
3
|
+
import "./index.less";
|
|
4
|
+
import classNames from "classnames";
|
|
5
|
+
import usePersistFn from 'ahooks/es/usePersistFn';
|
|
6
|
+
import useLockFn from 'ahooks/es/useLockFn';
|
|
7
|
+
import { getScrollParent } from './utils'
|
|
8
|
+
|
|
9
|
+
function Loading (props) {
|
|
10
|
+
return <div
|
|
11
|
+
style={{
|
|
12
|
+
color: props.color || '#999'
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
15
|
+
<svg
|
|
16
|
+
height='1em'
|
|
17
|
+
viewBox='0 0 100 40'
|
|
18
|
+
style={{ verticalAlign: '-0.125em' }}
|
|
19
|
+
>
|
|
20
|
+
<g stroke='none' strokeWidth='1' fill='none' fillRule='evenodd'>
|
|
21
|
+
<g transform='translate(-100.000000, -71.000000)'>
|
|
22
|
+
<g transform='translate(95.000000, 71.000000)'>
|
|
23
|
+
<g transform='translate(5.000000, 0.000000)'>
|
|
24
|
+
{[0, 1, 2].map(i => (
|
|
25
|
+
<rect
|
|
26
|
+
key={i}
|
|
27
|
+
fill='currentColor'
|
|
28
|
+
x={20 + i * 26}
|
|
29
|
+
y='16'
|
|
30
|
+
width='8'
|
|
31
|
+
height='8'
|
|
32
|
+
rx='2'
|
|
33
|
+
>
|
|
34
|
+
<animate
|
|
35
|
+
attributeName='y'
|
|
36
|
+
from='16'
|
|
37
|
+
to='16'
|
|
38
|
+
dur='2s'
|
|
39
|
+
begin={`${i * 0.2}s`}
|
|
40
|
+
repeatCount='indefinite'
|
|
41
|
+
values='16; 6; 26; 16; 16'
|
|
42
|
+
keyTimes='0; 0.1; 0.3; 0.4; 1'
|
|
43
|
+
id='circ-anim'
|
|
44
|
+
/>
|
|
45
|
+
</rect>
|
|
46
|
+
))}
|
|
47
|
+
</g>
|
|
48
|
+
</g>
|
|
49
|
+
</g>
|
|
50
|
+
</g>
|
|
51
|
+
</svg>
|
|
52
|
+
</div>
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function isWindow(element) {
|
|
56
|
+
return element === window;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default function InfiniteScroll (props) {
|
|
60
|
+
const { className, hasMore, loadMore, threshold = 0, style } = props;
|
|
61
|
+
const doLoadMore = useLockFn(async () => {
|
|
62
|
+
await loadMore();
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
const elementRef = useRef(null);
|
|
66
|
+
|
|
67
|
+
const check = usePersistFn(() => {
|
|
68
|
+
if (!hasMore) return;
|
|
69
|
+
const element = elementRef.current;
|
|
70
|
+
if (!element) return;
|
|
71
|
+
const parent = getScrollParent(element);
|
|
72
|
+
if (!parent) return;
|
|
73
|
+
const elementTop = element.getBoundingClientRect().top;
|
|
74
|
+
const current = isWindow(parent) ? window.innerHeight : parent.getBoundingClientRect().bottom;
|
|
75
|
+
if (current >= elementTop - threshold) {
|
|
76
|
+
doLoadMore();
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
// 确保在内容不足时会自动触发加载事件
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
check();
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
const element = elementRef.current;
|
|
87
|
+
if (!element) return;
|
|
88
|
+
const parent = getScrollParent(element);
|
|
89
|
+
if (!parent) return;
|
|
90
|
+
function onScroll() {
|
|
91
|
+
check();
|
|
92
|
+
}
|
|
93
|
+
parent.addEventListener('scroll', onScroll);
|
|
94
|
+
return () => {
|
|
95
|
+
parent.removeEventListener('scroll', onScroll)
|
|
96
|
+
}
|
|
97
|
+
}, [])
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<div className={classNames({[className]: true, "pda-infinite-scroll": true})} style={style} ref={elementRef}>
|
|
101
|
+
{hasMore ? (
|
|
102
|
+
<div className="pda-infinite-scroll-view">
|
|
103
|
+
<span>加载中</span>
|
|
104
|
+
<Loading />
|
|
105
|
+
</div>
|
|
106
|
+
) : (
|
|
107
|
+
<div className="pda-infinite-scroll-view">
|
|
108
|
+
<span>没有更多了~</span>
|
|
109
|
+
</div>
|
|
110
|
+
)}
|
|
111
|
+
</div>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
const overflowScrollReg = /scroll|auto/i;
|
|
3
|
+
|
|
4
|
+
function isElement(node) {
|
|
5
|
+
const ELEMENT_NODE_TYPE = 1;
|
|
6
|
+
return (
|
|
7
|
+
node.tagName !== 'HTML' &&
|
|
8
|
+
node.tagName !== 'BODY' &&
|
|
9
|
+
node.nodeType === ELEMENT_NODE_TYPE
|
|
10
|
+
)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function getScrollParent(el, root) {
|
|
14
|
+
let node = el;
|
|
15
|
+
|
|
16
|
+
while (node && node !== root && isElement(node)) {
|
|
17
|
+
const { overflowY } = window.getComputedStyle(node);
|
|
18
|
+
if (overflowScrollReg.test(overflowY)) {
|
|
19
|
+
return node;
|
|
20
|
+
}
|
|
21
|
+
node = node.parentNode;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return root;
|
|
25
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
// import OPInput from "../OPInput";
|
|
3
|
+
import "./index.less";
|
|
4
|
+
import classNames from "classnames";
|
|
5
|
+
|
|
6
|
+
export default class PdaInfoCard extends React.Component {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
render() {
|
|
12
|
+
const { className, title, isActive, infoList = [], style={}, index, isLast } = this.props;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className={classNames({[className]: true, "pda-step-card": true})} style={style}>
|
|
16
|
+
<div className="pda-step-indictor">
|
|
17
|
+
<div className={classNames({"pda-step-indictor-top": true, "pda-step-indictor-top-hidden": index === 0})}></div>
|
|
18
|
+
<div className={classNames({"pda-step-indictor-center": true, "pda-step-indictor-center-active": isActive})}></div>
|
|
19
|
+
<div className={classNames({"pda-step-indictor-bottom": true, "pda-step-indictor-bottom-hidden": isLast})}></div>
|
|
20
|
+
</div>
|
|
21
|
+
<div className={classNames({ 'pda-step': true, 'pda-step-dark': !isActive})}>
|
|
22
|
+
<div className="pda-step-title">{title}</div>
|
|
23
|
+
{
|
|
24
|
+
infoList.map((item, index) => {
|
|
25
|
+
return (
|
|
26
|
+
<div key={index} className="pda-step-list">
|
|
27
|
+
<span>{item.label || ''}</span>
|
|
28
|
+
|
|
29
|
+
<span>{item.content || ''}</span>
|
|
30
|
+
</div>
|
|
31
|
+
)
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
}
|