Label.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. "use strict";
  2. 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); }
  3. Object.defineProperty(exports, "__esModule", {
  4. value: true
  5. });
  6. exports.Label = Label;
  7. var _react = _interopRequireWildcard(require("react"));
  8. var _isNil = _interopRequireDefault(require("lodash/isNil"));
  9. var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
  10. var _isObject = _interopRequireDefault(require("lodash/isObject"));
  11. var _clsx = _interopRequireDefault(require("clsx"));
  12. var _Text = require("./Text");
  13. var _ReactUtils = require("../util/ReactUtils");
  14. var _DataUtils = require("../util/DataUtils");
  15. var _PolarUtils = require("../util/PolarUtils");
  16. var _excluded = ["offset"];
  17. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  18. 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); }
  19. 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; }
  20. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  21. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  22. 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); }
  23. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  24. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  25. 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; }
  26. function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
  27. function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
  28. 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; }
  29. 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) { _defineProperty(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; }
  30. function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  31. function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
  32. function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
  33. function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
  34. var getLabel = function getLabel(props) {
  35. var value = props.value,
  36. formatter = props.formatter;
  37. var label = (0, _isNil["default"])(props.children) ? value : props.children;
  38. if ((0, _isFunction["default"])(formatter)) {
  39. return formatter(label);
  40. }
  41. return label;
  42. };
  43. var getDeltaAngle = function getDeltaAngle(startAngle, endAngle) {
  44. var sign = (0, _DataUtils.mathSign)(endAngle - startAngle);
  45. var deltaAngle = Math.min(Math.abs(endAngle - startAngle), 360);
  46. return sign * deltaAngle;
  47. };
  48. var renderRadialLabel = function renderRadialLabel(labelProps, label, attrs) {
  49. var position = labelProps.position,
  50. viewBox = labelProps.viewBox,
  51. offset = labelProps.offset,
  52. className = labelProps.className;
  53. var _ref = viewBox,
  54. cx = _ref.cx,
  55. cy = _ref.cy,
  56. innerRadius = _ref.innerRadius,
  57. outerRadius = _ref.outerRadius,
  58. startAngle = _ref.startAngle,
  59. endAngle = _ref.endAngle,
  60. clockWise = _ref.clockWise;
  61. var radius = (innerRadius + outerRadius) / 2;
  62. var deltaAngle = getDeltaAngle(startAngle, endAngle);
  63. var sign = deltaAngle >= 0 ? 1 : -1;
  64. var labelAngle, direction;
  65. if (position === 'insideStart') {
  66. labelAngle = startAngle + sign * offset;
  67. direction = clockWise;
  68. } else if (position === 'insideEnd') {
  69. labelAngle = endAngle - sign * offset;
  70. direction = !clockWise;
  71. } else if (position === 'end') {
  72. labelAngle = endAngle + sign * offset;
  73. direction = clockWise;
  74. }
  75. direction = deltaAngle <= 0 ? direction : !direction;
  76. var startPoint = (0, _PolarUtils.polarToCartesian)(cx, cy, radius, labelAngle);
  77. var endPoint = (0, _PolarUtils.polarToCartesian)(cx, cy, radius, labelAngle + (direction ? 1 : -1) * 359);
  78. var path = "M".concat(startPoint.x, ",").concat(startPoint.y, "\n A").concat(radius, ",").concat(radius, ",0,1,").concat(direction ? 0 : 1, ",\n ").concat(endPoint.x, ",").concat(endPoint.y);
  79. var id = (0, _isNil["default"])(labelProps.id) ? (0, _DataUtils.uniqueId)('recharts-radial-line-') : labelProps.id;
  80. return /*#__PURE__*/_react["default"].createElement("text", _extends({}, attrs, {
  81. dominantBaseline: "central",
  82. className: (0, _clsx["default"])('recharts-radial-bar-label', className)
  83. }), /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement("path", {
  84. id: id,
  85. d: path
  86. })), /*#__PURE__*/_react["default"].createElement("textPath", {
  87. xlinkHref: "#".concat(id)
  88. }, label));
  89. };
  90. var getAttrsOfPolarLabel = function getAttrsOfPolarLabel(props) {
  91. var viewBox = props.viewBox,
  92. offset = props.offset,
  93. position = props.position;
  94. var _ref2 = viewBox,
  95. cx = _ref2.cx,
  96. cy = _ref2.cy,
  97. innerRadius = _ref2.innerRadius,
  98. outerRadius = _ref2.outerRadius,
  99. startAngle = _ref2.startAngle,
  100. endAngle = _ref2.endAngle;
  101. var midAngle = (startAngle + endAngle) / 2;
  102. if (position === 'outside') {
  103. var _polarToCartesian = (0, _PolarUtils.polarToCartesian)(cx, cy, outerRadius + offset, midAngle),
  104. _x = _polarToCartesian.x,
  105. _y = _polarToCartesian.y;
  106. return {
  107. x: _x,
  108. y: _y,
  109. textAnchor: _x >= cx ? 'start' : 'end',
  110. verticalAnchor: 'middle'
  111. };
  112. }
  113. if (position === 'center') {
  114. return {
  115. x: cx,
  116. y: cy,
  117. textAnchor: 'middle',
  118. verticalAnchor: 'middle'
  119. };
  120. }
  121. if (position === 'centerTop') {
  122. return {
  123. x: cx,
  124. y: cy,
  125. textAnchor: 'middle',
  126. verticalAnchor: 'start'
  127. };
  128. }
  129. if (position === 'centerBottom') {
  130. return {
  131. x: cx,
  132. y: cy,
  133. textAnchor: 'middle',
  134. verticalAnchor: 'end'
  135. };
  136. }
  137. var r = (innerRadius + outerRadius) / 2;
  138. var _polarToCartesian2 = (0, _PolarUtils.polarToCartesian)(cx, cy, r, midAngle),
  139. x = _polarToCartesian2.x,
  140. y = _polarToCartesian2.y;
  141. return {
  142. x: x,
  143. y: y,
  144. textAnchor: 'middle',
  145. verticalAnchor: 'middle'
  146. };
  147. };
  148. var getAttrsOfCartesianLabel = function getAttrsOfCartesianLabel(props) {
  149. var viewBox = props.viewBox,
  150. parentViewBox = props.parentViewBox,
  151. offset = props.offset,
  152. position = props.position;
  153. var _ref3 = viewBox,
  154. x = _ref3.x,
  155. y = _ref3.y,
  156. width = _ref3.width,
  157. height = _ref3.height;
  158. // Define vertical offsets and position inverts based on the value being positive or negative
  159. var verticalSign = height >= 0 ? 1 : -1;
  160. var verticalOffset = verticalSign * offset;
  161. var verticalEnd = verticalSign > 0 ? 'end' : 'start';
  162. var verticalStart = verticalSign > 0 ? 'start' : 'end';
  163. // Define horizontal offsets and position inverts based on the value being positive or negative
  164. var horizontalSign = width >= 0 ? 1 : -1;
  165. var horizontalOffset = horizontalSign * offset;
  166. var horizontalEnd = horizontalSign > 0 ? 'end' : 'start';
  167. var horizontalStart = horizontalSign > 0 ? 'start' : 'end';
  168. if (position === 'top') {
  169. var attrs = {
  170. x: x + width / 2,
  171. y: y - verticalSign * offset,
  172. textAnchor: 'middle',
  173. verticalAnchor: verticalEnd
  174. };
  175. return _objectSpread(_objectSpread({}, attrs), parentViewBox ? {
  176. height: Math.max(y - parentViewBox.y, 0),
  177. width: width
  178. } : {});
  179. }
  180. if (position === 'bottom') {
  181. var _attrs = {
  182. x: x + width / 2,
  183. y: y + height + verticalOffset,
  184. textAnchor: 'middle',
  185. verticalAnchor: verticalStart
  186. };
  187. return _objectSpread(_objectSpread({}, _attrs), parentViewBox ? {
  188. height: Math.max(parentViewBox.y + parentViewBox.height - (y + height), 0),
  189. width: width
  190. } : {});
  191. }
  192. if (position === 'left') {
  193. var _attrs2 = {
  194. x: x - horizontalOffset,
  195. y: y + height / 2,
  196. textAnchor: horizontalEnd,
  197. verticalAnchor: 'middle'
  198. };
  199. return _objectSpread(_objectSpread({}, _attrs2), parentViewBox ? {
  200. width: Math.max(_attrs2.x - parentViewBox.x, 0),
  201. height: height
  202. } : {});
  203. }
  204. if (position === 'right') {
  205. var _attrs3 = {
  206. x: x + width + horizontalOffset,
  207. y: y + height / 2,
  208. textAnchor: horizontalStart,
  209. verticalAnchor: 'middle'
  210. };
  211. return _objectSpread(_objectSpread({}, _attrs3), parentViewBox ? {
  212. width: Math.max(parentViewBox.x + parentViewBox.width - _attrs3.x, 0),
  213. height: height
  214. } : {});
  215. }
  216. var sizeAttrs = parentViewBox ? {
  217. width: width,
  218. height: height
  219. } : {};
  220. if (position === 'insideLeft') {
  221. return _objectSpread({
  222. x: x + horizontalOffset,
  223. y: y + height / 2,
  224. textAnchor: horizontalStart,
  225. verticalAnchor: 'middle'
  226. }, sizeAttrs);
  227. }
  228. if (position === 'insideRight') {
  229. return _objectSpread({
  230. x: x + width - horizontalOffset,
  231. y: y + height / 2,
  232. textAnchor: horizontalEnd,
  233. verticalAnchor: 'middle'
  234. }, sizeAttrs);
  235. }
  236. if (position === 'insideTop') {
  237. return _objectSpread({
  238. x: x + width / 2,
  239. y: y + verticalOffset,
  240. textAnchor: 'middle',
  241. verticalAnchor: verticalStart
  242. }, sizeAttrs);
  243. }
  244. if (position === 'insideBottom') {
  245. return _objectSpread({
  246. x: x + width / 2,
  247. y: y + height - verticalOffset,
  248. textAnchor: 'middle',
  249. verticalAnchor: verticalEnd
  250. }, sizeAttrs);
  251. }
  252. if (position === 'insideTopLeft') {
  253. return _objectSpread({
  254. x: x + horizontalOffset,
  255. y: y + verticalOffset,
  256. textAnchor: horizontalStart,
  257. verticalAnchor: verticalStart
  258. }, sizeAttrs);
  259. }
  260. if (position === 'insideTopRight') {
  261. return _objectSpread({
  262. x: x + width - horizontalOffset,
  263. y: y + verticalOffset,
  264. textAnchor: horizontalEnd,
  265. verticalAnchor: verticalStart
  266. }, sizeAttrs);
  267. }
  268. if (position === 'insideBottomLeft') {
  269. return _objectSpread({
  270. x: x + horizontalOffset,
  271. y: y + height - verticalOffset,
  272. textAnchor: horizontalStart,
  273. verticalAnchor: verticalEnd
  274. }, sizeAttrs);
  275. }
  276. if (position === 'insideBottomRight') {
  277. return _objectSpread({
  278. x: x + width - horizontalOffset,
  279. y: y + height - verticalOffset,
  280. textAnchor: horizontalEnd,
  281. verticalAnchor: verticalEnd
  282. }, sizeAttrs);
  283. }
  284. if ((0, _isObject["default"])(position) && ((0, _DataUtils.isNumber)(position.x) || (0, _DataUtils.isPercent)(position.x)) && ((0, _DataUtils.isNumber)(position.y) || (0, _DataUtils.isPercent)(position.y))) {
  285. return _objectSpread({
  286. x: x + (0, _DataUtils.getPercentValue)(position.x, width),
  287. y: y + (0, _DataUtils.getPercentValue)(position.y, height),
  288. textAnchor: 'end',
  289. verticalAnchor: 'end'
  290. }, sizeAttrs);
  291. }
  292. return _objectSpread({
  293. x: x + width / 2,
  294. y: y + height / 2,
  295. textAnchor: 'middle',
  296. verticalAnchor: 'middle'
  297. }, sizeAttrs);
  298. };
  299. var isPolar = function isPolar(viewBox) {
  300. return 'cx' in viewBox && (0, _DataUtils.isNumber)(viewBox.cx);
  301. };
  302. function Label(_ref4) {
  303. var _ref4$offset = _ref4.offset,
  304. offset = _ref4$offset === void 0 ? 5 : _ref4$offset,
  305. restProps = _objectWithoutProperties(_ref4, _excluded);
  306. var props = _objectSpread({
  307. offset: offset
  308. }, restProps);
  309. var viewBox = props.viewBox,
  310. position = props.position,
  311. value = props.value,
  312. children = props.children,
  313. content = props.content,
  314. _props$className = props.className,
  315. className = _props$className === void 0 ? '' : _props$className,
  316. textBreakAll = props.textBreakAll;
  317. if (!viewBox || (0, _isNil["default"])(value) && (0, _isNil["default"])(children) && ! /*#__PURE__*/(0, _react.isValidElement)(content) && !(0, _isFunction["default"])(content)) {
  318. return null;
  319. }
  320. if ( /*#__PURE__*/(0, _react.isValidElement)(content)) {
  321. return /*#__PURE__*/(0, _react.cloneElement)(content, props);
  322. }
  323. var label;
  324. if ((0, _isFunction["default"])(content)) {
  325. label = /*#__PURE__*/(0, _react.createElement)(content, props);
  326. if ( /*#__PURE__*/(0, _react.isValidElement)(label)) {
  327. return label;
  328. }
  329. } else {
  330. label = getLabel(props);
  331. }
  332. var isPolarLabel = isPolar(viewBox);
  333. var attrs = (0, _ReactUtils.filterProps)(props, true);
  334. if (isPolarLabel && (position === 'insideStart' || position === 'insideEnd' || position === 'end')) {
  335. return renderRadialLabel(props, label, attrs);
  336. }
  337. var positionAttrs = isPolarLabel ? getAttrsOfPolarLabel(props) : getAttrsOfCartesianLabel(props);
  338. return /*#__PURE__*/_react["default"].createElement(_Text.Text, _extends({
  339. className: (0, _clsx["default"])('recharts-label', className)
  340. }, attrs, positionAttrs, {
  341. breakAll: textBreakAll
  342. }), label);
  343. }
  344. Label.displayName = 'Label';
  345. var parseViewBox = function parseViewBox(props) {
  346. var cx = props.cx,
  347. cy = props.cy,
  348. angle = props.angle,
  349. startAngle = props.startAngle,
  350. endAngle = props.endAngle,
  351. r = props.r,
  352. radius = props.radius,
  353. innerRadius = props.innerRadius,
  354. outerRadius = props.outerRadius,
  355. x = props.x,
  356. y = props.y,
  357. top = props.top,
  358. left = props.left,
  359. width = props.width,
  360. height = props.height,
  361. clockWise = props.clockWise,
  362. labelViewBox = props.labelViewBox;
  363. if (labelViewBox) {
  364. return labelViewBox;
  365. }
  366. if ((0, _DataUtils.isNumber)(width) && (0, _DataUtils.isNumber)(height)) {
  367. if ((0, _DataUtils.isNumber)(x) && (0, _DataUtils.isNumber)(y)) {
  368. return {
  369. x: x,
  370. y: y,
  371. width: width,
  372. height: height
  373. };
  374. }
  375. if ((0, _DataUtils.isNumber)(top) && (0, _DataUtils.isNumber)(left)) {
  376. return {
  377. x: top,
  378. y: left,
  379. width: width,
  380. height: height
  381. };
  382. }
  383. }
  384. if ((0, _DataUtils.isNumber)(x) && (0, _DataUtils.isNumber)(y)) {
  385. return {
  386. x: x,
  387. y: y,
  388. width: 0,
  389. height: 0
  390. };
  391. }
  392. if ((0, _DataUtils.isNumber)(cx) && (0, _DataUtils.isNumber)(cy)) {
  393. return {
  394. cx: cx,
  395. cy: cy,
  396. startAngle: startAngle || angle || 0,
  397. endAngle: endAngle || angle || 0,
  398. innerRadius: innerRadius || 0,
  399. outerRadius: outerRadius || radius || r || 0,
  400. clockWise: clockWise
  401. };
  402. }
  403. if (props.viewBox) {
  404. return props.viewBox;
  405. }
  406. return {};
  407. };
  408. var parseLabel = function parseLabel(label, viewBox) {
  409. if (!label) {
  410. return null;
  411. }
  412. if (label === true) {
  413. return /*#__PURE__*/_react["default"].createElement(Label, {
  414. key: "label-implicit",
  415. viewBox: viewBox
  416. });
  417. }
  418. if ((0, _DataUtils.isNumOrStr)(label)) {
  419. return /*#__PURE__*/_react["default"].createElement(Label, {
  420. key: "label-implicit",
  421. viewBox: viewBox,
  422. value: label
  423. });
  424. }
  425. if ( /*#__PURE__*/(0, _react.isValidElement)(label)) {
  426. if (label.type === Label) {
  427. return /*#__PURE__*/(0, _react.cloneElement)(label, {
  428. key: 'label-implicit',
  429. viewBox: viewBox
  430. });
  431. }
  432. return /*#__PURE__*/_react["default"].createElement(Label, {
  433. key: "label-implicit",
  434. content: label,
  435. viewBox: viewBox
  436. });
  437. }
  438. if ((0, _isFunction["default"])(label)) {
  439. return /*#__PURE__*/_react["default"].createElement(Label, {
  440. key: "label-implicit",
  441. content: label,
  442. viewBox: viewBox
  443. });
  444. }
  445. if ((0, _isObject["default"])(label)) {
  446. return /*#__PURE__*/_react["default"].createElement(Label, _extends({
  447. viewBox: viewBox
  448. }, label, {
  449. key: "label-implicit"
  450. }));
  451. }
  452. return null;
  453. };
  454. var renderCallByParent = function renderCallByParent(parentProps, viewBox) {
  455. var checkPropsLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  456. if (!parentProps || !parentProps.children && checkPropsLabel && !parentProps.label) {
  457. return null;
  458. }
  459. var children = parentProps.children;
  460. var parentViewBox = parseViewBox(parentProps);
  461. var explicitChildren = (0, _ReactUtils.findAllByType)(children, Label).map(function (child, index) {
  462. return /*#__PURE__*/(0, _react.cloneElement)(child, {
  463. viewBox: viewBox || parentViewBox,
  464. // eslint-disable-next-line react/no-array-index-key
  465. key: "label-".concat(index)
  466. });
  467. });
  468. if (!checkPropsLabel) {
  469. return explicitChildren;
  470. }
  471. var implicitLabel = parseLabel(parentProps.label, viewBox || parentViewBox);
  472. return [implicitLabel].concat(_toConsumableArray(explicitChildren));
  473. };
  474. Label.parseViewBox = parseViewBox;
  475. Label.renderCallByParent = renderCallByParent;