@baic/yolk-cli 2.0.1-alpha.1 → 2.0.1-alpha.10
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/{templates/web/base/LICENSE → LICENSE} +1 -1
- package/README.md +6 -6
- package/{bin → lib}/index.d.ts +0 -0
- package/lib/index.js +2 -0
- package/package.json +22 -21
- package/templates/{miniapp/base/.editorconfig.tpl → miniprogram/.editorconfig} +0 -0
- package/templates/miniprogram/.eslintrc +6 -0
- package/templates/{miniapp/base/.prettierignore.tpl → miniprogram/.prettierignore} +0 -0
- package/templates/{miniapp/base/.prettierrc.tpl → miniprogram/.prettierrc} +0 -0
- package/templates/{miniapp/base → miniprogram}/.stylelintrc.json +1 -1
- package/templates/{miniapp/base → miniprogram}/LICENSE +0 -0
- package/templates/{mobile/base → miniprogram}/README.md.tpl +5 -1
- package/templates/miniprogram/babel.config.js +3 -0
- package/templates/miniprogram/config/index.ts.tpl +11 -0
- package/templates/miniprogram/global.d.ts +33 -0
- package/templates/{miniapp/base → miniprogram}/package.json.tpl +2 -3
- package/templates/{miniapp/base → miniprogram}/project.config.json.tpl +18 -3
- package/templates/{miniapp/base → miniprogram}/project.tt.json.tpl +0 -0
- package/templates/{miniapp/base → miniprogram}/src/app.config.ts +1 -3
- package/templates/{miniapp/base → miniprogram}/src/app.scss +0 -0
- package/templates/miniprogram/src/app.tsx +19 -0
- package/templates/{miniapp/base → miniprogram}/src/common/request.ts +1 -1
- package/templates/{web/base → miniprogram}/src/common/util.ts +1 -1
- package/templates/{miniapp/base → miniprogram}/src/components/index.ts +0 -0
- package/templates/miniprogram/src/constants.ts +1 -0
- package/templates/{miniapp/base → miniprogram}/src/hooks/index.ts +0 -0
- package/templates/{miniapp/base → miniprogram}/src/images/empty.gif +0 -0
- package/templates/{miniapp/base → miniprogram}/src/index.html +0 -0
- package/templates/miniprogram/src/pages/demo/examples/Input.tsx +3 -0
- package/templates/miniprogram/src/pages/demo/examples/MobileInput.tsx +3 -0
- package/templates/miniprogram/src/pages/demo/examples/MoneyInput.tsx +3 -0
- package/templates/miniprogram/src/pages/demo/examples/NumberInput.tsx +3 -0
- package/templates/miniprogram/src/pages/demo/examples/Textarea.tsx +3 -0
- package/templates/miniprogram/src/pages/demo/examples/TimerButton.tsx +3 -0
- package/templates/miniprogram/src/pages/demo/examples/usePreload.tsx +10 -0
- package/templates/miniprogram/src/pages/demo/index.config.ts +5 -0
- package/templates/{miniapp/base/src/pages/index → miniprogram/src/pages/demo}/index.module.scss +0 -0
- package/templates/miniprogram/src/pages/demo/index.tsx +44 -0
- package/templates/{miniapp/base → miniprogram}/src/pages/index/index.config.ts +0 -0
- package/templates/miniprogram/src/pages/index/index.module.scss +3 -0
- package/templates/{miniapp/base → miniprogram}/src/pages/index/index.tsx +1 -3
- package/templates/miniprogram/src/theme.scss +4 -0
- package/templates/{miniapp/base → miniprogram}/src/types/user.d.ts +0 -0
- package/templates/{miniapp/base → miniprogram}/tsconfig.json +3 -9
- package/templates/mobile/{base/.editorconfig.tpl → .editorconfig} +0 -0
- package/templates/mobile/{base/.eslintrc.tpl → .eslintrc} +0 -0
- package/templates/mobile/{base/.prettierignore.tpl → .prettierignore} +0 -0
- package/templates/mobile/{base/.prettierrc.tpl → .prettierrc} +0 -0
- package/templates/mobile/{base/.stylelintrc.json → .stylelintrc.json} +1 -1
- package/templates/mobile/{base/.umirc.ts.tpl → .umirc.ts.tpl} +1 -1
- package/templates/mobile/{base/LICENSE → LICENSE} +0 -0
- package/templates/{miniapp/base → mobile}/README.md.tpl +6 -2
- package/templates/{web/base → mobile}/package.json.tpl +2 -3
- package/templates/mobile/{base/public → public}/favicon.ico +0 -0
- package/templates/mobile/src/app.tsx +24 -0
- package/templates/mobile/src/common/request.ts +3 -0
- package/templates/{miniapp/base → mobile}/src/common/util.ts +1 -1
- package/templates/mobile/{base/src → src}/components/index.ts +0 -0
- package/templates/mobile/{base/src → src}/global.less +1 -1
- package/templates/mobile/src/layouts/index.tsx +4 -0
- package/templates/mobile/src/pages/404.tsx +10 -0
- package/templates/mobile/src/pages/demo/examples/BarCode.tsx +4 -0
- package/templates/mobile/src/pages/demo/examples/Iconfont.tsx +18 -0
- package/templates/mobile/src/pages/demo/examples/Loading.tsx +12 -0
- package/templates/mobile/src/pages/demo/examples/QrCode.tsx +4 -0
- package/templates/mobile/src/pages/demo/examples/Required.tsx +4 -0
- package/templates/mobile/src/pages/demo/examples/TimerButton.tsx +4 -0
- package/templates/mobile/src/pages/demo/examples/usePreload.tsx +9 -0
- package/templates/mobile/src/pages/demo/index.tsx +39 -0
- package/templates/mobile/src/pages/index.tsx +3 -0
- package/templates/mobile/{base/src → src}/types/user.d.ts +1 -1
- package/templates/{web/base → mobile}/tsconfig.json +2 -2
- package/templates/mobile/typings.d.ts +16 -0
- package/templates/web/{base/.editorconfig.tpl → .editorconfig} +0 -0
- package/templates/web/{base/.eslintrc.tpl → .eslintrc} +0 -0
- package/templates/web/{base/.prettierignore.tpl → .prettierignore} +0 -0
- package/templates/web/{base/.prettierrc.tpl → .prettierrc} +0 -0
- package/templates/web/{base/.stylelintrc.json → .stylelintrc.json} +1 -1
- package/templates/web/.umirc.ts +6 -0
- package/templates/web/LICENSE +21 -0
- package/templates/web/{base/README.md.tpl → README.md.tpl} +6 -2
- package/templates/{mobile/base → web}/package.json.tpl +2 -3
- package/templates/web/{base/public → public}/favicon.ico +0 -0
- package/templates/web/src/app.tsx +25 -0
- package/templates/web/src/common/request.ts +3 -0
- package/templates/{mobile/base → web}/src/common/util.ts +1 -1
- package/templates/web/{base/src → src}/components/index.ts +0 -0
- package/templates/web/{base/src → src}/global.less +1 -1
- package/templates/web/src/layouts/index.tsx +4 -0
- package/templates/web/{base/src → src}/pages/404.tsx +0 -0
- package/templates/web/src/pages/demo/examples/BankInput.tsx +14 -0
- package/templates/web/src/pages/demo/examples/BarCode.tsx +4 -0
- package/templates/web/src/pages/demo/examples/Collapse.tsx +4 -0
- package/templates/web/src/pages/demo/examples/DatePicker.tsx +4 -0
- package/templates/web/src/pages/demo/examples/Flex.tsx +10 -0
- package/templates/web/src/pages/demo/examples/Grid/1.tsx +25 -0
- package/templates/web/src/pages/demo/examples/Grid/2.tsx +26 -0
- package/templates/web/src/pages/demo/examples/Grid/3.tsx +37 -0
- package/templates/web/src/pages/demo/examples/Grid/4.tsx +44 -0
- package/templates/web/src/pages/demo/examples/Grid/5.tsx +37 -0
- package/templates/web/src/pages/demo/examples/Grid/6.tsx +28 -0
- package/templates/web/src/pages/demo/examples/Iconfont.tsx +18 -0
- package/templates/web/src/pages/demo/examples/ImagePreview.tsx +20 -0
- package/templates/web/src/pages/demo/examples/Input/1.tsx +4 -0
- package/templates/web/src/pages/demo/examples/Input/2.tsx +80 -0
- package/templates/web/src/pages/demo/examples/LinkButton/1.tsx +4 -0
- package/templates/web/src/pages/demo/examples/LinkButton/2.tsx +9 -0
- package/templates/web/src/pages/demo/examples/LinkButton/3.tsx +12 -0
- package/templates/web/src/pages/demo/examples/Loading.tsx +12 -0
- package/templates/web/src/pages/demo/examples/MobileInput.tsx +4 -0
- package/templates/web/src/pages/demo/examples/NumberInput.tsx +4 -0
- package/templates/web/src/pages/demo/examples/QrCode.tsx +4 -0
- package/templates/web/src/pages/demo/examples/RangeNumber/1.tsx +4 -0
- package/templates/web/src/pages/demo/examples/RangeNumber/2.tsx +16 -0
- package/templates/web/src/pages/demo/examples/Required.tsx +4 -0
- package/templates/web/src/pages/demo/examples/SearchLayout.tsx +46 -0
- package/templates/web/src/pages/demo/examples/Table/1.tsx +64 -0
- package/templates/web/src/pages/demo/examples/Table/2.tsx +29 -0
- package/templates/web/src/pages/demo/examples/Table/3.tsx +39 -0
- package/templates/web/src/pages/demo/examples/Table/4.tsx +42 -0
- package/templates/web/src/pages/demo/examples/TimerButton.tsx +4 -0
- package/templates/web/src/pages/demo/examples/Title/1.tsx +4 -0
- package/templates/web/src/pages/demo/examples/Title/2.tsx +5 -0
- package/templates/web/src/pages/demo/examples/WaterMark.tsx +8 -0
- package/templates/web/src/pages/demo/examples/Wrapper.tsx +40 -0
- package/templates/web/src/pages/demo/examples/usePreload.tsx +9 -0
- package/templates/web/src/pages/demo/index.tsx +133 -0
- package/templates/web/src/pages/index.tsx +3 -0
- package/templates/web/{base/src → src}/types/user.d.ts +1 -1
- package/templates/{mobile/base → web}/tsconfig.json +2 -2
- package/templates/web/typings.d.ts +16 -0
- package/bin/index.js +0 -2
- package/templates/miniapp/base/.eslintrc.js.tpl +0 -6
- package/templates/miniapp/base/.gitignore.tpl +0 -38
- package/templates/miniapp/base/babel.config.js +0 -3
- package/templates/miniapp/base/config/index.ts.tpl +0 -8
- package/templates/miniapp/base/global.d.ts +0 -18
- package/templates/miniapp/base/src/app.tsx +0 -26
- package/templates/miniapp/base/src/constants.ts +0 -1
- package/templates/miniapp/base/src/store/index.ts +0 -34
- package/templates/miniapp/base/src/theme.scss +0 -4
- package/templates/mobile/base/.gitignore.tpl +0 -33
- package/templates/mobile/base/__tests__/__snapshots__/pages.test.tsx.snap +0 -88
- package/templates/mobile/base/__tests__/pages.test.tsx +0 -11
- package/templates/mobile/base/src/app.tsx +0 -27
- package/templates/mobile/base/src/common/request.ts +0 -3
- package/templates/mobile/base/src/layouts/index.less +0 -103
- package/templates/mobile/base/src/layouts/index.tsx +0 -48
- package/templates/mobile/base/src/pages/404.tsx +0 -12
- package/templates/mobile/base/src/pages/index.tsx +0 -3
- package/templates/mobile/base/src/store/index.ts +0 -17
- package/templates/mobile/base/typings.d.ts +0 -8
- package/templates/web/base/.gitignore.tpl +0 -33
- package/templates/web/base/.umirc.ts.tpl +0 -6
- package/templates/web/base/__tests__/__snapshots__/pages.test.tsx.snap +0 -112
- package/templates/web/base/__tests__/pages.test.tsx +0 -11
- package/templates/web/base/src/app.tsx +0 -36
- package/templates/web/base/src/common/request.ts +0 -3
- package/templates/web/base/src/layouts/index.less +0 -11
- package/templates/web/base/src/layouts/index.tsx +0 -94
- package/templates/web/base/src/pages/index.tsx +0 -3
- package/templates/web/base/src/store/index.ts +0 -17
- package/templates/web/base/typings.d.ts +0 -8
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Form, Button, Divider } from 'antd';
|
|
3
|
+
import { useForm } from '@baic/yolk-web-form';
|
|
4
|
+
import {
|
|
5
|
+
Config,
|
|
6
|
+
Input,
|
|
7
|
+
NumberInput,
|
|
8
|
+
MobileInput,
|
|
9
|
+
BankInput,
|
|
10
|
+
Grid,
|
|
11
|
+
} from '@baic/yolk-web';
|
|
12
|
+
|
|
13
|
+
export default () => {
|
|
14
|
+
const [form] = useForm();
|
|
15
|
+
const { createFormItem, setFieldsValue, resetFields } = form;
|
|
16
|
+
const [edit, setEdit] = React.useState(true);
|
|
17
|
+
const onClickHandler = React.useCallback(() => {
|
|
18
|
+
if (edit) {
|
|
19
|
+
setEdit(false);
|
|
20
|
+
setFieldsValue({
|
|
21
|
+
grid_name: '某某',
|
|
22
|
+
grid_age: 18,
|
|
23
|
+
grid_mobile: '13000000000',
|
|
24
|
+
grid_bankNumber: '0000000000000000',
|
|
25
|
+
});
|
|
26
|
+
} else {
|
|
27
|
+
setEdit(true);
|
|
28
|
+
resetFields();
|
|
29
|
+
}
|
|
30
|
+
}, [edit, setFieldsValue, resetFields]);
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<Button onClick={onClickHandler}>{edit ? '详情' : '编辑'}</Button>
|
|
34
|
+
<Divider />
|
|
35
|
+
<Config edit={edit}>
|
|
36
|
+
<Form form={form}>
|
|
37
|
+
<Grid
|
|
38
|
+
data={[
|
|
39
|
+
{
|
|
40
|
+
label: '姓名',
|
|
41
|
+
value: createFormItem({
|
|
42
|
+
name: 'grid_name',
|
|
43
|
+
rules: 'required',
|
|
44
|
+
})(<Input />),
|
|
45
|
+
required: edit,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: '年龄',
|
|
49
|
+
value: createFormItem({
|
|
50
|
+
name: 'grid_age',
|
|
51
|
+
rules: 'required',
|
|
52
|
+
})(<NumberInput maxLength={3} />),
|
|
53
|
+
required: edit,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
label: '电话号码',
|
|
57
|
+
value: createFormItem({
|
|
58
|
+
name: 'grid_mobile',
|
|
59
|
+
rules: {
|
|
60
|
+
required: true,
|
|
61
|
+
mobile: true,
|
|
62
|
+
},
|
|
63
|
+
})(<MobileInput />),
|
|
64
|
+
required: edit,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
label: '银行卡号',
|
|
68
|
+
value: createFormItem({
|
|
69
|
+
name: 'grid_bankNumber',
|
|
70
|
+
rules: 'required',
|
|
71
|
+
})(<BankInput />),
|
|
72
|
+
required: edit,
|
|
73
|
+
},
|
|
74
|
+
]}
|
|
75
|
+
/>
|
|
76
|
+
</Form>
|
|
77
|
+
</Config>
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { LinkButton } from '@baic/yolk-web';
|
|
3
|
+
|
|
4
|
+
export default () => (
|
|
5
|
+
<LinkButton.Group>
|
|
6
|
+
<LinkButton onClick={() => {}}>编辑</LinkButton>
|
|
7
|
+
<LinkButton.Merge>
|
|
8
|
+
<LinkButton onClick={() => {}}>修改</LinkButton>
|
|
9
|
+
<LinkButton>删除</LinkButton>
|
|
10
|
+
</LinkButton.Merge>
|
|
11
|
+
</LinkButton.Group>
|
|
12
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Form } from 'antd';
|
|
3
|
+
import { useForm } from '@baic/yolk-web-form';
|
|
4
|
+
import { RangeNumber } from '@baic/yolk-web';
|
|
5
|
+
|
|
6
|
+
export default () => {
|
|
7
|
+
const [form] = useForm();
|
|
8
|
+
const { createFormItem } = form;
|
|
9
|
+
return (
|
|
10
|
+
<Form form={form}>
|
|
11
|
+
{createFormItem({
|
|
12
|
+
name: 'RangeNumber',
|
|
13
|
+
})(<RangeNumber />)}
|
|
14
|
+
</Form>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Form } from 'antd';
|
|
3
|
+
import { useForm } from '@baic/yolk-web-form';
|
|
4
|
+
import {
|
|
5
|
+
SearchLayout,
|
|
6
|
+
Input,
|
|
7
|
+
NumberInput,
|
|
8
|
+
MobileInput,
|
|
9
|
+
BankInput,
|
|
10
|
+
} from '@baic/yolk-web';
|
|
11
|
+
|
|
12
|
+
export default () => {
|
|
13
|
+
const [form] = useForm();
|
|
14
|
+
const { createFormItem } = form;
|
|
15
|
+
return (
|
|
16
|
+
<Form form={form}>
|
|
17
|
+
<SearchLayout
|
|
18
|
+
data={[
|
|
19
|
+
createFormItem({
|
|
20
|
+
name: 'name',
|
|
21
|
+
label: '姓名',
|
|
22
|
+
rules: 'required',
|
|
23
|
+
})(<Input />),
|
|
24
|
+
createFormItem({
|
|
25
|
+
name: 'age',
|
|
26
|
+
label: '年龄',
|
|
27
|
+
rules: 'required',
|
|
28
|
+
})(<NumberInput maxLength={3} />),
|
|
29
|
+
createFormItem({
|
|
30
|
+
name: 'mobile',
|
|
31
|
+
label: '电话号码',
|
|
32
|
+
rules: {
|
|
33
|
+
required: true,
|
|
34
|
+
mobile: true,
|
|
35
|
+
},
|
|
36
|
+
})(<MobileInput />),
|
|
37
|
+
createFormItem({
|
|
38
|
+
name: 'bankNumber',
|
|
39
|
+
label: '银行卡号',
|
|
40
|
+
rules: 'required',
|
|
41
|
+
})(<BankInput />),
|
|
42
|
+
]}
|
|
43
|
+
/>
|
|
44
|
+
</Form>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Table } from '@baic/yolk-web';
|
|
3
|
+
|
|
4
|
+
export default () => (
|
|
5
|
+
<Table
|
|
6
|
+
columns={[
|
|
7
|
+
{
|
|
8
|
+
dataIndex: 'a',
|
|
9
|
+
title: 'a',
|
|
10
|
+
formatter: v => v,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
dataIndex: 'b',
|
|
14
|
+
title: 'b',
|
|
15
|
+
ellipsis: true,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
dataIndex: 'b',
|
|
19
|
+
title: 'b',
|
|
20
|
+
ellipsis: 5,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
dataIndex: 'b',
|
|
24
|
+
title: 'b',
|
|
25
|
+
ellipsis: () => '123',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
dataIndex: 'a',
|
|
29
|
+
title: 'a',
|
|
30
|
+
fontWeight: 'bold',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
dataIndex: 'a',
|
|
34
|
+
title: 'a',
|
|
35
|
+
unit: '元',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
dataIndex: 'a',
|
|
39
|
+
title: 'a',
|
|
40
|
+
tag: true,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
dataIndex: 'a',
|
|
44
|
+
title: 'a',
|
|
45
|
+
tag: {
|
|
46
|
+
color: 'red',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
dataIndex: 'a',
|
|
51
|
+
title: 'a',
|
|
52
|
+
tag: 'red',
|
|
53
|
+
},
|
|
54
|
+
]}
|
|
55
|
+
dataSource={[
|
|
56
|
+
{
|
|
57
|
+
a: '1',
|
|
58
|
+
b: '124125125151251251515125',
|
|
59
|
+
c: true,
|
|
60
|
+
d: null,
|
|
61
|
+
},
|
|
62
|
+
]}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Table } from '@baic/yolk-web';
|
|
3
|
+
|
|
4
|
+
export default () => (
|
|
5
|
+
<Table
|
|
6
|
+
bordered
|
|
7
|
+
dragSort
|
|
8
|
+
columns={[
|
|
9
|
+
{
|
|
10
|
+
dataIndex: 'a',
|
|
11
|
+
title: 'a',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
dataIndex: 'b',
|
|
15
|
+
title: 'b',
|
|
16
|
+
},
|
|
17
|
+
]}
|
|
18
|
+
dataSource={[
|
|
19
|
+
{
|
|
20
|
+
a: '1',
|
|
21
|
+
b: '1',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
a: '2',
|
|
25
|
+
b: '2',
|
|
26
|
+
},
|
|
27
|
+
]}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { message } from 'antd';
|
|
3
|
+
import { Table } from '@baic/yolk-web';
|
|
4
|
+
|
|
5
|
+
export default () => (
|
|
6
|
+
<Table
|
|
7
|
+
bordered
|
|
8
|
+
dragSort={{
|
|
9
|
+
header: {
|
|
10
|
+
onSortEnd: ({ oldIndex, newIndex }) =>
|
|
11
|
+
message.success(`排序结束, 从${oldIndex}到${newIndex}`),
|
|
12
|
+
},
|
|
13
|
+
body: {
|
|
14
|
+
onSortEnd: ({ oldIndex, newIndex }) =>
|
|
15
|
+
message.success(`排序结束, 从${oldIndex}到${newIndex}`),
|
|
16
|
+
},
|
|
17
|
+
}}
|
|
18
|
+
columns={[
|
|
19
|
+
{
|
|
20
|
+
dataIndex: 'a',
|
|
21
|
+
title: 'a',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
dataIndex: 'b',
|
|
25
|
+
title: 'b',
|
|
26
|
+
},
|
|
27
|
+
]}
|
|
28
|
+
dataSource={[
|
|
29
|
+
{
|
|
30
|
+
a: '1',
|
|
31
|
+
b: '1',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
a: '2',
|
|
35
|
+
b: '2',
|
|
36
|
+
},
|
|
37
|
+
]}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MenuOutlined } from '@ant-design/icons';
|
|
3
|
+
import { Table } from '@baic/yolk-web';
|
|
4
|
+
|
|
5
|
+
export default () => (
|
|
6
|
+
<Table
|
|
7
|
+
bordered
|
|
8
|
+
dragSort={{
|
|
9
|
+
header: false,
|
|
10
|
+
body: {
|
|
11
|
+
selfDrag: false,
|
|
12
|
+
},
|
|
13
|
+
}}
|
|
14
|
+
columns={[
|
|
15
|
+
{
|
|
16
|
+
title: '排序',
|
|
17
|
+
render: () =>
|
|
18
|
+
Table.createDragSortComponent(
|
|
19
|
+
<MenuOutlined style={{ cursor: 'grab', color: '#999' }} />,
|
|
20
|
+
),
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
dataIndex: 'a',
|
|
24
|
+
title: 'a',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
dataIndex: 'b',
|
|
28
|
+
title: 'b',
|
|
29
|
+
},
|
|
30
|
+
]}
|
|
31
|
+
dataSource={[
|
|
32
|
+
{
|
|
33
|
+
a: '1',
|
|
34
|
+
b: '1',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
a: '2',
|
|
38
|
+
b: '2',
|
|
39
|
+
},
|
|
40
|
+
]}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Button, Divider, Radio } from 'antd';
|
|
3
|
+
import { RadioChangeEvent } from 'antd/lib/radio/interface';
|
|
4
|
+
import { Wrapper } from '@baic/yolk-web';
|
|
5
|
+
import { WrapperInstance, Mode } from '@baic/yolk-web/lib/wrapper';
|
|
6
|
+
|
|
7
|
+
export default () => {
|
|
8
|
+
const ref = React.useRef<WrapperInstance>(null);
|
|
9
|
+
const [mode, setMode] = React.useState<Mode>('page');
|
|
10
|
+
const onClickHandler = React.useCallback(() => ref.current?.open(), []);
|
|
11
|
+
const onChangeHandler = React.useCallback(
|
|
12
|
+
(e: RadioChangeEvent) => setMode(e.target.value),
|
|
13
|
+
[],
|
|
14
|
+
);
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
<Button onClick={onClickHandler}>打开</Button>
|
|
18
|
+
<Divider type="vertical" />
|
|
19
|
+
<Radio.Group onChange={onChangeHandler} defaultValue={mode}>
|
|
20
|
+
<Radio value="modal">Modal模式</Radio>
|
|
21
|
+
<Radio value="page">Page模式</Radio>
|
|
22
|
+
<Radio value="inline">Inline模式</Radio>
|
|
23
|
+
</Radio.Group>
|
|
24
|
+
<Divider />
|
|
25
|
+
<div
|
|
26
|
+
style={{
|
|
27
|
+
position: 'relative',
|
|
28
|
+
overflow: 'hidden',
|
|
29
|
+
width: 500,
|
|
30
|
+
height: 500,
|
|
31
|
+
border: '1px solid #ddd',
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<Wrapper ref={ref} mode={mode} title="标题">
|
|
35
|
+
这里是内容
|
|
36
|
+
</Wrapper>
|
|
37
|
+
</div>
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import { Tabs } from 'antd';
|
|
6
|
+
|
|
7
|
+
import BankInput from './examples/BankInput';
|
|
8
|
+
import BarCode from './examples/BarCode';
|
|
9
|
+
import Collapse from './examples/Collapse';
|
|
10
|
+
import DatePicker from './examples/DatePicker';
|
|
11
|
+
import Flex from './examples/Flex';
|
|
12
|
+
import Grid1 from './examples/Grid/1';
|
|
13
|
+
import Grid2 from './examples/Grid/2';
|
|
14
|
+
import Grid3 from './examples/Grid/3';
|
|
15
|
+
import Grid4 from './examples/Grid/4';
|
|
16
|
+
import Grid5 from './examples/Grid/5';
|
|
17
|
+
import Grid6 from './examples/Grid/6';
|
|
18
|
+
import Iconfont from './examples/Iconfont';
|
|
19
|
+
import ImagePreview from './examples/ImagePreview';
|
|
20
|
+
import Input1 from './examples/Input/1';
|
|
21
|
+
import Input2 from './examples/Input/2';
|
|
22
|
+
import LinkButton1 from './examples/LinkButton/1';
|
|
23
|
+
import LinkButton2 from './examples/LinkButton/2';
|
|
24
|
+
import LinkButton3 from './examples/LinkButton/3';
|
|
25
|
+
import Loading from './examples/Loading';
|
|
26
|
+
import MobileInput from './examples/MobileInput';
|
|
27
|
+
import NumberInput from './examples/NumberInput';
|
|
28
|
+
import QrCode from './examples/QrCode';
|
|
29
|
+
import RangeNumber1 from './examples/RangeNumber/1';
|
|
30
|
+
import RangeNumber2 from './examples/RangeNumber/2';
|
|
31
|
+
import Required from './examples/Required';
|
|
32
|
+
import SearchLayout from './examples/SearchLayout';
|
|
33
|
+
import Table1 from './examples/Table/1';
|
|
34
|
+
import Table2 from './examples/Table/2';
|
|
35
|
+
import Table3 from './examples/Table/3';
|
|
36
|
+
import Table4 from './examples/Table/4';
|
|
37
|
+
import TimerButton from './examples/TimerButton';
|
|
38
|
+
import Title1 from './examples/Title/1';
|
|
39
|
+
import Title2 from './examples/Title/2';
|
|
40
|
+
import usePreload from './examples/usePreload';
|
|
41
|
+
import WaterMark from './examples/WaterMark';
|
|
42
|
+
import Wrapper from './examples/Wrapper';
|
|
43
|
+
|
|
44
|
+
const { TabPane } = Tabs;
|
|
45
|
+
|
|
46
|
+
const tabs: Record<
|
|
47
|
+
string,
|
|
48
|
+
React.FunctionComponent | Record<string, React.FunctionComponent>
|
|
49
|
+
> = {
|
|
50
|
+
BankInput,
|
|
51
|
+
BarCode,
|
|
52
|
+
Collapse,
|
|
53
|
+
DatePicker,
|
|
54
|
+
Flex,
|
|
55
|
+
Grid: {
|
|
56
|
+
Grid1,
|
|
57
|
+
Grid2,
|
|
58
|
+
Grid3,
|
|
59
|
+
Grid4,
|
|
60
|
+
Grid5,
|
|
61
|
+
Grid6,
|
|
62
|
+
},
|
|
63
|
+
Iconfont,
|
|
64
|
+
ImagePreview,
|
|
65
|
+
Input: {
|
|
66
|
+
Input1,
|
|
67
|
+
Input2,
|
|
68
|
+
},
|
|
69
|
+
LinkButton: {
|
|
70
|
+
LinkButton1,
|
|
71
|
+
LinkButton2,
|
|
72
|
+
LinkButton3,
|
|
73
|
+
},
|
|
74
|
+
Loading,
|
|
75
|
+
MobileInput,
|
|
76
|
+
NumberInput,
|
|
77
|
+
QrCode,
|
|
78
|
+
RangeNumber: {
|
|
79
|
+
RangeNumber1,
|
|
80
|
+
RangeNumber2,
|
|
81
|
+
},
|
|
82
|
+
Required,
|
|
83
|
+
SearchLayout,
|
|
84
|
+
Table: {
|
|
85
|
+
Table1,
|
|
86
|
+
Table2,
|
|
87
|
+
Table3,
|
|
88
|
+
Table4,
|
|
89
|
+
},
|
|
90
|
+
TimerButton,
|
|
91
|
+
Title: {
|
|
92
|
+
Title1,
|
|
93
|
+
Title2,
|
|
94
|
+
},
|
|
95
|
+
usePreload,
|
|
96
|
+
WaterMark,
|
|
97
|
+
Wrapper,
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export default () => {
|
|
101
|
+
const keys = Object.keys(tabs);
|
|
102
|
+
return (
|
|
103
|
+
<Tabs defaultActiveKey={keys[0]}>
|
|
104
|
+
{keys.map(key => {
|
|
105
|
+
const tab = tabs[key];
|
|
106
|
+
if (_.isFunction(tab)) {
|
|
107
|
+
return (
|
|
108
|
+
<TabPane key={key} tab={key}>
|
|
109
|
+
{React.createElement(tab)}
|
|
110
|
+
</TabPane>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
if (_.isObject(tab)) {
|
|
114
|
+
const keys2 = Object.keys(tab);
|
|
115
|
+
return (
|
|
116
|
+
<TabPane key={key} tab={key}>
|
|
117
|
+
<Tabs defaultActiveKey={keys2[0]}>
|
|
118
|
+
{keys2.map(key2 => {
|
|
119
|
+
const tab2 = tab[key2];
|
|
120
|
+
return (
|
|
121
|
+
<TabPane key={key2} tab={key2}>
|
|
122
|
+
{React.createElement(tab2)}
|
|
123
|
+
</TabPane>
|
|
124
|
+
);
|
|
125
|
+
})}
|
|
126
|
+
</Tabs>
|
|
127
|
+
</TabPane>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
})}
|
|
131
|
+
</Tabs>
|
|
132
|
+
);
|
|
133
|
+
};
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
"module": "esnext",
|
|
5
5
|
"moduleResolution": "node",
|
|
6
6
|
"importHelpers": true,
|
|
7
|
-
"jsx": "react",
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
8
|
"esModuleInterop": true,
|
|
9
9
|
"sourceMap": true,
|
|
10
10
|
"baseUrl": "./",
|
|
11
11
|
"strict": true,
|
|
12
12
|
"paths": {
|
|
13
13
|
"@/*": ["src/*"],
|
|
14
|
-
"@@/*": ["src/.umi/*"]
|
|
14
|
+
"@@/*": ["src/.umi/*"]
|
|
15
15
|
},
|
|
16
16
|
"allowSyntheticDefaultImports": true
|
|
17
17
|
},
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare module '*.png';
|
|
2
|
+
declare module '*.gif';
|
|
3
|
+
declare module '*.jpg';
|
|
4
|
+
declare module '*.jpeg';
|
|
5
|
+
declare module '*.svg' {
|
|
6
|
+
export function ReactComponent(
|
|
7
|
+
props: React.SVGProps<SVGSVGElement>,
|
|
8
|
+
): React.ReactElement;
|
|
9
|
+
const url: string;
|
|
10
|
+
export default url;
|
|
11
|
+
}
|
|
12
|
+
declare module '*.css';
|
|
13
|
+
declare module '*.less';
|
|
14
|
+
declare module '*.scss';
|
|
15
|
+
declare module '*.sass';
|
|
16
|
+
declare module '*.styl';
|