aldehyde 0.2.314 → 0.2.316
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/login2/login-page.d.ts.map +1 -1
- package/lib/login2/login-page.js +7 -8
- package/lib/login2/login-page.js.map +1 -1
- package/lib/login3/index.less +3 -3
- package/lib/login3/login-page.d.ts.map +1 -1
- package/lib/login3/login-page.js +2 -1
- package/lib/login3/login-page.js.map +1 -1
- package/lib/lowcode-components/base-button/index.d.ts +6 -0
- package/lib/lowcode-components/base-button/index.d.ts.map +1 -1
- package/lib/lowcode-components/base-button/index.js +27 -2
- package/lib/lowcode-components/base-button/index.js.map +1 -1
- package/lib/lowcode-components/base-map/index.d.ts.map +1 -1
- package/lib/lowcode-components/base-map/index.js +8 -4
- package/lib/lowcode-components/base-map/index.js.map +1 -1
- package/lib/lowcode-components/effectScatter-map/index.d.ts.map +1 -1
- package/lib/lowcode-components/effectScatter-map/index.js +8 -4
- package/lib/lowcode-components/effectScatter-map/index.js.map +1 -1
- package/lib/lowcode-components/effectScatter-map-3d/index.d.ts.map +1 -1
- package/lib/lowcode-components/effectScatter-map-3d/index.js +8 -4
- package/lib/lowcode-components/effectScatter-map-3d/index.js.map +1 -1
- package/lib/lowcode-components/index.d.ts +2 -0
- package/lib/lowcode-components/index.d.ts.map +1 -1
- package/lib/lowcode-components/index.js +3 -1
- package/lib/lowcode-components/index.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/assets.d.ts.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/assets.js +8 -0
- package/lib/lowcode-components/lowcode-view/component/assets.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/component-container.d.ts.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/component-container.js +3 -1
- package/lib/lowcode-components/lowcode-view/component/component-container.js.map +1 -1
- package/lib/lowcode-components/placeholder-component/index.d.ts +13 -0
- package/lib/lowcode-components/placeholder-component/index.d.ts.map +1 -0
- package/lib/lowcode-components/placeholder-component/index.js +33 -0
- package/lib/lowcode-components/placeholder-component/index.js.map +1 -0
- package/lib/tmpl/hcservice-v3.d.ts +1 -1
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +2 -1
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tree/act-tree.d.ts.map +1 -1
- package/lib/tree/act-tree.js +2 -7
- package/lib/tree/act-tree.js.map +1 -1
- package/lib/units/index.d.ts +2 -0
- package/lib/units/index.d.ts.map +1 -1
- package/lib/units/index.js +15 -0
- package/lib/units/index.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/login2/login-page.tsx +41 -42
- package/src/aldehyde/login3/index.less +3 -3
- package/src/aldehyde/login3/login-page.tsx +5 -3
- package/src/aldehyde/lowcode-components/base-button/index.tsx +34 -2
- package/src/aldehyde/lowcode-components/base-map/index.tsx +3 -1
- package/src/aldehyde/lowcode-components/effectScatter-map/index.tsx +3 -1
- package/src/aldehyde/lowcode-components/effectScatter-map-3d/index.tsx +3 -1
- package/src/aldehyde/lowcode-components/index.ts +5 -2
- package/src/aldehyde/lowcode-components/lowcode-view/component/assets.ts +8 -0
- package/src/aldehyde/lowcode-components/lowcode-view/component/component-container.tsx +3 -1
- package/src/aldehyde/lowcode-components/placeholder-component/index.tsx +57 -0
- package/src/aldehyde/tmpl/hcservice-v3.tsx +61 -59
- package/src/aldehyde/tree/act-tree.tsx +8 -13
- package/src/aldehyde/units/index.tsx +74 -58
|
@@ -4,14 +4,14 @@ import LoginBgPng from "./img/login-bg.png";
|
|
|
4
4
|
import { useLocale } from "../locale/useLocale";
|
|
5
5
|
import HCDataSource from "../tmpl/hc-data-source";
|
|
6
6
|
import ProgramConfig from "../units";
|
|
7
|
-
import { Col, Row} from "antd";
|
|
7
|
+
import { Col, Row } from "antd";
|
|
8
8
|
import ResetPassword from "../layout/menu/reset-password";
|
|
9
|
-
import {SafetyCertificateTwoTone} from '@ant-design/icons'
|
|
9
|
+
import { SafetyCertificateTwoTone } from '@ant-design/icons'
|
|
10
10
|
type LoginPageProps = {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
programName?: string;
|
|
12
|
+
copyright?: string;
|
|
13
13
|
};
|
|
14
|
-
const LoginPage = (props:LoginPageProps) => {
|
|
14
|
+
const LoginPage = (props: LoginPageProps) => {
|
|
15
15
|
|
|
16
16
|
const { translate } = useLocale();
|
|
17
17
|
|
|
@@ -40,51 +40,50 @@ const LoginPage = (props:LoginPageProps) => {
|
|
|
40
40
|
aspectRatio: "1/1",
|
|
41
41
|
}}
|
|
42
42
|
>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
{props.programName?translate("${" + props.programName + "}"): translate("${" + ProgramConfig.programName() + "}")}
|
|
43
|
+
<div
|
|
44
|
+
style={{
|
|
45
|
+
fontWeight: 600,
|
|
46
|
+
fontSize: "30px",
|
|
47
|
+
color: "#222222",
|
|
48
|
+
marginBottom: 10,
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
{translate("${欢迎,登录}")}
|
|
52
|
+
</div>
|
|
53
|
+
<div
|
|
54
|
+
style={{
|
|
55
|
+
fontWeight: 600,
|
|
56
|
+
fontSize: "24px",
|
|
57
|
+
color: "#222222",
|
|
58
|
+
marginBottom: 40,
|
|
59
|
+
}}
|
|
60
|
+
>{props.programName == "Aldehyde" ? "" :
|
|
61
|
+
<><SafetyCertificateTwoTone />
|
|
62
|
+
{props.programName ? translate("${" + props.programName + "}") : translate("${" + ProgramConfig.programName() + "}")}
|
|
64
63
|
</>}
|
|
65
|
-
|
|
64
|
+
</div>
|
|
66
65
|
<Login
|
|
67
66
|
onFinish={(token) => {
|
|
68
67
|
HCDataSource.clear();
|
|
69
68
|
window.location.hash = "/v2/home";
|
|
70
|
-
|
|
69
|
+
ProgramConfig.setHydrocarbonToken(token);
|
|
71
70
|
}}
|
|
72
71
|
></Login>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
<Row>
|
|
73
|
+
<Col span={6} offset={18}><ResetPassword showUserName={true}></ResetPassword></Col>
|
|
74
|
+
</Row>
|
|
75
|
+
{props.copyright ?
|
|
76
76
|
<div
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
</
|
|
86
|
-
|
|
87
|
-
</div>
|
|
77
|
+
style={{
|
|
78
|
+
fontWeight: 600,
|
|
79
|
+
fontSize: "14px",
|
|
80
|
+
color: "#999",
|
|
81
|
+
marginTop: 40,
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
{"Copyright ◎ 2025" + (props.copyright || "")}
|
|
85
|
+
</div> : ""
|
|
86
|
+
}
|
|
88
87
|
</div>
|
|
89
88
|
</div>
|
|
90
89
|
);
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
flex-direction: row-reverse;
|
|
10
10
|
justify-content: flex-start;
|
|
11
11
|
align-items: center;
|
|
12
|
+
overflow: hidden;
|
|
12
13
|
|
|
13
14
|
.login-logo-img {
|
|
14
15
|
position: absolute;
|
|
@@ -62,7 +63,7 @@
|
|
|
62
63
|
|
|
63
64
|
.login-form {
|
|
64
65
|
padding: 40px;
|
|
65
|
-
min-height:
|
|
66
|
+
min-height: 350px;
|
|
66
67
|
position: relative;
|
|
67
68
|
|
|
68
69
|
.ant-input::placeholder {
|
|
@@ -95,8 +96,7 @@
|
|
|
95
96
|
font-weight: 600;
|
|
96
97
|
font-size: 14px;
|
|
97
98
|
color: #ffffff;
|
|
98
|
-
|
|
99
|
-
bottom: 40px;
|
|
99
|
+
margin-top: 40px;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -54,9 +54,11 @@ const LoginPage = (props: LoginPageProps) => {
|
|
|
54
54
|
<div className="reset-password">
|
|
55
55
|
<ResetPassword showUserName={true} />
|
|
56
56
|
</div>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
{props.copyright ?
|
|
58
|
+
<div className="login-copyright">
|
|
59
|
+
{"Copyright ◎ 2025" + (props.copyright || "")}
|
|
60
|
+
</div> : ""
|
|
61
|
+
}
|
|
60
62
|
</div>
|
|
61
63
|
</div>
|
|
62
64
|
</div >
|
|
@@ -50,6 +50,8 @@ const handleCompsHide = (ids: string[], type: string) => {
|
|
|
50
50
|
updateLayer?.(toBeUpdate);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
const pattern = /ddpage\/([^/]+).*menuId=([^&]+)/;
|
|
54
|
+
|
|
53
55
|
interface ILayerItem {
|
|
54
56
|
id?: string | undefined;
|
|
55
57
|
hide?: boolean;
|
|
@@ -66,11 +68,17 @@ export interface ComponentStyle {
|
|
|
66
68
|
event?: {
|
|
67
69
|
eventType: string;
|
|
68
70
|
compsIds: string[];
|
|
71
|
+
routerType: string;
|
|
72
|
+
target: string;
|
|
73
|
+
path: string;
|
|
74
|
+
ddpageId: string;
|
|
75
|
+
menu: string;
|
|
69
76
|
};
|
|
70
77
|
}
|
|
71
78
|
|
|
72
79
|
export interface ComponentProps {
|
|
73
80
|
style?: ComponentStyle;
|
|
81
|
+
navigate?: (parms: any) => void;
|
|
74
82
|
}
|
|
75
83
|
|
|
76
84
|
export interface ComponentRef {
|
|
@@ -78,7 +86,7 @@ export interface ComponentRef {
|
|
|
78
86
|
}
|
|
79
87
|
|
|
80
88
|
const ButtonComponent = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>) => {
|
|
81
|
-
const { style, } = props;
|
|
89
|
+
const { style, navigate } = props;
|
|
82
90
|
const [config, setConfig] = useState<ComponentStyle>(style || {});
|
|
83
91
|
|
|
84
92
|
useImperativeHandle(ref, () => ({
|
|
@@ -93,13 +101,37 @@ const ButtonComponent = forwardRef((props: ComponentProps, ref: ForwardedRef<Com
|
|
|
93
101
|
* eventType 事件类型
|
|
94
102
|
*/
|
|
95
103
|
const onClick = () => {
|
|
96
|
-
const { compsIds, eventType } = config.event || {};
|
|
104
|
+
const { compsIds, eventType, routerType, target, path, ddpageId, menu } = config.event || {};
|
|
97
105
|
switch (eventType) {
|
|
98
106
|
case "toggle":
|
|
99
107
|
case "show":
|
|
100
108
|
case "hide":
|
|
101
109
|
handleCompsHide(compsIds, eventType);
|
|
102
110
|
break;
|
|
111
|
+
case "router":
|
|
112
|
+
const location = window.location;
|
|
113
|
+
const version = localStorage.getItem("version");
|
|
114
|
+
if (routerType === "screen") { // 大屏跳转
|
|
115
|
+
const hash = location.hash;
|
|
116
|
+
const match = hash.match(pattern);
|
|
117
|
+
const sourceId = match?.[1];
|
|
118
|
+
const menuId = match?.[2];
|
|
119
|
+
const isLayout = ["#/v2/", "#/v3/"].some(prefix => hash.startsWith(prefix));
|
|
120
|
+
if (sourceId && menuId) {
|
|
121
|
+
const url = `${isLayout ? `/${version}` : ""}/ddpage/${sourceId}/${ddpageId}?menuId=${menuId}`;
|
|
122
|
+
target === "self" ? navigate(url) : window.open(`#${url}`, "_blank");
|
|
123
|
+
}
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (routerType === "url") { // 外部链接
|
|
127
|
+
window.open(path, `_${target}`);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (routerType === "menu") { // 菜单
|
|
131
|
+
const newUrl = menu.replace("{version}", `/${version}`);
|
|
132
|
+
target === "self" ? navigate(newUrl) : window.open(`#${newUrl}`, "_blank");
|
|
133
|
+
}
|
|
134
|
+
break;
|
|
103
135
|
default:
|
|
104
136
|
break;
|
|
105
137
|
}
|
|
@@ -159,6 +159,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
159
159
|
// 自定义弹窗渲染
|
|
160
160
|
const customizeTooltipConfig = (config) => {
|
|
161
161
|
const { title, width, height, padding, backgroundColor, backgroundImage, content } = config;
|
|
162
|
+
let titleText = title.text;
|
|
162
163
|
return {
|
|
163
164
|
padding: 0,
|
|
164
165
|
borderWidth: 0,
|
|
@@ -167,10 +168,11 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
167
168
|
formatter: (params) => {
|
|
168
169
|
const itemData = params.data.itemData;
|
|
169
170
|
const dom = document.createElement("div");
|
|
171
|
+
if (title.titleType === "d1") { titleText = itemData?.value?.[title.titleType] || ""; }
|
|
170
172
|
const bgImg = `background-image: url(${backgroundImage});background-size: 100% 100%;background-repeat: no-repeat;background-position: center;`;
|
|
171
173
|
dom.style = `width:${width}px;height:${height}px;${backgroundImage ? bgImg : `background:${backgroundColor}`}`;
|
|
172
174
|
dom.innerHTML = `<div style="padding:${padding}px;width:100%;height:100%">
|
|
173
|
-
${title?.text ? `<div style="width:100%;margin-bottom:4px; font-size: ${title.fontSize}px; color: ${title.color}; text-align: ${title.position}">${
|
|
175
|
+
${title?.text ? `<div style="width:100%;margin-bottom:4px; font-size: ${title.fontSize}px; color: ${title.color}; text-align: ${title.position}">${titleText}</div>` : ""}
|
|
174
176
|
${content?.value?.map(r => itemData?.config?.[r] && `<div style="width:100%;display:flex;justify-content:space-between;align-items:center; font-size: ${content.fontSize}px; color: ${content.color};">
|
|
175
177
|
<div style="width:60%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">${itemData?.config?.[r] || ""}</div>
|
|
176
178
|
<div style="width:40%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:right">${itemData?.value?.[r] || ""}</div>
|
|
@@ -185,6 +185,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
185
185
|
// 自定义弹窗渲染
|
|
186
186
|
const customizeTooltipConfig = (config) => {
|
|
187
187
|
const { title, width, height, padding, backgroundColor, backgroundImage, content } = config;
|
|
188
|
+
let titleText = title.text;
|
|
188
189
|
return {
|
|
189
190
|
padding: 0,
|
|
190
191
|
borderWidth: 0,
|
|
@@ -193,10 +194,11 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
193
194
|
formatter: (params) => {
|
|
194
195
|
const itemData = params.data.itemData;
|
|
195
196
|
const dom = document.createElement("div");
|
|
197
|
+
if (title.titleType === "d1") { titleText = itemData?.value?.[title.titleType]; }
|
|
196
198
|
const bgImg = `background-image: url(${backgroundImage});background-size: 100% 100%;background-repeat: no-repeat;background-position: center;`;
|
|
197
199
|
dom.style = `width:${width}px;height:${height}px;${backgroundImage ? bgImg : `background:${backgroundColor}`}`;
|
|
198
200
|
dom.innerHTML = `<div style="padding:${padding}px;width:100%;height:100%">
|
|
199
|
-
${title?.text ? `<div style="width:100%;margin-bottom:4px; font-size: ${title.fontSize}px; color: ${title.color}; text-align: ${title.position}">${
|
|
201
|
+
${title?.text ? `<div style="width:100%;margin-bottom:4px; font-size: ${title.fontSize}px; color: ${title.color}; text-align: ${title.position}">${titleText}</div>` : ""}
|
|
200
202
|
${content?.value?.map(r => itemData?.config?.[r] && `<div style="width:100%;display:flex;justify-content:space-between;align-items:center; font-size: ${content.fontSize}px; color: ${content.color};">
|
|
201
203
|
<div style="width:60%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">${itemData?.config?.[r] || ""}</div>
|
|
202
204
|
<div style="width:40%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:right">${itemData?.value?.[r] || ""}</div>
|
|
@@ -281,6 +281,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
281
281
|
// 自定义弹窗渲染
|
|
282
282
|
const customizeTooltipConfig = (config) => {
|
|
283
283
|
const { title, width, height, padding, backgroundColor, backgroundImage, content } = config;
|
|
284
|
+
let titleText = title.text;
|
|
284
285
|
return {
|
|
285
286
|
padding: 0,
|
|
286
287
|
borderWidth: 0,
|
|
@@ -289,10 +290,11 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
289
290
|
formatter: (params) => {
|
|
290
291
|
const itemData = params.data.itemData;
|
|
291
292
|
const dom = document.createElement("div");
|
|
293
|
+
if (title.titleType === "d1") { titleText = itemData?.value?.[title.titleType]; }
|
|
292
294
|
const bgImg = `background-image: url(${backgroundImage});background-size: 100% 100%;background-repeat: no-repeat;background-position: center;`;
|
|
293
295
|
dom.style = `width:${width}px;height:${height}px;${backgroundImage ? bgImg : `background:${backgroundColor}`}`;
|
|
294
296
|
dom.innerHTML = `<div style="padding:${padding}px;width:100%;height:100%">
|
|
295
|
-
${title?.text ? `<div style="width:100%;margin-bottom:4px; font-size: ${title.fontSize}px; color: ${title.color}; text-align: ${title.position}">${
|
|
297
|
+
${title?.text ? `<div style="width:100%;margin-bottom:4px; font-size: ${title.fontSize}px; color: ${title.color}; text-align: ${title.position}">${titleText}</div>` : ""}
|
|
296
298
|
${content?.value?.map(r => itemData?.config?.[r] && `<div style="width:100%;display:flex;justify-content:space-between;align-items:center; font-size: ${content.fontSize}px; color: ${content.color};">
|
|
297
299
|
<div style="width:60%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">${itemData?.config?.[r] || ""}</div>
|
|
298
300
|
<div style="width:40%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:right">${itemData?.value?.[r] || ""}</div>
|
|
@@ -49,6 +49,7 @@ import StrokeAnimation from "./stroke-animation";
|
|
|
49
49
|
import EffectScatterMap3D from "./effectScatter-map-3d";
|
|
50
50
|
import BaseButton from "./base-button";
|
|
51
51
|
import BaseTabs from "./base-tabs";
|
|
52
|
+
import PlaceholderComponent from "./placeholder-component";
|
|
52
53
|
|
|
53
54
|
|
|
54
55
|
type CompoundedComponent = {
|
|
@@ -102,7 +103,8 @@ type CompoundedComponent = {
|
|
|
102
103
|
StrokeAnimation?: typeof StrokeAnimation,
|
|
103
104
|
EffectScatterMap3D?: typeof EffectScatterMap3D,
|
|
104
105
|
BaseButton?: typeof BaseButton,
|
|
105
|
-
BaseTabs?: typeof BaseTabs
|
|
106
|
+
BaseTabs?: typeof BaseTabs,
|
|
107
|
+
PlaceholderComponent?: typeof PlaceholderComponent
|
|
106
108
|
};
|
|
107
109
|
|
|
108
110
|
const LowcodeComponents: CompoundedComponent = {
|
|
@@ -114,7 +116,8 @@ const LowcodeComponents: CompoundedComponent = {
|
|
|
114
116
|
Decoration1, Decoration2, Decoration3, Decoration4, Decoration5,
|
|
115
117
|
Decoration6, Decoration7, Decoration8, Decoration9, Decoration10, Decoration11,
|
|
116
118
|
BaseTable, TextScroller, CapsuleBarChart, CircularProgressChart, ActTable, ProgressChart,
|
|
117
|
-
LineBarChart, Column3dChart, StrokeAnimation, EffectScatterMap3D, BaseButton, BaseTabs
|
|
119
|
+
LineBarChart, Column3dChart, StrokeAnimation, EffectScatterMap3D, BaseButton, BaseTabs,
|
|
120
|
+
PlaceholderComponent
|
|
118
121
|
};
|
|
119
122
|
|
|
120
123
|
export default LowcodeComponents;
|
|
@@ -50,6 +50,7 @@ import StrokeAnimation from "../../stroke-animation";
|
|
|
50
50
|
import EffectScatterMap3D from "../../effectScatter-map-3d";
|
|
51
51
|
import BaseButton from "../../base-button";
|
|
52
52
|
import BaseTabs from "../../base-tabs";
|
|
53
|
+
import PlaceholderComponent from "../../placeholder-component";
|
|
53
54
|
|
|
54
55
|
interface ComponentItemConfig {
|
|
55
56
|
baseInfo: BaseInfoType, // 基础信息
|
|
@@ -435,5 +436,12 @@ export const compsConfig: { [key: string]: ComponentItemConfig } = {
|
|
|
435
436
|
compName: "选项卡",
|
|
436
437
|
compKey: "BaseTabs"
|
|
437
438
|
}
|
|
439
|
+
},
|
|
440
|
+
PlaceholderComponent: {
|
|
441
|
+
componentNode: PlaceholderComponent,
|
|
442
|
+
baseInfo: {
|
|
443
|
+
compName: "占位组件",
|
|
444
|
+
compKey: "PlaceholderComponent"
|
|
445
|
+
}
|
|
438
446
|
}
|
|
439
447
|
};
|
|
@@ -3,6 +3,7 @@ import Loading from "./loading";
|
|
|
3
3
|
import { ILayerItem, LayerManagerDataType } from "../interface";
|
|
4
4
|
import AbstractDesignerController from "./abstract-designer-controller";
|
|
5
5
|
import abstractDesignerLoader from "./abstract-designer-loader";
|
|
6
|
+
import { useNavigate } from "react-router-dom";
|
|
6
7
|
|
|
7
8
|
const registerProxy = (compId: string, controller: AbstractDesignerController) => {
|
|
8
9
|
controller.changeData = new Proxy(controller.changeData, {
|
|
@@ -21,6 +22,7 @@ const ComponentContainer = memo((props: ComponentContainerProps) => {
|
|
|
21
22
|
const { layer, layerManager } = props;
|
|
22
23
|
const ref = useRef(null);
|
|
23
24
|
const [compController, setCompController] = useState<{ [key: string]: AbstractDesignerController }>({});
|
|
25
|
+
const navigate = useNavigate();
|
|
24
26
|
|
|
25
27
|
useEffect(() => {
|
|
26
28
|
//通过ref创建组件,并将组件实例存入Map中。后续通过Map匹配到具体实例,调用实例的对象方法进行组件的更新操作
|
|
@@ -44,7 +46,7 @@ const ComponentContainer = memo((props: ComponentContainerProps) => {
|
|
|
44
46
|
//todo 此处逻辑应该使用设计模式优化,而非写死
|
|
45
47
|
registerProxy(layer.id!, Controller);
|
|
46
48
|
setCompController(val => ({ ...val, [layer.id]: Controller }))
|
|
47
|
-
Controller.create(ref.current!, config).then(() => {
|
|
49
|
+
Controller.create(ref.current!, { ...config, navigate }).then(() => {
|
|
48
50
|
//在组件完全渲染完毕后进行数据的加载和事件的注册
|
|
49
51
|
Controller.loadComponentData();
|
|
50
52
|
//设置组件滤镜效果(todo 考虑是否应该在此处设置?)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
|
|
2
|
+
import React, { ForwardedRef, forwardRef, useMemo, useImperativeHandle, useState } from 'react';
|
|
3
|
+
import Units from "../../units/index";
|
|
4
|
+
import { useLocale } from "../../locale/useLocale";
|
|
5
|
+
|
|
6
|
+
const defStyle = {
|
|
7
|
+
color: '#9a9a9a',
|
|
8
|
+
height: '100%',
|
|
9
|
+
display: 'flex',
|
|
10
|
+
justifyContent: 'center',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
border: '1px solid #9a9a9a',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export interface ComponentProps {
|
|
16
|
+
style: { key: string },
|
|
17
|
+
isDesignMode?: boolean; // 是否编辑模式
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface CompImageonentRef {
|
|
21
|
+
updateConfig: (newConfig: ComponentProps) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const PlaceholderComponent = forwardRef((props: ComponentProps, ref: ForwardedRef<CompImageonentRef>) => {
|
|
25
|
+
const { isDesignMode } = props;
|
|
26
|
+
const { translate } = useLocale();
|
|
27
|
+
const [key, setKey] = useState<string>(props.style?.key);
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
useImperativeHandle(ref, () => ({
|
|
31
|
+
updateConfig: (newConfig) => setKey(newConfig.style?.key),
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
const renderComponent = useMemo(() => {
|
|
36
|
+
const temComponent = Units.getCustomComponent(key);
|
|
37
|
+
if (temComponent) {
|
|
38
|
+
return React.createElement(temComponent);
|
|
39
|
+
}
|
|
40
|
+
return <div style={defStyle}>{translate("${没有找到自定义组件}")}</div>;
|
|
41
|
+
}, [key]);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div style={{ width: '100%', height: '100%' }}>
|
|
45
|
+
{isDesignMode || !key ?
|
|
46
|
+
<div style={defStyle}>
|
|
47
|
+
<div>{translate("${占位组件}")}</div>
|
|
48
|
+
</div> :
|
|
49
|
+
<div style={{ width: '100%', height: '100%', overflow: "auto" }}>
|
|
50
|
+
{renderComponent}
|
|
51
|
+
</div>
|
|
52
|
+
}
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export default PlaceholderComponent;
|