@easyv/charts 1.6.23 → 1.6.24

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.
@@ -228,7 +228,7 @@ var Label = function Label(_ref5) {
228
228
  }
229
229
  })));
230
230
  };
231
- var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(0, _react.forwardRef)(function (_ref6, ref) {
231
+ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (_ref6, ref) {
232
232
  var orientation = _ref6.orientation,
233
233
  scaler = _ref6.scaler,
234
234
  _ref6$tickSize = _ref6.tickSize,
@@ -15,7 +15,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
15
15
  * svg外框
16
16
  */
17
17
  var event = function event() {};
18
- var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
18
+ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
19
19
  var width = _ref.width,
20
20
  height = _ref.height,
21
21
  marginLeft = _ref.marginLeft,
@@ -18,7 +18,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
18
18
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
19
19
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
20
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21
- var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
21
+ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
22
22
  var _props$actions = props.actions,
23
23
  setX = _props$actions.setX,
24
24
  setWorking = _props$actions.setWorking,
@@ -17,7 +17,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
17
17
  * 文字跑马灯组件
18
18
  * eg: <Marquee value={文本内容} speed={跑马灯速度} style={额外样式}></Marquee>
19
19
  */
20
- var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
20
+ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
21
21
  var value = props.value,
22
22
  style = props.style,
23
23
  _props$speed = props.speed,
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
14
+ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (props) {
15
+ var value = props.value,
16
+ _props$config = props.config,
17
+ fontFamily = _props$config.fontFamily,
18
+ separator = _props$config.separator,
19
+ show = _props$config.show,
20
+ splitCount = _props$config.splitCount,
21
+ style = _props$config.style,
22
+ _props$config$margin = _props$config.margin,
23
+ left = _props$config$margin.left,
24
+ right = _props$config$margin.right;
25
+ var stringValue = String(value);
26
+ var _stringValue$split = stringValue.split('.'),
27
+ _stringValue$split2 = (0, _slicedToArray2["default"])(_stringValue$split, 2),
28
+ intValueString = _stringValue$split2[0],
29
+ _stringValue$split2$ = _stringValue$split2[1],
30
+ pointValueSting = _stringValue$split2$ === void 0 ? '' : _stringValue$split2$;
31
+ var intArray = [];
32
+ var pointArray = (0, _toConsumableArray2["default"])(pointValueSting);
33
+ (0, _toConsumableArray2["default"])(intValueString).forEach(function (i, index) {
34
+ !(intValueString.length - index - 1) || (intValueString.length - index - 1) % splitCount ? intArray.push(i) : (intArray.push(i), intArray.push('分隔符'));
35
+ });
36
+ return show ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, intArray.map(function (v, index) {
37
+ return /*#__PURE__*/_react["default"].createElement("span", {
38
+ key: 'int_' + index,
39
+ style: {
40
+ fontFamily: v === '分隔符' && style != 'default' ? fontFamily : 'inherit',
41
+ marginLeft: v === '分隔符' ? left : 0,
42
+ marginRight: v === '分隔符' ? right : 0
43
+ }
44
+ }, v === '分隔符' ? style == 'custom' && separator ? separator : ',' : v);
45
+ }), pointArray.length ? /*#__PURE__*/_react["default"].createElement("span", null, ".") : null, pointArray.map(function (v, index) {
46
+ return /*#__PURE__*/_react["default"].createElement("span", {
47
+ key: 'point_' + index
48
+ }, v);
49
+ })) : value;
50
+ });
@@ -17,7 +17,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
17
17
  * 文本溢出组件
18
18
  * eg: <TextOverflow type={溢出形式} value={文本内容} speed={跑马灯速度} style={额外样式}></Marquee>
19
19
  */
20
- var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
20
+ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
21
21
  var type = props.type,
22
22
  value = props.value,
23
23
  style = props.style,
@@ -143,6 +143,12 @@ Object.defineProperty(exports, "PieTooltip", {
143
143
  return _PieTooltip.PieTooltip;
144
144
  }
145
145
  });
