aldehyde 0.2.336 → 0.2.337
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/lowcode-components/bar-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/bar-chart/index.js +13 -5
- 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 -5
- package/lib/lowcode-components/base-map/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 -5
- 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 +13 -5
- 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 +13 -5
- 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 -5
- 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 +13 -5
- 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 +13 -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 -5
- 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 -5
- 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 +13 -5
- package/lib/lowcode-components/gauge-chart/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 +2 -1
- package/lib/lowcode-components/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 -5
- 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 -5
- 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 +13 -5
- package/lib/lowcode-components/liquid-chart/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.js +2 -2
- 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 +7 -2
- package/lib/lowcode-components/lowcode-view/component/component-controller.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/index.d.ts.map +1 -1
- package/lib/lowcode-components/lowcode-view/index.js +10 -1
- 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 -5
- 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 +13 -5
- package/lib/lowcode-components/progress-chart/index.js.map +1 -1
- package/lib/lowcode-components/search-form/index.d.ts +26 -0
- package/lib/lowcode-components/search-form/index.d.ts.map +1 -0
- package/lib/lowcode-components/search-form/index.js +84 -0
- package/lib/lowcode-components/search-form/index.js.map +1 -0
- package/lib/lowcode-components/search-form/index.less +26 -0
- package/lib/lowcode-components/stroke-animation/index.d.ts.map +1 -1
- package/lib/lowcode-components/stroke-animation/index.js +13 -5
- 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 +13 -5
- package/lib/lowcode-components/text-scroller/index.js.map +1 -1
- 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 -2
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/lowcode-components/bar-chart/index.tsx +14 -5
- package/src/aldehyde/lowcode-components/base-map/index.tsx +15 -5
- package/src/aldehyde/lowcode-components/capsule-bar-chart/index.tsx +14 -5
- package/src/aldehyde/lowcode-components/carousel/index.tsx +14 -5
- package/src/aldehyde/lowcode-components/circular-progress-chart/index.tsx +14 -5
- package/src/aldehyde/lowcode-components/column-3d-chart/index.tsx +14 -5
- package/src/aldehyde/lowcode-components/column-chart/index.tsx +14 -5
- package/src/aldehyde/lowcode-components/data-number/index.tsx +14 -5
- package/src/aldehyde/lowcode-components/data.d.ts +1 -0
- package/src/aldehyde/lowcode-components/effectScatter-map/index.tsx +14 -5
- package/src/aldehyde/lowcode-components/effectScatter-map-3d/index.tsx +14 -5
- package/src/aldehyde/lowcode-components/gauge-chart/index.tsx +14 -5
- package/src/aldehyde/lowcode-components/index.ts +4 -2
- package/src/aldehyde/lowcode-components/line-bar-chart/index.tsx +14 -5
- package/src/aldehyde/lowcode-components/line-chart/index.tsx +14 -5
- package/src/aldehyde/lowcode-components/liquid-chart/index.tsx +14 -5
- package/src/aldehyde/lowcode-components/lowcode-view/component/assets.ts +8 -0
- package/src/aldehyde/lowcode-components/lowcode-view/component/component-container.tsx +3 -3
- package/src/aldehyde/lowcode-components/lowcode-view/component/component-controller.ts +5 -0
- package/src/aldehyde/lowcode-components/lowcode-view/index.tsx +11 -1
- package/src/aldehyde/lowcode-components/pie-chart/index.tsx +14 -5
- package/src/aldehyde/lowcode-components/progress-chart/index.tsx +14 -5
- package/src/aldehyde/lowcode-components/search-form/index.less +26 -0
- package/src/aldehyde/lowcode-components/search-form/index.tsx +121 -0
- package/src/aldehyde/lowcode-components/stroke-animation/index.tsx +14 -6
- package/src/aldehyde/lowcode-components/text-scroller/index.tsx +13 -5
- package/src/aldehyde/tmpl/hcservice-v3.tsx +2 -1
|
@@ -112,6 +112,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
112
112
|
const [size, setSize] = useState<{ width: number, height: number }>();
|
|
113
113
|
const [dataConfig, setDataConfig] = useState<DataConfigProps>({ ...propsData }); // 数据源配置
|
|
114
114
|
const [data, setData] = useState<{ name: string, value: number[] }[]>([]);
|
|
115
|
+
const [searchParams, setSearchParams] = useState<{ [key: string]: any }>();
|
|
115
116
|
const chartRef = useRef<HTMLDivElement>(null);
|
|
116
117
|
const chart = useRef<any>(null);
|
|
117
118
|
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
@@ -141,6 +142,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
141
142
|
setSize({ width: base.width, height: base.height });
|
|
142
143
|
setDataConfig(newDataConfig);
|
|
143
144
|
handleInitData(newDataConfig);
|
|
145
|
+
setSearchParams(newDataConfig.searchParams);
|
|
144
146
|
},
|
|
145
147
|
destroy: handleDestroy,
|
|
146
148
|
}));
|
|
@@ -160,19 +162,19 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
160
162
|
}, []);
|
|
161
163
|
|
|
162
164
|
// 请求数据
|
|
163
|
-
const getData = async () => {
|
|
164
|
-
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId) || {};
|
|
165
|
+
const getData = async (params?: object) => {
|
|
166
|
+
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
165
167
|
const { config, value } = data || {};
|
|
166
168
|
setData(handleData(value));
|
|
167
169
|
return config;
|
|
168
170
|
};
|
|
169
171
|
|
|
170
172
|
// 初始化请求数据
|
|
171
|
-
const getInitData = async () => {
|
|
173
|
+
const getInitData = async (params?: object) => {
|
|
172
174
|
pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
|
|
173
|
-
const config = await getData();
|
|
175
|
+
const config = await getData(params);
|
|
174
176
|
if (config?.requestMode === "polling") {
|
|
175
|
-
pollingIntervalRef.current = setInterval(() =>
|
|
177
|
+
pollingIntervalRef.current = setInterval(() => getData(params), config?.pollingInterval || 60000);
|
|
176
178
|
}
|
|
177
179
|
};
|
|
178
180
|
|
|
@@ -195,6 +197,13 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
195
197
|
}
|
|
196
198
|
}, [dataConfig?.sourceType, dataConfig?.sourceId]);
|
|
197
199
|
|
|
200
|
+
// 搜索参数变化时重新请求数据
|
|
201
|
+
useEffect(() => {
|
|
202
|
+
if (searchParams) {
|
|
203
|
+
getInitData(searchParams);
|
|
204
|
+
}
|
|
205
|
+
}, [searchParams]);
|
|
206
|
+
|
|
198
207
|
// 自定义弹窗渲染
|
|
199
208
|
const customizeTooltipConfig = (config) => {
|
|
200
209
|
const { title, width, height, padding, backgroundColor, backgroundImage, content } = config;
|
|
@@ -194,6 +194,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
194
194
|
const [size, setSize] = useState<{ width: number, height: number }>();
|
|
195
195
|
const [dataConfig, setDataConfig] = useState<DataConfigProps>({ ...propsData }); // 数据源配置
|
|
196
196
|
const [data, setData] = useState<{ name: string, value: number[] }[]>([]);
|
|
197
|
+
const [searchParams, setSearchParams] = useState<{ [key: string]: any }>();
|
|
197
198
|
const chartRef = useRef<HTMLDivElement>(null);
|
|
198
199
|
const chart = useRef<any>(null);
|
|
199
200
|
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
@@ -223,6 +224,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
223
224
|
setSize({ width: base.width, height: base.height });
|
|
224
225
|
setDataConfig(newDataConfig);
|
|
225
226
|
handleInitData(newDataConfig);
|
|
227
|
+
setSearchParams(newDataConfig.searchParams);
|
|
226
228
|
},
|
|
227
229
|
destroy: handleDestroy,
|
|
228
230
|
}));
|
|
@@ -256,19 +258,19 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
256
258
|
}, []);
|
|
257
259
|
|
|
258
260
|
// 请求数据
|
|
259
|
-
const getData = async () => {
|
|
260
|
-
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId) || {};
|
|
261
|
+
const getData = async (params?: object) => {
|
|
262
|
+
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
261
263
|
const { config, value } = data || {};
|
|
262
264
|
setData(handleData(value));
|
|
263
265
|
return config;
|
|
264
266
|
};
|
|
265
267
|
|
|
266
268
|
// 初始化请求数据
|
|
267
|
-
const getInitData = async () => {
|
|
269
|
+
const getInitData = async (params?: object) => {
|
|
268
270
|
pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
|
|
269
|
-
const config = await getData();
|
|
271
|
+
const config = await getData(params);
|
|
270
272
|
if (config?.requestMode === "polling") {
|
|
271
|
-
pollingIntervalRef.current = setInterval(() =>
|
|
273
|
+
pollingIntervalRef.current = setInterval(() => getData(params), config?.pollingInterval || 60000);
|
|
272
274
|
}
|
|
273
275
|
};
|
|
274
276
|
|
|
@@ -291,6 +293,13 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
291
293
|
}
|
|
292
294
|
}, [dataConfig?.sourceType, dataConfig?.sourceId]);
|
|
293
295
|
|
|
296
|
+
// 搜索参数变化时重新请求数据
|
|
297
|
+
useEffect(() => {
|
|
298
|
+
if (searchParams) {
|
|
299
|
+
getInitData(searchParams);
|
|
300
|
+
}
|
|
301
|
+
}, [searchParams]);
|
|
302
|
+
|
|
294
303
|
// 自定义弹窗渲染
|
|
295
304
|
const customizeTooltipConfig = (config) => {
|
|
296
305
|
const { title, width, height, padding, backgroundColor, backgroundImage, content } = config;
|
|
@@ -63,6 +63,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
63
63
|
const [size, setSize] = useState<{ width: number, height: number }>();
|
|
64
64
|
const [dataConfig, setDataConfig] = useState<DataConfigProps>({ ...propsData }); // 数据源配置
|
|
65
65
|
const [data, setData] = useState<number>(0);
|
|
66
|
+
const [searchParams, setSearchParams] = useState<{ [key: string]: any }>();
|
|
66
67
|
const chartRef = useRef<HTMLDivElement>(null);
|
|
67
68
|
const chart = useRef<any>(null);
|
|
68
69
|
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
@@ -93,6 +94,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
93
94
|
setDataConfig(newDataConfig);
|
|
94
95
|
setRenderType(newStyle?.renderer || "svg");
|
|
95
96
|
handleInitData(newDataConfig);
|
|
97
|
+
setSearchParams(newDataConfig.searchParams);
|
|
96
98
|
},
|
|
97
99
|
destroy: handleDestroy,
|
|
98
100
|
}));
|
|
@@ -115,8 +117,8 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
115
117
|
}, [renderType]);
|
|
116
118
|
|
|
117
119
|
// 请求数据
|
|
118
|
-
const getData = async () => {
|
|
119
|
-
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId) || {};
|
|
120
|
+
const getData = async (params?: object) => {
|
|
121
|
+
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
120
122
|
const { config, value } = data || {};
|
|
121
123
|
const temData = handleData(value);
|
|
122
124
|
setData(temData);
|
|
@@ -124,11 +126,11 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
124
126
|
};
|
|
125
127
|
|
|
126
128
|
// 初始化请求数据
|
|
127
|
-
const getInitData = async () => {
|
|
129
|
+
const getInitData = async (params?: object) => {
|
|
128
130
|
pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
|
|
129
|
-
const config = await getData();
|
|
131
|
+
const config = await getData(params);
|
|
130
132
|
if (config?.requestMode === "polling") {
|
|
131
|
-
pollingIntervalRef.current = setInterval(() =>
|
|
133
|
+
pollingIntervalRef.current = setInterval(() => getData(params), config?.pollingInterval || 60000);
|
|
132
134
|
}
|
|
133
135
|
};
|
|
134
136
|
|
|
@@ -152,6 +154,13 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
152
154
|
}
|
|
153
155
|
}, [dataConfig?.sourceType, dataConfig?.sourceId]);
|
|
154
156
|
|
|
157
|
+
// 搜索参数变化时重新请求数据
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
if (searchParams) {
|
|
160
|
+
getInitData(searchParams);
|
|
161
|
+
}
|
|
162
|
+
}, [searchParams]);
|
|
163
|
+
|
|
155
164
|
const renderChart = () => {
|
|
156
165
|
const { tooltip, radius, startAngle, endAngle, min, max, axisLine, splitLine, axisTick, axisLabel, detail, progress, center } = config;
|
|
157
166
|
const temAxisLine = { ...axisLine, lineStyle: { ...axisLine?.lineStyle, color: axisLine?.lineStyle?.color?.map(r => ([r.percentage, r.color])) } };
|
|
@@ -51,6 +51,7 @@ import BaseButton from "./base-button";
|
|
|
51
51
|
import BaseTabs from "./base-tabs";
|
|
52
52
|
import PlaceholderComponent from "./placeholder-component";
|
|
53
53
|
import Carousel from "./carousel";
|
|
54
|
+
import SearchForm from "./search-form";
|
|
54
55
|
|
|
55
56
|
|
|
56
57
|
type CompoundedComponent = {
|
|
@@ -106,7 +107,8 @@ type CompoundedComponent = {
|
|
|
106
107
|
BaseButton?: typeof BaseButton,
|
|
107
108
|
BaseTabs?: typeof BaseTabs,
|
|
108
109
|
PlaceholderComponent?: typeof PlaceholderComponent,
|
|
109
|
-
Carousel?: typeof Carousel
|
|
110
|
+
Carousel?: typeof Carousel,
|
|
111
|
+
SearchForm?: typeof SearchForm
|
|
110
112
|
};
|
|
111
113
|
|
|
112
114
|
const LowcodeComponents: CompoundedComponent = {
|
|
@@ -119,7 +121,7 @@ const LowcodeComponents: CompoundedComponent = {
|
|
|
119
121
|
Decoration6, Decoration7, Decoration8, Decoration9, Decoration10, Decoration11,
|
|
120
122
|
BaseTable, TextScroller, CapsuleBarChart, CircularProgressChart, ActTable, ProgressChart,
|
|
121
123
|
LineBarChart, Column3dChart, StrokeAnimation, EffectScatterMap3D, BaseButton, BaseTabs,
|
|
122
|
-
PlaceholderComponent, Carousel
|
|
124
|
+
PlaceholderComponent, Carousel, SearchForm
|
|
123
125
|
};
|
|
124
126
|
|
|
125
127
|
export default LowcodeComponents;
|
|
@@ -107,6 +107,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
107
107
|
const [size, setSize] = useState<{ width: number, height: number }>();
|
|
108
108
|
const [dataConfig, setDataConfig] = useState<DataConfigProps>({ ...propsData }); // 数据源配置
|
|
109
109
|
const [data, setData] = useState<{ name: string, data: any }[]>([]);
|
|
110
|
+
const [searchParams, setSearchParams] = useState<{ [key: string]: any }>();
|
|
110
111
|
const chartRef = useRef<HTMLDivElement>(null);
|
|
111
112
|
const chart = useRef<any>(null);
|
|
112
113
|
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
@@ -137,6 +138,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
137
138
|
setDataConfig(newDataConfig);
|
|
138
139
|
setRenderType(newStyle?.renderer || "svg");
|
|
139
140
|
handleInitData(newDataConfig);
|
|
141
|
+
setSearchParams(newDataConfig.searchParams);
|
|
140
142
|
},
|
|
141
143
|
destroy: handleDestroy,
|
|
142
144
|
}));
|
|
@@ -159,8 +161,8 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
159
161
|
}, [renderType]);
|
|
160
162
|
|
|
161
163
|
// 请求数据
|
|
162
|
-
const getData = async () => {
|
|
163
|
-
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId) || {};
|
|
164
|
+
const getData = async (params?: object) => {
|
|
165
|
+
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
164
166
|
const { config, value } = data || {};
|
|
165
167
|
const temData = handleData(value);
|
|
166
168
|
setData(temData);
|
|
@@ -168,11 +170,11 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
168
170
|
};
|
|
169
171
|
|
|
170
172
|
// 初始化请求数据
|
|
171
|
-
const getInitData = async () => {
|
|
173
|
+
const getInitData = async (params?: object) => {
|
|
172
174
|
pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
|
|
173
|
-
const config = await getData();
|
|
175
|
+
const config = await getData(params);
|
|
174
176
|
if (config?.requestMode === "polling") {
|
|
175
|
-
pollingIntervalRef.current = setInterval(() =>
|
|
177
|
+
pollingIntervalRef.current = setInterval(() => getData(params), config?.pollingInterval || 60000);
|
|
176
178
|
}
|
|
177
179
|
};
|
|
178
180
|
|
|
@@ -195,6 +197,13 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
195
197
|
}
|
|
196
198
|
}, [dataConfig?.sourceType, dataConfig?.sourceId]);
|
|
197
199
|
|
|
200
|
+
// 搜索参数变化时重新请求数据
|
|
201
|
+
useEffect(() => {
|
|
202
|
+
if (searchParams) {
|
|
203
|
+
getInitData(searchParams);
|
|
204
|
+
}
|
|
205
|
+
}, [searchParams]);
|
|
206
|
+
|
|
198
207
|
const renderChart = () => {
|
|
199
208
|
const { grid, legend, tooltip, color, xAxis, yAxis, smooth, lineStyle, step, isArea, isGradient, areaStyle, barMaxWidth, symbol } = config;
|
|
200
209
|
const option = _.cloneDeep(defOption);
|
|
@@ -101,6 +101,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
101
101
|
const [size, setSize] = useState<{ width: number, height: number }>();
|
|
102
102
|
const [dataConfig, setDataConfig] = useState<DataConfigProps>({ ...propsData }); // 数据源配置
|
|
103
103
|
const [data, setData] = useState<{ name: string, data: any }[]>([]);
|
|
104
|
+
const [searchParams, setSearchParams] = useState<{ [key: string]: any }>();
|
|
104
105
|
const chartRef = useRef<HTMLDivElement>(null);
|
|
105
106
|
const chart = useRef<any>(null);
|
|
106
107
|
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
@@ -131,6 +132,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
131
132
|
setDataConfig(newDataConfig);
|
|
132
133
|
setRenderType(newStyle?.renderer || "svg");
|
|
133
134
|
handleInitData(newDataConfig);
|
|
135
|
+
setSearchParams(newDataConfig.searchParams);
|
|
134
136
|
},
|
|
135
137
|
destroy: handleDestroy,
|
|
136
138
|
}));
|
|
@@ -153,8 +155,8 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
153
155
|
}, [renderType]);
|
|
154
156
|
|
|
155
157
|
// 请求数据
|
|
156
|
-
const getData = async () => {
|
|
157
|
-
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId) || {};
|
|
158
|
+
const getData = async (params?: object) => {
|
|
159
|
+
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
158
160
|
const { config, value } = data || {};
|
|
159
161
|
const temData = handleData(value);
|
|
160
162
|
setData(temData);
|
|
@@ -162,11 +164,11 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
162
164
|
};
|
|
163
165
|
|
|
164
166
|
// 初始化请求数据
|
|
165
|
-
const getInitData = async () => {
|
|
167
|
+
const getInitData = async (params?: object) => {
|
|
166
168
|
pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
|
|
167
|
-
const config = await getData();
|
|
169
|
+
const config = await getData(params);
|
|
168
170
|
if (config?.requestMode === "polling") {
|
|
169
|
-
pollingIntervalRef.current = setInterval(() =>
|
|
171
|
+
pollingIntervalRef.current = setInterval(() => getData(params), config?.pollingInterval || 60000);
|
|
170
172
|
}
|
|
171
173
|
};
|
|
172
174
|
|
|
@@ -189,6 +191,13 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
189
191
|
}
|
|
190
192
|
}, [dataConfig?.sourceType, dataConfig?.sourceId]);
|
|
191
193
|
|
|
194
|
+
// 搜索参数变化时重新请求数据
|
|
195
|
+
useEffect(() => {
|
|
196
|
+
if (searchParams) {
|
|
197
|
+
getInitData(searchParams);
|
|
198
|
+
}
|
|
199
|
+
}, [searchParams]);
|
|
200
|
+
|
|
192
201
|
const renderChart = () => {
|
|
193
202
|
const { grid, legend, tooltip, color, xAxis, yAxis, smooth, lineStyle, step, isArea, isGradient, areaStyle, symbol: { itemStyle, ...symbol } } = config;
|
|
194
203
|
const option = _.cloneDeep(defOption);
|
|
@@ -79,6 +79,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
79
79
|
const [size, setSize] = useState<{ width: number, height: number }>();
|
|
80
80
|
const [dataConfig, setDataConfig] = useState<DataConfigProps>({ ...propsData }); // 数据源配置
|
|
81
81
|
const [data, setData] = useState<number>(0);
|
|
82
|
+
const [searchParams, setSearchParams] = useState<{ [key: string]: any }>();
|
|
82
83
|
const chartRef = useRef<HTMLDivElement>(null);
|
|
83
84
|
const chart = useRef<any>(null);
|
|
84
85
|
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
@@ -109,6 +110,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
109
110
|
setDataConfig(newDataConfig);
|
|
110
111
|
setRenderType(newStyle?.renderer || "svg");
|
|
111
112
|
handleInitData(newDataConfig);
|
|
113
|
+
setSearchParams(newDataConfig.searchParams);
|
|
112
114
|
},
|
|
113
115
|
destroy: handleDestroy,
|
|
114
116
|
}));
|
|
@@ -131,8 +133,8 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
131
133
|
}, [renderType]);
|
|
132
134
|
|
|
133
135
|
// 请求数据
|
|
134
|
-
const getData = async () => {
|
|
135
|
-
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId) || {};
|
|
136
|
+
const getData = async (params?: object) => {
|
|
137
|
+
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
136
138
|
const { config, value } = data || {};
|
|
137
139
|
const temData = handleData(value);
|
|
138
140
|
setData(temData);
|
|
@@ -140,11 +142,11 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
140
142
|
};
|
|
141
143
|
|
|
142
144
|
// 初始化请求数据
|
|
143
|
-
const getInitData = async () => {
|
|
145
|
+
const getInitData = async (params?: object) => {
|
|
144
146
|
pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
|
|
145
|
-
const config = await getData();
|
|
147
|
+
const config = await getData(params);
|
|
146
148
|
if (config?.requestMode === "polling") {
|
|
147
|
-
pollingIntervalRef.current = setInterval(() =>
|
|
149
|
+
pollingIntervalRef.current = setInterval(() => getData(params), config?.pollingInterval || 60000);
|
|
148
150
|
}
|
|
149
151
|
};
|
|
150
152
|
|
|
@@ -168,6 +170,13 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
168
170
|
}
|
|
169
171
|
}, [dataConfig?.sourceType, dataConfig?.sourceId]);
|
|
170
172
|
|
|
173
|
+
// 搜索参数变化时重新请求数据
|
|
174
|
+
useEffect(() => {
|
|
175
|
+
if (searchParams) {
|
|
176
|
+
getInitData(searchParams);
|
|
177
|
+
}
|
|
178
|
+
}, [searchParams]);
|
|
179
|
+
|
|
171
180
|
const renderChart = () => {
|
|
172
181
|
const { tooltip, radius, center, shape, amplitude, dataNum, color, backgroundStyle, label } = config;
|
|
173
182
|
const option = _.cloneDeep(defOption);
|
|
@@ -52,6 +52,7 @@ import BaseButton from "../../base-button";
|
|
|
52
52
|
import BaseTabs from "../../base-tabs";
|
|
53
53
|
import PlaceholderComponent from "../../placeholder-component";
|
|
54
54
|
import Carousel from "../../carousel";
|
|
55
|
+
import SearchForm from "../../search-form";
|
|
55
56
|
|
|
56
57
|
interface ComponentItemConfig {
|
|
57
58
|
baseInfo: BaseInfoType, // 基础信息
|
|
@@ -451,5 +452,12 @@ export const compsConfig: { [key: string]: ComponentItemConfig } = {
|
|
|
451
452
|
compName: "轮播图",
|
|
452
453
|
compKey: "Carousel"
|
|
453
454
|
}
|
|
455
|
+
},
|
|
456
|
+
SearchForm: {
|
|
457
|
+
componentNode: SearchForm,
|
|
458
|
+
baseInfo: {
|
|
459
|
+
compName: "搜索表单",
|
|
460
|
+
compKey: "SearchForm"
|
|
461
|
+
}
|
|
454
462
|
}
|
|
455
463
|
};
|
|
@@ -24,7 +24,7 @@ const ComponentContainer = memo((props: ComponentContainerProps) => {
|
|
|
24
24
|
const ref = useRef(null);
|
|
25
25
|
const [compController, setCompController] = useState<{ [key: string]: AbstractDesignerController }>({});
|
|
26
26
|
const navigate = useNavigate();
|
|
27
|
-
const { setControllers } = useContext(ControllerContext);
|
|
27
|
+
const { setControllers, setSearchParams } = useContext(ControllerContext);
|
|
28
28
|
|
|
29
29
|
useEffect(() => {
|
|
30
30
|
//通过ref创建组件,并将组件实例存入Map中。后续通过Map匹配到具体实例,调用实例的对象方法进行组件的更新操作
|
|
@@ -48,11 +48,11 @@ const ComponentContainer = memo((props: ComponentContainerProps) => {
|
|
|
48
48
|
//todo 此处逻辑应该使用设计模式优化,而非写死
|
|
49
49
|
registerProxy(layer.id!, Controller);
|
|
50
50
|
setCompController(val => ({ ...val, [layer.id]: Controller }))
|
|
51
|
-
Controller.create(ref.current!, { ...config, navigate }).then(() => {
|
|
51
|
+
Controller.create(ref.current!, { ...config, navigate, setSearchParams }).then(() => {
|
|
52
52
|
//设置组件滤镜效果(todo 考虑是否应该在此处设置?)
|
|
53
53
|
Controller.updateFilter(Controller.getConfig()?.filter);
|
|
54
54
|
//存储Controller,用于后续操作(初始化更新数据)
|
|
55
|
-
setControllers(val => ({ ...val, [layer.id]: Controller }))
|
|
55
|
+
setControllers(val => ({ ...val, [layer.id]: Controller }));
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
return () => {
|
|
@@ -98,6 +98,11 @@ export class ComponentController extends AbstractDesignerController {
|
|
|
98
98
|
this.instance?.updateConfig(this.config);
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
+
if (data?.type === "searchParams") { // 组件数据搜索参数更新
|
|
102
|
+
this.config.data.searchParams = data?.searchParams;
|
|
103
|
+
this.instance?.updateConfig(this.config);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
101
106
|
// 默认组件静态数据更新
|
|
102
107
|
this.config.data.staticData = data;
|
|
103
108
|
this.instance?.updateConfig(this.config);
|
|
@@ -43,6 +43,7 @@ const LowcodeView = (props: Props) => {
|
|
|
43
43
|
const [layerManager, setLayerManager] = useState<LayerManagerDataType>();
|
|
44
44
|
const [canvasConfig, setCanvasConfig] = useState<CanvasConfig>();
|
|
45
45
|
const [controllers, setControllers] = useState<any>({});
|
|
46
|
+
const [searchParams, setSearchParams] = useState<any>({}); // 全局搜索参数,用于组件间通信
|
|
46
47
|
const { width, height, adaptationType, backgroundColor, backgroundImage } = canvasConfig || {};
|
|
47
48
|
|
|
48
49
|
useEffect(() => {
|
|
@@ -130,6 +131,15 @@ const LowcodeView = (props: Props) => {
|
|
|
130
131
|
}
|
|
131
132
|
}, [ddpageId]);
|
|
132
133
|
|
|
134
|
+
// 搜索参数变化时,更新组件数据
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
for (const key in searchParams) {
|
|
137
|
+
if (controllers[key]) {
|
|
138
|
+
controllers[key].changeData({ type: "searchParams", searchParams: searchParams[key] });
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}, [searchParams])
|
|
142
|
+
|
|
133
143
|
const canvasDom = () => <div style={{
|
|
134
144
|
width,
|
|
135
145
|
height,
|
|
@@ -144,7 +154,7 @@ const LowcodeView = (props: Props) => {
|
|
|
144
154
|
</div>;
|
|
145
155
|
|
|
146
156
|
return (
|
|
147
|
-
<ControllerContext.Provider value={{ setControllers }}>
|
|
157
|
+
<ControllerContext.Provider value={{ setControllers, setSearchParams }}>
|
|
148
158
|
<div className='lowcodeView' style={{ height: isFullScreen ? "100vh" : "calc(100vh - 121px)", ...screenFitStyleMap[adaptationType || "scale"] }}>
|
|
149
159
|
{loading || !layerManager ?
|
|
150
160
|
<Loading />
|
|
@@ -137,6 +137,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
137
137
|
const [size, setSize] = useState<{ width: number, height: number }>();
|
|
138
138
|
const [dataConfig, setDataConfig] = useState<DataConfigProps>({ ...propsData }); // 数据源配置
|
|
139
139
|
const [data, setData] = useState<{ name: string, data: any }[]>([]);
|
|
140
|
+
const [searchParams, setSearchParams] = useState<{ [key: string]: any }>();
|
|
140
141
|
const chartRef = useRef<HTMLDivElement>(null);
|
|
141
142
|
const chart = useRef<any>(null);
|
|
142
143
|
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
@@ -167,6 +168,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
167
168
|
setDataConfig(newDataConfig);
|
|
168
169
|
setRenderType(newStyle?.renderer || "svg");
|
|
169
170
|
handleInitData(newDataConfig);
|
|
171
|
+
setSearchParams(newDataConfig.searchParams);
|
|
170
172
|
},
|
|
171
173
|
destroy: handleDestroy,
|
|
172
174
|
}));
|
|
@@ -189,8 +191,8 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
189
191
|
}, [renderType]);
|
|
190
192
|
|
|
191
193
|
// 请求数据
|
|
192
|
-
const getData = async () => {
|
|
193
|
-
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId) || {};
|
|
194
|
+
const getData = async (params?: object) => {
|
|
195
|
+
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
194
196
|
const { config, value } = data || {};
|
|
195
197
|
const temData = handleData(value);
|
|
196
198
|
setData(temData);
|
|
@@ -198,11 +200,11 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
198
200
|
};
|
|
199
201
|
|
|
200
202
|
// 初始化请求数据
|
|
201
|
-
const getInitData = async () => {
|
|
203
|
+
const getInitData = async (params?: object) => {
|
|
202
204
|
pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
|
|
203
|
-
const config = await getData();
|
|
205
|
+
const config = await getData(params);
|
|
204
206
|
if (config?.requestMode === "polling") {
|
|
205
|
-
pollingIntervalRef.current = setInterval(() =>
|
|
207
|
+
pollingIntervalRef.current = setInterval(() => getData(params), config?.pollingInterval || 60000);
|
|
206
208
|
}
|
|
207
209
|
};
|
|
208
210
|
|
|
@@ -225,6 +227,13 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
225
227
|
}
|
|
226
228
|
}, [dataConfig?.sourceType, dataConfig?.sourceId]);
|
|
227
229
|
|
|
230
|
+
// 搜索参数变化时重新请求数据
|
|
231
|
+
useEffect(() => {
|
|
232
|
+
if (searchParams) {
|
|
233
|
+
getInitData(searchParams);
|
|
234
|
+
}
|
|
235
|
+
}, [searchParams]);
|
|
236
|
+
|
|
228
237
|
const legendFormatter = ({ name, formatter }) => {
|
|
229
238
|
if (!formatter || formatter === "a") {
|
|
230
239
|
return `{a|${name}}`;
|
|
@@ -110,6 +110,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
110
110
|
const [size, setSize] = useState<{ width: number, height: number }>();
|
|
111
111
|
const [dataConfig, setDataConfig] = useState<DataConfigProps>({ ...propsData }); // 数据源配置
|
|
112
112
|
const [data, setData] = useState<number>(0);
|
|
113
|
+
const [searchParams, setSearchParams] = useState<{ [key: string]: any }>();
|
|
113
114
|
const chartRef = useRef<HTMLDivElement>(null);
|
|
114
115
|
const chart = useRef<any>(null);
|
|
115
116
|
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
@@ -140,6 +141,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
140
141
|
setDataConfig(newDataConfig);
|
|
141
142
|
setRenderType(newStyle?.renderer || "svg");
|
|
142
143
|
handleInitData(newDataConfig);
|
|
144
|
+
setSearchParams(newDataConfig.searchParams);
|
|
143
145
|
},
|
|
144
146
|
destroy: handleDestroy,
|
|
145
147
|
}));
|
|
@@ -162,8 +164,8 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
162
164
|
}, [renderType]);
|
|
163
165
|
|
|
164
166
|
// 请求数据
|
|
165
|
-
const getData = async () => {
|
|
166
|
-
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId) || {};
|
|
167
|
+
const getData = async (params?: object) => {
|
|
168
|
+
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
167
169
|
const { config, value } = data || {};
|
|
168
170
|
const temData = handleData(value);
|
|
169
171
|
setData(temData);
|
|
@@ -171,11 +173,11 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
171
173
|
};
|
|
172
174
|
|
|
173
175
|
// 初始化请求数据
|
|
174
|
-
const getInitData = async () => {
|
|
176
|
+
const getInitData = async (params?: object) => {
|
|
175
177
|
pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
|
|
176
|
-
const config = await getData();
|
|
178
|
+
const config = await getData(params);
|
|
177
179
|
if (config?.requestMode === "polling") {
|
|
178
|
-
pollingIntervalRef.current = setInterval(() =>
|
|
180
|
+
pollingIntervalRef.current = setInterval(() => getData(params), config?.pollingInterval || 60000);
|
|
179
181
|
}
|
|
180
182
|
};
|
|
181
183
|
|
|
@@ -199,6 +201,13 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
199
201
|
}
|
|
200
202
|
}, [dataConfig?.sourceType, dataConfig?.sourceId]);
|
|
201
203
|
|
|
204
|
+
// 搜索参数变化时重新请求数据
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
if (searchParams) {
|
|
207
|
+
getInitData(searchParams);
|
|
208
|
+
}
|
|
209
|
+
}, [searchParams]);
|
|
210
|
+
|
|
202
211
|
const renderChart = () => {
|
|
203
212
|
const { title, max, background, barWidth, label, color } = config;
|
|
204
213
|
const option = _.cloneDeep(defOption);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.search-form-component {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
|
|
5
|
+
.search-form-card {
|
|
6
|
+
background: transparent;
|
|
7
|
+
border: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.search-form-empty {
|
|
11
|
+
color: #9a9a9a;
|
|
12
|
+
height: 100%;
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
align-items: center;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.search-form-btn {
|
|
19
|
+
background-size: 100% 100%;
|
|
20
|
+
background-repeat: no-repeat;
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
border: none;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
}
|
|
26
|
+
}
|