@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,55 @@
1
+ @import '../variable.less';
2
+
3
+ .confirm-wrap{
4
+ background:#ffffff;
5
+ border-radius:6px 6px 0 0;
6
+ // padding:24px 20px;
7
+ padding-top: 24px;
8
+ width:100%;
9
+ .confirm-content {
10
+ padding: 0 24px;
11
+ }
12
+ .confirm-title{
13
+ font-size:24 * @change2rem;
14
+ font-weight:700;
15
+ }
16
+
17
+ .confirm-message{
18
+ font-size:22 * @change2rem;
19
+ margin-bottom:10 * @change2rem;
20
+ }
21
+ .confirm-sub-message {
22
+ font-size:22 * @change2rem;
23
+ margin-bottom:10 * @change2rem;
24
+ // word-wrap: break-word;
25
+ // word-break: break-all;
26
+ }
27
+ .confirm-sub-block {
28
+ display: flex;
29
+ flex-direction: row;
30
+ .confirm-sub-label {
31
+ white-space: nowrap;
32
+ }
33
+ .confirm-sub-content {
34
+ margin-left: 12px;
35
+ word-wrap:break-word;
36
+ word-break: break-all;
37
+ }
38
+ }
39
+
40
+ .confirm-btns{
41
+ &>*:not(:first-child) {
42
+ padding-top: 0;
43
+ }
44
+ }
45
+
46
+ &.confirm-warning {
47
+ background-color: red;
48
+ .pda-button {
49
+ background-color: transparent;
50
+ color: black;
51
+ border: 2px solid black;
52
+ border-radius: 40px;
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,171 @@
1
+ import React from "react";
2
+ import Header from "./index";
3
+ export default function () {
4
+ return (
5
+ <div>
6
+ <h1>Header</h1>
7
+ <p>头部指引, 在 iData PDA 中 fn 的键值为 0,已做特殊处理,可以直接写fn。</p>
8
+ <br/>
9
+ <div>
10
+ 注意:通过以下代码禁用实体 back 键的默认动作后,Header 组件的 onBack 可以响应实体back键
11
+ <code className="code">
12
+ {
13
+ `
14
+ WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'keyboard', 'method': 'disableBackKey', 'params': {}}", function(e) {
15
+ console.log('disable back key succeed');
16
+ }, function(e) {
17
+ console.log('disable back key failed');
18
+ });
19
+ `
20
+ }
21
+ </code>
22
+ </div>
23
+ <h2>示例</h2>
24
+ <div className="dark-block">
25
+ {/* const { className, goBack = true, icon="scan", title="任务", more=false } = this.props; */}
26
+ <Header
27
+ title='hello world'
28
+ onBack={console.log}
29
+ backShortcutKey="a"
30
+ />
31
+ <Header
32
+ icon='read'
33
+ title='hello world'
34
+ configIconClick = {
35
+ e => {
36
+ console.log('config icon click');
37
+ }
38
+ }
39
+ ></Header>
40
+ <Header
41
+ icon='select'
42
+ title='hello world'
43
+ menus={[
44
+ {
45
+ label:"menus1"
46
+ },
47
+ {
48
+ label:"menus2"
49
+ },
50
+ {
51
+ label:"menus3"
52
+ }
53
+ ]}
54
+ onClickMenuItem={console.log}
55
+ cancelMenuText="取消"
56
+ menuShortcutKey="f1,f2,fn"
57
+ configIconClick = {
58
+ e => {
59
+ console.log('config icon click');
60
+ }
61
+ }
62
+ ></Header>
63
+ </div>
64
+ <code className="code">{`
65
+ // backShortcutKey 绑定了 a 键快捷触发 onBack
66
+ <Header
67
+ title='hello world'
68
+ onBack={console.log}
69
+ backShortcutKey="a"
70
+ />
71
+ <Header
72
+ icon='read'
73
+ title='hello world'
74
+ ></Header>
75
+ <Header
76
+ icon='select'
77
+ title='hello world'
78
+ menus={[
79
+ {
80
+ label:"menus1"
81
+ },
82
+ {
83
+ label:"menus2"
84
+ },
85
+ {
86
+ label:"menus3"
87
+ }
88
+ ]}
89
+ onClickMenuItem={console.log}
90
+ cancelMenuText="取消"
91
+ menuShortcutKey="f1,f2,fn"
92
+ ></Header>
93
+ `}</code>
94
+ <h2>参数</h2>
95
+ <table className="pure-table pure-table-bordered">
96
+ <thead>
97
+ <tr>
98
+ <th>属性</th>
99
+ <th>说明</th>
100
+ <th>类型</th>
101
+ <th>默认值</th>
102
+ </tr>
103
+ </thead>
104
+ <tbody>
105
+ <tr>
106
+ <td>onBack</td>
107
+ <td>返回按钮点击</td>
108
+ <td>Function("back")</td>
109
+ <td></td>
110
+ </tr>
111
+ <tr>
112
+ <td>onClickMenuItem</td>
113
+ <td>menu item 点击</td>
114
+ <td>function(item)</td>
115
+ <td></td>
116
+ </tr>
117
+
118
+ <tr>
119
+ <td>icon</td>
120
+ <td>title 图标</td>
121
+ <td>string: scan | select | read</td>
122
+ <td>scan</td>
123
+ </tr>
124
+ <tr>
125
+ <td>title</td>
126
+ <td>标题</td>
127
+ <td>string</td>
128
+ <td></td>
129
+ </tr>
130
+ <tr>
131
+ <td>onScanBarcode</td>
132
+ <td>{`(barcode)=> `}</td>
133
+ <td>Function</td>
134
+ <td>-</td>
135
+ </tr>
136
+
137
+ <tr>
138
+ <td>menus</td>
139
+ <td>弹出菜单列表,menus item 的所有参数会直接给 Button</td>
140
+ <td>Array-Object</td>
141
+ <td></td>
142
+ </tr>
143
+ <tr>
144
+ <td>cancelMenuText</td>
145
+ <td>取消弹出菜单的按钮文案,没有的话不显示取消弹出菜单</td>
146
+ <td>String</td>
147
+ <td></td>
148
+ </tr>
149
+ <tr>
150
+ <td>menuShortcutKey</td>
151
+ <td>自己定义绑定 menu 菜单的快捷键弹出,比如 `f1`, `f1,f2` (支持,号分割绑定多个键)</td>
152
+ <td>String</td>
153
+ <td></td>
154
+ </tr>
155
+ <tr>
156
+ <td>backShortcutKey</td>
157
+ <td>返回,绑定快捷键, 必须声明过 onBack 参数才有效</td>
158
+ <td>String</td>
159
+ <td></td>
160
+ </tr>
161
+ <tr>
162
+ <td>configIconClick</td>
163
+ <td>增加 Config 按钮</td>
164
+ <td>function</td>
165
+ <td></td>
166
+ </tr>
167
+ </tbody>
168
+ </table>
169
+ </div>
170
+ );
171
+ }
@@ -0,0 +1,191 @@
1
+ import React from "react";
2
+ import keycode from "keycode";
3
+ import Button from "../Button";
4
+ import Overlay from "../Overlay";
5
+ import "./index.less";
6
+
7
+
8
+ // 在 android pda 里,fn 被触发为 0, 这里做特殊处理
9
+ const SPECIAL_KEY_MAP = ['fn'];
10
+
11
+ const empty = () => {};
12
+ /*
13
+ title,
14
+ onBack,
15
+ icon: ["scan"],
16
+ menus: [
17
+ {
18
+ label:"",
19
+ value:""
20
+ }
21
+ ],
22
+ onClickMenuItem: Empty
23
+ */
24
+ export default function (props) {
25
+ const {
26
+ onBack,
27
+ icon,
28
+ title,
29
+ menus = [],
30
+ onClickMenuItem = empty,
31
+ onScanBarcode,
32
+ cancelMenuText,
33
+ configIconClick = null,
34
+ menuShortcutKey,
35
+ backShortcutKey,
36
+ } = props;
37
+ const [showMenus, setShowMenus] = React.useState(false);
38
+
39
+ // menu弹出快捷键绑定
40
+ React.useEffect(
41
+ function () {
42
+ if (menuShortcutKey) {
43
+ return bindShortcutKey(
44
+ getShortcutKeyCodes(menuShortcutKey),
45
+ function () {
46
+ setShowMenus(true);
47
+ }
48
+ );
49
+ }
50
+ },
51
+ [menuShortcutKey]
52
+ );
53
+
54
+ // back 快捷键绑定
55
+ React.useEffect(
56
+ function () {
57
+ if (backShortcutKey && onBack) {
58
+ return bindShortcutKey(
59
+ getShortcutKeyCodes(backShortcutKey),
60
+ function () {
61
+ onBack("back");
62
+ }
63
+ );
64
+ }
65
+ },
66
+ [backShortcutKey, onBack]
67
+ );
68
+
69
+ //监听实体back键
70
+ React.useEffect(() => {
71
+ return onKeyBoradBack(function(){
72
+ onBack && onBack("back");
73
+ })
74
+ }, []);
75
+
76
+ // onScanBarcode
77
+ React.useEffect(() => {
78
+ return addEventListener(document, "BarcodeScan", function(e){
79
+ onScanBarcode && onScanBarcode(e.param.scanData)
80
+ })
81
+ }, [onScanBarcode])
82
+
83
+
84
+ return (
85
+ <div className="pda-header">
86
+ <div className="header-click-area">
87
+ {onBack ? (
88
+ <div className="pda-goback" onClick={() => onBack("back")}></div>
89
+ ) : null}
90
+ {icon && (
91
+ <div className={`pda-header-icon pda-header-icon-${icon}`}></div>
92
+ )}
93
+ </div>
94
+ <div className="pda-title-text">{title}</div>
95
+ {menus && menus.length ? (
96
+ <div className="pda-header-icon pda-header-more" onClick={() => setShowMenus(true)} />
97
+ ) : null}
98
+ {
99
+ configIconClick ? (
100
+ <div className="pda-header-icon pda-header-config" onClick={configIconClick} />
101
+ ) : null
102
+ }
103
+
104
+ <Overlay
105
+ visible={showMenus}
106
+ verticalPosition="bottom"
107
+ closable={false}
108
+ onClosed={() => setShowMenus(false)}
109
+ >
110
+ <div className="pda-menus">
111
+ {menus.map((item, index) => {
112
+ return (
113
+ <Button
114
+ onClick={() => {
115
+ setShowMenus(false);
116
+ onClickMenuItem(item);
117
+ }}
118
+ key={item.key || index}
119
+ >
120
+ {item.label}
121
+ </Button>
122
+ );
123
+ })}
124
+ {cancelMenuText ? (
125
+ <div style={{ marginTop: 20 }}>
126
+ <Button onClick={() => setShowMenus(false)}>
127
+ {cancelMenuText}
128
+ </Button>
129
+ </div>
130
+ ) : null}
131
+ </div>
132
+ </Overlay>
133
+ </div>
134
+ );
135
+ }
136
+
137
+ // 获取快捷键列表值,支持 , 号分割
138
+ // "F5,a" ===> [116, 56]
139
+ function getShortcutKeyCodes(shortcutKey) {
140
+ const shortcutKeys = shortcutKey.indexOf(",") > -1 ? shortcutKey.split(",") : [shortcutKey];
141
+ return shortcutKeys
142
+ .map((k) => {
143
+ if(SPECIAL_KEY_MAP.indexOf(k.toLowerCase()) > -1){
144
+ return k.toLowerCase();
145
+ }
146
+ const kc = keycode(k);
147
+ if (kc === undefined) {
148
+ console.warn("OPButton.shortcutKey error key value by:", k);
149
+ }
150
+ return kc;
151
+ })
152
+ .filter((k) => k !== undefined);
153
+ }
154
+
155
+ // 创建快捷键绑定
156
+ function bindShortcutKey(keys, callback) {
157
+ function keyUpCallback(event) {
158
+ // 处理特殊键
159
+ const key = event.key.toLowerCase();
160
+ const keyCode = SPECIAL_KEY_MAP.indexOf(key) > -1 ? key : event.keyCode;
161
+ if (keys.indexOf(keyCode) > -1) {
162
+ callback && callback(event);
163
+ }
164
+ }
165
+ document.addEventListener("keyup", keyUpCallback);
166
+ return function () {
167
+ document.removeEventListener("keyup", keyUpCallback);
168
+ };
169
+ }
170
+
171
+
172
+ function onKeyBoradBack(fn){
173
+ function keyPressed(data){
174
+ if ('back' == data.param.originValue) {
175
+ fn && fn()
176
+ }
177
+ }
178
+ document.addEventListener('keyPressed', keyPressed, false);
179
+ return function(){
180
+ document.removeEventListener('keyPressed', keyPressed);
181
+ }
182
+ }
183
+
184
+
185
+ // -addEventListener
186
+ function addEventListener(node, eventName, fn){
187
+ node.addEventListener(eventName, fn, false);
188
+ return function(){
189
+ node.removeEventListener(eventName, fn);
190
+ }
191
+ }
@@ -0,0 +1,71 @@
1
+ .pda-header {
2
+ background-color:#000000;
3
+ display: flex;
4
+ flex-direction: row;
5
+ // justify-content: center;
6
+ align-items: center;
7
+ color: white;
8
+ height: 84px;
9
+ .header-click-area {
10
+ height: 100%;
11
+ display: flex;
12
+ align-items: center;
13
+ flex-direction: row;
14
+ }
15
+ .pda-goback {
16
+ background-image: url(https://img.alicdn.com/imgextra/i4/O1CN01O46CYm1Gc4yvZtk7A_!!6000000000642-2-tps-36-64.png);
17
+ width: 18px;
18
+ height: 32px;
19
+ background-size: 100%;
20
+ margin-left: 28px;
21
+ margin-right: 8px;
22
+ }
23
+ .pda-header-icon {
24
+ height: 36px;
25
+ width: 36px;
26
+ margin-left: 16px;
27
+ background-size: 100%;
28
+ background-repeat: no-repeat;
29
+ background-position: center;
30
+ }
31
+ .pda-header-icon-scan {
32
+ background-image: url(https://img.alicdn.com/imgextra/i4/O1CN017UD9RM1vCKxsjxsrE_!!6000000006136-2-tps-68-68.png);
33
+ }
34
+ .pda-header-icon-select {
35
+ background-image: url(https://img.alicdn.com/imgextra/i2/O1CN0170QXc91udWriUp19S_!!6000000006060-2-tps-74-72.png);
36
+ }
37
+ .pda-header-icon-read {
38
+ background-image: url(https://img.alicdn.com/imgextra/i2/O1CN01EMphgH1ylYGXImCZn_!!6000000006619-2-tps-70-70.png);
39
+ }
40
+ .pda-title-text {
41
+ margin-left: 16px;
42
+ font-size: 40px;
43
+ flex:1;
44
+ }
45
+
46
+ .pda-header-more {
47
+ // height: 36px;
48
+ // width: 36px;
49
+ // margin-left: 16px;
50
+ background-image: url(https://img.alicdn.com/imgextra/i4/O1CN01dTdXds1p9gz4wKAve_!!6000000005318-2-tps-70-26.png);
51
+ // background-size: 100%;
52
+ // background-repeat: no-repeat;
53
+ // background-position: center;
54
+ // margin-right:15px;
55
+ }
56
+ .pda-header-config {
57
+ background-image: url(https://img.alicdn.com/imgextra/i3/O1CN01SKQH1k1p7rQYTBXdn_!!6000000005314-2-tps-56-60.png);
58
+ }
59
+
60
+ .pda-menus {
61
+ background-color: white;
62
+ border-radius: 8px 8px 0 0;
63
+ width: 100%;
64
+ padding: 24px;
65
+ display: flex;
66
+ flex-direction: column;
67
+ &>* {
68
+ margin-bottom: 12px;
69
+ }
70
+ }
71
+ }