@cloudbase/weda-ui 2.0.10 → 2.0.11

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 (90) hide show
  1. package/package.json +9 -2
  2. package/src/mp/components/button/index.js +1 -1
  3. package/src/mp/components/button/index.wxml +19 -19
  4. package/src/mp/components/calendar/index.js +64 -37
  5. package/src/mp/components/calendar/index.wxml +28 -8
  6. package/src/mp/components/carousel/index.wxml +30 -3
  7. package/src/mp/components/chart/bar/index.js +1 -2
  8. package/src/mp/components/chart/bar/index.wxml +7 -2
  9. package/src/mp/components/chart/common/config/bar.js +1 -1
  10. package/src/mp/components/chart/common/core/eChartBar.js +29 -34
  11. package/src/mp/components/chart/common/core/eChartBase.js +46 -32
  12. package/src/mp/components/chart/common/core/eChartLine.js +34 -40
  13. package/src/mp/components/chart/common/core/eChartPie.js +12 -9
  14. package/src/mp/components/chart/ec-canvas/ec-canvas.wxml +19 -2
  15. package/src/mp/components/chart/ec-canvas/wx-canvas.js +24 -22
  16. package/src/mp/components/chart/line/index.js +2 -2
  17. package/src/mp/components/chart/line/index.wxml +7 -2
  18. package/src/mp/components/chart/pie/index.js +1 -1
  19. package/src/mp/components/chart/pie/index.wxml +7 -3
  20. package/src/mp/components/chart/statisticsCard/index.wxml +5 -1
  21. package/src/mp/components/dataView/index.wxml +2 -2
  22. package/src/mp/components/form/checkbox/index.js +10 -6
  23. package/src/mp/components/form/checkbox/index.wxml +26 -23
  24. package/src/mp/components/form/form/index.wxml +3 -3
  25. package/src/mp/components/form/formcell/index.wxml +9 -9
  26. package/src/mp/components/form/formcell/index.wxss +1 -1
  27. package/src/mp/components/form/input/index.js +3 -3
  28. package/src/mp/components/form/input/index.wxml +36 -30
  29. package/src/mp/components/form/input/index.wxss +2 -2
  30. package/src/mp/components/form/location/components/mapChoose/index.wxml +59 -12
  31. package/src/mp/components/form/location/index.wxml +39 -7
  32. package/src/mp/components/form/radio/index.js +9 -5
  33. package/src/mp/components/form/radio/index.wxml +23 -23
  34. package/src/mp/components/form/select/index.js +156 -97
  35. package/src/mp/components/form/select/index.wxml +39 -37
  36. package/src/mp/components/form/select/index.wxss +1 -1
  37. package/src/mp/components/form/select/region/index.js +18 -12
  38. package/src/mp/components/form/switch/index.wxml +20 -16
  39. package/src/mp/components/form/textarea/index.wxml +12 -8
  40. package/src/mp/components/form/tips/index.wxml +1 -3
  41. package/src/mp/components/form/uploader/index.js +1 -1
  42. package/src/mp/components/form/uploader/index.wxml +19 -18
  43. package/src/mp/components/form/uploader/weui-uploader.js +210 -200
  44. package/src/mp/components/form/uploader/weui-uploader.wxml +81 -38
  45. package/src/mp/components/form/uploaderFile/index.js +5 -4
  46. package/src/mp/components/form/uploaderFile/index.wxml +97 -41
  47. package/src/mp/components/graphicCard/index.js +26 -24
  48. package/src/mp/components/graphicCard/index.wxml +30 -6
  49. package/src/mp/components/image/index.wxml +25 -18
  50. package/src/mp/components/image/index.wxss +3 -1
  51. package/src/mp/components/listView/index.wxml +34 -11
  52. package/src/mp/components/lottery/index.wxml +29 -7
  53. package/src/mp/components/lottery/index.wxss +31 -25
  54. package/src/mp/components/navLayout/index.wxml +29 -7
  55. package/src/mp/components/navigationBar/index.wxml +162 -53
  56. package/src/mp/components/swiper/index.wxml +12 -7
  57. package/src/mp/components/tabs/index.js +14 -10
  58. package/src/mp/components/tabs/index.wxml +2 -1
  59. package/src/mp/components/text/index.wxml +2 -1
  60. package/src/mp/components/text/index.wxss +1 -1
  61. package/src/mp/components/wxOpenApi/phone/index.wxml +11 -12
  62. package/src/mp/components/wxOpenApi/phoneCode/index.wxml +11 -12
  63. package/src/mp/components/wxOpenApi/share/index.wxml +11 -12
  64. package/src/mp/components/wxOpenApi/userInfo/index.wxml +10 -11
  65. package/src/mp/style/weda-ui.wxss +8 -3
  66. package/src/mp/utils/deepEqual.js +37 -37
  67. package/src/mp/utils/destr.js +41 -40
  68. package/src/mp/utils/dr_square_point.js +10 -6
  69. package/src/setupTests.js +13 -13
  70. package/src/web/components/button/index.tsx +44 -40
  71. package/src/web/components/carousel/index.tsx +1 -1
  72. package/src/web/components/chart/common/config/bar.js +1 -1
  73. package/src/web/components/chart/common/core/eChartBar.js +28 -34
  74. package/src/web/components/chart/common/core/eChartLine.js +34 -40
  75. package/src/web/components/chart/common/core/eChartPie.js +12 -9
  76. package/src/web/components/form/form/index.tsx +5 -5
  77. package/src/web/components/form/formcell/index.css +5 -1
  78. package/src/web/components/form/formcell/index.tsx +1 -1
  79. package/src/web/components/form/select/h5.tsx +154 -103
  80. package/src/web/components/form/select/index.css +0 -3
  81. package/src/web/components/form/textarea/index.tsx +1 -1
  82. package/src/web/components/form/uploader/uploader.h5.tsx +26 -20
  83. package/src/web/components/image/index.tsx +1 -1
  84. package/src/web/components/link/index.tsx +1 -1
  85. package/src/web/components/navLayout/index.tsx +1 -1
  86. package/src/web/components/navigationBar/index.tsx +2 -2
  87. package/src/web/components/picker/timePicker.tsx +1 -1
  88. package/src/web/components/text/index.tsx +13 -14
  89. package/src/web/utils/isObjectEqual.js +2 -1
  90. package/src/web/weda-ui.css +4 -0
