@vortex-ui/env-puzzle 2.0.0-beta.9 → 3.0.0-beta.2

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 (220) hide show
  1. package/README.md +46 -46
  2. package/lib/b-map/b-map.d.ts +1 -1
  3. package/lib/b-map/b-map.js +100 -162
  4. package/lib/b-map/b-map.js.map +1 -1
  5. package/lib/b-map/custom-overlay.js +17 -37
  6. package/lib/b-map/custom-overlay.js.map +1 -1
  7. package/lib/b-map/drawing.js +11 -25
  8. package/lib/b-map/drawing.js.map +1 -1
  9. package/lib/b-map/index.d.ts +2 -2
  10. package/lib/b-map/index.js +4 -16
  11. package/lib/b-map/index.js.map +1 -1
  12. package/lib/b-map/js/marker-clusterer.js +223 -339
  13. package/lib/b-map/js/marker-clusterer.js.map +1 -1
  14. package/lib/b-map/lushu.js +17 -36
  15. package/lib/b-map/lushu.js.map +1 -1
  16. package/lib/b-map/marker-clusterer.js +6 -14
  17. package/lib/b-map/marker-clusterer.js.map +1 -1
  18. package/lib/b-map/marker.js +32 -70
  19. package/lib/b-map/marker.js.map +1 -1
  20. package/lib/b-map/polygon.js +5 -13
  21. package/lib/b-map/polygon.js.map +1 -1
  22. package/lib/b-map/style/css.js.map +1 -1
  23. package/lib/b-map/style/index.js.map +1 -1
  24. package/lib/b-map/style/index.less +10 -10
  25. package/lib/create-modal/create-modal.d.ts +3 -2
  26. package/lib/create-modal/create-modal.js +163 -307
  27. package/lib/create-modal/create-modal.js.map +1 -1
  28. package/lib/create-modal/index.d.ts +1 -2
  29. package/lib/create-modal/index.js +2 -8
  30. package/lib/create-modal/index.js.map +1 -1
  31. package/lib/create-modal/style/css.js +0 -18
  32. package/lib/create-modal/style/css.js.map +1 -1
  33. package/lib/create-modal/style/index.css +2 -2
  34. package/lib/create-modal/style/index.d.ts +0 -9
  35. package/lib/create-modal/style/index.js +0 -18
  36. package/lib/create-modal/style/index.js.map +1 -1
  37. package/lib/create-modal/style/index.less +116 -119
  38. package/lib/global.less +5 -6
  39. package/lib/import-modal/import-modal.d.ts +3 -1
  40. package/lib/import-modal/import-modal.js +140 -204
  41. package/lib/import-modal/import-modal.js.map +1 -1
  42. package/lib/import-modal/index.js +2 -6
  43. package/lib/import-modal/index.js.map +1 -1
  44. package/lib/import-modal/style/css.js +0 -10
  45. package/lib/import-modal/style/css.js.map +1 -1
  46. package/lib/import-modal/style/index.d.ts +0 -5
  47. package/lib/import-modal/style/index.js +0 -10
  48. package/lib/import-modal/style/index.js.map +1 -1
  49. package/lib/import-modal/style/index.less +14 -15
  50. package/lib/index.js +1 -14
  51. package/lib/index.js.map +1 -1
  52. package/lib/interface/index.js.map +1 -1
  53. package/lib/mapv-Layer/Function.js +0 -2
  54. package/lib/mapv-Layer/Function.js.map +1 -1
  55. package/lib/mapv-Layer/index.js +2 -6
  56. package/lib/mapv-Layer/index.js.map +1 -1
  57. package/lib/mapv-Layer/mapv-Layer.js +19 -40
  58. package/lib/mapv-Layer/mapv-Layer.js.map +1 -1
  59. package/lib/mapv-Layer/style/css.js.map +1 -1
  60. package/lib/mapv-Layer/style/index.js.map +1 -1
  61. package/lib/percent/index.d.ts +1 -1
  62. package/lib/percent/index.js +2 -7
  63. package/lib/percent/index.js.map +1 -1
  64. package/lib/percent/interface.js.map +1 -1
  65. package/lib/percent/line-percent.js +20 -37
  66. package/lib/percent/line-percent.js.map +1 -1
  67. package/lib/percent/percent.js +20 -43
  68. package/lib/percent/percent.js.map +1 -1
  69. package/lib/percent/style/css.js.map +1 -1
  70. package/lib/percent/style/index.js.map +1 -1
  71. package/lib/percent/style/index.less +41 -41
  72. package/lib/scroll/index.js +2 -6
  73. package/lib/scroll/index.js.map +1 -1
  74. package/lib/scroll/scroll.d.ts +1 -1
  75. package/lib/scroll/scroll.js +19 -47
  76. package/lib/scroll/scroll.js.map +1 -1
  77. package/lib/scroll/style/css.js.map +1 -1
  78. package/lib/scroll/style/index.js.map +1 -1
  79. package/lib/scroll/style/index.less +3 -3
  80. package/lib/scroll-select/index.js +2 -6
  81. package/lib/scroll-select/index.js.map +1 -1
  82. package/lib/scroll-select/scrollSelect.d.ts +2 -1
  83. package/lib/scroll-select/scrollSelect.js +144 -218
  84. package/lib/scroll-select/scrollSelect.js.map +1 -1
  85. package/lib/scroll-select/style/css.js +0 -2
  86. package/lib/scroll-select/style/css.js.map +1 -1
  87. package/lib/scroll-select/style/index.d.ts +0 -1
  88. package/lib/scroll-select/style/index.js +0 -2
  89. package/lib/scroll-select/style/index.js.map +1 -1
  90. package/lib/scroll-select/style/index.less +7 -7
  91. package/lib/style/color.less +1 -1
  92. package/lib/table/index.js +2 -6
  93. package/lib/table/index.js.map +1 -1
  94. package/lib/table/style/css.js +0 -2
  95. package/lib/table/style/css.js.map +1 -1
  96. package/lib/table/style/index.d.ts +0 -1
  97. package/lib/table/style/index.js +0 -2
  98. package/lib/table/style/index.js.map +1 -1
  99. package/lib/table/table.d.ts +1 -1
  100. package/lib/table/table.js +24 -56
  101. package/lib/table/table.js.map +1 -1
  102. package/lib/template/action.d.ts +3 -1
  103. package/lib/template/action.js +93 -132
  104. package/lib/template/action.js.map +1 -1
  105. package/lib/template/card-table.d.ts +7 -6
  106. package/lib/template/card-table.js +40 -82
  107. package/lib/template/card-table.js.map +1 -1
  108. package/lib/template/card.d.ts +1 -1
  109. package/lib/template/card.js +20 -38
  110. package/lib/template/card.js.map +1 -1
  111. package/lib/template/check-row.d.ts +2 -1
  112. package/lib/template/check-row.js +7 -12
  113. package/lib/template/check-row.js.map +1 -1
  114. package/lib/template/field.js +8 -24
  115. package/lib/template/field.js.map +1 -1
  116. package/lib/template/filter.d.ts +1 -2
  117. package/lib/template/filter.js +25 -63
  118. package/lib/template/filter.js.map +1 -1
  119. package/lib/template/icon.js +4 -15
  120. package/lib/template/icon.js.map +1 -1
  121. package/lib/template/index.d.ts +2 -3
  122. package/lib/template/index.js +4 -12
  123. package/lib/template/index.js.map +1 -1
  124. package/lib/template/interface.js.map +1 -1
  125. package/lib/template/renderColumnButtons.js +80 -104
  126. package/lib/template/renderColumnButtons.js.map +1 -1
  127. package/lib/template/style/action.css +3 -2
  128. package/lib/template/style/action.less +74 -71
  129. package/lib/template/style/card.css +2 -2
  130. package/lib/template/style/card.less +87 -88
  131. package/lib/template/style/check-row.less +27 -27
  132. package/lib/template/style/css.js +0 -36
  133. package/lib/template/style/css.js.map +1 -1
  134. package/lib/template/style/field.less +11 -11
  135. package/lib/template/style/filter.css +0 -29
  136. package/lib/template/style/filter.less +46 -72
  137. package/lib/template/style/icon.less +7 -7
  138. package/lib/template/style/index.css +8 -42
  139. package/lib/template/style/index.d.ts +0 -18
  140. package/lib/template/style/index.js +0 -36
  141. package/lib/template/style/index.js.map +1 -1
  142. package/lib/template/style/index.less +48 -49
  143. package/lib/template/style/table.css +0 -6
  144. package/lib/template/style/table.less +79 -91
  145. package/lib/template/table.d.ts +7 -5
  146. package/lib/template/table.js +23 -45
  147. package/lib/template/table.js.map +1 -1
  148. package/lib/template/template.d.ts +4 -4
  149. package/lib/template/template.js +134 -258
  150. package/lib/template/template.js.map +1 -1
  151. package/lib/template/toolbar.d.ts +1 -1
  152. package/lib/template/toolbar.js +57 -63
  153. package/lib/template/toolbar.js.map +1 -1
  154. package/lib/to-map/container.js +58 -112
  155. package/lib/to-map/container.js.map +1 -1
  156. package/lib/to-map/draw-area.js +14 -34
  157. package/lib/to-map/draw-area.js.map +1 -1
  158. package/lib/to-map/index.d.ts +1 -1
  159. package/lib/to-map/index.js +2 -7
  160. package/lib/to-map/index.js.map +1 -1
  161. package/lib/to-map/style/css.js +0 -2
  162. package/lib/to-map/style/css.js.map +1 -1
  163. package/lib/to-map/style/index.d.ts +0 -1
  164. package/lib/to-map/style/index.js +0 -2
  165. package/lib/to-map/style/index.js.map +1 -1
  166. package/lib/to-map/style/index.less +86 -86
  167. package/lib/to-map/to-map.js +22 -49
  168. package/lib/to-map/to-map.js.map +1 -1
  169. package/lib/upload/index.js +2 -6
  170. package/lib/upload/index.js.map +1 -1
  171. package/lib/upload/style/css.js +0 -5
  172. package/lib/upload/style/css.js.map +1 -1
  173. package/lib/upload/style/index.d.ts +0 -2
  174. package/lib/upload/style/index.js +0 -5
  175. package/lib/upload/style/index.js.map +1 -1
  176. package/lib/upload/upload.d.ts +4 -1
  177. package/lib/upload/upload.js +164 -245
  178. package/lib/upload/upload.js.map +1 -1
  179. package/lib/use-simple-res/demos/index.d.ts +2 -1
  180. package/lib/use-simple-res/demos/index.js +31 -59
  181. package/lib/use-simple-res/demos/index.js.map +1 -1
  182. package/lib/use-simple-res/index.d.ts +0 -1
  183. package/lib/use-simple-res/index.js +61 -75
  184. package/lib/use-simple-res/index.js.map +1 -1
  185. package/lib/use-simple-res/style/css.js.map +1 -1
  186. package/lib/use-simple-res/style/index.js.map +1 -1
  187. package/lib/utils/dom-util.js +8 -27
  188. package/lib/utils/dom-util.js.map +1 -1
  189. package/lib/utils/request-util.d.ts +10 -1
  190. package/lib/utils/request-util.js +170 -45
  191. package/lib/utils/request-util.js.map +1 -1
  192. package/lib/utils/string-util.d.ts +2 -0
  193. package/lib/utils/string-util.js +34 -16
  194. package/lib/utils/string-util.js.map +1 -1
  195. package/lib/view-modal/index.d.ts +0 -1
  196. package/lib/view-modal/index.js +2 -8
  197. package/lib/view-modal/index.js.map +1 -1
  198. package/lib/view-modal/style/css.js +0 -12
  199. package/lib/view-modal/style/css.js.map +1 -1
  200. package/lib/view-modal/style/index.css +3 -41
  201. package/lib/view-modal/style/index.d.ts +0 -7
  202. package/lib/view-modal/style/index.js +0 -12
  203. package/lib/view-modal/style/index.js.map +1 -1
  204. package/lib/view-modal/style/index.less +42 -57
  205. package/lib/view-modal/view-modal.d.ts +1 -1
  206. package/lib/view-modal/view-modal.js +36 -86
  207. package/lib/view-modal/view-modal.js.map +1 -1
  208. package/package.json +157 -143
  209. package/lib/style/css.js +0 -13
  210. package/lib/style/css.js.map +0 -1
  211. package/lib/style/darkGreen.css +0 -719
  212. package/lib/style/darkGreen.less +0 -482
  213. package/lib/style/index.d.ts +0 -2
  214. package/lib/style/index.js +0 -13
  215. package/lib/style/index.js.map +0 -1
  216. package/lib/template/vtx-search/index.d.ts +0 -2
  217. package/lib/template/vtx-search/index.js +0 -126
  218. package/lib/template/vtx-search/index.js.map +0 -1
  219. package/lib/template/vtx-search/style/index.css +0 -92
  220. package/lib/template/vtx-search/style/index.less +0 -92