146
+ Object.defineProperty(exports, "SplitText", {
147
+ enumerable: true,
148
+ get: function get() {
149
+ return _SplitText["default"];
150
+ }
151
+ });
146
152
  Object.defineProperty(exports, "StackData", {
147
153
  enumerable: true,
148
154
  get: function get() {
@@ -194,4 +200,5 @@ var _TextOverflow = _interopRequireDefault(require("./TextOverflow"));
194
200
  var _BaseLine = _interopRequireDefault(require("./BaseLine"));
195
201
  var _Control = _interopRequireDefault(require("./Control"));
196
202
  var _PieTooltip = require("./PieTooltip");
203
+ var _SplitText = _interopRequireDefault(require("./SplitText"));
197
204
  var Area = exports.Area = _Line["default"];
@@ -37,6 +37,7 @@ var pieLegendFormatter = exports.pieLegendFormatter = function pieLegendFormatte
37
37
  _ref2$value$translate = _ref2$value.translate,
38
38
  valueX = _ref2$value$translate.x,
39
39
  valueY = _ref2$value$translate.y,
40
+ splitConfig = _ref2$value.splitConfig,
40
41
  _ref2$value$suffix = _ref2$value.suffix,
41
42
  showSuffix = _ref2$value$suffix.show,
42
43
  text = _ref2$value$suffix.text,
@@ -90,7 +91,10 @@ var pieLegendFormatter = exports.pieLegendFormatter = function pieLegendFormatte
90
91
  alignItems: 'center',
91
92
  justifyContent: valueAlign == "left" ? "flex-start" : valueAlign == "right" ? "flex-end" : 'center'
92
93
  })
93
- }, /*#__PURE__*/React.createElement("span", null, data.y), showSuffix && /*#__PURE__*/React.createElement("span", {
94
+ }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(_components.SplitText, {
95
+ value: data.y,
96
+ config: splitConfig
97
+ })), showSuffix && /*#__PURE__*/React.createElement("span", {
94
98
  style: {
95
99
  whiteSpace: "nowrap",
96
100
  fontSize: fontSize,
@@ -390,11 +390,11 @@ function band() {
390
390
  };
391
391
  scale.range = function (_) {
392
392
  var _ref12;
393
- return arguments.length ? (_ref12 = (0, _slicedToArray2["default"])(_, 2), r0 = _ref12[0], r1 = _ref12[1], r0 = +r0, r1 = +r1, rescale()) : [r0, r1];
393
+ return arguments.length ? ((_ref12 = (0, _slicedToArray2["default"])(_, 2), r0 = _ref12[0], r1 = _ref12[1]), r0 = +r0, r1 = +r1, rescale()) : [r0, r1];
394
394
  };
395
395
  scale.rangeRound = function (_) {
396
396
  var _ref13;
397
- return _ref13 = (0, _slicedToArray2["default"])(_, 2), r0 = _ref13[0], r1 = _ref13[1], r0 = +r0, r1 = +r1, round = true, rescale();
397
+ return (_ref13 = (0, _slicedToArray2["default"])(_, 2), r0 = _ref13[0], r1 = _ref13[1]), r0 = +r0, r1 = +r1, round = true, rescale();
398
398
  };
399
399
  scale.bandwidth = function () {
400
400
  return bandwidth;
@@ -535,7 +535,7 @@ var getBandBackground = exports.getBandBackground = function getBandBackground(p
535
535
  var _pattern$backgroundSi = pattern.backgroundSize,
536
536
  backgroundSize = _pattern$backgroundSi === void 0 ? '100% 100%' : _pattern$backgroundSi,
537
537
  _pattern = (0, _objectWithoutProperties2["default"])(pattern, _excluded2);
538
- return 'center top / ' + backgroundSize + ' url("data:image/svg+xml,' + encodeURIComponent((0, _server.renderToStaticMarkup)(/*#__PURE__*/React.createElement(SvgBackground, {
538
+ return 'center top / ' + backgroundSize + ' url("data:image/svg+xml,' + encodeURIComponent((0, _server.renderToStaticMarkup)( /*#__PURE__*/React.createElement(SvgBackground, {
539
539
  fill: fill,
540
540
  pattern: _pattern
541
541
  }))) + '")';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/charts",
3
- "version": "1.6.23",
3
+ "version": "1.6.24",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -0,0 +1,70 @@
1
+ import React, { memo } from 'react';
2
+
3
+ type SplitConfig = {
4
+ fontFamily: string;
5
+ separator: string;
6
+ show: boolean;
7
+ splitCount: number;
8
+ style: 'custom' | 'default';
9
+ margin: {
10
+ left: number;
11
+ right: number;
12
+ };
13
+ };
14
+
15
+ interface SplitProps {
16
+ value: number | string;
17
+ config: SplitConfig;
18
+ }
19
+
20
+ export default memo((props: SplitProps) => {
21
+ const {
22
+ value,
23
+ config: {
24
+ fontFamily,
25
+ separator,
26
+ show,
27
+ splitCount,
28
+ style,
29
+ margin: { left, right },
30
+ },
31
+ } = props;
32
+
33
+ const stringValue = String(value);
34
+ const [intValueString, pointValueSting = ''] = stringValue.split('.');
35
+
36
+ const intArray: (string | '分隔符')[] = [];
37
+
38
+ const pointArray = [...pointValueSting];
39
+
40
+ [...intValueString].forEach((i, index) => {
41
+ !(intValueString.length - index - 1) || (intValueString.length - index - 1) % splitCount
42
+ ? intArray.push(i)
43
+ : (intArray.push(i), intArray.push('分隔符'));
44
+ });
45
+
46
+ return show ? (
47
+ <>
48
+ {intArray.map((v, index) => {
49
+ return (
50
+ <span
51
+ key={'int_' + index}
52
+ style={{
53
+ fontFamily: v === '分隔符' && style != 'default' ? fontFamily : 'inherit',
54
+ marginLeft: v === '分隔符' ? left : 0,
55
+ marginRight: v === '分隔符' ? right : 0,
56
+ }}
57
+ >
58
+ {v === '分隔符' ? (style == 'custom' && separator ? separator : ',') : v}
59
+ </span>
60
+ );
61
+ })}
62
+ {pointArray.length ? <span>.</span> : null}
63
+ {pointArray.map((v, index) => {
64
+ return <span key={'point_' + index}>{v}</span>;
65
+ })}
66
+ </>
67
+ ) : (
68
+ value
69
+ );
70
+ });
@@ -25,6 +25,7 @@ import TextOverflow from './TextOverflow';
25
25
  import BaseLine from './BaseLine';
26
26
  import Control from './Control';
27
27
  import { PieTooltip } from './PieTooltip';
28
+ import SplitText from './SplitText';
28
29
 
29
30
  const Area = Line;
30
31
  export {
@@ -55,5 +56,6 @@ export {
55
56
  Chart,
56
57
  ConicalGradient,
57
58
  BaseLine,
58
- PieTooltip
59
+ PieTooltip,
60
+ SplitText
59
61
  };
@@ -1,6 +1,6 @@
1
1
  import css from '../css/index.module.css';
2
2
  import { getFontStyle } from '../utils';
3
- import { TextOverflow } from '../components';
3
+ import { TextOverflow, SplitText } from '../components';
4
4
 
5
5
  export const pieLegendFormatter = (
6
6
  { displayName, data, percent, series: { color: seriesColor, icon="" } },
@@ -16,6 +16,7 @@ export const pieLegendFormatter = (
16
16
  x:valueX,
17
17
  y:valueY
18
18
  },
19
+ splitConfig,
19
20
  suffix: {
20
21
  show: showSuffix,
21
22
  text,
@@ -77,7 +78,7 @@ export const pieLegendFormatter = (
77
78
  justifyContent: valueAlign=="left"?"flex-start":valueAlign=="right"?"flex-end":'center',
78
79
  }}
79
80
  >
80
- <span>{data.y}</span>
81
+ <span><SplitText value={data.y} config={splitConfig} /></span>
81
82
  {showSuffix && (
82
83
  <span
83
84
  style={{