@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,52 +0,0 @@
1
- .pda-app-list{
2
- // width:480px;
3
- // background:#000000;
4
- .pda-app-group{
5
- margin:25px;
6
-
7
- .group-name{
8
- font-size:32px;
9
- line-height:1em;
10
- margin:0;
11
- font-size: 32px;
12
- color: #FFFFFF;
13
- font-weight:400;
14
- opacity:0.6;
15
- }
16
-
17
- .group-apps{
18
- display:flex;
19
- flex-wrap: wrap;
20
- justify-content: space-between;
21
- margin-top:25px;
22
- .app-item{
23
- display:flex;
24
- flex-direction:column;
25
- justify-content:center;
26
- align-items:center;
27
- background-image: linear-gradient(138deg, #0091EA 0%, #095FFF 100%);
28
- border-radius: 12px;
29
- font-size: 32px;
30
- color: #FFFFFF;
31
- min-height:126px;
32
- flex:1;
33
- min-width:48%;
34
- max-width:48%;
35
- margin-bottom:25px;
36
- cursor: pointer;
37
-
38
- &:hover,&:active,&:focus{
39
- background-image: linear-gradient(45deg, #0091EA 0%, #095FFF 100%);
40
- box-shadow: 0 0 1px 2px #fff;
41
- }
42
-
43
- .app-name{
44
- text-align: center;
45
- }
46
- .app-subname{
47
- font-size:50%;
48
- }
49
- }
50
- }
51
- }
52
- }
@@ -1,88 +0,0 @@
1
- import React from "react";
2
- import BaseLayoutContainer from './BaseLayoutContainer'
3
- import classNames from "classnames";
4
- import { playSound } from "../utils";
5
-
6
- const blankFunc = () => { };
7
-
8
- // onBarcodeScan 按下键才开始监听
9
- // onScanBarcode 一直监听
10
- export default class BarcodeScan extends React.Component {
11
- constructor(props) {
12
- super(props);
13
- this._barcodeBeginScan = false;
14
- this._handleBarcodeScan = e => {
15
- const { onBarcodeScan } = this.props;
16
- this._stopWork();
17
- playSound('scan');
18
- onBarcodeScan && onBarcodeScan(e.param);
19
- }
20
- this._startWork = e => {
21
- document.addEventListener('BarcodeScan', this._handleBarcodeScan);
22
- this._barcodeBeginScan = true;
23
- }
24
- this._stopWork = e => {
25
- document.removeEventListener('BarcodeScan', this._handleBarcodeScan);
26
- }
27
- this._handleKeyDown = e => {
28
- const { code, keyCode, key } = e; // code: F23/F24; keyCode: 0; key: uniden...
29
- // console.log('keydown code: ', code, keyCode, key);
30
- if (code === 'F22' || code === 'F23' || code === 'F24' || code === 'F9' || code ==='F16') {
31
- if (!this._barcodeBeginScan) {
32
- this._startWork();
33
- }
34
- }
35
- }
36
- this._handleKeyUp = e => {
37
- const { code, keyCode, key } = e; // code: F23/F24; keyCode: 0; key: uniden...
38
- if (code === 'F22' || code === 'F23' || code === 'F24' || code === 'F9' || code ==='F16') {
39
- this._stopWork();
40
- this._barcodeBeginScan = false;
41
- }
42
- }
43
-
44
- this.onScanBarcode = this.onScanBarcode.bind(this);
45
- }
46
-
47
- onScanBarcode(e){
48
- this.props.onScanBarcode && this.props.onScanBarcode(e.param);
49
- }
50
-
51
- componentDidMount() {
52
- const {onBarcodeScan} = this.props;
53
- if(onBarcodeScan){
54
- document.addEventListener('keydown', this._handleKeyDown);
55
- document.addEventListener('keyup', this._handleKeyUp);
56
- }
57
- document.addEventListener('BarcodeScan', this.onScanBarcode);
58
- WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'keyboard', 'method': 'changeScanMode', 'params': {'scanMode': 'barcode'}}", function (e) {
59
- // alert('success ' + JSON.stringify(e));
60
- }, function (e) {
61
- // alert('failure ' + JSON.stringify(e));
62
- });
63
- }
64
- componentWillUnmount() {
65
- const {onBarcodeScan} = this.props;
66
- if(onBarcodeScan){
67
- document.removeEventListener('keydown', this._handleKeyDown);
68
- document.removeEventListener('keyup', this._handleKeyUp);
69
- }
70
- document.removeEventListener('BarcodeScan', this.onScanBarcode)
71
- }
72
-
73
-
74
- render() {
75
- // console.log('onBarcode render');
76
-
77
- const props = this.props;
78
- const { onBarcodeScan = blankFunc, ...opts } = props;
79
-
80
- return (
81
- <BaseLayoutContainer
82
- {...opts}
83
- />
84
- )
85
- }
86
- }
87
-
88
-
@@ -1,208 +0,0 @@
1
- import React from "react";
2
- import "./index.less";
3
- import classNames from "classnames";
4
- import { WindVaneLog } from '../utils';
5
-
6
- const blankFunc = () => { };
7
-
8
- export default class BaseLayoutContainer extends React.Component {
9
- constructor(props) {
10
- super(props);
11
- this.state = {
12
- showLoading: false,
13
- }
14
- this._handleKeyUp = e => {
15
- const { onScan = blankFunc, onEnter = blankFunc, onEsc = blankFunc, onDelete = blankFunc, scanMode = null } = this.props;
16
-
17
- const { code, keyCode, key } = e; // code: F23/F24; keyCode: 0; key: uniden...
18
- if (code === 'Enter') {
19
- e.preventDefault();
20
- onEnter(e);
21
- return;
22
- }
23
- if (code === 'Delete') {
24
- e.preventDefault();
25
- onDelete(e);
26
- return;
27
- }
28
- if (code === 'Esc') {
29
- e.preventDefault();
30
- onEsc(e);
31
- return;
32
- }
33
- }
34
- this._handleBeforeUnload = e => {
35
- e.returnValue = ("确定离开当前页面吗?");
36
- return true;
37
- }
38
- this._handleUnload = e => {
39
- WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'rfid', 'method': 'stopRfidScan', 'params':null}", function (e) {
40
- // alert('success ' + JSON.stringify(e));
41
- }, function (e) {
42
- // alert('failure ' + JSON.stringify(e));
43
- });
44
- const stopParam = {
45
- tag: 'stopRfid',
46
- level: 'd',
47
- message: 'stop rfid scan!!!'
48
- };
49
- WindVaneLog(stopParam);
50
-
51
- const leaveParam = {
52
- tag: 'leavePage',
53
- level: 'd',
54
- message: 'leave page: ' + window.location.href,
55
- }
56
- WindVaneLog(stopParam);
57
- }
58
- }
59
- componentDidMount() {
60
- // console.log('这里增加监听');
61
- // window.onbeforeunload = this._handleBeforeUnload;
62
- window.onunload = this._handleUnload;
63
- document.addEventListener('keyup', this._handleKeyUp);
64
- }
65
- componentWillUnmount() {
66
- // console.log('这里关闭页面了');
67
- window.onbeforeunload = null;
68
- window.onunload = null;
69
- document.removeEventListener('keyup', this._handleKeyUp)
70
- }
71
- shouldComponentUpdate(nextProps, nextState) {
72
- if(nextProps.loading && !this.props.loading) {
73
- this.setState({
74
- showLoading: true,
75
- })
76
- if(nextProps.loadingTimeout) {
77
- setTimeout(() => {
78
- this.setState({
79
- showLoading: false,
80
- });
81
- }, nextProps.loadingTimeout);
82
- }
83
- }
84
- if(!nextProps.loading && this.state.showLoading) {
85
- this.setState({
86
- showLoading: false,
87
- })
88
- }
89
- return true;
90
- }
91
-
92
- render() {
93
- const props = this.props;
94
- const { style = {}, header, footer, loading } = this.props;
95
-
96
- return (
97
- <div
98
- className={classNames({ 'baselayout-wrapper': true, })} style={style}
99
- >
100
- {
101
- header && <div className={classNames({ 'baselayout-header': true })}>
102
- {header}
103
- </div>
104
- }
105
- <div className={classNames({ 'baselayout-container': true })}>
106
- {props.children}
107
- </div>
108
- {
109
- footer && <div className={classNames({ 'baselayout-footer': true })}>
110
- {footer}
111
- </div>
112
- }
113
- {
114
- this.state.showLoading ? (
115
- <div className="loading">
116
- {/* 加载中 */}
117
- </div>
118
- ) : null
119
- }
120
-
121
- </div>
122
- )
123
- }
124
- }
125
-
126
-
127
- // export default function BaseLayout(props) {
128
- // console.log('render baseLayout:', props);
129
-
130
- // const { style = {}, header, footer, continuousRfidScan = false, onRfidScan = blankFunc, onScan = blankFunc, onEnter = blankFunc, onEsc = blankFunc, onDelete = blankFunc } = props;
131
-
132
- // // const [continuousRfidScanState, setContinuousRfidScanState] = useState(continuousRfidScan)
133
-
134
- // // 监听按键事件
135
- // useEffect(() => {
136
- // const handleKeyUp = e => {
137
- // // console.log(e);
138
- // e.preventDefault();
139
- // const { code, keyCode, key } = e; // code: F23/F24; keyCode: 0; key: uniden...
140
- // if (code === 'F23' || code === 'F24') {
141
- // // console.log('scan');
142
- // onScan(e);
143
- // return;
144
- // }
145
- // if (code === 'Enter') {
146
- // onEnter(e);
147
- // return;
148
- // }
149
- // if (code === 'Delete') {
150
- // onDelete(e);
151
- // return;
152
- // }
153
- // if (code === 'Esc') {
154
- // onEsc(e);
155
- // return;
156
- // }
157
- // }
158
- // document.addEventListener('keyup', handleKeyUp);
159
- // return () => {
160
- // document.removeEventListener('keyup', handleKeyUp);
161
- // }
162
- // }, [])
163
-
164
- // // 监听连扫
165
- // useEffect(() => {
166
- // const handleContinuousRfidScan = (ev) => {
167
- // onRfidScan(ev.param);
168
- // }
169
- // if(continuousRfidScan) {
170
- // document.addEventListener('ContinuousRfidScan', handleContinuousRfidScan, false);
171
- // WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'rfid', 'method': 'startScan', 'params': null}", function (e) {
172
- // // console.log('start success ' + JSON.stringify(e));
173
- // }, function (e) {
174
- // console.log('failure-1 ' + JSON.stringify(e));
175
- // });
176
- // }
177
-
178
- // return () => {
179
- // WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'rfid', 'method': 'stopScan', 'params':null}", function (e) {
180
- // // console.log('stop success ' + JSON.stringify(e));
181
- // }, function (e) {
182
- // console.log('failure-2 ' + JSON.stringify(e));
183
- // });
184
- // document.removeEventListener('ContinuousRfidScan', handleContinuousRfidScan, false)
185
- // }
186
- // }, [])
187
-
188
- // return (
189
- // <div
190
- // className={classNames({ 'baselayout-wrapper': true, })} style={style}
191
- // >
192
- // {
193
- // header && <div className={classNames({ 'baselayout-header': true })}>
194
- // {header}
195
- // </div>
196
- // }
197
- // <div className={classNames({ 'baselayout-container': true })}>
198
- // {props.children}
199
- // </div>
200
- // {
201
- // footer && <div className={classNames({ 'baselayout-footer': true })}>
202
- // {footer}
203
- // </div>
204
- // }
205
- // {/* <div className="baselayout-paddingbottom"></div> */}
206
- // </div>
207
- // )
208
- // }
@@ -1,106 +0,0 @@
1
- import React from "react";
2
- import BaseLayoutContainer from './BaseLayoutContainer'
3
- import classNames from "classnames";
4
- import { playSound } from "../utils";
5
-
6
- const blankFunc = () => { };
7
-
8
- export default class RfidOnce extends React.Component {
9
- constructor(props) {
10
- super(props);
11
- this._rfidBeginScan = false;
12
- this._handleRfidScan = e => {
13
- const { onRfidOnce, onRfidBoxOnce, onRfidPalletOnce } = this.props;
14
- const data = e.param;
15
- const isBox = data.rfidData.startsWith("0F006");
16
- const isPallet = data.rfidData.startsWith("0F011");
17
-
18
- playSound('single_recog');
19
-
20
- if(isPallet) {
21
- let rfidData = data.rfidData;
22
- data.originData = rfidData;
23
- data.rfidData = rfidData.substr(5, 12)
24
- }
25
-
26
- if(onRfidBoxOnce && isBox) {
27
- this._stopWork();
28
- onRfidBoxOnce(data);
29
- } else if(onRfidPalletOnce && isPallet) {
30
- this._stopWork();
31
- onRfidPalletOnce(data);
32
- }
33
- if(onRfidOnce){
34
- this._stopWork();
35
- onRfidOnce(data);
36
- }
37
- }
38
- this._startWork = e => {
39
- // console.log('start work');
40
- document.addEventListener('ContinuousRfidScan', this._handleRfidScan);
41
- WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'rfid', 'method': 'startScan', 'params': null}", function(e) {
42
- // alert('success ' + JSON.stringify(e));
43
- }, function(e) {
44
- // alert('failure ' + JSON.stringify(e));
45
- });
46
- this._rfidBeginScan = true;
47
- }
48
- this._stopWork = e => {
49
- // console.log('stop work');
50
- document.removeEventListener('ContinuousRfidScan', this._handleRfidScan);
51
- WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'rfid', 'method': 'stopRfidScan', 'params':null}", function(e) {
52
- }, function(e) {
53
- });
54
- }
55
- this._handleKeyDown = e => {
56
- const { code, keyCode, key } = e; // code: F23/F24; keyCode: 0; key: uniden...
57
- if (code === 'F22' || code === 'F23' || code === 'F24' || code === 'F9' || code ==='F16') {
58
- // console.log('keydown', this._rfidBeginScan);
59
- if (!this._rfidBeginScan) {
60
- this._startWork();
61
- }
62
- }
63
- }
64
- this._handleKeyUp = e => {
65
- const { code, keyCode, key } = e; // code: F23/F24; keyCode: 0; key: uniden...
66
- if (code === 'F22' || code === 'F23' || code === 'F24' || code === 'F9' || code ==='F16') {
67
- // console.log('keyup stop');
68
- this._stopWork();
69
- this._rfidBeginScan = false;
70
- }
71
- }
72
- }
73
-
74
- componentDidMount() {
75
- document.addEventListener('keydown', this._handleKeyDown);
76
- document.addEventListener('keyup', this._handleKeyUp);
77
- // document.addEventListener('ContinuousRfidScan', function (data) {
78
- // // console.log(JSON.stringify(data));
79
- // // console.log(data);
80
- // }, false);
81
-
82
- WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'keyboard', 'method': 'changeScanMode', 'params': {'scanMode': 'RFID'}}", function (e) {
83
- // alert('success ' + JSON.stringify(e));
84
- }, function (e) {
85
- // alert('failure ' + JSON.stringify(e));
86
- });
87
- }
88
- componentWillUnmount() {
89
- document.removeEventListener('keydown', this._handleKeyDown);
90
- document.removeEventListener('keyup', this._handleKeyUp);
91
- this._stopWork();
92
- }
93
-
94
- render() {
95
- // console.log('onRfidOnce render');
96
-
97
- const props = this.props;
98
- const { onRfidOnce = blankFunc, ...opts } = props;
99
-
100
- return (
101
- <BaseLayoutContainer
102
- {...opts}
103
- />
104
- )
105
- }
106
- }
@@ -1,118 +0,0 @@
1
- import React from "react";
2
- import BaseLayoutContainer from './BaseLayoutContainer'
3
- import classNames from "classnames";
4
-
5
- const blankFunc = () => { };
6
-
7
- export default class RfidOnce extends React.Component {
8
- static defaultProps = {
9
- rfidReaderSleep: false,
10
- }
11
- constructor(props) {
12
- super(props);
13
- this._rfidBeginScan = false;
14
- this._handleRfidScan = e => {
15
- const { onRfidScan, onRfidBoxScan, onRfidPalletScan } = this.props;
16
- const data = e.param;
17
- const isBox = data.rfidData.startsWith("0F006");
18
- const isPallet = data.rfidData.startsWith("0F011");
19
- if(isPallet) {
20
- let rfidData = data.rfidData;
21
- data.originData = rfidData;
22
- data.rfidData = rfidData.substr(5, 12)
23
- }
24
-
25
- if(isBox && onRfidBoxScan) {
26
- onRfidBoxScan(data);
27
- } else if(isPallet && onRfidPalletScan) {
28
- onRfidPalletScan(data);
29
- }
30
- if(onRfidScan) {
31
- onRfidScan(data);
32
- }
33
- }
34
- this._startWork = e => {
35
- document.addEventListener('ContinuousRfidScan', this._handleRfidScan);
36
- WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'rfid', 'method': 'startScan', 'params': null}", function(e) {
37
-
38
- }, function(e) {
39
-
40
- });
41
- this._rfidBeginScan = true;
42
- }
43
- this._stopWork = e => {
44
- document.removeEventListener('ContinuousRfidScan', this._handleRfidScan);
45
- // WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'rfid', 'method': 'stopScan', 'params':null}", function(e) {
46
- // }, function(e) {
47
- // });
48
- WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'rfid', 'method': 'stopRfidScan', 'params':null}", function(e) {
49
- }, function(e) {
50
- });
51
- }
52
- this._handleKeyDown = e => {
53
- const { code, keyCode, key } = e; // code: F23/F24; keyCode: 0; key: uniden...
54
- if (code === 'F22' || code === 'F23' || code === 'F24' || code === 'F9' || code ==='F16') {
55
- if (!this._rfidBeginScan) {
56
- this._startWork();
57
- }
58
- }
59
- }
60
- this._handleKeyUp = e => {
61
- const { code, keyCode, key } = e; // code: F23/F24; keyCode: 0; key: uniden...
62
- if (code === 'F22' || code === 'F23' || code === 'F24' || code === 'F9' || code ==='F16') {
63
- this._stopWork();
64
- this._rfidBeginScan = false;
65
- }
66
- }
67
- }
68
-
69
- componentDidMount() {
70
- // console.log('Rfid Scan didMount');
71
- const { autoRfidScan = false, rfidReaderSleep } = this.props;
72
-
73
- WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'keyboard', 'method': 'changeScanMode', 'params': {'scanMode': 'RFID'}}", function (e) {
74
- // alert('success ' + JSON.stringify(e));
75
- }, function (e) {
76
- // alert('failure ' + JSON.stringify(e));
77
- });
78
-
79
- if(!autoRfidScan) {
80
- document.addEventListener('keydown', this._handleKeyDown);
81
- document.addEventListener('keyup', this._handleKeyUp);
82
- } else {
83
- if(!rfidReaderSleep) {
84
- this._startWork();
85
- }
86
- }
87
- }
88
- componentWillUnmount() {
89
- // const { autoRfidScan = false } = this.props;
90
- document.removeEventListener('keydown', this._handleKeyDown);
91
- document.removeEventListener('keyup', this._handleKeyUp);
92
- this._stopWork();
93
- }
94
- shouldComponentUpdate(nextProps, nextState) {
95
- if(this.props.autoRfidScan && (this.props.rfidReaderSleep !== nextProps.rfidReaderSleep) ) {
96
- if(!nextProps.rfidReaderSleep) {
97
- this._startWork();
98
- } else {
99
- this._stopWork();
100
- }
101
- }
102
- return true;
103
- }
104
-
105
-
106
- render() {
107
- // console.log('onRfidScan render');
108
-
109
- const props = this.props;
110
- const { onRfidScan = blankFunc, autoRfidScan, ...opts } = props;
111
-
112
- return (
113
- <BaseLayoutContainer
114
- {...opts}
115
- />
116
- )
117
- }
118
- }