beer-assembly-biz 1.1.1-alpha.9 → 1.1.2-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/AppLayout.d.ts +13 -5
- package/AppLayout.js +37 -22
- package/BackPageContainer.d.ts +7 -0
- package/BackPageContainer.js +35 -0
- package/InlineContainer.d.ts +6 -0
- package/InlineContainer.js +28 -0
- package/MediaModals.d.ts +32 -0
- package/MediaModals.js +373 -0
- package/MyPageContainer.d.ts +18 -0
- package/MyPageContainer.js +72 -0
- package/Permission.d.ts +8 -0
- package/Permission.js +7 -0
- package/SubMenusContainer.d.ts +28 -0
- package/SubMenusContainer.js +72 -0
- package/Upgrade.d.ts +7 -0
- package/Upgrade.js +46 -0
- package/UserModals.js +1 -1
- package/auth/AuthPassword.d.ts +5 -0
- package/auth/AuthPassword.js +11 -5
- package/auth/AuthStyle01.d.ts +10 -1
- package/auth/AuthStyle01.js +7 -2
- package/auth/AuthStyle02.d.ts +10 -1
- package/auth/AuthStyle02.js +7 -2
- package/content/ParentContext.d.ts +8 -0
- package/content/ParentContext.js +9 -0
- package/content/PermissionContext.d.ts +4 -0
- package/content/PermissionContext.js +12 -0
- package/icon/directory.svg +11 -8
- package/icon/empty.svg +40 -40
- package/icon/media.png +0 -0
- package/icon/volc.svg +96 -0
- package/package.json +6 -6
package/AppLayout.d.ts
CHANGED
|
@@ -78,6 +78,14 @@ export declare type LayoutProps = {
|
|
|
78
78
|
* 子路径路径分割符号, 用去区分是否子路径判断子路径的菜单归属
|
|
79
79
|
*/
|
|
80
80
|
pathPartition: string[];
|
|
81
|
+
/**
|
|
82
|
+
* 请求获取用户信息
|
|
83
|
+
*/
|
|
84
|
+
requestUser: () => Promise<UserInfo>;
|
|
85
|
+
/**
|
|
86
|
+
* 登录页面.
|
|
87
|
+
*/
|
|
88
|
+
authPath?: string;
|
|
81
89
|
/**
|
|
82
90
|
* 左侧: Logo样式
|
|
83
91
|
*/
|
|
@@ -90,6 +98,10 @@ export declare type LayoutProps = {
|
|
|
90
98
|
* 高度
|
|
91
99
|
*/
|
|
92
100
|
height?: number;
|
|
101
|
+
/**
|
|
102
|
+
* 跳转路径
|
|
103
|
+
*/
|
|
104
|
+
link?: string;
|
|
93
105
|
};
|
|
94
106
|
/**
|
|
95
107
|
* 右侧: 用户下拉选菜单
|
|
@@ -97,7 +109,7 @@ export declare type LayoutProps = {
|
|
|
97
109
|
userMenus?: {
|
|
98
110
|
key: string;
|
|
99
111
|
type?: string;
|
|
100
|
-
label:
|
|
112
|
+
label: ReactNode;
|
|
101
113
|
}[];
|
|
102
114
|
/**
|
|
103
115
|
* 头部: 从右到左菜单
|
|
@@ -108,10 +120,6 @@ export declare type LayoutProps = {
|
|
|
108
120
|
* @param path 路径.
|
|
109
121
|
*/
|
|
110
122
|
toLink?: (path: string) => void;
|
|
111
|
-
/**
|
|
112
|
-
* 请求获取用户信息
|
|
113
|
-
*/
|
|
114
|
-
requestUser?: () => Promise<UserInfo>;
|
|
115
123
|
/**
|
|
116
124
|
* 请求获取菜单信息
|
|
117
125
|
* @param appCode 应用代码
|
package/AppLayout.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { css } from '@emotion/css';
|
|
3
|
-
import {
|
|
4
|
-
import { Dropdown, message, Typography } from 'antd';
|
|
3
|
+
import { ProLayout } from '@ant-design/pro-components';
|
|
4
|
+
import { Dropdown, message, theme, Typography } from 'antd';
|
|
5
5
|
import { Session } from 'beer-network/session';
|
|
6
6
|
import dayjs from 'dayjs';
|
|
7
7
|
import ImageLayout01 from './images/layout_01.png';
|
|
@@ -9,6 +9,7 @@ import ImageLayout02 from './images/layout_02.png';
|
|
|
9
9
|
import ImageLayout03 from './images/layout_03.png';
|
|
10
10
|
dayjs.locale('zh-cn');
|
|
11
11
|
const Component = (props) => {
|
|
12
|
+
const { token } = theme.useToken();
|
|
12
13
|
const [messageApi, contextHolder] = message.useMessage();
|
|
13
14
|
// App
|
|
14
15
|
const [app, setApp] = useState({});
|
|
@@ -16,6 +17,8 @@ const Component = (props) => {
|
|
|
16
17
|
const [userInfo, setUserInfo] = useState();
|
|
17
18
|
// 菜单是否折叠
|
|
18
19
|
const [collapsed, setCollapsed] = useState(false);
|
|
20
|
+
// 是否是手机号
|
|
21
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
19
22
|
// 菜单的选择
|
|
20
23
|
const [pathKeys, setPathKeys] = useState([]);
|
|
21
24
|
// 获取参数参数
|
|
@@ -84,7 +87,7 @@ const Component = (props) => {
|
|
|
84
87
|
messageApi.success('退出登录成功!')
|
|
85
88
|
.then();
|
|
86
89
|
setTimeout(() => {
|
|
87
|
-
Session.logout('/auth/login');
|
|
90
|
+
Session.logout(props?.authPath || '/auth/login');
|
|
88
91
|
}, 800);
|
|
89
92
|
};
|
|
90
93
|
// 更新属性触发: 应用
|
|
@@ -99,8 +102,8 @@ const Component = (props) => {
|
|
|
99
102
|
}, [menus, props.path]);
|
|
100
103
|
// 更新属性触发: 请求用户信息
|
|
101
104
|
useEffect(() => {
|
|
102
|
-
props
|
|
103
|
-
|
|
105
|
+
props.requestUser()
|
|
106
|
+
.then(userInfo => {
|
|
104
107
|
// 更新缓存到Session
|
|
105
108
|
if (userInfo === undefined || userInfo?.id === undefined) {
|
|
106
109
|
return;
|
|
@@ -108,10 +111,10 @@ const Component = (props) => {
|
|
|
108
111
|
setUserInfo(userInfo);
|
|
109
112
|
sessionStorage.setItem('SESSION', JSON.stringify(userInfo));
|
|
110
113
|
});
|
|
111
|
-
}, [
|
|
112
|
-
return React.createElement(
|
|
114
|
+
}, []);
|
|
115
|
+
return React.createElement(React.Fragment, null,
|
|
113
116
|
contextHolder,
|
|
114
|
-
React.createElement(ProLayout, { className: css `
|
|
117
|
+
React.createElement(ProLayout, { theme: "light", className: css `
|
|
115
118
|
.ant-pro-sider-logo {
|
|
116
119
|
.ant-pro-layout-apps-icon {
|
|
117
120
|
display: ${collapsed ? 'flex' : 'none'};
|
|
@@ -134,7 +137,7 @@ const Component = (props) => {
|
|
|
134
137
|
padding: 3px;
|
|
135
138
|
|
|
136
139
|
& > div {
|
|
137
|
-
height:
|
|
140
|
+
height: ${token.controlHeight + 2}px;
|
|
138
141
|
line-height: 1.5;
|
|
139
142
|
}
|
|
140
143
|
}
|
|
@@ -175,18 +178,21 @@ const Component = (props) => {
|
|
|
175
178
|
heightLayoutHeader: 48
|
|
176
179
|
},
|
|
177
180
|
sider: {
|
|
178
|
-
menuHeight:
|
|
181
|
+
menuHeight: token.controlHeight + 2,
|
|
179
182
|
paddingBlockLayoutMenu: 4,
|
|
180
183
|
paddingInlineLayoutMenu: 4,
|
|
181
184
|
colorMenuBackground: '#fff',
|
|
182
185
|
colorTextMenu: 'rgb(87, 89, 102)',
|
|
186
|
+
colorTextMenuSelected: 'rgba(0,0,0,0.8)',
|
|
183
187
|
colorBgMenuItemSelected: 'rgba(0,0,0,0.08)'
|
|
184
188
|
},
|
|
185
189
|
pageContainer: {
|
|
186
190
|
paddingInlinePageContainerContent: 0,
|
|
187
191
|
paddingBlockPageContainerContent: 0
|
|
188
192
|
}
|
|
189
|
-
}, siderMenuType: 'sub', fixedHeader: true,
|
|
193
|
+
}, siderMenuType: 'sub', fixedHeader: true, collapsedButtonRender: (collapsed, reactNode) => {
|
|
194
|
+
return isMobile ? undefined : reactNode;
|
|
195
|
+
}, appList: (props.apps?.length || 0) > 1 || collapsed ? props.apps?.map(it => {
|
|
190
196
|
return {
|
|
191
197
|
...it,
|
|
192
198
|
icon: React.createElement("img", { src: it.icon, alt: "" }),
|
|
@@ -195,13 +201,16 @@ const Component = (props) => {
|
|
|
195
201
|
url: it.defaultPath || it.path
|
|
196
202
|
};
|
|
197
203
|
}) : [], menuHeaderRender: (_logo, _title, props) => {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
204
|
+
if (props !== undefined) {
|
|
205
|
+
setTimeout(() => {
|
|
206
|
+
setCollapsed(props?.collapsed === true);
|
|
207
|
+
setIsMobile(props?.isMobile === true);
|
|
208
|
+
});
|
|
209
|
+
}
|
|
201
210
|
return React.createElement(React.Fragment, null, props?.collapsed ? undefined : React.createElement("div", { style: {
|
|
202
211
|
padding: '2px 0',
|
|
203
212
|
textIndent: 10,
|
|
204
|
-
fontSize:
|
|
213
|
+
fontSize: token.fontSize + 2,
|
|
205
214
|
color: '#333',
|
|
206
215
|
fontWeight: 500
|
|
207
216
|
} }, app?.name));
|
|
@@ -214,8 +223,8 @@ const Component = (props) => {
|
|
|
214
223
|
}
|
|
215
224
|
}, subMenuItemRender: (props, _defaultDom, menuProps) => {
|
|
216
225
|
return React.createElement("div", { style: {
|
|
217
|
-
height:
|
|
218
|
-
fontSize:
|
|
226
|
+
height: token.controlHeight + 2,
|
|
227
|
+
fontSize: token.fontSize,
|
|
219
228
|
display: 'flex',
|
|
220
229
|
alignItems: 'center',
|
|
221
230
|
justifyContent: menuProps.collapsed ? 'center' : undefined,
|
|
@@ -233,9 +242,9 @@ const Component = (props) => {
|
|
|
233
242
|
const isSub = (props.locale?.toString()
|
|
234
243
|
?.split('.') || []).length > 2;
|
|
235
244
|
return React.createElement("a", { style: {
|
|
236
|
-
fontSize:
|
|
245
|
+
fontSize: token.fontSize,
|
|
237
246
|
userSelect: 'none',
|
|
238
|
-
height:
|
|
247
|
+
height: token.controlHeight + 2,
|
|
239
248
|
display: 'flex',
|
|
240
249
|
alignItems: 'center',
|
|
241
250
|
justifyContent: menuProps.collapsed && !isSub ? 'center' : undefined,
|
|
@@ -263,13 +272,19 @@ const Component = (props) => {
|
|
|
263
272
|
display: block;
|
|
264
273
|
margin: 0 6px;
|
|
265
274
|
}
|
|
266
|
-
|
|
275
|
+
`, onClick: () => {
|
|
276
|
+
const link = props?.logo?.link || '';
|
|
277
|
+
if (link === '') {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
window.location.href = link;
|
|
281
|
+
} },
|
|
267
282
|
React.createElement("img", { src: props?.logo?.path, alt: "" })), title: false, avatarProps: {
|
|
268
283
|
src: (userInfo?.avatar || '') === '' ? '/avatar.png' : userInfo?.avatar,
|
|
269
284
|
size: 'small',
|
|
270
285
|
title: React.createElement("span", { style: {
|
|
271
286
|
color: '#333',
|
|
272
|
-
fontSize:
|
|
287
|
+
fontSize: token.fontSize + 1
|
|
273
288
|
} }, userInfo?.nickName || '系统用户'),
|
|
274
289
|
render: (_props, dom) => {
|
|
275
290
|
return (React.createElement(Dropdown, { menu: {
|
|
@@ -289,7 +304,7 @@ const Component = (props) => {
|
|
|
289
304
|
React.createElement(Typography.Text, { ellipsis: true, style: {
|
|
290
305
|
width: 200,
|
|
291
306
|
fontWeight: 500,
|
|
292
|
-
fontSize:
|
|
307
|
+
fontSize: token.fontSize + 1
|
|
293
308
|
} }, userInfo?.companyName || userInfo?.nickName)),
|
|
294
309
|
React.createElement("p", null,
|
|
295
310
|
React.createElement(Typography.Text, { ellipsis: true, style: { width: 200 } },
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { css } from '@emotion/css';
|
|
3
|
+
import { PageContainer } from '@ant-design/pro-components';
|
|
4
|
+
import { useNavigate } from 'react-router-dom';
|
|
5
|
+
import { theme } from 'antd';
|
|
6
|
+
export const Component = (props) => {
|
|
7
|
+
const { token } = theme.useToken();
|
|
8
|
+
const navigate = useNavigate();
|
|
9
|
+
return React.createElement(React.Fragment, null,
|
|
10
|
+
React.createElement(PageContainer, { onBack: () => {
|
|
11
|
+
navigate(-1);
|
|
12
|
+
}, className: css `
|
|
13
|
+
.ant-page-header-heading {
|
|
14
|
+
padding-block-start: 0 !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ant-page-header-heading-title {
|
|
18
|
+
font-size: ${token.fontSize + 2}px;
|
|
19
|
+
line-height: 1.5;
|
|
20
|
+
color: #333;
|
|
21
|
+
}
|
|
22
|
+
`, header: {
|
|
23
|
+
style: {
|
|
24
|
+
background: '#fff',
|
|
25
|
+
padding: '10px 24px',
|
|
26
|
+
borderBottom: '1px solid rgba(0, 0, 0, 0.06)'
|
|
27
|
+
}
|
|
28
|
+
}, title: props.title, ghost: true, childrenContentStyle: {
|
|
29
|
+
padding: '0'
|
|
30
|
+
} },
|
|
31
|
+
React.createElement("div", { className: css `
|
|
32
|
+
padding: 12px 16px;
|
|
33
|
+
` }, props.children)));
|
|
34
|
+
};
|
|
35
|
+
export default Component;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { App, ConfigProvider } from 'antd';
|
|
3
|
+
export const Component = (props) => {
|
|
4
|
+
return React.createElement(App, null,
|
|
5
|
+
React.createElement(ConfigProvider, { theme: {
|
|
6
|
+
token: {
|
|
7
|
+
fontSize: 12,
|
|
8
|
+
controlHeight: 26,
|
|
9
|
+
fontWeightStrong: 500
|
|
10
|
+
},
|
|
11
|
+
components: {
|
|
12
|
+
Table: {
|
|
13
|
+
motion: false,
|
|
14
|
+
headerColor: '#333',
|
|
15
|
+
rowHoverBg: '#f5f6f7',
|
|
16
|
+
rowSelectedBg: '#f4f5f6',
|
|
17
|
+
rowSelectedHoverBg: '#e6e7e8',
|
|
18
|
+
headerBg: '#fafafa',
|
|
19
|
+
cellPaddingInlineSM: 6,
|
|
20
|
+
cellPaddingBlockSM: 7
|
|
21
|
+
},
|
|
22
|
+
Switch: {
|
|
23
|
+
fontSize: 10
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
} }, props?.children));
|
|
27
|
+
};
|
|
28
|
+
export default Component;
|
package/MediaModals.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DirectorySelectProps } from 'beer-assembly/DirectorySelect';
|
|
3
|
+
export type Handler<T> = {
|
|
4
|
+
ok: (callback?: (params: T) => void) => void;
|
|
5
|
+
};
|
|
6
|
+
type DirectoryRequest = NonNullable<DirectorySelectProps['request']>;
|
|
7
|
+
export declare type MediaItem = {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
type: 'DIRECTORY' | 'FILE';
|
|
11
|
+
url: string;
|
|
12
|
+
active: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare type RequestParams = {
|
|
15
|
+
/**
|
|
16
|
+
* 获取列表数据.
|
|
17
|
+
* @param parentId 父类ID.
|
|
18
|
+
*/
|
|
19
|
+
requestList: (parentId: string) => Promise<MediaItem[]>;
|
|
20
|
+
rename: (id: string, name: string) => Promise<Boolean>;
|
|
21
|
+
copy: (id: string) => Promise<Boolean>;
|
|
22
|
+
move: (moveId: string, targetId: string) => Promise<Boolean>;
|
|
23
|
+
remove: (id: string) => Promise<Boolean>;
|
|
24
|
+
createDirectory: (parentId: string, name: string) => Promise<Boolean>;
|
|
25
|
+
putFile: (parentId: string, files: FileList) => Promise<Boolean>;
|
|
26
|
+
} & {
|
|
27
|
+
directory: DirectoryRequest;
|
|
28
|
+
};
|
|
29
|
+
export declare class MediaModals {
|
|
30
|
+
static useMedia(request?: RequestParams): [Handler<string[]>, ReactNode];
|
|
31
|
+
}
|
|
32
|
+
export {};
|