@cloudbase/weda-ui 0.2.16 → 0.2.17

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.
Files changed (86) hide show
  1. package/README.md +39 -170
  2. package/package.json +17 -10
  3. package/src/configs/components/chart/bar.json +711 -0
  4. package/src/configs/components/chart/line.json +666 -0
  5. package/src/configs/components/chart/pie.json +487 -0
  6. package/src/configs/components/listView.json +2 -1
  7. package/src/configs/index.js +7 -0
  8. package/src/mp/components/chart/bar/index.js +254 -0
  9. package/src/mp/components/chart/bar/index.json +6 -0
  10. package/src/mp/components/chart/bar/index.wxml +3 -0
  11. package/src/mp/components/chart/bar/index.wxss +9 -0
  12. package/src/mp/components/chart/common/config/bar.js +50 -0
  13. package/src/mp/components/chart/common/config/global.js +16 -0
  14. package/src/mp/components/chart/common/config/line.js +48 -0
  15. package/src/mp/components/chart/common/config/pie.js +36 -0
  16. package/src/mp/components/chart/common/core/eChartBar.js +262 -0
  17. package/src/mp/components/chart/common/core/eChartBase.js +371 -0
  18. package/src/mp/components/chart/common/core/eChartLine.js +228 -0
  19. package/src/mp/components/chart/common/core/eChartPie.js +166 -0
  20. package/src/mp/components/chart/common/lib/echarts.min.js +18 -0
  21. package/src/mp/components/chart/ec-canvas/ec-canvas.js +277 -0
  22. package/src/mp/components/chart/ec-canvas/ec-canvas.json +4 -0
  23. package/src/mp/components/chart/ec-canvas/ec-canvas.wxml +4 -0
  24. package/src/mp/components/chart/ec-canvas/ec-canvas.wxss +4 -0
  25. package/src/mp/components/chart/ec-canvas/wx-canvas.js +107 -0
  26. package/src/mp/components/chart/line/index.js +243 -0
  27. package/src/mp/components/chart/line/index.json +6 -0
  28. package/src/mp/components/chart/line/index.wxml +3 -0
  29. package/src/mp/components/chart/line/index.wxss +9 -0
  30. package/src/mp/components/chart/pie/index.js +178 -0
  31. package/src/mp/components/chart/pie/index.json +6 -0
  32. package/src/mp/components/chart/pie/index.wxml +4 -0
  33. package/src/mp/components/chart/pie/index.wxss +9 -0
  34. package/src/mp/components/dataView/index.json +1 -1
  35. package/src/mp/components/form/radio/index.js +5 -0
  36. package/src/mp/components/form/select/index.wxml +4 -4
  37. package/src/mp/components/form/textarea/index.wxml +6 -5
  38. package/src/mp/components/form/uploader/index.js +42 -22
  39. package/src/mp/components/form/uploader/index.wxml +15 -3
  40. package/src/mp/components/form/uploaderFile/index.js +58 -30
  41. package/src/mp/components/graphicCard/index.js +26 -28
  42. package/src/mp/components/internals/listView/arrow-right-line.svg +3 -0
  43. package/src/mp/components/internals/listView/index.js +286 -0
  44. package/src/mp/components/internals/listView/index.json +4 -0
  45. package/src/mp/components/internals/listView/index.wxml +40 -0
  46. package/src/mp/components/internals/listView/index.wxss +150 -0
  47. package/src/mp/components/internals/listView/more-line.svg +3 -0
  48. package/src/mp/components/listView/index.js +17 -24
  49. package/src/mp/components/listView/index.wxml +1 -1
  50. package/src/mp/components/navLayout/index.js +3 -3
  51. package/src/mp/index.json +3 -0
  52. package/src/mp/utils/platform.js +15 -0
  53. package/src/setupTests.js +2 -1
  54. package/src/web/components/chart/bar/index.tsx +139 -0
  55. package/src/web/components/chart/common/config/bar.js +49 -0
  56. package/src/web/components/chart/common/config/global.js +16 -0
  57. package/src/web/components/chart/common/config/line.js +50 -0
  58. package/src/web/components/chart/common/config/pie.js +37 -0
  59. package/src/web/components/chart/common/core/eChartBar.js +264 -0
  60. package/src/web/components/chart/common/core/eChartBase.ts +379 -0
  61. package/src/web/components/chart/common/core/eChartLine.js +229 -0
  62. package/src/web/components/chart/common/core/eChartPie.js +170 -0
  63. package/src/web/components/chart/common/core/type.ts +34 -0
  64. package/src/web/components/chart/common/echart.css +106 -0
  65. package/src/web/components/chart/common/echarts.ts +33 -0
  66. package/src/web/components/chart/common/useChart.tsx +69 -0
  67. package/src/web/components/chart/line/index.tsx +135 -0
  68. package/src/web/components/chart/pie/index.tsx +99 -0
  69. package/src/web/components/form/location/components/LocationH5/location.h5.jsx +3 -3
  70. package/src/web/components/form/location/components/LocationPC/location.PC.jsx +2 -2
  71. package/src/web/components/form/select/h5.tsx +3 -1
  72. package/src/web/components/form/select/time.jsx +1 -0
  73. package/src/web/components/form/uploader/uploader.h5.tsx +19 -17
  74. package/src/web/components/form/uploader/uploader.pc.tsx +13 -16
  75. package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +35 -37
  76. package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +15 -21
  77. package/src/web/components/graphicCard/index.css +1 -5
  78. package/src/web/components/graphicCard/index.tsx +4 -3
  79. package/src/web/components/index.js +5 -2
  80. package/src/web/utils/platform.js +1 -1
  81. package/src/web/utils/tcb.js +3 -15
  82. package/CHANGELOG.md +0 -240
  83. package/src/.DS_Store +0 -0
  84. package/src/configs/.DS_Store +0 -0
  85. package/src/mp/.gitignore +0 -10
  86. package/src/web/.DS_Store +0 -0
