aldehyde 0.2.296 → 0.2.299
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.map +1 -1
- package/lib/controls/action/index.js +1 -1
- package/lib/controls/action/index.js.map +1 -1
- package/lib/controls/action/utils.d.ts.map +1 -1
- package/lib/controls/action/utils.js +1 -1
- package/lib/controls/action/utils.js.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/fields-edit-card.js +4 -3
- package/lib/detail/edit/fields-edit-card.js.map +1 -1
- package/lib/detail/edit/{row-edit-card.d.ts → popover-edit-card.d.ts} +2 -2
- package/lib/detail/edit/popover-edit-card.d.ts.map +1 -0
- package/lib/detail/edit/{row-edit-card.js → popover-edit-card.js} +5 -5
- package/lib/detail/edit/popover-edit-card.js.map +1 -0
- package/lib/detail/edit/{row-editor.d.ts → popover-editor.d.ts} +2 -2
- package/lib/detail/edit/popover-editor.d.ts.map +1 -0
- package/lib/detail/edit/{row-editor.js → popover-editor.js} +6 -6
- package/lib/detail/edit/popover-editor.js.map +1 -0
- package/lib/form/criteria-form.js +1 -1
- package/lib/form/criteria-form.js.map +1 -1
- package/lib/form/fields-form.d.ts +1 -0
- package/lib/form/fields-form.d.ts.map +1 -1
- package/lib/form/fields-form.js +2 -2
- package/lib/form/fields-form.js.map +1 -1
- package/lib/layout/menu/user-bar.d.ts.map +1 -1
- package/lib/layout/menu/user-bar.js +2 -1
- package/lib/layout/menu/user-bar.js.map +1 -1
- package/lib/layout2/components/user-button.d.ts.map +1 -1
- package/lib/layout2/components/user-button.js +2 -1
- package/lib/layout2/components/user-button.js.map +1 -1
- package/lib/lowcode-components/assets/china.json +1 -1
- package/lib/lowcode-components/column-3d-chart/index.d.ts +43 -0
- package/lib/lowcode-components/column-3d-chart/index.d.ts.map +1 -0
- package/lib/lowcode-components/column-3d-chart/index.js +342 -0
- package/lib/lowcode-components/column-3d-chart/index.js.map +1 -0
- package/lib/lowcode-components/effectScatter-map-3d/index.d.ts +34 -0
- package/lib/lowcode-components/effectScatter-map-3d/index.d.ts.map +1 -0
- package/lib/lowcode-components/effectScatter-map-3d/index.js +273 -0
- package/lib/lowcode-components/effectScatter-map-3d/index.js.map +1 -0
- package/lib/lowcode-components/gauge-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/gauge-chart/index.js +19 -16
- package/lib/lowcode-components/gauge-chart/index.js.map +1 -1
- package/lib/lowcode-components/index.d.ts +8 -0
- package/lib/lowcode-components/index.d.ts.map +1 -1
- package/lib/lowcode-components/index.js +6 -1
- package/lib/lowcode-components/index.js.map +1 -1
- package/lib/lowcode-components/line-bar-chart/index.d.ts +57 -0
- package/lib/lowcode-components/line-bar-chart/index.d.ts.map +1 -0
- package/lib/lowcode-components/line-bar-chart/index.js +178 -0
- package/lib/lowcode-components/line-bar-chart/index.js.map +1 -0
- package/lib/lowcode-components/line-chart/index.d.ts +1 -0
- package/lib/lowcode-components/line-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/line-chart/index.js +5 -2
- package/lib/lowcode-components/line-chart/index.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/abstract-designer-loader.d.ts.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/abstract-designer-loader.js +3 -0
- package/lib/lowcode-components/lowcode-view/component/abstract-designer-loader.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 +32 -0
- package/lib/lowcode-components/lowcode-view/component/assets.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/group-layer/controller.d.ts +15 -0
- package/lib/lowcode-components/lowcode-view/component/group-layer/controller.d.ts.map +1 -0
- package/lib/lowcode-components/lowcode-view/component/group-layer/controller.js +36 -0
- package/lib/lowcode-components/lowcode-view/component/group-layer/controller.js.map +1 -0
- package/lib/lowcode-components/lowcode-view/component/group-layer/definition.d.ts +10 -0
- package/lib/lowcode-components/lowcode-view/component/group-layer/definition.d.ts.map +1 -0
- package/lib/lowcode-components/lowcode-view/component/group-layer/definition.js +43 -0
- package/lib/lowcode-components/lowcode-view/component/group-layer/definition.js.map +1 -0
- package/lib/lowcode-components/lowcode-view/component/group-layer/index.d.ts +11 -0
- package/lib/lowcode-components/lowcode-view/component/group-layer/index.d.ts.map +1 -0
- package/lib/lowcode-components/lowcode-view/component/group-layer/index.js +14 -0
- package/lib/lowcode-components/lowcode-view/component/group-layer/index.js.map +1 -0
- package/lib/lowcode-components/lowcode-view/component/layer-builder.d.ts.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/layer-builder.js +10 -1
- package/lib/lowcode-components/lowcode-view/component/layer-builder.js.map +1 -1
- package/lib/lowcode-components/pie-chart/index.d.ts +1 -0
- package/lib/lowcode-components/pie-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/pie-chart/index.js +6 -2
- package/lib/lowcode-components/pie-chart/index.js.map +1 -1
- package/lib/lowcode-components/stroke-animation/index.d.ts +27 -0
- package/lib/lowcode-components/stroke-animation/index.d.ts.map +1 -0
- package/lib/lowcode-components/stroke-animation/index.js +144 -0
- package/lib/lowcode-components/stroke-animation/index.js.map +1 -0
- package/lib/module/dtmpl-edit-page.d.ts.map +1 -1
- package/lib/module/dtmpl-edit-page.js +1 -1
- package/lib/module/dtmpl-edit-page.js.map +1 -1
- package/lib/table/act-table.d.ts +1 -1
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +25 -6
- 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 +17 -6
- package/lib/table/column/column-builder.js.map +1 -1
- package/lib/table/query-table.d.ts.map +1 -1
- package/lib/table/query-table.js +2 -16
- package/lib/table/query-table.js.map +1 -1
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/table/relation-table.js +11 -6
- package/lib/table/relation-table.js.map +1 -1
- package/lib/table/report-table.d.ts.map +1 -1
- package/lib/table/report-table.js +19 -6
- package/lib/table/report-table.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 +32 -1
- package/lib/units/index.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/action/index.tsx +1 -0
- package/src/aldehyde/controls/action/utils.tsx +2 -3
- package/src/aldehyde/detail/edit/fields-edit-card.tsx +5 -3
- package/src/aldehyde/detail/edit/{row-edit-card.tsx → popover-edit-card.tsx} +1 -1
- package/src/aldehyde/detail/edit/{row-editor.tsx → popover-editor.tsx} +6 -6
- package/src/aldehyde/form/criteria-form.tsx +1 -1
- package/src/aldehyde/form/fields-form.tsx +4 -3
- package/src/aldehyde/layout/menu/user-bar.tsx +2 -1
- package/src/aldehyde/layout2/components/user-button.tsx +2 -1
- package/src/aldehyde/lowcode-components/assets/china.json +1 -1
- package/src/aldehyde/lowcode-components/column-3d-chart/index.tsx +374 -0
- package/src/aldehyde/lowcode-components/effectScatter-map-3d/index.tsx +301 -0
- package/src/aldehyde/lowcode-components/gauge-chart/index.tsx +14 -2
- package/src/aldehyde/lowcode-components/index.ts +11 -2
- package/src/aldehyde/lowcode-components/line-bar-chart/index.tsx +231 -0
- package/src/aldehyde/lowcode-components/line-chart/index.tsx +9 -2
- package/src/aldehyde/lowcode-components/lowcode-view/component/abstract-designer-loader.ts +4 -1
- package/src/aldehyde/lowcode-components/lowcode-view/component/assets.ts +32 -0
- package/src/aldehyde/lowcode-components/lowcode-view/component/group-layer/controller.ts +37 -0
- package/src/aldehyde/lowcode-components/lowcode-view/component/group-layer/definition.ts +54 -0
- package/src/aldehyde/lowcode-components/lowcode-view/component/group-layer/index.tsx +16 -0
- package/src/aldehyde/lowcode-components/lowcode-view/component/layer-builder.tsx +9 -1
- package/src/aldehyde/lowcode-components/pie-chart/index.tsx +8 -1
- package/src/aldehyde/lowcode-components/stroke-animation/index.tsx +169 -0
- package/src/aldehyde/module/dtmpl-edit-page.tsx +1 -0
- package/src/aldehyde/table/act-table.tsx +25 -6
- package/src/aldehyde/table/column/column-builder.tsx +17 -11
- package/src/aldehyde/table/query-table.tsx +2 -20
- package/src/aldehyde/table/relation-table.tsx +11 -9
- package/src/aldehyde/table/report-table.tsx +17 -4
- package/src/aldehyde/units/index.tsx +21 -1
- package/lib/detail/edit/row-edit-card.d.ts.map +0 -1
- package/lib/detail/edit/row-edit-card.js.map +0 -1
- package/lib/detail/edit/row-editor.d.ts.map +0 -1
- package/lib/detail/edit/row-editor.js.map +0 -1
|
@@ -43,6 +43,10 @@ import CapsuleBarChart from "./capsule-bar-chart";
|
|
|
43
43
|
import CircularProgressChart from "./circular-progress-chart";
|
|
44
44
|
import ActTable from "./act-table";
|
|
45
45
|
import ProgressChart from "./progress-chart";
|
|
46
|
+
import LineBarChart from "./line-bar-chart";
|
|
47
|
+
import Column3dChart from "./column-3d-chart";
|
|
48
|
+
import StrokeAnimation from "./stroke-animation";
|
|
49
|
+
import EffectScatterMap3D from "./effectScatter-map-3d";
|
|
46
50
|
|
|
47
51
|
|
|
48
52
|
type CompoundedComponent = {
|
|
@@ -90,7 +94,11 @@ type CompoundedComponent = {
|
|
|
90
94
|
CircularProgressChart?: typeof CircularProgressChart;
|
|
91
95
|
ActTable?: typeof ActTable,
|
|
92
96
|
ProgressChart?: typeof ProgressChart,
|
|
93
|
-
BaseMap?: typeof BaseMap
|
|
97
|
+
BaseMap?: typeof BaseMap,
|
|
98
|
+
LineBarChart?: typeof LineBarChart,
|
|
99
|
+
Column3dChart?: typeof Column3dChart,
|
|
100
|
+
StrokeAnimation?: typeof StrokeAnimation,
|
|
101
|
+
EffectScatterMap3D?: typeof EffectScatterMap3D
|
|
94
102
|
};
|
|
95
103
|
|
|
96
104
|
const LowcodeComponents: CompoundedComponent = {
|
|
@@ -101,7 +109,8 @@ const LowcodeComponents: CompoundedComponent = {
|
|
|
101
109
|
Border7, Border8, Border9, Border10, Border11, Border12, Border13,
|
|
102
110
|
Decoration1, Decoration2, Decoration3, Decoration4, Decoration5,
|
|
103
111
|
Decoration6, Decoration7, Decoration8, Decoration9, Decoration10, Decoration11,
|
|
104
|
-
BaseTable, TextScroller, CapsuleBarChart, CircularProgressChart, ActTable, ProgressChart
|
|
112
|
+
BaseTable, TextScroller, CapsuleBarChart, CircularProgressChart, ActTable, ProgressChart,
|
|
113
|
+
LineBarChart, Column3dChart, StrokeAnimation, EffectScatterMap3D
|
|
105
114
|
};
|
|
106
115
|
|
|
107
116
|
export default LowcodeComponents;
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import * as echarts from 'echarts';
|
|
2
|
+
import React, { useEffect, useRef, useState, ForwardedRef, forwardRef, useImperativeHandle } from 'react';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
import HydrocarbonService from "../../tmpl/hcservice-v3";
|
|
5
|
+
import { DataConfigProps } from "../data";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const defOption = {
|
|
9
|
+
title: {
|
|
10
|
+
text: '暂无数据',
|
|
11
|
+
left: 'center',
|
|
12
|
+
top: 'middle',
|
|
13
|
+
show: false, // 无数据时显示
|
|
14
|
+
},
|
|
15
|
+
tooltip: { trigger: "axis" },
|
|
16
|
+
grid: { top: 30, let: 30, right: 20, bottom: 30 },
|
|
17
|
+
xAxis: {
|
|
18
|
+
type: 'category',
|
|
19
|
+
boundaryGap: true,
|
|
20
|
+
axisTick: { show: true },
|
|
21
|
+
},
|
|
22
|
+
yAxis: {
|
|
23
|
+
type: 'value'
|
|
24
|
+
},
|
|
25
|
+
legend: { show: false },
|
|
26
|
+
barMaxWidth: 20,
|
|
27
|
+
series: [
|
|
28
|
+
{
|
|
29
|
+
data: [["1990", 225], ["1991", 359], ["1992", 57], ["1993", 214], ["1994", 134], ["1995", 250], ["1996", 156]],
|
|
30
|
+
type: 'line',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
data: [["1990", 325], ["1991", 259], ["1992", 157], ["1993", 314], ["1994", 234], ["1995", 150], ["1996", 256]],
|
|
34
|
+
type: 'bar',
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const legends = {
|
|
40
|
+
top: { top: 0 },
|
|
41
|
+
bottom: { bottom: 0 },
|
|
42
|
+
left: { left: 5, top: "center" },
|
|
43
|
+
right: { right: 5, top: "center" },
|
|
44
|
+
leftTop: { left: 5 },
|
|
45
|
+
rightTop: { right: 5 },
|
|
46
|
+
leftBottom: { left: 5, bottom: 0 },
|
|
47
|
+
rightBottom: { right: 5, bottom: 0 },
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// 处理数据格式
|
|
51
|
+
const handleData = (data: { config: { [key: string]: string }, value: { [key: string]: any }[] }[]) => {
|
|
52
|
+
if (!data?.length) {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
const temData = data.map((r) => {
|
|
56
|
+
const { config, value } = r;
|
|
57
|
+
const vNames = Object.keys(config).filter((r) => r.startsWith("v")).sort((a, b) => parseInt(a.substring(1)) - parseInt(b.substring(1)));
|
|
58
|
+
return {
|
|
59
|
+
name: config.d1,
|
|
60
|
+
data: vNames.map((r) => ({
|
|
61
|
+
name: config[r],
|
|
62
|
+
data: value.map((v) => [v["d1"], v[r]]),
|
|
63
|
+
}))
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
return temData[0]?.data || [];
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export interface ComponentStyle {
|
|
70
|
+
tooltip?: { show: boolean };
|
|
71
|
+
color?: string[];
|
|
72
|
+
grid?: { top: number, let: number, right: number, bottom: number };
|
|
73
|
+
xAxis?: { [key: string]: any };
|
|
74
|
+
yAxis?: { [key: string]: any };
|
|
75
|
+
legend?: { [key: string]: any };
|
|
76
|
+
markPoint?: { [key: string]: any };
|
|
77
|
+
smooth?: boolean;
|
|
78
|
+
lineStyle?: { [key: string]: any };
|
|
79
|
+
symbol?: { [key: string]: any };
|
|
80
|
+
step?: boolean; // 是否为阶梯折线图
|
|
81
|
+
isArea?: boolean; // 是否面积图
|
|
82
|
+
isGradient?: boolean; // 面积图是否渐变
|
|
83
|
+
areaStyle?: { opacity: number }; // 面积图样式
|
|
84
|
+
renderer?: "canvas" | "svg";
|
|
85
|
+
barMaxWidth?: number; //柱状图最大宽度
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface ComponentProps {
|
|
89
|
+
style?: ComponentStyle;
|
|
90
|
+
base: { width: number, height: number },
|
|
91
|
+
data?: DataConfigProps;
|
|
92
|
+
isDesignMode?: boolean; // 是否编辑模式
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface ComponentRef {
|
|
96
|
+
updateConfig: (newConfig: ComponentProps) => void;
|
|
97
|
+
destroy: () => void;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>) => {
|
|
101
|
+
const { style, data: propsData, isDesignMode } = props;
|
|
102
|
+
const [config, setConfig] = useState<ComponentStyle>(style || {});
|
|
103
|
+
const [renderType, setRenderType] = useState<"canvas" | "svg">(style?.renderer || "svg"); // 渲染模式
|
|
104
|
+
const [size, setSize] = useState<{ width: number, height: number }>();
|
|
105
|
+
const [dataConfig, setDataConfig] = useState<DataConfigProps>({ ...propsData }); // 数据源配置
|
|
106
|
+
const [data, setData] = useState<{ name: string, data: any }[]>([]);
|
|
107
|
+
const chartRef = useRef<HTMLDivElement>(null);
|
|
108
|
+
const chart = useRef<any>(null);
|
|
109
|
+
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
110
|
+
|
|
111
|
+
const handleDestroy = () => {
|
|
112
|
+
pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
|
|
113
|
+
window.removeEventListener('resize', handleResize);
|
|
114
|
+
chart.current && chart.current.dispose();
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
useImperativeHandle(ref, () => ({
|
|
118
|
+
updateConfig: (newConfig) => {
|
|
119
|
+
const { base, style: newStyle, data: newDataConfig } = newConfig;
|
|
120
|
+
setConfig({ ...(newStyle || {}) });
|
|
121
|
+
setSize({ width: base.width, height: base.height });
|
|
122
|
+
setDataConfig(newDataConfig);
|
|
123
|
+
setRenderType(newStyle?.renderer || "svg");
|
|
124
|
+
},
|
|
125
|
+
destroy: handleDestroy,
|
|
126
|
+
}));
|
|
127
|
+
|
|
128
|
+
// 窗口大小变化时重新调整图表大小
|
|
129
|
+
const handleResize = () => {
|
|
130
|
+
chart.current.resize({ animation: { duration: 500 } });
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
return () => {
|
|
135
|
+
handleDestroy();
|
|
136
|
+
}
|
|
137
|
+
}, []);
|
|
138
|
+
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
handleDestroy();
|
|
141
|
+
chart.current = echarts.init(chartRef.current, null, { renderer: renderType });
|
|
142
|
+
window.addEventListener('resize', handleResize);
|
|
143
|
+
}, [renderType]);
|
|
144
|
+
|
|
145
|
+
// 请求数据
|
|
146
|
+
const getData = async () => {
|
|
147
|
+
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId) || {};
|
|
148
|
+
const { config, value } = data || {};
|
|
149
|
+
const temData = handleData(value);
|
|
150
|
+
setData(temData);
|
|
151
|
+
return config;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// 初始化请求数据
|
|
155
|
+
const getInitData = async () => {
|
|
156
|
+
pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
|
|
157
|
+
const config = await getData();
|
|
158
|
+
if (config?.requestMode === "polling") {
|
|
159
|
+
pollingIntervalRef.current = setInterval(() => { getData() }, config?.pollingInterval || 60000);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// 静态数据处理
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
if (dataConfig?.sourceType === 'staticData') {
|
|
166
|
+
setData(handleData(dataConfig.staticData));
|
|
167
|
+
}
|
|
168
|
+
}, [dataConfig?.sourceType, dataConfig?.staticData]);
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* 数据源数据请求
|
|
172
|
+
* 1、编辑态不请求数据
|
|
173
|
+
*/
|
|
174
|
+
useEffect(() => {
|
|
175
|
+
if (!isDesignMode && dataConfig?.sourceType === 'sourceId' && dataConfig?.sourceId) {
|
|
176
|
+
getInitData();
|
|
177
|
+
} else if (dataConfig?.sourceType === 'sourceId') {
|
|
178
|
+
setData([]);
|
|
179
|
+
}
|
|
180
|
+
}, [dataConfig?.sourceType, dataConfig?.sourceId]);
|
|
181
|
+
|
|
182
|
+
const renderChart = () => {
|
|
183
|
+
const { grid, legend, tooltip, color, xAxis, yAxis, smooth, lineStyle, step, isArea, isGradient, areaStyle, barMaxWidth, symbol } = config;
|
|
184
|
+
const option = _.cloneDeep(defOption);
|
|
185
|
+
// 编辑态无数据显示默认数据
|
|
186
|
+
const temData = isDesignMode && !data?.length ? option.series : data;
|
|
187
|
+
option.barMaxWidth = barMaxWidth;
|
|
188
|
+
option.grid = grid;
|
|
189
|
+
option.legend = { ...legend, ...legends[legend?.position] };
|
|
190
|
+
option.tooltip = { trigger: "axis", ...tooltip };
|
|
191
|
+
option.xAxis = { ...option.xAxis, ...xAxis, axisTick: { show: xAxis?.axisLine?.show } };
|
|
192
|
+
option.yAxis = { ...option.yAxis, ...yAxis };
|
|
193
|
+
option.title.show = !temData?.length;
|
|
194
|
+
option.series = temData.map((r, index) => (index === 0 ? {
|
|
195
|
+
type: "line",
|
|
196
|
+
...r,
|
|
197
|
+
...symbol, step, smooth,
|
|
198
|
+
itemStyle: symbol.showSymbol ? { color: color[index] } : undefined,
|
|
199
|
+
lineStyle: { ...lineStyle, color: color[index] },
|
|
200
|
+
areaStyle: isArea ? {
|
|
201
|
+
...areaStyle,
|
|
202
|
+
color: isGradient ? new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
203
|
+
{ offset: 0, color: color[index] },
|
|
204
|
+
{ offset: 1, color: 'rgba(0, 0, 0, 0)' }
|
|
205
|
+
]) : color[index]
|
|
206
|
+
} : undefined
|
|
207
|
+
} : {
|
|
208
|
+
type: "bar",
|
|
209
|
+
...r,
|
|
210
|
+
itemStyle: { color: color[index] },
|
|
211
|
+
}));
|
|
212
|
+
chart.current.setOption(option, true);
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
useEffect(() => {
|
|
216
|
+
if (config) {
|
|
217
|
+
renderChart();
|
|
218
|
+
}
|
|
219
|
+
}, [config, data]);
|
|
220
|
+
|
|
221
|
+
useEffect(() => {
|
|
222
|
+
if (size) {
|
|
223
|
+
handleResize();
|
|
224
|
+
}
|
|
225
|
+
}, [size]);
|
|
226
|
+
|
|
227
|
+
return <div ref={chartRef} style={{ width: '100%', height: '100%' }} />;
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
export default Index;
|
|
231
|
+
|
|
@@ -74,6 +74,7 @@ export interface ComponentStyle {
|
|
|
74
74
|
symbol?: { [key: string]: any };
|
|
75
75
|
step?: boolean; // 是否为阶梯折线图
|
|
76
76
|
isArea?: boolean; // 是否面积图
|
|
77
|
+
isGradient?: boolean; // 面积图是否渐变
|
|
77
78
|
areaStyle?: { opacity: number }; // 面积图样式
|
|
78
79
|
renderer?: "canvas" | "svg";
|
|
79
80
|
}
|
|
@@ -173,7 +174,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
173
174
|
}, [dataConfig?.sourceType, dataConfig?.sourceId]);
|
|
174
175
|
|
|
175
176
|
const renderChart = () => {
|
|
176
|
-
const { grid, legend, tooltip, color, xAxis, yAxis, smooth, lineStyle, step, isArea, areaStyle, symbol: { itemStyle, ...symbol } } = config;
|
|
177
|
+
const { grid, legend, tooltip, color, xAxis, yAxis, smooth, lineStyle, step, isArea, isGradient, areaStyle, symbol: { itemStyle, ...symbol } } = config;
|
|
177
178
|
const option = _.cloneDeep(defOption);
|
|
178
179
|
// 编辑态无数据显示默认数据
|
|
179
180
|
const temData = isDesignMode && !data?.length ? option.series : data;
|
|
@@ -189,7 +190,13 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
189
190
|
...symbol, step, smooth,
|
|
190
191
|
itemStyle: symbol.showSymbol ? { color: itemStyle.color[index] || color[index] } : undefined,
|
|
191
192
|
lineStyle: { ...lineStyle, color: color[index] },
|
|
192
|
-
areaStyle: isArea ? {
|
|
193
|
+
areaStyle: isArea ? {
|
|
194
|
+
...areaStyle,
|
|
195
|
+
color: isGradient ? new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
196
|
+
{ offset: 0, color: color[index] },
|
|
197
|
+
{ offset: 1, color: 'rgba(0, 0, 0, 0)' }
|
|
198
|
+
]) : color[index]
|
|
199
|
+
} : undefined
|
|
193
200
|
}));
|
|
194
201
|
chart.current.setOption(option, true);
|
|
195
202
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AbstractDefinition } from "./abstract-definition";
|
|
2
2
|
import { compsConfig } from "./assets";
|
|
3
3
|
import ComponentDefinition from "./component-definition";
|
|
4
|
+
import GroupDefinition from "./group-layer/definition";
|
|
4
5
|
|
|
5
6
|
class AbstractDesignerLoader {
|
|
6
7
|
|
|
@@ -25,7 +26,9 @@ class AbstractDesignerLoader {
|
|
|
25
26
|
if (compKey) {
|
|
26
27
|
this.definitionMap[compKey] = definition;
|
|
27
28
|
}
|
|
28
|
-
})
|
|
29
|
+
});
|
|
30
|
+
// 编组组件信息挂载
|
|
31
|
+
this.definitionMap["group"] = new GroupDefinition();
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
}
|
|
@@ -44,6 +44,10 @@ import CapsuleBarChart from "../../capsule-bar-chart";
|
|
|
44
44
|
import CircularProgressChart from "../../circular-progress-chart";
|
|
45
45
|
import ActTable from "../../act-table";
|
|
46
46
|
import ProgressChart from "../../progress-chart";
|
|
47
|
+
import LineBarChart from "../../line-bar-chart";
|
|
48
|
+
import Column3dChart from "../../column-3d-chart";
|
|
49
|
+
import StrokeAnimation from "../../stroke-animation";
|
|
50
|
+
import EffectScatterMap3D from "../../effectScatter-map-3d";
|
|
47
51
|
|
|
48
52
|
interface ComponentItemConfig {
|
|
49
53
|
baseInfo: BaseInfoType, // 基础信息
|
|
@@ -387,5 +391,33 @@ export const compsConfig: { [key: string]: ComponentItemConfig } = {
|
|
|
387
391
|
compName: "进度条",
|
|
388
392
|
compKey: "ProgressChart"
|
|
389
393
|
}
|
|
394
|
+
},
|
|
395
|
+
LineBarChart: {
|
|
396
|
+
componentNode: LineBarChart,
|
|
397
|
+
baseInfo: {
|
|
398
|
+
compName: "折柱混合图",
|
|
399
|
+
compKey: "LineBarChart"
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
Column3DChart: {
|
|
403
|
+
componentNode: Column3dChart,
|
|
404
|
+
baseInfo: {
|
|
405
|
+
compName: "立体柱状图",
|
|
406
|
+
compKey: "Column3DChart"
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
StrokeAnimation: {
|
|
410
|
+
componentNode: StrokeAnimation,
|
|
411
|
+
baseInfo: {
|
|
412
|
+
compName: "关键帧描边动画",
|
|
413
|
+
compKey: "StrokeAnimation"
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
EffectScatterMap3D: {
|
|
417
|
+
componentNode: EffectScatterMap3D,
|
|
418
|
+
baseInfo: {
|
|
419
|
+
compName: "立体散点地图",
|
|
420
|
+
compKey: "EffectScatterMap3D"
|
|
421
|
+
}
|
|
390
422
|
}
|
|
391
423
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ComponentInfoType } from "../../interface";
|
|
2
|
+
import GroupLayer from "./index";
|
|
3
|
+
import AbstractDesignerController from "../abstract-controller";
|
|
4
|
+
|
|
5
|
+
export interface GroupLayerProps {
|
|
6
|
+
base: ComponentInfoType;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default class GroupLayerController extends AbstractDesignerController<GroupLayer, GroupLayerProps> {
|
|
10
|
+
|
|
11
|
+
constructor(container: HTMLElement, config: GroupLayerProps, instance: GroupLayer) {
|
|
12
|
+
super();
|
|
13
|
+
this.container = container;
|
|
14
|
+
this.config = config;
|
|
15
|
+
this.instance = instance;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async create(container: HTMLElement, config: GroupLayerProps): Promise<void> {
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public getConfig(): GroupLayerProps | null {
|
|
22
|
+
return this.config;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public update(): void {
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public show(): void {
|
|
29
|
+
this.instance?.setState({ load: true })
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public hide(): void {
|
|
33
|
+
this.instance?.setState({ load: false })
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AbstractDefinition,
|
|
3
|
+
ActionInfo,
|
|
4
|
+
BaseInfoType
|
|
5
|
+
} from "../abstract-definition";
|
|
6
|
+
import GroupLayerController, { GroupLayerProps } from "./controller";
|
|
7
|
+
import AbstractController from "../abstract-controller";
|
|
8
|
+
|
|
9
|
+
export default class GroupLayerDefinition extends AbstractDefinition<GroupLayerController, GroupLayerProps> {
|
|
10
|
+
getBaseInfo(): BaseInfoType {
|
|
11
|
+
return {
|
|
12
|
+
compName: "",
|
|
13
|
+
compKey: "group",
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getChartImg(): string | null {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
getController() {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
getInitConfig(): GroupLayerProps {
|
|
26
|
+
return {
|
|
27
|
+
base: {
|
|
28
|
+
id: "",
|
|
29
|
+
name: '分组图层',
|
|
30
|
+
type: 'group',
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getActionList(): ActionInfo[] {
|
|
36
|
+
return [
|
|
37
|
+
{
|
|
38
|
+
name: "显示",
|
|
39
|
+
id: "show",
|
|
40
|
+
handler: (controller: AbstractController) => {
|
|
41
|
+
(controller as GroupLayerController).show();
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "隐藏",
|
|
46
|
+
id: "hide",
|
|
47
|
+
handler: (controller: AbstractController) => {
|
|
48
|
+
(controller as GroupLayerController).hide();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export interface GroupLayerStyleProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default class GroupLayer extends React.PureComponent<GroupLayerStyleProps> {
|
|
8
|
+
state = {
|
|
9
|
+
load: true
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
render() {
|
|
13
|
+
const { load } = this.state;
|
|
14
|
+
return load ? <div style={{ position: 'absolute' }}>{this.props.children}</div> : "";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -2,6 +2,7 @@ import { createElement, ReactElement } from "react";
|
|
|
2
2
|
import cloneDeep from "lodash/cloneDeep";
|
|
3
3
|
import ComponentContainer from "./component-container";
|
|
4
4
|
import { ILayerItem, LayerManagerDataType, } from "../interface";
|
|
5
|
+
import GroupLayer from "./group-layer";
|
|
5
6
|
|
|
6
7
|
export enum LayerOrder {
|
|
7
8
|
ASC,
|
|
@@ -77,12 +78,19 @@ class LayerBuilder {
|
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
private buildComponents = (layerManager: LayerManagerDataType, layer: ILayerItem): ReactElement => {
|
|
81
|
+
const { type, children } = layer;
|
|
80
82
|
const { layerConfigs } = layerManager;
|
|
81
83
|
const targetLayer = layerConfigs[layer.id!];
|
|
82
84
|
//给每个图层重新设置排序编号,用于在图层移动的过程中提供更好的体验
|
|
83
85
|
if (targetLayer)
|
|
84
86
|
targetLayer.order = this.order++;
|
|
85
|
-
|
|
87
|
+
if (type === 'group') {
|
|
88
|
+
//先生成子元素再包裹groupItem
|
|
89
|
+
const childDomArr: ReactElement[] = children?.map((item: ILayerItem) => this.buildComponents(layerManager, item));
|
|
90
|
+
return createElement(GroupLayer, { key: layer.id }, ...childDomArr);
|
|
91
|
+
} else {
|
|
92
|
+
return createElement(ComponentContainer, { layer, key: layer.id, layerManager });
|
|
93
|
+
}
|
|
86
94
|
}
|
|
87
95
|
|
|
88
96
|
}
|
|
@@ -51,6 +51,11 @@ const legends = {
|
|
|
51
51
|
rightBottom: { right: 5, bottom: 0 },
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
+
const halfConifg = {
|
|
55
|
+
startAngle: 180,
|
|
56
|
+
endAngle: 360,
|
|
57
|
+
};
|
|
58
|
+
|
|
54
59
|
// 处理数据格式
|
|
55
60
|
const handleData = (data: { config: { [key: string]: string }, value: { [key: string]: any }[] }[]) => {
|
|
56
61
|
if (!data?.length) {
|
|
@@ -79,6 +84,7 @@ export interface ComponentStyle {
|
|
|
79
84
|
center?: { x: number, y: number };
|
|
80
85
|
roseType?: string; // 玫瑰图配置
|
|
81
86
|
renderer?: "canvas" | "svg";
|
|
87
|
+
isHalf?: boolean; // 是否半扇形/环形图
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
export interface ComponentProps {
|
|
@@ -176,7 +182,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
176
182
|
}, [dataConfig?.sourceType, dataConfig?.sourceId]);
|
|
177
183
|
|
|
178
184
|
const renderChart = () => {
|
|
179
|
-
const { legend, tooltip, radius, innerRadius, color, label, labelLine, padAngle, roseType, center } = config;
|
|
185
|
+
const { legend, tooltip, radius, innerRadius, color, label, labelLine, padAngle, roseType, center, isHalf } = config;
|
|
180
186
|
const option = _.cloneDeep(defOption);
|
|
181
187
|
// 编辑态无数据显示默认数据
|
|
182
188
|
const temData = isDesignMode && !data?.length ? option.series : data;
|
|
@@ -186,6 +192,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
186
192
|
option.title.show = !temData?.length;
|
|
187
193
|
option.series = temData.map(r => ({
|
|
188
194
|
...r,
|
|
195
|
+
...(isHalf ? halfConifg : {}),
|
|
189
196
|
type: "pie",
|
|
190
197
|
radius: [`${innerRadius}%`, `${radius}%`],
|
|
191
198
|
center: [`${center?.x}%`, `${center?.y}%`],
|