@@ -1,48 +1,49 @@
1
1
  // https://github.com/unjs/destr/blob/2f6612533dd798d2ff5786274f2244558f86d09c/src/index.ts
2
2
  // https://github.com/fastify/secure-json-parse
3
3
  // https://github.com/hapijs/bourne
4
- const suspectProtoRx = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/;
5
- const suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
4
+ const suspectProtoRx =
5
+ /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/;
6
+ const suspectConstructorRx =
7
+ /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
6
8
  const JsonSigRx = /^["{[]|^-?[0-9][0-9.]{0,14}$/;
7
9
  function jsonParseTransform(key, value) {
8
- if (key === '__proto__' || key === 'constructor') {
9
- return;
10
- }
11
- return value;
10
+ if (key === '__proto__' || key === 'constructor') {
11
+ return;
12
+ }
13
+ return value;
12
14
  }
13
15
  export default function destr(val) {
14
- if (typeof val !== 'string') {
15
- return val;
16
- }
17
- const _lval = val.toLowerCase();
18
- if (_lval === 'true') {
19
- return true;
20
- }
21
- if (_lval === 'false') {
22
- return false;
23
- }
24
- if (_lval === 'null') {
25
- return null;
26
- }
27
- if (_lval === 'nan') {
28
- return NaN;
29
- }
30
- if (_lval === 'infinity') {
31
- return Infinity;
32
- }
33
- if (_lval === 'undefined') {
34
- return undefined;
35
- }
36
- if (!JsonSigRx.test(val)) {
37
- return val;
38
- }
39
- try {
40
- if (suspectProtoRx.test(val) || suspectConstructorRx.test(val)) {
41
- return JSON.parse(val, jsonParseTransform);
42
- }
43
- return JSON.parse(val);
44
- }
45
- catch (_e) {
46
- return val;
47
- }
16
+ if (typeof val !== 'string') {
17
+ return val;
18
+ }
19
+ const _lval = val.toLowerCase();
20
+ if (_lval === 'true') {
21
+ return true;
22
+ }
23
+ if (_lval === 'false') {
24
+ return false;
25
+ }
26
+ if (_lval === 'null') {
27
+ return null;
28
+ }
29
+ if (_lval === 'nan') {
30
+ return NaN;
31
+ }
32
+ if (_lval === 'infinity') {
33
+ return Infinity;
34
+ }
35
+ if (_lval === 'undefined') {
36
+ return undefined;
37
+ }
38
+ if (!JsonSigRx.test(val)) {
39
+ return val;
40
+ }
41
+ try {
42
+ if (suspectProtoRx.test(val) || suspectConstructorRx.test(val)) {
43
+ return JSON.parse(val, jsonParseTransform);
44
+ }
45
+ return JSON.parse(val);
46
+ } catch (_e) {
47
+ return val;
48
+ }
48
49
  }
@@ -10,16 +10,20 @@
10
10
  function dr_square_point($lng, $lat, $distance = 0.5) {
11
11
  $distance = $distance ? $distance : 1;
12
12
  let $r = 6371; //地球半径,平均半径为6371km
13
- let $dlng = 2 * Math.asin(Math.sin($distance / (2 * $r)) / Math.cos($lat * (Math.PI / 180)));
13
+ let $dlng =
14
+ 2 *
15
+ Math.asin(
16
+ Math.sin($distance / (2 * $r)) / Math.cos($lat * (Math.PI / 180))
17
+ );
14
18
  $dlng = $dlng * (180 / Math.PI);
15
19
  let $dlat = $distance / $r;
16
20
  $dlat = $dlat * (180 / Math.PI);
17
21
  return {
18
- 'leftTop': [$lat + $dlat, $lng - $dlng],
19
- 'leftBottom': [$lat - $dlat, $lng - $dlng],
20
- 'rightBottom': [$lat - $dlat, $lng + $dlng],
21
- 'rightTop': [$lat + $dlat, $lng + $dlng],
22
+ leftTop: [$lat + $dlat, $lng - $dlng],
23
+ leftBottom: [$lat - $dlat, $lng - $dlng],
24
+ rightBottom: [$lat - $dlat, $lng + $dlng],
25
+ rightTop: [$lat + $dlat, $lng + $dlng],
22
26
  };
23
27
  }
24
28
 
25
- export default dr_square_point;
29
+ export default dr_square_point;
package/src/setupTests.js CHANGED
@@ -1,14 +1,14 @@
1
- require("regenerator-runtime");
1
+ require('regenerator-runtime');
2
2
  Object.defineProperty(window, 'matchMedia', {
3
- writable: true,
4
- value: jest.fn().mockImplementation(query => ({
5
- matches: false,
6
- media: query,
7
- onchange: null,
8
- addListener: jest.fn(), // Deprecated
9
- removeListener: jest.fn(), // Deprecated
10
- addEventListener: jest.fn(),
11
- removeEventListener: jest.fn(),
12
- dispatchEvent: jest.fn(),
13
- })),
14
- });
3
+ writable: true,
4
+ value: jest.fn().mockImplementation((query) => ({
5
+ matches: false,
6
+ media: query,
7
+ onchange: null,
8
+ addListener: jest.fn(), // Deprecated
9
+ removeListener: jest.fn(), // Deprecated
10
+ addEventListener: jest.fn(),
11
+ removeEventListener: jest.fn(),
12
+ dispatchEvent: jest.fn(),
13
+ })),
14
+ });
@@ -1,8 +1,12 @@
1
1
  import * as React from 'react';
