@cniot/android-pda-components 0.2.17 → 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.
Files changed (114) hide show
  1. package/README.md +4 -21
  2. package/build/assets/index.51a8714a.css +1 -0
  3. package/build/assets/{index.8c37299c.js → index.b428d9a3.js} +29 -29
  4. package/build/assets/vendor.999402d8.js +40 -0
  5. package/build/index.html +3 -3
  6. package/change.md +7 -0
  7. package/package.json +1 -1
  8. package/packages/AppList/doc.jsx +138 -0
  9. package/packages/AppList/index.jsx +33 -0
  10. package/packages/AppList/index.less +52 -0
  11. package/packages/BaseLayout/BarcodeScan.jsx +88 -0
  12. package/packages/BaseLayout/BaseLayoutContainer.jsx +208 -0
  13. package/packages/BaseLayout/RfidOnce.jsx +106 -0
  14. package/packages/BaseLayout/RfidScan.jsx +118 -0
  15. package/packages/BaseLayout/doc.jsx +177 -0
  16. package/packages/BaseLayout/index.jsx +52 -0
  17. package/packages/BaseLayout/index.less +47 -0
  18. package/packages/Button/doc.jsx +62 -0
  19. package/packages/Button/index.jsx +27 -0
  20. package/packages/Button/index.less +62 -0
  21. package/packages/Confirm/doc.jsx +147 -0
  22. package/packages/Confirm/index.jsx +71 -0
  23. package/packages/Confirm/index.less +55 -0
  24. package/packages/Header/doc.jsx +171 -0
  25. package/packages/Header/index.jsx +191 -0
  26. package/packages/Header/index.less +71 -0
  27. package/packages/InfoCard/doc.jsx +244 -0
  28. package/packages/InfoCard/index.jsx +67 -0
  29. package/packages/InfoCard/index.less +111 -0
  30. package/packages/List/doc.jsx +89 -0
  31. package/packages/List/index.jsx +54 -0
  32. package/packages/List/index.less +43 -0
  33. package/packages/Overlay/doc.jsx +103 -0
  34. package/packages/Overlay/index.jsx +42 -0
  35. package/packages/Overlay/index.less +28 -0
  36. package/packages/PdaActionSheet/doc.jsx +193 -0
  37. package/packages/PdaActionSheet/index.jsx +44 -0
  38. package/packages/PdaActionSheet/index.less +65 -0
  39. package/packages/PdaDistanceCard/doc.jsx +62 -0
  40. package/packages/PdaDistanceCard/index.jsx +35 -0
  41. package/packages/PdaDistanceCard/index.less +42 -0
  42. package/packages/PdaFinishCard/doc.jsx +111 -0
  43. package/packages/PdaFinishCard/index.jsx +62 -0
  44. package/packages/PdaFinishCard/index.less +62 -0
  45. package/packages/PdaInfiniteScroll/doc.jsx +121 -0
  46. package/packages/PdaInfiniteScroll/index.jsx +114 -0
  47. package/packages/PdaInfiniteScroll/index.less +12 -0
  48. package/packages/PdaInfiniteScroll/utils.jsx +25 -0
  49. package/packages/PdaSteps/PdaStep/index.jsx +38 -0
  50. package/packages/PdaSteps/PdaStep/index.less +70 -0
  51. package/packages/PdaSteps/PdaSteps/index.jsx +33 -0
  52. package/packages/PdaSteps/PdaSteps/index.less +0 -0
  53. package/packages/PdaSteps/doc.jsx +131 -0
  54. package/packages/PdaSteps/index.jsx +5 -0
  55. package/packages/PdaTitle/doc.jsx +102 -0
  56. package/packages/PdaTitle/index.jsx +51 -0
  57. package/packages/Presentation/doc.jsx +72 -0
  58. package/packages/Presentation/index.jsx +25 -0
  59. package/packages/Presentation/index.less +31 -0
  60. package/packages/SelectCard/doc.jsx +57 -0
  61. package/packages/SelectCard/index.jsx +13 -0
  62. package/packages/SelectCard/index.less +30 -0
  63. package/packages/SimpleCard/doc.jsx +59 -0
  64. package/packages/SimpleCard/index.jsx +13 -0
  65. package/packages/SimpleCard/index.less +38 -0
  66. package/packages/SimpleCardBlock/doc.jsx +77 -0
  67. package/packages/SimpleCardBlock/index.jsx +43 -0
  68. package/packages/SimpleCardBlock/index.less +26 -0
  69. package/packages/SubCard/doc.jsx +63 -0
  70. package/packages/SubCard/index.jsx +28 -0
  71. package/packages/SubCard/index.less +64 -0
  72. package/packages/Tag/doc.jsx +47 -0
  73. package/packages/Tag/index.jsx +12 -0
  74. package/packages/Tag/index.less +22 -0
  75. package/packages/TaskCard/doc.jsx +151 -0
  76. package/packages/TaskCard/index.jsx +65 -0
  77. package/packages/TaskCard/index.less +101 -0
  78. package/packages/Toast/doc.jsx +112 -0
  79. package/packages/Toast/index.jsx +7 -0
  80. package/packages/Toast/index.less +23 -0
  81. package/packages/Toast/methods.jsx +77 -0
  82. package/packages/Toast/toast.jsx +96 -0
  83. package/packages/WakeKeyborard/doc.jsx +170 -0
  84. package/packages/WakeKeyborard/index.jsx +61 -0
  85. package/packages/WakeKeyborard/index.less +55 -0
  86. package/packages/WakeKeyborard/keyborard.jsx +61 -0
  87. package/packages/doc.jsx +19 -0
  88. package/packages/global.less +7 -0
  89. package/packages/index.jsx +60 -0
  90. package/packages/index.less +3 -0
  91. package/packages/pageflow-system-pages/alert/doc.jsx +70 -0
  92. package/packages/pageflow-system-pages/alert/index.jsx +22 -0
  93. package/packages/pageflow-system-pages/confirm/doc.jsx +118 -0
  94. package/packages/pageflow-system-pages/confirm/index.jsx +31 -0
  95. package/packages/pageflow-system-pages/debug/index.jsx +27 -0
  96. package/packages/pageflow-system-pages/debug/index.less +5 -0
  97. package/packages/pageflow-system-pages/index.jsx +38 -0
  98. package/packages/pageflow-system-pages/loading/index.jsx +37 -0
  99. package/packages/pageflow-system-pages/not-found/index.jsx +12 -0
  100. package/packages/pageflow-system-pages/not-found/index.less +26 -0
  101. package/packages/pageflow-system-pages/prompt/doc.jsx +95 -0
  102. package/packages/pageflow-system-pages/prompt/index.jsx +43 -0
  103. package/packages/pageflow-system-pages/prompt/index.less +44 -0
  104. package/packages/pageflow-system-pages/start/index.jsx +28 -0
  105. package/packages/pageflow-system-pages/start/index.less +12 -0
  106. package/packages/pageflow-system-pages/toast/doc.jsx +76 -0
  107. package/packages/pageflow-system-pages/toast/index.jsx +42 -0
  108. package/packages/utils/index.js +56 -0
  109. package/packages/variable.less +4 -0
  110. package/build/assets/index.b8d6d64c.css +0 -1
  111. package/build/assets/vendor.5080796b.js +0 -40
  112. package/es/index.cjs.js +0 -7
  113. package/es/index.es.js +0 -2170
  114. package/es/style.css +0 -1
