@cniot/android-pda-components 2.0.0-beta.0 → 2.0.0-beta.2
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/build/assets/index.158dfbf4.js +964 -0
- package/build/assets/{index.6824d354.css → index.47962a04.css} +1 -1
- package/build/index.html +2 -2
- package/doc/all-v2-components/index.jsx +11 -0
- package/doc/test/flow/index.js +46 -0
- package/doc/test/flow/pages/index.js +82 -0
- package/doc/test/flow/utils/index.js +37 -0
- package/doc/test/i18n/index.js +95 -0
- package/doc/test/i18n/strings/en-US.json +1 -0
- package/doc/test/i18n/strings/index.js +8 -0
- package/doc/test/i18n/strings/zh-CN.json +1 -0
- package/doc/test/index.jsx +46 -0
- package/doc/test/pages/popup/index.jsx +22 -0
- package/doc/test/pages/popup/index.less +0 -0
- package/doc/test/pages/scan/index.jsx +192 -0
- package/doc/test/pages/scan/index.less +0 -0
- package/es/index.cjs.js +13 -5
- package/es/index.es.js +2495 -306
- package/es/style.css +1 -1
- package/package.json +4 -3
- package/build/assets/index.f8372496.js +0 -956
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is generated by parrot must
|
|
3
|
+
* DOCUMENT LIST:
|
|
4
|
+
* parrot must: http://gitlab.alibaba-inc.com/parrot/parrot-tool-must
|
|
5
|
+
* @ali/global-locale: http://gitlab.alibaba-inc.com/parrot/global-locale
|
|
6
|
+
* @ali/global-string-format: http://gitlab.alibaba-inc.com/parrot/global-string-format
|
|
7
|
+
*/
|
|
8
|
+
import i18n from "$i18n";
|
|
9
|
+
import locale from "@aligov/global-locale";
|
|
10
|
+
import stringFormat from "@aligov/global-string-format";
|
|
11
|
+
import strings from "./strings";
|
|
12
|
+
|
|
13
|
+
let language; // Current language
|
|
14
|
+
let intl; // Instance of intl-universal. Create by provideIntl
|
|
15
|
+
/**
|
|
16
|
+
* update instance of intl universal
|
|
17
|
+
*/
|
|
18
|
+
function update() {
|
|
19
|
+
const { lang } = locale.getLocale();
|
|
20
|
+
language = lang;
|
|
21
|
+
intl = stringFormat.init(lang, strings);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* change current language
|
|
26
|
+
* @param {string} langTag language tag config above
|
|
27
|
+
*/
|
|
28
|
+
function change(langTag) {
|
|
29
|
+
locale.setLang(langTag);
|
|
30
|
+
update();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Format string by key
|
|
34
|
+
* For example:
|
|
35
|
+
* $i18n.get('jsx.home.title'),
|
|
36
|
+
* $i18n.get({
|
|
37
|
+
* id: 'jsx.home.hello',
|
|
38
|
+
* defaultMessage: 'Hello {name}' // not required
|
|
39
|
+
* },{
|
|
40
|
+
* name: 'Alice'
|
|
41
|
+
* })
|
|
42
|
+
* More syntax: https://formatjs.io/guides/message-syntax/
|
|
43
|
+
* @param {string|object} id key or object
|
|
44
|
+
* @param {object} variable variable for id
|
|
45
|
+
* @return {string} format message
|
|
46
|
+
*/
|
|
47
|
+
function get(id, variable) {
|
|
48
|
+
if (!intl) update();
|
|
49
|
+
if (typeof id === "string") {
|
|
50
|
+
return stringFormat.format(
|
|
51
|
+
{
|
|
52
|
+
id: id,
|
|
53
|
+
},
|
|
54
|
+
variable
|
|
55
|
+
);
|
|
56
|
+
} else if (typeof id === "object" && id.dm) {
|
|
57
|
+
id.defaultMessage = id.dm;
|
|
58
|
+
}
|
|
59
|
+
return stringFormat.format(
|
|
60
|
+
{
|
|
61
|
+
id: id.id,
|
|
62
|
+
defaultString: id.dm,
|
|
63
|
+
},
|
|
64
|
+
variable
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function addMessage(strs) {
|
|
69
|
+
for (let key in strs) {
|
|
70
|
+
if (!strings[key]) {
|
|
71
|
+
strings[key] = {};
|
|
72
|
+
}
|
|
73
|
+
Object.assign(strings[key], strs[key]);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* set the first hng cookie
|
|
78
|
+
* //! IMPORTANT remove this after published, only for demo to start up
|
|
79
|
+
* //! IMPORTANT 项目第一次启动后请删除下边的逻辑,这个逻辑只是为了第一次运行的时候,项目能够切换到英文
|
|
80
|
+
*/
|
|
81
|
+
// Delete start
|
|
82
|
+
// change("en-US");
|
|
83
|
+
// change("zh-CN");
|
|
84
|
+
// Delete end
|
|
85
|
+
|
|
86
|
+
i18n.addMessage(strings);
|
|
87
|
+
// window.locale = locale;
|
|
88
|
+
export default {
|
|
89
|
+
get,
|
|
90
|
+
update,
|
|
91
|
+
change,
|
|
92
|
+
language,
|
|
93
|
+
locale,
|
|
94
|
+
addMessage,
|
|
95
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PageFlowApp, WebService, Desktop } from "@cniot/pageflow";
|
|
3
|
+
import { appId, onStart } from "./flow";
|
|
4
|
+
import track from "../../track";
|
|
5
|
+
|
|
6
|
+
// 使用 PC 组件库,开发基于 pc 的实操流程
|
|
7
|
+
import registerSystemPages from "../../system/index-android-pda";
|
|
8
|
+
// 使用 android 组件库,开发基于 手机浏览器的 的实操流程
|
|
9
|
+
// import registerSystemPages from "../../system/index-pc";
|
|
10
|
+
// import "./index.less";
|
|
11
|
+
|
|
12
|
+
// 创建链接 GS 的服务程序
|
|
13
|
+
const service = new WebService({
|
|
14
|
+
// 应用id
|
|
15
|
+
appId,
|
|
16
|
+
// 启动函数
|
|
17
|
+
onStart,
|
|
18
|
+
debug: true,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const app = new PageFlowApp({
|
|
22
|
+
service,
|
|
23
|
+
// 如果下发了没有定义的页面,会显示这个 404
|
|
24
|
+
notFoundPage: "/system/404",
|
|
25
|
+
// 如果 gs 中使用 new Error() 抛出错误,会调用 showErrorPagePath 定义的页面
|
|
26
|
+
showErrorPage: "/system/toast",
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// 注册组件库提供的默认界面,用法请参考组件库文档
|
|
30
|
+
registerSystemPages(app);
|
|
31
|
+
|
|
32
|
+
// 自动监控每个页面第一次渲染时间,同时支持按钮点击统计
|
|
33
|
+
track(app);
|
|
34
|
+
|
|
35
|
+
// 自动注册的web/pages下 index.jsx 的页面, 注册路径同文件夹保持一致
|
|
36
|
+
const pages = import.meta.globEager("./pages/*/index.jsx");
|
|
37
|
+
Object.keys(pages).forEach(function (key) {
|
|
38
|
+
const mpath = key.match(/(\/pages\/.+)\//);
|
|
39
|
+
if (mpath && mpath[1]) {
|
|
40
|
+
app.registerPage(mpath[1], pages[key].default);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export default function () {
|
|
45
|
+
return <Desktop app={app} service={service} />;
|
|
46
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button, List } from "antd-mobile";
|
|
3
|
+
import { Layout, Header, Footer, Scan, Popup } from "$src/components";
|
|
4
|
+
/**
|
|
5
|
+
* 标准 React 组件
|
|
6
|
+
* @param data any 指令下发的数据
|
|
7
|
+
* @param onNext 把数据回传给流程控制
|
|
8
|
+
* @param onCallback 一个特殊的回传值的方法,可以传2个参数,在flow.onCallback里统一接收
|
|
9
|
+
* @param hasActive() 当前页面是否在激活状态,如果弹出 overlay 的页面 hasActive 会变成 false
|
|
10
|
+
* @return React.Element
|
|
11
|
+
*/
|
|
12
|
+
export default function (props) {
|
|
13
|
+
const { data, onNext } = props;
|
|
14
|
+
return (
|
|
15
|
+
<Popup visible={true} onClose={() => onNext()}>
|
|
16
|
+
<div>12312321</div>
|
|
17
|
+
<Button block color="primary" onClick={() => onNext()}>
|
|
18
|
+
按钮组
|
|
19
|
+
</Button>
|
|
20
|
+
</Popup>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button, List } from "antd-mobile";
|
|
3
|
+
import {
|
|
4
|
+
Layout,
|
|
5
|
+
Header,
|
|
6
|
+
Footer,
|
|
7
|
+
Scan,
|
|
8
|
+
Illustration,
|
|
9
|
+
Card,
|
|
10
|
+
TaskCard,
|
|
11
|
+
TaskInput,
|
|
12
|
+
Select,
|
|
13
|
+
MenuList,
|
|
14
|
+
} from "$src/components";
|
|
15
|
+
/**
|
|
16
|
+
* 标准 React 组件
|
|
17
|
+
* @param data any 指令下发的数据
|
|
18
|
+
* @param onNext 把数据回传给流程控制
|
|
19
|
+
* @param onCallback 一个特殊的回传值的方法,可以传2个参数,在flow.onCallback里统一接收
|
|
20
|
+
* @param hasActive() 当前页面是否在激活状态,如果弹出 overlay 的页面 hasActive 会变成 false
|
|
21
|
+
* @return React.Element
|
|
22
|
+
*/
|
|
23
|
+
export default function (props) {
|
|
24
|
+
const { data, onNext } = props;
|
|
25
|
+
return (
|
|
26
|
+
<Layout>
|
|
27
|
+
<Header
|
|
28
|
+
onBack={onNext}
|
|
29
|
+
actions={[
|
|
30
|
+
{
|
|
31
|
+
label: "功能1",
|
|
32
|
+
value: "",
|
|
33
|
+
onClick() {
|
|
34
|
+
alert("功能1");
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: "功能2",
|
|
39
|
+
value: "",
|
|
40
|
+
onClick() {
|
|
41
|
+
alert("功能2");
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
]}
|
|
45
|
+
>
|
|
46
|
+
标准页面
|
|
47
|
+
</Header>
|
|
48
|
+
<Scan
|
|
49
|
+
label="扫描"
|
|
50
|
+
placeholder="请扫描"
|
|
51
|
+
onScan={(value) => {
|
|
52
|
+
console.log("scan value", value);
|
|
53
|
+
}}
|
|
54
|
+
></Scan>
|
|
55
|
+
|
|
56
|
+
<Scan
|
|
57
|
+
label="只输入"
|
|
58
|
+
placeholder="Input code"
|
|
59
|
+
scanAllowed={false}
|
|
60
|
+
onScan={(value) => {
|
|
61
|
+
console.log("scan value", value);
|
|
62
|
+
}}
|
|
63
|
+
onChange={(value) => {
|
|
64
|
+
console.log("change", value);
|
|
65
|
+
}}
|
|
66
|
+
noEnter={true}
|
|
67
|
+
></Scan>
|
|
68
|
+
<List header="可点击列表" className="body-card">
|
|
69
|
+
<List.Item onClick={() => onNext("popup")}>Popup </List.Item>
|
|
70
|
+
<List.Item onClick={() => onNext("success")}>成功 Toast</List.Item>
|
|
71
|
+
<List.Item onClick={() => onNext("error")}>异常 Toast</List.Item>
|
|
72
|
+
<List.Item onClick={() => onNext("prompt")}>输入</List.Item>
|
|
73
|
+
<List.Item onClick={() => onNext("confirm")}>二次确认</List.Item>
|
|
74
|
+
</List>
|
|
75
|
+
|
|
76
|
+
<Illustration />
|
|
77
|
+
|
|
78
|
+
<Card
|
|
79
|
+
leftTag={
|
|
80
|
+
<>
|
|
81
|
+
<div className="tag-blue">{"xxx"}</div>
|
|
82
|
+
</>
|
|
83
|
+
}
|
|
84
|
+
tag={'ppp'}
|
|
85
|
+
imgs={[
|
|
86
|
+
"https://img.alicdn.com/imgextra/i4/O1CN01K7b3xn1OOMGFyyIVJ_!!6000000001695-2-tps-86-92.png",
|
|
87
|
+
]}
|
|
88
|
+
dataSource={[
|
|
89
|
+
{ label: "", value: "value", className: "high" },
|
|
90
|
+
{ label: "label", value: "value" },
|
|
91
|
+
{ label: "label", value: "value,i,9", className: "tag" },
|
|
92
|
+
{ label: "label", value: "value", className: "tag" },
|
|
93
|
+
{ label: "label", value: "value", className: "tag" },
|
|
94
|
+
{ label: "label", value: "value", className: "tag" },
|
|
95
|
+
{ label: "label", value: "value", className: "tag" },
|
|
96
|
+
{ label: "label", value: "value", className: "tag" },
|
|
97
|
+
{ label: "label", value: "value", className: "tag" },
|
|
98
|
+
{ label: "label", value: "value", className: "tag" },
|
|
99
|
+
{
|
|
100
|
+
label: "label",
|
|
101
|
+
value:
|
|
102
|
+
"value,valuevalue,valuevalue,valuevalue,valuevalue,valuevalue,value",
|
|
103
|
+
},
|
|
104
|
+
{ label: "label", value: "value" },
|
|
105
|
+
{ label: "222", value: "333", display: true },
|
|
106
|
+
]}
|
|
107
|
+
extend={
|
|
108
|
+
<Button size="medium" color="primary" fill="outline">
|
|
109
|
+
Start
|
|
110
|
+
</Button>
|
|
111
|
+
}
|
|
112
|
+
></Card>
|
|
113
|
+
|
|
114
|
+
<TaskCard
|
|
115
|
+
data={{
|
|
116
|
+
title: "Trip ID.",
|
|
117
|
+
content: "TK2021012700002",
|
|
118
|
+
tags: [
|
|
119
|
+
{ label: "SKU", value: "6" },
|
|
120
|
+
{ label: "QTY", value: "2" },
|
|
121
|
+
{ label: "QTY1", value: "2" },
|
|
122
|
+
// { label: "SKU", value: "6/7" },
|
|
123
|
+
// { label: "QTY", value: "2/2" },
|
|
124
|
+
],
|
|
125
|
+
progress: {
|
|
126
|
+
desc: "MLP progress",
|
|
127
|
+
current: "1",
|
|
128
|
+
total: 10,
|
|
129
|
+
},
|
|
130
|
+
}}
|
|
131
|
+
></TaskCard>
|
|
132
|
+
<TaskInput
|
|
133
|
+
label="只输入"
|
|
134
|
+
placeholder="Input code"
|
|
135
|
+
scanAllowd={false}
|
|
136
|
+
onChange={(value) => {
|
|
137
|
+
console.log("scan value", value);
|
|
138
|
+
}}
|
|
139
|
+
decimal={3}
|
|
140
|
+
// unit={'EA'}
|
|
141
|
+
// max={5}
|
|
142
|
+
// min={1}
|
|
143
|
+
></TaskInput>
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
<Select
|
|
147
|
+
label="Select Reason"
|
|
148
|
+
placeholder="SHORT Reason please select SHORT Reason please select"
|
|
149
|
+
dataSource={[
|
|
150
|
+
{ label: "Item code", value: "?" },
|
|
151
|
+
{ label: "DIS", value: "?" },
|
|
152
|
+
{ label: "Barcode", value: "10" },
|
|
153
|
+
{ label: "Category", value: "3" },
|
|
154
|
+
{ label: "Qty", value: "3" },
|
|
155
|
+
{ label: "Item code", value: "?" },
|
|
156
|
+
{ label: "DIS", value: "?" },
|
|
157
|
+
{ label: "Barcode", value: "10" },
|
|
158
|
+
{ label: "Category", value: "3" },
|
|
159
|
+
{ label: "Qty", value: "3" },
|
|
160
|
+
]}
|
|
161
|
+
/>
|
|
162
|
+
|
|
163
|
+
<MenuList
|
|
164
|
+
dataSource={[
|
|
165
|
+
{
|
|
166
|
+
label: "Assigned packing tasks",
|
|
167
|
+
value: 10,
|
|
168
|
+
key: "assigned",
|
|
169
|
+
backgroundColor: "#5dc8a6",
|
|
170
|
+
img: "https://img.alicdn.com/imgextra/i3/O1CN01UiB43o1HEYTkJDkGW_!!6000000000726-2-tps-124-128.png",
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
label: "Available Packing Tasks",
|
|
174
|
+
value: 20,
|
|
175
|
+
key: "available",
|
|
176
|
+
backgroundColor: "#4c80f8",
|
|
177
|
+
img: "https://img.alicdn.com/imgextra/i2/O1CN013UzJVm262gcLeDKjQ_!!6000000007604-2-tps-118-128.png",
|
|
178
|
+
},
|
|
179
|
+
]}
|
|
180
|
+
onSelect={console.log}
|
|
181
|
+
></MenuList>
|
|
182
|
+
|
|
183
|
+
<Footer>
|
|
184
|
+
<Button color="default">哈哈</Button>
|
|
185
|
+
<Button color="danger">哈哈</Button>
|
|
186
|
+
<Button color="primary" style={{ flex: 2 }}>
|
|
187
|
+
哈哈
|
|
188
|
+
</Button>
|
|
189
|
+
</Footer>
|
|
190
|
+
</Layout>
|
|
191
|
+
);
|
|
192
|
+
}
|
|
File without changes
|