2
- import { Button as TeaButton, ButtonProps, ConfigProvider } from 'tea-component';
2
+ import {
3
+ Button as TeaButton,
4
+ ButtonProps,
5
+ ConfigProvider,
6
+ } from 'tea-component';
3
7
  import classNames from '../../utils/classnames';
4
8
  import { usePlatform } from '../../utils/platform';
5
- import { CommonPropsType, unknownFunction } from '../../types';
9
+ import type { CommonPropsType, unknownFunction } from '../../types';
6
10
 
7
11
  import './index.css';
8
12
 
@@ -15,7 +19,7 @@ const Button = ({
15
19
  formType,
16
20
  loading,
17
21
  disabled,
18
- events = ({} as Record<string, unknownFunction>),
22
+ events = {} as Record<string, unknownFunction>,
19
23
  className,
20
24
  style,
21
25
  id,
@@ -38,48 +42,48 @@ const Button = ({
38
42
  });
39
43
  const onClick = (e) => events.tap({}, { originEvent: e });
40
44
 
41
- if(platform === 'h5') {
45
+ if (platform === 'h5') {
42
46
  return (
43
47
  <button
44
- className={cls}
45
- disabled={disabled}
46
- type={formType}
47
- style={style}
48
- id={id}
49
- onClick={onClick}
48
+ className={cls}
49
+ disabled={disabled}
50
+ type={formType}
51
+ style={style}
52
+ id={id}
53
+ onClick={onClick}
50
54
  >
51
- {loading && (
52
- <span className="weui-btn_loading">
53
- <i className="weui-loading" />
54
- </span>
55
- )}
56
- {text ? text : contentSlot}
57
- </button>
58
- );
59
- }
55
+ {loading && (
56
+ <span className="weui-btn_loading">
57
+ <i className="weui-loading" />
58
+ </span>
59
+ )}
60
+ {text ? text : contentSlot}
61
+ </button>
62
+ );
63
+ }
60
64
 
61
- return (
62
- <ConfigProvider classPrefix="wedatea2td">
63
- <TeaButton
64
- loading={loading}
65
- onClick={onClick}
66
- disabled={disabled}
67
- htmlType={formType}
68
- type={toTeaButtonType(type)}
69
- style={style}
70
- className={cls}
71
- id={id}
65
+ return (
66
+ <ConfigProvider classPrefix="wedatea2td">
67
+ <TeaButton
68
+ loading={loading}
69
+ onClick={onClick}
70
+ disabled={disabled}
71
+ htmlType={formType}
72
+ type={toTeaButtonType(type)}
73
+ style={style}
74
+ className={cls}
75
+ id={id}
72
76
  >
73
- {text ? text : contentSlot}
74
- </TeaButton>
75
- </ConfigProvider>
76
- );
77
+ {text ? text : contentSlot}
78
+ </TeaButton>
79
+ </ConfigProvider>
80
+ );
77
81
  };
