@kengic/uni 0.3.4-beta.0 → 0.3.4-beta.1
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/dist/service/index.ts +63 -0
- package/package.json +22 -19
package/dist/service/index.ts
CHANGED
|
@@ -1 +1,64 @@
|
|
|
1
|
+
import { ref, Ref } from 'vue';
|
|
2
|
+
import { v4 as uuid } from 'uuid';
|
|
3
|
+
|
|
1
4
|
export * from './http-client';
|
|
5
|
+
|
|
6
|
+
type IUseKgAutoFocusInput = {
|
|
7
|
+
/** 文本框的内容. */
|
|
8
|
+
text: Ref<string>;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 自动聚焦的文本框.
|
|
13
|
+
*/
|
|
14
|
+
function useKgAutoFocusInput(): IUseKgAutoFocusInput {
|
|
15
|
+
const text = ref('');
|
|
16
|
+
|
|
17
|
+
/* #ifdef APP-PLUS */
|
|
18
|
+
const inputID = uuid();
|
|
19
|
+
const view = new plus.nativeObj.View!(uuid(), {
|
|
20
|
+
opacity: 0,
|
|
21
|
+
top: '0px',
|
|
22
|
+
left: '0px',
|
|
23
|
+
height: '1px',
|
|
24
|
+
width: '1px',
|
|
25
|
+
});
|
|
26
|
+
view.drawInput(
|
|
27
|
+
{
|
|
28
|
+
top: '0px',
|
|
29
|
+
left: '0px',
|
|
30
|
+
width: '1px',
|
|
31
|
+
height: '1px',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
fontSize: '0px',
|
|
35
|
+
borderWidth: '0px',
|
|
36
|
+
onBlur() {
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
clearInterval(interval);
|
|
39
|
+
view.close();
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
inputID,
|
|
43
|
+
);
|
|
44
|
+
view.show();
|
|
45
|
+
|
|
46
|
+
uni.onKeyboardHeightChange((result) => {
|
|
47
|
+
if (result.height > 0) {
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
view.setInputFocusById(inputID, true);
|
|
51
|
+
}, 100);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
const interval = setInterval(() => {
|
|
57
|
+
text.value = view.getInputValueById(inputID) ?? '';
|
|
58
|
+
}, 10);
|
|
59
|
+
/* #endif */
|
|
60
|
+
|
|
61
|
+
return { text };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { type IUseKgAutoFocusInput, useKgAutoFocusInput };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kengic/uni",
|
|
3
|
-
"version": "0.3.4-beta.
|
|
3
|
+
"version": "0.3.4-beta.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "rimraf dist && vue-tsc && vite build",
|
|
6
6
|
"build:dev": "rimraf dist && vue-tsc && vite build --mode development",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"-------------------- D": "",
|
|
15
15
|
"bump-to:luotao.wms-pda": "tsx scripts/bump-to.luotao.wms-pda.ts",
|
|
16
16
|
"copy-to:luotao.wms-pda": "npm run build:dev && tsx scripts/copy-to.luotao.wms-pda.ts",
|
|
17
|
+
"copy-to:luotao.wms-pda--focus": "npm run build:dev && tsx scripts/copy-to.luotao.wms-pda--focus.ts",
|
|
17
18
|
"--------------------": "",
|
|
18
19
|
"gen:apis:WMS": "kengic-pont generate-apis --config kg.config.ts --origin WMS",
|
|
19
20
|
"bump-version:beta": "tsx scripts/bump.ts beta",
|
|
@@ -24,35 +25,37 @@
|
|
|
24
25
|
"publish:npm": "npmrc kengic && npm publish ./ --registry https://registry.npmjs.org/ --access public"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@ant-design/icons-vue": "6.1.0",
|
|
28
|
-
"@iconify-icons/ant-design": "1.2.5",
|
|
29
|
-
"@iconify/vue": "4.1.1",
|
|
30
|
-
"@vueuse/core": "8.9.4",
|
|
31
|
-
"@vueuse/shared": "8.9.4",
|
|
32
|
-
"lodash-es": "4.17.21",
|
|
33
|
-
"pinia": "2.0.35",
|
|
34
|
-
"
|
|
28
|
+
"@ant-design/icons-vue": "~6.1.0",
|
|
29
|
+
"@iconify-icons/ant-design": "~1.2.5",
|
|
30
|
+
"@iconify/vue": "~4.1.1",
|
|
31
|
+
"@vueuse/core": "~8.9.4",
|
|
32
|
+
"@vueuse/shared": "~8.9.4",
|
|
33
|
+
"lodash-es": "~4.17.21",
|
|
34
|
+
"pinia": "~2.0.35",
|
|
35
|
+
"uuid": "~9.0.1",
|
|
36
|
+
"vue": "~3.2.47"
|
|
35
37
|
},
|
|
36
38
|
"devDependencies": {
|
|
37
|
-
"@dcloudio/types": "3.3.3",
|
|
38
|
-
"@kengic/pont": "1.2.10-beta.44",
|
|
39
|
+
"@dcloudio/types": "~3.3.3",
|
|
40
|
+
"@kengic/pont": "~1.2.10-beta.44",
|
|
39
41
|
"@types/lodash-es": "~4.17.7",
|
|
40
42
|
"@types/node": "~18.14.6",
|
|
41
43
|
"@types/semver": "~7.3.13",
|
|
42
|
-
"@
|
|
44
|
+
"@types/uuid": "~9.0.7",
|
|
45
|
+
"@vitejs/plugin-vue": "~4.2.1",
|
|
43
46
|
"chalk": "~4.1.2",
|
|
44
47
|
"less": "~4.1.3",
|
|
45
48
|
"prettier": "~2.8.4",
|
|
46
49
|
"rimraf": "~3.0.2",
|
|
47
50
|
"rollup": "~2.79.1",
|
|
48
|
-
"sass": "1.62.1",
|
|
49
|
-
"sass-loader": "10.4.1",
|
|
51
|
+
"sass": "~1.62.1",
|
|
52
|
+
"sass-loader": "~10.4.1",
|
|
50
53
|
"semver": "~7.3.8",
|
|
51
|
-
"tsx": "3.12.7",
|
|
52
|
-
"typescript": "4.9.5",
|
|
53
|
-
"vite": "4.3.4",
|
|
54
|
-
"vue": "3.2.47",
|
|
55
|
-
"vue-tsc": "1.6.4"
|
|
54
|
+
"tsx": "~3.12.7",
|
|
55
|
+
"typescript": "~4.9.5",
|
|
56
|
+
"vite": "~4.3.4",
|
|
57
|
+
"vue": "~3.2.47",
|
|
58
|
+
"vue-tsc": "~1.6.4"
|
|
56
59
|
},
|
|
57
60
|
"main": "./dist/kengic-uni.js",
|
|
58
61
|
"module": "./dist/kengic-uni.js",
|