aldehyde 0.2.236 → 0.2.238
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/action/index.d.ts +2 -0
- package/lib/controls/action/index.d.ts.map +1 -1
- package/lib/controls/chemstruc/graph.d.ts +2 -0
- package/lib/controls/chemstruc/graph.d.ts.map +1 -1
- package/lib/controls/collapse-card/index.d.ts +2 -0
- package/lib/controls/collapse-card/index.d.ts.map +1 -1
- package/lib/controls/color-picker/index.d.ts +2 -0
- package/lib/controls/color-picker/index.d.ts.map +1 -1
- package/lib/controls/cquery/cquick-button.d.ts +2 -0
- package/lib/controls/cquery/cquick-button.d.ts.map +1 -1
- package/lib/controls/date-picker/index.d.ts.map +1 -1
- package/lib/controls/date-picker/index.js +9 -1
- package/lib/controls/date-picker/index.js.map +1 -1
- package/lib/controls/entity-select/entity-select.d.ts +2 -0
- package/lib/controls/entity-select/entity-select.d.ts.map +1 -1
- package/lib/controls/entity-select/lab-tree-select.d.ts +2 -0
- package/lib/controls/entity-select/lab-tree-select.d.ts.map +1 -1
- package/lib/controls/entity-select/popover-entity-select.d.ts +2 -0
- package/lib/controls/entity-select/popover-entity-select.d.ts.map +1 -1
- package/lib/controls/password-setter/index.d.ts +2 -0
- package/lib/controls/password-setter/index.d.ts.map +1 -1
- package/lib/controls/relation-existion/index.d.ts +2 -0
- package/lib/controls/relation-existion/index.d.ts.map +1 -1
- package/lib/controls/rfield/index.d.ts +2 -0
- package/lib/controls/rfield/index.d.ts.map +1 -1
- package/lib/controls/select/index.d.ts +2 -0
- package/lib/controls/select/index.d.ts.map +1 -1
- package/lib/controls/signature/index.d.ts +2 -0
- package/lib/controls/signature/index.d.ts.map +1 -1
- package/lib/controls/text/ellipsis-text.d.ts +2 -0
- package/lib/controls/text/ellipsis-text.d.ts.map +1 -1
- package/lib/controls/upload/index.d.ts +2 -0
- package/lib/controls/upload/index.d.ts.map +1 -1
- package/lib/controls/upload/mult-file-upload.d.ts +2 -0
- package/lib/controls/upload/mult-file-upload.d.ts.map +1 -1
- package/lib/custom-page/dtmpl-custom-edit-modal-page.d.ts +2 -0
- package/lib/custom-page/dtmpl-custom-edit-modal-page.d.ts.map +1 -1
- package/lib/detail/button/bottom-submit-button-bar.d.ts +2 -0
- package/lib/detail/button/bottom-submit-button-bar.d.ts.map +1 -1
- package/lib/detail/button/cquery-button-bar.d.ts +2 -0
- package/lib/detail/button/cquery-button-bar.d.ts.map +1 -1
- package/lib/detail/button/fix-right-submit-button-bar.d.ts +2 -0
- package/lib/detail/button/fix-right-submit-button-bar.d.ts.map +1 -1
- package/lib/detail/edit/fields-edit-card.d.ts +2 -0
- package/lib/detail/edit/fields-edit-card.d.ts.map +1 -1
- package/lib/detail/edit/modal-row-edit.d.ts +2 -0
- package/lib/detail/edit/modal-row-edit.d.ts.map +1 -1
- package/lib/detail/edit/row-edit-card.d.ts +2 -0
- package/lib/detail/edit/row-edit-card.d.ts.map +1 -1
- package/lib/detail/rightbar/index.d.ts +2 -0
- package/lib/detail/rightbar/index.d.ts.map +1 -1
- package/lib/detail/view/act-dtmpl-view.d.ts +2 -0
- package/lib/detail/view/act-dtmpl-view.d.ts.map +1 -1
- package/lib/detail/view/act-dtmpl-view.js +1 -1
- package/lib/detail/view/act-dtmpl-view.js.map +1 -1
- package/lib/detail/view/field-view-group.d.ts +2 -0
- package/lib/detail/view/field-view-group.d.ts.map +1 -1
- package/lib/detail/view/modal-dtmpl-view.d.ts +2 -0
- package/lib/detail/view/modal-dtmpl-view.d.ts.map +1 -1
- package/lib/detail/view/snapshot-timeline.d.ts +2 -0
- package/lib/detail/view/snapshot-timeline.d.ts.map +1 -1
- package/lib/detail/view/tab-act-dtmpl-view.d.ts +2 -0
- package/lib/detail/view/tab-act-dtmpl-view.d.ts.map +1 -1
- package/lib/detail/view/tab-act-dtmpl-view.js +3 -3
- package/lib/detail/view/tab-act-dtmpl-view.js.map +1 -1
- package/lib/export/export-frame.d.ts +2 -0
- package/lib/export/export-frame.d.ts.map +1 -1
- package/lib/export/select-code-export-frame.d.ts +2 -0
- package/lib/export/select-code-export-frame.d.ts.map +1 -1
- package/lib/form/dtmpl-form.d.ts +2 -0
- package/lib/form/dtmpl-form.d.ts.map +1 -1
- package/lib/form/field-group-form.d.ts +2 -0
- package/lib/form/field-group-form.d.ts.map +1 -1
- package/lib/form/form-Item-group.d.ts +2 -0
- package/lib/form/form-Item-group.d.ts.map +1 -1
- package/lib/form/form-Item-group.js +3 -2
- package/lib/form/form-Item-group.js.map +1 -1
- package/lib/hooks/use-match-route/index.d.ts +10 -0
- package/lib/hooks/use-match-route/index.d.ts.map +1 -0
- package/lib/hooks/use-match-route/index.js +41 -0
- package/lib/hooks/use-match-route/index.js.map +1 -0
- package/lib/hooks/use-tabs/index.d.ts +18 -0
- package/lib/hooks/use-tabs/index.d.ts.map +1 -0
- package/lib/hooks/use-tabs/index.js +112 -0
- package/lib/hooks/use-tabs/index.js.map +1 -0
- package/lib/import/excel-import.d.ts +2 -0
- package/lib/import/excel-import.d.ts.map +1 -1
- package/lib/layout/MainPage.js +1 -1
- package/lib/layout/MainPage.js.map +1 -1
- package/lib/layout/coverstyle.css +1 -1
- package/lib/layout/menu/block.d.ts +2 -0
- package/lib/layout/menu/block.d.ts.map +1 -1
- package/lib/layout/menu/l2menu-quick-bar.d.ts +2 -0
- package/lib/layout/menu/l2menu-quick-bar.d.ts.map +1 -1
- package/lib/layout/menu/menu-2layers.d.ts +2 -0
- package/lib/layout/menu/menu-2layers.d.ts.map +1 -1
- package/lib/layout/menu/reset-password.d.ts +2 -0
- package/lib/layout/menu/reset-password.d.ts.map +1 -1
- package/lib/layout/menu/user-bar.d.ts +2 -0
- package/lib/layout/menu/user-bar.d.ts.map +1 -1
- package/lib/layout/menu/userinfo-bar.d.ts +2 -0
- package/lib/layout/menu/userinfo-bar.d.ts.map +1 -1
- package/lib/layout/sidebar/index.js +4 -2
- package/lib/layout/sidebar/index.js.map +1 -1
- package/lib/layout2/components/userButton.d.ts.map +1 -1
- package/lib/layout2/components/userButton.js +14 -2
- package/lib/layout2/components/userButton.js.map +1 -1
- package/lib/layout2/header.d.ts.map +1 -1
- package/lib/layout2/header.js +4 -66
- package/lib/layout2/header.js.map +1 -1
- package/lib/layout2/main.d.ts +1 -1
- package/lib/layout2/main.d.ts.map +1 -1
- package/lib/layout2/main.js +3 -3
- package/lib/layout2/main.js.map +1 -1
- package/lib/layout2/page.d.ts.map +1 -1
- package/lib/layout2/page.js +20 -2
- package/lib/layout2/page.js.map +1 -1
- package/lib/layout2/sider.d.ts +1 -2
- package/lib/layout2/sider.d.ts.map +1 -1
- package/lib/layout2/sider.js +6 -125
- package/lib/layout2/sider.js.map +1 -1
- package/lib/layout2/tabs/tabs-context.d.ts +20 -0
- package/lib/layout2/tabs/tabs-context.d.ts.map +1 -0
- package/lib/layout2/tabs/tabs-context.js +9 -0
- package/lib/layout2/tabs/tabs-context.js.map +1 -0
- package/lib/layout2/tabs/tabs-layout.d.ts +4 -0
- package/lib/layout2/tabs/tabs-layout.d.ts.map +1 -0
- package/lib/layout2/tabs/tabs-layout.js +87 -0
- package/lib/layout2/tabs/tabs-layout.js.map +1 -0
- package/lib/locale/LocaleProvider.d.ts +2 -0
- package/lib/locale/LocaleProvider.d.ts.map +1 -1
- package/lib/locale/LocaleProvider.js +7 -1
- package/lib/locale/LocaleProvider.js.map +1 -1
- package/lib/locale/useLocale.d.ts +2 -0
- package/lib/locale/useLocale.d.ts.map +1 -1
- package/lib/locale/useLocale.js +8 -2
- package/lib/locale/useLocale.js.map +1 -1
- package/lib/login/login.d.ts +2 -0
- package/lib/login/login.d.ts.map +1 -1
- package/lib/login2/login-page.js +1 -1
- package/lib/login2/login-page.js.map +1 -1
- package/lib/login2/login.d.ts.map +1 -1
- package/lib/login2/login.js +5 -0
- package/lib/login2/login.js.map +1 -1
- package/lib/module/dtmpl-edit-card.d.ts +2 -0
- package/lib/module/dtmpl-edit-card.d.ts.map +1 -1
- package/lib/module/dtmpl-edit-page.d.ts +2 -0
- package/lib/module/dtmpl-edit-page.d.ts.map +1 -1
- package/lib/module/dtmpl-view-card.d.ts.map +1 -1
- package/lib/module/dtmpl-view-card.js +0 -10
- package/lib/module/dtmpl-view-card.js.map +1 -1
- package/lib/module/ltmpl-modal.d.ts +2 -0
- package/lib/module/ltmpl-modal.d.ts.map +1 -1
- package/lib/module/ltmpl-table.d.ts +4 -0
- 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/routable/ltmpl-route.d.ts +1 -0
- package/lib/routable/ltmpl-route.d.ts.map +1 -1
- package/lib/routable/ltmpl-route.js +20 -9
- package/lib/routable/ltmpl-route.js.map +1 -1
- package/lib/routable/ttmpl-route.d.ts +1 -0
- package/lib/routable/ttmpl-route.d.ts.map +1 -1
- package/lib/routable/ttmpl-route.js +2 -2
- package/lib/routable/ttmpl-route.js.map +1 -1
- package/lib/routable/withroute.d.ts.map +1 -1
- package/lib/routable/withroute.js +8 -2
- package/lib/routable/withroute.js.map +1 -1
- package/lib/table/act-table.d.ts +7 -1
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +76 -32
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/column/column-builder.d.ts +1 -0
- package/lib/table/column/column-builder.d.ts.map +1 -1
- package/lib/table/column/column-builder.js +2 -2
- package/lib/table/column/column-builder.js.map +1 -1
- package/lib/table/modal-select-table.d.ts +2 -0
- package/lib/table/modal-select-table.d.ts.map +1 -1
- package/lib/table/modal-select-table.js +1 -1
- package/lib/table/modal-select-table.js.map +1 -1
- package/lib/table/pagination.d.ts +2 -0
- package/lib/table/pagination.d.ts.map +1 -1
- package/lib/table/query-table.d.ts +4 -0
- package/lib/table/query-table.d.ts.map +1 -1
- package/lib/table/query-table.js +35 -4
- package/lib/table/query-table.js.map +1 -1
- package/lib/table/relation-table.d.ts +2 -0
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/table/relation-table.js +1 -1
- package/lib/table/relation-table.js.map +1 -1
- package/lib/table/report-table.d.ts.map +1 -1
- package/lib/table/report-table.js +4 -2
- package/lib/table/report-table.js.map +1 -1
- package/lib/table/select-table.d.ts +2 -0
- package/lib/table/select-table.d.ts.map +1 -1
- package/lib/table/select-table.js +2 -1
- package/lib/table/select-table.js.map +1 -1
- package/lib/table/selected-rows-card.d.ts +3 -0
- package/lib/table/selected-rows-card.d.ts.map +1 -1
- package/lib/table/selected-rows-card.js +2 -1
- package/lib/table/selected-rows-card.js.map +1 -1
- package/lib/table/stat/restat.d.ts +2 -0
- package/lib/table/stat/restat.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +2 -0
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +22 -0
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +10 -1
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/tree/act-tree.d.ts +6 -1
- package/lib/tree/act-tree.d.ts.map +1 -1
- package/lib/tree/act-tree.js +5 -5
- package/lib/tree/act-tree.js.map +1 -1
- package/lib/tree/tmpl-tree.d.ts +2 -0
- package/lib/tree/tmpl-tree.d.ts.map +1 -1
- package/lib/units/index.d.ts +5 -1
- package/lib/units/index.d.ts.map +1 -1
- package/lib/units/index.js +25 -0
- package/lib/units/index.js.map +1 -1
- package/lib/welcome/quick-entrance.d.ts +2 -0
- package/lib/welcome/quick-entrance.d.ts.map +1 -1
- package/lib/welcome/workbench.d.ts +2 -0
- package/lib/welcome/workbench.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/aldehyde/controls/date-picker/index.tsx +15 -1
- package/src/aldehyde/detail/view/act-dtmpl-view.tsx +1 -1
- package/src/aldehyde/detail/view/tab-act-dtmpl-view.tsx +2 -5
- package/src/aldehyde/form/form-Item-group.tsx +4 -3
- package/src/aldehyde/hooks/use-match-route/index.tsx +63 -0
- package/src/aldehyde/hooks/use-tabs/index.tsx +130 -0
- package/src/aldehyde/layout/MainPage.tsx +1 -1
- package/src/aldehyde/layout/coverstyle.css +1 -1
- package/src/aldehyde/layout/sidebar/index.tsx +4 -4
- package/src/aldehyde/layout2/components/userButton.tsx +20 -3
- package/src/aldehyde/layout2/header.tsx +5 -69
- package/src/aldehyde/layout2/main.tsx +4 -3
- package/src/aldehyde/layout2/page.tsx +25 -3
- package/src/aldehyde/layout2/sider.tsx +5 -133
- package/src/aldehyde/layout2/tabs/tabs-context.tsx +30 -0
- package/src/aldehyde/layout2/tabs/tabs-layout.tsx +152 -0
- package/src/aldehyde/locale/LocaleProvider.tsx +13 -2
- package/src/aldehyde/locale/useLocale.ts +10 -2
- package/src/aldehyde/login2/login-page.tsx +1 -1
- package/src/aldehyde/login2/login.tsx +6 -1
- package/src/aldehyde/module/dtmpl-view-card.tsx +0 -11
- package/src/aldehyde/module/ltmpl-table.tsx +13 -27
- package/src/aldehyde/routable/ltmpl-route.tsx +37 -46
- package/src/aldehyde/routable/ttmpl-route.tsx +3 -2
- package/src/aldehyde/routable/withroute.tsx +12 -2
- package/src/aldehyde/table/act-table.tsx +96 -45
- package/src/aldehyde/table/column/column-builder.tsx +7 -6
- package/src/aldehyde/table/modal-select-table.tsx +3 -2
- package/src/aldehyde/table/query-table.tsx +44 -4
- package/src/aldehyde/table/relation-table.tsx +1 -2
- package/src/aldehyde/table/report-table.tsx +9 -7
- package/src/aldehyde/table/select-table.tsx +2 -1
- package/src/aldehyde/table/selected-rows-card.tsx +3 -0
- package/src/aldehyde/tmpl/hcservice-v3.tsx +20 -0
- package/src/aldehyde/tmpl/interface.tsx +17 -4
- package/src/aldehyde/tree/act-tree.tsx +7 -5
- package/src/aldehyde/units/index.tsx +40 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ConfigProvider, Layout, Menu, MenuProps, theme, Tooltip } from "antd";
|
|
2
2
|
import React, { useEffect, useRef, useState } from "react";
|
|
3
|
+
|
|
3
4
|
import { MenuType } from "./type/layout.type";
|
|
4
5
|
import { NavLink, useParams, useSearchParams } from "react-router-dom";
|
|
5
6
|
import {
|
|
@@ -10,146 +11,19 @@ import {
|
|
|
10
11
|
import { useLocale } from "../locale/useLocale";
|
|
11
12
|
import { generate } from "@ant-design/colors";
|
|
12
13
|
import {
|
|
13
|
-
MenuItemIdToFirstFloorIdxMapType,
|
|
14
14
|
useLayoutContext,
|
|
15
15
|
} from "./LayoutContext";
|
|
16
16
|
|
|
17
17
|
type SiderPropsType = {
|
|
18
18
|
menuList: MenuType[];
|
|
19
|
-
|
|
19
|
+
// style?: typeof Layout.Sider.defaultProps.style;
|
|
20
|
+
collapsed:boolean;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
type MenuItem = Required<MenuProps>["items"][number];
|
|
23
24
|
|
|
24
25
|
type SecoundFloorMenuList = MenuType[][];
|
|
25
26
|
|
|
26
|
-
const items: MenuItem[] = [
|
|
27
|
-
{
|
|
28
|
-
label: "Navigation One",
|
|
29
|
-
key: "mail",
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
label: "Navigation Two",
|
|
33
|
-
key: "app",
|
|
34
|
-
disabled: false,
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
label: "Navigation Two",
|
|
38
|
-
key: "app2",
|
|
39
|
-
disabled: false,
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
label: "Navigation Two",
|
|
43
|
-
key: "app3",
|
|
44
|
-
disabled: false,
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
label: "Navigation Two",
|
|
48
|
-
key: "app4",
|
|
49
|
-
disabled: true,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
label: "Navigation Two",
|
|
53
|
-
key: "app5",
|
|
54
|
-
disabled: true,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
label: "Navigation Two",
|
|
58
|
-
key: "app6",
|
|
59
|
-
disabled: true,
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
label: "Navigation Two",
|
|
63
|
-
key: "app7",
|
|
64
|
-
disabled: true,
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
label: "Navigation Two",
|
|
68
|
-
key: "app8",
|
|
69
|
-
disabled: true,
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
label: "Navigation Two",
|
|
73
|
-
key: "app9",
|
|
74
|
-
disabled: true,
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
label: "Navigation Two",
|
|
78
|
-
key: "app10",
|
|
79
|
-
disabled: true,
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
label: "Navigation Two",
|
|
83
|
-
key: "app11",
|
|
84
|
-
disabled: true,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
label: "Navigation Two",
|
|
88
|
-
key: "app12",
|
|
89
|
-
disabled: false,
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
label: "Navigation Two",
|
|
93
|
-
key: "app13",
|
|
94
|
-
disabled: false,
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
label: "Navigation Two",
|
|
98
|
-
key: "app14",
|
|
99
|
-
disabled: false,
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
label: "Navigation Two",
|
|
103
|
-
key: "app15",
|
|
104
|
-
disabled: false,
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
label: "Navigation Two",
|
|
108
|
-
key: "app16",
|
|
109
|
-
disabled: false,
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
label: "Navigation Two",
|
|
113
|
-
key: "app17",
|
|
114
|
-
disabled: false,
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
label: "Navigation Two",
|
|
118
|
-
key: "app18",
|
|
119
|
-
disabled: false,
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
label: "Navigation Three - Submenu",
|
|
123
|
-
key: "SubMenu",
|
|
124
|
-
children: [
|
|
125
|
-
{
|
|
126
|
-
type: "group",
|
|
127
|
-
label: "Item 1",
|
|
128
|
-
children: [
|
|
129
|
-
{ label: "Option 1", key: "setting:1" },
|
|
130
|
-
{ label: "Option 2", key: "setting:2" },
|
|
131
|
-
],
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
type: "group",
|
|
135
|
-
label: "Item 2",
|
|
136
|
-
children: [
|
|
137
|
-
{ label: "Option 3", key: "setting:3" },
|
|
138
|
-
{ label: "Option 4", key: "setting:4" },
|
|
139
|
-
],
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
key: "alipay",
|
|
145
|
-
label: (
|
|
146
|
-
<a href="https://ant.design" target="_blank" rel="noopener noreferrer">
|
|
147
|
-
Navigation Four - Link
|
|
148
|
-
</a>
|
|
149
|
-
),
|
|
150
|
-
},
|
|
151
|
-
];
|
|
152
|
-
|
|
153
27
|
/**
|
|
154
28
|
* @param menuList 自定义的menu
|
|
155
29
|
* @returns 下标为 n 对应第 n 个根节点对应的第二层级menu
|
|
@@ -178,7 +52,7 @@ const getSecoundFloorMenuList = (
|
|
|
178
52
|
|
|
179
53
|
const { useToken } = theme;
|
|
180
54
|
|
|
181
|
-
const Sider: React.FC<SiderPropsType> = ({ menuList,
|
|
55
|
+
const Sider: React.FC<SiderPropsType> = ({ menuList,collapsed }) => {
|
|
182
56
|
const { setDocumentTitle, menuItemIdToFirstFloorIdxMap } = useLayoutContext();
|
|
183
57
|
|
|
184
58
|
// token
|
|
@@ -286,15 +160,13 @@ const Sider: React.FC<SiderPropsType> = ({ menuList, style }) => {
|
|
|
286
160
|
const menuClick = (openKeys) => {
|
|
287
161
|
setSelectedKeys([...openKeys]);
|
|
288
162
|
};
|
|
289
|
-
|
|
290
163
|
return (
|
|
291
|
-
<Layout.Sider
|
|
164
|
+
<Layout.Sider collapsed={collapsed} collapsedWidth={0}
|
|
292
165
|
style={{
|
|
293
166
|
background: colors[0],
|
|
294
167
|
// color: "#FFFFFF",
|
|
295
168
|
borderInlineEnd: "1px solid rgba(5, 5, 5, 0.06)",
|
|
296
169
|
overflowY: "auto",
|
|
297
|
-
...style,
|
|
298
170
|
}}
|
|
299
171
|
>
|
|
300
172
|
<ConfigProvider
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
|
+
|
|
3
|
+
import { createContext } from 'react';
|
|
4
|
+
|
|
5
|
+
interface KeepAliveTabContextType {
|
|
6
|
+
/**
|
|
7
|
+
* 刷新tab
|
|
8
|
+
* @param path tab path 可以为空,为空则刷新当前tab
|
|
9
|
+
*/
|
|
10
|
+
refreshTab: (path?: string) => void;
|
|
11
|
+
/**
|
|
12
|
+
* 关闭tab
|
|
13
|
+
* @param path tab path 可以为空,为空则关闭当前tab
|
|
14
|
+
*/
|
|
15
|
+
closeTab: (path?: string) => void;
|
|
16
|
+
/**
|
|
17
|
+
* 关闭其他tab
|
|
18
|
+
* @param path tab path 可以为空,为空则关闭其他tab
|
|
19
|
+
*/
|
|
20
|
+
closeOtherTab: (path?: string) => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const defaultValue = {
|
|
24
|
+
refreshTab: () => { },
|
|
25
|
+
closeTab: () => { },
|
|
26
|
+
closeOtherTab: () => { },
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
export const KeepAliveTabContext = createContext<KeepAliveTabContextType>(defaultValue);
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from "react";
|
|
2
|
+
import {Dropdown, Tabs} from 'antd';
|
|
3
|
+
import { MenuItemType } from 'antd/es/menu/interface';
|
|
4
|
+
import { KeepAliveTabContext } from './tabs-context';
|
|
5
|
+
import {KeepAliveTab, useTabs} from "../../hooks/use-tabs";
|
|
6
|
+
import antdIcons from '@ant-design/icons';
|
|
7
|
+
import { useNavigate} from 'react-router-dom';
|
|
8
|
+
import Units from '../../units';
|
|
9
|
+
import {useLocale} from "../../locale/useLocale";
|
|
10
|
+
// import {arrayMove} from "react-sortable-hoc";
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
const TabsLayout: React.FC = (props) => {
|
|
14
|
+
|
|
15
|
+
const { translate } = useLocale();
|
|
16
|
+
const {
|
|
17
|
+
activeTabRoutePath,
|
|
18
|
+
tabs = [],
|
|
19
|
+
closeTab,
|
|
20
|
+
refreshTab,
|
|
21
|
+
closeOtherTab,
|
|
22
|
+
setTabs,
|
|
23
|
+
} = useTabs();
|
|
24
|
+
|
|
25
|
+
const getIcon = (icon?: string): React.ReactElement | undefined => {
|
|
26
|
+
return icon && antdIcons[icon] && React.createElement(antdIcons[icon]);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const menuItems: MenuItemType[] = useMemo(
|
|
30
|
+
() => [
|
|
31
|
+
tabs.length <= 1 ? null : {
|
|
32
|
+
label: translate("${关闭}"),
|
|
33
|
+
key: "close",
|
|
34
|
+
},
|
|
35
|
+
tabs.length <= 1 ? null : {
|
|
36
|
+
label: translate("${关闭其他}"),
|
|
37
|
+
key:"other",
|
|
38
|
+
},
|
|
39
|
+
].filter(o => o !== null) ,
|
|
40
|
+
[tabs]);
|
|
41
|
+
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
+
const menuClick = useCallback(({ key, domEvent }: any, tab: KeepAliveTab) => {
|
|
44
|
+
domEvent.stopPropagation();
|
|
45
|
+
|
|
46
|
+
if (key === 'refresh') {
|
|
47
|
+
refreshTab(tab.routePath);
|
|
48
|
+
} else if (key ==="close") {
|
|
49
|
+
closeTab(tab.routePath);
|
|
50
|
+
} else if (key === "other") {
|
|
51
|
+
closeOtherTab(tab.routePath);
|
|
52
|
+
}
|
|
53
|
+
}, [closeOtherTab, closeTab, refreshTab]);
|
|
54
|
+
|
|
55
|
+
const renderTabTitle = useCallback((tab: KeepAliveTab) => {
|
|
56
|
+
let label=Units.mapMenu(tab.title)?Units.mapMenu(tab.title):tab.title;
|
|
57
|
+
label=translate("${"+label+"}");
|
|
58
|
+
return (
|
|
59
|
+
<Dropdown
|
|
60
|
+
menu={{
|
|
61
|
+
items: menuItems,
|
|
62
|
+
onClick: (e) => menuClick(e, tab),
|
|
63
|
+
}}
|
|
64
|
+
trigger={['contextMenu']}
|
|
65
|
+
onOpenChange={open => {
|
|
66
|
+
if (open) {
|
|
67
|
+
navigate(tab.pathname);
|
|
68
|
+
}
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<div className='flex gap-[6px]' style={{ margin: '-12px 0', padding: '12px 0' }}>
|
|
72
|
+
{getIcon(tab.icon)}
|
|
73
|
+
{label}
|
|
74
|
+
</div>
|
|
75
|
+
</Dropdown>
|
|
76
|
+
)
|
|
77
|
+
}, [menuItems]);
|
|
78
|
+
|
|
79
|
+
const tabItems = useMemo(() => {
|
|
80
|
+
return tabs.map(tab => {
|
|
81
|
+
return {
|
|
82
|
+
key: tab.routePath,
|
|
83
|
+
label: renderTabTitle(tab),
|
|
84
|
+
children: (
|
|
85
|
+
<div
|
|
86
|
+
key={tab.key}
|
|
87
|
+
className='overflow-y-auto'
|
|
88
|
+
// style={{
|
|
89
|
+
// height: `calc(100vh - ${defaultSetting.headerHeight + 36}px)`,
|
|
90
|
+
// }}
|
|
91
|
+
>
|
|
92
|
+
{/*<Watermark type='content'>*/}
|
|
93
|
+
{tab.children}
|
|
94
|
+
{/*</Watermark>*/}
|
|
95
|
+
</div>
|
|
96
|
+
),
|
|
97
|
+
closable: tabs.length > 1, // 剩最后一个就不能删除了
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
},[tabs]);
|
|
101
|
+
//let tabItems=tabItemsf();
|
|
102
|
+
|
|
103
|
+
let navigate = useNavigate();
|
|
104
|
+
|
|
105
|
+
const onTabsChange =useCallback( (tabKey: string) => {
|
|
106
|
+
tabs.forEach(tab=>{
|
|
107
|
+
if(tab.routePath == tabKey){
|
|
108
|
+
navigate(tab.pathname);
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
},[tabs]);
|
|
112
|
+
|
|
113
|
+
const onTabEdit = (
|
|
114
|
+
targetKey: string,
|
|
115
|
+
action: 'add' | 'remove',
|
|
116
|
+
) => {
|
|
117
|
+
if (action === 'remove') {
|
|
118
|
+
closeTab(targetKey);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const keepAliveContextValue = useMemo(
|
|
123
|
+
() => ({
|
|
124
|
+
closeTab,
|
|
125
|
+
closeOtherTab,
|
|
126
|
+
refreshTab,
|
|
127
|
+
}),
|
|
128
|
+
[closeTab, closeOtherTab, refreshTab]
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<KeepAliveTabContext.Provider value={keepAliveContextValue}>
|
|
133
|
+
<Tabs
|
|
134
|
+
tabBarStyle={{marginBottom:'4px'}}
|
|
135
|
+
activeKey={activeTabRoutePath}
|
|
136
|
+
items={tabItems}
|
|
137
|
+
type="editable-card"
|
|
138
|
+
onChange={onTabsChange}
|
|
139
|
+
hideAdd
|
|
140
|
+
onEdit={(e,a)=>{onTabEdit(e.toString(),a)}}
|
|
141
|
+
size="small"
|
|
142
|
+
// onDragEnd={({ activeIndex, overIndex }) => {
|
|
143
|
+
// setTabs(
|
|
144
|
+
// arrayMove(tabs, activeIndex, overIndex)
|
|
145
|
+
// );
|
|
146
|
+
// }}
|
|
147
|
+
/>
|
|
148
|
+
</KeepAliveTabContext.Provider>
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export default TabsLayout;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import React, { ReactNode, createContext, useEffect, useState } from "react";
|
|
3
3
|
import { useNavigatorLanguage } from "./useLocale";
|
|
4
|
-
import {
|
|
4
|
+
import {getLangWithLangApiMp, getLangWithLangMp } from "./langMp";
|
|
5
5
|
import { LocaleType } from "./langMp";
|
|
6
6
|
import HcserviceV3 from "../tmpl/hcservice-v3";
|
|
7
7
|
|
|
@@ -10,6 +10,8 @@ export const LocaleContext = createContext<{
|
|
|
10
10
|
langPkg: any;
|
|
11
11
|
availableLang: string[];
|
|
12
12
|
changeLocale: (locale: LocaleType) => void;
|
|
13
|
+
siderCollapsed:boolean;
|
|
14
|
+
changeSiderCollapsed:()=>void;
|
|
13
15
|
t: (...strs: string[]) => string;
|
|
14
16
|
translate: (...strs: string[]) => string;
|
|
15
17
|
getServiceLangStr?: ()=>string;
|
|
@@ -18,6 +20,8 @@ export const LocaleContext = createContext<{
|
|
|
18
20
|
availableLang: [],
|
|
19
21
|
langPkg: {},
|
|
20
22
|
changeLocale: () => {},
|
|
23
|
+
siderCollapsed:false,
|
|
24
|
+
changeSiderCollapsed:()=>{},
|
|
21
25
|
t: (...str) => str.join(""),
|
|
22
26
|
translate: (str) => {
|
|
23
27
|
let res = [],
|
|
@@ -76,6 +80,9 @@ export const LocaleProvider = ({
|
|
|
76
80
|
const [locale, setLocale] = useState<LocaleType>(
|
|
77
81
|
localeStorageLang ? localeStorageLang : getLangWithLangMp(navigatorLanguage)
|
|
78
82
|
);
|
|
83
|
+
|
|
84
|
+
const [siderCollapsed, setSiderCollapsed] = useState<boolean>(false);
|
|
85
|
+
|
|
79
86
|
const [langPkg, setLangPkg] = useState(
|
|
80
87
|
localeStorageLangPkg ? localeStorageLangPkg : {}
|
|
81
88
|
);
|
|
@@ -85,6 +92,10 @@ export const LocaleProvider = ({
|
|
|
85
92
|
setLocale(locale);
|
|
86
93
|
};
|
|
87
94
|
|
|
95
|
+
const changeSiderCollapsed = () => {
|
|
96
|
+
setSiderCollapsed(!siderCollapsed);
|
|
97
|
+
};
|
|
98
|
+
|
|
88
99
|
const getServiceLangStr = () => {
|
|
89
100
|
const langStr = getLangWithLangApiMp(locale);
|
|
90
101
|
return langStr;
|
|
@@ -196,7 +207,7 @@ export const LocaleProvider = ({
|
|
|
196
207
|
|
|
197
208
|
return (
|
|
198
209
|
<LocaleContext.Provider
|
|
199
|
-
value={{ locale, availableLang, langPkg, changeLocale, t, translate ,getServiceLangStr}}
|
|
210
|
+
value={{ locale, availableLang, langPkg, changeLocale,siderCollapsed,changeSiderCollapsed, t, translate ,getServiceLangStr}}
|
|
200
211
|
>
|
|
201
212
|
{children}
|
|
202
213
|
</LocaleContext.Provider>
|
|
@@ -35,8 +35,9 @@ export const useNavigatorLanguage = (): Readonly<NavigatorLanguageState> => {
|
|
|
35
35
|
export const useLocale = () => {
|
|
36
36
|
const {
|
|
37
37
|
locale,
|
|
38
|
-
langPkg,
|
|
39
38
|
changeLocale,
|
|
39
|
+
siderCollapsed,
|
|
40
|
+
changeSiderCollapsed,
|
|
40
41
|
t,
|
|
41
42
|
translate,
|
|
42
43
|
availableLang,
|
|
@@ -50,8 +51,15 @@ export const useLocale = () => {
|
|
|
50
51
|
setLocale: (loacle: LocaleType) => {
|
|
51
52
|
changeLocale(loacle);
|
|
52
53
|
},
|
|
54
|
+
getSiderCollapsed: () => {
|
|
55
|
+
return siderCollapsed;
|
|
56
|
+
},
|
|
57
|
+
changeSiderCollapsed: () => {
|
|
58
|
+
changeSiderCollapsed();
|
|
59
|
+
},
|
|
53
60
|
t,
|
|
54
61
|
translate,
|
|
55
|
-
availableLang,getServiceLangStr
|
|
62
|
+
availableLang,getServiceLangStr,
|
|
63
|
+
|
|
56
64
|
};
|
|
57
65
|
};
|
|
@@ -5,7 +5,8 @@ import { useLocale } from "../locale/useLocale";
|
|
|
5
5
|
import { useParams } from "react-router-dom";
|
|
6
6
|
import Units from "../units";
|
|
7
7
|
import {SafetyCertificateOutlined} from "@ant-design/icons";
|
|
8
|
-
|
|
8
|
+
import { useSessionStorageState } from 'ahooks';
|
|
9
|
+
import {KeepAliveTab} from "../hooks/use-tabs";
|
|
9
10
|
type LoginPropType = {
|
|
10
11
|
onFinish?: (token: string) => void;
|
|
11
12
|
title?: any;
|
|
@@ -22,6 +23,9 @@ type FormType = {
|
|
|
22
23
|
const Login = (props: LoginPropType) => {
|
|
23
24
|
// locale
|
|
24
25
|
const { translate } = useLocale();
|
|
26
|
+
const [keepAliveTabs, setKeepAliveTabs] = useSessionStorageState<KeepAliveTab[]>('keepAliveTabs', {
|
|
27
|
+
defaultValue: [],
|
|
28
|
+
});
|
|
25
29
|
|
|
26
30
|
useEffect(() => {
|
|
27
31
|
localStorage.setItem("version", "v2");
|
|
@@ -40,6 +44,7 @@ const Login = (props: LoginPropType) => {
|
|
|
40
44
|
// form
|
|
41
45
|
const [form] = Form.useForm<FormType>();
|
|
42
46
|
const submit = async () => {
|
|
47
|
+
setKeepAliveTabs([]);
|
|
43
48
|
try {
|
|
44
49
|
const { username, password,kaptchaText } = await form.validateFields();
|
|
45
50
|
|
|
@@ -30,17 +30,6 @@ class DtmplViewCard extends React.PureComponent<DtmplViewCardProps, DtmplViewCar
|
|
|
30
30
|
static defaultProps={editable:true,
|
|
31
31
|
showHeader:true}
|
|
32
32
|
|
|
33
|
-
// async componentDidMount() {
|
|
34
|
-
// this.loadDtmplConfig();
|
|
35
|
-
// }
|
|
36
|
-
//
|
|
37
|
-
// async componentDidUpdate(prevProps) {
|
|
38
|
-
// const { sourceId} = this.props;
|
|
39
|
-
// if(!prevProps || prevProps.sourceId!=sourceId){
|
|
40
|
-
// this.loadDtmplConfig();
|
|
41
|
-
// }
|
|
42
|
-
// }
|
|
43
|
-
|
|
44
33
|
goDtmpl=()=>{
|
|
45
34
|
this.setState({
|
|
46
35
|
showDtmplEdit:true,
|
|
@@ -31,6 +31,7 @@ export interface LtmplTableProps {
|
|
|
31
31
|
collapsible?: boolean;
|
|
32
32
|
initCollapse?: boolean;
|
|
33
33
|
readOnly?: boolean;
|
|
34
|
+
rowOperatable?: boolean;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
export interface LtmplTableState {
|
|
@@ -72,6 +73,7 @@ class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
|
|
|
72
73
|
collapsible: false,
|
|
73
74
|
initCollapse: false,
|
|
74
75
|
readOnly: false,
|
|
76
|
+
rowOperatable:true,
|
|
75
77
|
};
|
|
76
78
|
|
|
77
79
|
async componentDidMount() {
|
|
@@ -237,20 +239,12 @@ class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
|
|
|
237
239
|
addTmplId,dtmplSourceId,
|
|
238
240
|
} = this.state;
|
|
239
241
|
const {
|
|
240
|
-
sourceId,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
tip,
|
|
247
|
-
title,
|
|
248
|
-
collapsible,
|
|
249
|
-
initCollapse,
|
|
250
|
-
doCustomEdit,
|
|
251
|
-
doCustomCreate,
|
|
252
|
-
serverKey,
|
|
253
|
-
readOnly,
|
|
242
|
+
sourceId, mainCode,
|
|
243
|
+
showView, doSearch,
|
|
244
|
+
doRAction, funcMode,
|
|
245
|
+
tip, title, collapsible,
|
|
246
|
+
initCollapse, doCustomEdit, doCustomCreate,
|
|
247
|
+
serverKey,rowOperatable, readOnly,
|
|
254
248
|
} = this.props;
|
|
255
249
|
const { translate } = this.context;
|
|
256
250
|
|
|
@@ -260,24 +254,16 @@ class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
|
|
|
260
254
|
const { buttons, customEditPagePath } = ltmplConfigRes.ltmplConfig;
|
|
261
255
|
return (
|
|
262
256
|
<>
|
|
263
|
-
<ActTable
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
serverKey={serverKey}
|
|
267
|
-
pageSize={pageSize}
|
|
268
|
-
pageNo={pageNo}
|
|
269
|
-
onChangePage={this.onChangePage}
|
|
270
|
-
collapsible={collapsible}
|
|
257
|
+
<ActTable operatable={rowOperatable} readOnly={readOnly} tip={tip}
|
|
258
|
+
serverKey={serverKey} pageSize={pageSize} pageNo={pageNo}
|
|
259
|
+
onChangePage={this.onChangePage} collapsible={collapsible}
|
|
271
260
|
initCollapse={initCollapse && collapse}
|
|
272
|
-
title={title}
|
|
273
|
-
funcMode={funcMode}
|
|
274
|
-
mainCode={mainCode}
|
|
261
|
+
title={title} funcMode={funcMode} mainCode={mainCode}
|
|
275
262
|
showView={showView ? showView : this.showView}
|
|
276
263
|
doRAction={doRAction ? doRAction : this.doRAction}
|
|
277
264
|
doSearch={doSearch ? doSearch : this.doSearch}
|
|
278
265
|
doEdit={this.doEdit}
|
|
279
|
-
doCreate={this.doCreate}
|
|
280
|
-
sourceId={sourceId}
|
|
266
|
+
doCreate={this.doCreate} sourceId={sourceId}
|
|
281
267
|
criteriaData={criteriaData}
|
|
282
268
|
customEditable={doCustomEdit ? true : false}
|
|
283
269
|
customCreatable={doCustomCreate ? true : false}
|