@@ -0,0 +1,170 @@
1
+ import EchartBase from './eChartBase';
2
+ import getConfig from '../config/pie';
3
+ /**
4
+ * 饼状图表
5
+ * @author loonglong
6
+ **/
7
+ class EchartPie extends EchartBase {
8
+ constructor() {
9
+ super();
10
+ const config = getConfig();
11
+ this.config = { ...this.config, ...config };
12
+ }
13
+ async setSourceData({
14
+ dataSource,
15
+ filterData,
16
+ setColor,
17
+ xField,
18
+ xStatistics,
19
+ xIsCountEmpty,
20
+ yField,
21
+ }) {
22
+ const { name = '', type = '', methodName = '' } = dataSource;
23
+ if (name !== '') {
24
+ const params = this.createWhere({
25
+ filterData,
26
+ xField,
27
+ xStatistics,
28
+ xIsCountEmpty,
29
+ yField,
30
+ });
31
+ const arrSourData = await this.getSourceData(
32
+ name,
33
+ methodName,
34
+ type,
35
+ params,
36
+ );
37
+ // 获取 x 轴数据
38
+ if (arrSourData.length >= 0) {
39
+ const numPie = arrSourData[0].YLabels.length;
40
+ if (numPie > 0) {
41
+ const arrData = [];
42
+ let i = 0;
43
+ arrSourData.forEach((itemSource) => {
44
+ const numc = setColor ? setColor.length : 0;
45
+ const strColor = numc > 0 ? { color: setColor[i % numc] } : {};
46
+ arrData.push({
47
+ value: itemSource.YLabels[0].Value,
48
+ name: itemSource.XLabel.Value,
49
+ tooltip: {},
50
+ itemStyle: strColor,
51
+ });
52
+ i = i + 1;
53
+ });
54
+ this.config.series[0].data = arrData;
55
+ }
56
+ } else {
57
+ // this.config['series'][0].data = [];
58
+ }
59
+ }
60
+ }
61
+ setChartType({ chartType }) {
62
+ this.config.series.length > 0
63
+ && this.config.series.forEach((itemSeries) => {
64
+ if (chartType === 'pie') {
65
+ itemSeries.radius = '70%';
66
+ } else {
67
+ // @ts-ignore
68
+ itemSeries.radius = ['40%', '70%'];
69
+ }
70
+ });
71
+ }
72
+
73
+ // 显示图表上的数据标签 单位,标签,小数位数,后缀
74
+ setIsSeriesShowSymbol({
75
+ isSeriesShowSymbol,
76
+ isPercent,
77
+ isUnit,
78
+ unit,
79
+ decimalDigits,
80
+ suffix
81
+ }) {
82
+ decimalDigits = decimalDigits < 0 ? 0 : decimalDigits;
83
+ let show = false;
84
+ let position = 'inner';
85
+ let formatter = null;
86
+
87
+ if (isSeriesShowSymbol || isPercent || isUnit) {
88
+ formatter = '';
89
+ }
90
+ this.config.series[0].label.show = show;
91
+ this.config.series[0].label.position = position;
92
+ if (formatter === null) {
93
+ this.config.series[0].label.normal = null;
94
+ } else {
95
+ this.config.series[0].label.normal.formatter = (objValue) => {
96
+ let reData = '';
97
+ if (isSeriesShowSymbol) { // 显示数值
98
+ reData = objValue.value;
99
+ }
100
+ if (isUnit) { // 显示单位
101
+ if (unit) {
102
+ const objNewValue = this.getValueByUnit(objValue.value, unit);
103
+ reData = `${objNewValue.toFixed(decimalDigits)}${suffix}`;
104
+ } else {
105
+ reData = `${objValue.value.toFixed(decimalDigits)}`;
106
+ }
107
+ this.config.series[0].data.forEach((itemData) => {
108
+ itemData.tooltip.formatter = (objVal) => {
109
+ const objItemData = this.getValueByUnit(objVal.value, unit);
110
+ return `${objItemData.toFixed(decimalDigits)}${suffix}`;
111
+ };
112
+ });
113
+ }
114
+ if (isPercent) { // 显示百分比
115
+ reData = `${reData}(${objValue.percent}%)`;
116
+ }
117
+ return reData;
118
+ };
119
+ }
120
+ }
121
+ async setOptions({
122
+ chartType,
123
+ isTitle,
124
+ title,
125
+ titleLocation,
126
+ dataSource,
127
+ filterData,
128
+ setColor,
129
+ xField,
130
+ xStatistics,
131
+ xIsCountEmpty,
132
+ yField,
133
+ isLegend,
134
+ legend,
135
+ legend2,
136
+ isSeriesShowSymbol,
137
+ isPercent,
138
+ isUnit,
139
+ unit,
140
+ decimalDigits,
141
+ suffix
142
+ }) {
143
+ legend = document.body.clientWidth < 1024 ? legend : legend2;
144
+ if (dataSource) {
145
+ await this.setSourceData({
146
+ dataSource,
147
+ filterData,
148
+ setColor,
149
+ xField,
150
+ xStatistics,
151
+ xIsCountEmpty,
152
+ yField,
153
+ });
154
+ }
155
+
156
+ this.setChartType({ chartType });
157
+ this.setTitle({ isTitle, title, titleLocation });
158
+ this.setLegend({ isLegend, legend });
159
+ this.setIsSeriesShowSymbol({
160
+ isSeriesShowSymbol,
161
+ isPercent,
162
+ isUnit,
163
+ unit,
164
+ decimalDigits,
165
+ suffix
166
+ });
167
+ }
168
+ }
169
+
170
+ export default EchartPie;
@@ -0,0 +1,34 @@
1
+ export interface DataSource {
2
+ name:string, // 数据源名
3
+ type:string, // 数据源类型
4
+ subType:string, // 数据源子类型
5
+ provider?:string, // 内置连接器类型
6
+ methodName:string // 数据源方法名
7
+ }
8
+ export interface ObjSource {
9
+ dataSourceName:string, // 数据源名
10
+ dataSourceType:string, // 数据源类型
11
+ dataSourceMethodName:string // 数据源方法名
12
+ }
13
+ export interface Xfield {
14
+ format:string,
15
+ type:string,
16
+ title:string,
17
+ name:string,
18
+ }
19
+ enum CountType {
20
+ 'count',
21
+ 'sum',
22
+ 'avg',
23
+ 'max',
24
+ 'min'
25
+ }
26
+ export interface YfieldOne {
27
+ key:string,
28
+ operationType:CountType,
29
+ title?:string,
30
+ }
31
+ export interface Yfield {
32
+ groupKey?:string,
33
+ numValue?:Array<YfieldOne>,
34
+ }
@@ -0,0 +1,106 @@
1
+ .weda-ui-echart .set_bottom {
2
+ padding: 4px 0;
3
+ background: #fff;
4
+ margin: 0;
5
+ }
6
+ .weda-ui-echart .pc_set_title {
7
+ height: 48px;
8
+ line-height: 48px;
9
+ font-size: 16px;
10
+ padding-left: 24px;
11
+ }
12
+ .weda-ui-echart .mobile_set_title {
13
+ height: 24px;
14
+ line-height: 24px;
15
+ font-size: 12px;
16
+ padding-left: 12px;
17
+ }
18
+ .weda-ui-echart .echart-light-box {
19
+ position: relative;
20
+ background-color: #F4F5F6;
21
+ }
22
+ .weda-ui-echart .echart-light-body {
23
+ background-color: #ffffff;
24
+ }
25
+ .weda-ui-echart .echart-dark-box {
26
+ position: relative;
27
+ background-color: #4B5D6C;
28
+ }
29
+ .weda-ui-echart .echart-dark-body {
30
+ background-color: #1D1F24;
31
+ margin: 6px;
32
+ }
33
+ .weda-ui-echart .btn-grounp {
34
+ position: absolute;
35
+ top: 60px;
36
+ left: 58px;
37
+ z-index: 999;
38
+ background: transparent;
39
+ }
40
+ .weda-ui-echart button {
41
+ text-transform: none;
42
+ }
43
+ .weda-ui-echart .ant-btn,
44
+ .weda-ui-echart .ant-btn:active,
45
+ .weda-ui-echart .ant-btn:focus {
46
+ outline: 0;
47
+ }
48
+ .weda-ui-echart .ant-btn {
49
+ margin-right: 8px;
50
+ margin-bottom: 12px;
51
+ line-height: 1.499;
52
+ display: inline-block;
53
+ font-weight: 400;
54
+ text-align: center;
55
+ touch-action: manipulation;
56
+ cursor: pointer;
57
+ background-image: none;
58
+ border: 1px solid transparent;
59
+ white-space: nowrap;
60
+ padding: 0 23px;
61
+ font-size: 14px;
62
+ border-radius: 4px;
63
+ height: 36px;
64
+ -webkit-user-select: none;
65
+ -moz-user-select: none;
66
+ -ms-user-select: none;
67
+ user-select: none;
68
+ transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
69
+ position: relative;
70
+ color: #4B5D6C;
71
+ background-color: #fff;
72
+ border-color: #CCD2D8;
73
+ }
74
+ .weda-ui-echart .button,
75
+ .weda-ui-echart html [type="button"],
76
+ .weda-ui-echart [type="reset"],
77
+ .weda-ui-echart [type="submit"] {
78
+ -webkit-appearance: button;
79
+ }
80
+ .weda-ui-echart .ant-btn-primary {
81
+ color: #fff;
82
+ background-color: #4A62E7;
83
+ border-color: #4A62E7;
84
+ }
85
+ .weda-ui-echart .ant-btn:not([disabled]):hover {
86
+ text-decoration: none;
87
+ }
88
+ .weda-ui-echart .ant-btn:hover,
89
+ .weda-ui-echart .ant-btn:focus,
90
+ .weda-ui-echart .ant-btn:active,
91
+ .weda-ui-echart .ant-btn.active {
92
+ background: #fff;
93
+ text-decoration: none;
94
+ }
95
+ .weda-ui-echart .ant-btn:hover,
96
+ .weda-ui-echart .ant-btn:focus {
97
+ color: #4A62E7;
98
+ background-color: #fff;
99
+ border-color: #4A62E7;
100
+ }
101
+ .weda-ui-echart .ant-btn-primary:hover,
102
+ .weda-ui-echart .ant-btn-primary:focus {
103
+ color: #fff;
104
+ background-color: #5f78ff;
105
+ border-color: #5f78ff;
106
+ }
@@ -0,0 +1,33 @@
1
+ // 引入 echarts 核心模块,核心模块提供了 echarts 使用必须要的接口。
2
+ import * as echarts from 'echarts/core';
3
+ // 引入图表,图表后缀都为 Chart
4
+ import { BarChart, LineChart, PieChart } from 'echarts/charts';
5
+ //组件,组件后缀都为 Component
6
+ import {
7
+ TitleComponent,
8
+ TooltipComponent,
9
+ LegendComponent,
10
+ GridComponent
11
+ } from 'echarts/components';
12
+ // 标签自动布局,全局过渡动画等特性
13
+ import { LabelLayout, UniversalTransition } from 'echarts/features';
14
+ // 引入 Canvas 渲染器,注意引入 CanvasRenderer 或者 SVGRenderer 是必须的一步
15
+ import { CanvasRenderer } from 'echarts/renderers';
16
+
17
+ // 注册必须的组件
18
+ echarts.use([
19
+ TitleComponent,
20
+ TooltipComponent,
21
+ GridComponent,
22
+ LegendComponent,
23
+ LabelLayout,
24
+ UniversalTransition,
25
+ CanvasRenderer,
26
+ BarChart,
27
+ LineChart,
28
+ PieChart
29
+ ]);
30
+
31
+ export {
32
+ echarts
33
+ };
@@ -0,0 +1,69 @@
1
+ import { useAsync, useDeepCompareEffect, useEventListener, useIsMounted, useMountEffect } from "@react-hookz/web";
2
+ import { MutableRefObject, RefObject, useCallback, useEffect, useMemo, useRef } from "react";
3
+ import { IEchartModalBase } from "./core/eChartBase";
4
+ import { echarts } from "./echarts";
5
+
6
+ export function useChart(ref: RefObject<HTMLElement> | MutableRefObject<HTMLElement>) {
7
+ const chartRef = useRef<echarts.ECharts>();
8
+ const isMounted = useIsMounted();
9
+ useMountEffect(() => {
10
+
11
+ if(!ref.current || !isMounted) {
12
+ return;
13
+ }
14
+
15
+ const echartDom = ref.current;
16
+ const chart = echarts.init(echartDom);
17
+ chartRef.current = chart;
18
+ return () => {
19
+ chart.dispose();
20
+ chartRef.current = null;
21
+ };
22
+ });
23
+
24
+ useEventListener(window, 'resize', () => {
25
+ chartRef.current && chartRef.current.resize();
26
+ });
27
+
28
+ return chartRef.current;
29
+ }
30
+
31
+
32
+ /**
33
+ * @deprecated The method should not be used
34
+ */
35
+ export function useWedaChart(domRef, ModalClass: IEchartModalBase, options: echarts.EChartsCoreOption) {
36
+ const chart = useChart(domRef);
37
+ const getOptions = async() => {
38
+ const chartModal = new ModalClass();
39
+ let finalOptions: any = await chartModal.setOptions(options);
40
+ if(!finalOptions) {
41
+ finalOptions = chartModal.getOptions() as any;
42
+ }
43
+ return finalOptions;
44
+ };
45
+ const [state, actions] = useAsync(getOptions);
46
+
47
+ useMountEffect(() => {
48
+ actions.execute();
49
+ });
50
+ useDeepCompareEffect(() => {
51
+ actions.execute();
52
+ }, [
53
+ // options 变化,包含所有配置项,包括纯前端的配置项变化都会触发setOptions里发请求,但改不动了
54
+ options,
55
+ actions]);
56
+ useEffect(() => {
57
+ if(state.status === 'success' && chart) {
58
+ console.log(ModalClass.name, options, state.result, window.location.href);
59
+ chart.setOption(
60
+ state.result,
61
+ true // noMerge 全刷
62
+ );
63
+ } else {
64
+ if(state.status === 'error') {
65
+ console.error(state.error);
66
+ }
67
+ }
68
+ }, [state]);
69
+ }
@@ -0,0 +1,135 @@
1
+ import React, { useRef } from 'react';
2
+ import { CommonPropsType } from '../../../types';
3
+ import { DataSource, Xfield, Yfield } from '../common/core/type';
4
+ import EChartLine from '../common/core/eChartLine';
5
+ import classNames from '../../../utils/classnames';
6
+ import { useWedaChart } from '../common/useChart';
7
+ interface PropsType extends CommonPropsType {
8
+ chartType?: string;
9
+ isTitle?: boolean;
10
+ title?: string;
11
+ titleLocation?: string;
12
+ dataSource?: DataSource;
13
+ filterData?: string;
14
+ xField?: Xfield;
15
+ groupKey?: Xfield;
16
+ groupKeyTimeSpan?: string;
17
+ xStatistics?: string;
18
+ xIsCountEmpty?: boolean;
19
+ yField?: Yfield;
20
+ isLegend?: boolean;
21
+ legend?: string;
22
+ legend2?: string;
23
+ isXaxisName?: boolean;
24
+ xAxisName?: string;
25
+ isXaxisAxisLabelShow?: boolean;
26
+ isXaxisAxisTickShow?: boolean;
27
+ isXaxisAxisLabelRotate?: boolean;
28
+ isYAxisSplitlineLinestyleWidth?: boolean;
29
+ yAxisSplitlineLinestyleType?: string;
30
+ yAxisMax?: number;
31
+ yAxisMin?: number;
32
+ isYAxisName?: boolean;
33
+ yAxisName?: string;
34
+ isSeriesShowSymbol?: boolean;
35
+ isYAxisShow?: boolean;
36
+ isUnit?: boolean;
37
+ unit?: string;
38
+ decimalDigits?: number;
39
+ suffix?: string;
40
+ }
41
+ export default function Line({
42
+ id,
43
+ style,
44
+ events,
45
+ className,
46
+ children,
47
+ chartType,
48
+ isTitle,
49
+ title,
50
+ titleLocation,
51
+ dataSource,
52
+ filterData,
53
+ xField,
54
+ xStatistics,
55
+ xIsCountEmpty,
56
+ yField,
57
+ groupKey,
58
+ groupKeyTimeSpan,
59
+ isLegend,
60
+ legend,
61
+ legend2,
62
+ isXaxisName,
63
+ xAxisName,
64
+ isXaxisAxisLabelShow,
65
+ isXaxisAxisTickShow,
66
+ isXaxisAxisLabelRotate,
67
+ isYAxisSplitlineLinestyleWidth,
68
+ yAxisSplitlineLinestyleType,
69
+ yAxisMax,
70
+ yAxisMin,
71
+ isYAxisName,
72
+ yAxisName,
73
+ isSeriesShowSymbol,
74
+ isYAxisShow,
75
+ isUnit,
76
+ unit,
77
+ decimalDigits,
78
+ suffix,
79
+ }: PropsType) {
80
+ const domRef = useRef<HTMLDivElement>();
81
+ useWedaChart(domRef, EChartLine, {
82
+ chartType,
83
+ isTitle,
84
+ title,
85
+ titleLocation,
86
+ dataSource,
87
+ filterData,
88
+ xField,
89
+ xStatistics,
90
+ xIsCountEmpty,
91
+ yField,
92
+ groupKey,
93
+ groupKeyTimeSpan,
94
+ isLegend,
95
+ legend,
96
+ legend2,
97
+ isXaxisName,
98
+ xAxisName,
99
+ isXaxisAxisLabelShow,
100
+ isXaxisAxisTickShow,
101
+ isXaxisAxisLabelRotate,
102
+ isYAxisSplitlineLinestyleWidth,
103
+ yAxisSplitlineLinestyleType,
104
+ yAxisMax,
105
+ yAxisMin,
106
+ isYAxisName,
107
+ yAxisName,
108
+ isSeriesShowSymbol,
109
+ isYAxisShow,
110
+ isUnit,
111
+ unit,
112
+ decimalDigits,
113
+ suffix,
114
+ });
115
+
116
+ const inlineStyle = {
117
+ height: '380px',
118
+ width: '100%',
119
+ backgroundColor: '#ffffff',
120
+ ...style,
121
+ };
122
+ return (
123
+ <div
124
+ id={id}
125
+ ref={domRef}
126
+ data-testid="line"
127
+ style={inlineStyle}
128
+ className={classNames({
129
+ 'echart-wrapper-canvas': true,
130
+ 'echart-dark-body': true,
131
+ [className]: className,
132
+ })}
133
+ />
134
+ );
135
+ }
@@ -0,0 +1,99 @@
1
+ import React, { useRef } from 'react';
2
+ import { CommonPropsType } from '../../../types';
3
+ import { DataSource, Xfield, Yfield } from '../common/core/type';
4
+ import EchartPie from '../common/core/eChartPie';
5
+ import { useWedaChart } from '../common/useChart';
6
+ import classNames from '../../../utils/classnames';
7
+
8
+ interface PropsType extends CommonPropsType {
9
+ chartType?: string;
10
+ isTitle?: boolean;
11
+ title?: string;
12
+ titleLocation?: string;
13
+ dataSource?: DataSource;
14
+ filterData?: string;
15
+ setColor?: Array<string>;
16
+ xField?: Xfield;
17
+ xStatistics?: string;
18
+ xIsCountEmpty?: boolean;
19
+ yField?: Yfield;
20
+ isLegend?: boolean;
21
+ legend?: string;
22
+ legend2?: string;
23
+ isSeriesShowSymbol?: boolean;
24
+ isPercent?: boolean;
25
+ isUnit?: boolean;
26
+ unit?: string;
27
+ decimalDigits?: number;
28
+ suffix?: string;
29
+ }
30
+ export default function Line({
31
+ id,
32
+ style,
33
+ events,
34
+ className,
35
+ children,
36
+ chartType,
37
+ isTitle,
38
+ title,
39
+ titleLocation,
40
+ dataSource,
41
+ filterData,
42
+ setColor,
43
+ xField,
44
+ xStatistics,
45
+ xIsCountEmpty,
46
+ yField,
47
+ isLegend,
48
+ legend,
49
+ legend2,
50
+ isSeriesShowSymbol,
51
+ isPercent,
52
+ isUnit,
53
+ unit,
54
+ decimalDigits,
55
+ suffix,
56
+ }: PropsType) {
57
+ const domRef = useRef<HTMLDivElement>();
58
+ useWedaChart(domRef, EchartPie, {
59
+ chartType,
60
+ isTitle,
61
+ title,
62
+ titleLocation,
63
+ dataSource,
64
+ filterData,
65
+ setColor,
66
+ xField,
67
+ xStatistics,
68
+ xIsCountEmpty,
69
+ yField,
70
+ isLegend,
71
+ legend,
72
+ legend2,
73
+ isSeriesShowSymbol,
74
+ isPercent,
75
+ isUnit,
76
+ unit,
77
+ decimalDigits,
78
+ suffix,
79
+ });
80
+ const inlineStyle = {
81
+ height: '380px',
82
+ width: '100%',
83
+ backgroundColor: '#ffffff',
84
+ ...style,
85
+ };
86
+ return (
87
+ <div
88
+ id={id}
89
+ data-testid="pie"
90
+ ref={domRef}
91
+ style={inlineStyle}
92
+ className={classNames({
93
+ 'echart-wrapper-canvas': true,
94
+ 'echart-dark-body': true,
95
+ [className]: className,
96
+ })}
97
+ />
98
+ );
99
+ }
@@ -77,7 +77,7 @@ export default function LocationH5(props) {
77
77
  value: {
78
78
  address: poiname,
79
79
  geopoint: {
80
- coordinates: [lat, lng],
80
+ coordinates: [lng, lat],
81
81
  type: 'Point',
82
82
  },
83
83
  },
@@ -176,7 +176,7 @@ export default function LocationH5(props) {
176
176
  value: {
177
177
  address: city + addr,
178
178
  geopoint: {
179
- coordinates: [lat, lng],
179
+ coordinates: [lng, lat],
180
180
  type: 'Point',
181
181
  },
182
182
  },
@@ -283,7 +283,7 @@ export default function LocationH5(props) {
283
283
  value: {
284
284
  address: poiname,
285
285
  geopoint: {
286
- coordinates: [latlng.lat, latlng.lng],
286
+ coordinates: [latlng.lng, latlng.lat],
287
287
  type: 'Point',
288
288
  },
289
289
  },
@@ -58,7 +58,7 @@ export default function LocationPC(props) {
58
58
  let res = {
59
59
  address: poiname,
60
60
  geopoint: {
61
- coordinates: [latitude, longitude],
61
+ coordinates: [longitude, latitude],
62
62
  type: 'Point',
63
63
  },
64
64
  };
@@ -124,7 +124,7 @@ export default function LocationPC(props) {
124
124
  value: {
125
125
  address: poiname,
126
126
  geopoint: {
127
- coordinates: [latlng.lat, latlng.lng],
127
+ coordinates: [latlng.lng, latlng.lat],
128
128
  type: 'Point',
129
129
  },
130
130
  },