@cniot/android-pda-components 0.2.30 → 0.2.32

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.
Files changed (112) hide show
  1. package/build/assets/index.51a8714a.css +1 -0
  2. package/build/assets/{index.96f23a3d.js → index.7a87ca33.js} +16 -16
  3. package/build/index.html +2 -2
  4. package/doc/index.jsx +3 -2
  5. package/es/index.cjs.js +1 -1
  6. package/es/index.es.js +11 -5
  7. package/es/style.css +1 -1
  8. package/package.json +1 -1
  9. package/build/assets/index.248cb4f2.css +0 -1
  10. package/packages/AppList/doc.jsx +0 -138
  11. package/packages/AppList/index.jsx +0 -33
  12. package/packages/AppList/index.less +0 -52
  13. package/packages/BaseLayout/BarcodeScan.jsx +0 -88
  14. package/packages/BaseLayout/BaseLayoutContainer.jsx +0 -208
  15. package/packages/BaseLayout/RfidOnce.jsx +0 -106
  16. package/packages/BaseLayout/RfidScan.jsx +0 -118
  17. package/packages/BaseLayout/doc.jsx +0 -177
  18. package/packages/BaseLayout/index.jsx +0 -52
  19. package/packages/BaseLayout/index.less +0 -47
  20. package/packages/Button/doc.jsx +0 -62
  21. package/packages/Button/index.jsx +0 -27
  22. package/packages/Button/index.less +0 -62
  23. package/packages/Confirm/doc.jsx +0 -147
  24. package/packages/Confirm/index.jsx +0 -71
  25. package/packages/Confirm/index.less +0 -55
  26. package/packages/Header/doc.jsx +0 -155
  27. package/packages/Header/index.jsx +0 -184
  28. package/packages/Header/index.less +0 -68
  29. package/packages/InfoCard/doc.jsx +0 -244
  30. package/packages/InfoCard/index.jsx +0 -67
  31. package/packages/InfoCard/index.less +0 -111
  32. package/packages/List/doc.jsx +0 -89
  33. package/packages/List/index.jsx +0 -54
  34. package/packages/List/index.less +0 -43
  35. package/packages/Overlay/doc.jsx +0 -103
  36. package/packages/Overlay/index.jsx +0 -42
  37. package/packages/Overlay/index.less +0 -28
  38. package/packages/PdaActionSheet/doc.jsx +0 -193
  39. package/packages/PdaActionSheet/index.jsx +0 -44
  40. package/packages/PdaActionSheet/index.less +0 -65
  41. package/packages/PdaDistanceCard/doc.jsx +0 -62
  42. package/packages/PdaDistanceCard/index.jsx +0 -35
  43. package/packages/PdaDistanceCard/index.less +0 -42
  44. package/packages/PdaFinishCard/doc.jsx +0 -111
  45. package/packages/PdaFinishCard/index.jsx +0 -62
  46. package/packages/PdaFinishCard/index.less +0 -62
  47. package/packages/PdaInfiniteScroll/doc.jsx +0 -121
  48. package/packages/PdaInfiniteScroll/index.jsx +0 -114
  49. package/packages/PdaInfiniteScroll/index.less +0 -12
  50. package/packages/PdaInfiniteScroll/utils.jsx +0 -25
  51. package/packages/PdaSteps/PdaStep/index.jsx +0 -38
  52. package/packages/PdaSteps/PdaStep/index.less +0 -70
  53. package/packages/PdaSteps/PdaSteps/index.jsx +0 -33
  54. package/packages/PdaSteps/PdaSteps/index.less +0 -0
  55. package/packages/PdaSteps/doc.jsx +0 -131
  56. package/packages/PdaSteps/index.jsx +0 -5
  57. package/packages/PdaTitle/doc.jsx +0 -102
  58. package/packages/PdaTitle/index.jsx +0 -51
  59. package/packages/PdaTitle/index.less +0 -65
  60. package/packages/Presentation/doc.jsx +0 -72
  61. package/packages/Presentation/index.jsx +0 -25
  62. package/packages/Presentation/index.less +0 -31
  63. package/packages/SelectCard/doc.jsx +0 -57
  64. package/packages/SelectCard/index.jsx +0 -13
  65. package/packages/SelectCard/index.less +0 -30
  66. package/packages/SimpleCard/doc.jsx +0 -59
  67. package/packages/SimpleCard/index.jsx +0 -13
  68. package/packages/SimpleCard/index.less +0 -38
  69. package/packages/SimpleCardBlock/doc.jsx +0 -77
  70. package/packages/SimpleCardBlock/index.jsx +0 -43
  71. package/packages/SimpleCardBlock/index.less +0 -26
  72. package/packages/SubCard/doc.jsx +0 -63
  73. package/packages/SubCard/index.jsx +0 -28
  74. package/packages/SubCard/index.less +0 -64
  75. package/packages/Tag/doc.jsx +0 -47
  76. package/packages/Tag/index.jsx +0 -12
  77. package/packages/Tag/index.less +0 -22
  78. package/packages/TaskCard/doc.jsx +0 -151
  79. package/packages/TaskCard/index.jsx +0 -65
  80. package/packages/TaskCard/index.less +0 -101
  81. package/packages/Toast/doc.jsx +0 -112
  82. package/packages/Toast/index.jsx +0 -7
  83. package/packages/Toast/index.less +0 -23
  84. package/packages/Toast/methods.jsx +0 -77
  85. package/packages/Toast/toast.jsx +0 -96
  86. package/packages/WakeKeyborard/doc.jsx +0 -170
  87. package/packages/WakeKeyborard/index.jsx +0 -61
  88. package/packages/WakeKeyborard/index.less +0 -55
  89. package/packages/WakeKeyborard/keyborard.jsx +0 -61
  90. package/packages/doc.jsx +0 -19
  91. package/packages/global.less +0 -7
  92. package/packages/index.jsx +0 -60
  93. package/packages/index.less +0 -3
  94. package/packages/pageflow-system-pages/alert/doc.jsx +0 -70
  95. package/packages/pageflow-system-pages/alert/index.jsx +0 -22
  96. package/packages/pageflow-system-pages/confirm/doc.jsx +0 -118
  97. package/packages/pageflow-system-pages/confirm/index.jsx +0 -31
  98. package/packages/pageflow-system-pages/debug/index.jsx +0 -27
  99. package/packages/pageflow-system-pages/debug/index.less +0 -5
  100. package/packages/pageflow-system-pages/index.jsx +0 -38
  101. package/packages/pageflow-system-pages/loading/index.jsx +0 -37
  102. package/packages/pageflow-system-pages/not-found/index.jsx +0 -12
  103. package/packages/pageflow-system-pages/not-found/index.less +0 -26
  104. package/packages/pageflow-system-pages/prompt/doc.jsx +0 -95
  105. package/packages/pageflow-system-pages/prompt/index.jsx +0 -43
  106. package/packages/pageflow-system-pages/prompt/index.less +0 -44
  107. package/packages/pageflow-system-pages/start/index.jsx +0 -28
  108. package/packages/pageflow-system-pages/start/index.less +0 -12
  109. package/packages/pageflow-system-pages/toast/doc.jsx +0 -76
  110. package/packages/pageflow-system-pages/toast/index.jsx +0 -42
  111. package/packages/utils/index.js +0 -56
  112. package/packages/variable.less +0 -4
