@gm-pc/react 1.8.0-alpha.1 → 1.8.1-alpha.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gm-pc/react",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.1-alpha.0",
|
|
4
4
|
"description": "观麦前端基础组件库",
|
|
5
5
|
"author": "liyatang <liyatang@qq.com>",
|
|
6
6
|
"homepage": "https://github.com/gmfe/gm-pc#readme",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@gm-common/hooks": "^2.10.0",
|
|
26
26
|
"@gm-common/tool": "^2.10.0",
|
|
27
|
-
"@gm-pc/locales": "^1.8.
|
|
27
|
+
"@gm-pc/locales": "^1.8.1-alpha.0",
|
|
28
28
|
"big.js": "^6.0.1",
|
|
29
29
|
"classnames": "^2.2.5",
|
|
30
30
|
"lodash": "^4.17.19",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"react-dom": "^16.14.0",
|
|
47
47
|
"react-window": "^1.8.5"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "47f2c19560d4fb25c095d71310e0defab725f4a4"
|
|
50
50
|
}
|
|
@@ -49,10 +49,6 @@ const NavItem: FC<NavItemProps> = ({
|
|
|
49
49
|
setRect(null)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
const handlePushCreate = (data: NavDataLevel2) => {
|
|
53
|
-
onPushCreate(data)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
52
|
let iconE = icon
|
|
57
53
|
if ((rect || active) && iconActive) {
|
|
58
54
|
iconE = iconActive
|
|
@@ -85,7 +81,7 @@ const NavItem: FC<NavItemProps> = ({
|
|
|
85
81
|
data={sub}
|
|
86
82
|
selected={selected}
|
|
87
83
|
onSelect={handleSelect}
|
|
88
|
-
onPushCreate={
|
|
84
|
+
onPushCreate={(data) => onPushCreate(data)}
|
|
89
85
|
/>
|
|
90
86
|
)}
|
|
91
87
|
</Portal>
|
|
@@ -22,15 +22,18 @@ const Popup: FC<PopupProps> = ({
|
|
|
22
22
|
}
|
|
23
23
|
}, [parentRect])
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* 在 对应的 div 设置了 最大宽度 900 px
|
|
27
|
+
* @description UI 图是超过五个换行, 现在无论多少模块都在一行, 根据UI图对宽度进行处理
|
|
28
|
+
* @param number 二级菜单的个数
|
|
29
|
+
* @returns popup 的宽度
|
|
30
|
+
*/
|
|
26
31
|
const setPopupWidth = (number: number): string => {
|
|
32
|
+
// 只有一个的基本宽度, 根据 UI图, 一个三级路由占据的 宽度 + 左右margin
|
|
27
33
|
const baseWidth = 212
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
const widthArray = [baseWidth].concat(arr).map((i) => i + 'px')
|
|
33
|
-
return widthArray[number - 1]
|
|
34
|
+
// 有多个模块 半句的最大宽段, 超出 900 换行
|
|
35
|
+
const maxWidth = baseWidth + (number - 1) * 172
|
|
36
|
+
return maxWidth + 'px'
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
const handleMouseEnter: MouseEventHandler<HTMLDivElement> = (e) => {
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CSSProperties, ReactNode, MouseEvent } from 'react'
|
|
2
|
+
|
|
3
|
+
interface NavExtraProps {
|
|
4
|
+
/** 直接到达新建页面 */
|
|
5
|
+
onPushCreate(data: NavDataLevel3): void
|
|
6
|
+
/** 底部一级菜单显示图片 */
|
|
7
|
+
footerImage?: ReactNode
|
|
8
|
+
}
|
|
2
9
|
|
|
3
10
|
interface NavDataLevel3 {
|
|
4
11
|
link: string
|
|
5
12
|
name: string
|
|
13
|
+
/** 配置跳转到对应新建页的 提示 和 地址 */
|
|
6
14
|
toCreate?: {
|
|
7
15
|
tip: string
|
|
8
16
|
href: string
|
|
@@ -24,7 +32,7 @@ interface NavData {
|
|
|
24
32
|
sub: NavDataLevel2[]
|
|
25
33
|
}
|
|
26
34
|
|
|
27
|
-
interface NavProps {
|
|
35
|
+
interface NavProps extends NavExtraProps {
|
|
28
36
|
logo?: ReactNode
|
|
29
37
|
/** 三级菜单 没有sub就没有浮层 */
|
|
30
38
|
data: NavData[]
|
|
@@ -32,28 +40,23 @@ interface NavProps {
|
|
|
32
40
|
selected: string
|
|
33
41
|
/** 如果是选中一二级,会直接返回改分级下第三级的 item */
|
|
34
42
|
onSelect(data: NavDataLevel3): void
|
|
35
|
-
/** 直接到达新建页面 */
|
|
36
|
-
onPushCreate(data: NavDataLevel3): void
|
|
37
43
|
/** 控制 浮层的线上,如商品库传 merchandise */
|
|
38
44
|
showActive?: string
|
|
39
45
|
other?: ReactNode
|
|
40
46
|
className?: string
|
|
41
47
|
style?: CSSProperties
|
|
42
|
-
|
|
43
|
-
footerImage?: ReactNode
|
|
48
|
+
/** 底部 iot 图片 & 数据 */
|
|
44
49
|
footerConfig?: NavData[]
|
|
45
50
|
}
|
|
46
51
|
|
|
47
|
-
interface NavItemProps {
|
|
52
|
+
interface NavItemProps extends NavExtraProps {
|
|
48
53
|
data: NavData
|
|
49
54
|
selected: string
|
|
50
55
|
onSelect(data: NavDataLevel3): void
|
|
51
|
-
onPushCreate(data: NavDataLevel3): void
|
|
52
56
|
/** onMouseMove 的回调 */
|
|
53
57
|
onMouseMove(event: MouseEvent, link: string): void
|
|
54
58
|
/** 控制子导航列表的显示 */
|
|
55
59
|
showSub?: boolean
|
|
56
|
-
footerImage?: ReactNode
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
interface PopupProps {
|