@@ -1,47 +1,37 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _react = _interopRequireWildcard(require("react"));
11
-
12
9
  var _classnames = _interopRequireDefault(require("classnames"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
-
16
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
-
18
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
20
12
  var LinePercenet = function LinePercenet(props) {
21
13
  var title = props.title,
22
- value = props.value,
23
- suffix = props.suffix,
24
- lineWidth = props.lineWidth,
25
- className = props.className,
26
- style = props.style,
27
- _props$all = props.all,
28
- all = _props$all === void 0 ? 100 : _props$all;
14
+ value = props.value,
15
+ suffix = props.suffix,
16
+ lineWidth = props.lineWidth,
17
+ className = props.className,
18
+ style = props.style,
19
+ _props$all = props.all,
20
+ all = _props$all === void 0 ? 100 : _props$all;
29
21
  var wrapRef = (0, _react.useRef)(null);
30
22
  var canvasRef = (0, _react.useRef)(null);
31
-
32
23
  _react["default"].useEffect(function () {
33
24
  if (!wrapRef.current || !canvasRef.current) {
34
25
  return;
35
26
  }
36
-
37
27
  var canvasWidth = wrapRef.current.clientWidth;
38
28
  var canvasHeight = wrapRef.current.clientHeight;
39
29
  canvasRef.current.width = canvasWidth;
40
30
  canvasRef.current.height = canvasHeight;
41
- var ctx = canvasRef.current.getContext('2d'); // 擦除
42
-
43
- ctx.clearRect(0, 0, canvasWidth, canvasHeight); // render base line
44
-
31
+ var ctx = canvasRef.current.getContext('2d');
32
+ // 擦除
33
+ ctx.clearRect(0, 0, canvasWidth, canvasHeight);
34
+ // render base line
45
35
  var lineHeight = 10;
46
36
  var topLeftPointX = 5;
47
37
  var topLeftPointY = canvasHeight - lineHeight;
@@ -55,13 +45,11 @@ var LinePercenet = function LinePercenet(props) {
55
45
  ctx.fill();
56
46
  var itemColLength = 10;
57
47
  var itemColPadding = 5; // 每个小柱子的间距
58
-
59
48
  var totalCol = Math.floor(canvasWidth / (itemColLength + itemColPadding)) - 1;
60
49
  var perValue = all / totalCol;
61
50
  var activeValueCount = Math.floor(value / perValue);
62
51
  var i = 0;
63
-
64
- var renderItemCol = function renderItemCol() {
52
+ var _renderItemCol = function renderItemCol() {
65
53
  if (i < activeValueCount) {
66
54
  ctx.beginPath();
67
55
  var tilt = 12;
@@ -75,25 +63,22 @@ var LinePercenet = function LinePercenet(props) {
75
63
  ctx.fillStyle = "rgba(70, 181, 192, ".concat(i / activeValueCount / 2 + 0.5, ")");
76
64
  ctx.fill();
77
65
  setTimeout(function () {
78
- renderItemCol();
66
+ _renderItemCol();
79
67
  }, 100);
80
68
  }
81
-
82
69
  i += 1;
83
70
  };
84
-
85
- renderItemCol();
71
+ _renderItemCol();
86
72
  }, [value]);
87
-
88
73
  return /*#__PURE__*/_react["default"].createElement("div", {
89
74
  style: style,
90
75
  className: (0, _classnames["default"])(className, 'env-percent-line')
91
- }, title && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
76
+ }, title && (/*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
92
77
  className: "env-percent-line__name"
93
78
  }, title), /*#__PURE__*/_react["default"].createElement("img", {
94
79
  className: "env-percent-line__arrow",
95
80
  src: require('./images/icon-arrow.png')
96
- })), /*#__PURE__*/_react["default"].createElement("div", {
81
+ }))), /*#__PURE__*/_react["default"].createElement("div", {
97
82
  ref: wrapRef,
98
83
  style: {
99
84
  width: lineWidth
@@ -105,10 +90,8 @@ var LinePercenet = function LinePercenet(props) {
105
90
  className: "env-percent-line__suffix"
106
91
  }, suffix));
107
92
  };
108
-
109
93
  LinePercenet.defaultProps = {
110
94
  lineWidth: 300
111
95
  };
112
- var _default = LinePercenet;
113
- exports["default"] = _default;
96
+ var _default = exports["default"] = LinePercenet;
114
97
  //# sourceMappingURL=line-percent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"line-percent.js","names":["LinePercenet","props","title","value","suffix","lineWidth","className","style","all","wrapRef","useRef","canvasRef","React","useEffect","current","canvasWidth","clientWidth","canvasHeight","clientHeight","width","height","ctx","getContext","clearRect","lineHeight","topLeftPointX","topLeftPointY","lineLength","moveTo","lineTo","closePath","fillStyle","fill","itemColLength","itemColPadding","totalCol","Math","floor","perValue","activeValueCount","i","renderItemCol","beginPath","tilt","itemTopLeftPointX","itemTopLeftPointY","setTimeout","createElement","classnames","Fragment","src","require","ref","defaultProps"],"sources":["percent/line-percent.js"],"sourcesContent":["import React, { useRef } from 'react';\nimport classnames from 'classnames';\nconst LinePercenet = (props) => {\n const { title, value, suffix, lineWidth, className, style, all = 100, } = props;\n const wrapRef = useRef(null);\n const canvasRef = useRef(null);\n React.useEffect(() => {\n if (!wrapRef.current || !canvasRef.current) {\n return;\n }\n const canvasWidth = wrapRef.current.clientWidth;\n const canvasHeight = wrapRef.current.clientHeight;\n canvasRef.current.width = canvasWidth;\n canvasRef.current.height = canvasHeight;\n const ctx = canvasRef.current.getContext('2d');\n // 擦除\n ctx.clearRect(0, 0, canvasWidth, canvasHeight);\n // render base line\n const lineHeight = 10;\n const topLeftPointX = 5;\n const topLeftPointY = canvasHeight - lineHeight;\n const lineLength = canvasWidth - topLeftPointX - 20;\n ctx.moveTo(topLeftPointX, topLeftPointY);\n ctx.lineTo(topLeftPointX + lineLength, topLeftPointY);\n ctx.lineTo(lineLength, topLeftPointY + lineHeight);\n ctx.lineTo(0, topLeftPointY + lineHeight);\n ctx.closePath();\n ctx.fillStyle = 'rgba(22, 61, 92, 1)';\n ctx.fill();\n const itemColLength = 10;\n const itemColPadding = 5; // 每个小柱子的间距\n const totalCol = Math.floor(canvasWidth / (itemColLength + itemColPadding)) - 1;\n const perValue = all / totalCol;\n const activeValueCount = Math.floor(value / perValue);\n let i = 0;\n const renderItemCol = () => {\n if (i < activeValueCount) {\n ctx.beginPath();\n const tilt = 12;\n const itemTopLeftPointX = i * (itemColLength + itemColPadding) + tilt;\n const itemTopLeftPointY = 0;\n ctx.moveTo(itemTopLeftPointX, itemTopLeftPointY);\n ctx.lineTo(itemTopLeftPointX + itemColLength, itemTopLeftPointY);\n ctx.lineTo(itemTopLeftPointX + itemColLength - tilt, canvasHeight);\n ctx.lineTo(itemTopLeftPointX - tilt, canvasHeight);\n ctx.closePath();\n ctx.fillStyle = `rgba(70, 181, 192, ${i / activeValueCount / 2 + 0.5})`;\n ctx.fill();\n setTimeout(() => {\n renderItemCol();\n }, 100);\n }\n i += 1;\n };\n renderItemCol();\n }, [value]);\n return (React.createElement(\"div\", { style: style, className: classnames(className, 'env-percent-line') },\n title && (React.createElement(React.Fragment, null,\n React.createElement(\"div\", { className: \"env-percent-line__name\" }, title),\n React.createElement(\"img\", { className: \"env-percent-line__arrow\", src: require('./images/icon-arrow.png') }))),\n React.createElement(\"div\", { ref: wrapRef, style: { width: lineWidth }, className: \"env-percent-line__value\" },\n React.createElement(\"canvas\", { ref: canvasRef })),\n suffix && React.createElement(\"div\", { className: \"env-percent-line__suffix\" }, suffix)));\n};\nLinePercenet.defaultProps = {\n lineWidth: 300,\n};\nexport default LinePercenet;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;;;;;;;AACA,IAAMA,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAAW;EAC5B,IAAQC,KAA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4B;EACxBhD,SAAS,EAAE;AADa,CAA5B;eAGeL,Y"}
1
+ {"version":3,"file":"line-percent.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","e","__esModule","t","WeakMap","r","n","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","LinePercenet","props","title","value","suffix","lineWidth","className","style","_props$all","all","wrapRef","useRef","canvasRef","React","useEffect","current","canvasWidth","clientWidth","canvasHeight","clientHeight","width","height","ctx","getContext","clearRect","lineHeight","topLeftPointX","topLeftPointY","lineLength","moveTo","lineTo","closePath","fillStyle","fill","itemColLength","itemColPadding","totalCol","Math","floor","perValue","activeValueCount","renderItemCol","beginPath","tilt","itemTopLeftPointX","itemTopLeftPointY","concat","setTimeout","createElement","classnames","Fragment","src","ref","defaultProps","_default","exports"],"sources":["percent/line-percent.js"],"sourcesContent":["import React, { useRef } from 'react';\nimport classnames from 'classnames';\nconst LinePercenet = (props) => {\n const { title, value, suffix, lineWidth, className, style, all = 100, } = props;\n const wrapRef = useRef(null);\n const canvasRef = useRef(null);\n React.useEffect(() => {\n if (!wrapRef.current || !canvasRef.current) {\n return;\n }\n const canvasWidth = wrapRef.current.clientWidth;\n const canvasHeight = wrapRef.current.clientHeight;\n canvasRef.current.width = canvasWidth;\n canvasRef.current.height = canvasHeight;\n const ctx = canvasRef.current.getContext('2d');\n // 擦除\n ctx.clearRect(0, 0, canvasWidth, canvasHeight);\n // render base line\n const lineHeight = 10;\n const topLeftPointX = 5;\n const topLeftPointY = canvasHeight - lineHeight;\n const lineLength = canvasWidth - topLeftPointX - 20;\n ctx.moveTo(topLeftPointX, topLeftPointY);\n ctx.lineTo(topLeftPointX + lineLength, topLeftPointY);\n ctx.lineTo(lineLength, topLeftPointY + lineHeight);\n ctx.lineTo(0, topLeftPointY + lineHeight);\n ctx.closePath();\n ctx.fillStyle = 'rgba(22, 61, 92, 1)';\n ctx.fill();\n const itemColLength = 10;\n const itemColPadding = 5; // 每个小柱子的间距\n const totalCol = Math.floor(canvasWidth / (itemColLength + itemColPadding)) - 1;\n const perValue = all / totalCol;\n const activeValueCount = Math.floor(value / perValue);\n let i = 0;\n const renderItemCol = () => {\n if (i < activeValueCount) {\n ctx.beginPath();\n const tilt = 12;\n const itemTopLeftPointX = i * (itemColLength + itemColPadding) + tilt;\n const itemTopLeftPointY = 0;\n ctx.moveTo(itemTopLeftPointX, itemTopLeftPointY);\n ctx.lineTo(itemTopLeftPointX + itemColLength, itemTopLeftPointY);\n ctx.lineTo(itemTopLeftPointX + itemColLength - tilt, canvasHeight);\n ctx.lineTo(itemTopLeftPointX - tilt, canvasHeight);\n ctx.closePath();\n ctx.fillStyle = `rgba(70, 181, 192, ${i / activeValueCount / 2 + 0.5})`;\n ctx.fill();\n setTimeout(() => {\n renderItemCol();\n }, 100);\n }\n i += 1;\n };\n renderItemCol();\n }, [value]);\n return (React.createElement(\"div\", { style: style, className: classnames(className, 'env-percent-line') },\n title && (React.createElement(React.Fragment, null,\n React.createElement(\"div\", { className: \"env-percent-line__name\" }, title),\n React.createElement(\"img\", { className: \"env-percent-line__arrow\", src: require('./images/icon-arrow.png') }))),\n React.createElement(\"div\", { ref: wrapRef, style: { width: lineWidth }, className: \"env-percent-line__value\" },\n React.createElement(\"canvas\", { ref: canvasRef })),\n suffix && React.createElement(\"div\", { className: \"env-percent-line__suffix\" }, suffix)));\n};\nLinePercenet.defaultProps = {\n lineWidth: 300,\n};\nexport default LinePercenet;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAoC,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF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C;EACnB,CAAC,EAAE,CAACtC,KAAK,CAAC,CAAC;EACX,oBAAQU,iBAAK,CAACmC,aAAa,CAAC,KAAK,EAAE;IAAEzC,KAAK,EAAEA,KAAK;IAAED,SAAS,EAAE,IAAA2C,sBAAU,EAAC3C,SAAS,EAAE,kBAAkB;EAAE,CAAC,EACrGJ,KAAK,kBAAKW,iBAAK,CAACmC,aAAa,CAACnC,iBAAK,CAACqC,QAAQ,EAAE,IAAI,eAC9CrC,iBAAK,CAACmC,aAAa,CAAC,KAAK,EAAE;IAAE1C,SAAS,EAAE;EAAyB,CAAC,EAAEJ,KAAK,CAAC,eAC1EW,iBAAK,CAACmC,aAAa,CAAC,KAAK,EAAE;IAAE1C,SAAS,EAAE,yBAAyB;IAAE6C,GAAG,EAAE1E,OAAO,CAAC,yBAAyB;EAAE,CAAC,CAAC,CAAC,CAAC,eACnHoC,iBAAK,CAACmC,aAAa,CAAC,KAAK,EAAE;IAAEI,GAAG,EAAE1C,OAAO;IAAEH,KAAK,EAAE;MAAEa,KAAK,EAAEf;IAAU,CAAC;IAAEC,SAAS,EAAE;EAA0B,CAAC,eAC1GO,iBAAK,CAACmC,aAAa,CAAC,QAAQ,EAAE;IAAEI,GAAG,EAAExC;EAAU,CAAC,CAAC,CAAC,EACtDR,MAAM,iBAAIS,iBAAK,CAACmC,aAAa,CAAC,KAAK,EAAE;IAAE1C,SAAS,EAAE;EAA2B,CAAC,EAAEF,MAAM,CAAC,CAAC;AAChG,CAAC;AACDJ,YAAY,CAACqD,YAAY,GAAG;EACxBhD,SAAS,EAAE;AACf,CAAC;AAAC,IAAAiD,QAAA,GAAAC,OAAA,cACavD,YAAY","ignoreList":[]}
@@ -1,35 +1,26 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var _classnames = _interopRequireDefault(require("classnames"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
-
16
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
-
18
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
20
12
  var THEME_COLOR = '#4EF6FC';
21
-
22
13
  var Percent = function Percent(props) {
23
14
  var wrapRef = React.useRef(null);
24
15
  var canvasRef = React.useRef(null);
25
16
  var realValue = props.value,
26
- title = props.title,
27
- style = props.style,
28
- className = props.className,
29
- _props$unit = props.unit,
30
- unit = _props$unit === void 0 ? '%' : _props$unit,
31
- _props$all = props.all,
32
- all = _props$all === void 0 ? 100 : _props$all;
17
+ title = props.title,
18
+ style = props.style,
19
+ className = props.className,
20
+ _props$unit = props.unit,
21
+ unit = _props$unit === void 0 ? '%' : _props$unit,
22
+ _props$all = props.all,
23
+ all = _props$all === void 0 ? 100 : _props$all;
33
24
  var value = realValue;
34
25
  value < 0 && (value = 0);
35
26
  value > all && (value = all);
@@ -37,40 +28,34 @@ var Percent = function Percent(props) {
37
28
  if (!canvasRef) {
38
29
  return;
39
30
  }
40
-
41
31
  var canvasWidth = wrapRef.current.clientWidth;
42
32
  var canvasHeight = wrapRef.current.clientHeight;
43
33
  var current = canvasRef.current;
44
34
  var ctx = canvasRef.current.getContext('2d');
45
35
  current.width = canvasWidth;
46
- current.height = canvasHeight; // 擦除
47
-
36
+ current.height = canvasHeight;
37
+ // 擦除
48
38
  ctx.clearRect(0, 0, canvasWidth, canvasHeight);
49
39
  var padding = canvasWidth * 0.05; // 距离上下左右的距离;
50
-
51
40
  var maxRadius = (canvasWidth - 2 * padding) / 2; // 最大可使用半径
52
-
53
41
  var pointLength = 10; // 圆弧边上柱子的长度
54
-
55
42
  var clearance = canvasWidth * 0.1; // 两个圆之间的间隙
56
-
57
43
  var innerRadius = maxRadius - pointLength - clearance;
58
44
  var circleCenterX = canvasWidth / 2;
59
- var circleCenterY = maxRadius + padding; // 渲染内部圆弧
60
-
45
+ var circleCenterY = maxRadius + padding;
46
+ // 渲染内部圆弧
61
47
  ctx.arc(circleCenterX, circleCenterY, innerRadius, Math.PI, 0);
62
48
  ctx.lineWidth = 4;
63
49
  ctx.strokeStyle = THEME_COLOR;
64
50
  ctx.shadowColor = THEME_COLOR;
65
51
  ctx.shadowOffsetY = -3;
66
52
  ctx.shadowBlur = 8;
67
- ctx.stroke(); // 渲染边上的柱子
68
-
53
+ ctx.stroke();
54
+ // 渲染边上的柱子
69
55
  var total = 30;
70
56
  var angle = Math.PI / total;
71
57
  var perValue = all / total;
72
58
  var activeCount = Math.floor(value / perValue);
73
-
74
59
  var renderColumn = function renderColumn(i, color) {
75
60
  ctx.beginPath();
76
61
  var currentAngle = angle * i;
@@ -83,35 +68,29 @@ var Percent = function Percent(props) {
83
68
  ctx.strokeStyle = color;
84
69
  ctx.stroke();
85
70
  };
86
-
87
71
  for (var i = 0; i <= total; i++) {
88
72
  renderColumn(i, '#ccc');
89
73
  }
90
-
91
74
  var timer = null;
92
75
  var currentActiveCount = 0;
93
-
94
- var renderActiveColumn = function renderActiveColumn() {
76
+ var _renderActiveColumn = function renderActiveColumn() {
95
77
  if (currentActiveCount <= activeCount) {
96
78
  renderColumn(currentActiveCount, THEME_COLOR);
97
79
  currentActiveCount += 1;
98
80
  timer = setTimeout(function () {
99
- renderActiveColumn();
81
+ _renderActiveColumn();
100
82
  }, 100);
101
83
  }
102
84
  };
103
-
104
85
  if (activeCount > 0) {
105
- renderActiveColumn();
86
+ _renderActiveColumn();
106
87
  }
107
-
108
88
  if (title) {
109
89
  // 渲染文字
110
90
  ctx.font = "bold 18px Arial";
111
91
  ctx.fillStyle = THEME_COLOR;
112
92
  ctx.fillText(title, (ctx.canvas.width - ctx.measureText(title).width) / 2, circleCenterY + 40);
113
93
  }
114
-
115
94
  ctx.font = "12px Arial";
116
95
  ctx.fillStyle = '#ffffff';
117
96
  ctx.fillText('0', padding, circleCenterY + 14);
@@ -133,7 +112,5 @@ var Percent = function Percent(props) {
133
112
  className: "env-percent-semicircle__value"
134
113
  }, realValue, unit));
135
114
  };
136
-
137
- var _default = Percent;
138
- exports["default"] = _default;
115
+ var _default = exports["default"] = Percent;
139
116
  //# sourceMappingURL=percent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"percent.js","names":["THEME_COLOR","Percent","props","wrapRef","React","useRef","canvasRef","realValue","value","title","style","className","unit","all","useEffect","canvasWidth","current","clientWidth","canvasHeight","clientHeight","ctx","getContext","width","height","clearRect","padding","maxRadius","pointLength","clearance","innerRadius","circleCenterX","circleCenterY","arc","Math","PI","lineWidth","strokeStyle","shadowColor","shadowOffsetY","shadowBlur","stroke","total","angle","perValue","activeCount","floor","renderColumn","i","color","beginPath","currentAngle","moveTo","cos","sin","lineTo","lineCap","timer","currentActiveCount","renderActiveColumn","setTimeout","font","fillStyle","fillText","canvas","measureText","textAlign","clearTimeout","createElement","classnames","ref"],"sources":["percent/percent.js"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nconst THEME_COLOR = '#4EF6FC';\nconst Percent = (props) => {\n const wrapRef = React.useRef(null);\n const canvasRef = React.useRef(null);\n const { value: realValue, title, style, className, unit = '%', all = 100, } = props;\n let value = realValue;\n value < 0 && (value = 0);\n value > all && (value = all);\n React.useEffect(() => {\n if (!canvasRef) {\n return;\n }\n const canvasWidth = wrapRef.current.clientWidth;\n const canvasHeight = wrapRef.current.clientHeight;\n const { current } = canvasRef;\n const ctx = canvasRef.current.getContext('2d');\n current.width = canvasWidth;\n current.height = canvasHeight;\n // 擦除\n ctx.clearRect(0, 0, canvasWidth, canvasHeight);\n const padding = canvasWidth * 0.05; // 距离上下左右的距离;\n const maxRadius = (canvasWidth - 2 * padding) / 2; // 最大可使用半径\n const pointLength = 10; // 圆弧边上柱子的长度\n const clearance = canvasWidth * 0.1; // 两个圆之间的间隙\n const innerRadius = maxRadius - pointLength - clearance;\n const circleCenterX = canvasWidth / 2;\n const circleCenterY = maxRadius + padding;\n // 渲染内部圆弧\n ctx.arc(circleCenterX, circleCenterY, innerRadius, Math.PI, 0);\n ctx.lineWidth = 4;\n ctx.strokeStyle = THEME_COLOR;\n ctx.shadowColor = THEME_COLOR;\n ctx.shadowOffsetY = -3;\n ctx.shadowBlur = 8;\n ctx.stroke();\n // 渲染边上的柱子\n const total = 30;\n const angle = Math.PI / total;\n const perValue = all / total;\n const activeCount = Math.floor(value / perValue);\n const renderColumn = (i, color) => {\n ctx.beginPath();\n const currentAngle = angle * i;\n ctx.moveTo(circleCenterX - maxRadius * Math.cos(currentAngle), circleCenterY - maxRadius * Math.sin(currentAngle));\n ctx.lineTo(circleCenterX\n - (innerRadius + clearance) * Math.cos(currentAngle), circleCenterY\n - (innerRadius + clearance) * Math.sin(currentAngle));\n ctx.shadowOffsetY = 0;\n ctx.shadowBlur = 0;\n ctx.lineWidth = 3;\n ctx.lineCap = 'round';\n ctx.strokeStyle = color;\n ctx.stroke();\n };\n for (let i = 0; i <= total; i++) {\n renderColumn(i, '#ccc');\n }\n let timer = null;\n let currentActiveCount = 0;\n const renderActiveColumn = () => {\n if (currentActiveCount <= activeCount) {\n renderColumn(currentActiveCount, THEME_COLOR);\n currentActiveCount += 1;\n timer = setTimeout(() => {\n renderActiveColumn();\n }, 100);\n }\n };\n if (activeCount > 0) {\n renderActiveColumn();\n }\n if (title) {\n // 渲染文字\n ctx.font = `bold 18px Arial`;\n ctx.fillStyle = THEME_COLOR;\n ctx.fillText(title, (ctx.canvas.width - ctx.measureText(title).width) / 2, circleCenterY + 40);\n }\n ctx.font = `12px Arial`;\n ctx.fillStyle = '#ffffff';\n ctx.fillText('0', padding, circleCenterY + 14);\n ctx.textAlign = 'right';\n ctx.fillText(`${all}${unit}`, canvasWidth - padding, circleCenterY + 14);\n ctx.textAlign = 'start';\n return () => {\n clearTimeout(timer);\n timer = null;\n };\n }, [value]);\n return (React.createElement(\"div\", { className: classnames(className, 'env-percent-semicircle'), style: style, ref: wrapRef },\n React.createElement(\"canvas\", { ref: canvasRef }),\n React.createElement(\"div\", { className: \"env-percent-semicircle__value\" },\n realValue,\n unit)));\n};\nexport default Percent;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;;;;;;;AACA,IAAMA,WAAW,GAAG,SAApB;;AACA,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,KAAD,EAAW;EACvB,IAAMC,OAAO,GAAGC,KAAK,CAACC,MAAN,CAAa,IAAb,CAAhB;EACA,IAAMC,SAAS,GAAGF,KAAK,CAACC,MAAN,CAAa,IAAb,CAAlB;EACA,IAAeE,SAAf,GAA8EL,KAA9E,CAAQM,KAAR;EAAA,IAA0BC,KAA1B,GAA8EP,KAA9E,CAA0BO,KAA1B;EAAA,IAAiCC,KAAjC,GAA8ER,KAA9E,CAAiCQ,KAAjC;EAAA,IAAwCC,SAAxC,GAA8ET,KAA9E,CAAwCS,SAAxC;EAAA,kBAA8ET,KAA9E,CAAmDU,IAAnD;EAAA,IAAmDA,IAAnD,4BAA0D,GAA1D;EAAA,iBAA8EV,KAA9E,CAA+DW,GAA/D;EAAA,IAA+DA,GAA/D,2BAAqE,GAArE;EACA,IAAIL,KAAK,GAAGD,SAAZ;EACAC,KAAK,GAAG,CAAR,KAAcA,KAAK,GAAG,CAAtB;EACAA,KAAK,GAAGK,GAAR,KAAgBL,KAAK,GAAGK,GAAxB;EACAT,KAAK,CAACU,SAAN,CAAgB,YAAM;IAClB,IAAI,CAACR,SAAL,EAAgB;MACZ;IACH;;IACD,IAAMS,WAAW,GAAGZ,OAAO,CAACa,OAAR,CAAgBC,WAApC;IACA,IAAMC,YAAY,GAAGf,OAAO,CAACa,OAAR,CAAgBG,YAArC;IACA,IAAQH,OAAR,GAAoBV,SAApB,CAAQU,OAAR;IACA,IAAMI,GAAG,GAAGd,SAAS,CAACU,OAAV,CAAkBK,UAAlB,CAA6B,IAA7B,CAAZ;IACAL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R;AAKH,CA5FD;;eA6FeX,O"}
1
+ {"version":3,"file":"percent.js","names":["React","_interopRequireWildcard","require","_classnames","_interopRequireDefault","e","__esModule","t","WeakMap","r","n","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","THEME_COLOR","Percent","props","wrapRef","useRef","canvasRef","realValue","value","title","style","className","_props$unit","unit","_props$all","all","useEffect","canvasWidth","current","clientWidth","canvasHeight","clientHeight","ctx","getContext","width","height","clearRect","padding","maxRadius","pointLength","clearance","innerRadius","circleCenterX","circleCenterY","arc","Math","PI","lineWidth","strokeStyle","shadowColor","shadowOffsetY","shadowBlur","stroke","total","angle","perValue","activeCount","floor","renderColumn","color","beginPath","currentAngle","moveTo","cos","sin","lineTo","lineCap","timer","currentActiveCount","renderActiveColumn","setTimeout","font","fillStyle","fillText","canvas","measureText","textAlign","concat","clearTimeout","createElement","classnames","ref","_default","exports"],"sources":["percent/percent.js"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nconst THEME_COLOR = '#4EF6FC';\nconst Percent = (props) => {\n const wrapRef = React.useRef(null);\n const canvasRef = React.useRef(null);\n const { value: realValue, title, style, className, unit = '%', all = 100, } = props;\n let value = realValue;\n value < 0 && (value = 0);\n value > all && (value = all);\n React.useEffect(() => {\n if (!canvasRef) {\n return;\n }\n const canvasWidth = wrapRef.current.clientWidth;\n const canvasHeight = wrapRef.current.clientHeight;\n const { current } = canvasRef;\n const ctx = canvasRef.current.getContext('2d');\n current.width = canvasWidth;\n current.height = canvasHeight;\n // 擦除\n ctx.clearRect(0, 0, canvasWidth, canvasHeight);\n const padding = canvasWidth * 0.05; // 距离上下左右的距离;\n const maxRadius = (canvasWidth - 2 * padding) / 2; // 最大可使用半径\n const pointLength = 10; // 圆弧边上柱子的长度\n const clearance = canvasWidth * 0.1; // 两个圆之间的间隙\n const innerRadius = maxRadius - pointLength - clearance;\n const circleCenterX = canvasWidth / 2;\n const circleCenterY = maxRadius + padding;\n // 渲染内部圆弧\n ctx.arc(circleCenterX, circleCenterY, innerRadius, Math.PI, 0);\n ctx.lineWidth = 4;\n ctx.strokeStyle = THEME_COLOR;\n ctx.shadowColor = THEME_COLOR;\n ctx.shadowOffsetY = -3;\n ctx.shadowBlur = 8;\n ctx.stroke();\n // 渲染边上的柱子\n const total = 30;\n const angle = Math.PI / total;\n const perValue = all / total;\n const activeCount = Math.floor(value / perValue);\n const renderColumn = (i, color) => {\n ctx.beginPath();\n const currentAngle = angle * i;\n ctx.moveTo(circleCenterX - maxRadius * Math.cos(currentAngle), circleCenterY - maxRadius * Math.sin(currentAngle));\n ctx.lineTo(circleCenterX\n - (innerRadius + clearance) * Math.cos(currentAngle), circleCenterY\n - (innerRadius + clearance) * Math.sin(currentAngle));\n ctx.shadowOffsetY = 0;\n ctx.shadowBlur = 0;\n ctx.lineWidth = 3;\n ctx.lineCap = 'round';\n ctx.strokeStyle = color;\n ctx.stroke();\n };\n for (let i = 0; i <= total; i++) {\n renderColumn(i, '#ccc');\n }\n let timer = null;\n let currentActiveCount = 0;\n const renderActiveColumn = () => {\n if (currentActiveCount <= activeCount) {\n renderColumn(currentActiveCount, THEME_COLOR);\n currentActiveCount += 1;\n timer = setTimeout(() => {\n renderActiveColumn();\n }, 100);\n }\n };\n if (activeCount > 0) {\n renderActiveColumn();\n }\n if (title) {\n // 渲染文字\n ctx.font = `bold 18px Arial`;\n ctx.fillStyle = THEME_COLOR;\n ctx.fillText(title, (ctx.canvas.width - ctx.measureText(title).width) / 2, circleCenterY + 40);\n }\n ctx.font = `12px Arial`;\n ctx.fillStyle = '#ffffff';\n ctx.fillText('0', padding, circleCenterY + 14);\n ctx.textAlign = 'right';\n ctx.fillText(`${all}${unit}`, canvasWidth - padding, circleCenterY + 14);\n ctx.textAlign = 'start';\n return () => {\n clearTimeout(timer);\n timer = null;\n };\n }, [value]);\n return (React.createElement(\"div\", { className: classnames(className, 'env-percent-semicircle'), style: style, ref: wrapRef },\n React.createElement(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esContent":["import './index.less';\n"],"mappings":";;AAAA"}
1
+ {"version":3,"file":"css.js","names":["require"],"sources":["percent/style/index.js"],"sourcesContent":["import './index.less';\n"],"mappings":";;AAAAA,OAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["percent/style/index.js"],"sourcesContent":["import './index.less';\n"],"mappings":";;AAAA"}
1
+ {"version":3,"file":"index.js","names":["require"],"sources":["percent/style/index.js"],"sourcesContent":["import './index.less';\n"],"mappings":";;AAAAA,OAAA","ignoreList":[]}
@@ -1,41 +1,41 @@
1
- .env-percent-semicircle {
2
- position: relative;
3
- color: #fff;
4
-
5
- &__value {
6
- width: 30%;
7
- border-radius: 4px;
8
- border: 1px solid #4ef6fc;
9
- position: absolute;
10
- left: 0;
11
- right: 0;
12
- top: 45%;
13
- margin: auto;
14
- text-align: center;
15
- box-shadow: 0 0 10px 2px #1890ff inset, 0 0 10px 2px #1890ff;
16
- }
17
- }
18
-
19
- .env-percent-line {
20
- width: 100%;
21
- height: 28px;
22
- display: flex;
23
- align-items: center;
24
- font-size: 18px;
25
- font-family: Source Han Sans CN;
26
- font-weight: 500;
27
- color: #ffffff;
28
- white-space: nowrap;
29
-
30
- &__arrow {
31
- margin: 0 20px;
32
- }
33
-
34
- &__value {
35
- height: 100%;
36
- }
37
-
38
- &__suffix {
39
- padding-left: 20px;
40
- }
41
- }
1
+ .env-percent-semicircle {
2
+ position: relative;
3
+ color: #fff;
4
+
5
+ &__value {
6
+ width: 30%;
7
+ border-radius: 4px;
8
+ border: 1px solid #4ef6fc;
9
+ position: absolute;
10
+ left: 0;
11
+ right: 0;
12
+ top: 45%;
13
+ margin: auto;
14
+ text-align: center;
15
+ box-shadow: 0 0 10px 2px #1890ff inset, 0 0 10px 2px #1890ff;
16
+ }
17
+ }
18
+
19
+ .env-percent-line {
20
+ width: 100%;
21
+ height: 28px;
22
+ display: flex;
23
+ align-items: center;
24
+ font-size: 18px;
25
+ font-family: Source Han Sans CN;
26
+ font-weight: 500;
27
+ color: #ffffff;
28
+ white-space: nowrap;
29
+
30
+ &__arrow {
31
+ margin: 0 20px;
32
+ }
33
+
34
+ &__value {
35
+ height: 100%;
36
+ }
37
+
38
+ &__suffix {
39
+ padding-left: 20px;
40
+ }
41
+ }
@@ -4,11 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _scroll = _interopRequireDefault(require("./scroll"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
-
12
- var _default = _scroll["default"];
13
- exports["default"] = _default;
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
9
+ var _default = exports["default"] = _scroll["default"];
14
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Scroll"],"sources":["scroll/index.js"],"sourcesContent":["import Scroll from './scroll';\nexport default Scroll;\n"],"mappings":";;;;;;;AAAA;;;;eACeA,kB"}
1
+ {"version":3,"file":"index.js","names":["_scroll","_interopRequireDefault","require","e","__esModule","_default","exports","Scroll"],"sources":["scroll/index.js"],"sourcesContent":["import Scroll from './scroll';\nexport default Scroll;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8B,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AAAA,IAAAE,QAAA,GAAAC,OAAA,cACfC,kBAAM","ignoreList":[]}
@@ -1,4 +1,4 @@
1
1
  import * as React from 'react';
2
- declare type ScrollProps = {} & React.HTMLAttributes<HTMLDivElement>;
2
+ type ScrollProps = {} & React.HTMLAttributes<HTMLDivElement>;
3
3
  declare const Scroll: React.FC<ScrollProps>;
4
4
  export default Scroll;
@@ -1,87 +1,61 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var _classnames = _interopRequireDefault(require("classnames"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
-
16
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
-
18
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
20
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
21
-
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
12
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
22
13
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
23
-
24
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
25
-
26
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
27
-
28
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
29
-
30
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
31
-
14
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
15
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
16
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
17
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
32
18
  var __rest = void 0 && (void 0).__rest || function (s, e) {
33
19
  var t = {};
34
-
35
- for (var p in s) {
36
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
37
- }
38
-
20
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
39
21
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
40
22
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
41
23
  }
42
24
  return t;
43
25
  };
44
-
45
26
  var Scroll = function Scroll(props) {
46
27
  var timer = null;
47
-
48
28
  var clearTimer = function clearTimer() {
49
29
  if (timer) {
50
30
  clearInterval(timer);
51
31
  timer = null;
52
32
  }
53
33
  };
54
-
55
34
  var children = props.children,
56
- className = props.className,
57
- rest = __rest(props, ["children", "className"]);
58
-
35
+ className = props.className,
36
+ rest = __rest(props, ["children", "className"]);
59
37
  var wrapperRef = React.useRef(null);
60
38
  var contentRef = React.useRef(null);
61
-
62
39
  var _React$useState = React.useState(true),
63
- _React$useState2 = _slicedToArray(_React$useState, 2),
64
- hasCopy = _React$useState2[0],
65
- setHasCopy = _React$useState2[1];
66
-
40
+ _React$useState2 = _slicedToArray(_React$useState, 2),
41
+ hasCopy = _React$useState2[0],
42
+ setHasCopy = _React$useState2[1];
67
43
  React.useEffect(function () {
68
44
  clearTimer();
69
45
  var wrapper = wrapperRef.current;
70
- var content = contentRef.current; // 当内容不足的时候, 不需要拷贝的元素
71
-
46
+ var content = contentRef.current;
47
+ // 当内容不足的时候, 不需要拷贝的元素
72
48
  if (wrapper.clientHeight > content.clientHeight) {
73
49
  setHasCopy(false);
74
50
  return;
75
- } // 重置滚动高度并拷贝元素
76
-
77
-
51
+ }
52
+ // 重置滚动高度并拷贝元素
78
53
  setHasCopy(true);
79
54
  wrapper.scrollTop = 0;
80
55
  timer = setInterval(function () {
81
56
  if (!wrapper || !content) {
82
57
  return;
83
58
  }
84
-
85
59
  if (wrapper.scrollTop >= content.scrollHeight) {
86
60
  wrapper.scrollTop = 0;
87
61
  } else {
@@ -99,7 +73,5 @@ var Scroll = function Scroll(props) {
99
73
  ref: contentRef
100
74
  }, children), hasCopy && /*#__PURE__*/React.createElement("div", null, children));
101
75
  };
102
-
103
- var _default = Scroll;
104
- exports["default"] = _default;
76
+ var _default = exports["default"] = Scroll;
105
77
  //# sourceMappingURL=scroll.js.map