Skip to content

Commit 0db0f2a

Browse files
authored
Merge pull request #2 from ClearXs/0.1.x
0.1.x
2 parents ec17637 + 1d35b6b commit 0db0f2a

File tree

262 files changed

+11834
-5088
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

262 files changed

+11834
-5088
lines changed

.npmrc

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
registry="https://packages.aliyun.com/636dc75af003e3b7bb5cad97/npm/npm-registry/":_authToken=NjM2ZGM3NDMzNjE1Yjk0MjA2N2MzYmE5OnIwRGE9ZzE9KTEtLQ==
2-
always-auth=true
1+
registry="https://packages.aliyun.com/636dc75af003e3b7bb5cad97/npm/npm-registry"

package.json

+17-16
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
},
2222
"homepage": "https://github.com/ClearXs/Turbo-ui#readme",
2323
"scripts": {
24-
"dev": "vite --open --mode dev --port 5173",
25-
"start": "vite --open --mode dev --port 5173",
24+
"dev": "vite --open --mode dev --port 5673",
25+
"start": "vite --open --mode dev --port 5673",
2626
"host": "vite --open --host",
2727
"build": "vite build --mode prod -d",
2828
"preview": "vite preview",
@@ -35,35 +35,36 @@
3535
"test:cover": "vitest run --coverage"
3636
},
3737
"dependencies": {
38-
"@designable/core": "0.0.1-beta.0",
39-
"@designable/formily-semi": "0.0.1-beta.0",
40-
"@designable/formily-setters": "0.0.1-beta.0",
41-
"@designable/formily-transformer": "0.0.1-beta.0",
42-
"@designable/react": "0.0.1-beta.0",
43-
"@designable/react-sandbox": "0.0.1-beta.0",
44-
"@designable/react-settings-form": "0.0.1-beta.0",
45-
"@designable/shared": "0.0.1-beta.0",
46-
"@douyinfe/semi-icons": "^2.49.1",
47-
"@douyinfe/semi-illustrations": "^2.49.1",
48-
"@douyinfe/semi-ui": "^2.49.1",
38+
"@designable/core": "0.0.1-beta.13",
39+
"@designable/formily-semi": "0.0.1-beta.13",
40+
"@designable/formily-setters": "0.0.1-beta.13",
41+
"@designable/formily-transformer": "0.0.1-beta.13",
42+
"@designable/react": "0.0.1-beta.13",
43+
"@designable/react-sandbox": "0.0.1-beta.13",
44+
"@designable/react-settings-form": "0.0.1-beta.13",
45+
"@designable/shared": "0.0.1-beta.13",
46+
"@douyinfe/semi-icons": "^2.50.0",
47+
"@douyinfe/semi-illustrations": "^2.50.0",
48+
"@douyinfe/semi-ui": "^2.50.0",
4949
"@emotion/react": "^11.11.1",
5050
"@emotion/styled": "^11.11.0",
51-
"@formily/antd": "^2.3.1",
5251
"@formily/core": "^2.3.1",
5352
"@formily/json-schema": "^2.3.1",
5453
"@formily/react": "^2.3.1",
5554
"@formily/reactive": "^2.3.1",
5655
"@formily/reactive-react": "^2.3.1",
57-
"@formily/semi": "1.0.1-beta.16",
56+
"@formily/semi": "0.0.3-beta.0",
5857
"@formily/shared": "^2.3.1",
59-
"antd": "^4.15.2",
6058
"axios": "^1.6.2",
6159
"classnames": "^2.3.2",
60+
"dnd-core": "^16.0.1",
6261
"iconoir": "^7.2.0",
6362
"iconoir-react": "^7.2.0",
6463
"lodash": "^4.17.21",
6564
"moment": "^2.29.4",
6665
"react": "^18.2.0",
66+
"react-dnd": "^16.0.1",
67+
"react-dnd-html5-backend": "^16.0.1",
6768
"react-dom": "^18.2.0",
6869
"react-router-dom": "^6.21.0",
6970
"recoil": "^0.7.7",

pnpm-lock.yaml

+2,648-2,176
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.tsx

+10-32
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,22 @@
11
import { Layout } from '@douyinfe/semi-ui';
2-
import './theme/default.css';
3-
import { useSetRecoilState } from 'recoil';
4-
import { CurrentUserRouteState, CurrentUserSelectTabState } from './store/menu';
5-
import { useEffect } from 'react';
6-
import { get } from './util/local';
7-
import { Authentication } from './util/headers';
8-
import { useNavigate } from 'react-router-dom';
9-
import { menuToRouterObject } from './router';
102
import MotionContent from './components/MotionContent';
11-
import { useContentMenu, useFindUserRoute } from './hook/menu';
12-
import useAuthApi from './api/system/auth';
133
import MotionHeader from './components/MotionHeader';
4+
import { useEffect } from 'react';
5+
import { GlobalRegistry } from '@designable/core';
6+
import './locales';
147

15-
export default function App(): React.ReactNode {
16-
const authApi = useAuthApi();
17-
const findUserRoute = useFindUserRoute();
18-
const [addUserContentTab] = useContentMenu();
19-
const setUserRouters = useSetRecoilState(CurrentUserRouteState);
20-
const navigate = useNavigate();
21-
const setSelectContentTab = useSetRecoilState(CurrentUserSelectTabState);
8+
import { SUPPORT_LOCALES } from './components/MotionHeader/Locales';
229

10+
export default function App(): React.ReactNode {
2311
useEffect(() => {
24-
authApi.getCurrentUserMenu().then((res) => {
25-
res.code === 200 && setUserRouters(menuToRouterObject(res.data || []));
26-
});
27-
// 默认路由值home页面
28-
const route = findUserRoute('home');
29-
if (route) {
30-
// 1.加上content tabs的页签
31-
addUserContentTab(route, 'home');
32-
// 2.navigate to home
33-
navigate(route.path as string);
34-
// 3.设置content选中的面板
35-
setSelectContentTab(route.code as string);
12+
const supportLocales = SUPPORT_LOCALES.map((locales) => locales.value);
13+
if (!supportLocales.includes(GlobalRegistry.getDesignerLanguage())) {
14+
GlobalRegistry.setDesignerLanguage('zh-cn');
3615
}
37-
// 重新加载组件需要重新考虑变更条件
38-
}, [get(Authentication)]);
16+
}, []);
3917

4018
return (
41-
<Layout className="h-100vh w-100vw">
19+
<Layout className="h-100vh w-100vw overflow-hidden">
4220
<MotionHeader />
4321
<MotionContent />
4422
</Layout>

src/api/developer/bo.ts

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import useRequest from '@/hook/request';
2+
import {
3+
CategoryEntity,
4+
GeneralApi,
5+
GeneralApiImpl,
6+
R,
7+
TenantEntity,
8+
} from '../interface';
9+
import { BoSchema } from '@designable/core';
10+
11+
export interface Bo extends TenantEntity, CategoryEntity {
12+
/**
13+
* 业务对象名称
14+
*/
15+
name: string;
16+
17+
/**
18+
* 业务对象编码
19+
*/
20+
code: string;
21+
22+
/**
23+
* 备注
24+
*/
25+
remark: string;
26+
27+
/**
28+
* 数据源id
29+
*/
30+
dataSourceId: string;
31+
}
32+
33+
export interface BoApi extends GeneralApi<Bo> {
34+
/**
35+
* 获取bo schema
36+
*/
37+
schema: (boId: string) => Promise<R<BoSchema>>;
38+
}
39+
40+
class BoApiImpl extends GeneralApiImpl<Bo> implements BoApi {
41+
schema(boId: string): Promise<R<BoSchema>> {
42+
return this.request.get(this.apiPath + `/schema/${boId}`).then((res) => {
43+
return res.data;
44+
});
45+
}
46+
}
47+
48+
export default function useBoApi(): BoApi {
49+
const request = useRequest();
50+
return new BoApiImpl('/api/dev/bo', request);
51+
}

src/api/developer/boattribute.ts

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import useRequest from '@/hook/request';
2+
import { Tree, TreeGeneralApi, TreeGeneralApiImpl } from '../interface';
3+
4+
export interface BoAttributeTree extends Tree {
5+
/**
6+
* 业务对象属性名称
7+
*/
8+
name: string;
9+
10+
/**
11+
* 业务对象属性编码
12+
*/
13+
code: string;
14+
15+
/**
16+
* 业务对象属性类型
17+
*/
18+
attrType: 'table' | 'field';
19+
20+
/**
21+
* 业务对象属性字段
22+
*/
23+
field: string;
24+
25+
/**
26+
* 业务对象属性备注
27+
*/
28+
remark: string;
29+
30+
/**
31+
* 所属于业务对象表ID
32+
*/
33+
boId: string;
34+
35+
/**
36+
* 业务对象属性类型
37+
*/
38+
type: string;
39+
40+
/**
41+
* 业务对象属性长度
42+
*/
43+
precision: number;
44+
45+
/**
46+
* 业务对象属性小数位
47+
*/
48+
scala: number;
49+
50+
/**
51+
* 是否主键
52+
*/
53+
isPk: boolean;
54+
55+
/**
56+
* 业务对象属性小数位
57+
*/
58+
isFk: boolean;
59+
60+
/**
61+
* 业务对象属性小数位
62+
*/
63+
isNonNull: boolean;
64+
65+
/**
66+
* 业务对象属性小数位
67+
*/
68+
isUnique: boolean;
69+
}
70+
71+
export interface BoAttributeApi extends TreeGeneralApi<BoAttributeTree> {}
72+
73+
class BoAttributeApiImpl
74+
extends TreeGeneralApiImpl<BoAttributeTree>
75+
implements BoAttributeApi {}
76+
77+
export default function useBoAttributeApi(): BoAttributeApi {
78+
const request = useRequest();
79+
return new BoAttributeApiImpl('/api/dev/bo/attribute', request);
80+
}
File renamed without changes.

src/api/developer/datasource.ts

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import useRequest from '@/hook/request';
2+
import { GeneralApi, GeneralApiImpl, TenantEntity } from '../interface';
3+
4+
export interface DataSource extends TenantEntity {
5+
/**
6+
* 数据源名称
7+
*/
8+
name: string;
9+
10+
/**
11+
* 数据源连接地址
12+
*/
13+
url: string;
14+
15+
/**
16+
* 连接用户名
17+
*/
18+
username: string;
19+
20+
/**
21+
* 连接密码
22+
*/
23+
password: string;
24+
25+
/**
26+
* 数据源引擎
27+
*/
28+
engine: string;
29+
}
30+
31+
export interface DataSourceApi extends GeneralApi<DataSource> {}
32+
33+
class DataSourceApiImpl
34+
extends GeneralApiImpl<DataSource>
35+
implements DataSourceApi {}
36+
37+
export default function useDataSourceApi(): DataSourceApi {
38+
const request = useRequest();
39+
return new DataSourceApiImpl('/api/dev/datasource', request);
40+
}

src/api/developer/form.ts

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import useRequest from '@/hook/request';
2+
import { CategoryEntity, GeneralApi, GeneralApiImpl } from '../interface';
3+
4+
export interface Form extends CategoryEntity {
5+
/**
6+
* 表单名称
7+
*/
8+
name: string;
9+
10+
/**
11+
* 表单编码
12+
*/
13+
code: string;
14+
15+
/**
16+
* 表单数据schema
17+
*/
18+
schema: string;
19+
20+
/**
21+
* boSchema
22+
*/
23+
boSchema: string;
24+
25+
/**
26+
* 所属于bo id
27+
*/
28+
boId: string;
29+
30+
/**
31+
* 分类id
32+
*/
33+
categoryId: string;
34+
35+
/**
36+
* 备注
37+
*/
38+
remark: string;
39+
}
40+
41+
export interface FormApi extends GeneralApi<Form> {
42+
publish(form: Form): Promise<Boolean>;
43+
}
44+
45+
class FormApiImpl extends GeneralApiImpl<Form> implements FormApi {
46+
publish(form: Form): Promise<Boolean> {
47+
return this.request.post(this.apiPath + '/publish', form).then((res) => {
48+
return res.data;
49+
});
50+
}
51+
}
52+
53+
export default function useFormApi(): FormApi {
54+
const request = useRequest();
55+
return new FormApiImpl('/api/dev/form', request);
56+
}

0 commit comments

Comments
 (0)