@cniot/android-pda-components 2.0.0-beta.10 → 2.0.0-beta.12
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/.must.config.js +46 -0
- package/README.md +6 -1
- package/build/assets/{index.dacfd7cb.js → index.0fcaa733.js} +55 -55
- package/build/assets/{index.133cdfa9.css → index.87e75c31.css} +1 -1
- package/build/index.html +2 -2
- package/es/index.cjs.js +12 -6
- package/es/index.es.js +3039 -306
- package/i18n/index.js +107 -0
- package/i18n/strings/en-US.json +26 -0
- package/i18n/strings/index.js +9 -0
- package/i18n/strings/zh-CN.json +26 -0
- package/i18n/unprocessed-code.js.txt +12 -0
- package/package.json +7 -3
- package/vite.config.js +6 -1
package/i18n/index.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
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 locale from "@aligov/global-locale";
|
|
9
|
+
import stringFormat from "@aligov/global-string-format";
|
|
10
|
+
import strings from "./strings";
|
|
11
|
+
|
|
12
|
+
// 获取远程 国际化配置
|
|
13
|
+
const remoteStrings = window.__i18n_getRemoteMessageStrings__?.() || {};
|
|
14
|
+
// merge 到本地
|
|
15
|
+
Object.keys(remoteStrings).reduce((strings, key) => {
|
|
16
|
+
strings[key] = Object.assign(strings[key] || {}, remoteStrings[key]);
|
|
17
|
+
}, strings);
|
|
18
|
+
|
|
19
|
+
let language; // Current language
|
|
20
|
+
let intl; // Instance of intl-universal. Create by provideIntl
|
|
21
|
+
/**
|
|
22
|
+
* update instance of intl universal
|
|
23
|
+
*/
|
|
24
|
+
async function update() {
|
|
25
|
+
const { lang } = locale.getLocale();
|
|
26
|
+
language = lang;
|
|
27
|
+
intl = await stringFormat.init(lang, strings);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* change current language
|
|
32
|
+
* @param {string} langTag language tag config above
|
|
33
|
+
*/
|
|
34
|
+
async function change(langTag) {
|
|
35
|
+
locale.setLang(langTag);
|
|
36
|
+
await update();
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Format string by key
|
|
40
|
+
* For example:
|
|
41
|
+
* i18n.get('jsx.home.title'),
|
|
42
|
+
* i18n.get({
|
|
43
|
+
* id: 'jsx.home.hello',
|
|
44
|
+
* defaultMessage: 'Hello {name}' // not required
|
|
45
|
+
* },{
|
|
46
|
+
* name: 'Alice'
|
|
47
|
+
* })
|
|
48
|
+
* More syntax: https://formatjs.io/guides/message-syntax/
|
|
49
|
+
* @param {string|object} id key or object
|
|
50
|
+
* @param {object} variable variable for id
|
|
51
|
+
* @return {string} format message
|
|
52
|
+
*/
|
|
53
|
+
function get(id, variable) {
|
|
54
|
+
if (!intl) update();
|
|
55
|
+
if (typeof id === "string") {
|
|
56
|
+
return stringFormat.format(
|
|
57
|
+
{
|
|
58
|
+
id: id,
|
|
59
|
+
},
|
|
60
|
+
variable
|
|
61
|
+
);
|
|
62
|
+
} else if (typeof id === "object" && id.dm) {
|
|
63
|
+
id.defaultMessage = id.dm;
|
|
64
|
+
}
|
|
65
|
+
return stringFormat.format(
|
|
66
|
+
{
|
|
67
|
+
id: id.id,
|
|
68
|
+
defaultString: id.dm,
|
|
69
|
+
},
|
|
70
|
+
variable
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// 添加到语言文件中去
|
|
75
|
+
function addMessage(strs) {
|
|
76
|
+
for (let key in strs) {
|
|
77
|
+
if (!strings[key]) {
|
|
78
|
+
strings[key] = {};
|
|
79
|
+
}
|
|
80
|
+
Object.assign(strings[key], strs[key]);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* set the first hng cookie
|
|
85
|
+
* //! IMPORTANT remove this after published, only for demo to start up
|
|
86
|
+
* //! IMPORTANT 项目第一次启动后请删除下边的逻辑,这个逻辑只是为了第一次运行的时候,项目能够切换到英文
|
|
87
|
+
*/
|
|
88
|
+
// Delete start
|
|
89
|
+
// change("en-US");
|
|
90
|
+
// change("zh-CN");
|
|
91
|
+
// Delete end
|
|
92
|
+
|
|
93
|
+
// window.locale = locale;
|
|
94
|
+
export default {
|
|
95
|
+
tr(format) {
|
|
96
|
+
if (format && format.id) {
|
|
97
|
+
return get(format);
|
|
98
|
+
}
|
|
99
|
+
return get(format);
|
|
100
|
+
},
|
|
101
|
+
get,
|
|
102
|
+
update,
|
|
103
|
+
change,
|
|
104
|
+
language,
|
|
105
|
+
locale,
|
|
106
|
+
addMessage,
|
|
107
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"确定离开当前页面吗?": "Are you sure you want to leave the current page?",
|
|
3
|
+
"远": "Far",
|
|
4
|
+
"近": "Near",
|
|
5
|
+
"返回首页": "Return to Home Page",
|
|
6
|
+
"加载中": "Loading",
|
|
7
|
+
"没有更多了~": "No more ~",
|
|
8
|
+
"任务": "Task",
|
|
9
|
+
"请选择": "Please select",
|
|
10
|
+
"搜索": "Search",
|
|
11
|
+
"取消": "Cancel",
|
|
12
|
+
"SearchOutline-编组": "SearchOutline-grouping",
|
|
13
|
+
"SearchOutline-矩形": "SearchOutline-rectangle",
|
|
14
|
+
"查询": "Query",
|
|
15
|
+
"请输入": "Please enter",
|
|
16
|
+
"货品编码:": "Product Code:",
|
|
17
|
+
"实际数量": "Actual quantity",
|
|
18
|
+
"/计划数量": "/Planned quantity",
|
|
19
|
+
"InputFieldV2 中 componentProps 提供的 onChange 和 onBlur 会被 外层覆盖,不会执行": "InputFieldV2 and onBlur provided by componentProps in onChange will be covered by the outer layer and will not be executed.",
|
|
20
|
+
"InputFieldV2 中 validateTriggerType 应为 onChange 或 onBlur": "InputFieldV2 in validateTriggerType should be onChange or onBlur",
|
|
21
|
+
"确认": "Confirm",
|
|
22
|
+
"扫描/输入": "Scan/input",
|
|
23
|
+
"输入以筛选": "Enter to filter",
|
|
24
|
+
"开始作业": "Start Job",
|
|
25
|
+
"必填": "Required"
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"确定离开当前页面吗?": "确定离开当前页面吗?",
|
|
3
|
+
"远": "远",
|
|
4
|
+
"近": "近",
|
|
5
|
+
"返回首页": "返回首页",
|
|
6
|
+
"加载中": "加载中",
|
|
7
|
+
"没有更多了~": "没有更多了~",
|
|
8
|
+
"任务": "任务",
|
|
9
|
+
"请选择": "请选择",
|
|
10
|
+
"搜索": "搜索",
|
|
11
|
+
"取消": "取消",
|
|
12
|
+
"SearchOutline-编组": "SearchOutline-编组",
|
|
13
|
+
"SearchOutline-矩形": "SearchOutline-矩形",
|
|
14
|
+
"查询": "查询",
|
|
15
|
+
"请输入": "请输入",
|
|
16
|
+
"货品编码:": "货品编码:",
|
|
17
|
+
"实际数量": "实际数量",
|
|
18
|
+
"/计划数量": "/计划数量",
|
|
19
|
+
"InputFieldV2 中 componentProps 提供的 onChange 和 onBlur 会被 外层覆盖,不会执行": "InputFieldV2 中 componentProps 提供的 onChange 和 onBlur 会被 外层覆盖,不会执行",
|
|
20
|
+
"InputFieldV2 中 validateTriggerType 应为 onChange 或 onBlur": "InputFieldV2 中 validateTriggerType 应为 onChange 或 onBlur",
|
|
21
|
+
"确认": "确认",
|
|
22
|
+
"扫描/输入": "扫描/输入",
|
|
23
|
+
"输入以筛选": "输入以筛选",
|
|
24
|
+
"开始作业": "开始作业",
|
|
25
|
+
"必填": "必填"
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
-------------------------------------------------------------------------------
|
|
3
|
+
-------------------------- 👇 重要信息👇 --------------------------------
|
|
4
|
+
由于这些模板较为复杂,提取后会造成翻译不准确,所以建议进行手动处理
|
|
5
|
+
下边列出了所有模板的位置,你也可以在后边这个文件找他们: /Users/qigu/code/android-pda-components/i18n/unprocessed-code.js.txt
|
|
6
|
+
后边的这个文档提供了怎么处理处理这些模板的方法:
|
|
7
|
+
http://gitlab.alibaba-inc.com/parrot/parrot-tool-must/blob/master/doc/es6tempale.md
|
|
8
|
+
-------------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
`进度:${footer?.realNum / footer?.planNum * 100}%`
|
|
11
|
+
at (/Users/qigu/code/android-pda-components/packages/components-v2/card-v2/index.jsx:149:14)
|
|
12
|
+
|
package/package.json
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cniot/android-pda-components",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./es/index.cjs.js",
|
|
6
6
|
"module": "./es/index.es.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"dev": "vite",
|
|
9
|
-
"
|
|
9
|
+
"i18n": "must",
|
|
10
|
+
"build": "vite build --config vite.config.js",
|
|
11
|
+
"build:doc": "vite build --config vite.config.doc.js",
|
|
10
12
|
"doc": "vite --config vite.config.doc.js"
|
|
11
13
|
},
|
|
12
|
-
"type": "module",
|
|
13
14
|
"author": "",
|
|
14
15
|
"license": "ISC",
|
|
15
16
|
"dependencies": {
|
|
17
|
+
"@aligov/global-locale": "^1.0.5",
|
|
18
|
+
"@aligov/global-string-format": "^1.0.7",
|
|
16
19
|
"EventEmitter": "^1.0.0",
|
|
17
20
|
"ahooks": "^2.10.11",
|
|
18
21
|
"antd-mobile": "^5.15.0",
|
|
@@ -32,6 +35,7 @@
|
|
|
32
35
|
"vite-plugin-plain-text": "^1.1.4",
|
|
33
36
|
"less": "^4.1.1",
|
|
34
37
|
"history": "^5.0.1",
|
|
38
|
+
"@ali/parrot-tool-must": "^2.3.9",
|
|
35
39
|
"react": "^17.0.2",
|
|
36
40
|
"react-dom": "^17.0.2"
|
|
37
41
|
},
|
package/vite.config.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
1
3
|
export default {
|
|
2
|
-
server:{
|
|
4
|
+
server: {
|
|
3
5
|
// 如果想要在其他电脑上访问本机的服务,可以打开以下 host 字段
|
|
4
6
|
host: "0.0.0.0",
|
|
5
7
|
},
|
|
@@ -24,4 +26,7 @@ export default {
|
|
|
24
26
|
},
|
|
25
27
|
},
|
|
26
28
|
},
|
|
29
|
+
resolve: {
|
|
30
|
+
alias: [{ find: /^\$i18n/, replacement: path.resolve(__dirname, "i18n") }],
|
|
31
|
+
},
|
|
27
32
|
};
|