78
82
 
79
- function toTeaButtonType(type: PropsType['type'] ): ButtonProps['type'] {
80
- if(type === 'primary') return type;
81
- if(type === 'warn') return 'error';
82
- if(type === 'default') return 'primary';
83
+ function toTeaButtonType(type: PropsType['type']): ButtonProps['type'] {
84
+ if (type === 'primary') return type;
85
+ if (type === 'warn') return 'error';
86
+ if (type === 'default') return 'primary';
83
87
  return 'primary';
84
88
  }
85
89
 
@@ -95,7 +99,7 @@ export interface PropsType extends CommonPropsType {
95
99
  /**
96
100
  * 大小
97
101
  */
98
- size?: "default" | "mini" | "large";
102
+ size?: 'default' | 'mini' | 'large';
99
103
  /**
100
104
  * 是否禁用
101
105
  */
@@ -108,7 +112,7 @@ export interface PropsType extends CommonPropsType {
108
112
  /**
109
113
  * 用于 form 类型
110
114
  */
111
- formType?: "button" | "submit" | "reset";
115
+ formType?: 'button' | 'submit' | 'reset';
112
116
  contentSlot?: string;
113
117
  }
114
118
 
@@ -9,7 +9,7 @@ import {
9
9
  } from '@react-hookz/web';
10
10
 
11
11
  import './index.css';
12
- import { CommonPropsType } from '../../types';
12
+ import type { CommonPropsType } from '../../types';
13
13
 
14
14
  import Image from '../image';
15
15
  interface imagesItem {
@@ -11,7 +11,7 @@ const getConfig = () => {
11
11
  axisTick: {
12
12
  show: true, // 刻度显示
13
13
  },
14
- inverse:false,
14
+ inverse: false,
15
15
  type: 'category',
16
16
  data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
17
17
  },
@@ -19,7 +19,7 @@ class EchartBar extends EchartBase {
19
19
  groupKey,
20
20
  groupKeyTimeSpan,
21
21
  yField,
22
- isPile
22
+ isPile,
23
23
  }) {
24
24
  const { name = '', type = '', methodName = '' } = dataSource;
25
25
  if (name !== '') {
@@ -36,7 +36,7 @@ class EchartBar extends EchartBase {
36
36
  name,
37
37
  methodName,
38
38
  type,
39
- params,
39
+ params
40
40
  );
41
41
  // 获取 x 轴数据
42
42
  const sortedXAxisData = this.sortXAxisData(arrSourData, xField.format);
@@ -57,12 +57,18 @@ class EchartBar extends EchartBase {
57
57
  },
58
58
  data: [],
59
59
  };
60
- sortedXAxisData.forEach((itemSource,index) => {
60
+ sortedXAxisData.forEach((itemSource, index) => {
61
61
  this.config.series[j].name = itemSource.YLabels[j].Cn_Name;
62
- if ((itemSource.YLabels[j].Value === undefined || itemSource.YLabels[j].Value === null) && !xIsCountEmpty) {
62
+ if (
63
+ (itemSource.YLabels[j].Value === undefined ||
64
+ itemSource.YLabels[j].Value === null) &&
65
+ !xIsCountEmpty
66
+ ) {
63
67
  arrXisCountEmptyIndex.push(index);
64
68
  } else {
65
- const value = itemSource.YLabels[j].Value ? itemSource.YLabels[j].Value : 0;
69
+ const value = itemSource.YLabels[j].Value
70
+ ? itemSource.YLabels[j].Value
71
+ : 0;
66
72
  this.config.series[j].data.push(value);
67
73
  }
68
74
  });
@@ -87,7 +93,6 @@ class EchartBar extends EchartBase {
87
93
  });
88
94
  });
89
95
 
90
-
91
96
  // 组装图表需要的数据
92
97
  const arrGroupKey = Object.keys(objGroupKey);
93
98
  this.config.series = arrGroupKey.map((groupKey) => {
@@ -102,23 +107,13 @@ class EchartBar extends EchartBase {
102
107
  label: {
103
108
  show: true,
104
109
  },
105
- data: this.getSeriesDataGroup(
106
- arrXaxisData,
107
- objGroupKey[groupKey],
108
- ),
110
+ data: this.getSeriesDataGroup(arrXaxisData, objGroupKey[groupKey]),
109
111
  stack: isPile ? 'pile' : null,
110
112
  };
111
113
  return serie;
112
114
  });
113
- this.config.tooltip.formatter = params => (
114
- `${params.data.dimensionality
115
- }\r\n${
116
- params.data.name
117
- }\r\n${
118
- params.seriesName
119
- }:${
120
- params.value}`
121
- );
115
+ this.config.tooltip.formatter = (params) =>
116
+ `${params.data.dimensionality}\r\n${params.data.name}\r\n${params.seriesName}:${params.value}`;
122
117
  }
123
118
  }
124
119
  }
