aldehyde 0.2.63 → 0.2.65
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/entity-select.d.ts.map +1 -1
- package/lib/controls/entity-select/entity-select.js +3 -3
- package/lib/controls/entity-select/entity-select.js.map +1 -1
- package/lib/custom-page/dtmpl-custom-edit-modal-page.d.ts +2 -2
- package/lib/custom-page/dtmpl-custom-edit-modal-page.js +2 -2
- package/lib/custom-page/dtmpl-custom-edit-modal-page.js.map +1 -1
- package/lib/detail/button/bottom-submit-button-bar.d.ts +13 -0
- package/lib/detail/button/bottom-submit-button-bar.d.ts.map +1 -0
- package/lib/detail/button/bottom-submit-button-bar.js +30 -0
- package/lib/detail/button/bottom-submit-button-bar.js.map +1 -0
- package/lib/detail/button/fix-right-submit-button-bar.d.ts +15 -0
- package/lib/detail/button/fix-right-submit-button-bar.d.ts.map +1 -0
- package/lib/detail/button/fix-right-submit-button-bar.js +88 -0
- package/lib/detail/button/fix-right-submit-button-bar.js.map +1 -0
- package/lib/detail/button/submit-button-bar.d.ts +4 -3
- package/lib/detail/button/submit-button-bar.d.ts.map +1 -1
- package/lib/detail/button/submit-button-bar.js +8 -90
- package/lib/detail/button/submit-button-bar.js.map +1 -1
- package/lib/detail/edit/dtmpl-edit.js.map +1 -1
- package/lib/detail/edit/row-editor.d.ts.map +1 -1
- package/lib/detail/edit/row-editor.js +1 -1
- package/lib/detail/edit/row-editor.js.map +1 -1
- package/lib/detail/view/modal-dtmpl-view.js +1 -1
- package/lib/detail/view/modal-dtmpl-view.js.map +1 -1
- package/lib/layout/MainPage.d.ts.map +1 -1
- package/lib/layout/MainPage.js +50 -10
- package/lib/layout/MainPage.js.map +1 -1
- package/lib/layout/menu/block.d.ts +1 -1
- package/lib/layout/menu/block.d.ts.map +1 -1
- package/lib/layout/menu/block.js +21 -9
- package/lib/layout/menu/block.js.map +1 -1
- package/lib/layout/menu/menu-2layers.js +5 -5
- package/lib/layout/menu/menu-2layers.js.map +1 -1
- package/lib/layout/menu/menu-render.d.ts +6 -4
- package/lib/layout/menu/menu-render.d.ts.map +1 -1
- package/lib/layout/menu/menu-render.js +85 -30
- package/lib/layout/menu/menu-render.js.map +1 -1
- package/lib/module/dtmpl-edit-page.d.ts +2 -2
- package/lib/module/dtmpl-edit-page.js +2 -2
- package/lib/module/dtmpl-edit-page.js.map +1 -1
- package/lib/module/dtmpl-view-drawer.d.ts +2 -2
- package/lib/module/dtmpl-view-drawer.js +3 -3
- package/lib/module/dtmpl-view-drawer.js.map +1 -1
- package/lib/module/dtmpl-view-modal.d.ts +2 -2
- package/lib/module/dtmpl-view-modal.js +3 -3
- package/lib/module/dtmpl-view-modal.js.map +1 -1
- package/lib/module/ltmpl-drawer.d.ts +1 -1
- package/lib/module/ltmpl-drawer.js +3 -3
- package/lib/module/ltmpl-drawer.js.map +1 -1
- package/lib/module/ltmpl-modal.d.ts +2 -2
- package/lib/module/ltmpl-modal.d.ts.map +1 -1
- package/lib/module/ltmpl-modal.js +5 -6
- package/lib/module/ltmpl-modal.js.map +1 -1
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/table/relation-table.js +2 -2
- package/lib/table/relation-table.js.map +1 -1
- package/lib/tmpl/interface.d.ts +4 -0
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/entity-select/entity-select.tsx +2 -4
- package/src/aldehyde/custom-page/dtmpl-custom-edit-modal-page.tsx +2 -2
- package/src/aldehyde/detail/button/bottom-submit-button-bar.tsx +55 -0
- package/src/aldehyde/detail/button/fix-right-submit-button-bar.tsx +130 -0
- package/src/aldehyde/detail/button/submit-button-bar.tsx +13 -119
- package/src/aldehyde/detail/edit/dtmpl-edit.tsx +1 -1
- package/src/aldehyde/detail/edit/row-editor.tsx +0 -1
- package/src/aldehyde/detail/view/modal-dtmpl-view.tsx +1 -1
- package/src/aldehyde/layout/MainPage.tsx +87 -49
- package/src/aldehyde/layout/menu/block.tsx +20 -12
- package/src/aldehyde/layout/menu/menu-2layers.tsx +5 -5
- package/src/aldehyde/layout/menu/menu-render.tsx +108 -48
- package/src/aldehyde/module/dtmpl-edit-page.tsx +2 -2
- package/src/aldehyde/module/dtmpl-view-drawer.tsx +3 -3
- package/src/aldehyde/module/dtmpl-view-modal.tsx +3 -3
- package/src/aldehyde/module/ltmpl-drawer.tsx +3 -3
- package/src/aldehyde/module/ltmpl-modal.tsx +6 -8
- package/src/aldehyde/table/relation-table.tsx +0 -2
- package/src/aldehyde/tmpl/interface.tsx +6 -1
- package/lib/layout/menu/block1.d.ts +0 -18
- package/lib/layout/menu/block1.d.ts.map +0 -1
- package/lib/layout/menu/block1.js +0 -46
- package/lib/layout/menu/block1.js.map +0 -1
- package/src/aldehyde/layout/menu/block1.tsx +0 -81
|
@@ -1,46 +1,84 @@
|
|
|
1
|
-
import {Level1Menu, Level2Menu} from "../../tmpl/interface";
|
|
1
|
+
import {BlockMenu, Level1Menu, Level2Menu} from "../../tmpl/interface";
|
|
2
2
|
import {Menu} from "antd";
|
|
3
|
+
import type {MenuProps} from "antd";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import {NavLink} from 'react-router-dom';
|
|
5
6
|
import Units from "../../units";
|
|
6
|
-
|
|
7
|
+
|
|
7
8
|
|
|
8
9
|
export default {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
|
|
11
|
+
getMenu(blockMenu: BlockMenu , target, basePath = ""){
|
|
12
|
+
if(blockMenu.l1Menus){
|
|
13
|
+
return this.toL1Menu(blockMenu.l1Menus, target, basePath = "")
|
|
14
|
+
}else{
|
|
15
|
+
return this.toSubMenu(blockMenu.items, target, basePath = "");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
toL1Menu(subMenus: (Level1Menu)[], target, basePath = "") {
|
|
21
|
+
let menus:MenuProps['items'] =[];
|
|
22
|
+
let menu;
|
|
23
|
+
if(subMenus){
|
|
24
|
+
subMenus.map((item) => {
|
|
25
|
+
menu = {key: item.id};
|
|
26
|
+
let subItems = item.l2Menus;
|
|
27
|
+
if (subItems) {//菜单
|
|
28
|
+
menu.label = item.title;
|
|
29
|
+
menu.children = this.toSubMenu(subItems, target, basePath);
|
|
30
|
+
}
|
|
31
|
+
menus.push(menu);
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
return menus;
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
toSubMenu(subMenus: (Level2Menu |BlockMenu)[], target, basePath = "") {
|
|
38
|
+
let menus:MenuProps['items'] =[];
|
|
39
|
+
let menu;
|
|
40
|
+
if(subMenus){
|
|
41
|
+
subMenus.map((item) => {
|
|
42
|
+
menu = {key: item.id};
|
|
43
|
+
let subItems = item.items;
|
|
44
|
+
if (subItems) {//菜单
|
|
45
|
+
menu.label = item.title;
|
|
46
|
+
menu.children = this.toSubMenu(subItems, target, basePath);
|
|
47
|
+
} else {
|
|
48
|
+
let i:Level2Menu=item as Level2Menu;
|
|
49
|
+
menu.label = this.toL2MenuTitle(i , target, basePath);
|
|
50
|
+
}
|
|
51
|
+
menus.push(menu);
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
return menus;
|
|
17
55
|
},
|
|
18
|
-
getRoutePath(menu:Level2Menu,basePath,defaultCriteriaData){
|
|
19
|
-
if(menu){
|
|
20
|
-
let pageType=menu.pageType;
|
|
56
|
+
getRoutePath(menu: Level2Menu, basePath, defaultCriteriaData) {
|
|
57
|
+
if (menu) {
|
|
58
|
+
let pageType = menu.pageType;
|
|
21
59
|
|
|
22
|
-
let routePath='act-table';
|
|
60
|
+
let routePath = 'act-table';
|
|
23
61
|
|
|
24
|
-
let codeSource='';
|
|
62
|
+
let codeSource = '';
|
|
25
63
|
switch (pageType) {
|
|
26
64
|
case "列表":
|
|
27
|
-
routePath='act-table';
|
|
65
|
+
routePath = 'act-table';
|
|
28
66
|
break;
|
|
29
67
|
case "添加":
|
|
30
|
-
routePath='detail-edit';
|
|
31
|
-
codeSource='&codeSource=new';
|
|
68
|
+
routePath = 'detail-edit';
|
|
69
|
+
codeSource = '&codeSource=new';
|
|
32
70
|
break;
|
|
33
71
|
case "编辑":
|
|
34
|
-
routePath='detail-edit';
|
|
35
|
-
codeSource='&codeSource=listop';
|
|
72
|
+
routePath = 'detail-edit';
|
|
73
|
+
codeSource = '&codeSource=listop';
|
|
36
74
|
break;
|
|
37
75
|
case "编辑或添加":
|
|
38
|
-
routePath='detail-edit';
|
|
39
|
-
codeSource='&codeSource=listop-new';
|
|
76
|
+
routePath = 'detail-edit';
|
|
77
|
+
codeSource = '&codeSource=listop-new';
|
|
40
78
|
break;
|
|
41
79
|
case "详情":
|
|
42
|
-
routePath='detail-view';
|
|
43
|
-
codeSource='&codeSource=listop';
|
|
80
|
+
routePath = 'detail-view';
|
|
81
|
+
codeSource = '&codeSource=listop';
|
|
44
82
|
break;
|
|
45
83
|
}
|
|
46
84
|
|
|
@@ -49,37 +87,59 @@ export default {
|
|
|
49
87
|
}
|
|
50
88
|
return null;
|
|
51
89
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
defaultCriteriaData='&'+ Units.transQueryParamsToStr(item.defaultCriteriaValue);
|
|
90
|
+
toL2MenuTitle(item: Level2Menu, target, basePath = "") {
|
|
91
|
+
|
|
92
|
+
if(!item){
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let delimiter = "/";
|
|
97
|
+
let customPath = item.customPath;
|
|
98
|
+
if (customPath) {
|
|
99
|
+
if (customPath.startsWith('/') || customPath.startsWith('\\')) {
|
|
100
|
+
delimiter = "";
|
|
64
101
|
}
|
|
102
|
+
}
|
|
103
|
+
let defaultCriteriaData = "";
|
|
104
|
+
if (item['defaultCriteriaValue']) {
|
|
105
|
+
defaultCriteriaData = '&' + Units.transQueryParamsToStr(item.defaultCriteriaValue);
|
|
106
|
+
}
|
|
65
107
|
|
|
66
|
-
|
|
108
|
+
let path = customPath ? `${basePath}/page/${item.id}${delimiter}${customPath}?menuId=${item.id}` : this.getRoutePath(item, basePath, defaultCriteriaData);
|
|
67
109
|
|
|
68
|
-
|
|
69
|
-
<NavLink to={path} target={target} >{item.title}</NavLink>
|
|
70
|
-
</Menu.Item>
|
|
71
|
-
})
|
|
110
|
+
return <NavLink to={path} target={target}>{item.title}</NavLink>;
|
|
72
111
|
},
|
|
73
|
-
findOpenId(
|
|
74
|
-
let openL2MenuId:string=undefined;
|
|
75
|
-
|
|
76
|
-
for(const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
112
|
+
findOpenId(blockMenu: BlockMenu, currentL2MenuId: string) {
|
|
113
|
+
let openL2MenuId: string = undefined;
|
|
114
|
+
if(blockMenu.l1Menus){
|
|
115
|
+
for (const menul1 of blockMenu.l1Menus) {
|
|
116
|
+
for (const menul2 of menul1.l2Menus) {
|
|
117
|
+
if (menul2.id == currentL2MenuId) {
|
|
118
|
+
openL2MenuId = menul1.id;
|
|
119
|
+
return openL2MenuId;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}else{
|
|
124
|
+
for (const menul1 of blockMenu.items) {
|
|
125
|
+
if(menul1.items){
|
|
126
|
+
for (const menul2 of menul1.items) {
|
|
127
|
+
if (menul2.id == currentL2MenuId) {
|
|
128
|
+
openL2MenuId = menul1.id;
|
|
129
|
+
return openL2MenuId;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}else{
|
|
133
|
+
if (menul1.id == currentL2MenuId) {
|
|
134
|
+
openL2MenuId = menul1.id;
|
|
135
|
+
return openL2MenuId;
|
|
136
|
+
}
|
|
80
137
|
}
|
|
138
|
+
|
|
81
139
|
}
|
|
82
140
|
}
|
|
141
|
+
|
|
142
|
+
|
|
83
143
|
return openL2MenuId;
|
|
84
144
|
}
|
|
85
145
|
}
|
|
@@ -39,8 +39,8 @@ export default class DtmplEditPage extends React.PureComponent<ModalEditorProps,
|
|
|
39
39
|
}
|
|
40
40
|
static defaultProps = {
|
|
41
41
|
showConfirm: true,
|
|
42
|
-
height:
|
|
43
|
-
width:
|
|
42
|
+
height: '76vh',
|
|
43
|
+
width:'76vw',
|
|
44
44
|
bodyWidth:'100%',
|
|
45
45
|
//antd modal
|
|
46
46
|
forceRender: true,
|
|
@@ -25,8 +25,8 @@ class DtmplViewDrawer extends React.PureComponent<DtmplViewDrawerProps, DtmplVie
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
static defaultProps = {
|
|
28
|
-
height:
|
|
29
|
-
width:
|
|
28
|
+
height: "82vh",
|
|
29
|
+
width:"82vw",
|
|
30
30
|
forceRender: true,
|
|
31
31
|
cancelText: "关闭",
|
|
32
32
|
placement:'left',
|
|
@@ -49,7 +49,7 @@ class DtmplViewDrawer extends React.PureComponent<DtmplViewDrawerProps, DtmplVie
|
|
|
49
49
|
open={open}
|
|
50
50
|
width={width}
|
|
51
51
|
style={{
|
|
52
|
-
maxWidth:
|
|
52
|
+
maxWidth: "92vh",
|
|
53
53
|
}}
|
|
54
54
|
extra={
|
|
55
55
|
<Space>
|
|
@@ -22,8 +22,8 @@ class DtmplViewModal extends React.PureComponent<DtmplViewModalProps, DtmplViewM
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
static defaultProps = {
|
|
25
|
-
height:
|
|
26
|
-
width:
|
|
25
|
+
height: "82vh",
|
|
26
|
+
width:"82vw",
|
|
27
27
|
forceRender: true,
|
|
28
28
|
style: {maxWidth: 'calc(100vw - 60px)', maxHeight: 'calc(100vh - 50px)'},
|
|
29
29
|
open:false,
|
|
@@ -44,7 +44,7 @@ class DtmplViewModal extends React.PureComponent<DtmplViewModalProps, DtmplViewM
|
|
|
44
44
|
centered
|
|
45
45
|
onCancel={onClose}
|
|
46
46
|
>
|
|
47
|
-
<Scrollbars
|
|
47
|
+
<Scrollbars autoHide autoHideTimeout={1000}>
|
|
48
48
|
<DtmplViewCard codeSource={codeSource} serverKey={serverKey} sourceId={sourceId} code={code}></DtmplViewCard>
|
|
49
49
|
</Scrollbars>
|
|
50
50
|
</Modal>
|
|
@@ -19,9 +19,9 @@ export default class LtmplDrawer extends React.PureComponent<LtmplDrawPageProps,
|
|
|
19
19
|
|
|
20
20
|
static defaultProps = {
|
|
21
21
|
showConfirm: true,
|
|
22
|
-
width:
|
|
22
|
+
width:'76vw',
|
|
23
23
|
forceRender: true,
|
|
24
|
-
style: {maxWidth: '
|
|
24
|
+
style: {maxWidth: '92vw', maxHeight: '92vh'},
|
|
25
25
|
okText: "确定",
|
|
26
26
|
cancelText: "取消",
|
|
27
27
|
placement:'left',
|
|
@@ -43,7 +43,7 @@ export default class LtmplDrawer extends React.PureComponent<LtmplDrawPageProps,
|
|
|
43
43
|
open={open}
|
|
44
44
|
width={width}
|
|
45
45
|
style={{
|
|
46
|
-
maxWidth:
|
|
46
|
+
maxWidth: '92vw',
|
|
47
47
|
}}
|
|
48
48
|
// extra={
|
|
49
49
|
// <Space>{this.getFooter()}</Space>
|
|
@@ -19,8 +19,8 @@ export default class LtmplDrawer extends React.PureComponent<LtmplDrawPageProps,
|
|
|
19
19
|
|
|
20
20
|
static defaultProps = {
|
|
21
21
|
showConfirm: true,
|
|
22
|
-
height:
|
|
23
|
-
width:
|
|
22
|
+
height:'82vh' ,
|
|
23
|
+
width:'82vw',
|
|
24
24
|
forceRender: true,
|
|
25
25
|
style: {maxWidth: 'calc(100vw - 60px)', maxHeight: 'calc(100vh - 50px)',padding:10},
|
|
26
26
|
okText: "确定",
|
|
@@ -39,17 +39,15 @@ export default class LtmplDrawer extends React.PureComponent<LtmplDrawPageProps,
|
|
|
39
39
|
width={width}
|
|
40
40
|
title={title}
|
|
41
41
|
closable={false}
|
|
42
|
-
bodyStyle={{height: height, overflow: 'auto',padding:6}}
|
|
42
|
+
bodyStyle={{height: height, overflow: 'auto',padding:"6 0 6 6"}}
|
|
43
43
|
destroyOnClose={true}
|
|
44
44
|
centered
|
|
45
45
|
onOk={onCancel}
|
|
46
46
|
onCancel={onCancel}
|
|
47
|
-
footer={[<Button onClick={onCancel}>关 闭</Button>]}
|
|
48
|
-
|
|
49
|
-
<Card bordered={false} bodyStyle={{padding:'4px
|
|
50
|
-
|
|
47
|
+
footer={[<Button onClick={onCancel}>关 闭</Button>]}>
|
|
48
|
+
<Scrollbars autoHide autoHideTimeout={1000}>
|
|
49
|
+
<Card bordered={false} bodyStyle={{padding:'4px 10px 0 0'}} >
|
|
51
50
|
<LtmplTable {...other}></LtmplTable>
|
|
52
|
-
|
|
53
51
|
</Card>
|
|
54
52
|
</Scrollbars>
|
|
55
53
|
</Modal>
|
|
@@ -190,7 +190,6 @@ class RelationTable extends React.PureComponent<RelationTableProps, RelationTabl
|
|
|
190
190
|
{dtmplEdit ?
|
|
191
191
|
<Button disabled={disabled}
|
|
192
192
|
title="编辑当实体"
|
|
193
|
-
type='primary'
|
|
194
193
|
icon={<FormOutlined/>}
|
|
195
194
|
size="small"
|
|
196
195
|
onClick={() => this.showEditDtmplModel(record)}
|
|
@@ -470,7 +469,6 @@ class RelationTable extends React.PureComponent<RelationTableProps, RelationTabl
|
|
|
470
469
|
{buttons.includes('dtmplAdd') ?
|
|
471
470
|
<Button
|
|
472
471
|
disabled={buttonDisabled}
|
|
473
|
-
type='primary'
|
|
474
472
|
icon={<PlusSquareOutlined/>}
|
|
475
473
|
size="small"
|
|
476
474
|
onClick={this.showAddDtmplModel}
|
|
@@ -79,6 +79,7 @@ export interface JumpConfig extends OrderableTmplBase {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
export interface Level2Menu extends MenuBase {
|
|
82
|
+
items:(BlockMenu|Level2Menu)[],
|
|
82
83
|
customPath?: string;
|
|
83
84
|
displayTotal?: boolean;
|
|
84
85
|
count?:number;
|
|
@@ -95,7 +96,8 @@ export interface MenuBase extends OrderableTmplBase {
|
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
export interface BlockMenu extends MenuBase {
|
|
98
|
-
l1Menus: Level1Menu[]
|
|
99
|
+
l1Menus: Level1Menu[],
|
|
100
|
+
items:(BlockMenu|Level2Menu)[]
|
|
99
101
|
}
|
|
100
102
|
|
|
101
103
|
export interface CriteriaConfig extends FieldConfig {
|
|
@@ -108,6 +110,8 @@ export interface ColumnConfig extends FieldConfig {
|
|
|
108
110
|
|
|
109
111
|
export type CodeSource = 'new'|'listop'|'listop-new'|undefined;
|
|
110
112
|
|
|
113
|
+
export type ButtonPosition = 'fixedBottomRight'|'bottomLeft'|'bottomCenter'|'bottomRight'|undefined;
|
|
114
|
+
|
|
111
115
|
export type FieldGroupType = 'relation' | 'fieldGroup' ;
|
|
112
116
|
|
|
113
117
|
export type ButtonName = 'rowAdd' | 'rowEdit' | 'batchDelete'|'singleDelete'| 'selectAdd' | 'dtmplAdd' | 'dtmplEdit' | 'copy'|
|
|
@@ -146,6 +150,7 @@ export interface DtmplConfig extends TmplBase {
|
|
|
146
150
|
actions: ActionConfig[];
|
|
147
151
|
premises: FieldConfig[];
|
|
148
152
|
groups: FieldGroupConfig[];
|
|
153
|
+
buttonPosition:ButtonPosition;
|
|
149
154
|
onValuesChange:(changedValues,allValues:DtmplData,formInstance:FormInstance)=>void
|
|
150
155
|
}
|
|
151
156
|
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { BlockMenu } from "../../tmpl/interface";
|
|
3
|
-
export interface BlockProps {
|
|
4
|
-
blocks: BlockMenu[];
|
|
5
|
-
currentBlockId?: string;
|
|
6
|
-
currentL2MenuId?: string;
|
|
7
|
-
activeColor?: string;
|
|
8
|
-
}
|
|
9
|
-
interface BlockState {
|
|
10
|
-
}
|
|
11
|
-
declare class Block extends React.PureComponent<BlockProps, BlockState> {
|
|
12
|
-
constructor(props: any);
|
|
13
|
-
renderBlockMenu: (blockMenu: BlockMenu) => React.JSX.Element;
|
|
14
|
-
findBlockId: (blocks: BlockMenu[], currentL2MenuId: string) => string;
|
|
15
|
-
render(): React.JSX.Element | React.JSX.Element[];
|
|
16
|
-
}
|
|
17
|
-
export default Block;
|
|
18
|
-
//# sourceMappingURL=block1.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block1.d.ts","sourceRoot":"","sources":["../../../../../src/aldehyde/layout/menu/block1.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAI/C,MAAM,WAAW,UAAU;IACvB,MAAM,EAAC,SAAS,EAAE,CAAC;IACnB,cAAc,CAAC,EAAC,MAAM,CAAC;IACvB,eAAe,CAAC,EAAC,MAAM,CAAC;IACxB,WAAW,CAAC,EAAC,MAAM,CAAC;CACvB;AACD,UAAU,UAAU;CAEnB;AAED,cAAM,KAAM,SAAQ,KAAK,CAAC,aAAa,CAAC,UAAU,EAAE,UAAU,CAAC;gBAE/C,KAAK,KAAA;IAIjB,eAAe,cAAc,SAAS,uBAKrC;IAGD,WAAW,WAAW,SAAS,EAAE,mBAAiB,MAAM,YAavD;IAED,MAAM;CAiCT;AAED,eAAe,KAAK,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Dropdown, Menu } from 'antd';
|
|
3
|
-
import MenuRender from './menu-render';
|
|
4
|
-
class Block extends React.PureComponent {
|
|
5
|
-
constructor(props) {
|
|
6
|
-
super(props);
|
|
7
|
-
this.renderBlockMenu = (blockMenu) => {
|
|
8
|
-
return React.createElement(Menu, null, MenuRender.renderL1Menu(blockMenu.l1Menus, null));
|
|
9
|
-
};
|
|
10
|
-
this.findBlockId = (blocks, currentL2MenuId) => {
|
|
11
|
-
let blockId = undefined;
|
|
12
|
-
for (const block of blocks) {
|
|
13
|
-
for (const menul1 of block.l1Menus) {
|
|
14
|
-
for (const menul2 of menul1.l2Menus) {
|
|
15
|
-
if (menul2.id === currentL2MenuId) {
|
|
16
|
-
blockId = block.id;
|
|
17
|
-
return blockId;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return blockId;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
render() {
|
|
26
|
-
const { currentBlockId, blocks, currentL2MenuId, activeColor } = this.props;
|
|
27
|
-
const syyy = { '--header-block-active-bottom-color': activeColor ? activeColor : "#1E90FF", '--header-top-active-background': activeColor ? activeColor : "#1E90FF" };
|
|
28
|
-
if (!blocks || blocks.length < 1) {
|
|
29
|
-
return React.createElement(React.Fragment, null);
|
|
30
|
-
}
|
|
31
|
-
let blockId = currentBlockId;
|
|
32
|
-
if (currentL2MenuId && !blockId) {
|
|
33
|
-
blockId = this.findBlockId(blocks, currentL2MenuId);
|
|
34
|
-
}
|
|
35
|
-
if (!blockId) {
|
|
36
|
-
blockId = blocks.at(0).id;
|
|
37
|
-
}
|
|
38
|
-
return (blocks.map((item, index) => {
|
|
39
|
-
return React.createElement("div", { key: index, className: `${item.id == blockId ? "active" : ""} header-block`, style: syyy },
|
|
40
|
-
React.createElement(Dropdown, { overlay: this.renderBlockMenu(item) },
|
|
41
|
-
React.createElement("a", { className: "dropdown-link", style: item.id == blockId ? { color: '#fff' } : { color: activeColor }, rel: "noopener noreferrer" }, item.title)));
|
|
42
|
-
}));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export default Block;
|
|
46
|
-
//# sourceMappingURL=block1.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block1.js","sourceRoot":"","sources":["../../../../../src/aldehyde/layout/menu/block1.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AAErC,OAAO,UAAU,MAAM,eAAe,CAAC;AAavC,MAAM,KAAM,SAAQ,KAAK,CAAC,aAAqC;IAE3D,YAAY,KAAK;QACb,KAAK,CAAC,KAAK,CAAC,CAAC;QAGjB,oBAAe,GAAG,CAAC,SAAmB,EAAC,EAAE;YACrC,OAAO,oBAAC,IAAI,QACP,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,OAAO,EAAC,IAAI,CAAC,CAC7C,CAAA;QAEX,CAAC,CAAA;QAGD,gBAAW,GAAG,CAAC,MAAkB,EAAC,eAAsB,EAAE,EAAE;YACxD,IAAI,OAAO,GAAQ,SAAS,CAAC;YAC7B,KAAI,MAAM,KAAK,IAAI,MAAM,EAAC;gBACtB,KAAI,MAAM,MAAM,IAAI,KAAK,CAAC,OAAO,EAAC;oBAC9B,KAAI,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,EAAC;wBAC/B,IAAG,MAAM,CAAC,EAAE,KAAG,eAAe,EAAC;4BAC3B,OAAO,GAAC,KAAK,CAAC,EAAE,CAAC;4BACjB,OAAO,OAAO,CAAC;yBAClB;qBACJ;iBACJ;aACJ;YACD,OAAO,OAAO,CAAC;QACnB,CAAC,CAAA;IAvBD,CAAC;IAyBD,MAAM;QACF,MAAM,EAAC,cAAc,EAAC,MAAM,EAAC,eAAe,EAAC,WAAW,EAAC,GAAC,IAAI,CAAC,KAAK,CAAC;QAErE,MAAM,IAAI,GAAC,EAAC,oCAAoC,EAAC,WAAW,CAAA,CAAC,CAAA,WAAW,CAAA,CAAC,CAAA,SAAS,EAAC,gCAAgC,EAAC,WAAW,CAAA,CAAC,CAAA,WAAW,CAAA,CAAC,CAAA,SAAS,EAAkB,CAAA;QAEvK,IAAG,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,GAAC,CAAC,EAAC;YAC1B,OAAO,yCAAK,CAAC;SAChB;QACD,IAAI,OAAO,GAAC,cAAc,CAAC;QAC3B,IAAG,eAAe,IAAI,CAAC,OAAO,EAAC;YAC3B,OAAO,GAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAC,eAAe,CAAC,CAAC;SACpD;QACD,IAAG,CAAC,OAAO,EAAC;YACR,OAAO,GAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAC3B;QAED,OAAO,CACP,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACvB,OAAO,6BAAK,GAAG,EAAE,KAAK,EACV,SAAS,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,eAAe,EAAG,KAAK,EAAE,IAAI;gBACrF,oBAAC,QAAQ,IAAC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;oBACzC,2BAAI,SAAS,EAAC,eAAe,EACzB,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,OAAO,CAAA,CAAC,CAAA,EAAC,KAAK,EAAC,MAAM,EAAC,CAAA,CAAC,CAAA,EAAC,KAAK,EAAC,WAAW,EAAC,EAC7D,GAAG,EAAC,qBAAqB,IAEvB,IAAI,CAAC,KAAK,CACX,CACG,CACT,CAAA;QACV,CAAC,CAAC,CACD,CAAC;IACN,CAAC;CAEJ;AAED,eAAe,KAAK,CAAC"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import React, {CSSProperties} from "react";
|
|
2
|
-
import { Dropdown, Menu} from 'antd';
|
|
3
|
-
import {BlockMenu} from "../../tmpl/interface";
|
|
4
|
-
import MenuRender from './menu-render';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export interface BlockProps{
|
|
8
|
-
blocks:BlockMenu[];
|
|
9
|
-
currentBlockId?:string;
|
|
10
|
-
currentL2MenuId?:string;
|
|
11
|
-
activeColor?:string;
|
|
12
|
-
}
|
|
13
|
-
interface BlockState{
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
class Block extends React.PureComponent<BlockProps, BlockState> {
|
|
18
|
-
|
|
19
|
-
constructor(props) {
|
|
20
|
-
super(props);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
renderBlockMenu = (blockMenu:BlockMenu)=>{
|
|
24
|
-
return <Menu>
|
|
25
|
-
{MenuRender.renderL1Menu(blockMenu.l1Menus,null)}
|
|
26
|
-
</Menu>
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
findBlockId = (blocks:BlockMenu[],currentL2MenuId:string) => {
|
|
32
|
-
let blockId:string=undefined;
|
|
33
|
-
for(const block of blocks){
|
|
34
|
-
for(const menul1 of block.l1Menus){
|
|
35
|
-
for(const menul2 of menul1.l2Menus){
|
|
36
|
-
if(menul2.id===currentL2MenuId){
|
|
37
|
-
blockId=block.id;
|
|
38
|
-
return blockId;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return blockId;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
render(){
|
|
47
|
-
const {currentBlockId,blocks,currentL2MenuId,activeColor}=this.props;
|
|
48
|
-
|
|
49
|
-
const syyy={'--header-block-active-bottom-color':activeColor?activeColor:"#1E90FF",'--header-top-active-background':activeColor?activeColor:"#1E90FF"} as CSSProperties
|
|
50
|
-
|
|
51
|
-
if(!blocks || blocks.length<1){
|
|
52
|
-
return <></>;
|
|
53
|
-
}
|
|
54
|
-
let blockId=currentBlockId;
|
|
55
|
-
if(currentL2MenuId && !blockId){
|
|
56
|
-
blockId=this.findBlockId(blocks,currentL2MenuId);
|
|
57
|
-
}
|
|
58
|
-
if(!blockId){
|
|
59
|
-
blockId=blocks.at(0).id;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
blocks.map((item, index) => {
|
|
64
|
-
return <div key={index}
|
|
65
|
-
className={`${item.id == blockId ? "active" : ""} header-block`} style={syyy}>
|
|
66
|
-
<Dropdown overlay={this.renderBlockMenu(item)}>
|
|
67
|
-
<a className="dropdown-link"
|
|
68
|
-
style={item.id == blockId?{color:'#fff'}:{color:activeColor}}
|
|
69
|
-
rel="noopener noreferrer"
|
|
70
|
-
>
|
|
71
|
-
{item.title}
|
|
72
|
-
</a>
|
|
73
|
-
</Dropdown>
|
|
74
|
-
</div>
|
|
75
|
-
})
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export default Block;
|