lowcoder-comps 0.0.29 → 0.0.31
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/README.md +120 -0
- package/index.html +26 -0
- package/index.tsx +21 -0
- package/jest.config.js +6 -0
- package/package.json +3 -4
- package/src/__test__/allComp.test.tsx +61 -0
- package/src/app-env.d.ts +3 -0
- package/src/comps/calendarComp/calendarComp.tsx +633 -0
- package/src/comps/calendarComp/calendarConstants.tsx +1048 -0
- package/src/comps/calendarComp/errorBoundary.tsx +30 -0
- package/src/comps/chartComp/chartComp.tsx +442 -0
- package/src/comps/chartComp/chartConfigs/barChartConfig.tsx +51 -0
- package/src/comps/chartComp/chartConfigs/cartesianAxisConfig.tsx +307 -0
- package/src/comps/chartComp/chartConfigs/chartUrls.tsx +9 -0
- package/src/comps/chartComp/chartConfigs/legendConfig.tsx +55 -0
- package/src/comps/chartComp/chartConfigs/lineChartConfig.tsx +96 -0
- package/src/comps/chartComp/chartConfigs/pieChartConfig.tsx +83 -0
- package/src/comps/chartComp/chartConfigs/scatterChartConfig.tsx +62 -0
- package/src/comps/chartComp/chartConstants.tsx +299 -0
- package/src/comps/chartComp/chartPropertyView.tsx +235 -0
- package/src/comps/chartComp/chartUtils.ts +291 -0
- package/src/comps/chartComp/reactEcharts/core.tsx +194 -0
- package/src/comps/chartComp/reactEcharts/index.ts +21 -0
- package/src/comps/chartComp/reactEcharts/types.ts +76 -0
- package/src/comps/chartComp/seriesComp.tsx +119 -0
- package/src/comps/imageEditorComp/imageEditorClass.tsx +52 -0
- package/src/comps/imageEditorComp/imageEditorConstants.tsx +109 -0
- package/src/comps/imageEditorComp/index.tsx +184 -0
- package/src/comps/mermaidComp/index.tsx +44 -0
- package/src/comps/mermaidComp/mermaid.tsx +29 -0
- package/src/global.ts +1 -0
- package/src/i18n/comps/index.tsx +29 -0
- package/src/i18n/comps/locales/en.ts +163 -0
- package/src/i18n/comps/locales/enObj.tsx +198 -0
- package/src/i18n/comps/locales/index.ts +7 -0
- package/src/i18n/comps/locales/types.tsx +10 -0
- package/src/i18n/comps/locales/zh.ts +156 -0
- package/src/i18n/comps/locales/zhObj.tsx +4 -0
- package/src/index.ts +11 -0
- package/tsconfig.json +22 -0
- package/vite.config.js +10 -0
- package/2085da13.js +0 -960
- package/250691b5.js +0 -5
- package/256b619e.js +0 -92
- package/274f545c.js +0 -881
- package/289305a1.js +0 -208
- package/2eae45c2.js +0 -34
- package/2ff2c7a6.js +0 -6
- package/2ff7471d.js +0 -9
- package/335b22a2.js +0 -220
- package/38c826fe.js +0 -1127
- package/44011c1d.js +0 -818
- package/4fc06812.js +0 -64
- package/56a787cf.js +0 -915
- package/590941ff.js +0 -86
- package/6341867f.js +0 -804
- package/657fd065.js +0 -8
- package/78a5e50d.js +0 -1579
- package/820c3641.js +0 -25
- package/88b4e75a.js +0 -2967
- package/8d999722.js +0 -1102
- package/92e85b65.js +0 -65
- package/989caea2.js +0 -505
- package/99b984d1.js +0 -237
- package/9e5f02d6.js +0 -19104
- package/a40faea7.js +0 -11624
- package/abac9104.js +0 -1536
- package/af2f19b3.js +0 -819
- package/af5ee3de.js +0 -268
- package/b24707c2.js +0 -48428
- package/b68f8b69.js +0 -1276
- package/ba68ba65.js +0 -391
- package/bafb8599.js +0 -319
- package/bba60c35.js +0 -2501
- package/bd7c2a8e.js +0 -1089
- package/c71dadea.js +0 -455
- package/d05c1762.js +0 -933
- package/d073ab24.js +0 -134353
- package/d838cd10.js +0 -769
- package/dc36a6eb.js +0 -796
- package/ed143450.js +0 -1284
- package/ee8ec8f2.js +0 -2284
- package/f6755210.js +0 -1269
- package/f9637058.js +0 -16
- package/fba4c8e4.js +0 -447
- package/index.js +0 -5
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import {
|
|
2
|
+
jsonControl,
|
|
3
|
+
JSONObject,
|
|
4
|
+
stateComp,
|
|
5
|
+
toJSONObjectArray,
|
|
6
|
+
toObject,
|
|
7
|
+
BoolControl,
|
|
8
|
+
withDefault,
|
|
9
|
+
StringControl,
|
|
10
|
+
NumberControl,
|
|
11
|
+
FunctionControl,
|
|
12
|
+
dropdownControl,
|
|
13
|
+
eventHandlerControl,
|
|
14
|
+
valueComp,
|
|
15
|
+
withType,
|
|
16
|
+
ValueFromOption,
|
|
17
|
+
uiChildren,
|
|
18
|
+
clickEvent,
|
|
19
|
+
} from "lowcoder-sdk";
|
|
20
|
+
import { RecordConstructorToComp, RecordConstructorToView } from "lowcoder-core";
|
|
21
|
+
import { BarChartConfig } from "./chartConfigs/barChartConfig";
|
|
22
|
+
import { XAxisConfig, YAxisConfig } from "./chartConfigs/cartesianAxisConfig";
|
|
23
|
+
import { LegendConfig } from "./chartConfigs/legendConfig";
|
|
24
|
+
import { LineChartConfig } from "./chartConfigs/lineChartConfig";
|
|
25
|
+
import { PieChartConfig } from "./chartConfigs/pieChartConfig";
|
|
26
|
+
import { ScatterChartConfig } from "./chartConfigs/scatterChartConfig";
|
|
27
|
+
import { SeriesListComp } from "./seriesComp";
|
|
28
|
+
import { EChartsOption } from "echarts";
|
|
29
|
+
import { i18nObjs, trans } from "i18n/comps";
|
|
30
|
+
|
|
31
|
+
export const ChartTypeOptions = [
|
|
32
|
+
{
|
|
33
|
+
label: trans("chart.bar"),
|
|
34
|
+
value: "bar",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: trans("chart.line"),
|
|
38
|
+
value: "line",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
label: trans("chart.scatter"),
|
|
42
|
+
value: "scatter",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: trans("chart.pie"),
|
|
46
|
+
value: "pie",
|
|
47
|
+
},
|
|
48
|
+
] as const;
|
|
49
|
+
|
|
50
|
+
const chartModeOptions = [
|
|
51
|
+
{
|
|
52
|
+
label: trans("chart.UIMode"),
|
|
53
|
+
value: "ui",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
label: "ECharts JSON",
|
|
57
|
+
value: "json",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: "Map",
|
|
61
|
+
value: "map",
|
|
62
|
+
},
|
|
63
|
+
] as const;
|
|
64
|
+
|
|
65
|
+
export const UIEventOptions = [
|
|
66
|
+
{
|
|
67
|
+
label: trans("chart.select"),
|
|
68
|
+
value: "select",
|
|
69
|
+
description: trans("chart.selectDesc"),
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
label: trans("chart.unSelect"),
|
|
73
|
+
value: "unselect",
|
|
74
|
+
description: trans("chart.unselectDesc"),
|
|
75
|
+
},
|
|
76
|
+
] as const;
|
|
77
|
+
|
|
78
|
+
export const MapEventOptions = [
|
|
79
|
+
{
|
|
80
|
+
label: trans("chart.mapReady"),
|
|
81
|
+
value: "mapReady",
|
|
82
|
+
description: trans("chart.mapReadyDesc"),
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
label: trans("chart.zoomLevelChange"),
|
|
86
|
+
value: "zoomLevelChange",
|
|
87
|
+
description: trans("chart.zoomLevelChangeDesc"),
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
label: trans("chart.centerPositionChange"),
|
|
91
|
+
value: "centerPositionChange",
|
|
92
|
+
description: trans("chart.centerPositionChangeDesc"),
|
|
93
|
+
},
|
|
94
|
+
] as const;
|
|
95
|
+
|
|
96
|
+
export const XAxisDirectionOptions = [
|
|
97
|
+
{
|
|
98
|
+
label: trans("chart.horizontal"),
|
|
99
|
+
value: "horizontal",
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
label: trans("chart.vertical"),
|
|
103
|
+
value: "vertical",
|
|
104
|
+
},
|
|
105
|
+
] as const;
|
|
106
|
+
|
|
107
|
+
export type XAxisDirectionType = ValueFromOption<typeof XAxisDirectionOptions>;
|
|
108
|
+
|
|
109
|
+
export const noDataAxisConfig = {
|
|
110
|
+
animation: false,
|
|
111
|
+
xAxis: {
|
|
112
|
+
type: "category",
|
|
113
|
+
name: trans("chart.noData"),
|
|
114
|
+
nameLocation: "middle",
|
|
115
|
+
data: [],
|
|
116
|
+
axisLine: {
|
|
117
|
+
lineStyle: {
|
|
118
|
+
color: "#8B8FA3",
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
yAxis: {
|
|
123
|
+
type: "value",
|
|
124
|
+
axisLabel: {
|
|
125
|
+
color: "#8B8FA3",
|
|
126
|
+
},
|
|
127
|
+
splitLine: {
|
|
128
|
+
lineStyle: {
|
|
129
|
+
color: "#F0F0F0",
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
tooltip: {
|
|
134
|
+
show: false,
|
|
135
|
+
},
|
|
136
|
+
series: [
|
|
137
|
+
{
|
|
138
|
+
data: [700],
|
|
139
|
+
type: "line",
|
|
140
|
+
itemStyle: {
|
|
141
|
+
opacity: 0,
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
} as EChartsOption;
|
|
146
|
+
|
|
147
|
+
export const noDataPieChartConfig = {
|
|
148
|
+
animation: false,
|
|
149
|
+
tooltip: {
|
|
150
|
+
show: false,
|
|
151
|
+
},
|
|
152
|
+
legend: {
|
|
153
|
+
formatter: trans("chart.unknown"),
|
|
154
|
+
top: "bottom",
|
|
155
|
+
selectedMode: false,
|
|
156
|
+
},
|
|
157
|
+
color: ["#B8BBCC", "#CED0D9", "#DCDEE6", "#E6E6EB"],
|
|
158
|
+
series: [
|
|
159
|
+
{
|
|
160
|
+
type: "pie",
|
|
161
|
+
radius: "35%",
|
|
162
|
+
center: ["25%", "50%"],
|
|
163
|
+
silent: true,
|
|
164
|
+
label: {
|
|
165
|
+
show: false,
|
|
166
|
+
},
|
|
167
|
+
data: [
|
|
168
|
+
{
|
|
169
|
+
name: "1",
|
|
170
|
+
value: 70,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: "2",
|
|
174
|
+
value: 68,
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: "3",
|
|
178
|
+
value: 48,
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: "4",
|
|
182
|
+
value: 40,
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
type: "pie",
|
|
188
|
+
radius: "35%",
|
|
189
|
+
center: ["75%", "50%"],
|
|
190
|
+
silent: true,
|
|
191
|
+
label: {
|
|
192
|
+
show: false,
|
|
193
|
+
},
|
|
194
|
+
data: [
|
|
195
|
+
{
|
|
196
|
+
name: "1",
|
|
197
|
+
value: 70,
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: "2",
|
|
201
|
+
value: 68,
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: "3",
|
|
205
|
+
value: 48,
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
name: "4",
|
|
209
|
+
value: 40,
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
} as EChartsOption;
|
|
215
|
+
|
|
216
|
+
export type ChartSize = { w: number; h: number };
|
|
217
|
+
|
|
218
|
+
export const getDataKeys = (data: Array<JSONObject>) => {
|
|
219
|
+
if (!data) {
|
|
220
|
+
return [];
|
|
221
|
+
}
|
|
222
|
+
const dataKeys: Array<string> = [];
|
|
223
|
+
data.slice(0, 50).forEach((d) => {
|
|
224
|
+
Object.keys(d).forEach((key) => {
|
|
225
|
+
if (!dataKeys.includes(key)) {
|
|
226
|
+
dataKeys.push(key);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
return dataKeys;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
const ChartOptionMap = {
|
|
234
|
+
bar: BarChartConfig,
|
|
235
|
+
line: LineChartConfig,
|
|
236
|
+
pie: PieChartConfig,
|
|
237
|
+
scatter: ScatterChartConfig,
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const ChartOptionComp = withType(ChartOptionMap, "bar");
|
|
241
|
+
export type CharOptionCompType = keyof typeof ChartOptionMap;
|
|
242
|
+
|
|
243
|
+
export const chartUiModeChildren = {
|
|
244
|
+
title: StringControl,
|
|
245
|
+
data: jsonControl(toJSONObjectArray, i18nObjs.defaultDataSource),
|
|
246
|
+
xAxisKey: valueComp<string>(""), // x-axis, key from data
|
|
247
|
+
xAxisDirection: dropdownControl(XAxisDirectionOptions, "horizontal"),
|
|
248
|
+
series: SeriesListComp,
|
|
249
|
+
xConfig: XAxisConfig,
|
|
250
|
+
yConfig: YAxisConfig,
|
|
251
|
+
legendConfig: LegendConfig,
|
|
252
|
+
chartConfig: ChartOptionComp,
|
|
253
|
+
onUIEvent: eventHandlerControl(UIEventOptions),
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
const chartJsonModeChildren = {
|
|
257
|
+
echartsOption: jsonControl(toObject, i18nObjs.defaultEchartsJsonOption),
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const chartMapModeChildren = {
|
|
261
|
+
mapInstance: stateComp(),
|
|
262
|
+
getMapInstance: FunctionControl,
|
|
263
|
+
mapApiKey: withDefault(StringControl, ''),
|
|
264
|
+
mapZoomLevel: withDefault(NumberControl, 3),
|
|
265
|
+
mapCenterLng: withDefault(NumberControl, 15.932644),
|
|
266
|
+
mapCenterLat: withDefault(NumberControl, 50.942063),
|
|
267
|
+
mapOptions: jsonControl(toObject, i18nObjs.defaultMapJsonOption),
|
|
268
|
+
onMapEvent: eventHandlerControl(MapEventOptions),
|
|
269
|
+
showCharts: withDefault(BoolControl, true),
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export type UIChartDataType = {
|
|
273
|
+
seriesName: string;
|
|
274
|
+
// coordinate chart
|
|
275
|
+
x?: any;
|
|
276
|
+
y?: any;
|
|
277
|
+
// pie or funnel
|
|
278
|
+
itemName?: any;
|
|
279
|
+
value?: any;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export type NonUIChartDataType = {
|
|
283
|
+
name: string;
|
|
284
|
+
value: any;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export const chartChildrenMap = {
|
|
288
|
+
mode: dropdownControl(chartModeOptions, "ui"),
|
|
289
|
+
selectedPoints: stateComp<Array<UIChartDataType>>([]),
|
|
290
|
+
lastInteractionData: stateComp<Array<UIChartDataType> | NonUIChartDataType>({}),
|
|
291
|
+
onEvent: eventHandlerControl([clickEvent] as const),
|
|
292
|
+
...chartUiModeChildren,
|
|
293
|
+
...chartJsonModeChildren,
|
|
294
|
+
...chartMapModeChildren,
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
const chartUiChildrenMap = uiChildren(chartChildrenMap);
|
|
298
|
+
export type ChartCompPropsType = RecordConstructorToView<typeof chartUiChildrenMap>;
|
|
299
|
+
export type ChartCompChildrenType = RecordConstructorToComp<typeof chartUiChildrenMap>;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { changeChildAction, CompAction } from "lowcoder-core";
|
|
2
|
+
import { ChartCompChildrenType, ChartTypeOptions, getDataKeys } from "./chartConstants";
|
|
3
|
+
import { newSeries } from "./seriesComp";
|
|
4
|
+
import {
|
|
5
|
+
CustomModal,
|
|
6
|
+
Dropdown,
|
|
7
|
+
hiddenPropertyView,
|
|
8
|
+
Option,
|
|
9
|
+
RedButton,
|
|
10
|
+
Section,
|
|
11
|
+
sectionNames,
|
|
12
|
+
controlItem,
|
|
13
|
+
} from "lowcoder-sdk";
|
|
14
|
+
import { trans } from "i18n/comps";
|
|
15
|
+
import { examplesUrl, mapExamplesUrl, mapOptionUrl, optionUrl } from "./chartConfigs/chartUrls";
|
|
16
|
+
|
|
17
|
+
export function chartPropertyView(
|
|
18
|
+
children: ChartCompChildrenType,
|
|
19
|
+
dispatch: (action: CompAction) => void
|
|
20
|
+
) {
|
|
21
|
+
const series = children.series.getView();
|
|
22
|
+
const columnOptions = getDataKeys(children.data.getView()).map((key) => ({
|
|
23
|
+
label: key,
|
|
24
|
+
value: key,
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
const uiModePropertyView = (
|
|
28
|
+
<>
|
|
29
|
+
<Section name={trans("chart.data")}>
|
|
30
|
+
{children.data.propertyView({
|
|
31
|
+
label: trans("chart.data"),
|
|
32
|
+
})}
|
|
33
|
+
<Dropdown
|
|
34
|
+
value={children.chartConfig.children.compType.getView()}
|
|
35
|
+
options={ChartTypeOptions}
|
|
36
|
+
label={trans("chart.chartType")}
|
|
37
|
+
onChange={(value) => {
|
|
38
|
+
// keep the previous value
|
|
39
|
+
if (children.chartConfig.children.comp.children.hasOwnProperty("showLabel")) {
|
|
40
|
+
children.chartConfig.dispatchChangeValueAction({
|
|
41
|
+
compType: value as any,
|
|
42
|
+
comp: {
|
|
43
|
+
showLabel: (
|
|
44
|
+
children.chartConfig.children.comp.children as any
|
|
45
|
+
).showLabel.toJsonValue(),
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
children.chartConfig.dispatchChangeValueAction({
|
|
50
|
+
compType: value,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
<Dropdown
|
|
56
|
+
value={children.xAxisKey.getView()}
|
|
57
|
+
options={columnOptions}
|
|
58
|
+
label={trans("chart.xAxis")}
|
|
59
|
+
onChange={(value) => {
|
|
60
|
+
dispatch(changeChildAction("xAxisKey", value));
|
|
61
|
+
}}
|
|
62
|
+
/>
|
|
63
|
+
<Option
|
|
64
|
+
items={series}
|
|
65
|
+
title={trans("chart.chartSeries")}
|
|
66
|
+
itemTitle={(s) => s.getView().seriesName}
|
|
67
|
+
popoverTitle={(s) => s.getView().columnName}
|
|
68
|
+
content={(s, index) => (
|
|
69
|
+
<>
|
|
70
|
+
{s.getPropertyViewWithData(columnOptions)}
|
|
71
|
+
{
|
|
72
|
+
<RedButton
|
|
73
|
+
onClick={() => {
|
|
74
|
+
CustomModal.confirm({
|
|
75
|
+
title: trans("chart.delete"),
|
|
76
|
+
content: trans("chart.confirmDelete") + `${s.getView().seriesName}?`,
|
|
77
|
+
onConfirm: () =>
|
|
78
|
+
children.series.dispatch(children.series.deleteAction(index)),
|
|
79
|
+
confirmBtnType: "delete",
|
|
80
|
+
okText: trans("chart.delete"),
|
|
81
|
+
});
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
{trans("chart.delete")}
|
|
85
|
+
</RedButton>
|
|
86
|
+
}
|
|
87
|
+
</>
|
|
88
|
+
)}
|
|
89
|
+
onAdd={() => {
|
|
90
|
+
if (columnOptions.length <= 0) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
children.series.dispatch(
|
|
94
|
+
children.series.pushAction(
|
|
95
|
+
newSeries(trans("chart.customSeries"), columnOptions[0].value)
|
|
96
|
+
)
|
|
97
|
+
);
|
|
98
|
+
}}
|
|
99
|
+
onMove={(fromIndex, toIndex) => {
|
|
100
|
+
const action = children.series.arrayMoveAction(fromIndex, toIndex);
|
|
101
|
+
children.series.dispatch(action);
|
|
102
|
+
}}
|
|
103
|
+
hide={(s) => s.getView().hide}
|
|
104
|
+
onHide={(s, hide) => s.children.hide.dispatchChangeValueAction(hide)}
|
|
105
|
+
dataIndex={(s) => s.getView().dataIndex}
|
|
106
|
+
/>
|
|
107
|
+
</Section>
|
|
108
|
+
<Section name={sectionNames.interaction}>
|
|
109
|
+
<div style={{display: 'flex', flexDirection: 'column', gap: '8px'}}>
|
|
110
|
+
{children.onUIEvent.propertyView({title: trans("chart.chartEventHandlers")})}
|
|
111
|
+
</div>
|
|
112
|
+
{/* <div style={{display: 'flex', flexDirection: 'column', gap: '8px'}}>
|
|
113
|
+
{children.onEvent.propertyView()}
|
|
114
|
+
</div> */}
|
|
115
|
+
</Section>
|
|
116
|
+
<Section name={sectionNames.layout}>
|
|
117
|
+
{children.title.propertyView({ label: trans("chart.title") })}
|
|
118
|
+
{children.chartConfig.children.compType.getView() !== "pie" && (
|
|
119
|
+
<>
|
|
120
|
+
{children.xAxisDirection.propertyView({
|
|
121
|
+
label: trans("chart.xAxisDirection"),
|
|
122
|
+
radioButton: true,
|
|
123
|
+
})}
|
|
124
|
+
{children.xConfig.getPropertyView()}
|
|
125
|
+
{children.yConfig.getPropertyView()}
|
|
126
|
+
</>
|
|
127
|
+
)}
|
|
128
|
+
{children.legendConfig.getPropertyView()}
|
|
129
|
+
{hiddenPropertyView(children)}
|
|
130
|
+
</Section>
|
|
131
|
+
<Section name={sectionNames.style}>{children.chartConfig.getPropertyView()}</Section>
|
|
132
|
+
</>
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
const jsonModePropertyView = (
|
|
136
|
+
<>
|
|
137
|
+
<Section name={trans("chart.config")}>
|
|
138
|
+
{children.echartsOption.propertyView({
|
|
139
|
+
label: trans("chart.echartsOptionLabel"),
|
|
140
|
+
styleName: "higher",
|
|
141
|
+
tooltip: (
|
|
142
|
+
<div>
|
|
143
|
+
<a href={optionUrl} target="_blank" rel="noopener noreferrer">
|
|
144
|
+
{trans("chart.echartsOptionTooltip")}
|
|
145
|
+
</a>
|
|
146
|
+
<br />
|
|
147
|
+
<a href={examplesUrl} target="_blank" rel="noopener noreferrer">
|
|
148
|
+
{trans("chart.echartsOptionExamples")}
|
|
149
|
+
</a>
|
|
150
|
+
</div>
|
|
151
|
+
),
|
|
152
|
+
})}
|
|
153
|
+
</Section>
|
|
154
|
+
<Section name={sectionNames.interaction}>
|
|
155
|
+
{children.onEvent.propertyView()}
|
|
156
|
+
</Section>
|
|
157
|
+
<Section name={sectionNames.layout}>{hiddenPropertyView(children)}</Section>
|
|
158
|
+
</>
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
const mapModePropertyView = (
|
|
162
|
+
<>
|
|
163
|
+
<Section name={'Map Configuration'}>
|
|
164
|
+
{children.mapApiKey.propertyView({
|
|
165
|
+
label: "API Key"
|
|
166
|
+
})}
|
|
167
|
+
{children.mapZoomLevel.propertyView({
|
|
168
|
+
label: "Zoom Level"
|
|
169
|
+
})}
|
|
170
|
+
{controlItem({}, (
|
|
171
|
+
<b style={{marginTop: '8px'}}>
|
|
172
|
+
{'Center Position'}
|
|
173
|
+
</b>
|
|
174
|
+
))}
|
|
175
|
+
{children.mapCenterLng.propertyView({
|
|
176
|
+
label: "Longitude"
|
|
177
|
+
})}
|
|
178
|
+
{children.mapCenterLat.propertyView({
|
|
179
|
+
label: "Latitude"
|
|
180
|
+
})}
|
|
181
|
+
{children.showCharts.propertyView({
|
|
182
|
+
label: "Show Charts"
|
|
183
|
+
})}
|
|
184
|
+
</Section>
|
|
185
|
+
<Section name={'Map Data'}>
|
|
186
|
+
{children.mapOptions.propertyView({
|
|
187
|
+
label: trans("chart.echartsOptionLabel"),
|
|
188
|
+
styleName: "higher",
|
|
189
|
+
tooltip: (
|
|
190
|
+
<div>
|
|
191
|
+
<a href={mapOptionUrl} target="_blank" rel="noopener noreferrer">
|
|
192
|
+
{trans("chart.echartsMapOptionTooltip")}
|
|
193
|
+
</a>
|
|
194
|
+
<br />
|
|
195
|
+
<a href={mapExamplesUrl} target="_blank" rel="noopener noreferrer">
|
|
196
|
+
{trans("chart.echartsMapOptionExamples")}
|
|
197
|
+
</a>
|
|
198
|
+
</div>
|
|
199
|
+
),
|
|
200
|
+
})}
|
|
201
|
+
</Section>
|
|
202
|
+
<Section name={sectionNames.interaction}>
|
|
203
|
+
<div style={{display: 'flex', flexDirection: 'column', gap: '8px'}}>
|
|
204
|
+
{children.onMapEvent.propertyView({title: trans("chart.chartEventHandlers")})}
|
|
205
|
+
</div>
|
|
206
|
+
<div style={{display: 'flex', flexDirection: 'column', gap: '8px'}}>
|
|
207
|
+
{children.onEvent.propertyView()}
|
|
208
|
+
</div>
|
|
209
|
+
</Section>
|
|
210
|
+
<Section name={sectionNames.layout}>{hiddenPropertyView(children)}</Section>
|
|
211
|
+
</>
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
const getChatConfigByMode = (mode: string) => {
|
|
215
|
+
switch(mode) {
|
|
216
|
+
case "ui":
|
|
217
|
+
return uiModePropertyView;
|
|
218
|
+
case "json":
|
|
219
|
+
return jsonModePropertyView;
|
|
220
|
+
case "map":
|
|
221
|
+
return mapModePropertyView;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return (
|
|
225
|
+
<>
|
|
226
|
+
<Section name={trans("chart.mode")}>
|
|
227
|
+
{children.mode.propertyView({
|
|
228
|
+
label: "",
|
|
229
|
+
radioButton: true,
|
|
230
|
+
})}
|
|
231
|
+
</Section>
|
|
232
|
+
{getChatConfigByMode(children.mode.getView())}
|
|
233
|
+
</>
|
|
234
|
+
);
|
|
235
|
+
}
|