@baic/yolk-cli 2.1.0-alpha.89 → 2.1.0-alpha.90
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/package.json +2 -2
- package/templates/miniprogram/src/app.tsx +4 -6
- package/templates/miniprogram/src/types/user.d.ts +4 -2
- package/templates/umi-mobile/src/types/user.d.ts +2 -2
- package/templates/umi-mobile-h5+app/src/types/user.d.ts +2 -2
- package/templates/umi-mobile-native/src/common/Xprinter.ts +4 -4
- package/templates/umi-mobile-native/src/common/bluetooth.ts +2 -2
- package/templates/umi-mobile-native/src/types/user.d.ts +2 -2
- package/templates/umi-web/src/types/user.d.ts +2 -2
- package/templates/umi-web-screen/src/components/resize-container/index.tsx +6 -7
- package/templates/umi-web-screen/src/layouts/controller/index.tsx +5 -9
- package/templates/umi-web-screen/src/pages/template/controller/index.tsx +11 -12
- package/templates/umi-web-screen/src/types/user.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baic/yolk-cli",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.90",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/303394539/yolk.git"
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "c76b9bcbe03f19781d06275061f8434e8c65849d"
|
|
57
57
|
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import './app.scss';
|
|
2
|
+
|
|
3
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
4
|
|
|
3
5
|
import { Provider } from '@baic/yolk-miniprogram';
|
|
4
6
|
|
|
5
7
|
import request from '@/common/request';
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
interface Props {
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
}
|
|
9
|
+
type Props = PropsWithChildren<Record<string, unknown>>;
|
|
12
10
|
|
|
13
11
|
export default ({ children }: Props) => (
|
|
14
12
|
<Provider request={request} inputMaxLength={40}>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type User = {
|
|
2
2
|
id?: string;
|
|
3
|
-
}
|
|
3
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type User = {
|
|
2
2
|
id?: string;
|
|
3
|
-
}
|
|
3
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import bridge from './bridge';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type Options = {
|
|
4
4
|
deviceId?: string;
|
|
5
5
|
commands?: PrintCommand[];
|
|
6
|
-
}
|
|
6
|
+
};
|
|
7
7
|
type FunctionName = 'connect' | 'disconnect' | 'print' | 'getBondedDevices';
|
|
8
8
|
|
|
9
9
|
export type PrintCommand = Record<
|
|
@@ -25,13 +25,13 @@ export type PrintCommand = Record<
|
|
|
25
25
|
url?: string;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
export
|
|
28
|
+
export type BondedDevice = {
|
|
29
29
|
name: string;
|
|
30
30
|
deviceId: string;
|
|
31
31
|
bondState: number;
|
|
32
32
|
type: number;
|
|
33
33
|
alias?: string;
|
|
34
|
-
}
|
|
34
|
+
};
|
|
35
35
|
|
|
36
36
|
const Xprinter = {
|
|
37
37
|
exec<T = object>(functionName: FunctionName, options?: Options) {
|
|
@@ -4,14 +4,14 @@ import { Toast } from 'antd-mobile';
|
|
|
4
4
|
|
|
5
5
|
import Util from '@/common/util';
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export type BluetoothOptions = {
|
|
8
8
|
autoReconnection?: boolean;
|
|
9
9
|
onWriteValue?: () => ArrayBuffer;
|
|
10
10
|
writeInterval?: number;
|
|
11
11
|
readInterval?: number;
|
|
12
12
|
reconnectInterval?: number;
|
|
13
13
|
notifyInterval?: number;
|
|
14
|
-
}
|
|
14
|
+
};
|
|
15
15
|
|
|
16
16
|
class Bluetooth {
|
|
17
17
|
private options: BluetoothOptions = {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type User = {
|
|
2
2
|
id?: string;
|
|
3
|
-
}
|
|
3
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type User = {
|
|
2
2
|
id?: string;
|
|
3
|
-
}
|
|
3
|
+
};
|
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import _ from 'lodash';
|
|
3
2
|
import classnames from 'classnames';
|
|
4
3
|
|
|
5
|
-
import
|
|
4
|
+
import * as React from 'react';
|
|
6
5
|
|
|
7
6
|
import { useSize } from 'ahooks';
|
|
8
7
|
|
|
9
8
|
import style from './style.less';
|
|
10
9
|
|
|
11
|
-
export
|
|
10
|
+
export type ContainerInstance = {
|
|
12
11
|
zoom: number;
|
|
13
12
|
width: number;
|
|
14
13
|
height: number;
|
|
15
14
|
container?: HTMLDivElement | null;
|
|
16
|
-
}
|
|
15
|
+
};
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
type ResizeContainerProps = {
|
|
19
18
|
children?: React.ReactNode | ((e: ContainerInstance) => React.ReactNode);
|
|
20
19
|
className?: string;
|
|
21
20
|
getContainer?: () => HTMLElement | React.RefObject<HTMLElement>;
|
|
22
21
|
onResize?: (e: ContainerInstance) => void;
|
|
23
22
|
containerParentElementZoom?: boolean | number;
|
|
24
23
|
containerZoom?: boolean | number;
|
|
25
|
-
}
|
|
24
|
+
};
|
|
26
25
|
|
|
27
26
|
const Component = React.forwardRef<ContainerInstance, ResizeContainerProps>(
|
|
28
27
|
(
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
3
2
|
import { createContext, useEffect, useRef, useState } from 'react';
|
|
4
3
|
|
|
5
|
-
import useSize from '@/hooks/use-size';
|
|
6
|
-
|
|
7
4
|
import { RootWinWidth } from '@/constants';
|
|
5
|
+
import useSize from '@/hooks/use-size';
|
|
8
6
|
|
|
9
|
-
export
|
|
7
|
+
export type Value = {
|
|
10
8
|
layout: {
|
|
11
9
|
16_9: {
|
|
12
10
|
type: 1;
|
|
13
11
|
};
|
|
14
12
|
};
|
|
15
|
-
}
|
|
13
|
+
};
|
|
16
14
|
|
|
17
15
|
export const context = createContext<Value>({
|
|
18
16
|
layout: {
|
|
@@ -22,9 +20,7 @@ export const context = createContext<Value>({
|
|
|
22
20
|
},
|
|
23
21
|
});
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
children?: ReactNode;
|
|
27
|
-
}
|
|
23
|
+
type Props = PropsWithChildren<Record<string, unknown>>;
|
|
28
24
|
|
|
29
25
|
const { Provider } = context;
|
|
30
26
|
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import { createContext, useCallback, useEffect,useRef, useState } from 'react';
|
|
2
3
|
|
|
3
4
|
import { useMount, useUnmount } from 'ahooks';
|
|
4
5
|
|
|
5
6
|
import useSize from '@/hooks/use-size';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
children?: React.ReactNode;
|
|
9
|
-
}
|
|
8
|
+
type Props = PropsWithChildren<Record<string, unknown>>;
|
|
10
9
|
|
|
11
10
|
export type Data = Record<string, any>;
|
|
12
11
|
|
|
13
|
-
export
|
|
12
|
+
export type Value = {
|
|
14
13
|
data: Data;
|
|
15
14
|
layout: {
|
|
16
15
|
16_9: {
|
|
17
16
|
type: 1;
|
|
18
17
|
};
|
|
19
18
|
};
|
|
20
|
-
}
|
|
19
|
+
};
|
|
21
20
|
|
|
22
|
-
export const context =
|
|
21
|
+
export const context = createContext<Value>({
|
|
23
22
|
data: {},
|
|
24
23
|
layout: {
|
|
25
24
|
16_9: {
|
|
@@ -34,11 +33,11 @@ const Component = ({ children }: Props) => {
|
|
|
34
33
|
const [size] = useSize();
|
|
35
34
|
|
|
36
35
|
// ref
|
|
37
|
-
const timeoutID =
|
|
36
|
+
const timeoutID = useRef<NodeJS.Timeout>();
|
|
38
37
|
|
|
39
38
|
// data
|
|
40
|
-
const [data, setData] =
|
|
41
|
-
const initDataHandler =
|
|
39
|
+
const [data, setData] = useState<Data>({});
|
|
40
|
+
const initDataHandler = useCallback(async () => {
|
|
42
41
|
await Promise.all([]);
|
|
43
42
|
const $data: Data = {};
|
|
44
43
|
setData({
|
|
@@ -49,7 +48,7 @@ const Component = ({ children }: Props) => {
|
|
|
49
48
|
}, [data]);
|
|
50
49
|
|
|
51
50
|
// layout
|
|
52
|
-
const [layout, setLayout] =
|
|
51
|
+
const [layout, setLayout] = useState<Value['layout']>({
|
|
53
52
|
16_9: {
|
|
54
53
|
type: 1,
|
|
55
54
|
},
|
|
@@ -62,7 +61,7 @@ const Component = ({ children }: Props) => {
|
|
|
62
61
|
}
|
|
63
62
|
});
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
useEffect(() => {
|
|
66
65
|
setLayout({
|
|
67
66
|
16_9: {
|
|
68
67
|
type: 1,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type User = {
|
|
2
2
|
id?: string;
|
|
3
|
-
}
|
|
3
|
+
};
|