@@ -0,0 +1,101 @@
1
+ .pda-list-item {
2
+ padding: 24px 16px;
3
+ border-radius: 16px;
4
+ & div {
5
+ margin: 0;
6
+ }
7
+ &>div {
8
+ margin-bottom: 12px;
9
+ }
10
+ &>div:last-child {
11
+ margin-bottom: 0px;
12
+ }
13
+ // .pda-listitem-header {
14
+ // font-size: 32px;
15
+ // line-height: 32px;
16
+ // color: #FFFFFF60;
17
+
18
+ // }
19
+ .pda-listitem-highlight {
20
+ width: 100%;
21
+ font-size: 40px;
22
+ line-height: 40px;
23
+ font-weight: bold;
24
+ color: #FFFFFF;
25
+
26
+ display: flex;
27
+ flex-direction: row;
28
+ justify-content: space-between;
29
+ div:first-child {
30
+ flex: 1;
31
+ // display: block;
32
+ word-break: normal;
33
+ white-space: normal;
34
+ word-break: break-word;
35
+ // width: 200px;
36
+ }
37
+ }
38
+ // .pda-listitem-highlight-top{
39
+ // margin-top: -8px;
40
+ // }
41
+ .pda-listitem-header,
42
+ .pda-listitem-state-text,
43
+ .pda-listitem-subinfo {
44
+ font-size: 32px;
45
+ line-height: 32px;
46
+ color: #999999;
47
+ word-break: break-all;
48
+ }
49
+
50
+ .pda-listitem-state-block {
51
+ display: flex;
52
+ flex-direction: row;
53
+ flex-wrap: wrap;
54
+ margin-bottom: 0;
55
+
56
+ &>div {
57
+ padding: 6px 10px;
58
+ border-radius: 4px;
59
+ background-color: #0091EA;
60
+ margin-bottom: 12px;
61
+ margin-right: 12px;
62
+
63
+ font-size: 24px;
64
+ line-height: 24px;
65
+ }
66
+ &>div.success {
67
+ background-color: #00FF00;
68
+ }
69
+ &>div.warning {
70
+ background-color: #FFCC00;
71
+ }
72
+ &>div.error {
73
+ background-color: #FF0000;
74
+ }
75
+ }
76
+
77
+ position: relative;
78
+ .pda-listitem-icon {
79
+ position: absolute;
80
+ top: 0;
81
+ right: 0;
82
+ width: 60px;
83
+ height: 60px;
84
+ background-color: #0091EA;
85
+ border-radius: 0 16px;
86
+ display: flex;
87
+ justify-content: center;
88
+ align-items: center;
89
+ opacity: 0.85;
90
+ }
91
+ .listitem-icon-container {
92
+ background-size: 100%;
93
+ background-repeat: no-repeat;
94
+ // background-position: center;
95
+ width: 16px;
96
+ height: 24px;
97
+ }
98
+ .listitem-icon-next {
99
+ background-image: url(https://img.alicdn.com/imgextra/i4/O1CN01FkZisA1tCg1sj3b6U_!!6000000005866-2-tps-40-58.png);
100
+ }
101
+ }
@@ -0,0 +1,112 @@
1
+ import React from "react";
2
+ import Toast from "./index";
3
+ export default function () {
4
+ return (
5
+ <div>
6
+ <h1>Toast</h1>
7
+ <p>弹窗组件,如果要悬浮在页面上,请配合 Overlay 使用</p>
8
+ <h2>示例</h2>
9
+ <div className="light-block">
10
+ <button onClick={
11
+ e => {
12
+ // console.log(123);
13
+ Toast.show({
14
+ type: 'success',
15
+ title: 'hello title',
16
+ message: 'hello message',
17
+ duration: 1000,
18
+ })
19
+ }
20
+ }>
21
+ 点击 toast
22
+ </button>
23
+ <Toast
24
+ title="111111"
25
+ message="22222"
26
+ type="success"
27
+ ></Toast>
28
+ <br />
29
+ <Toast
30
+ title="111111"
31
+ message="22222"
32
+ type="warning"
33
+ ></Toast>
34
+
35
+ <br />
36
+ <Toast
37
+ title="延时关闭"
38
+ message="duration={3000}"
39
+ type="error"
40
+ duration={3000}
41
+ ></Toast>
42
+
43
+ <br />
44
+ </div>
45
+ <code className="code">{`
46
+ Toast.show({
47
+ type: 'success',
48
+ title: 'hello title',
49
+ message: 'hello message',
50
+ })
51
+ <Toast
52
+ title="111111"
53
+ message="22222"
54
+ type="success"
55
+ ></Toast>
56
+ <br />
57
+ <Toast
58
+ title="111111"
59
+ message="22222"
60
+ type="warning"
61
+ ></Toast>
62
+
63
+ <br />
64
+ <Toast
65
+ title="延时关闭"
66
+ message="duration={3000}"
67
+ type="error"
68
+ duration={3000}
69
+ ></Toast>
70
+ `}</code>
71
+ <h2>参数</h2>
72
+ <table className="pure-table pure-table-bordered">
73
+ <thead>
74
+ <tr>
75
+ <th>属性</th>
76
+ <th>说明</th>
77
+ <th>类型</th>
78
+ <th>默认值</th>
79
+ </tr>
80
+ </thead>
81
+ <tbody>
82
+ <tr>
83
+ <td>title</td>
84
+ <td>标题</td>
85
+ <td>string</td>
86
+ <td>标题文案</td>
87
+ </tr>
88
+ <tr>
89
+ <td>message</td>
90
+ <td>消息内容</td>
91
+ <td>string</td>
92
+ <td>消息内容</td>
93
+ </tr>
94
+
95
+ <tr>
96
+ <td>type</td>
97
+ <td>消息类型</td>
98
+ <td>string</td>
99
+ <td>success|warning|error</td>
100
+ </tr>
101
+ <tr>
102
+ <td>duration</td>
103
+ <td>延迟时间</td>
104
+ <td>number</td>
105
+ <td>单位 ms</td>
106
+ </tr>
107
+
108
+ </tbody>
109
+ </table>
110
+ </div>
111
+ );
112
+ }
@@ -0,0 +1,7 @@
1
+ import Toast from './toast';
2
+ import { show, clear } from './methods';
3
+
4
+ Toast.show = show;
5
+ Toast.clear = clear;
6
+
7
+ export default Toast;
@@ -0,0 +1,23 @@
1
+ @import '../variable.less';
2
+
3
+ .toast-wrap{
4
+ background:#00FF00;
5
+ border-radius:6px;
6
+ padding:10px 15px;
7
+ width: 100%;
8
+ box-sizing: border-box;
9
+ &.warning{
10
+ background-color:#FFCB00;
11
+ }
12
+ &.error{
13
+ background-color:#FF0000;
14
+ }
15
+ .toast-title{
16
+ font-size: 50px;
17
+ font-weight: bold;
18
+ }
19
+
20
+ .toast-message{
21
+ font-size: 32px;
22
+ }
23
+ }
@@ -0,0 +1,77 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import { resolveContainer } from '../utils'
3
+ import ReactDOM from 'react-dom'
4
+ import { InternalToast } from './toast'
5
+ import { mergeProps } from '../utils'
6
+
7
+ const containers = [];
8
+
9
+ function unmount(container) {
10
+ const unmountResult = ReactDOM.unmountComponentAtNode(container)
11
+ if (unmountResult && container.parentNode) {
12
+ container.parentNode.removeChild(container)
13
+ }
14
+ }
15
+
16
+ const defaultProps = {
17
+ duration: 2000,
18
+ }
19
+
20
+ export function show(p) {
21
+ const props = mergeProps(
22
+ defaultProps,
23
+ p,
24
+ )
25
+ let timer = 0;
26
+ const { getContainer = () => document.body } = props
27
+ const container = document.createElement('div')
28
+ const bodyContainer = resolveContainer(getContainer)
29
+ bodyContainer.appendChild(container)
30
+ // console.log('container: ', container);
31
+
32
+ clear()
33
+ containers.push(container)
34
+
35
+ function TempToast() {
36
+ const [visible, setVisible] = useState(true)
37
+ useEffect(() => {
38
+ return () => {
39
+ props.afterClose && props.afterClose()
40
+ }
41
+ }, [])
42
+
43
+ useEffect(() => {
44
+ if (props.duration === 0) {
45
+ return
46
+ }
47
+ timer = window.setTimeout(() => {
48
+ setVisible(false)
49
+ }, props.duration)
50
+ return () => {
51
+ window.clearTimeout(timer)
52
+ }
53
+ }, [])
54
+
55
+ return (
56
+ <InternalToast
57
+ {...props}
58
+ getContainer={() => container}
59
+ visible={visible}
60
+ afterClose={() => {
61
+ unmount(container)
62
+ }}
63
+ />
64
+ )
65
+ // return 'hello world: toast'
66
+ }
67
+
68
+ ReactDOM.render(<TempToast />, container)
69
+ }
70
+
71
+ export function clear() {
72
+ while (true) {
73
+ const container = containers.pop()
74
+ if (!container) break
75
+ unmount(container)
76
+ }
77
+ }
@@ -0,0 +1,96 @@
1
+ import React, { useState, useEffect, ReactNode, useMemo } from "react";
2
+ import './index.less';
3
+
4
+ import classNames from 'classnames'
5
+ // import Mask from '../mask'
6
+ import { mergeProps, playSound } from '../utils'
7
+ // import { PropagationEvent } from '../utils'
8
+ // import { GetContainer } from '../utils'
9
+ import Overlay from '../Overlay'
10
+
11
+
12
+ function getTypeClass(type) {
13
+ return {
14
+ "success": "toast-wrap success",
15
+ "warning": "toast-wrap warning",
16
+ "error": "toast-wrap error",
17
+ }[type] || "toast-wrap"
18
+ }
19
+ export default function Toast(props) {
20
+ const { title = "title", message = "message", type = "success", duration = null } = props;
21
+ const [hidden, setHidden] = useState(false)
22
+ useEffect(() => {
23
+ if(window.WindVane){
24
+ if(type === 'warning') {
25
+ playSound('error1');
26
+ window.WindVane.call('WVMotion', 'vibrate', {duration: 400});
27
+ } else if(type === 'error') {
28
+ playSound('error2');
29
+ window.WindVane.call('WVMotion', 'vibrate', {duration: 200});
30
+ setTimeout(() => {
31
+ window.WindVane.call('WVMotion', 'vibrate', {duration: 300});
32
+ }, 250);
33
+ }
34
+ }
35
+ }, [])
36
+ if (duration) {
37
+ setTimeout(() => {
38
+ setHidden(true);
39
+ }, duration);
40
+ }
41
+
42
+ return !hidden ? (
43
+ <div className={getTypeClass(type)}>
44
+ <div className="toast-title">{title}</div>
45
+ <div className="toast-message">{message}</div>
46
+ </div>
47
+ ) : null
48
+ }
49
+
50
+
51
+ const defaultProps = {
52
+ maskClickable: true,
53
+ stopPropagation: ['click'],
54
+ }
55
+
56
+ export const InternalToast = p => {
57
+ const props = mergeProps(defaultProps, p)
58
+ const { maskClickable, content, icon, position, title, message, type, visible } = props
59
+
60
+ return (
61
+ // <Mask
62
+ // visible={props.visible}
63
+ // destroyOnClose
64
+ // opacity={0}
65
+ // disableBodyScroll={!maskClickable}
66
+ // getContainer={props.getContainer}
67
+ // afterClose={props.afterClose}
68
+ // style={{
69
+ // pointerEvents: maskClickable ? 'none' : 'auto',
70
+ // ...props.maskStyle,
71
+ // }}
72
+ // className={classNames(`${classPrefix}-mask`, props.maskClassName)}
73
+ // stopPropagation={props.stopPropagation}
74
+ // >
75
+ // <div
76
+ // style={{ top }}
77
+ // className={classNames(
78
+ // `${classPrefix}-wrap`,
79
+ // icon ? `${classPrefix}-wrap-icon` : `${classPrefix}-wrap-text`
80
+ // )}
81
+ // >
82
+ // {/* {iconElement && (
83
+ // <div className={`${classPrefix}-icon`}>{iconElement}</div>
84
+ // )} */}
85
+ // {content}
86
+ // </div>
87
+ // </Mask>
88
+ <Overlay visible={visible} verticalPosition='bottom' closable={true}>
89
+ <Toast
90
+ title={title}
91
+ message={message}
92
+ type={type}
93
+ ></Toast>
94
+ </Overlay>
95
+ )
96
+ }
@@ -0,0 +1,170 @@
1
+ import React, { useState } from "react";
2
+ import WakeKeyborard from "./index";
3
+ import Keyborard from "./keyborard";
4
+ import Button from '../Button';
5
+
6
+ export default function () {
7
+ const [input, setInput] = useState(false);
8
+ return (
9
+ <div>
10
+ <h1>WakeKeyborard</h1>
11
+ <p>WakeKeyborard</p>
12
+ <h2>示例</h2>
13
+
14
+ <div className="light-block">
15
+ <p>点击右下角键盘</p>
16
+ <WakeKeyborard
17
+ autoWakeup={true}
18
+ label='搜索'
19
+ onWakeKeyboard={() => { console.log('wake keyboard') }}
20
+ onHidden={() => { console.log('keyboard hidden') }}
21
+ onClick={v => { console.log('v is ', v); }}
22
+ type='text'
23
+ />
24
+ <p>点击下面按钮唤起</p>
25
+ <Button
26
+ onClick={e => {
27
+ setInput(!input);
28
+ }}
29
+ >输入</Button>
30
+ {
31
+ input ? (
32
+ <Keyborard
33
+ onWakeKeyboard={
34
+ e => {
35
+ console.log('keyborard from button');
36
+ }
37
+ }
38
+ onClick={
39
+ v => {
40
+ console.log('value: ', v);
41
+ }
42
+ }
43
+ onHidden={
44
+ e => {
45
+ console.log('keyborard hidden from button');
46
+ setInput(false);
47
+ }
48
+ }
49
+ />
50
+ ) : null
51
+ }
52
+
53
+ </div>
54
+ <code className="code">{`
55
+ <WakeKeyborard
56
+ autoWakeup={true}
57
+ label='搜索'
58
+ onWakeKeyboard={() => { console.log('wake keyboard') }}
59
+ onHidden={() => { console.log('keyboard hidden') }}
60
+ onClick={v => { console.log('v is ', v); }}
61
+ type='text'
62
+ />
63
+
64
+
65
+
66
+ const [input, setInput] = useState(false);
67
+
68
+ <Button
69
+ onClick={e => {
70
+ setInput(!input);
71
+ }}
72
+ >输入</Button>
73
+ {
74
+ input ? (
75
+ <Keyborard
76
+ onWakeKeyboard={
77
+ e => {
78
+ console.log('keyborard from button');
79
+ }
80
+ }
81
+ onClick={
82
+ v => {
83
+ console.log('value: ', v);
84
+ }
85
+ }
86
+ onHidden={
87
+ e => {
88
+ console.log('keyborard hidden from button');
89
+ setInput(false);
90
+ }
91
+ }
92
+ />
93
+ ) : null
94
+ }
95
+ `}</code>
96
+ <h2>WakeKeyborard 参数</h2>
97
+ <table className="pure-table pure-table-bordered">
98
+ <thead>
99
+ <tr>
100
+ <th>属性</th>
101
+ <th>说明</th>
102
+ <th>类型</th>
103
+ <th>默认值</th>
104
+ </tr>
105
+ </thead>
106
+ <tbody>
107
+ <tr>
108
+ <td>autoWakeup</td>
109
+ <td>自动唤起</td>
110
+ <td>boolean</td>
111
+ <td>false</td>
112
+ </tr>
113
+
114
+ </tbody>
115
+ </table>
116
+ <p>其他参数同下面 Keyboard 参数</p>
117
+
118
+ <h2>Keyborard 参数</h2>
119
+ <table className="pure-table pure-table-bordered">
120
+ <thead>
121
+ <tr>
122
+ <th>属性</th>
123
+ <th>说明</th>
124
+ <th>类型</th>
125
+ <th>默认值</th>
126
+ </tr>
127
+ </thead>
128
+ <tbody>
129
+ <tr>
130
+ <td>label</td>
131
+ <td>确认按键文案</td>
132
+ <td>string</td>
133
+ <td>查询</td>
134
+ </tr>
135
+ <tr>
136
+ <td>onWakeKeyboard</td>
137
+ <td>唤起键盘回调</td>
138
+ <td>function</td>
139
+ <td></td>
140
+ </tr>
141
+ <tr>
142
+ <td>onClick</td>
143
+ <td>点击查询回调</td>
144
+ <td>function: (value) => { }</td>
145
+ <td>(value) => { }</td>
146
+ </tr>
147
+ <tr>
148
+ <td>onHidden</td>
149
+ <td>键盘隐藏时回调</td>
150
+ <td>function: (value) => { }</td>
151
+ <td>(value) => { }</td>
152
+ </tr>
153
+ <tr>
154
+ <td>type</td>
155
+ <td>键盘 type</td>
156
+ <td>string</td>
157
+ <td>tel</td>
158
+ </tr>
159
+ <tr>
160
+ <td>placeholder</td>
161
+ <td>输入框 placeholder</td>
162
+ <td>string</td>
163
+ <td>请输入</td>
164
+ </tr>
165
+ </tbody>
166
+ </table>
167
+
168
+ </div>
169
+ );
170
+ }
@@ -0,0 +1,61 @@
1
+ import React, { useState, useEffect, useRef } from "react";
2
+ // import OPInput from "../OPInput";
3
+ import "./index.less";
4
+ // import classNames from "classnames";
5
+ import Button from '../Button'
6
+ import Keyborard from "./keyborard";
7
+
8
+ const blankFunc = () => { };
9
+ export default function WakeKeyborard(props) {
10
+ const [inputVisible, setInputVisible] = useState(props.autoWakeup || false);
11
+ // const inputRef = useRef(null);
12
+
13
+ // const { label = "查询", onWakeKeyboard = blankFunc, onClick = blankFunc, onHidden = blankFunc } = props;
14
+ const { onClick = blankFunc, onHidden = blankFunc, ...keyborardProps } = props;
15
+
16
+ return (
17
+ <div className="wakekeyborard">
18
+ {
19
+ inputVisible ? (
20
+ <Keyborard
21
+ // label={label}
22
+ onClick={
23
+ (v, e) => {
24
+ onClick(v);
25
+ setInputVisible(!inputVisible);
26
+ // onHidden(true);
27
+ }
28
+ }
29
+ onHidden={
30
+ s => {
31
+ setInputVisible(false);
32
+ onHidden(s);
33
+ }
34
+ }
35
+ {...keyborardProps}
36
+ />
37
+ ) : null
38
+ }
39
+ {
40
+ !inputVisible ? (
41
+ <div
42
+ className="wakekeyborard-icon"
43
+ onClick={
44
+ e => {
45
+ // this.setState({ inputVisible: !inputVisible });
46
+ setInputVisible(!inputVisible);
47
+ // requestAnimationFrame(() => {
48
+ // onWakeKeyboard();
49
+ // })
50
+ }
51
+ }
52
+ ></div>
53
+ ) : null
54
+ }
55
+
56
+ </div>
57
+ )
58
+ }
59
+
60
+
61
+ WakeKeyborard.Keyborard = Keyborard;
@@ -0,0 +1,55 @@
1
+ .wakekeyborard {
2
+ .wakekeyborard-icon {
3
+ width: 80px;
4
+ height: 80px;
5
+ background-image: url(https://img.alicdn.com/imgextra/i3/O1CN01kxYh3U25Xzr9nAcYp_!!6000000007537-2-tps-240-240.png);
6
+ background-size: 100%;
7
+
8
+ position: fixed;
9
+ right: 24px;
10
+ bottom: 24px;
11
+ }
12
+ }
13
+
14
+ .wakekeyborard-overlay {
15
+ position: fixed;
16
+ top: 0;
17
+ right: 0;
18
+ left: 0;
19
+ bottom: 0;
20
+ background-color: rgba(222, 222, 222, 0.2);
21
+ }
22
+ .wakekeyborard-inputbox {
23
+ width: 100%;
24
+ display: flex;
25
+ flex-direction: row;
26
+ height: 85px;
27
+
28
+ position: absolute;
29
+ bottom: 0;
30
+ left: 0;
31
+ right: 0;
32
+
33
+ input {
34
+ // width: 330px;
35
+ width:100%;
36
+ border-radius: 16px 0 0 0 ;
37
+ border: 0;
38
+ font-size: 42px;
39
+ background-color: white;
40
+ padding-left: 20px;
41
+ &:focus {
42
+ outline: none;
43
+ }
44
+ &::-webkit-input-placeholder {
45
+ color: rgb(209, 209, 214);
46
+ font-size: 32px;
47
+ }
48
+ }
49
+ button {
50
+ width: 150px;
51
+ border: 0;
52
+ border-radius: 0 16px 0 0;
53
+ background-color: white;
54
+ }
55
+ }