@baic/yolk-cli 2.1.0-alpha.103 → 2.1.0-alpha.105
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/umi-mobile/.umirc.ts.tpl +0 -1
- package/templates/umi-mobile/src/.umi/core/EmptyRoute.tsx +8 -0
- package/templates/umi-mobile/src/.umi/core/defineApp.ts +21 -0
- package/templates/umi-mobile/src/.umi/core/history.ts +70 -0
- package/templates/umi-mobile/src/.umi/core/historyIntelli.ts +132 -0
- package/templates/umi-mobile/src/.umi/core/plugin.ts +83 -0
- package/templates/umi-mobile/src/.umi/core/pluginConfig.d.ts +295 -0
- package/templates/umi-mobile/src/.umi/core/polyfill.ts +191 -0
- package/templates/umi-mobile/src/.umi/core/route.tsx +267 -0
- package/templates/umi-mobile/src/.umi/core/routeProps.js +3 -0
- package/templates/umi-mobile/src/.umi/core/routeProps.ts +4 -0
- package/templates/umi-mobile/src/.umi/core/terminal.ts +62 -0
- package/templates/umi-mobile/src/.umi/exports.ts +51 -0
- package/templates/umi-mobile/src/.umi/plugin-clickToComponent/runtime.tsx +19 -0
- package/templates/umi-mobile/src/.umi/plugin-errorBoundary/runtime.tsx +67 -0
- package/templates/umi-mobile/src/.umi/plugin-hd/runtime.tsx +57 -0
- package/templates/umi-mobile/src/.umi/testBrowser.tsx +91 -0
- package/templates/umi-mobile/src/.umi/tsconfig.json +29 -0
- package/templates/umi-mobile/src/.umi/typings.d.ts +138 -0
- package/templates/umi-mobile/src/.umi/umi.ts +76 -0
- package/templates/umi-mobile/src/app.tsx +2 -2
- package/templates/umi-mobile/src/pages/404.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/BarCode.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/Iconfont.tsx +1 -2
- package/templates/umi-mobile/src/pages/demo/examples/Input.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/List/1.tsx +1 -2
- package/templates/umi-mobile/src/pages/demo/examples/List/2.tsx +1 -1
- package/templates/umi-mobile/src/pages/demo/examples/List/3.tsx +1 -1
- package/templates/umi-mobile/src/pages/demo/examples/List/4.tsx +7 -8
- package/templates/umi-mobile/src/pages/demo/examples/Loading.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/NumberInput/1.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/NumberInput/2.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/NumberInput/3.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/NumberInput/4.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/PagingList/1.tsx +1 -2
- package/templates/umi-mobile/src/pages/demo/examples/QrCode.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/Required.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/TimerButton.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/usePreload.tsx +1 -1
- package/templates/umi-mobile/src/pages/demo/index.tsx +8 -8
- package/templates/umi-mobile/src/pages/index.tsx +0 -2
- package/templates/umi-mobile-h5+app/.umirc.ts.tpl +0 -1
- package/templates/umi-mobile-native/.umirc.ts.tpl +0 -1
- package/templates/umi-web/.umirc.ts.tpl +0 -1
- package/templates/umi-web/src/pages/404.tsx +2 -3
- package/templates/umi-web/src/pages/demo/index.tsx +3 -2
- package/templates/umi-web/src/pages/index.tsx +0 -2
- package/templates/umi-web-screen/.umirc.ts.tpl +0 -1
- package/templates/umi-web-screen/src/components/resize-container/index.tsx +9 -8
- package/templates/umi-web-screen/src/pages/404.tsx +2 -3
- package/templates/umi-web-screen/src/pages/template/components/charts/demo-line/index.tsx +1 -2
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
1
|
import _ from 'lodash';
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import type { FunctionComponent } from 'react';
|
|
4
|
+
import { createElement } from 'react';
|
|
5
|
+
|
|
6
|
+
import { Collapse, Tabs } from 'antd-mobile';
|
|
6
7
|
|
|
7
8
|
import BarCode from './examples/BarCode';
|
|
8
9
|
import Iconfont from './examples/Iconfont';
|
|
@@ -27,7 +28,7 @@ const { Panel } = Collapse;
|
|
|
27
28
|
|
|
28
29
|
const tabs: Record<
|
|
29
30
|
string,
|
|
30
|
-
|
|
31
|
+
FunctionComponent | Record<string, FunctionComponent>
|
|
31
32
|
> = {
|
|
32
33
|
BarCode,
|
|
33
34
|
Iconfont,
|
|
@@ -58,7 +59,7 @@ export default () => {
|
|
|
58
59
|
if (_.isFunction(tab)) {
|
|
59
60
|
return (
|
|
60
61
|
<Tab key={key} title={key}>
|
|
61
|
-
{
|
|
62
|
+
{createElement(tab)}
|
|
62
63
|
</Tab>
|
|
63
64
|
);
|
|
64
65
|
}
|
|
@@ -71,7 +72,7 @@ export default () => {
|
|
|
71
72
|
const tab2 = tab[key2];
|
|
72
73
|
return (
|
|
73
74
|
<Panel key={key2} title={key2}>
|
|
74
|
-
{
|
|
75
|
+
{createElement(tab2)}
|
|
75
76
|
</Panel>
|
|
76
77
|
);
|
|
77
78
|
})}
|
|
@@ -79,9 +80,8 @@ export default () => {
|
|
|
79
80
|
</Tab>
|
|
80
81
|
);
|
|
81
82
|
}
|
|
83
|
+
return null;
|
|
82
84
|
})}
|
|
83
85
|
</Tabs>
|
|
84
86
|
);
|
|
85
87
|
};
|
|
86
|
-
|
|
87
|
-
// export default () => <PagingList_1 />;
|
|
@@ -103,7 +103,7 @@ export default () => {
|
|
|
103
103
|
const keys = Object.keys(tabs);
|
|
104
104
|
return (
|
|
105
105
|
<Tabs defaultActiveKey={keys[0]}>
|
|
106
|
-
{keys.map(key => {
|
|
106
|
+
{keys.map((key) => {
|
|
107
107
|
const tab = tabs[key];
|
|
108
108
|
if (_.isFunction(tab)) {
|
|
109
109
|
return (
|
|
@@ -117,7 +117,7 @@ export default () => {
|
|
|
117
117
|
return (
|
|
118
118
|
<TabPane key={key} tab={key}>
|
|
119
119
|
<Tabs defaultActiveKey={keys2[0]}>
|
|
120
|
-
{keys2.map(key2 => {
|
|
120
|
+
{keys2.map((key2) => {
|
|
121
121
|
const tab2 = tab[key2];
|
|
122
122
|
return (
|
|
123
123
|
<TabPane key={key2} tab={key2}>
|
|
@@ -129,6 +129,7 @@ export default () => {
|
|
|
129
129
|
</TabPane>
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
|
+
return null;
|
|
132
133
|
})}
|
|
133
134
|
</Tabs>
|
|
134
135
|
);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import type { ReactNode, RefObject } from 'react';
|
|
5
|
+
import { forwardRef, useImperativeHandle, useMemo, useRef } from 'react';
|
|
5
6
|
|
|
6
7
|
import { useSize } from 'ahooks';
|
|
7
8
|
|
|
@@ -15,15 +16,15 @@ export type ContainerInstance = {
|
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
type ResizeContainerProps = {
|
|
18
|
-
children?:
|
|
19
|
+
children?: ReactNode | ((e: ContainerInstance) => ReactNode);
|
|
19
20
|
className?: string;
|
|
20
|
-
getContainer?: () => HTMLElement |
|
|
21
|
+
getContainer?: () => HTMLElement | RefObject<HTMLElement>;
|
|
21
22
|
onResize?: (e: ContainerInstance) => void;
|
|
22
23
|
containerParentElementZoom?: boolean | number;
|
|
23
24
|
containerZoom?: boolean | number;
|
|
24
25
|
};
|
|
25
26
|
|
|
26
|
-
const Component =
|
|
27
|
+
const Component = forwardRef<ContainerInstance, ResizeContainerProps>(
|
|
27
28
|
(
|
|
28
29
|
{
|
|
29
30
|
children,
|
|
@@ -35,13 +36,13 @@ const Component = React.forwardRef<ContainerInstance, ResizeContainerProps>(
|
|
|
35
36
|
},
|
|
36
37
|
ref,
|
|
37
38
|
) => {
|
|
38
|
-
const containerRef =
|
|
39
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
39
40
|
const { width = 0, height = 0 } = useSize(
|
|
40
41
|
_.isFunction(getContainer)
|
|
41
42
|
? getContainer()
|
|
42
43
|
: () => containerRef.current?.parentElement || null,
|
|
43
44
|
) || { width: 0, height: 0 };
|
|
44
|
-
const instance =
|
|
45
|
+
const instance = useMemo(() => {
|
|
45
46
|
let res = {
|
|
46
47
|
width,
|
|
47
48
|
height,
|
|
@@ -72,8 +73,8 @@ const Component = React.forwardRef<ContainerInstance, ResizeContainerProps>(
|
|
|
72
73
|
}
|
|
73
74
|
return res;
|
|
74
75
|
}, [width, height, onResize, containerParentElementZoom, containerZoom]);
|
|
75
|
-
|
|
76
|
-
const childrenMemo =
|
|
76
|
+
useImperativeHandle(ref, () => instance);
|
|
77
|
+
const childrenMemo = useMemo(() => {
|
|
77
78
|
const { width: containerWidth, height: containerHeight } = instance;
|
|
78
79
|
if (0 === containerWidth || 0 === containerHeight) {
|
|
79
80
|
return null;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
1
|
import { Line } from '@ant-design/plots';
|
|
4
2
|
|
|
5
3
|
import { ResizeContainer } from '@/components';
|
|
@@ -8,6 +6,7 @@ const Component = () => (
|
|
|
8
6
|
<ResizeContainer>
|
|
9
7
|
{({ width, height }) => (
|
|
10
8
|
<Line
|
|
9
|
+
supportCSSTransform
|
|
11
10
|
width={width}
|
|
12
11
|
height={height}
|
|
13
12
|
xField="date"
|