aldehyde 0.2.332 → 0.2.334
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/rfield/index.js +1 -1
- package/lib/controls/rfield/index.js.map +1 -1
- package/lib/detail/button/inline-edit-button.d.ts +13 -0
- package/lib/detail/button/inline-edit-button.d.ts.map +1 -0
- package/lib/detail/button/inline-edit-button.js +17 -0
- package/lib/detail/button/inline-edit-button.js.map +1 -0
- package/lib/detail/dtmpl.css +8 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/layout2/components/theme-button.js +1 -1
- package/lib/layout2/components/theme-button.js.map +1 -1
- package/lib/layout2/components/user-button.d.ts +2 -1
- package/lib/layout2/components/user-button.d.ts.map +1 -1
- package/lib/layout2/components/user-button.js +8 -2
- package/lib/layout2/components/user-button.js.map +1 -1
- package/lib/layout3/components/tabs-layout.js +1 -1
- package/lib/layout3/components/tabs-layout.js.map +1 -1
- package/lib/layout3/css/header.css +166 -138
- package/lib/layout3/css/main.css +114 -16
- package/lib/layout3/css/sider.css +7 -6
- package/lib/layout3/css/tabs-layout.css +17 -8
- package/lib/layout3/header.d.ts.map +1 -1
- package/lib/layout3/header.js +2 -1
- package/lib/layout3/header.js.map +1 -1
- package/lib/layout3/page.d.ts.map +1 -1
- package/lib/layout3/page.js +1 -1
- package/lib/layout3/page.js.map +1 -1
- package/lib/layout3/sider.js +1 -1
- package/lib/layout3/sider.js.map +1 -1
- package/lib/layout4/components/tabs-layout.d.ts +5 -0
- package/lib/layout4/components/tabs-layout.d.ts.map +1 -0
- package/lib/layout4/components/tabs-layout.js +68 -0
- package/lib/layout4/components/tabs-layout.js.map +1 -0
- package/lib/layout4/css/header.css +157 -0
- package/lib/layout4/css/main.css +119 -0
- package/lib/layout4/css/sider.css +11 -0
- package/lib/layout4/css/tabs-layout.css +43 -0
- package/lib/layout4/header.d.ts +11 -0
- package/lib/layout4/header.d.ts.map +1 -0
- package/lib/layout4/header.js +137 -0
- package/lib/layout4/header.js.map +1 -0
- package/lib/layout4/imgs/header-bg.png +0 -0
- package/lib/layout4/imgs/home.png +0 -0
- package/lib/layout4/imgs/menu-item-bg.png +0 -0
- package/lib/layout4/imgs/user.png +0 -0
- package/lib/layout4/main.d.ts +8 -0
- package/lib/layout4/main.d.ts.map +1 -0
- package/lib/layout4/main.js +14 -0
- package/lib/layout4/main.js.map +1 -0
- package/lib/layout4/page.d.ts +8 -0
- package/lib/layout4/page.d.ts.map +1 -0
- package/lib/layout4/page.js +60 -0
- package/lib/layout4/page.js.map +1 -0
- package/lib/layout4/sider.d.ts +10 -0
- package/lib/layout4/sider.d.ts.map +1 -0
- package/lib/layout4/sider.js +125 -0
- package/lib/layout4/sider.js.map +1 -0
- package/lib/lowcode-components/bar-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/bar-chart/index.js +13 -1
- package/lib/lowcode-components/bar-chart/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 +13 -1
- package/lib/lowcode-components/base-map/index.js.map +1 -1
- package/lib/lowcode-components/base-table/index.d.ts.map +1 -1
- package/lib/lowcode-components/base-table/index.js +10 -4
- package/lib/lowcode-components/base-table/index.js.map +1 -1
- package/lib/lowcode-components/capsule-bar-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/capsule-bar-chart/index.js +13 -1
- package/lib/lowcode-components/capsule-bar-chart/index.js.map +1 -1
- package/lib/lowcode-components/carousel/index.d.ts.map +1 -1
- package/lib/lowcode-components/carousel/index.js +14 -1
- package/lib/lowcode-components/carousel/index.js.map +1 -1
- package/lib/lowcode-components/circular-progress-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/circular-progress-chart/index.js +14 -1
- package/lib/lowcode-components/circular-progress-chart/index.js.map +1 -1
- package/lib/lowcode-components/column-3d-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/column-3d-chart/index.js +13 -1
- package/lib/lowcode-components/column-3d-chart/index.js.map +1 -1
- package/lib/lowcode-components/column-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/column-chart/index.js +14 -1
- package/lib/lowcode-components/column-chart/index.js.map +1 -1
- package/lib/lowcode-components/data-number/index.d.ts.map +1 -1
- package/lib/lowcode-components/data-number/index.js +23 -5
- package/lib/lowcode-components/data-number/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 +13 -1
- 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 +13 -1
- package/lib/lowcode-components/effectScatter-map-3d/index.js.map +1 -1
- package/lib/lowcode-components/gauge-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/gauge-chart/index.js +20 -3
- package/lib/lowcode-components/gauge-chart/index.js.map +1 -1
- package/lib/lowcode-components/line-bar-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/line-bar-chart/index.js +13 -1
- package/lib/lowcode-components/line-bar-chart/index.js.map +1 -1
- package/lib/lowcode-components/line-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/line-chart/index.js +13 -1
- package/lib/lowcode-components/line-chart/index.js.map +1 -1
- package/lib/lowcode-components/liquid-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/liquid-chart/index.js +20 -3
- package/lib/lowcode-components/liquid-chart/index.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/abstract-designer-controller.d.ts +5 -5
- package/lib/lowcode-components/lowcode-view/component/abstract-designer-controller.d.ts.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/abstract-designer-controller.js +8 -19
- package/lib/lowcode-components/lowcode-view/component/abstract-designer-controller.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 +6 -5
- package/lib/lowcode-components/lowcode-view/component/component-container.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/component-controller.d.ts.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/component-controller.js +9 -3
- package/lib/lowcode-components/lowcode-view/component/component-controller.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/screen-fit/index.d.ts +0 -4
- package/lib/lowcode-components/lowcode-view/component/screen-fit/index.d.ts.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/screen-fit/index.js +7 -5
- package/lib/lowcode-components/lowcode-view/component/screen-fit/index.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/index.d.ts +1 -0
- package/lib/lowcode-components/lowcode-view/index.d.ts.map +1 -1
- package/lib/lowcode-components/lowcode-view/index.js +54 -11
- package/lib/lowcode-components/lowcode-view/index.js.map +1 -1
- package/lib/lowcode-components/pie-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/pie-chart/index.js +13 -1
- package/lib/lowcode-components/pie-chart/index.js.map +1 -1
- package/lib/lowcode-components/progress-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/progress-chart/index.js +20 -3
- package/lib/lowcode-components/progress-chart/index.js.map +1 -1
- package/lib/lowcode-components/stroke-animation/index.d.ts.map +1 -1
- package/lib/lowcode-components/stroke-animation/index.js +20 -3
- package/lib/lowcode-components/stroke-animation/index.js.map +1 -1
- package/lib/lowcode-components/text-scroller/index.d.ts.map +1 -1
- package/lib/lowcode-components/text-scroller/index.js +20 -3
- package/lib/lowcode-components/text-scroller/index.js.map +1 -1
- package/lib/table/act-table.d.ts +8 -0
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +52 -13
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/column/column-builder.d.ts.map +1 -1
- package/lib/table/column/column-builder.js +32 -8
- package/lib/table/column/column-builder.js.map +1 -1
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/table/relation-table.js +2 -0
- package/lib/table/relation-table.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +5 -0
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +17 -0
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +6 -1
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/tmpl/tmpl-config-analysis.d.ts.map +1 -1
- package/lib/tmpl/tmpl-config-analysis.js +2 -2
- package/lib/tmpl/tmpl-config-analysis.js.map +1 -1
- package/lib/tree/index.css +11 -9
- package/lib/tree/tmpl-tree.js +1 -1
- package/lib/tree/tmpl-tree.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/rfield/index.tsx +1 -1
- package/src/aldehyde/detail/button/inline-edit-button.tsx +40 -0
- package/src/aldehyde/detail/dtmpl.css +8 -1
- package/src/aldehyde/index.tsx +6 -1
- package/src/aldehyde/layout2/components/theme-button.tsx +1 -1
- package/src/aldehyde/layout2/components/user-button.tsx +23 -14
- package/src/aldehyde/layout3/components/tabs-layout.tsx +1 -1
- package/src/aldehyde/layout3/css/header.css +166 -138
- package/src/aldehyde/layout3/css/main.css +114 -16
- package/src/aldehyde/layout3/css/sider.css +7 -6
- package/src/aldehyde/layout3/css/tabs-layout.css +17 -8
- package/src/aldehyde/layout3/header.tsx +8 -6
- package/src/aldehyde/layout3/page.tsx +6 -1
- package/src/aldehyde/layout3/sider.tsx +1 -1
- package/src/aldehyde/layout4/components/tabs-layout.tsx +106 -0
- package/src/aldehyde/layout4/css/header.css +157 -0
- package/src/aldehyde/layout4/css/main.css +119 -0
- package/src/aldehyde/layout4/css/sider.css +11 -0
- package/src/aldehyde/layout4/css/tabs-layout.css +43 -0
- package/src/aldehyde/layout4/header.tsx +182 -0
- package/src/aldehyde/layout4/imgs/header-bg.png +0 -0
- package/src/aldehyde/layout4/imgs/home.png +0 -0
- package/src/aldehyde/layout4/imgs/menu-item-bg.png +0 -0
- package/src/aldehyde/layout4/imgs/user.png +0 -0
- package/src/aldehyde/layout4/imgs/user.svg +27 -0
- package/src/aldehyde/layout4/main.tsx +27 -0
- package/src/aldehyde/layout4/page.tsx +91 -0
- package/src/aldehyde/layout4/sider.tsx +178 -0
- package/src/aldehyde/lowcode-components/bar-chart/index.tsx +14 -1
- package/src/aldehyde/lowcode-components/base-map/index.tsx +14 -1
- package/src/aldehyde/lowcode-components/base-table/index.tsx +29 -12
- package/src/aldehyde/lowcode-components/capsule-bar-chart/index.tsx +14 -1
- package/src/aldehyde/lowcode-components/carousel/index.tsx +15 -1
- package/src/aldehyde/lowcode-components/circular-progress-chart/index.tsx +14 -1
- package/src/aldehyde/lowcode-components/column-3d-chart/index.tsx +14 -1
- package/src/aldehyde/lowcode-components/column-chart/index.tsx +15 -1
- package/src/aldehyde/lowcode-components/data-number/index.tsx +23 -4
- package/src/aldehyde/lowcode-components/data.d.ts +2 -0
- package/src/aldehyde/lowcode-components/effectScatter-map/index.tsx +14 -1
- package/src/aldehyde/lowcode-components/effectScatter-map-3d/index.tsx +14 -1
- package/src/aldehyde/lowcode-components/gauge-chart/index.tsx +21 -2
- package/src/aldehyde/lowcode-components/line-bar-chart/index.tsx +14 -1
- package/src/aldehyde/lowcode-components/line-chart/index.tsx +14 -1
- package/src/aldehyde/lowcode-components/liquid-chart/index.tsx +21 -2
- package/src/aldehyde/lowcode-components/lowcode-view/component/abstract-designer-controller.ts +8 -15
- package/src/aldehyde/lowcode-components/lowcode-view/component/component-container.tsx +7 -6
- package/src/aldehyde/lowcode-components/lowcode-view/component/component-controller.ts +10 -4
- package/src/aldehyde/lowcode-components/lowcode-view/component/screen-fit/index.tsx +7 -10
- package/src/aldehyde/lowcode-components/lowcode-view/index.tsx +56 -22
- package/src/aldehyde/lowcode-components/pie-chart/index.tsx +14 -1
- package/src/aldehyde/lowcode-components/progress-chart/index.tsx +21 -2
- package/src/aldehyde/lowcode-components/stroke-animation/index.tsx +21 -2
- package/src/aldehyde/lowcode-components/text-scroller/index.tsx +21 -2
- package/src/aldehyde/table/act-table.tsx +275 -229
- package/src/aldehyde/table/column/column-builder.tsx +550 -505
- package/src/aldehyde/table/relation-table.tsx +1 -0
- package/src/aldehyde/tmpl/hcservice-v3.tsx +29 -0
- package/src/aldehyde/tmpl/interface.tsx +6 -1
- package/src/aldehyde/tmpl/tmpl-config-analysis.tsx +6 -6
- package/src/aldehyde/tree/index.css +11 -9
- package/src/aldehyde/tree/tmpl-tree.tsx +1 -1
|
@@ -11,17 +11,14 @@ interface ScreenFitProps {
|
|
|
11
11
|
delay?: number,
|
|
12
12
|
mode?: AdaptationType,
|
|
13
13
|
scaleChange?: (xScale: number, yScale: number) => void,
|
|
14
|
-
containerStyle: {
|
|
15
|
-
width: number,
|
|
16
|
-
height: number,
|
|
17
|
-
},
|
|
18
14
|
}
|
|
19
15
|
|
|
20
16
|
|
|
21
17
|
export default function ScreenFit(props: ScreenFitProps) {
|
|
22
|
-
const { width, height, bodyOverflowHidden = true, delay =
|
|
18
|
+
const { width, height, bodyOverflowHidden = true, delay = 200, scaleChange } = props
|
|
23
19
|
let bodyOverflow: string
|
|
24
|
-
const elRef = useRef<HTMLDivElement>(null)
|
|
20
|
+
const elRef = useRef<HTMLDivElement>(null);
|
|
21
|
+
const canvasRef = useRef(null);
|
|
25
22
|
const [size, setSize] = useState({ width, height, originalHeight: 0, originalWidth: 0 })
|
|
26
23
|
|
|
27
24
|
let observer: MutationObserver;
|
|
@@ -38,8 +35,8 @@ export default function ScreenFit(props: ScreenFitProps) {
|
|
|
38
35
|
|
|
39
36
|
function updateScale() {
|
|
40
37
|
// 获取真实视口尺寸
|
|
41
|
-
const currentWidth =
|
|
42
|
-
const currentHeight =
|
|
38
|
+
const currentWidth = canvasRef.current?.clientWidth || 0;
|
|
39
|
+
const currentHeight = canvasRef.current?.clientHeight || 0;
|
|
43
40
|
// 获取大屏最终的宽高
|
|
44
41
|
const realWidth = size.width || size.originalWidth;
|
|
45
42
|
const realHeight = size.height || size.originalHeight;
|
|
@@ -76,7 +73,7 @@ export default function ScreenFit(props: ScreenFitProps) {
|
|
|
76
73
|
}
|
|
77
74
|
|
|
78
75
|
const onResize = debounce(() => {
|
|
79
|
-
if (!elRef.current) return;
|
|
76
|
+
if (!elRef.current && !canvasRef.current) return;
|
|
80
77
|
updateSize();
|
|
81
78
|
updateScale();
|
|
82
79
|
}, delay)
|
|
@@ -113,7 +110,7 @@ export default function ScreenFit(props: ScreenFitProps) {
|
|
|
113
110
|
}, [])
|
|
114
111
|
|
|
115
112
|
return (
|
|
116
|
-
<div className={'react-screen-box'}>
|
|
113
|
+
<div ref={canvasRef} className={'react-screen-box'}>
|
|
117
114
|
<div className={'screen-wrapper'} ref={elRef}>
|
|
118
115
|
{props.children}
|
|
119
116
|
</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React, { CSSProperties, useEffect, useState,
|
|
1
|
+
import React, { CSSProperties, useEffect, useState, createContext } from 'react'
|
|
2
2
|
import { useParams } from 'react-router-dom';
|
|
3
3
|
import isEqual from "lodash/isEqual";
|
|
4
|
+
import chunk from "lodash/chunk";
|
|
4
5
|
import Loading from "./component/loading";
|
|
5
6
|
import layerBuilder from "./component/layer-builder";
|
|
6
7
|
import './component/font/FontGlobal.css';
|
|
@@ -11,6 +12,8 @@ import abstractDesignerLoader from "./component/abstract-designer-loader";
|
|
|
11
12
|
import { merge } from "./component/util";
|
|
12
13
|
import "./index.less";
|
|
13
14
|
|
|
15
|
+
export const ControllerContext = createContext(null);
|
|
16
|
+
|
|
14
17
|
const fromBase64 = (base64: string) => {
|
|
15
18
|
const binaryString = atob(base64);
|
|
16
19
|
const utf8Array = new Uint8Array(binaryString.length);
|
|
@@ -36,10 +39,10 @@ interface Props {
|
|
|
36
39
|
const LowcodeView = (props: Props) => {
|
|
37
40
|
const { isFullScreen } = props;
|
|
38
41
|
const { ddpageId } = useParams();
|
|
39
|
-
const canvasRef = useRef(null);
|
|
40
42
|
const [loading, setLoading] = useState<boolean>(false);
|
|
41
43
|
const [layerManager, setLayerManager] = useState<LayerManagerDataType>();
|
|
42
44
|
const [canvasConfig, setCanvasConfig] = useState<CanvasConfig>();
|
|
45
|
+
const [controllers, setControllers] = useState<any>({});
|
|
43
46
|
const { width, height, adaptationType, backgroundColor, backgroundImage } = canvasConfig || {};
|
|
44
47
|
|
|
45
48
|
useEffect(() => {
|
|
@@ -70,7 +73,40 @@ const LowcodeView = (props: Props) => {
|
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
setLayerManager({ ...layerManager, layerConfigs: { ...layerConfigs, ...temObj } });
|
|
73
|
-
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// 获取初始化组件数据
|
|
79
|
+
const getInitComponentData = async () => {
|
|
80
|
+
const { elemConfigs } = layerManager;
|
|
81
|
+
const dataSourceConfigs = Object.keys(elemConfigs || {}).reduce((total, next) => {
|
|
82
|
+
const item = elemConfigs[next]?.data || {};
|
|
83
|
+
if (item.sourceType === "sourceId" && item.sourceId && item.isInit) {
|
|
84
|
+
total.push({ sourceId: item.sourceId, chartCode: next });
|
|
85
|
+
}
|
|
86
|
+
return total;
|
|
87
|
+
}, []);
|
|
88
|
+
if (!dataSourceConfigs.length) return;
|
|
89
|
+
const temSourceConfigs = chunk(dataSourceConfigs, 10); // 每批处理10个组件数据
|
|
90
|
+
temSourceConfigs.forEach(i => {
|
|
91
|
+
HcserviceV3.requestCharMultitData(null, JSON.stringify(i)).then(rs => {
|
|
92
|
+
const { status, ...data } = rs;
|
|
93
|
+
if (status === "success") {
|
|
94
|
+
for (const item in data) { // 更新组件数据
|
|
95
|
+
controllers[item] && controllers[item].loadComponentData({ type: "initData", data: data[item] || {} });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
const cKeys = Object.keys(controllers);
|
|
104
|
+
const leKeys = Object.keys(layerManager?.elemConfigs || {});
|
|
105
|
+
// 判断组件实例是否加载完成(组件实例是否存在且与配置数量相等)
|
|
106
|
+
if (cKeys.length && cKeys.length === leKeys.length) {
|
|
107
|
+
getInitComponentData();
|
|
108
|
+
}
|
|
109
|
+
}, [controllers]);
|
|
74
110
|
|
|
75
111
|
useEffect(() => {
|
|
76
112
|
if (layerManager?.layerConfigs) {
|
|
@@ -92,7 +128,7 @@ const LowcodeView = (props: Props) => {
|
|
|
92
128
|
setLayerManager({});
|
|
93
129
|
setCanvasConfig({});
|
|
94
130
|
}
|
|
95
|
-
}, [ddpageId])
|
|
131
|
+
}, [ddpageId]);
|
|
96
132
|
|
|
97
133
|
const canvasDom = () => <div style={{
|
|
98
134
|
width,
|
|
@@ -108,24 +144,22 @@ const LowcodeView = (props: Props) => {
|
|
|
108
144
|
</div>;
|
|
109
145
|
|
|
110
146
|
return (
|
|
111
|
-
<
|
|
112
|
-
{
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
</div>
|
|
147
|
+
<ControllerContext.Provider value={{ setControllers }}>
|
|
148
|
+
<div className='lowcodeView' style={{ height: isFullScreen ? "100vh" : "calc(100vh - 121px)", ...screenFitStyleMap[adaptationType || "scale"] }}>
|
|
149
|
+
{loading || !layerManager ?
|
|
150
|
+
<Loading />
|
|
151
|
+
:
|
|
152
|
+
(adaptationType === 'none' ? canvasDom() :
|
|
153
|
+
<ScreenFit
|
|
154
|
+
width={width}
|
|
155
|
+
height={height}
|
|
156
|
+
mode={adaptationType}
|
|
157
|
+
>
|
|
158
|
+
{canvasDom()}
|
|
159
|
+
</ScreenFit>)
|
|
160
|
+
}
|
|
161
|
+
</div>
|
|
162
|
+
</ControllerContext.Provider>
|
|
129
163
|
);
|
|
130
164
|
};
|
|
131
165
|
|
|
@@ -147,6 +147,18 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
147
147
|
chart.current && chart.current.dispose();
|
|
148
148
|
};
|
|
149
149
|
|
|
150
|
+
// 全局初始化请求数据处理
|
|
151
|
+
const handleInitData = (val: DataConfigProps) => {
|
|
152
|
+
if (val.sourceType === "sourceId" && val.isInit && val.initData) {
|
|
153
|
+
const { config, value } = val.initData;
|
|
154
|
+
const temData = handleData(value);
|
|
155
|
+
setData(temData);
|
|
156
|
+
if (config?.requestMode === "polling") {
|
|
157
|
+
pollingIntervalRef.current = setInterval(() => { getData() }, config?.pollingInterval || 60000);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
150
162
|
useImperativeHandle(ref, () => ({
|
|
151
163
|
updateConfig: (newConfig) => {
|
|
152
164
|
const { base, style: newStyle, data: newDataConfig } = newConfig;
|
|
@@ -154,6 +166,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
154
166
|
setSize({ width: base.width, height: base.height });
|
|
155
167
|
setDataConfig(newDataConfig);
|
|
156
168
|
setRenderType(newStyle?.renderer || "svg");
|
|
169
|
+
handleInitData(newDataConfig);
|
|
157
170
|
},
|
|
158
171
|
destroy: handleDestroy,
|
|
159
172
|
}));
|
|
@@ -205,7 +218,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
205
218
|
* 1、编辑态不请求数据
|
|
206
219
|
*/
|
|
207
220
|
useEffect(() => {
|
|
208
|
-
if (!isDesignMode && dataConfig?.sourceType === 'sourceId' && dataConfig?.sourceId) {
|
|
221
|
+
if (!isDesignMode && dataConfig?.sourceType === 'sourceId' && dataConfig?.sourceId && !dataConfig?.isInit) {
|
|
209
222
|
getInitData();
|
|
210
223
|
} else if (dataConfig?.sourceType === 'sourceId') {
|
|
211
224
|
setData([]);
|
|
@@ -71,6 +71,12 @@ const defOption = {
|
|
|
71
71
|
]
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
+
// 处理数据格式
|
|
75
|
+
const handleData = (data: { config: { [key: string]: string }, value: { [key: string]: any }[] }[]) => {
|
|
76
|
+
const temData = data?.[0]?.value?.[0]?.v1 || 0;
|
|
77
|
+
return temData;
|
|
78
|
+
}
|
|
79
|
+
|
|
74
80
|
export interface ComponentStyle {
|
|
75
81
|
title?: { [key: string]: any };
|
|
76
82
|
barWidth?: number;
|
|
@@ -114,6 +120,18 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
114
120
|
chart.current && chart.current.dispose();
|
|
115
121
|
};
|
|
116
122
|
|
|
123
|
+
// 全局初始化请求数据处理
|
|
124
|
+
const handleInitData = (val: DataConfigProps) => {
|
|
125
|
+
if (val.sourceType === "sourceId" && val.isInit && val.initData) {
|
|
126
|
+
const { config, value } = val.initData;
|
|
127
|
+
const temData = handleData(value);
|
|
128
|
+
setData(temData);
|
|
129
|
+
if (config?.requestMode === "polling") {
|
|
130
|
+
pollingIntervalRef.current = setInterval(() => { getData() }, config?.pollingInterval || 60000);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
117
135
|
useImperativeHandle(ref, () => ({
|
|
118
136
|
updateConfig: (newConfig) => {
|
|
119
137
|
const { base, style: newStyle, data: newDataConfig } = newConfig;
|
|
@@ -121,6 +139,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
121
139
|
setSize({ width: base.width, height: base.height });
|
|
122
140
|
setDataConfig(newDataConfig);
|
|
123
141
|
setRenderType(newStyle?.renderer || "svg");
|
|
142
|
+
handleInitData(newDataConfig);
|
|
124
143
|
},
|
|
125
144
|
destroy: handleDestroy,
|
|
126
145
|
}));
|
|
@@ -146,7 +165,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
146
165
|
const getData = async () => {
|
|
147
166
|
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId) || {};
|
|
148
167
|
const { config, value } = data || {};
|
|
149
|
-
const temData = value
|
|
168
|
+
const temData = handleData(value);
|
|
150
169
|
setData(temData);
|
|
151
170
|
return config;
|
|
152
171
|
};
|
|
@@ -173,7 +192,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
173
192
|
* 1、编辑态不请求数据
|
|
174
193
|
*/
|
|
175
194
|
useEffect(() => {
|
|
176
|
-
if (!isDesignMode && dataConfig?.sourceType === 'sourceId' && dataConfig?.sourceId) {
|
|
195
|
+
if (!isDesignMode && dataConfig?.sourceType === 'sourceId' && dataConfig?.sourceId && !dataConfig?.isInit) {
|
|
177
196
|
getInitData();
|
|
178
197
|
} else if (dataConfig?.sourceType === 'sourceId') {
|
|
179
198
|
setData(0);
|
|
@@ -4,6 +4,12 @@ import _ from 'lodash';
|
|
|
4
4
|
import HydrocarbonService from "../../tmpl/hcservice-v3";
|
|
5
5
|
import { DataConfigProps } from "../data";
|
|
6
6
|
|
|
7
|
+
// 处理数据格式
|
|
8
|
+
const handleData = (data: { config: { [key: string]: string }, value: { [key: string]: any }[] }[]) => {
|
|
9
|
+
const temData = data?.[0]?.value?.[0]?.v1;
|
|
10
|
+
return temData;
|
|
11
|
+
}
|
|
12
|
+
|
|
7
13
|
export interface ComponentStyle {
|
|
8
14
|
fontSize?: number;
|
|
9
15
|
fontWeight?: number;
|
|
@@ -42,12 +48,25 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
42
48
|
chart.current && chart.current.dispose();
|
|
43
49
|
};
|
|
44
50
|
|
|
51
|
+
// 全局初始化请求数据处理
|
|
52
|
+
const handleInitData = (val: DataConfigProps) => {
|
|
53
|
+
if (val.sourceType === "sourceId" && val.isInit && val.initData) {
|
|
54
|
+
const { config, value } = val.initData;
|
|
55
|
+
const temData = handleData(value);
|
|
56
|
+
setData(temData);
|
|
57
|
+
if (config?.requestMode === "polling") {
|
|
58
|
+
pollingIntervalRef.current = setInterval(() => { getData() }, config?.pollingInterval || 60000);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
45
63
|
useImperativeHandle(ref, () => ({
|
|
46
64
|
updateConfig: (newConfig) => {
|
|
47
65
|
const { base, style: newStyle, data: newDataConfig } = newConfig;
|
|
48
66
|
setConfig({ ...(newStyle || {}) });
|
|
49
67
|
setSize({ width: base.width, height: base.height });
|
|
50
68
|
setDataConfig(newDataConfig);
|
|
69
|
+
handleInitData(newDataConfig);
|
|
51
70
|
},
|
|
52
71
|
destroy: handleDestroy,
|
|
53
72
|
}));
|
|
@@ -69,7 +88,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
69
88
|
const getData = async () => {
|
|
70
89
|
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId) || {};
|
|
71
90
|
const { config, value } = data || {};
|
|
72
|
-
const temData = value
|
|
91
|
+
const temData = handleData(value);
|
|
73
92
|
setData(temData);
|
|
74
93
|
return config;
|
|
75
94
|
};
|
|
@@ -96,7 +115,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
96
115
|
* 1、编辑态不请求数据
|
|
97
116
|
*/
|
|
98
117
|
useEffect(() => {
|
|
99
|
-
if (!isDesignMode && dataConfig?.sourceType === 'sourceId' && dataConfig?.sourceId) {
|
|
118
|
+
if (!isDesignMode && dataConfig?.sourceType === 'sourceId' && dataConfig?.sourceId && !dataConfig?.isInit) {
|
|
100
119
|
getInitData();
|
|
101
120
|
} else if (dataConfig?.sourceType === 'sourceId') {
|
|
102
121
|
setData("关键帧描边动画");
|
|
@@ -4,6 +4,12 @@ import _ from "lodash";
|
|
|
4
4
|
import HydrocarbonService from "../../tmpl/hcservice-v3";
|
|
5
5
|
import { DataConfigProps } from "../data";
|
|
6
6
|
|
|
7
|
+
// 处理数据格式
|
|
8
|
+
const handleData = (data: { config: { [key: string]: string }, value: { [key: string]: any }[] }[]) => {
|
|
9
|
+
const temData = data?.[0]?.value?.[0]?.v1;
|
|
10
|
+
return temData;
|
|
11
|
+
}
|
|
12
|
+
|
|
7
13
|
export interface ComponentStyle {
|
|
8
14
|
speed?: number;
|
|
9
15
|
fontSize?: number;
|
|
@@ -40,12 +46,25 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
40
46
|
pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
|
|
41
47
|
};
|
|
42
48
|
|
|
49
|
+
// 全局初始化请求数据处理
|
|
50
|
+
const handleInitData = (val: DataConfigProps) => {
|
|
51
|
+
if (val.sourceType === "sourceId" && val.isInit && val.initData) {
|
|
52
|
+
const { config, value } = val.initData;
|
|
53
|
+
const temData = handleData(value);
|
|
54
|
+
setData(temData);
|
|
55
|
+
if (config?.requestMode === "polling") {
|
|
56
|
+
pollingIntervalRef.current = setInterval(() => { getData() }, config?.pollingInterval || 60000);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
43
61
|
useImperativeHandle(ref, () => ({
|
|
44
62
|
updateConfig: (newConfig) => {
|
|
45
63
|
const { style: newStyle, data: newDataConfig } = newConfig;
|
|
46
64
|
setConfig({ ...(newStyle || {}) });
|
|
47
65
|
setSpeed(newStyle?.speed || 5);
|
|
48
66
|
setDataConfig({ ...newDataConfig });
|
|
67
|
+
handleInitData(newDataConfig);
|
|
49
68
|
},
|
|
50
69
|
destroy: handleDestroy,
|
|
51
70
|
}));
|
|
@@ -76,7 +95,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
76
95
|
const getData = async () => {
|
|
77
96
|
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId) || {};
|
|
78
97
|
const { config, value } = data || {};
|
|
79
|
-
const temData = value
|
|
98
|
+
const temData = handleData(value);
|
|
80
99
|
setData(temData);
|
|
81
100
|
return config;
|
|
82
101
|
};
|
|
@@ -103,7 +122,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
103
122
|
* 1、编辑态不请求数据
|
|
104
123
|
*/
|
|
105
124
|
useEffect(() => {
|
|
106
|
-
if (!isDesignMode && dataConfig?.sourceType === 'sourceId' && dataConfig?.sourceId) {
|
|
125
|
+
if (!isDesignMode && dataConfig?.sourceType === 'sourceId' && dataConfig?.sourceId && !dataConfig?.isInit) {
|
|
107
126
|
getInitData();
|
|
108
127
|
} else if (dataConfig?.sourceType === 'sourceId') {
|
|
109
128
|
setData("文本跑马灯");
|