aldehyde 0.2.445 → 0.2.446
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/form/criteria-form.js +1 -1
- package/lib/form/criteria-form.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/layout/menu/l2menu-quick-bar.d.ts.map +1 -1
- package/lib/layout/menu/l2menu-quick-bar.js +2 -1
- package/lib/layout/menu/l2menu-quick-bar.js.map +1 -1
- package/lib/layout2/components/search-menu.d.ts.map +1 -1
- package/lib/layout2/components/search-menu.js +8 -6
- package/lib/layout2/components/search-menu.js.map +1 -1
- package/lib/layout2/components/theme-button.d.ts.map +1 -1
- package/lib/layout2/components/theme-button.js +3 -1
- package/lib/layout2/components/theme-button.js.map +1 -1
- package/lib/layout2/tabs/tabs-layout.js +3 -3
- package/lib/layout2/tabs/tabs-layout.js.map +1 -1
- package/lib/layout3/components/tabs-layout.js +3 -3
- package/lib/layout3/components/tabs-layout.js.map +1 -1
- package/lib/layout3/css/header.less +12 -0
- package/lib/layout4/components/tabs-layout.js +3 -3
- package/lib/layout4/components/tabs-layout.js.map +1 -1
- package/lib/layout5/header.js +1 -1
- package/lib/layout5/header.js.map +1 -1
- package/lib/list/vertical-list/item.js +1 -1
- package/lib/list/vertical-list/item.js.map +1 -1
- package/lib/locale/LocaleButton.js +1 -1
- package/lib/locale/LocaleButton.js.map +1 -1
- package/lib/locale/LocaleProvider.d.ts +6 -2
- package/lib/locale/LocaleProvider.d.ts.map +1 -1
- package/lib/locale/LocaleProvider.js +14 -12
- package/lib/locale/LocaleProvider.js.map +1 -1
- package/lib/locale/langMp.d.ts +1 -1
- package/lib/locale/langMp.d.ts.map +1 -1
- package/lib/locale/useLocale.d.ts +1 -1
- package/lib/lowcode-components/line-bar-chart/index.d.ts +2 -0
- package/lib/lowcode-components/line-bar-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/line-bar-chart/index.js +14 -13
- package/lib/lowcode-components/line-bar-chart/index.js.map +1 -1
- package/lib/lowcode-components/line-chart/index.d.ts +2 -0
- package/lib/lowcode-components/line-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/line-chart/index.js +14 -13
- package/lib/lowcode-components/line-chart/index.js.map +1 -1
- package/lib/module/ttmpl-tree.d.ts +9 -0
- package/lib/module/ttmpl-tree.d.ts.map +1 -0
- package/lib/module/ttmpl-tree.js +42 -0
- package/lib/module/ttmpl-tree.js.map +1 -0
- package/lib/table/page-config-button.js +1 -1
- package/lib/table/page-config-button.js.map +1 -1
- package/lib/tmpl/interface.d.ts +2 -0
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/welcome/components/menu-card.d.ts.map +1 -1
- package/lib/welcome/components/menu-card.js +5 -3
- package/lib/welcome/components/menu-card.js.map +1 -1
- package/lib/welcome/components/page-card.js +1 -1
- package/lib/welcome/components/page-card.js.map +1 -1
- package/lib/welcome/components/quick-entrance.js +1 -1
- package/lib/welcome/components/quick-entrance.js.map +1 -1
- package/lib/welcome/components/user-menus.js +4 -4
- package/lib/welcome/components/user-menus.js.map +1 -1
- package/lib/welcome/components/workbench.d.ts.map +1 -1
- package/lib/welcome/components/workbench.js +3 -1
- package/lib/welcome/components/workbench.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/form/criteria-form.tsx +1 -1
- package/src/aldehyde/index.tsx +3 -1
- package/src/aldehyde/layout/menu/l2menu-quick-bar.tsx +2 -1
- package/src/aldehyde/layout2/components/search-menu.tsx +9 -6
- package/src/aldehyde/layout2/components/theme-button.tsx +3 -1
- package/src/aldehyde/layout2/tabs/tabs-layout.tsx +3 -3
- package/src/aldehyde/layout3/components/tabs-layout.tsx +3 -3
- package/src/aldehyde/layout3/css/header.less +12 -0
- package/src/aldehyde/layout4/components/tabs-layout.tsx +3 -3
- package/src/aldehyde/layout5/header.tsx +1 -1
- package/src/aldehyde/list/vertical-list/item.tsx +1 -1
- package/src/aldehyde/locale/LocaleButton.tsx +1 -1
- package/src/aldehyde/locale/LocaleProvider.tsx +21 -18
- package/src/aldehyde/locale/langMp.ts +1 -1
- package/src/aldehyde/lowcode-components/line-bar-chart/index.tsx +17 -13
- package/src/aldehyde/lowcode-components/line-chart/index.tsx +17 -13
- package/src/aldehyde/module/ttmpl-tree.tsx +48 -0
- package/src/aldehyde/table/page-config-button.tsx +1 -1
- package/src/aldehyde/tmpl/interface.tsx +2 -0
- package/src/aldehyde/welcome/components/menu-card.tsx +5 -3
- package/src/aldehyde/welcome/components/page-card.tsx +1 -1
- package/src/aldehyde/welcome/components/quick-entrance.tsx +1 -1
- package/src/aldehyde/welcome/components/user-menus.tsx +4 -4
- package/src/aldehyde/welcome/components/workbench.tsx +3 -1
|
@@ -21,7 +21,7 @@ interface Props {
|
|
|
21
21
|
|
|
22
22
|
const TabsLayout = (props: Props) => {
|
|
23
23
|
const { menuList } = props;
|
|
24
|
-
const { translate } = useLocale();
|
|
24
|
+
const { translate, getLocale } = useLocale();
|
|
25
25
|
const navigate = useNavigate();
|
|
26
26
|
const { activeTabRoutePath, closeTab, refreshTab, closeOtherTab, tabs = [] } = useContext(KeepAliveTabContext);
|
|
27
27
|
|
|
@@ -62,7 +62,7 @@ const TabsLayout = (props: Props) => {
|
|
|
62
62
|
</div>
|
|
63
63
|
</Dropdown >
|
|
64
64
|
)
|
|
65
|
-
}, [menuItems]);
|
|
65
|
+
}, [menuItems, getLocale()]);
|
|
66
66
|
|
|
67
67
|
const tabItems = useMemo(() => {
|
|
68
68
|
if (!menuList.length) { // 无菜单不显示
|
|
@@ -82,7 +82,7 @@ const TabsLayout = (props: Props) => {
|
|
|
82
82
|
),
|
|
83
83
|
closable: tabs.length > 1, // 剩最后一个就不能删除了
|
|
84
84
|
}))
|
|
85
|
-
}, [tabs, menuList]);
|
|
85
|
+
}, [tabs, menuList, getLocale()]);
|
|
86
86
|
|
|
87
87
|
const onTabsChange = useCallback((tabKey: string) => {
|
|
88
88
|
const tab = tabs.find(r => r.routePath === tabKey);
|
|
@@ -143,7 +143,7 @@ const Header: React.FC<HeaderPropsType> = ({ menuList, themeConfig }) => {
|
|
|
143
143
|
const breadcrumbItems = useMemo(() => {
|
|
144
144
|
const temData = handleBreadcrumbItems(menuList, []);
|
|
145
145
|
return temData || [{ title: <NavLink to={pathname} target="_self">{translate("${首页}")}</NavLink> }];
|
|
146
|
-
}, [menuList, pathname]);
|
|
146
|
+
}, [menuList, pathname, getLocale()]);
|
|
147
147
|
|
|
148
148
|
const toolbarStyle: CSSProperties = {
|
|
149
149
|
width: "100%",
|
|
@@ -111,7 +111,7 @@ const Index = (props: Props) => {
|
|
|
111
111
|
<Space size="large">
|
|
112
112
|
{temData["cardShowCols"].map((col, index) =>
|
|
113
113
|
<div className="card-show-item" key={index}>
|
|
114
|
-
<div className="title">{col.title}:</div>
|
|
114
|
+
<div className="title">{translate("${" + col.title + "}")}:</div>
|
|
115
115
|
<div className="element">{(col.value || col.value === 0) ? col.element : "-"}</div>
|
|
116
116
|
</div>)}
|
|
117
117
|
</Space> :
|
|
@@ -31,7 +31,7 @@ const LocaleButton = (props: Props) => {
|
|
|
31
31
|
|
|
32
32
|
items.unshift({
|
|
33
33
|
label: (
|
|
34
|
-
<span style={getLocale() === "zh" ? { color: token.colorPrimary } : {}}>
|
|
34
|
+
<span style={(!getLocale() || getLocale() === "zh") ? { color: token.colorPrimary } : {}}>
|
|
35
35
|
中文
|
|
36
36
|
</span>
|
|
37
37
|
),
|
|
@@ -70,13 +70,19 @@ const getLocaleWithServer = async (lang: string, serverKey?: string) => {
|
|
|
70
70
|
return {};
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
+
interface Props {
|
|
74
|
+
serverKey?: string | string[];
|
|
75
|
+
children: ReactNode;
|
|
76
|
+
languages?: string[];
|
|
77
|
+
defaultLanguage?: LocaleType
|
|
78
|
+
}
|
|
79
|
+
|
|
73
80
|
export const LocaleProvider = ({
|
|
74
81
|
serverKey = "",
|
|
75
82
|
children,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}) => {
|
|
83
|
+
languages = [],
|
|
84
|
+
defaultLanguage
|
|
85
|
+
}: Props) => {
|
|
80
86
|
const { navigatorLanguage } = useNavigatorLanguage();
|
|
81
87
|
const localeStorageLang: LocaleType = window.localStorage.getItem(
|
|
82
88
|
"locale"
|
|
@@ -85,9 +91,7 @@ export const LocaleProvider = ({
|
|
|
85
91
|
window.localStorage.getItem("langPkg")
|
|
86
92
|
);
|
|
87
93
|
|
|
88
|
-
const [locale, setLocale] = useState<LocaleType>(
|
|
89
|
-
localeStorageLang ? localeStorageLang : getLangWithLangMp(navigatorLanguage)
|
|
90
|
-
);
|
|
94
|
+
const [locale, setLocale] = useState<LocaleType>();
|
|
91
95
|
|
|
92
96
|
const [siderCollapsed, setSiderCollapsed] = useState<boolean>(false);
|
|
93
97
|
|
|
@@ -140,17 +144,16 @@ export const LocaleProvider = ({
|
|
|
140
144
|
};
|
|
141
145
|
|
|
142
146
|
useEffect(() => {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}, [locale]);
|
|
147
|
+
// 使用主题中配置支持语言(主题未配置,则默认返回的后端配置的语言)
|
|
148
|
+
if (languages?.length && locale) {
|
|
149
|
+
if (!Array.isArray(serverKey)) serverKey = [...new Set(["", serverKey])];
|
|
150
|
+
getAllLocale([...new Set(["", ...serverKey])]);
|
|
151
|
+
setAvailableLang(languages?.length ? languages?.filter(r => r !== "zh").map((i) => getLangWithLangMp(i)) : []);
|
|
152
|
+
} else if (!locale && languages?.length) {
|
|
153
|
+
// 默认使用缓存-主题配置默认-系统
|
|
154
|
+
setLocale(localeStorageLang || defaultLanguage || getLangWithLangMp(navigatorLanguage));
|
|
155
|
+
}
|
|
156
|
+
}, [locale, languages]);
|
|
154
157
|
|
|
155
158
|
useEffect(() => {
|
|
156
159
|
window.localStorage.setItem("langPkg", JSON.stringify(langPkg));
|
|
@@ -4,7 +4,7 @@ import enUS from "antd/locale/en_US";
|
|
|
4
4
|
import ptPT from 'antd/locale/pt_PT';
|
|
5
5
|
import ruRU from 'antd/locale/ru_RU';
|
|
6
6
|
|
|
7
|
-
export type LocaleType = "zh" | "en" | "fr" | "pt" | "ru";
|
|
7
|
+
export type LocaleType = "zh" | "en" | "fr" | "pt" | "ru" | string;
|
|
8
8
|
|
|
9
9
|
export const langMp = {
|
|
10
10
|
fr: ["fra", "fr-FR"],
|
|
@@ -50,8 +50,8 @@ const legends = {
|
|
|
50
50
|
rightBottom: { right: 5, bottom: 0 },
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
// 处理数据格式
|
|
54
|
-
const handleData = (data: { config: { [key: string]: string }, value: { [key: string]: any }[] }[]) => {
|
|
53
|
+
// 处理数据格式 nullSetZero(是否空值置0)
|
|
54
|
+
const handleData = (data: { config: { [key: string]: string }, value: { [key: string]: any }[] }[], nullSetZero?: boolean) => {
|
|
55
55
|
if (!data?.length) {
|
|
56
56
|
return [];
|
|
57
57
|
}
|
|
@@ -63,10 +63,10 @@ const handleData = (data: { config: { [key: string]: string }, value: { [key: st
|
|
|
63
63
|
name: config.d1,
|
|
64
64
|
data: vNames.map((r) => ({
|
|
65
65
|
name: config[r],
|
|
66
|
-
data: value.map((v) => [v["d1"], v[r]]),
|
|
66
|
+
data: value.map((v) => [v["d1"], nullSetZero ? (v[r] || 0) : v[r]]),
|
|
67
67
|
}))
|
|
68
68
|
} : {
|
|
69
|
-
data: value.map((r, index) => ({ name: `数值${index || ""}`, data: vNames.map(v => [config[v], r[v]]) }))
|
|
69
|
+
data: value.map((r, index) => ({ name: `数值${index || ""}`, data: vNames.map(v => [config[v], nullSetZero ? (r[v] || 0) : r[v]]) }))
|
|
70
70
|
};
|
|
71
71
|
});
|
|
72
72
|
return temData[0]?.data || [];
|
|
@@ -90,6 +90,8 @@ export interface ComponentStyle {
|
|
|
90
90
|
renderer?: "canvas" | "svg";
|
|
91
91
|
barMaxWidth?: number; //柱状图最大宽度
|
|
92
92
|
dataZoom?: boolean;
|
|
93
|
+
connectNulls?: boolean; // 是否连接空值
|
|
94
|
+
nullSetZero?: boolean; // 空值是否置0
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
export interface ComponentProps {
|
|
@@ -129,11 +131,12 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
129
131
|
// 全局初始化请求数据处理
|
|
130
132
|
const handleInitData = (val: DataConfigProps) => {
|
|
131
133
|
if (val.sourceType === "sourceId" && val.isInit && val.initData) {
|
|
132
|
-
const { config, value } = val.initData;
|
|
133
|
-
const
|
|
134
|
+
const { config: dataConfig, value } = val.initData;
|
|
135
|
+
const { nullSetZero } = config || {};
|
|
136
|
+
const temData = handleData(value, nullSetZero);
|
|
134
137
|
setData(temData);
|
|
135
|
-
if (
|
|
136
|
-
pollingIntervalRef.current = setInterval(() => { getData() },
|
|
138
|
+
if (dataConfig?.requestMode === "polling") {
|
|
139
|
+
pollingIntervalRef.current = setInterval(() => { getData() }, dataConfig?.pollingInterval || 60000);
|
|
137
140
|
}
|
|
138
141
|
}
|
|
139
142
|
}
|
|
@@ -171,13 +174,13 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
171
174
|
|
|
172
175
|
// 请求数据
|
|
173
176
|
const getData = async (params?: object) => {
|
|
177
|
+
const { nullSetZero } = config || {};
|
|
174
178
|
setLoading(true);
|
|
175
179
|
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
176
180
|
setLoading(false);
|
|
177
|
-
const
|
|
178
|
-
const temData = handleData(value);
|
|
181
|
+
const temData = handleData(data?.value, nullSetZero);
|
|
179
182
|
setData(temData);
|
|
180
|
-
return config;
|
|
183
|
+
return data?.config;
|
|
181
184
|
};
|
|
182
185
|
|
|
183
186
|
// 初始化请求数据
|
|
@@ -225,7 +228,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
225
228
|
}, [searchParams, initSearchParams]);
|
|
226
229
|
|
|
227
230
|
const renderChart = () => {
|
|
228
|
-
const { grid, legend, tooltip, color, xAxis, yAxis, smooth, lineStyle, step, isArea, isGradient, areaStyle, barMaxWidth, symbol, dataZoom } = config;
|
|
231
|
+
const { grid, legend, tooltip, color, xAxis, yAxis, smooth, lineStyle, step, isArea, isGradient, areaStyle, barMaxWidth, symbol, dataZoom, connectNulls } = config;
|
|
229
232
|
const option = _.cloneDeep(defOption);
|
|
230
233
|
// 编辑态无数据显示默认数据
|
|
231
234
|
const temData = isDesignMode && !data?.length ? option.series : data;
|
|
@@ -250,7 +253,8 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
250
253
|
{ offset: 0, color: color[index] },
|
|
251
254
|
{ offset: 1, color: 'rgba(0, 0, 0, 0)' }
|
|
252
255
|
]) : color[index]
|
|
253
|
-
} : undefined
|
|
256
|
+
} : undefined,
|
|
257
|
+
connectNulls
|
|
254
258
|
} : {
|
|
255
259
|
type: "bar",
|
|
256
260
|
...r,
|
|
@@ -45,8 +45,8 @@ const legends = {
|
|
|
45
45
|
rightBottom: { right: 5, bottom: 0 },
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
// 处理数据格式
|
|
49
|
-
const handleData = (data: { config: { [key: string]: string }, value: { [key: string]: any }[] }[]) => {
|
|
48
|
+
// 处理数据格式 nullSetZero(是否空值置0)
|
|
49
|
+
const handleData = (data: { config: { [key: string]: string }, value: { [key: string]: any }[] }[], nullSetZero?: boolean) => {
|
|
50
50
|
if (!data?.length) {
|
|
51
51
|
return [];
|
|
52
52
|
}
|
|
@@ -59,10 +59,10 @@ const handleData = (data: { config: { [key: string]: string }, value: { [key: st
|
|
|
59
59
|
name: config.d1,
|
|
60
60
|
data: vNames.map((r) => ({
|
|
61
61
|
name: config[r],
|
|
62
|
-
data: value.map((v) => [v["d1"], v[r]]),
|
|
62
|
+
data: value.map((v) => [v["d1"], nullSetZero ? (v[r] || 0) : v[r]]),
|
|
63
63
|
}))
|
|
64
64
|
} : {
|
|
65
|
-
data: value.map((r, index) => ({ name: `数值${index || ""}`, data: vNames.map(v => [config[v], r[v]]) }))
|
|
65
|
+
data: value.map((r, index) => ({ name: `数值${index || ""}`, data: vNames.map(v => [config[v], nullSetZero ? (r[v] || 0) : r[v]]) }))
|
|
66
66
|
};
|
|
67
67
|
});
|
|
68
68
|
return temData[0]?.data || [];
|
|
@@ -85,6 +85,8 @@ export interface ComponentStyle {
|
|
|
85
85
|
areaStyle?: { opacity: number }; // 面积图样式
|
|
86
86
|
renderer?: "canvas" | "svg";
|
|
87
87
|
dataZoom?: boolean;
|
|
88
|
+
connectNulls?: boolean; // 是否连接空值
|
|
89
|
+
nullSetZero?: boolean; // 空值是否置0
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
export interface ComponentProps {
|
|
@@ -124,11 +126,12 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
124
126
|
// 全局初始化请求数据处理
|
|
125
127
|
const handleInitData = (val: DataConfigProps) => {
|
|
126
128
|
if (val.sourceType === "sourceId" && val.isInit && val.initData) {
|
|
127
|
-
const { config, value } = val.initData;
|
|
128
|
-
const
|
|
129
|
+
const { config: dataConfig, value } = val.initData;
|
|
130
|
+
const { nullSetZero } = config || {};
|
|
131
|
+
const temData = handleData(value, nullSetZero);
|
|
129
132
|
setData(temData);
|
|
130
|
-
if (
|
|
131
|
-
pollingIntervalRef.current = setInterval(() => { getData() },
|
|
133
|
+
if (dataConfig?.requestMode === "polling") {
|
|
134
|
+
pollingIntervalRef.current = setInterval(() => { getData() }, dataConfig?.pollingInterval || 60000);
|
|
132
135
|
}
|
|
133
136
|
}
|
|
134
137
|
}
|
|
@@ -166,13 +169,13 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
166
169
|
|
|
167
170
|
// 请求数据
|
|
168
171
|
const getData = async (params?: object) => {
|
|
172
|
+
const { nullSetZero } = config || {};
|
|
169
173
|
setLoading(true);
|
|
170
174
|
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
171
175
|
setLoading(false);
|
|
172
|
-
const
|
|
173
|
-
const temData = handleData(value);
|
|
176
|
+
const temData = handleData(data?.value, nullSetZero);
|
|
174
177
|
setData(temData);
|
|
175
|
-
return config;
|
|
178
|
+
return data?.config;
|
|
176
179
|
};
|
|
177
180
|
|
|
178
181
|
// 初始化请求数据
|
|
@@ -220,7 +223,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
220
223
|
}, [searchParams, initSearchParams]);
|
|
221
224
|
|
|
222
225
|
const renderChart = () => {
|
|
223
|
-
const { grid, legend, tooltip, color, xAxis, yAxis, smooth, lineStyle, step, isArea, isGradient, areaStyle, dataZoom, symbol: { itemStyle, ...symbol } } = config;
|
|
226
|
+
const { grid, legend, tooltip, color, xAxis, yAxis, smooth, connectNulls, lineStyle, step, isArea, isGradient, areaStyle, dataZoom, symbol: { itemStyle, ...symbol } } = config;
|
|
224
227
|
const option = _.cloneDeep(defOption);
|
|
225
228
|
// 编辑态无数据显示默认数据
|
|
226
229
|
const temData = isDesignMode && !data?.length ? option.series : data;
|
|
@@ -244,7 +247,8 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
244
247
|
{ offset: 0, color: color[index] || color[0] },
|
|
245
248
|
{ offset: 1, color: 'rgba(0, 0, 0, 0)' }
|
|
246
249
|
]) : color[index]
|
|
247
|
-
} : undefined
|
|
250
|
+
} : undefined,
|
|
251
|
+
connectNulls
|
|
248
252
|
}));
|
|
249
253
|
chart.current.setOption(option, true);
|
|
250
254
|
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import { RouterCompProps, TtmplConfig } from "../tmpl/interface";
|
|
3
|
+
import HCDataSource from "../tmpl/hc-data-source";
|
|
4
|
+
import ActTree from "../tree/act-tree";
|
|
5
|
+
import { Card, message } from "antd";
|
|
6
|
+
|
|
7
|
+
export interface TtmplTreeProps extends RouterCompProps {
|
|
8
|
+
treeTop?: number;
|
|
9
|
+
sourceId: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const TtmplTree: React.FC<TtmplTreeProps> = (props) => {
|
|
13
|
+
const { treeTop, sourceId } = props;
|
|
14
|
+
const [ttmplConfig, setTtmplConfig] = useState<TtmplConfig>();
|
|
15
|
+
|
|
16
|
+
const loadData = async () => {
|
|
17
|
+
try {
|
|
18
|
+
let config: TtmplConfig = await HCDataSource.requestTtmplConfig(null, sourceId);
|
|
19
|
+
if (config.type === "1M") {
|
|
20
|
+
message.error("不支持的配置树。请联系管理员!");
|
|
21
|
+
} else {
|
|
22
|
+
setTtmplConfig({ ...config });
|
|
23
|
+
}
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error("Failed to load ttmpl config", error);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (sourceId) {
|
|
31
|
+
loadData();
|
|
32
|
+
}
|
|
33
|
+
}, [sourceId]);
|
|
34
|
+
|
|
35
|
+
if (!ttmplConfig) {
|
|
36
|
+
return <Card loading={true} />;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<ActTree
|
|
41
|
+
key={ttmplConfig?.id}
|
|
42
|
+
top={treeTop}
|
|
43
|
+
ttmplConfig={ttmplConfig}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default TtmplTree;
|
|
@@ -180,7 +180,7 @@ const Index = (props: Props) => {
|
|
|
180
180
|
<Form.Item style={{ margin: 0, textAlign: "right" }}><Button type="primary" htmlType="submit">{translate("${提交}")}</Button></Form.Item>
|
|
181
181
|
</Form>;
|
|
182
182
|
|
|
183
|
-
return <Dropdown trigger={["click"]} menu={{ items: [renderMenuItem({ key: "default", name: "默认" }), ...menus.map(r => renderMenuItem({ ...r, key: r.recordCode }))].filter(Boolean) }} popupRender={(menu) => (
|
|
183
|
+
return <Dropdown trigger={["click"]} menu={{ items: [renderMenuItem({ key: "default", name: translate("${默认}") }), ...menus.map(r => renderMenuItem({ ...r, key: r.recordCode }))].filter(Boolean) }} popupRender={(menu) => (
|
|
184
184
|
<div style={contentStyle} ref={menuRef}>
|
|
185
185
|
{React.cloneElement(menu as any, { style: { boxShadow: 'none' } },)}
|
|
186
186
|
<Divider style={{ margin: 0 }} />
|
|
@@ -5,6 +5,7 @@ import { useNavigate } from "react-router-dom";
|
|
|
5
5
|
import "antd/dist/reset.css";
|
|
6
6
|
import { MenuType } from "../../layout2/type/layout-type";
|
|
7
7
|
import IconFont from "../../icon/aliIcon";
|
|
8
|
+
import { useLocale } from "../../locale/useLocale";
|
|
8
9
|
import "./menu-card.less";
|
|
9
10
|
|
|
10
11
|
const { useToken } = theme;
|
|
@@ -18,6 +19,7 @@ const Index = (props: Props) => {
|
|
|
18
19
|
const navigate = useNavigate();
|
|
19
20
|
const [menu, setMenu] = useState<MenuType[]>([]);
|
|
20
21
|
const { token } = useToken();
|
|
22
|
+
const { translate } = useLocale();
|
|
21
23
|
|
|
22
24
|
useEffect(() => {
|
|
23
25
|
if (menus?.length) {
|
|
@@ -29,14 +31,14 @@ const Index = (props: Props) => {
|
|
|
29
31
|
const renderIcon = item.icon ? <IconFont type={item.icon} /> : <RocketTwoTone />;
|
|
30
32
|
const iconColor = item.themeColor || token.colorPrimary;
|
|
31
33
|
const children = item.children?.filter(r => !r.disabled).slice(0, 3) || [];
|
|
32
|
-
const funcDescription = item.funcDescription
|
|
34
|
+
const funcDescription = item.funcDescription ? translate("${" + item.funcDescription + "}") : `${children.map(r => translate("${" + r.label + "}")).join("、")}${translate("${等功能}")}`;
|
|
33
35
|
return <div className="item-card" style={{ borderColor: `${token.colorBorder}CC`, backgroundColor: token.colorBgContainer }} onClick={() => navigate(`/${item.url}`)}>
|
|
34
36
|
<Space size={16} align="start" style={{ marginBottom: "16px" }}>
|
|
35
37
|
<div className="icon-wrapper" style={{ color: iconColor, background: `${iconColor}1A` }}>
|
|
36
38
|
<div className="icon-animated">{renderIcon}</div>
|
|
37
39
|
</div>
|
|
38
40
|
<div>
|
|
39
|
-
<h3 className="item-title">{item.label}</h3>
|
|
41
|
+
<h3 className="item-title">{translate("${" + item.label + "}")}</h3>
|
|
40
42
|
<p style={{ color: token.colorTextSecondary }}>
|
|
41
43
|
{funcDescription}
|
|
42
44
|
</p>
|
|
@@ -48,7 +50,7 @@ const Index = (props: Props) => {
|
|
|
48
50
|
navigate(`/${cItem.url}`);
|
|
49
51
|
}}
|
|
50
52
|
key={cItem.id} className="tag" style={{ color: iconColor, background: `${iconColor}1A` }}>
|
|
51
|
-
{cItem.label}
|
|
53
|
+
{translate("${" + cItem.label + "}")}
|
|
52
54
|
</span>
|
|
53
55
|
))}
|
|
54
56
|
</Flex>
|
|
@@ -82,7 +82,7 @@ const Index = (props: Props) => {
|
|
|
82
82
|
<div className="heard">
|
|
83
83
|
<div className="title">
|
|
84
84
|
<div className="line" style={{ background: token.colorPrimary }} />
|
|
85
|
-
<h3 className="text">{l2Menu?.title || "-"}</h3>
|
|
85
|
+
<h3 className="text">{translate("${" + (l2Menu?.title || "-") + "}")}</h3>
|
|
86
86
|
</div>
|
|
87
87
|
<div style={{ color: token.colorPrimary, cursor: "pointer" }} onClick={() => l2Menu?.url && navigate(`/${l2Menu.url}`)}>
|
|
88
88
|
{translate("${查看更多}")} <RightOutlined />
|
|
@@ -60,7 +60,7 @@ const Index = (props: Props) => {
|
|
|
60
60
|
<div className={`icon-wrapper`} style={{ color: iconColor, background: ` ${iconColor}1A` }}>
|
|
61
61
|
<div className="icon-animated">{renderIcon}</div>
|
|
62
62
|
</div>
|
|
63
|
-
<span className="menu-title">{item.title}</span>
|
|
63
|
+
<span className="menu-title">{translate("${" + item.title + "}")}</span>
|
|
64
64
|
</div>;
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -67,7 +67,7 @@ const RenderDrawer = (props: DrawerProps) => {
|
|
|
67
67
|
|
|
68
68
|
const handleTreeData = (arr: MenuType[]) => {
|
|
69
69
|
return arr.map(item => {
|
|
70
|
-
const newItem = { ...item, key: item.id };
|
|
70
|
+
const newItem = { ...item, key: item.id, title: translate("${" + item.title + "}") };
|
|
71
71
|
if (newItem.children && Array.isArray(newItem.children)) {
|
|
72
72
|
newItem.children = handleTreeData(newItem.children);
|
|
73
73
|
}
|
|
@@ -185,7 +185,7 @@ const Index = (props: Props) => {
|
|
|
185
185
|
<div className={`icon-wrapper`} style={{ color: iconColor, background: ` ${iconColor}1A` }}>
|
|
186
186
|
<div className="icon-animated">{renderIcon}</div>
|
|
187
187
|
</div>
|
|
188
|
-
<span className="menu-title">{item.title}</span>
|
|
188
|
+
<span className="menu-title">{translate("${" + item.title + "}")}</span>
|
|
189
189
|
</div>;
|
|
190
190
|
};
|
|
191
191
|
|
|
@@ -219,7 +219,7 @@ const Index = (props: Props) => {
|
|
|
219
219
|
<div className="icon-animated">{renderIcon}</div>
|
|
220
220
|
</div>
|
|
221
221
|
<div>
|
|
222
|
-
<h3 className="item-title" onClick={() => navigate(`/${item.url}`)}>{item.title}</h3>
|
|
222
|
+
<h3 className="item-title" onClick={() => navigate(`/${item.url}`)}>{translate("${" + item.title + "}")}</h3>
|
|
223
223
|
<Flex gap="small" align="center" wrap>
|
|
224
224
|
{children.map((cItem) => (
|
|
225
225
|
<span
|
|
@@ -228,7 +228,7 @@ const Index = (props: Props) => {
|
|
|
228
228
|
onClickPageConfig({ ...cItem, url: item.url });
|
|
229
229
|
}}
|
|
230
230
|
key={cItem.recordCode} className="tag" style={{ color: iconColor, background: `${iconColor}1A` }}>
|
|
231
|
-
{cItem.name}
|
|
231
|
+
{translate("${" + cItem.name + "}")}
|
|
232
232
|
</span>
|
|
233
233
|
))}
|
|
234
234
|
</Flex>
|
|
@@ -8,6 +8,7 @@ import HCDataSource from "../../tmpl/hc-data-source";
|
|
|
8
8
|
import { Level2Menu } from "../../tmpl/interface";
|
|
9
9
|
import IconFont from "../../icon/aliIcon";
|
|
10
10
|
import { handleMenuItemUrl } from "../../layout2/page";
|
|
11
|
+
import { useLocale } from "../../locale/useLocale";
|
|
11
12
|
import "./workbench.less";
|
|
12
13
|
|
|
13
14
|
const { useToken } = theme;
|
|
@@ -29,6 +30,7 @@ const Workbench = (props: WorkbenchProps) => {
|
|
|
29
30
|
const rowRef = useRef(null);
|
|
30
31
|
const navigate = useNavigate();
|
|
31
32
|
const { token } = useToken();
|
|
33
|
+
const { translate } = useLocale();
|
|
32
34
|
|
|
33
35
|
const getL2Menus = async () => {
|
|
34
36
|
let temData: Level2Menu[] = await HCDataSource.fastMenu("QuickPanel");
|
|
@@ -102,7 +104,7 @@ const Workbench = (props: WorkbenchProps) => {
|
|
|
102
104
|
<div className="stat-card" style={{ borderColor: `${token.colorBorder}CC`, backgroundColor: token.colorBgContainer }} onClick={() => navigate(`/${item.url}`)}>
|
|
103
105
|
<div className="bg-gradient" style={{ background: `radial-gradient(circle, ${iconColor}1A 0%, transparent 70%)` }} />
|
|
104
106
|
<div >
|
|
105
|
-
<p className="card-title">{l2Menu.title}</p>
|
|
107
|
+
<p className="card-title">{translate("${" + l2Menu.title + "}")}</p>
|
|
106
108
|
<p className="card-count" style={{ color: iconColor }}>{l2Menu.count || 0}</p>
|
|
107
109
|
</div>
|
|
108
110
|
<div className="icon-wrapper" style={{ color: iconColor, background: `${iconColor}1A` }}>
|