@@ -1,22 +0,0 @@
1
- import React from "react";
2
- import Confirm from '../../Confirm';
3
- import Overlay from "../../Overlay";
4
- // import "./index.less";
5
-
6
- export default function Alert(props) {
7
- const { service, data = {} } = props;
8
- // const { title = "title", message = "message", okText = "okText", cancelText="" } = data;
9
- const onClickCallback = React.useCallback(
10
- function () {
11
- service.onNext(true);
12
- },
13
- [service]
14
- );
15
-
16
- return (
17
- <Overlay verticalPosition="bottom">
18
- {/* <Confirm title={title} message={message} okText={okText} cancelText={cancelText} onClick={onClickCallback} ></Confirm> */}
19
- <Confirm {...data} onClick={onClickCallback} ></Confirm>
20
- </Overlay>
21
- );
22
- }
@@ -1,118 +0,0 @@
1
- import React from "react";
2
- import SystemConfirm from "./index";
3
-
4
- import service from '../../../mock/service';
5
- export default function () {
6
- return (
7
- <div>
8
- <h1>/system/confirm</h1>
9
- <p>弹出一个确认框,用户必须点击确认才能继续</p>
10
- <h2>示例</h2>
11
- <code className="code">
12
- {
13
- `
14
- // gs 代码如下
15
- pageFlow.confirm({
16
- title: '111',
17
- message: '2222',
18
- okText: "确认",
19
- cancelText:"取消"
20
- })
21
- // 如果 message 需要多行显示,使用 subMessage 方式
22
- pageFlow.confirm({
23
- title: '111',
24
- subMessage: [
25
- {label: 'title1', content: 'content1'},
26
- {label: 'title2', content: 'content2'},
27
- {label: 'title3', content: 'content3'},
28
- ],
29
- okText: "确认",
30
- cancelText:"取消"
31
- })
32
- `
33
- }
34
- </code>
35
- <h2>页面效果</h2>
36
- <div className="light-block light-block-overlay">
37
- <SystemConfirm service={service} data={{
38
- title: '111',
39
- message: <span>栈板码:<span style={{color: '#0091EA'}}>111</span><br/><span>箱码:222</span></span>,
40
- okText: "确认",
41
- cancelText:"取消"
42
- }} ></SystemConfirm>
43
- </div>
44
- <h2>Confirm</h2>
45
- <table className="pure-table pure-table-bordered">
46
- <thead>
47
- <tr>
48
- <th>属性</th>
49
- <th>说明</th>
50
- <th>类型</th>
51
- <th>默认值</th>
52
- </tr>
53
- </thead>
54
- <tbody>
55
- <tr>
56
- <td>title</td>
57
- <td>标题</td>
58
- <td>string</td>
59
- <td></td>
60
- </tr>
61
- <tr>
62
- <td>message</td>
63
- <td>信息</td>
64
- <td>string</td>
65
- <td></td>
66
- </tr>
67
- <tr>
68
- <td>subMessage</td>
69
- <td>副文本消息</td>
70
- <td>string</td>
71
- <td></td>
72
- </tr>
73
- <tr>
74
- <td>okText</td>
75
- <td>确认文本</td>
76
- <td>string</td>
77
- <td></td>
78
- </tr>
79
- <tr>
80
- <td>cancelText</td>
81
- <td>取消文本</td>
82
- <td>string</td>
83
- <td></td>
84
- </tr>
85
- <tr>
86
- <td>okDataClick</td>
87
- <td>ok 按钮 arms 监控</td>
88
- <td>string</td>
89
- <td></td>
90
- </tr>
91
- <tr>
92
- <td>cancelDataClick</td>
93
- <td>cancel 按钮 arms 监控</td>
94
- <td>string</td>
95
- <td></td>
96
- </tr>
97
- <tr>
98
- <td>insertButtons</td>
99
- <td>插入在默认按钮上面</td>
100
- <td>{JSON.stringify([
101
- { label: '查看详情111', value: 'hello', dataClick: '查看详情1234' }
102
- ])}</td>
103
- <td></td>
104
- </tr>
105
- <tr>
106
- <td>appendButtons</td>
107
- <td>追加到默认按钮下面</td>
108
- <td>{JSON.stringify([
109
- { label: '查看详情222', value: 'hello', dataClick: '查看详情1234' }
110
- ])}</td>
111
- <td></td>
112
- </tr>
113
- </tbody>
114
- </table>
115
-
116
- </div>
117
- );
118
- }
@@ -1,31 +0,0 @@
1
- import React from "react";
2
- import Confirm from '../../Confirm';
3
- import Overlay from "../../Overlay";
4
- // import "./index.less";
5
-
6
- export default function confirm(props) {
7
- const { service, data = {} } = props;
8
- // const { title = "title", message, subMessage=[], okText = "okText", cancelText="" } = data;
9
- // const { title = "title", message, subMessage=[], okText = "okText", cancelText="" } = data;
10
- const onClickCallback = React.useCallback(
11
- function (v) {
12
- service.onNext(v);
13
- },
14
- [service]
15
- );
16
-
17
- return (
18
- <Overlay verticalPosition="bottom">
19
- {/* <Confirm
20
- title={title}
21
- message={message}
22
- subMessage={subMessage}
23
- okText={okText}
24
- cancelText={cancelText}
25
- onClick={onClickCallback}
26
- >
27
- </Confirm> */}
28
- <Confirm {...data} onClick={onClickCallback}></Confirm>
29
- </Overlay>
30
- );
31
- }
@@ -1,27 +0,0 @@
1
- import React from "react";
2
- import { createHashHistory } from "history";
3
- import "./index.less";
4
- // debug
5
- export default function Debug(props) {
6
- const { appManager } = props;
7
- const pages = Array.from(appManager.pageManager.keys()).reverse();
8
- React.useEffect(function () {
9
- const history = createHashHistory();
10
- const unListen = history.listen(({ action, location }) => {
11
- const pathname = location.pathname;
12
- appManager.mockToPage(pathname, {});
13
- });
14
- return unListen;
15
- }, []);
16
- return (
17
- <div className="local-debug-side">
18
- <ul>
19
- {pages.map((pathname) => (
20
- <li key={pathname}>
21
- <a href={`#${pathname}`}>{pathname}</a>
22
- </li>
23
- ))}
24
- </ul>
25
- </div>
26
- );
27
- }
@@ -1,5 +0,0 @@
1
- .local-debug-side {
2
- position: absolute;
3
- right: 0;
4
- bottom: 0;
5
- }
@@ -1,38 +0,0 @@
1
- import Alert from "./alert";
2
- import Start from "./start";
3
- import Confirm from "./confirm";
4
- import Prompt from "./prompt";
5
- import Toast from "./toast";
6
- import NotFound from "./not-found";
7
- import Debug from "./debug";
8
- import Loading from "./loading";
9
-
10
- function PlaySound({ data, service, action }) {
11
- const { sound } = data;
12
- if(window.WindVane) {
13
- var params = {
14
- domain: 'audio',
15
- method: 'playSound',
16
- params: { sound, }
17
- }
18
- WindVane.call(
19
- 'WindvanePlugin',
20
- 'invoke',
21
- JSON.stringify(params),
22
- );
23
- }
24
- service.onNext({});
25
- return null
26
- }
27
-
28
- export default {
29
- Alert,
30
- Start,
31
- Toast,
32
- Confirm,
33
- NotFound,
34
- Debug,
35
- Prompt,
36
- Loading,
37
- PlaySound,
38
- };
@@ -1,37 +0,0 @@
1
- import React from "react";
2
- // import "./index.less";
3
-
4
- export default function Loading(props) {
5
- const [showLoading, setShowLoading] = React.useState(false);
6
- const edgeService = props.edgeService;
7
- React.useEffect(
8
- function () {
9
- let currentLoading = false;
10
- const throttleSetShowLoading = function(loading){
11
- currentLoading = loading;
12
- if(loading){
13
- setTimeout(function(){
14
- if(currentLoading === loading){
15
- setShowLoading(true)
16
- }
17
- }, 350)
18
- }else{
19
- setTimeout(function(){
20
- if(currentLoading === loading){
21
- setShowLoading(false)
22
- }
23
- }, 100)
24
- }
25
- }
26
- edgeService.on("IO_STATUS", throttleSetShowLoading);
27
- return function () {
28
- edgeService.off("IO_STATUS", throttleSetShowLoading);
29
- }
30
- },
31
- [edgeService]
32
- );
33
-
34
- return showLoading ? (
35
- <div style={{position:"absolute",left:0,top:0, zIndex: 100}} >LOADING...</div>
36
- ) : null;
37
- }
@@ -1,12 +0,0 @@
1
- import React from "react";
2
- import "./index.less";
3
- export default function NotFound(props) {
4
- return (
5
- <div style={{ padding: "20%" }}>
6
- <h1>
7
- 404 <small style={{ fontSize: "60%" }}>Not found</small>
8
- </h1>
9
- <div>{props.action.getPage()}</div>
10
- </div>
11
- );
12
- }
@@ -1,26 +0,0 @@
1
- .mini-app-start-page {
2
- display: flex;
3
- flex-direction: column;
4
- justify-content: center;
5
- align-items: center;
6
- width: 100vw;
7
- height: 100vh;
8
- button {
9
- padding: 0.3em 3em;
10
- // height: 3em;
11
- border-radius: 6px;
12
- border: none;
13
- font-size: 36px;
14
- background-color: #00bdff;
15
- color: #ffffff;
16
- margin-top: 20px;
17
-
18
- &:active {
19
- transform: scale(0.95);
20
- }
21
- }
22
-
23
- .desc {
24
- opacity: 0.3;
25
- }
26
- }
@@ -1,95 +0,0 @@
1
- import React from "react";
2
- import SystemPrompt from "./index";
3
- import service from '../../../mock/service';
4
-
5
- export default function () {
6
- const [display, setDisplay] = React.useState(false);
7
- return (
8
- <div>
9
- <h1>/system/prompt</h1>
10
- <p>弹出输入框,用户输入内容然后提交,取消按钮输入返回 'back' 字符串</p>
11
- <h2>示例</h2>
12
- <code className="code">
13
- {
14
- `
15
- // gs 代码如下
16
- pageFlow.prompt({
17
- defaultValue:"111", //默认值
18
- placeholder:"请输入..." //输入占位符
19
- type:"text",//控制弹出键盘的类型,可选值 number|text|tel 参考:https://www.w3school.com.cn/tags/att_input_type.asp
20
- okText:"确认", //确认按钮文案
21
- cancelText:"取消" //取消文案 没有取消文案将不能取消输入
22
- })
23
- `
24
- }
25
- </code>
26
- <h2>页面效果</h2>
27
- <div className="light-block">
28
- <button onClick={()=> setDisplay(true)}>点击显示</button>
29
- {
30
- display ? <SystemPrompt
31
- service={service}
32
- data={{
33
- defaultValue:"111", //默认值
34
- placeholder:"请输入...", //输入占位符
35
- type:"text",//控制弹出键盘的类型,可选值 number|text|tel 参考:https://www.w3school.com.cn/tags/att_input_type.asp
36
- okText:"确认", //确认按钮文案
37
- cancelText:"取消" //取消文案 没有取消文案将不能取消输入
38
- }}
39
- onNext={(value)=> {console.log(value); setDisplay(false);}}
40
- ></SystemPrompt> : null
41
- }
42
-
43
- </div>
44
- <h2>/system/prompt</h2>
45
- <table className="pure-table pure-table-bordered">
46
- <thead>
47
- <tr>
48
- <th>属性</th>
49
- <th>说明</th>
50
- <th>类型</th>
51
- <th>默认值</th>
52
- </tr>
53
- </thead>
54
- <tbody>
55
- <tr>
56
- <td>title</td>
57
- <td>标题</td>
58
- <td>string</td>
59
- <td>请输入</td>
60
- </tr>
61
- <tr>
62
- <td>defaultValue</td>
63
- <td>默认值</td>
64
- <td>string</td>
65
- <td>-</td>
66
- </tr>
67
- <tr>
68
- <td>placeholder</td>
69
- <td>input 占位符</td>
70
- <td>string</td>
71
- <td>请输入...</td>
72
- </tr>
73
- <tr>
74
- <td>type</td>
75
- <td>定制键盘类型 参考:https://www.w3school.com.cn/tags/att_input_type.asp</td>
76
- <td>string</td>
77
- <td>text</td>
78
- </tr>
79
- <tr>
80
- <td>okText</td>
81
- <td>确认文案</td>
82
- <td>string</td>
83
- <td>确认</td>
84
- </tr>
85
- <tr>
86
- <td>cancelText</td>
87
- <td>取消文案,取消文案为空,不显示取消按钮</td>
88
- <td>string</td>
89
- <td>取消</td>
90
- </tr>
91
- </tbody>
92
- </table>
93
- </div>
94
- );
95
- }
@@ -1,43 +0,0 @@
1
- import React from "react";
2
- import Button from "../../Button";
3
- import Overlay from "../../overlay";
4
- import './index.less';
5
-
6
- export default function Prompt(props) {
7
- const inputRef = React.useRef();
8
- const {data = {}, onNext} = props;
9
- const {placeholder, defaultValue, title="请输入", type="text", okText="确认", cancelText="取消"} = data;
10
-
11
- return <Overlay verticalPosition="center" closable={false} >
12
- <div className="prompt-dialog">
13
- <div>
14
- <h1 className="prompt-title">{title}</h1>
15
- <input
16
- className="prompt-input"
17
- autoFocus={true}
18
- ref={inputRef}
19
- placeholder={placeholder}
20
- type={type}
21
- defaultValue={defaultValue}
22
- onKeyUp={(e)=> {
23
- if(e.keyCode === 13){
24
- onNext(getInputValue(inputRef.current))
25
- }
26
- }}
27
- />
28
- <div className="prompt-btns">
29
- {
30
- cancelText ? <Button onClick={()=> onNext('back')} >{cancelText}</Button> : null
31
- }
32
- <Button type="primary" onClick={()=>{ onNext(getInputValue(inputRef.current)) }} >{okText}</Button>
33
- </div>
34
- </div>
35
- </div>
36
- </Overlay>
37
- }
38
-
39
-
40
- function getInputValue(input){
41
- const value = input.value || "";
42
- return String(value).trim()
43
- }
@@ -1,44 +0,0 @@
1
- .prompt-dialog{
2
- background:#ffffff;
3
- border-radius:6px 6px 0 0;
4
- // padding:24px 20px;
5
- padding:10px;
6
- width:80%;
7
-
8
- .prompt-title{
9
- font-size:30px;
10
- margin:10px 0;
11
- }
12
-
13
- .prompt-input{
14
- transition: all .1s linear;
15
- border: 1px solid #dcdfe6;
16
- background-color: #fff;
17
- outline: 0;
18
- padding: 0;
19
- margin: 0;
20
- font-weight: 400;
21
- vertical-align: middle;
22
- background-color: #0000;
23
- color: #1f2633;
24
- font-size: 24px;
25
- box-sizing: border-box;
26
- width: 100%;
27
- padding: 0.5em;
28
- border-radius: 4px;
29
- &:hover,&:active,&:focus{
30
- border-color: #03c1fd;
31
- }
32
- }
33
-
34
- .prompt-btns{
35
- display:flex;
36
- margin-top:10px;
37
- .pda-button{
38
- margin-left:10px;
39
- }
40
- .pda-button:first-child{
41
- margin-left:0px;
42
- }
43
- }
44
- }
@@ -1,28 +0,0 @@
1
- import React from "react";
2
- import Button from "../../Button";
3
-
4
- export default function Start(props) {
5
- const { action, appManager, service } = props;
6
- const onReStart = React.useCallback(function () {
7
- service.onStart(appManager.config.appId);
8
- });
9
- return (
10
- <div
11
- style={{
12
- display: "flex",
13
- flexDirection: "column",
14
- justifyContent: "center",
15
- alignItems: "center",
16
- width: "100vw",
17
- height: "100vh",
18
- }}
19
- >
20
- <Button type="primary" onClick={onReStart}>
21
- 开始作业
22
- </Button>
23
- <br />
24
- <div>{appManager.config.appId}</div>
25
- <div>{appManager.config.groupId}</div>
26
- </div>
27
- );
28
- }
@@ -1,12 +0,0 @@
1
- .mini-app-start-page {
2
- display: flex;
3
- flex-direction: column;
4
- justify-content: center;
5
- align-items: center;
6
- width: 100vw;
7
- height: 100vh;
8
-
9
- .desc {
10
- opacity: 0.3;
11
- }
12
- }
@@ -1,76 +0,0 @@
1
- import React from "react";
2
- import SystemToast from "./index";
3
- import service from '../../../mock/service';
4
-
5
- export default function () {
6
- return (
7
- <div>
8
- <h1>/system/toast</h1>
9
- <p>弹框组件,如果要悬浮在页面上,请配合 Overlay 使用</p>
10
- <h2>示例</h2>
11
- <code className="code">
12
- {
13
- `
14
- // gs 代码如下
15
- pageFlow.toast({
16
- level: "success", // success|warning|error
17
- title: '111',
18
- message: '2222',
19
- duration: 3000,
20
- })
21
- `
22
- }
23
- </code>
24
- <h2>页面效果</h2>
25
- <div className="light-block light-block-overlay">
26
- <SystemToast
27
- service={service}
28
- data={{
29
- level: "success", // success|warning|error
30
- title: '111',
31
- message: '2222',
32
- duration: 3000,
33
- }}
34
- onNext={console.log}
35
- ></SystemToast>
36
- </div>
37
- <h2>Toast</h2>
38
- <table className="pure-table pure-table-bordered">
39
- <thead>
40
- <tr>
41
- <th>属性</th>
42
- <th>说明</th>
43
- <th>类型</th>
44
- <th>默认值</th>
45
- </tr>
46
- </thead>
47
- <tbody>
48
- <tr>
49
- <td>level</td>
50
- <td>弹框类型</td>
51
- <td>string</td>
52
- <td>success|warning|error</td>
53
- </tr>
54
- <tr>
55
- <td>message</td>
56
- <td>信息</td>
57
- <td>string</td>
58
- <td></td>
59
- </tr>
60
- <tr>
61
- <td>title</td>
62
- <td>标题</td>
63
- <td>string</td>
64
- <td></td>
65
- </tr>
66
- <tr>
67
- <td>duration</td>
68
- <td>延迟时间</td>
69
- <td>number</td>
70
- <td>ms</td>
71
- </tr>
72
- </tbody>
73
- </table>
74
- </div>
75
- );
76
- }
@@ -1,42 +0,0 @@
1
- import React, {useState} from "react";
2
- import Toast from '../../Toast';
3
- import Overlay from '../../Overlay';
4
- // import "./index.less";
5
-
6
- // Error occurs while executing src/start.gs(8879527103889997824#19) cause by Error: 拣货数量不能大于计划数量
7
- export default function toast(props) {
8
- const { data = {}, onNext, service } = props;
9
- const { title, level, message, duration = null } = data;
10
- const [hidden, setHidden] = useState(false)
11
- React.useEffect(() => {
12
- // 如果是 500 导致的的toast hasNext = fasle
13
- // 如果是 pageflow.toast hasNext = undefined
14
- if(data.hasNext === undefined) {
15
- onNext("")
16
- }
17
- let timeout = null;
18
- if(duration) {
19
- timeout = setTimeout(() => {
20
- setHidden(true);
21
- // service.onNext("");
22
- }, duration);
23
- }
24
- return () => {
25
- clearTimeout(timeout);
26
- }
27
- }, [data])
28
-
29
- return !hidden ? (
30
- <Overlay verticalPosition="bottom" >
31
- <div style={{width: '90%'}} >
32
- <Toast type={level} title={title} message={splitMessage(message)} ></Toast>
33
- </div>
34
- </Overlay>
35
- ) : null;
36
- }
37
-
38
-
39
- function splitMessage(message) {
40
- var msg = String(message).split("by Error:");
41
- return msg[1] || msg[0];
42
- }