aldehyde 0.2.409 → 0.2.412
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/lib/controls/entity-select/popover-entity-select.js +1 -1
- package/lib/controls/entity-select/popover-entity-select.js.map +1 -1
- package/lib/controls/enum-badge/index.d.ts.map +1 -1
- package/lib/controls/enum-badge/index.js +1 -1
- package/lib/controls/enum-badge/index.js.map +1 -1
- package/lib/controls/enum-tag/index.d.ts.map +1 -1
- package/lib/controls/enum-tag/index.js +3 -4
- package/lib/controls/enum-tag/index.js.map +1 -1
- package/lib/controls/html-editor/draft.d.ts +2 -1
- package/lib/controls/html-editor/draft.d.ts.map +1 -1
- package/lib/controls/html-editor/draft.js +3 -5
- package/lib/controls/html-editor/draft.js.map +1 -1
- package/lib/controls/html-editor/index.less +68 -0
- package/lib/detail/edit/popover-edit-card.js +1 -1
- package/lib/detail/edit/popover-edit-card.js.map +1 -1
- package/lib/detail/edit/popover-editor.d.ts.map +1 -1
- package/lib/detail/edit/popover-editor.js +1 -3
- package/lib/detail/edit/popover-editor.js.map +1 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -3
- package/lib/index.js.map +1 -1
- package/lib/layout/menu/l2menu-message-bar.d.ts +1 -0
- package/lib/layout/menu/l2menu-message-bar.d.ts.map +1 -1
- package/lib/layout/menu/l2menu-message-bar.js +3 -2
- package/lib/layout/menu/l2menu-message-bar.js.map +1 -1
- package/lib/layout/menu/message-bar.less +69 -0
- package/lib/layout2/components/theme-button.d.ts.map +1 -1
- package/lib/layout2/components/theme-button.js +18 -4
- package/lib/layout2/components/theme-button.js.map +1 -1
- package/lib/layout2/css/header.css +10 -6
- package/lib/layout2/css/tabs-layout.less +6 -0
- package/lib/layout2/header.d.ts +1 -1
- package/lib/layout2/header.d.ts.map +1 -1
- package/lib/layout2/header.js +2 -5
- package/lib/layout2/header.js.map +1 -1
- package/lib/layout2/page.d.ts +5 -1
- package/lib/layout2/page.d.ts.map +1 -1
- package/lib/layout2/page.js +18 -8
- package/lib/layout2/page.js.map +1 -1
- package/lib/layout2/type/layout-type.d.ts +4 -0
- package/lib/layout2/type/layout-type.d.ts.map +1 -1
- package/lib/layout3/page.d.ts.map +1 -1
- package/lib/layout3/page.js +17 -5
- package/lib/layout3/page.js.map +1 -1
- package/lib/layout4/css/main.less +1 -1
- package/lib/layout4/header.d.ts +1 -1
- package/lib/layout4/header.d.ts.map +1 -1
- package/lib/layout4/header.js +1 -2
- package/lib/layout4/header.js.map +1 -1
- package/lib/layout4/page.d.ts +1 -1
- package/lib/layout4/page.d.ts.map +1 -1
- package/lib/layout4/page.js +21 -6
- package/lib/layout4/page.js.map +1 -1
- package/lib/layout5/css/sider.less +6 -0
- package/lib/layout5/page.d.ts +1 -1
- package/lib/layout5/page.d.ts.map +1 -1
- package/lib/layout5/page.js +21 -6
- package/lib/layout5/page.js.map +1 -1
- package/lib/layout5/sider.d.ts +1 -1
- package/lib/layout5/sider.d.ts.map +1 -1
- package/lib/layout5/sider.js +1 -2
- package/lib/layout5/sider.js.map +1 -1
- package/lib/list/card-list/index.less +6 -4
- package/lib/list/vertical-list/index.d.ts +2 -3
- package/lib/list/vertical-list/index.d.ts.map +1 -1
- package/lib/list/vertical-list/index.js +7 -39
- package/lib/list/vertical-list/index.js.map +1 -1
- package/lib/list/vertical-list/index.less +191 -12
- package/lib/list/vertical-list/item.d.ts +13 -0
- package/lib/list/vertical-list/item.d.ts.map +1 -0
- package/lib/list/vertical-list/item.js +91 -0
- package/lib/list/vertical-list/item.js.map +1 -0
- package/lib/module/ltmpl-table.d.ts +4 -1
- package/lib/module/ltmpl-table.d.ts.map +1 -1
- package/lib/module/ltmpl-table.js +3 -2
- package/lib/module/ltmpl-table.js.map +1 -1
- package/lib/sso-Login/index.d.ts +7 -0
- package/lib/sso-Login/index.d.ts.map +1 -0
- package/lib/sso-Login/index.js +51 -0
- package/lib/sso-Login/index.js.map +1 -0
- package/lib/table/act-table.d.ts +2 -0
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +3 -2
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/column/column-builder.d.ts.map +1 -1
- package/lib/table/column/column-builder.js +25 -7
- package/lib/table/column/column-builder.js.map +1 -1
- package/lib/table/column/index.less +7 -5
- package/lib/table/query-table.d.ts +1 -0
- package/lib/table/query-table.d.ts.map +1 -1
- package/lib/table/query-table.js +7 -5
- package/lib/table/query-table.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +5 -0
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +28 -0
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +8 -1
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/units/index.d.ts +3 -1
- package/lib/units/index.d.ts.map +1 -1
- package/lib/units/index.js +22 -4
- package/lib/units/index.js.map +1 -1
- package/lib/welcome/HCWelcome.js +45 -20
- package/lib/welcome/HCWelcome.js.map +1 -1
- package/lib/welcome/components/menu-card.d.ts +10 -0
- package/lib/welcome/components/menu-card.d.ts.map +1 -0
- package/lib/welcome/components/menu-card.js +43 -0
- package/lib/welcome/components/menu-card.js.map +1 -0
- package/lib/welcome/components/menu-card.less +96 -0
- package/lib/welcome/components/page-card.d.ts +16 -0
- package/lib/welcome/components/page-card.d.ts.map +1 -0
- package/lib/welcome/components/page-card.js +86 -0
- package/lib/welcome/components/page-card.js.map +1 -0
- package/lib/welcome/components/page-card.less +50 -0
- package/lib/welcome/components/quick-entrance.d.ts +14 -0
- package/lib/welcome/components/quick-entrance.d.ts.map +1 -0
- package/lib/welcome/components/quick-entrance.js +66 -0
- package/lib/welcome/components/quick-entrance.js.map +1 -0
- package/lib/welcome/components/quick-entrance.less +121 -0
- package/lib/welcome/components/workbench.d.ts +14 -0
- package/lib/welcome/components/workbench.d.ts.map +1 -0
- package/lib/welcome/components/workbench.js +115 -0
- package/lib/welcome/components/workbench.js.map +1 -0
- package/lib/welcome/components/workbench.less +119 -0
- package/package.json +1 -1
- package/src/aldehyde/controls/entity-select/popover-entity-select.tsx +1 -1
- package/src/aldehyde/controls/enum-badge/index.tsx +3 -2
- package/src/aldehyde/controls/enum-tag/index.tsx +9 -12
- package/src/aldehyde/controls/html-editor/draft.tsx +27 -31
- package/src/aldehyde/controls/html-editor/index.less +68 -0
- package/src/aldehyde/detail/edit/popover-edit-card.tsx +3 -3
- package/src/aldehyde/detail/edit/popover-editor.tsx +20 -22
- package/src/aldehyde/index.tsx +6 -3
- package/src/aldehyde/layout/menu/l2menu-message-bar.tsx +4 -1
- package/src/aldehyde/layout/menu/message-bar.less +69 -0
- package/src/aldehyde/layout2/components/theme-button.tsx +9 -4
- package/src/aldehyde/layout2/css/header.css +10 -6
- package/src/aldehyde/layout2/css/tabs-layout.less +6 -0
- package/src/aldehyde/layout2/header.tsx +6 -10
- package/src/aldehyde/layout2/page.tsx +21 -10
- package/src/aldehyde/layout2/type/layout-type.ts +4 -0
- package/src/aldehyde/layout3/page.tsx +9 -5
- package/src/aldehyde/layout4/css/main.less +1 -1
- package/src/aldehyde/layout4/header.tsx +2 -3
- package/src/aldehyde/layout4/page.tsx +14 -7
- package/src/aldehyde/layout5/css/sider.less +6 -0
- package/src/aldehyde/layout5/page.tsx +14 -7
- package/src/aldehyde/layout5/sider.tsx +5 -8
- package/src/aldehyde/list/card-list/index.less +6 -4
- package/src/aldehyde/list/vertical-list/index.less +191 -12
- package/src/aldehyde/list/vertical-list/index.tsx +10 -70
- package/src/aldehyde/list/vertical-list/item.tsx +136 -0
- package/src/aldehyde/module/ltmpl-table.tsx +7 -2
- package/src/aldehyde/sso-Login/index.tsx +49 -0
- package/src/aldehyde/table/act-table.tsx +4 -1
- package/src/aldehyde/table/column/column-builder.tsx +28 -10
- package/src/aldehyde/table/column/index.less +7 -5
- package/src/aldehyde/table/query-table.tsx +8 -7
- package/src/aldehyde/tmpl/hcservice-v3.tsx +26 -0
- package/src/aldehyde/tmpl/interface.tsx +6 -1
- package/src/aldehyde/units/index.tsx +21 -4
- package/src/aldehyde/welcome/HCWelcome.js +54 -28
- package/src/aldehyde/welcome/components/menu-card.less +96 -0
- package/src/aldehyde/welcome/components/menu-card.tsx +68 -0
- package/src/aldehyde/welcome/components/page-card.less +50 -0
- package/src/aldehyde/welcome/components/page-card.tsx +97 -0
- package/src/aldehyde/welcome/components/quick-entrance.less +121 -0
- package/src/aldehyde/welcome/components/quick-entrance.tsx +80 -0
- package/src/aldehyde/welcome/components/workbench.less +119 -0
- package/src/aldehyde/welcome/components/workbench.tsx +144 -0
- package/lib/welcome/quick-entrance.d.ts +0 -37
- package/lib/welcome/quick-entrance.d.ts.map +0 -1
- package/lib/welcome/quick-entrance.js +0 -93
- package/lib/welcome/quick-entrance.js.map +0 -1
- package/lib/welcome/workbench.d.ts +0 -37
- package/lib/welcome/workbench.d.ts.map +0 -1
- package/lib/welcome/workbench.js +0 -92
- package/lib/welcome/workbench.js.map +0 -1
- package/src/aldehyde/welcome/quick-entrance.tsx +0 -100
- package/src/aldehyde/welcome/workbench.tsx +0 -102
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
.page-card {
|
|
2
|
+
position: relative;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
border-radius: 0.75rem;
|
|
5
|
+
padding: 1.25rem 0;
|
|
6
|
+
border: 1px solid;
|
|
7
|
+
|
|
8
|
+
.heard {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
padding: 0 1.25rem;
|
|
13
|
+
|
|
14
|
+
.title {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: 0.5rem;
|
|
18
|
+
|
|
19
|
+
.line {
|
|
20
|
+
width: 0.25rem;
|
|
21
|
+
height: 1.25rem;
|
|
22
|
+
border-radius: 9999px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.text {
|
|
26
|
+
font-weight: 600;
|
|
27
|
+
margin: 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.card-content {
|
|
33
|
+
min-height: 100px;
|
|
34
|
+
max-height: 50vh;
|
|
35
|
+
overflow: auto;
|
|
36
|
+
|
|
37
|
+
.ant-layout {
|
|
38
|
+
background: transparent !important;
|
|
39
|
+
|
|
40
|
+
.ant-list-items {
|
|
41
|
+
padding: 0 1.25rem;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.actTable {
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import { theme, Empty } from "antd";
|
|
3
|
+
import { RightOutlined } from "@ant-design/icons";
|
|
4
|
+
import { useNavigate } from "react-router-dom";
|
|
5
|
+
import "antd/dist/reset.css";
|
|
6
|
+
import HCDataSource from "../../tmpl/hc-data-source";
|
|
7
|
+
import { Level2Menu } from "../../tmpl/interface";
|
|
8
|
+
import { handleMenuItemUrl } from "../../layout2/page";
|
|
9
|
+
import { useLocale } from "../../locale/useLocale";
|
|
10
|
+
import LtmplTable from "../../module/ltmpl-table";
|
|
11
|
+
import "./page-card.less";
|
|
12
|
+
|
|
13
|
+
// 查找第n个子菜单
|
|
14
|
+
const findNthLeaf = (tree, n = 1) => {
|
|
15
|
+
// 边界校验:n 必须是正整数
|
|
16
|
+
if (!Array.isArray(tree) || !Number.isInteger(n) || n < 1) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
let count = 0; // 已找到的叶子数量(从 0 开始计)
|
|
20
|
+
const dfs = (nodes) => {
|
|
21
|
+
for (const node of nodes) {
|
|
22
|
+
// 检查当前节点是否为大屏或者自定义页面
|
|
23
|
+
if (node.dragDropPageId || node.customPath) {
|
|
24
|
+
continue; // 跳过被排除的节点及其子树
|
|
25
|
+
}
|
|
26
|
+
const isLeaf = !node.children || node.children.length === 0;
|
|
27
|
+
if (isLeaf) {
|
|
28
|
+
count++;
|
|
29
|
+
if (count === n) {
|
|
30
|
+
return node; // 找到第 n 个叶子
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
const result = dfs(node.children);
|
|
34
|
+
if (result) return result; // 提前终止
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return dfs(tree);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
const { useToken } = theme;
|
|
44
|
+
|
|
45
|
+
interface MenuType extends Level2Menu {
|
|
46
|
+
url: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface Props {
|
|
50
|
+
layoutRootPath?: string;
|
|
51
|
+
fastMenu: string;
|
|
52
|
+
menus: MenuType[];
|
|
53
|
+
menuOrder: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const Index = (props: Props) => {
|
|
57
|
+
const { layoutRootPath, fastMenu, menus, menuOrder } = props;
|
|
58
|
+
const [l2Menu, setL2Menu] = useState<MenuType>();
|
|
59
|
+
const navigate = useNavigate();
|
|
60
|
+
const { translate } = useLocale();
|
|
61
|
+
const { token } = useToken();
|
|
62
|
+
|
|
63
|
+
const getL2Menu = async () => {
|
|
64
|
+
let temData: Level2Menu[] = await HCDataSource.fastMenu(fastMenu);
|
|
65
|
+
const itemMenu = temData?.[0];
|
|
66
|
+
if (itemMenu && !itemMenu.disabled) {
|
|
67
|
+
const { id, pageType, defaultCriteriaValue, customPath, dragDropPageId, fullScreen } = itemMenu;
|
|
68
|
+
const url = handleMenuItemUrl(id, pageType, defaultCriteriaValue, customPath, dragDropPageId, fullScreen, layoutRootPath);
|
|
69
|
+
setL2Menu({ ...itemMenu, url });
|
|
70
|
+
} else {
|
|
71
|
+
setL2Menu(findNthLeaf(menus, menuOrder || 0));
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (menus?.length && fastMenu) {
|
|
77
|
+
getL2Menu();
|
|
78
|
+
}
|
|
79
|
+
}, [menus, fastMenu]);
|
|
80
|
+
|
|
81
|
+
return <div className="page-card" style={{ borderColor: `${token.colorBorder}CC`, backgroundColor: token.colorBgContainer }}>
|
|
82
|
+
<div className="heard">
|
|
83
|
+
<div className="title">
|
|
84
|
+
<div className="line" style={{ background: token.colorPrimary }} />
|
|
85
|
+
<h3 className="text">{l2Menu?.title || "-"}</h3>
|
|
86
|
+
</div>
|
|
87
|
+
<div style={{ color: token.colorPrimary, cursor: "pointer" }} onClick={() => l2Menu?.url && navigate(`/${l2Menu.url}`)}>
|
|
88
|
+
{translate("${查看更多}")} <RightOutlined />
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
<div className="card-content">
|
|
92
|
+
{l2Menu?.id ? <LtmplTable sourceId={l2Menu?.id} funcMode="simple" defShowType="verticalList" showPagination={false} /> : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />}
|
|
93
|
+
</div>
|
|
94
|
+
</div>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export default Index;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
.quick-entrance {
|
|
2
|
+
position: relative;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
border-radius: 0.75rem;
|
|
5
|
+
padding: 1.25rem;
|
|
6
|
+
border: 1px solid;
|
|
7
|
+
|
|
8
|
+
.heard {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
|
|
13
|
+
.title {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: 0.5rem;
|
|
17
|
+
|
|
18
|
+
.line {
|
|
19
|
+
width: 0.25rem;
|
|
20
|
+
height: 1.25rem;
|
|
21
|
+
border-radius: 9999px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.text {
|
|
25
|
+
font-weight: 600;
|
|
26
|
+
margin: 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.quick-action {
|
|
32
|
+
transition-property: all;
|
|
33
|
+
transition-timing-function: cubic-bezier(.4, 0, .2, 1);
|
|
34
|
+
transition-duration: .15s;
|
|
35
|
+
padding: 12px;
|
|
36
|
+
border-radius: 8px;
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
display: flex;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
align-content: space-between;
|
|
42
|
+
flex-wrap: wrap;
|
|
43
|
+
position: relative;
|
|
44
|
+
|
|
45
|
+
.menu-title {
|
|
46
|
+
width: 100%;
|
|
47
|
+
text-align: center;
|
|
48
|
+
color: var(--ant-color-text-secondary);
|
|
49
|
+
margin-top: 8px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
.icon-wrapper {
|
|
54
|
+
position: relative;
|
|
55
|
+
display: flex;
|
|
56
|
+
height: 3rem;
|
|
57
|
+
width: 3rem;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
transition-property: all;
|
|
61
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
62
|
+
transition-duration: 0.3s;
|
|
63
|
+
animation-duration: 0.3s;
|
|
64
|
+
border-radius: 0.75rem;
|
|
65
|
+
opacity: 1;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.icon-animated {
|
|
69
|
+
font-size: 24px;
|
|
70
|
+
transition-property: all;
|
|
71
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
72
|
+
transition-duration: 300ms;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.quick-action-bg {
|
|
76
|
+
position: absolute;
|
|
77
|
+
top: 0;
|
|
78
|
+
left: 0;
|
|
79
|
+
transition-property: opacity;
|
|
80
|
+
transition-timing-function: cubic-bezier(.4, 0, .2, 1);
|
|
81
|
+
transition-duration: .3s;
|
|
82
|
+
opacity: 0;
|
|
83
|
+
width: 100%;
|
|
84
|
+
height: 100%;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.quick-action:hover {
|
|
89
|
+
transform: translateY(-1px);
|
|
90
|
+
|
|
91
|
+
.icon-animated {
|
|
92
|
+
transform: scale(1.1) rotate(6deg);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.quick-action-bg {
|
|
96
|
+
opacity: 1;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.menu-title {
|
|
100
|
+
font-weight: bolder;
|
|
101
|
+
color: var(--ant-color-text-base)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.items-grid {
|
|
106
|
+
display: grid;
|
|
107
|
+
margin-top: 1rem;
|
|
108
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
109
|
+
gap: 0.5rem;
|
|
110
|
+
|
|
111
|
+
@media (min-width: 740px) {
|
|
112
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@media (min-width: 840px) {
|
|
116
|
+
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import { theme } from "antd";
|
|
3
|
+
import { RocketTwoTone } from "@ant-design/icons";
|
|
4
|
+
import { useNavigate } from "react-router-dom";
|
|
5
|
+
import "antd/dist/reset.css";
|
|
6
|
+
import HCDataSource from "../../tmpl/hc-data-source";
|
|
7
|
+
import { Level2Menu } from "../../tmpl/interface";
|
|
8
|
+
import IconFont from "../../icon/aliIcon";
|
|
9
|
+
import { handleMenuItemUrl } from "../../layout2/page";
|
|
10
|
+
import { useLocale } from "../../locale/useLocale";
|
|
11
|
+
import "./quick-entrance.less";
|
|
12
|
+
|
|
13
|
+
const { useToken } = theme;
|
|
14
|
+
|
|
15
|
+
interface MenuType extends Level2Menu {
|
|
16
|
+
url: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface Props {
|
|
20
|
+
layoutRootPath?: string;
|
|
21
|
+
menus: MenuType[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const Index = (props: Props) => {
|
|
25
|
+
const { layoutRootPath, menus } = props;
|
|
26
|
+
const [l2Menus, setL2Menus] = useState<MenuType[]>([]);
|
|
27
|
+
const navigate = useNavigate();
|
|
28
|
+
const { translate } = useLocale();
|
|
29
|
+
const { token } = useToken();
|
|
30
|
+
|
|
31
|
+
const getL2Menus = async () => {
|
|
32
|
+
let temData: Level2Menu[] = await HCDataSource.fastMenu("QuickQueryBar");
|
|
33
|
+
let temMenu: MenuType[] = [];
|
|
34
|
+
if (!temData?.length) {
|
|
35
|
+
temMenu = menus.slice(0, 5) || [];
|
|
36
|
+
} else {
|
|
37
|
+
temData.forEach(item => {
|
|
38
|
+
const { id, pageType, defaultCriteriaValue, customPath, dragDropPageId, fullScreen } = item;
|
|
39
|
+
if (!item.disabled) {
|
|
40
|
+
const url = handleMenuItemUrl(id, pageType, defaultCriteriaValue, customPath, dragDropPageId, fullScreen, layoutRootPath);
|
|
41
|
+
temMenu.push({ ...item, url });
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
setL2Menus(temMenu);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (menus?.length) {
|
|
51
|
+
getL2Menus();
|
|
52
|
+
}
|
|
53
|
+
}, [menus]);
|
|
54
|
+
|
|
55
|
+
const renderItem = (item: MenuType) => {
|
|
56
|
+
const renderIcon = item.icon ? <IconFont type={item.icon} /> : <RocketTwoTone />;
|
|
57
|
+
const iconColor = item.themeColor || token.colorPrimary;
|
|
58
|
+
return <div className="quick-action" onClick={() => navigate(`/${item.url}`)}>
|
|
59
|
+
<div className="quick-action-bg" style={{ background: ` ${iconColor}1A` }} />
|
|
60
|
+
<div className={`icon-wrapper`} style={{ color: iconColor, background: ` ${iconColor}1A` }}>
|
|
61
|
+
<div className="icon-animated">{renderIcon}</div>
|
|
62
|
+
</div>
|
|
63
|
+
<span className="menu-title">{item.title}</span>
|
|
64
|
+
</div>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return <div className="quick-entrance" style={{ borderColor: `${token.colorBorder}CC`, backgroundColor: token.colorBgContainer }}>
|
|
68
|
+
<div className="heard">
|
|
69
|
+
<div className="title">
|
|
70
|
+
<div className="line" style={{ background: token.colorPrimary }} />
|
|
71
|
+
<h3 className="text">{translate("${快捷操作}")}</h3>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
<div className="items-grid">
|
|
75
|
+
{l2Menus.map((item) => renderItem(item))}
|
|
76
|
+
</div>
|
|
77
|
+
</div>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default Index;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
.workbench {
|
|
2
|
+
width: 100%;
|
|
3
|
+
|
|
4
|
+
.card-row {
|
|
5
|
+
padding-bottom: 16px;
|
|
6
|
+
padding-top: 1px;
|
|
7
|
+
scroll-behavior: smooth;
|
|
8
|
+
overflow-x: auto;
|
|
9
|
+
|
|
10
|
+
&::-webkit-scrollbar {
|
|
11
|
+
display: none;
|
|
12
|
+
/* 隐藏滚动条 */
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
scrollbar-width: none;
|
|
16
|
+
-ms-overflow-style: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.stat-card {
|
|
20
|
+
position: relative;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
border-radius: 0.75rem;
|
|
23
|
+
padding: 1.25rem;
|
|
24
|
+
transition-property: transform, box-shadow;
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: flex-start;
|
|
27
|
+
justify-content: space-between;
|
|
28
|
+
border: 1px solid;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
|
|
31
|
+
.card-title {
|
|
32
|
+
color: var(--ant-color-text-secondary);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.card-count {
|
|
36
|
+
margin-top: 0.5rem;
|
|
37
|
+
font-size: 1.875rem;
|
|
38
|
+
line-height: 2.25rem;
|
|
39
|
+
font-weight: 700;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.icon-wrapper {
|
|
43
|
+
position: relative;
|
|
44
|
+
display: flex;
|
|
45
|
+
height: 3rem;
|
|
46
|
+
width: 3rem;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
transition-property: all;
|
|
50
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
51
|
+
transition-duration: 0.3s;
|
|
52
|
+
animation-duration: 0.3s;
|
|
53
|
+
border-radius: 0.75rem;
|
|
54
|
+
opacity: 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.bg-gradient {
|
|
58
|
+
content: '';
|
|
59
|
+
position: absolute;
|
|
60
|
+
right: -5rem;
|
|
61
|
+
top: -5rem;
|
|
62
|
+
height: 12rem;
|
|
63
|
+
width: 12rem;
|
|
64
|
+
border-radius: 50%;
|
|
65
|
+
opacity: 1;
|
|
66
|
+
transition-property: opacity, transform;
|
|
67
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
68
|
+
transition-duration: 500ms;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.left-button {
|
|
73
|
+
position: absolute;
|
|
74
|
+
left: 0;
|
|
75
|
+
top: calc(50% - 8px);
|
|
76
|
+
transform: translateY(-50%);
|
|
77
|
+
z-index: 2;
|
|
78
|
+
border-radius: 50%;
|
|
79
|
+
display: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.right-button {
|
|
83
|
+
position: absolute;
|
|
84
|
+
right: 0;
|
|
85
|
+
top: calc(50% - 8px);
|
|
86
|
+
transform: translateY(-50%);
|
|
87
|
+
z-index: 2;
|
|
88
|
+
border-radius: 50%;
|
|
89
|
+
display: none;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.stat-card:hover {
|
|
93
|
+
transform: translateY(-1px);
|
|
94
|
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
|
95
|
+
|
|
96
|
+
.bg-gradient {
|
|
97
|
+
transform: scale(1.5);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.icon-animated {
|
|
102
|
+
font-size: 24px;
|
|
103
|
+
transition-property: all;
|
|
104
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
105
|
+
transition-duration: 300ms;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.stat-card:hover .icon-animated {
|
|
109
|
+
transform: scale(1.1) rotate(6deg);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.workbench:hover {
|
|
114
|
+
|
|
115
|
+
.left-button,
|
|
116
|
+
.right-button {
|
|
117
|
+
display: block;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect } from "react";
|
|
2
|
+
import { Row, Col, theme, Button } from "antd";
|
|
3
|
+
import { RocketTwoTone, LeftOutlined, RightOutlined } from "@ant-design/icons";
|
|
4
|
+
import { useNavigate } from "react-router-dom";
|
|
5
|
+
import "antd/dist/reset.css";
|
|
6
|
+
import HcserviceV3 from "../../tmpl/hcservice-v3";
|
|
7
|
+
import HCDataSource from "../../tmpl/hc-data-source";
|
|
8
|
+
import { Level2Menu } from "../../tmpl/interface";
|
|
9
|
+
import IconFont from "../../icon/aliIcon";
|
|
10
|
+
import { handleMenuItemUrl } from "../../layout2/page";
|
|
11
|
+
import "./workbench.less";
|
|
12
|
+
|
|
13
|
+
const { useToken } = theme;
|
|
14
|
+
|
|
15
|
+
interface MenuType extends Level2Menu {
|
|
16
|
+
url: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface WorkbenchProps {
|
|
20
|
+
layoutRootPath?: string;
|
|
21
|
+
menus: MenuType[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const Workbench = (props: WorkbenchProps) => {
|
|
25
|
+
const { layoutRootPath, menus } = props;
|
|
26
|
+
const [l2Menus, setL2Menus] = useState<{ [key: string]: MenuType }>({});
|
|
27
|
+
const [l2MenusArr, setL2MenusArr] = useState<MenuType[]>([]);
|
|
28
|
+
const IntervalRef = useRef([]);
|
|
29
|
+
const rowRef = useRef(null);
|
|
30
|
+
const navigate = useNavigate();
|
|
31
|
+
const { token } = useToken();
|
|
32
|
+
|
|
33
|
+
const getL2Menus = async () => {
|
|
34
|
+
let temData: Level2Menu[] = await HCDataSource.fastMenu("QuickPanel");
|
|
35
|
+
let temMenu: MenuType[] = [];
|
|
36
|
+
if (!temData?.length) {
|
|
37
|
+
temMenu = menus.filter(r => !r.dragDropPageId && !r.customPath)?.slice(0, 4) || []
|
|
38
|
+
} else {
|
|
39
|
+
temData.forEach(item => {
|
|
40
|
+
const { id, pageType, defaultCriteriaValue, customPath, dragDropPageId, fullScreen } = item;
|
|
41
|
+
if (!item.disabled) {
|
|
42
|
+
const url = handleMenuItemUrl(id, pageType, defaultCriteriaValue, customPath, dragDropPageId, fullScreen, layoutRootPath);
|
|
43
|
+
temMenu.push({ ...item, url });
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
setL2MenusArr(temMenu);
|
|
48
|
+
const temL2Menus = {};
|
|
49
|
+
if (temMenu) {
|
|
50
|
+
for (const item of temMenu) {
|
|
51
|
+
if (item.disabled) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
let i = setInterval(async () => {
|
|
55
|
+
let count = await HcserviceV3.requestLtmplCount(null, item.id);
|
|
56
|
+
setL2Menus(val => ({ ...val, [item.id]: { ...item, count: count || 0 } }))
|
|
57
|
+
}, 180000);
|
|
58
|
+
IntervalRef.current.push(i);
|
|
59
|
+
let count = await HcserviceV3.requestLtmplCount(null, item.id);
|
|
60
|
+
temL2Menus[item.id] = { ...item, count: count || 0 };
|
|
61
|
+
}
|
|
62
|
+
setL2Menus(temL2Menus);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (menus?.length) {
|
|
69
|
+
getL2Menus();
|
|
70
|
+
}
|
|
71
|
+
return () => {
|
|
72
|
+
IntervalRef.current.forEach(i => clearInterval(i));
|
|
73
|
+
}
|
|
74
|
+
}, [menus]);
|
|
75
|
+
|
|
76
|
+
// 轮播滚动
|
|
77
|
+
const scrollToIndex = (direction) => {
|
|
78
|
+
const container = rowRef.current;
|
|
79
|
+
if (!container) return;
|
|
80
|
+
// 获取第一个卡片元素及其计算样式(包括margin)
|
|
81
|
+
const firstCard = container.querySelector('.ant-col');
|
|
82
|
+
if (!firstCard) return;
|
|
83
|
+
// 计算单个卡片的宽度 + gutter
|
|
84
|
+
const cardStyle = window.getComputedStyle(firstCard);
|
|
85
|
+
const cardWidth = firstCard.offsetWidth + parseInt(cardStyle.marginRight);
|
|
86
|
+
// 计算本次滚动的距离(向前或向后一个卡片)
|
|
87
|
+
const scrollAmount = cardWidth * direction;
|
|
88
|
+
// 执行滚动
|
|
89
|
+
container.scrollBy({
|
|
90
|
+
left: scrollAmount,
|
|
91
|
+
behavior: 'smooth' // 平滑滚动
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const renderCard = () => {
|
|
96
|
+
return l2MenusArr.map((item) => {
|
|
97
|
+
const l2Menu = l2Menus[item.id] || item;
|
|
98
|
+
const renderIcon = l2Menu.icon ? <IconFont type={l2Menu.icon} /> : <RocketTwoTone />;
|
|
99
|
+
const iconColor = l2Menu.themeColor || token.colorPrimary;
|
|
100
|
+
let comp = (
|
|
101
|
+
<Col className="gutter-row" sm={24} md={12} lg={6} span={6}>
|
|
102
|
+
<div className="stat-card" style={{ borderColor: `${token.colorBorder}CC`, backgroundColor: token.colorBgContainer }} onClick={() => navigate(`/${item.url}`)}>
|
|
103
|
+
<div className="bg-gradient" style={{ background: `radial-gradient(circle, ${iconColor}1A 0%, transparent 70%)` }} />
|
|
104
|
+
<div >
|
|
105
|
+
<p className="card-title">{l2Menu.title}</p>
|
|
106
|
+
<p className="card-count" style={{ color: iconColor }}>{l2Menu.count || 0}</p>
|
|
107
|
+
</div>
|
|
108
|
+
<div className="icon-wrapper" style={{ color: iconColor, background: `${iconColor}1A` }}>
|
|
109
|
+
<div className="icon-animated">{renderIcon}</div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
</Col>
|
|
113
|
+
);
|
|
114
|
+
return comp;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return <div className="workbench">
|
|
119
|
+
<Row ref={rowRef} gutter={16} wrap={false} className="card-row" >
|
|
120
|
+
{renderCard()}
|
|
121
|
+
</Row>
|
|
122
|
+
{l2MenusArr.length > 4 ?
|
|
123
|
+
<>
|
|
124
|
+
<Button
|
|
125
|
+
type="primary"
|
|
126
|
+
ghost
|
|
127
|
+
onClick={() => scrollToIndex(-1)}
|
|
128
|
+
shape="circle"
|
|
129
|
+
icon={<LeftOutlined />}
|
|
130
|
+
className="left-button"
|
|
131
|
+
/>
|
|
132
|
+
<Button
|
|
133
|
+
type="primary"
|
|
134
|
+
ghost
|
|
135
|
+
shape="circle"
|
|
136
|
+
onClick={() => scrollToIndex(1)}
|
|
137
|
+
icon={<RightOutlined />}
|
|
138
|
+
className="right-button"
|
|
139
|
+
/>
|
|
140
|
+
</> : ""}
|
|
141
|
+
</div>;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export default Workbench;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { CardProps } from "antd";
|
|
3
|
-
import "antd/dist/reset.css";
|
|
4
|
-
import { Level2Menu } from "../tmpl/interface";
|
|
5
|
-
import { LocaleContext } from "../locale/LocaleProvider";
|
|
6
|
-
interface QuickEntranceProps extends CardProps {
|
|
7
|
-
}
|
|
8
|
-
interface QuickEntranceState {
|
|
9
|
-
l2Menus?: Level2Menu[];
|
|
10
|
-
}
|
|
11
|
-
declare class QuickEntrance extends React.PureComponent<QuickEntranceProps, QuickEntranceState> {
|
|
12
|
-
state: {
|
|
13
|
-
l2Menus: any;
|
|
14
|
-
};
|
|
15
|
-
static contextType: React.Context<{
|
|
16
|
-
locale: import("../locale/langMp").LocaleType;
|
|
17
|
-
langPkg: any;
|
|
18
|
-
availableLang: string[];
|
|
19
|
-
changeLocale: (locale: import("../locale/langMp").LocaleType) => void;
|
|
20
|
-
siderCollapsed: boolean;
|
|
21
|
-
changeSiderCollapsed: () => void;
|
|
22
|
-
t: (...strs: string[]) => string;
|
|
23
|
-
translate: (...strs: string[]) => string;
|
|
24
|
-
getServiceLangStr?: () => string;
|
|
25
|
-
compactTheme?: boolean;
|
|
26
|
-
changeCompactTheme?: () => void;
|
|
27
|
-
screenfull?: boolean;
|
|
28
|
-
changeScreenfull?: () => void;
|
|
29
|
-
}>;
|
|
30
|
-
context: React.ContextType<typeof LocaleContext>;
|
|
31
|
-
intervals: any[];
|
|
32
|
-
componentDidMount(): Promise<void>;
|
|
33
|
-
componentWillUnmount(): void;
|
|
34
|
-
render(): React.JSX.Element;
|
|
35
|
-
}
|
|
36
|
-
export default QuickEntrance;
|
|
37
|
-
//# sourceMappingURL=quick-entrance.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"quick-entrance.d.ts","sourceRoot":"","sources":["../../../../src/aldehyde/welcome/quick-entrance.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAsC,SAAS,EAAE,MAAM,MAAM,CAAC;AAErE,OAAO,qBAAqB,CAAC;AAG7B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,UAAU,kBAAmB,SAAQ,SAAS;CAAI;AAElD,UAAU,kBAAkB;IAC1B,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;CACxB;AAED,cAAM,aAAc,SAAQ,KAAK,CAAC,aAAa,CAC7C,kBAAkB,EAClB,kBAAkB,CACnB;IACC,KAAK;;MAEH;IACF,MAAM,CAAC,WAAW;;;;;;;YAXE,GAAG;oBAInB,GAAG;;;;;;OAO4B;IACnC,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC;IACjD,SAAS,EAAE,GAAG,EAAE,CAAM;IAChB,iBAAiB;IAyBvB,oBAAoB,IAAI,IAAI;IAU5B,MAAM;CAoCP;AAED,eAAe,aAAa,CAAC"}
|