No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

70 líneas
2.7 KiB

  1. var _extends = Object.assign || 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; };
  2. // Copyright (c) 2016 - 2017 Uber Technologies, Inc.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. import React from 'react';
  22. import TreemapLeaf from './treemap-leaf';
  23. function TreemapDOM(props) {
  24. var animation = props.animation,
  25. className = props.className,
  26. height = props.height,
  27. hideRootNode = props.hideRootNode,
  28. getLabel = props.getLabel,
  29. mode = props.mode,
  30. nodes = props.nodes,
  31. width = props.width,
  32. scales = props.scales,
  33. style = props.style;
  34. var useCirclePacking = mode === 'circlePack';
  35. return React.createElement(
  36. 'div',
  37. {
  38. className: 'rv-treemap ' + (useCirclePacking ? 'rv-treemap-circle-packed' : '') + ' ' + className,
  39. style: { height: height, width: width }
  40. },
  41. nodes.map(function (node, index) {
  42. // throw out the rootest node
  43. if (hideRootNode && !index) {
  44. return null;
  45. }
  46. var nodeProps = _extends({
  47. animation: animation,
  48. node: node,
  49. getLabel: getLabel
  50. }, props, {
  51. x0: useCirclePacking ? node.x : node.x0,
  52. x1: useCirclePacking ? node.x : node.x1,
  53. y0: useCirclePacking ? node.y : node.y0,
  54. y1: useCirclePacking ? node.y : node.y1,
  55. r: useCirclePacking ? node.r : 1,
  56. scales: scales,
  57. style: style
  58. });
  59. return React.createElement(TreemapLeaf, _extends({}, nodeProps, { key: 'leaf-' + index }));
  60. })
  61. );
  62. }
  63. TreemapDOM.displayName = 'TreemapDOM';
  64. export default TreemapDOM;