aldehyde 0.2.236 → 0.2.237
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 +9 -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/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/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 +15 -2
- 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/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/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
|
@@ -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
|
};
|
|
@@ -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}
|
|
@@ -18,10 +18,12 @@ import DtmplViewDrawer from "../module/dtmpl-view-drawer";
|
|
|
18
18
|
import DtmplCustomEditModalPage from "../custom-page/dtmpl-custom-edit-modal-page";
|
|
19
19
|
import DtmplEditPage from "../module/dtmpl-edit-page";
|
|
20
20
|
import DtmplViewModal from "../module/dtmpl-view-modal";
|
|
21
|
+
import {arrowsOptions} from "ketcher-react/dist/script/ui/views/toolbars/LeftToolbar/leftToolbarOptions";
|
|
21
22
|
|
|
22
23
|
export interface LtmplRouteProps extends RouterCompProps {
|
|
23
24
|
layoutRootPath?: string;
|
|
24
25
|
tableType?:"common"|"report";
|
|
26
|
+
rowOperatable?: boolean;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
export interface LtmplRouteState {
|
|
@@ -44,6 +46,7 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
44
46
|
static defaultProps = {
|
|
45
47
|
basePath: "",
|
|
46
48
|
tableType:"common",
|
|
49
|
+
rowOperatable:true,
|
|
47
50
|
};
|
|
48
51
|
state = {
|
|
49
52
|
ltmplConfigRes: undefined,
|
|
@@ -55,7 +58,8 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
55
58
|
showViewDrawer: false,
|
|
56
59
|
showViewModal: false,
|
|
57
60
|
showEdit: false,
|
|
58
|
-
showWindowType: "modal"
|
|
61
|
+
showWindowType: "modal",
|
|
62
|
+
routeMode:'multiple',
|
|
59
63
|
};
|
|
60
64
|
|
|
61
65
|
async componentDidMount() {
|
|
@@ -126,7 +130,7 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
126
130
|
const {sourceId} = this.props.params;
|
|
127
131
|
const {ltmplConfigRes} = this.state;
|
|
128
132
|
let ltmplConfig: LtmplConfig = ltmplConfigRes.ltmplConfig;
|
|
129
|
-
let showType: string = !ltmplConfig.buttonViewConfig ? "
|
|
133
|
+
let showType: string = !ltmplConfig.buttonViewConfig ? "drawer" : ltmplConfig.buttonViewConfig.showType;
|
|
130
134
|
|
|
131
135
|
let dtmplSourceId = showViewParam.dtmplSourceId
|
|
132
136
|
? showViewParam.dtmplSourceId
|
|
@@ -165,7 +169,7 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
165
169
|
let ltmplConfig: LtmplConfig = ltmplConfigRes.ltmplConfig;
|
|
166
170
|
let showWindowType: PageType;
|
|
167
171
|
|
|
168
|
-
showWindowType = !ltmplConfig.buttonEditConfig ? "
|
|
172
|
+
showWindowType = !ltmplConfig.buttonEditConfig ? "modal" : ltmplConfig.buttonEditConfig.showType;
|
|
169
173
|
|
|
170
174
|
let dtmplSourceId = param.dtmplSourceId ? param.dtmplSourceId : sourceId;
|
|
171
175
|
let path = `${basePath}${
|
|
@@ -212,7 +216,9 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
212
216
|
const {sourceId} = this.props.params;
|
|
213
217
|
const {ltmplConfigRes} = this.state;
|
|
214
218
|
let ltmplConfig: LtmplConfig = ltmplConfigRes.ltmplConfig;
|
|
215
|
-
|
|
219
|
+
|
|
220
|
+
let showWindowType: string = !ltmplConfig.buttonAddConfig ?"modal" : ltmplConfig.buttonAddConfig.showType;
|
|
221
|
+
|
|
216
222
|
let path = `${basePath}${
|
|
217
223
|
this.computedLayoutPath
|
|
218
224
|
}/${sourceId}/detail-edit?menuId=${this.getMenuId()}&addTmplId=${
|
|
@@ -317,8 +323,7 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
317
323
|
ltmplConfigRes, showDraw, showWindowType, ractionId, selectedCode,
|
|
318
324
|
showViewDrawer, showViewModal, showEdit
|
|
319
325
|
} = this.state;
|
|
320
|
-
const {location, params,tableType} = this.props;
|
|
321
|
-
|
|
326
|
+
const {location, params,tableType,rowOperatable} = this.props;
|
|
322
327
|
const {sourceId} = params;
|
|
323
328
|
const {translate} = this.context;
|
|
324
329
|
//let menuId = undefined;
|
|
@@ -338,41 +343,37 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
338
343
|
|
|
339
344
|
let ltmplConfig = ltmplConfigRes ? ltmplConfigRes.ltmplConfig : null;
|
|
340
345
|
|
|
346
|
+
let windowWidth = ltmplConfig?.buttonViewConfig?.windowWidth
|
|
347
|
+
windowWidth= windowWidth && windowWidth>0 ? windowWidth : 1280;
|
|
348
|
+
|
|
349
|
+
let windowHeight = ltmplConfig?.buttonViewConfig?.windowHeight;
|
|
350
|
+
windowHeight= windowHeight && windowHeight>0 ? windowHeight : '80vh';
|
|
351
|
+
|
|
352
|
+
let windowEditWidth = ltmplConfig?.buttonEditConfig?.windowWidth;
|
|
353
|
+
windowEditWidth= windowEditWidth && windowEditWidth>0 ? windowEditWidth : 1280;
|
|
354
|
+
|
|
355
|
+
let windowEditHeight = ltmplConfig?.buttonEditConfig?.windowHeight;
|
|
356
|
+
windowEditHeight= windowEditHeight && windowEditHeight>0 ? windowEditHeight : '80vh';
|
|
357
|
+
|
|
341
358
|
if (!ltmplConfig) {
|
|
342
359
|
return <></>;
|
|
343
360
|
} else {
|
|
344
361
|
return (
|
|
345
362
|
<>
|
|
346
363
|
<ActTable
|
|
347
|
-
tableType={tableType}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
menuId={this.getMenuId()}
|
|
353
|
-
mainCode={mainCode}
|
|
354
|
-
showView={this.showView}
|
|
355
|
-
doSearch={this.onChangeSearch}
|
|
356
|
-
doEdit={this.doEdit}
|
|
357
|
-
doCreate={this.doCreate}
|
|
358
|
-
sourceId={sourceId}
|
|
359
|
-
criteriaData={criteriaData}
|
|
360
|
-
ltmplConfig={ltmplConfig}
|
|
361
|
-
doRAction={this.doRAction}
|
|
364
|
+
tableType={tableType} serverKey={null} pageSize={pageSize} pageNo={pageNo} onChangePage={this.onChangePage}
|
|
365
|
+
menuId={this.getMenuId()} operatable={rowOperatable}
|
|
366
|
+
mainCode={mainCode} showView={this.showView} doSearch={this.onChangeSearch} doEdit={this.doEdit}
|
|
367
|
+
doCreate={this.doCreate} sourceId={sourceId}
|
|
368
|
+
criteriaData={criteriaData} ltmplConfig={ltmplConfig} doRAction={this.doRAction}
|
|
362
369
|
/>
|
|
363
370
|
{showDraw ? (
|
|
364
371
|
<Drawer
|
|
365
|
-
placement={"left"}
|
|
366
|
-
|
|
367
|
-
closable={true}
|
|
368
|
-
mask={false}
|
|
369
|
-
onClose={this.doClose}
|
|
370
|
-
open={showDraw}
|
|
371
|
-
width={"calc(100% - 280px)"}
|
|
372
|
+
placement={"left"} title={translate("${关联查询}")} closable={true} mask={false} onClose={this.doClose}
|
|
373
|
+
open={showDraw} width={"calc(100% - 280px)"}
|
|
372
374
|
style={{
|
|
373
375
|
maxWidth: 1960,
|
|
374
|
-
}}
|
|
375
|
-
extra={
|
|
376
|
+
}} extra={
|
|
376
377
|
<Space>
|
|
377
378
|
<Button onClick={this.doClose}>
|
|
378
379
|
{translate("${关闭}")}
|
|
@@ -381,19 +382,14 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
381
382
|
}
|
|
382
383
|
>
|
|
383
384
|
{
|
|
384
|
-
<LtmplTable
|
|
385
|
-
serverKey={null}
|
|
386
|
-
sourceId={ractionId}
|
|
387
|
-
mainCode={selectedCode}
|
|
388
|
-
></LtmplTable>
|
|
385
|
+
<LtmplTable serverKey={null} sourceId={ractionId} mainCode={selectedCode}></LtmplTable>
|
|
389
386
|
}
|
|
390
387
|
</Drawer>
|
|
391
388
|
) : null}
|
|
392
389
|
{showViewDrawer && selectedCode ? (
|
|
393
390
|
<DtmplViewDrawer
|
|
394
|
-
serverKey={null}
|
|
395
|
-
|
|
396
|
-
width={ltmplConfig.buttonViewConfig.windowWidth}
|
|
391
|
+
serverKey={null} placement={ltmplConfig.buttonViewConfig.windowPosition}
|
|
392
|
+
width={ windowWidth}
|
|
397
393
|
onClose={this.doClose}
|
|
398
394
|
open={showViewDrawer}
|
|
399
395
|
sourceId={sourceId}
|
|
@@ -402,12 +398,7 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
402
398
|
) : null}
|
|
403
399
|
{showViewModal && selectedCode ? (
|
|
404
400
|
<DtmplViewModal
|
|
405
|
-
serverKey={null}
|
|
406
|
-
width={ltmplConfig.buttonViewConfig.windowWidth}
|
|
407
|
-
height={ltmplConfig.buttonViewConfig.windowHeight}
|
|
408
|
-
onClose={this.doClose}
|
|
409
|
-
open={showViewModal}
|
|
410
|
-
sourceId={sourceId}
|
|
401
|
+
serverKey={null} width={windowWidth} height={windowHeight} onClose={this.doClose} open={showViewModal} sourceId={sourceId}
|
|
411
402
|
code={selectedCode}
|
|
412
403
|
></DtmplViewModal>
|
|
413
404
|
) : null}
|
|
@@ -429,8 +420,8 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
429
420
|
serverKey={null}
|
|
430
421
|
pageType={showWindowType=="modal"?"modal":"drawer"}
|
|
431
422
|
open={showEdit}
|
|
432
|
-
width={
|
|
433
|
-
height={
|
|
423
|
+
width={windowEditWidth }
|
|
424
|
+
height={windowEditHeight}
|
|
434
425
|
onCancel={this.doClose}
|
|
435
426
|
mainCode={mainCode}
|
|
436
427
|
sourceId={sourceId}
|
|
@@ -12,6 +12,7 @@ import ActTree from "../tree/act-tree";
|
|
|
12
12
|
import { Card } from "antd";
|
|
13
13
|
export interface TtmplRouteProps extends RouterCompProps {
|
|
14
14
|
layoutRootPath?: string;
|
|
15
|
+
treeTop?:number,
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export interface TtmplRouteState {
|
|
@@ -78,14 +79,14 @@ class TtmplRoute extends React.PureComponent<TtmplRouteProps, TtmplRouteState> {
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
render() {
|
|
81
|
-
const {} = this.props;
|
|
82
|
+
const {treeTop} = this.props;
|
|
82
83
|
const { ttmplConfig } = this.state;
|
|
83
84
|
if (!ttmplConfig) {
|
|
84
85
|
return <Card loading={true}></Card>;
|
|
85
86
|
} else {
|
|
86
87
|
return (
|
|
87
88
|
<>
|
|
88
|
-
<ActTree ttmplConfig={ttmplConfig}></ActTree>
|
|
89
|
+
<ActTree top={treeTop} ttmplConfig={ttmplConfig}></ActTree>
|
|
89
90
|
</>
|
|
90
91
|
);
|
|
91
92
|
}
|
|
@@ -9,14 +9,24 @@ import {
|
|
|
9
9
|
const withRouter = (Comp) => (props) => {
|
|
10
10
|
const location = useLocation();
|
|
11
11
|
const navigate = useNavigate();
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
14
|
+
|
|
15
|
+
const {pathname} = location;
|
|
16
|
+
const {sourceId} = useParams();
|
|
17
|
+
//let sourceId= pathname.split("/")[2];
|
|
18
|
+
|
|
19
|
+
// debugger
|
|
20
|
+
// if(location.pathname.indexOf(sourceId)<=0){
|
|
21
|
+
// return <></>
|
|
22
|
+
// }
|
|
23
|
+
|
|
14
24
|
return (
|
|
15
25
|
<Comp
|
|
16
26
|
{...props}
|
|
17
27
|
location={location}
|
|
18
28
|
navigate={navigate}
|
|
19
|
-
params={
|
|
29
|
+
params={{sourceId}}
|
|
20
30
|
searchParams={searchParams}
|
|
21
31
|
/>
|
|
22
32
|
);
|