create-antd-layout 1.0.0
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/bin/index.js +130 -0
- package/package.json +49 -0
- package/templates/antd-layout-vite-simple/LICENSE +21 -0
- package/templates/antd-layout-vite-simple/README.md +73 -0
- package/templates/antd-layout-vite-simple/eslint.config.js +23 -0
- package/templates/antd-layout-vite-simple/index.html +13 -0
- package/templates/antd-layout-vite-simple/package-lock.json +3269 -0
- package/templates/antd-layout-vite-simple/package.json +39 -0
- package/templates/antd-layout-vite-simple/public/vite.svg +1 -0
- package/templates/antd-layout-vite-simple/src/App.css +3 -0
- package/templates/antd-layout-vite-simple/src/App.tsx +21 -0
- package/templates/antd-layout-vite-simple/src/assets/react.svg +1 -0
- package/templates/antd-layout-vite-simple/src/components/PopoverPanel.tsx +178 -0
- package/templates/antd-layout-vite-simple/src/components/ThemeButton.tsx +35 -0
- package/templates/antd-layout-vite-simple/src/index.css +17 -0
- package/templates/antd-layout-vite-simple/src/layouts/index.tsx +68 -0
- package/templates/antd-layout-vite-simple/src/main.tsx +10 -0
- package/templates/antd-layout-vite-simple/src/pages/login.tsx +7 -0
- package/templates/antd-layout-vite-simple/src/pages/system/config.tsx +72 -0
- package/templates/antd-layout-vite-simple/src/pages/system/logs.tsx +41 -0
- package/templates/antd-layout-vite-simple/src/pages/welcome.tsx +27 -0
- package/templates/antd-layout-vite-simple/src/pages/workend/order.tsx +24 -0
- package/templates/antd-layout-vite-simple/src/pages/workend/product.tsx +117 -0
- package/templates/antd-layout-vite-simple/src/routes.ts +39 -0
- package/templates/antd-layout-vite-simple/tsconfig.app.json +33 -0
- package/templates/antd-layout-vite-simple/tsconfig.json +7 -0
- package/templates/antd-layout-vite-simple/tsconfig.node.json +26 -0
- package/templates/antd-layout-vite-simple/vite.config.ts +13 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Table } from 'antd';
|
|
3
|
+
import type { TableColumnsType, TableProps } from 'antd';
|
|
4
|
+
import { Container } from '@adminui-dev/antd-layout';
|
|
5
|
+
|
|
6
|
+
interface DataType {
|
|
7
|
+
key: React.Key;
|
|
8
|
+
name: string;
|
|
9
|
+
age: number;
|
|
10
|
+
address: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const columns: TableColumnsType<DataType> = [
|
|
14
|
+
{
|
|
15
|
+
title: 'Name',
|
|
16
|
+
dataIndex: 'name',
|
|
17
|
+
showSorterTooltip: { target: 'full-header' },
|
|
18
|
+
filters: [
|
|
19
|
+
{
|
|
20
|
+
text: 'Joe',
|
|
21
|
+
value: 'Joe',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
text: 'Jim',
|
|
25
|
+
value: 'Jim',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
text: 'Submenu',
|
|
29
|
+
value: 'Submenu',
|
|
30
|
+
children: [
|
|
31
|
+
{
|
|
32
|
+
text: 'Green',
|
|
33
|
+
value: 'Green',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
text: 'Black',
|
|
37
|
+
value: 'Black',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
// specify the condition of filtering result
|
|
43
|
+
// here is that finding the name started with `value`
|
|
44
|
+
onFilter: (value, record) => record.name.indexOf(value as string) === 0,
|
|
45
|
+
sorter: (a, b) => a.name.length - b.name.length,
|
|
46
|
+
sortDirections: ['descend'],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
title: 'Age',
|
|
50
|
+
dataIndex: 'age',
|
|
51
|
+
defaultSortOrder: 'descend',
|
|
52
|
+
sorter: (a, b) => a.age - b.age,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
title: 'Address',
|
|
56
|
+
dataIndex: 'address',
|
|
57
|
+
filters: [
|
|
58
|
+
{
|
|
59
|
+
text: 'London',
|
|
60
|
+
value: 'London',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
text: 'New York',
|
|
64
|
+
value: 'New York',
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
onFilter: (value, record) => record.address.indexOf(value as string) === 0,
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
const data = [
|
|
72
|
+
{
|
|
73
|
+
key: '1',
|
|
74
|
+
name: 'John Brown',
|
|
75
|
+
age: 32,
|
|
76
|
+
address: 'New York No. 1 Lake Park',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
key: '2',
|
|
80
|
+
name: 'Jim Green',
|
|
81
|
+
age: 42,
|
|
82
|
+
address: 'London No. 1 Lake Park',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
key: '3',
|
|
86
|
+
name: 'Joe Black',
|
|
87
|
+
age: 32,
|
|
88
|
+
address: 'Sydney No. 1 Lake Park',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
key: '4',
|
|
92
|
+
name: 'Jim Red',
|
|
93
|
+
age: 32,
|
|
94
|
+
address: 'London No. 2 Lake Park',
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
const onChange: TableProps<DataType>['onChange'] = (pagination, filters, sorter, extra) => {
|
|
99
|
+
console.log('params', pagination, filters, sorter, extra);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* This is just a casual demo
|
|
104
|
+
* @returns
|
|
105
|
+
*/
|
|
106
|
+
export default function(){
|
|
107
|
+
return(
|
|
108
|
+
<Container mode='panel'>
|
|
109
|
+
<Table<DataType>
|
|
110
|
+
columns={columns}
|
|
111
|
+
dataSource={data}
|
|
112
|
+
onChange={onChange}
|
|
113
|
+
showSorterTooltip={{ target: 'sorter-icon' }}
|
|
114
|
+
/>
|
|
115
|
+
</Container>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { LazyPage } from "@adminui-dev/antd-layout"
|
|
2
|
+
import { createBrowserRouter,redirect } from "react-router-dom"
|
|
3
|
+
|
|
4
|
+
const DashboardLayout = LazyPage(()=>import("@/layouts"))
|
|
5
|
+
const LoginPage = LazyPage(()=>import("@/pages/login"))
|
|
6
|
+
const ConfigPage = LazyPage(()=>import("@/pages/system/config"))
|
|
7
|
+
const LogsPage = LazyPage(()=>import("@/pages/system/logs"))
|
|
8
|
+
const OrderPage = LazyPage(()=>import("@/pages/workend/order"))
|
|
9
|
+
const ProductPage = LazyPage(()=>import("@/pages/workend/product"))
|
|
10
|
+
const WelcomePage = LazyPage(()=>import("@/pages/welcome"))
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* global router data
|
|
14
|
+
* standard react-router solution
|
|
15
|
+
* reference: https://reactrouter.com/start/data/routing
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
const routers = createBrowserRouter(
|
|
19
|
+
[
|
|
20
|
+
{path:"/",Component:DashboardLayout, children:[
|
|
21
|
+
{index:true,loader:()=>redirect("/welcome")},
|
|
22
|
+
{path:"welcome",Component:WelcomePage},
|
|
23
|
+
{path:"system",children:[
|
|
24
|
+
{index:true,loader:()=>redirect("/system/config")},
|
|
25
|
+
{path:"config",Component:ConfigPage},
|
|
26
|
+
{path:"logs",Component:LogsPage}
|
|
27
|
+
]},
|
|
28
|
+
{path:"workend",children:[
|
|
29
|
+
{index:true,loader:()=>redirect("/workend/order")},
|
|
30
|
+
{path:"order",Component:OrderPage},
|
|
31
|
+
{path:"product",Component:ProductPage}
|
|
32
|
+
]}
|
|
33
|
+
]},
|
|
34
|
+
{ path:"/login",Component:LoginPage }
|
|
35
|
+
]
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
export { routers }
|
|
39
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"useDefineForClassFields": true,
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"types": ["vite/client"],
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
|
|
11
|
+
/* Bundler mode */
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"moduleDetection": "force",
|
|
16
|
+
"noEmit": true,
|
|
17
|
+
"jsx": "react-jsx",
|
|
18
|
+
|
|
19
|
+
/* Linting */
|
|
20
|
+
"strict": true,
|
|
21
|
+
"noUnusedLocals": true,
|
|
22
|
+
"noUnusedParameters": true,
|
|
23
|
+
"erasableSyntaxOnly": true,
|
|
24
|
+
"noFallthroughCasesInSwitch": true,
|
|
25
|
+
"noUncheckedSideEffectImports": true,
|
|
26
|
+
|
|
27
|
+
"baseUrl": ".",
|
|
28
|
+
"paths": {
|
|
29
|
+
"@/*": ["src/*"]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"include": ["src"]
|
|
33
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "ES2023",
|
|
5
|
+
"lib": ["ES2023"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
|
|
10
|
+
/* Bundler mode */
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"allowImportingTsExtensions": true,
|
|
13
|
+
"verbatimModuleSyntax": true,
|
|
14
|
+
"moduleDetection": "force",
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
|
|
17
|
+
/* Linting */
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true,
|
|
21
|
+
"erasableSyntaxOnly": true,
|
|
22
|
+
"noFallthroughCasesInSwitch": true,
|
|
23
|
+
"noUncheckedSideEffectImports": true
|
|
24
|
+
},
|
|
25
|
+
"include": ["vite.config.ts"]
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import react from '@vitejs/plugin-react'
|
|
3
|
+
import path from "path"
|
|
4
|
+
|
|
5
|
+
// https://vite.dev/config/
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [react()],
|
|
8
|
+
resolve: {
|
|
9
|
+
alias: {
|
|
10
|
+
"@": path.resolve(__dirname, "./src"),
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
})
|