@@ -138,19 +133,17 @@ class EchartBar extends EchartBase {
138
133
  isUnit,
139
134
  unit,
140
135
  decimalDigits,
141
- suffix
136
+ suffix,
142
137
  }) {
143
138
  decimalDigits = Math.max(0, decimalDigits);
144
- this.config.series.length > 0
145
- && this.config.series.forEach((itemSeries) => {
139
+ this.config.series.length > 0 &&
140
+ this.config.series.forEach((itemSeries) => {
146
141
  itemSeries.showSymbol = isSeriesShowSymbol;
147
142
  itemSeries.label.show = isSeriesShowSymbol;
148
143
  if (isUnit) {
149
144
  itemSeries.label.formatter = (params) => {
150
145
  const objNewValue = this.getValueByUnit(params.value, unit);
151
- return (
152
- `${objNewValue.toFixed(decimalDigits)}${suffix}`
153
- );
146
+ return `${objNewValue.toFixed(decimalDigits)}${suffix}`;
154
147
  };
155
148
  }
156
149
  });
@@ -165,17 +158,18 @@ class EchartBar extends EchartBase {
165
158
  }
166
159
 
167
160
  // 设置柱状图X,Y倒转
168
- setDirectionType({directionType}) {
161
+ setDirectionType({ directionType }) {
169
162
  let temAxis = {};
170
- if (directionType === 'crosswise') { // 横向
163
+ if (directionType === 'crosswise') {
164
+ // 横向
171
165
  temAxis = this.config.xAxis;
172
166
  // @ts-ignore
173
167
  this.config.xAxis = this.config.yAxis;
174
168
  // @ts-ignore
175
169
  this.config.yAxis = temAxis;
176
- this.config.yAxis.inverse = true;
177
-
178
- } else { // 纵向
170
+ this.config.yAxis.inverse = true;
171
+ } else {
172
+ // 纵向
179
173
  if (this.config.yAxis.inverse) {
180
174
  temAxis = this.config.yAxis;
181
175
  // @ts-ignore
@@ -220,7 +214,7 @@ class EchartBar extends EchartBase {
220
214
  isUnit,
221
215
  unit,
222
216
  decimalDigits,
223
- suffix
217
+ suffix,
224
218
  }) {
225
219
  legend = document.body.clientWidth < 1024 ? legend : legend2;
226
220
  if (dataSource) {
@@ -233,7 +227,7 @@ class EchartBar extends EchartBase {
233
227
  groupKey,
234
228
  groupKeyTimeSpan,
235
229
  yField,
236
- isPile
230
+ isPile,
237
231
  });
238
232
  }
239
233
  this.setColor({ setColor });
@@ -255,9 +249,9 @@ class EchartBar extends EchartBase {
255
249
  isUnit,
256
250
  unit,
257
251
  decimalDigits,
258
- suffix
252
+ suffix,
259
253
  });
260
- this.setDirectionType({directionType});
254
+ this.setDirectionType({ directionType });
261
255
  return this.config;
262
256
  }
263
257
  }
@@ -35,7 +35,7 @@ class EchartLine extends EchartBase {
35
35
  name,
36
36
  methodName,
37
37
  type,
38
- params,
38
+ params
39
39
  );
40
40
  // 获取 x 轴数据
41
41
 
@@ -57,12 +57,18 @@ class EchartLine extends EchartBase {
57
57
  },
58
58
  data: [],
59
59
  };
60
- sortedXAxisData.forEach((itemSource,index) => {
60
+ sortedXAxisData.forEach((itemSource, index) => {
61
61
  this.config.series[j].name = itemSource.YLabels[j].Cn_Name;
62
- if ((itemSource.YLabels[j].Value === undefined || itemSource.YLabels[j].Value === null) && !xIsCountEmpty) {
62
+ if (
63
+ (itemSource.YLabels[j].Value === undefined ||
64
+ itemSource.YLabels[j].Value === null) &&
65
+ !xIsCountEmpty
66
+ ) {
63
67
  arrXisCountEmptyIndex.push(index);
64
68
  } else {
65
- const value = itemSource.YLabels[j].Value ? itemSource.YLabels[j].Value : 0;
69
+ const value = itemSource.YLabels[j].Value
70
+ ? itemSource.YLabels[j].Value
71
+ : 0;
66
72
  this.config.series[j].data.push(value);
67
73
  }
68
74
  });
@@ -90,38 +96,28 @@ class EchartLine extends EchartBase {
90
96
  // 组装图表需要的数据
91
97
  const groupNames = Object.keys(objGroupKey);
92
98
  this.config.series = groupNames.map((groupKey) => {
93
- // groupKey分组字段中文名
94
- const serie = {
95
- name: groupKey,
96
- connectNulls: true,
97
- data: this.getSeriesDataGroup(
98
- arrXaxisData,
99
- objGroupKey[groupKey],
100
- ),
101
- type: 'line',
102
- smooth: true,
103
- showSymbol: true, // 是否显示线条上数据标签
104
- label: {
105
- show: true, // 显示线条上的数据
106
- },
107
- };
108
- return serie;
109
- });
110
- this.config.tooltip.formatter = params => (
111
- `${params.data.dimensionality
112
- }\r\n${
113
- params.data.name
114
- }\r\n${
115
- params.seriesName
116
- }:${
117
- params.value}`
118
- );
99
+ // groupKey分组字段中文名
100
+ const serie = {
101
+ name: groupKey,
102
+ connectNulls: true,
103
+ data: this.getSeriesDataGroup(arrXaxisData, objGroupKey[groupKey]),
104
+ type: 'line',
105
+ smooth: true,
106
+ showSymbol: true, // 是否显示线条上数据标签
107
+ label: {
108
+ show: true, // 显示线条上的数据
109
+ },
110
+ };
111
+ return serie;
112
+ });
113
+ this.config.tooltip.formatter = (params) =>
114
+ `${params.data.dimensionality}\r\n${params.data.name}\r\n${params.seriesName}:${params.value}`;
119
115
  }
120
116
  }
121
117
  }
122
118
  setChartType({ chartType }) {
123
- this.config.series.length > 0
124
- && this.config.series.forEach((itemSeries) => {
119
+ this.config.series.length > 0 &&
120
+ this.config.series.forEach((itemSeries) => {
125
121
  itemSeries.smooth = chartType !== 'line';
126
122
  });
127
123
  }
@@ -132,19 +128,17 @@ class EchartLine extends EchartBase {
132
128
  isUnit,
133
129
  unit,
134
130
  decimalDigits,
135
- suffix
131
+ suffix,
136
132
  }) {
137
133
  decimalDigits = decimalDigits < 0 ? 0 : decimalDigits;
138
- this.config.series.length > 0
139
- && this.config.series.forEach((itemSeries) => {
134
+ this.config.series.length > 0 &&
135
+ this.config.series.forEach((itemSeries) => {
140
136
  itemSeries.showSymbol = isSeriesShowSymbol;
141
137
  itemSeries.label.show = isSeriesShowSymbol;
142
138
  if (isUnit) {
143
139
  itemSeries.label.formatter = (params) => {
144
140
  const objNewValue = this.getValueByUnit(params.value, unit);
145
- return (
146
- `${objNewValue.toFixed(decimalDigits)}${suffix}`
147
- );
141
+ return `${objNewValue.toFixed(decimalDigits)}${suffix}`;
148
142
  };
149
143
  }
150
144
  });
@@ -189,7 +183,7 @@ class EchartLine extends EchartBase {
189
183
  isUnit,
190
184
  unit,
191
185
  decimalDigits,
192
- suffix
186
+ suffix,
193
187
  }) {
194
188
  if (dataSource) {
195
189
  await this.setSourceData({
@@ -223,7 +217,7 @@ class EchartLine extends EchartBase {
223
217
  isUnit,
224
218
  unit,
225
219
  decimalDigits,
226
- suffix
220
+ suffix,
227
221
  });
228
222
  }
229
223
  }
@@ -32,7 +32,7 @@ class EchartPie extends EchartBase {
32
32
  name,
33
33
  methodName,
34
34
  type,
35
- params,
35
+ params
36
36
  );
37
37
  // 获取 x 轴数据
38
38
  if (arrSourData.length >= 0) {
@@ -59,8 +59,8 @@ class EchartPie extends EchartBase {
59
59
  }
60
60
  }
61
61
  setChartType({ chartType }) {
62
- this.config.series.length > 0
63
- && this.config.series.forEach((itemSeries) => {
62
+ this.config.series.length > 0 &&
63
+ this.config.series.forEach((itemSeries) => {
64
64
  if (chartType === 'pie') {
65
65
  itemSeries.radius = '70%';
66
66
  } else {
@@ -77,7 +77,7 @@ class EchartPie extends EchartBase {
77
77
  isUnit,
78
78
  unit,
79
79
  decimalDigits,
80
- suffix
80
+ suffix,
81
81
  }) {
82
82
  decimalDigits = decimalDigits < 0 ? 0 : decimalDigits;
83
83
  let show = false;
@@ -94,10 +94,12 @@ class EchartPie extends EchartBase {
94
94
  } else {
95
95
  this.config.series[0].label.normal.formatter = (objValue) => {
96
96
  let reData = '';
97
- if (isSeriesShowSymbol) { // 显示数值
97
+ if (isSeriesShowSymbol) {
98
+ // 显示数值
98
99
  reData = objValue.value;
99
100
  }
100
- if (isUnit) { // 显示单位
101
+ if (isUnit) {
102
+ // 显示单位
101
103
  if (unit) {
102
104
  const objNewValue = this.getValueByUnit(objValue.value, unit);
103
105
  reData = `${objNewValue.toFixed(decimalDigits)}${suffix}`;
@@ -111,7 +113,8 @@ class EchartPie extends EchartBase {
111
113
  };
112
114
  });
113
115
  }
114
- if (isPercent) { // 显示百分比
116
+ if (isPercent) {
117
+ // 显示百分比
115
118
  reData = `${reData}(${objValue.percent}%)`;
116
119
  }
117
120
  return reData;
@@ -138,7 +141,7 @@ class EchartPie extends EchartBase {
138
141
  isUnit,
139
142
  unit,
140
143
  decimalDigits,
141
- suffix
144
+ suffix,
142
145
  }) {
143
146
  legend = document.body.clientWidth < 1024 ? legend : legend2;
144
147
  if (dataSource) {
@@ -162,7 +165,7 @@ class EchartPie extends EchartBase {
162
165
  isUnit,
163
166
  unit,
164
167
  decimalDigits,
165
- suffix
168
+ suffix,
166
169
  });
167
170
  }
168
171
  }
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import classNames from '../../../utils/classnames';
3
3
  import './index.css';
4
- import {ConfigProvider, Form as TeaForm} from 'tea-component';
4
+ import { ConfigProvider, Form as TeaForm } from 'tea-component';
5
5
  import { usePlatform } from '../../../utils/platform';
6
- import { CommonFormPropsType } from '../types';
6
+ import type { CommonFormPropsType } from '../types';
7
7
 
8
8
  export default function Form({
9
9
  // 系统属性
@@ -26,14 +26,14 @@ export default function Form({
26
26
  'gsd-h5-react-form-pc': platform === 'pc',
27
27
  [className]: className,
28
28
  });
29
- if(platform === 'pc') {
29
+ if (platform === 'pc') {
30
30
  return (
31
31
  <ConfigProvider classPrefix="wedatea2td">
32
32
  {/** @ts-expect-error tea form id */}
33
33
  <TeaForm className={cls} style={style} id={id}>
34
34
  {contentSlot}
35
- </TeaForm>
36
- </ConfigProvider>
35
+ </TeaForm>
36
+ </ConfigProvider>
37
37
  );
38
38
  }
39
39
  return (