@unovis/ts 1.1.1-beta.7 → 1.1.1-beta.8
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.
- package/components/area/config.d.ts +25 -0
- package/components/area/config.js +16 -0
- package/components/area/config.js.map +1 -0
- package/components/area/index.d.ts +19 -0
- package/components/area/index.js +102 -0
- package/components/area/index.js.map +1 -0
- package/components/area/style.d.ts +3 -0
- package/{src/components/area/style.ts → components/area/style.js} +10 -9
- package/components/area/style.js.map +1 -0
- package/components/area/types.d.ts +6 -0
- package/components/axis/config.d.ts +71 -0
- package/components/axis/config.js +32 -0
- package/components/axis/config.js.map +1 -0
- package/components/axis/index.d.ts +44 -0
- package/components/axis/index.js +305 -0
- package/components/axis/index.js.map +1 -0
- package/components/axis/style.d.ts +9 -0
- package/{src/components/axis/style.ts → components/axis/style.js} +22 -27
- package/components/axis/style.js.map +1 -0
- package/components/axis/types.d.ts +4 -0
- package/components/axis/types.js +8 -0
- package/components/axis/types.js.map +1 -0
- package/components/brush/config.d.ts +42 -0
- package/components/brush/config.js +24 -0
- package/components/brush/config.js.map +1 -0
- package/components/brush/index.d.ts +28 -0
- package/components/brush/index.js +199 -0
- package/components/brush/index.js.map +1 -0
- package/components/brush/style.d.ts +5 -0
- package/{src/components/brush/style.ts → components/brush/style.js} +14 -15
- package/components/brush/style.js.map +1 -0
- package/components/brush/types.d.ts +7 -0
- package/components/brush/types.js +8 -0
- package/components/brush/types.js.map +1 -0
- package/components/bullet-legend/config.d.ts +34 -0
- package/components/bullet-legend/config.js +16 -0
- package/components/bullet-legend/config.js.map +1 -0
- package/components/bullet-legend/index.d.ts +19 -0
- package/components/bullet-legend/index.js +79 -0
- package/components/bullet-legend/index.js.map +1 -0
- package/components/bullet-legend/style.d.ts +6 -0
- package/{src/components/bullet-legend/style.ts → components/bullet-legend/style.js} +16 -18
- package/components/bullet-legend/style.js.map +1 -0
- package/components/bullet-legend/types.d.ts +7 -0
- package/components/bullet-legend/types.js +2 -0
- package/components/bullet-legend/types.js.map +1 -0
- package/components/chord-diagram/config.d.ts +44 -0
- package/components/chord-diagram/config.js +25 -0
- package/components/chord-diagram/config.js.map +1 -0
- package/components/chord-diagram/index.d.ts +42 -0
- package/components/chord-diagram/index.js +305 -0
- package/components/chord-diagram/index.js.map +1 -0
- package/components/chord-diagram/modules/label.d.ts +8 -0
- package/components/chord-diagram/modules/label.js +115 -0
- package/components/chord-diagram/modules/label.js.map +1 -0
- package/components/chord-diagram/modules/link.d.ts +21 -0
- package/components/chord-diagram/modules/link.js +63 -0
- package/components/chord-diagram/modules/link.js.map +1 -0
- package/components/chord-diagram/modules/node.d.ts +17 -0
- package/components/chord-diagram/modules/node.js +52 -0
- package/components/chord-diagram/modules/node.js.map +1 -0
- package/components/chord-diagram/style.d.ts +13 -0
- package/{src/components/chord-diagram/style.ts → components/chord-diagram/style.js} +30 -39
- package/components/chord-diagram/style.js.map +1 -0
- package/components/chord-diagram/types.d.ts +58 -0
- package/components/chord-diagram/types.js +8 -0
- package/components/chord-diagram/types.js.map +1 -0
- package/components/crosshair/config.d.ts +43 -0
- package/components/crosshair/config.js +19 -0
- package/components/crosshair/config.js.map +1 -0
- package/components/crosshair/index.d.ts +35 -0
- package/components/crosshair/index.js +183 -0
- package/components/crosshair/index.js.map +1 -0
- package/components/crosshair/style.d.ts +4 -0
- package/{src/components/crosshair/style.ts → components/crosshair/style.js} +12 -12
- package/components/crosshair/style.js.map +1 -0
- package/components/crosshair/types.d.ts +13 -0
- package/components/crosshair/types.js +2 -0
- package/components/crosshair/types.js.map +1 -0
- package/components/donut/config.d.ts +59 -0
- package/components/donut/config.js +28 -0
- package/components/donut/config.js.map +1 -0
- package/components/donut/index.d.ts +21 -0
- package/components/donut/index.js +107 -0
- package/components/donut/index.js.map +1 -0
- package/components/donut/modules/arc.d.ts +10 -0
- package/components/donut/modules/arc.js +59 -0
- package/components/donut/modules/arc.js.map +1 -0
- package/components/donut/style.d.ts +7 -0
- package/{src/components/donut/style.ts → components/donut/style.js} +18 -20
- package/components/donut/style.js.map +1 -0
- package/components/donut/types.d.ts +20 -0
- package/components/flow-legend/config.d.ts +29 -0
- package/components/flow-legend/config.js +18 -0
- package/components/flow-legend/config.js.map +1 -0
- package/components/flow-legend/index.d.ts +16 -0
- package/components/flow-legend/index.js +75 -0
- package/components/flow-legend/index.js.map +1 -0
- package/components/flow-legend/style.d.ts +8 -0
- package/{src/components/flow-legend/style.ts → components/flow-legend/style.js} +21 -25
- package/components/flow-legend/style.js.map +1 -0
- package/components/flow-legend/types.d.ts +9 -0
- package/components/flow-legend/types.js +8 -0
- package/components/flow-legend/types.js.map +1 -0
- package/components/free-brush/config.d.ts +45 -0
- package/components/free-brush/config.js +24 -0
- package/components/free-brush/config.js.map +1 -0
- package/components/free-brush/index.d.ts +20 -0
- package/components/free-brush/index.js +192 -0
- package/components/free-brush/index.js.map +1 -0
- package/components/free-brush/style.d.ts +4 -0
- package/{src/components/free-brush/style.ts → components/free-brush/style.js} +12 -12
- package/components/free-brush/style.js.map +1 -0
- package/components/free-brush/types.d.ts +7 -0
- package/components/free-brush/types.js +9 -0
- package/components/free-brush/types.js.map +1 -0
- package/components/graph/config.d.ts +238 -0
- package/components/graph/config.js +84 -0
- package/components/graph/config.js.map +1 -0
- package/components/graph/index.d.ts +126 -0
- package/components/graph/index.js +656 -0
- package/components/graph/index.js.map +1 -0
- package/components/graph/modules/layout-helpers.d.ts +21 -0
- package/components/graph/modules/layout-helpers.js +69 -0
- package/components/graph/modules/layout-helpers.js.map +1 -0
- package/components/graph/modules/layout.d.ts +10 -0
- package/components/graph/modules/layout.js +399 -0
- package/components/graph/modules/layout.js.map +1 -0
- package/components/graph/modules/link/helper.d.ts +25 -0
- package/components/graph/modules/link/helper.js +74 -0
- package/components/graph/modules/link/helper.js.map +1 -0
- package/components/graph/modules/link/index.d.ts +11 -0
- package/components/graph/modules/link/index.js +212 -0
- package/components/graph/modules/link/index.js.map +1 -0
- package/components/graph/modules/link/style.d.ts +15 -0
- package/{src/components/graph/modules/link/style.ts → components/graph/modules/link/style.js} +34 -45
- package/components/graph/modules/link/style.js.map +1 -0
- package/components/graph/modules/node/helper.d.ts +21 -0
- package/components/graph/modules/node/helper.js +126 -0
- package/components/graph/modules/node/helper.js.map +1 -0
- package/components/graph/modules/node/index.d.ts +11 -0
- package/components/graph/modules/node/index.js +252 -0
- package/components/graph/modules/node/index.js.map +1 -0
- package/components/graph/modules/node/style.d.ts +24 -0
- package/{src/components/graph/modules/node/style.ts → components/graph/modules/node/style.js} +52 -72
- package/components/graph/modules/node/style.js.map +1 -0
- package/components/graph/modules/panel/helper.d.ts +18 -0
- package/components/graph/modules/panel/helper.js +111 -0
- package/components/graph/modules/panel/helper.js.map +1 -0
- package/components/graph/modules/panel/index.d.ts +7 -0
- package/components/graph/modules/panel/index.js +98 -0
- package/components/graph/modules/panel/index.js.map +1 -0
- package/components/graph/modules/panel/style.d.ts +14 -0
- package/{src/components/graph/modules/panel/style.ts → components/graph/modules/panel/style.js} +32 -42
- package/components/graph/modules/panel/style.js.map +1 -0
- package/components/graph/modules/shape.d.ts +6 -0
- package/components/graph/modules/shape.js +80 -0
- package/components/graph/modules/shape.js.map +1 -0
- package/components/graph/modules/zoom-levels.d.ts +6 -0
- package/components/graph/modules/zoom-levels.js +10 -0
- package/components/graph/modules/zoom-levels.js.map +1 -0
- package/components/graph/style.d.ts +6 -0
- package/components/graph/style.js +66 -0
- package/components/graph/style.js.map +1 -0
- package/components/graph/types.d.ts +125 -0
- package/components/graph/types.js +30 -0
- package/components/graph/types.js.map +1 -0
- package/components/grouped-bar/config.d.ts +36 -0
- package/components/grouped-bar/config.js +20 -0
- package/components/grouped-bar/config.js.map +1 -0
- package/components/grouped-bar/index.d.ts +32 -0
- package/components/grouped-bar/index.js +249 -0
- package/components/grouped-bar/index.js.map +1 -0
- package/components/grouped-bar/style.d.ts +5 -0
- package/{src/components/grouped-bar/style.ts → components/grouped-bar/style.js} +14 -15
- package/components/grouped-bar/style.js.map +1 -0
- package/components/leaflet-flow-map/config.d.ts +46 -0
- package/components/leaflet-flow-map/config.js +25 -0
- package/components/leaflet-flow-map/config.js.map +1 -0
- package/components/leaflet-flow-map/index.d.ts +52 -0
- package/components/leaflet-flow-map/index.js +220 -0
- package/components/leaflet-flow-map/index.js.map +1 -0
- package/components/leaflet-flow-map/renderer-utils.d.ts +5 -0
- package/components/leaflet-flow-map/renderer-utils.js +15 -0
- package/components/leaflet-flow-map/renderer-utils.js.map +1 -0
- package/components/leaflet-flow-map/renderer.d.ts +26 -0
- package/components/leaflet-flow-map/renderer.js +117 -0
- package/components/leaflet-flow-map/renderer.js.map +1 -0
- package/components/leaflet-flow-map/shaders.d.ts +2 -0
- package/{src/components/leaflet-flow-map/shaders.ts → components/leaflet-flow-map/shaders.js} +7 -4
- package/components/leaflet-flow-map/shaders.js.map +1 -0
- package/components/leaflet-flow-map/types.d.ts +23 -0
- package/components/leaflet-map/config.d.ts +193 -0
- package/components/leaflet-map/config.js +71 -0
- package/components/leaflet-map/config.js.map +1 -0
- package/components/leaflet-map/index.d.ts +130 -0
- package/components/leaflet-map/index.js +690 -0
- package/components/leaflet-map/index.js.map +1 -0
- package/components/leaflet-map/leaflet.css.js +5 -0
- package/components/leaflet-map/leaflet.css.js.map +1 -0
- package/components/leaflet-map/modules/clusterBackground.d.ts +5 -0
- package/components/leaflet-map/modules/clusterBackground.js +27 -0
- package/components/leaflet-map/modules/clusterBackground.js.map +1 -0
- package/components/leaflet-map/modules/donut.d.ts +3 -0
- package/components/leaflet-map/modules/donut.js +25 -0
- package/components/leaflet-map/modules/donut.js.map +1 -0
- package/components/leaflet-map/modules/map.d.ts +14 -0
- package/components/leaflet-map/modules/map.js +154 -0
- package/components/leaflet-map/modules/map.js.map +1 -0
- package/components/leaflet-map/modules/node.d.ts +9 -0
- package/components/leaflet-map/modules/node.js +162 -0
- package/components/leaflet-map/modules/node.js.map +1 -0
- package/components/leaflet-map/modules/selectionRing.d.ts +7 -0
- package/components/leaflet-map/modules/selectionRing.js +41 -0
- package/components/leaflet-map/modules/selectionRing.js.map +1 -0
- package/components/leaflet-map/modules/utils.d.ts +50 -0
- package/components/leaflet-map/modules/utils.js +210 -0
- package/components/leaflet-map/modules/utils.js.map +1 -0
- package/{src/components → components}/leaflet-map/renderer/leaflet-maplibre-gl.js +78 -76
- package/components/leaflet-map/renderer/leaflet-maplibre-gl.js.map +1 -0
- package/components/leaflet-map/renderer/map-style.d.ts +4 -0
- package/components/leaflet-map/renderer/map-style.js +15 -0
- package/components/leaflet-map/renderer/map-style.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js +40 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js +40 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js +4981 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl-layer.d.ts +8 -0
- package/components/leaflet-map/renderer/mapboxgl-layer.js +27 -0
- package/components/leaflet-map/renderer/mapboxgl-layer.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl-utils.d.ts +4 -0
- package/components/leaflet-map/renderer/mapboxgl-utils.js +39 -0
- package/components/leaflet-map/renderer/mapboxgl-utils.js.map +1 -0
- package/{src/components → components}/leaflet-map/renderer/maplibre-gl.css.js +4 -2
- package/components/leaflet-map/renderer/maplibre-gl.css.js.map +1 -0
- package/components/leaflet-map/style.d.ts +52 -0
- package/components/leaflet-map/style.js +183 -0
- package/components/leaflet-map/style.js.map +1 -0
- package/components/leaflet-map/types.d.ts +75 -0
- package/components/leaflet-map/types.js +15 -0
- package/components/leaflet-map/types.js.map +1 -0
- package/components/line/config.d.ts +30 -0
- package/components/line/config.js +17 -0
- package/components/line/config.js.map +1 -0
- package/components/line/index.d.ts +27 -0
- package/components/line/index.js +152 -0
- package/components/line/index.js.map +1 -0
- package/components/line/style.d.ts +6 -0
- package/{src/components/line/style.ts → components/line/style.js} +16 -18
- package/components/line/style.js.map +1 -0
- package/components/line/types.d.ts +12 -0
- package/components/nested-donut/config.d.ts +59 -0
- package/components/nested-donut/config.js +19 -0
- package/components/nested-donut/config.js.map +1 -0
- package/components/nested-donut/index.d.ts +38 -0
- package/components/nested-donut/index.js +133 -0
- package/components/nested-donut/index.js.map +1 -0
- package/components/nested-donut/modules/arc.d.ts +17 -0
- package/components/nested-donut/modules/arc.js +50 -0
- package/components/nested-donut/modules/arc.js.map +1 -0
- package/components/nested-donut/modules/label.d.ts +7 -0
- package/components/nested-donut/modules/label.js +34 -0
- package/components/nested-donut/modules/label.js.map +1 -0
- package/components/nested-donut/style.d.ts +26 -0
- package/components/nested-donut/style.js +70 -0
- package/components/nested-donut/style.js.map +1 -0
- package/components/nested-donut/types.d.ts +24 -0
- package/components/nested-donut/types.js +11 -0
- package/components/nested-donut/types.js.map +1 -0
- package/components/sankey/config.d.ts +162 -0
- package/components/sankey/config.js +65 -0
- package/components/sankey/config.js.map +1 -0
- package/components/sankey/index.d.ts +59 -0
- package/components/sankey/index.js +306 -0
- package/components/sankey/index.js.map +1 -0
- package/components/sankey/modules/label.d.ts +23 -0
- package/components/sankey/modules/label.js +168 -0
- package/components/sankey/modules/label.js.map +1 -0
- package/components/sankey/modules/link.d.ts +14 -0
- package/components/sankey/modules/link.js +108 -0
- package/components/sankey/modules/link.js.map +1 -0
- package/components/sankey/modules/node.d.ts +10 -0
- package/components/sankey/modules/node.js +156 -0
- package/components/sankey/modules/node.js.map +1 -0
- package/components/sankey/style.d.ts +20 -0
- package/{src/components/sankey/style.ts → components/sankey/style.js} +44 -60
- package/components/sankey/style.js.map +1 -0
- package/components/sankey/types.d.ts +84 -0
- package/components/sankey/types.js +34 -0
- package/components/sankey/types.js.map +1 -0
- package/components/scatter/config.d.ts +44 -0
- package/components/scatter/config.js +23 -0
- package/components/scatter/config.js.map +1 -0
- package/components/scatter/index.d.ts +28 -0
- package/components/scatter/index.js +167 -0
- package/components/scatter/index.js.map +1 -0
- package/components/scatter/modules/point.d.ts +7 -0
- package/components/scatter/modules/point.js +86 -0
- package/components/scatter/modules/point.js.map +1 -0
- package/components/scatter/modules/utils.d.ts +11 -0
- package/components/scatter/modules/utils.js +112 -0
- package/components/scatter/modules/utils.js.map +1 -0
- package/components/scatter/style.d.ts +5 -0
- package/{src/components/scatter/style.ts → components/scatter/style.js} +14 -15
- package/components/scatter/style.js.map +1 -0
- package/components/scatter/types.d.ts +19 -0
- package/components/stacked-bar/config.d.ts +38 -0
- package/components/stacked-bar/config.js +20 -0
- package/components/stacked-bar/config.js.map +1 -0
- package/components/stacked-bar/index.d.ts +28 -0
- package/components/stacked-bar/index.js +208 -0
- package/components/stacked-bar/index.js.map +1 -0
- package/components/stacked-bar/style.d.ts +5 -0
- package/{src/components/stacked-bar/style.ts → components/stacked-bar/style.js} +14 -15
- package/components/stacked-bar/style.js.map +1 -0
- package/components/stacked-bar/types.d.ts +5 -0
- package/components/timeline/config.d.ts +43 -0
- package/components/timeline/config.js +24 -0
- package/components/timeline/config.js.map +1 -0
- package/components/timeline/index.d.ts +41 -0
- package/components/timeline/index.js +244 -0
- package/components/timeline/index.js.map +1 -0
- package/components/timeline/style.d.ts +13 -0
- package/{src/components/timeline/style.ts → components/timeline/style.js} +30 -39
- package/components/timeline/style.js.map +1 -0
- package/components/tooltip/config.d.ts +68 -0
- package/components/tooltip/config.js +20 -0
- package/components/tooltip/config.js.map +1 -0
- package/components/tooltip/index.d.ts +36 -0
- package/components/tooltip/index.js +184 -0
- package/components/tooltip/index.js.map +1 -0
- package/{src/components → components}/tooltip/style.js +14 -11
- package/components/tooltip/style.js.map +1 -0
- package/components/topojson-map/config.d.ts +99 -0
- package/components/topojson-map/config.js +42 -0
- package/components/topojson-map/config.js.map +1 -0
- package/components/topojson-map/index.d.ts +52 -0
- package/components/topojson-map/index.js +355 -0
- package/components/topojson-map/index.js.map +1 -0
- package/components/topojson-map/style.d.ts +11 -0
- package/{src/components/topojson-map/style.ts → components/topojson-map/style.js} +26 -33
- package/components/topojson-map/style.js.map +1 -0
- package/components/topojson-map/types.d.ts +78 -0
- package/components/topojson-map/types.js +80 -0
- package/components/topojson-map/types.js.map +1 -0
- package/components/topojson-map/utils.d.ts +3 -0
- package/components/topojson-map/utils.js +30 -0
- package/components/topojson-map/utils.js.map +1 -0
- package/components/vis-controls/config.d.ts +12 -0
- package/components/vis-controls/config.js +13 -0
- package/components/vis-controls/config.js.map +1 -0
- package/components/vis-controls/index.d.ts +14 -0
- package/components/vis-controls/index.js +52 -0
- package/components/vis-controls/index.js.map +1 -0
- package/components/vis-controls/style.d.ts +11 -0
- package/{src/components/vis-controls/style.ts → components/vis-controls/style.js} +27 -34
- package/components/vis-controls/style.js.map +1 -0
- package/components/vis-controls/types.d.ts +13 -0
- package/components/vis-controls/types.js +8 -0
- package/components/vis-controls/types.js.map +1 -0
- package/components/xy-labels/config.d.ts +48 -0
- package/components/xy-labels/config.js +25 -0
- package/components/xy-labels/config.js.map +1 -0
- package/components/xy-labels/index.d.ts +15 -0
- package/components/xy-labels/index.js +87 -0
- package/components/xy-labels/index.js.map +1 -0
- package/components/xy-labels/modules/label.d.ts +9 -0
- package/components/xy-labels/modules/label.js +107 -0
- package/components/xy-labels/modules/label.js.map +1 -0
- package/components/xy-labels/style.d.ts +5 -0
- package/{src/components/xy-labels/style.ts → components/xy-labels/style.js} +14 -15
- package/components/xy-labels/style.js.map +1 -0
- package/components/xy-labels/types.d.ts +23 -0
- package/components/xy-labels/types.js +9 -0
- package/components/xy-labels/types.js.map +1 -0
- package/components.d.ts +51 -0
- package/components.js +29 -0
- package/components.js.map +1 -0
- package/containers/single-container/config.d.ts +12 -0
- package/containers/single-container/config.js +12 -0
- package/containers/single-container/config.js.map +1 -0
- package/containers/single-container/index.d.ts +19 -0
- package/containers/single-container/index.js +128 -0
- package/containers/single-container/index.js.map +1 -0
- package/containers/xy-container/config.d.ts +99 -0
- package/containers/xy-container/config.js +30 -0
- package/containers/xy-container/config.js.map +1 -0
- package/containers/xy-container/index.d.ts +34 -0
- package/containers/xy-container/index.js +330 -0
- package/containers/xy-container/index.js.map +1 -0
- package/containers.d.ts +6 -0
- package/containers.js +4 -0
- package/containers.js.map +1 -0
- package/core/component/config.d.ts +58 -0
- package/core/component/config.js +14 -0
- package/core/component/config.js.map +1 -0
- package/core/component/index.d.ts +43 -0
- package/core/component/index.js +118 -0
- package/core/component/index.js.map +1 -0
- package/core/component/types.d.ts +2 -0
- package/core/component/types.js +2 -0
- package/core/component/types.js.map +1 -0
- package/core/config/index.d.ts +3 -0
- package/core/config/index.js +16 -0
- package/core/config/index.js.map +1 -0
- package/core/container/config.d.ts +48 -0
- package/core/container/config.js +29 -0
- package/core/container/config.js.map +1 -0
- package/core/container/index.d.ts +26 -0
- package/core/container/index.js +106 -0
- package/core/container/index.js.map +1 -0
- package/core/xy-component/config.d.ts +38 -0
- package/core/xy-component/config.js +20 -0
- package/core/xy-component/config.js.map +1 -0
- package/core/xy-component/index.d.ts +27 -0
- package/core/xy-component/index.js +74 -0
- package/core/xy-component/index.js.map +1 -0
- package/data-models/core.d.ts +6 -0
- package/data-models/core.js +14 -0
- package/data-models/core.js.map +1 -0
- package/data-models/graph.d.ts +24 -0
- package/data-models/graph.js +107 -0
- package/data-models/graph.js.map +1 -0
- package/data-models/map-graph.d.ts +21 -0
- package/data-models/map-graph.js +62 -0
- package/data-models/map-graph.js.map +1 -0
- package/data-models/map.d.ts +5 -0
- package/data-models/map.js +12 -0
- package/data-models/map.js.map +1 -0
- package/data-models/series.d.ts +6 -0
- package/data-models/series.js +19 -0
- package/data-models/series.js.map +1 -0
- package/index.d.ts +7 -0
- package/index.js +55 -0
- package/index.js.map +1 -0
- package/maps/china-provinces.json.js +140373 -0
- package/maps/fr-regions.json.js +14162 -0
- package/maps/germany-regions.json.js +35760 -0
- package/maps/ind-regions.json.js +290584 -0
- package/maps/uk-regions.json.js +96233 -0
- package/maps/us-counties.json.js +206318 -0
- package/maps/us-states.json.js +16345 -0
- package/maps/world-110m-alpha.json.js +251366 -0
- package/maps/world-simple.json.js +89428 -0
- package/maps/world-simplest.json.js +28175 -0
- package/maps.d.ts +60 -0
- package/maps.js +23 -0
- package/package.json +1 -1
- package/styles/colors.d.ts +7 -0
- package/styles/colors.js +24 -0
- package/styles/colors.js.map +1 -0
- package/styles/index.d.ts +7 -0
- package/styles/index.js +38 -0
- package/styles/index.js.map +1 -0
- package/styles/sizes.d.ts +2 -0
- package/{src/styles/sizes.ts → styles/sizes.js} +8 -6
- package/styles/sizes.js.map +1 -0
- package/types/accessor.d.ts +5 -0
- package/types/accessor.js +2 -0
- package/types/accessor.js.map +1 -0
- package/types/component.d.ts +13 -0
- package/types/component.js +14 -0
- package/types/component.js.map +1 -0
- package/types/curve.d.ts +40 -0
- package/types/curve.js +46 -0
- package/types/curve.js.map +1 -0
- package/types/data.d.ts +7 -0
- package/types/data.js +2 -0
- package/types/data.js.map +1 -0
- package/types/direction.d.ts +6 -0
- package/types/direction.js +10 -0
- package/types/direction.js.map +1 -0
- package/types/graph.d.ts +35 -0
- package/types/graph.js +2 -0
- package/types/graph.js.map +1 -0
- package/types/map.d.ts +4 -0
- package/types/map.js +2 -0
- package/types/map.js.map +1 -0
- package/types/misc.d.ts +8 -0
- package/types/position.d.ts +20 -0
- package/types/position.js +27 -0
- package/types/position.js.map +1 -0
- package/types/scale.d.ts +23 -0
- package/types/scale.js +27 -0
- package/types/scale.js.map +1 -0
- package/types/shape.d.ts +7 -0
- package/types/shape.js +11 -0
- package/types/shape.js.map +1 -0
- package/types/spacing.d.ts +6 -0
- package/types/spacing.js +2 -0
- package/types/spacing.js.map +1 -0
- package/types/svg.d.ts +18 -0
- package/types/svg.js +22 -0
- package/types/svg.js.map +1 -0
- package/types/symbol.d.ts +18 -0
- package/types/symbol.js +24 -0
- package/types/symbol.js.map +1 -0
- package/types/text.d.ts +47 -0
- package/types/text.js +26 -0
- package/types/text.js.map +1 -0
- package/types.d.ts +27 -0
- package/types.js +30 -0
- package/types.js.map +1 -0
- package/utils/color.d.ts +10 -0
- package/utils/color.js +32 -0
- package/utils/color.js.map +1 -0
- package/utils/d3.d.ts +3 -0
- package/utils/d3.js +16 -0
- package/utils/d3.js.map +1 -0
- package/utils/data.d.ts +45 -0
- package/utils/data.js +274 -0
- package/utils/data.js.map +1 -0
- package/utils/html.d.ts +1 -0
- package/utils/html.js +16 -0
- package/utils/html.js.map +1 -0
- package/utils/map.d.ts +2 -0
- package/utils/map.js +20 -0
- package/utils/map.js.map +1 -0
- package/utils/misc.d.ts +9 -0
- package/utils/misc.js +47 -0
- package/utils/misc.js.map +1 -0
- package/utils/path.d.ts +23 -0
- package/utils/path.js +144 -0
- package/utils/path.js.map +1 -0
- package/utils/scale.d.ts +1 -0
- package/utils/style.d.ts +6 -0
- package/utils/style.js +24 -0
- package/utils/style.js.map +1 -0
- package/utils/svg.d.ts +3 -0
- package/utils/text.d.ts +139 -0
- package/utils/text.js +443 -0
- package/utils/text.js.map +1 -0
- package/utils/type.d.ts +5 -0
- package/declaration.d.ts +0 -1
- package/index.ts +0 -1
- package/licences.txt +0 -43
- package/maps.ts +0 -1
- package/rollup.config.js +0 -71
- package/rules/ts-getter-setter.js +0 -35
- package/src/components/area/config.ts +0 -29
- package/src/components/area/index.ts +0 -133
- package/src/components/area/types.ts +0 -2
- package/src/components/axis/config.ts +0 -76
- package/src/components/axis/index.ts +0 -363
- package/src/components/axis/types.ts +0 -4
- package/src/components/brush/config.ts +0 -51
- package/src/components/brush/index.ts +0 -233
- package/src/components/brush/types.ts +0 -8
- package/src/components/bullet-legend/config.ts +0 -38
- package/src/components/bullet-legend/index.ts +0 -104
- package/src/components/bullet-legend/types.ts +0 -7
- package/src/components/chord-diagram/config.ts +0 -53
- package/src/components/chord-diagram/index.ts +0 -401
- package/src/components/chord-diagram/modules/label.ts +0 -155
- package/src/components/chord-diagram/modules/link.ts +0 -91
- package/src/components/chord-diagram/modules/node.ts +0 -80
- package/src/components/chord-diagram/types.ts +0 -68
- package/src/components/crosshair/config.ts +0 -48
- package/src/components/crosshair/index.ts +0 -220
- package/src/components/crosshair/types.ts +0 -15
- package/src/components/donut/config.ts +0 -65
- package/src/components/donut/index.ts +0 -148
- package/src/components/donut/modules/arc.ts +0 -86
- package/src/components/donut/types.ts +0 -17
- package/src/components/flow-legend/config.ts +0 -31
- package/src/components/flow-legend/index.ts +0 -103
- package/src/components/flow-legend/types.ts +0 -10
- package/src/components/free-brush/config.ts +0 -54
- package/src/components/free-brush/index.ts +0 -207
- package/src/components/free-brush/types.ts +0 -8
- package/src/components/graph/config.ts +0 -280
- package/src/components/graph/index.ts +0 -809
- package/src/components/graph/modules/layout-helpers.ts +0 -96
- package/src/components/graph/modules/layout.ts +0 -502
- package/src/components/graph/modules/link/helper.ts +0 -105
- package/src/components/graph/modules/link/index.ts +0 -302
- package/src/components/graph/modules/node/helper.ts +0 -162
- package/src/components/graph/modules/node/index.ts +0 -343
- package/src/components/graph/modules/panel/helper.ts +0 -160
- package/src/components/graph/modules/panel/index.ts +0 -137
- package/src/components/graph/modules/shape.ts +0 -108
- package/src/components/graph/modules/zoom-levels.ts +0 -6
- package/src/components/graph/style.ts +0 -72
- package/src/components/graph/types.ts +0 -152
- package/src/components/grouped-bar/config.ts +0 -40
- package/src/components/grouped-bar/index.ts +0 -325
- package/src/components/leaflet-flow-map/config.ts +0 -60
- package/src/components/leaflet-flow-map/index.ts +0 -279
- package/src/components/leaflet-flow-map/renderer-utils.ts +0 -14
- package/src/components/leaflet-flow-map/renderer.ts +0 -146
- package/src/components/leaflet-flow-map/types.ts +0 -18
- package/src/components/leaflet-map/config.ts +0 -234
- package/src/components/leaflet-map/index.ts +0 -808
- package/src/components/leaflet-map/leaflet.css +0 -625
- package/src/components/leaflet-map/modules/clusterBackground.ts +0 -34
- package/src/components/leaflet-map/modules/donut.ts +0 -37
- package/src/components/leaflet-map/modules/map.ts +0 -178
- package/src/components/leaflet-map/modules/node.ts +0 -208
- package/src/components/leaflet-map/modules/selectionRing.ts +0 -63
- package/src/components/leaflet-map/modules/utils.ts +0 -290
- package/src/components/leaflet-map/renderer/map-style.ts +0 -24
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json +0 -35
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json +0 -35
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json +0 -2185
- package/src/components/leaflet-map/renderer/mapboxgl-layer.ts +0 -43
- package/src/components/leaflet-map/renderer/mapboxgl-utils.ts +0 -40
- package/src/components/leaflet-map/style.ts +0 -217
- package/src/components/leaflet-map/types.ts +0 -75
- package/src/components/line/config.ts +0 -34
- package/src/components/line/index.ts +0 -188
- package/src/components/line/types.ts +0 -3
- package/src/components/nested-donut/config.ts +0 -75
- package/src/components/nested-donut/index.ts +0 -176
- package/src/components/nested-donut/modules/arc.ts +0 -78
- package/src/components/nested-donut/modules/label.ts +0 -63
- package/src/components/nested-donut/style.ts +0 -82
- package/src/components/nested-donut/types.ts +0 -29
- package/src/components/sankey/config.ts +0 -195
- package/src/components/sankey/index.ts +0 -387
- package/src/components/sankey/modules/label.ts +0 -228
- package/src/components/sankey/modules/link.ts +0 -141
- package/src/components/sankey/modules/node.ts +0 -221
- package/src/components/sankey/types.ts +0 -95
- package/src/components/scatter/config.ts +0 -49
- package/src/components/scatter/index.ts +0 -220
- package/src/components/scatter/modules/point.ts +0 -123
- package/src/components/scatter/modules/utils.ts +0 -150
- package/src/components/scatter/types.ts +0 -21
- package/src/components/stacked-bar/config.ts +0 -42
- package/src/components/stacked-bar/index.ts +0 -267
- package/src/components/stacked-bar/types.ts +0 -5
- package/src/components/timeline/config.ts +0 -49
- package/src/components/timeline/index.ts +0 -302
- package/src/components/tooltip/config.ts +0 -69
- package/src/components/tooltip/index.ts +0 -220
- package/src/components/topojson-map/config.ts +0 -124
- package/src/components/topojson-map/index.ts +0 -436
- package/src/components/topojson-map/types.ts +0 -123
- package/src/components/topojson-map/utils.ts +0 -29
- package/src/components/vis-controls/config.ts +0 -16
- package/src/components/vis-controls/index.ts +0 -68
- package/src/components/vis-controls/types.ts +0 -14
- package/src/components/xy-labels/config.ts +0 -56
- package/src/components/xy-labels/index.ts +0 -109
- package/src/components/xy-labels/modules/label.ts +0 -140
- package/src/components/xy-labels/types.ts +0 -26
- package/src/components.ts +0 -56
- package/src/containers/single-container/config.ts +0 -15
- package/src/containers/single-container/index.ts +0 -150
- package/src/containers/xy-container/config.ts +0 -112
- package/src/containers/xy-container/index.ts +0 -407
- package/src/containers.ts +0 -6
- package/src/core/component/config.ts +0 -61
- package/src/core/component/index.ts +0 -154
- package/src/core/component/types.ts +0 -9
- package/src/core/config/index.ts +0 -12
- package/src/core/container/config.ts +0 -56
- package/src/core/container/index.ts +0 -136
- package/src/core/xy-component/config.ts +0 -46
- package/src/core/xy-component/index.ts +0 -90
- package/src/data-models/core.ts +0 -15
- package/src/data-models/graph.ts +0 -138
- package/src/data-models/map-graph.ts +0 -72
- package/src/data-models/map.ts +0 -18
- package/src/data-models/series.ts +0 -16
- package/src/index.ts +0 -7
- package/src/maps/china-provinces.json +0 -1
- package/src/maps/fr-regions.json +0 -1
- package/src/maps/germany-regions.json +0 -1
- package/src/maps/ind-regions.json +0 -1
- package/src/maps/uk-regions.json +0 -1
- package/src/maps/us-counties.json +0 -1
- package/src/maps/us-states.json +0 -1
- package/src/maps/world-110m-alpha.json +0 -1
- package/src/maps/world-simple.json +0 -1
- package/src/maps/world-simplest.json +0 -1
- package/src/maps.ts +0 -34
- package/src/styles/colors.ts +0 -28
- package/src/styles/index.ts +0 -38
- package/src/types/accessor.ts +0 -5
- package/src/types/component.ts +0 -15
- package/src/types/curve.ts +0 -62
- package/src/types/data.ts +0 -5
- package/src/types/direction.ts +0 -6
- package/src/types/graph.ts +0 -40
- package/src/types/map.ts +0 -5
- package/src/types/misc.ts +0 -10
- package/src/types/position.ts +0 -23
- package/src/types/scale.ts +0 -47
- package/src/types/shape.ts +0 -7
- package/src/types/spacing.ts +0 -6
- package/src/types/svg.ts +0 -32
- package/src/types/symbol.ts +0 -21
- package/src/types/text.ts +0 -71
- package/src/types.ts +0 -31
- package/src/utils/color.ts +0 -41
- package/src/utils/d3.ts +0 -15
- package/src/utils/data.ts +0 -328
- package/src/utils/html.ts +0 -13
- package/src/utils/map.ts +0 -29
- package/src/utils/misc.ts +0 -54
- package/src/utils/path.ts +0 -196
- package/src/utils/scale.ts +0 -1
- package/src/utils/style.ts +0 -37
- package/src/utils/svg.ts +0 -49
- package/src/utils/text.ts +0 -529
- package/src/utils/type.ts +0 -9
- package/tsconfig.json +0 -29
|
@@ -0,0 +1,656 @@
|
|
|
1
|
+
import { __awaiter } from 'tslib';
|
|
2
|
+
import { min, max } from 'd3-array';
|
|
3
|
+
import { select, pointer } from 'd3-selection';
|
|
4
|
+
import { zoom, zoomTransform, zoomIdentity } from 'd3-zoom';
|
|
5
|
+
import { drag } from 'd3-drag';
|
|
6
|
+
import { interval } from 'd3-timer';
|
|
7
|
+
import { ComponentCore } from '../../core/component/index.js';
|
|
8
|
+
import { GraphDataModel } from '../../data-models/graph.js';
|
|
9
|
+
import { isNumber, clamp, getBoolean, isFunction, shallowDiff, unique, clean } from '../../utils/data.js';
|
|
10
|
+
import { stringToHtmlId } from '../../utils/misc.js';
|
|
11
|
+
import { smartTransition } from '../../utils/d3.js';
|
|
12
|
+
import { GraphLayoutType, GraphLinkArrowStyle } from './types.js';
|
|
13
|
+
import { GraphConfig } from './config.js';
|
|
14
|
+
import { background, graphGroup, root } from './style.js';
|
|
15
|
+
import * as style from './modules/node/style.js';
|
|
16
|
+
import { nodes, gNode, gNodeExit, node, nodeGauge, sideLabelGroup, label } from './modules/node/style.js';
|
|
17
|
+
import { links, gLink, gLinkExit, link } from './modules/link/style.js';
|
|
18
|
+
import { panels, gPanel, panel, panelSelection, label as label$1, labelText, sideIconGroup, sideIconShape, sideIconSymbol } from './modules/panel/style.js';
|
|
19
|
+
import { createNodes, updateNodes, removeNodes, updateSelectedNodes, zoomNodesThrottled, zoomNodes } from './modules/node/index.js';
|
|
20
|
+
import { getMaxNodeSize, getX, getY, getNodeSize } from './modules/node/helper.js';
|
|
21
|
+
import { createLinks, updateLinks, removeLinks, updateSelectedLinks, animateLinkFlow, zoomLinksThrottled, zoomLinks } from './modules/link/index.js';
|
|
22
|
+
import { getLinkColor, getLinkArrow, LINK_MARKER_WIDTH, LINK_MARKER_HEIGHT, getDoubleArrowPath, getArrowPath } from './modules/link/helper.js';
|
|
23
|
+
import { removePanels, createPanels, updatePanels } from './modules/panel/index.js';
|
|
24
|
+
import { initPanels, setPanelForNodes, updatePanelNumNodes, updatePanelBBoxSize } from './modules/panel/helper.js';
|
|
25
|
+
import { applyLayoutCircular, applyELKLayout, applyLayoutConcentric, applyLayoutForce, applyLayoutDagre, applyLayoutParallel } from './modules/layout.js';
|
|
26
|
+
|
|
27
|
+
class Graph extends ComponentCore {
|
|
28
|
+
constructor(config) {
|
|
29
|
+
super();
|
|
30
|
+
this.config = new GraphConfig();
|
|
31
|
+
this.datamodel = new GraphDataModel();
|
|
32
|
+
this._isFirstRender = true;
|
|
33
|
+
this._shouldRecalculateLayout = false;
|
|
34
|
+
this._shouldSetPanels = false;
|
|
35
|
+
this._isAutoFitDisabled = false;
|
|
36
|
+
this._isDragging = false;
|
|
37
|
+
this.events = {
|
|
38
|
+
[Graph.selectors.background]: {
|
|
39
|
+
click: this._onBackgroundClick.bind(this),
|
|
40
|
+
},
|
|
41
|
+
[Graph.selectors.node]: {
|
|
42
|
+
click: this._onNodeClick.bind(this),
|
|
43
|
+
mouseover: this._onNodeMouseOver.bind(this),
|
|
44
|
+
mouseout: this._onNodeMouseOut.bind(this),
|
|
45
|
+
},
|
|
46
|
+
[Graph.selectors.link]: {
|
|
47
|
+
click: this._onLinkClick.bind(this),
|
|
48
|
+
mouseover: this._onLinkMouseOver.bind(this),
|
|
49
|
+
mouseout: this._onLinkMouseOut.bind(this),
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
if (config)
|
|
53
|
+
this.config.init(config);
|
|
54
|
+
this._backgroundRect = this.g.append('rect').attr('class', background);
|
|
55
|
+
this._graphGroup = this.g.append('g').attr('class', graphGroup);
|
|
56
|
+
this._zoomBehavior = zoom()
|
|
57
|
+
.scaleExtent(this.config.zoomScaleExtent)
|
|
58
|
+
.on('zoom', (e) => this._onZoom(e.transform, e));
|
|
59
|
+
this._panelsGroup = this._graphGroup.append('g').attr('class', panels);
|
|
60
|
+
this._linksGroup = this._graphGroup.append('g').attr('class', links);
|
|
61
|
+
this._nodesGroup = this._graphGroup.append('g').attr('class', nodes);
|
|
62
|
+
this._defs = this._graphGroup.append('defs');
|
|
63
|
+
this._getMarkerId = this._getMarkerId.bind(this);
|
|
64
|
+
}
|
|
65
|
+
get selectedNode() {
|
|
66
|
+
return this._selectedNode;
|
|
67
|
+
}
|
|
68
|
+
get selectedLink() {
|
|
69
|
+
return this._selectedLink;
|
|
70
|
+
}
|
|
71
|
+
setData(data) {
|
|
72
|
+
const { config } = this;
|
|
73
|
+
this.datamodel.nodeSort = config.nodeSort;
|
|
74
|
+
this.datamodel.data = data;
|
|
75
|
+
this._shouldRecalculateLayout = true;
|
|
76
|
+
if (config.layoutAutofit)
|
|
77
|
+
this._shouldFitLayout = true;
|
|
78
|
+
this._shouldSetPanels = true;
|
|
79
|
+
this._addSVGDefs();
|
|
80
|
+
}
|
|
81
|
+
setConfig(config) {
|
|
82
|
+
this._shouldFitLayout = this._shouldFitLayout || this.config.layoutType !== config.layoutType;
|
|
83
|
+
this._shouldRecalculateLayout = this._shouldRecalculateLayout || this._shouldLayoutRecalculate(config);
|
|
84
|
+
super.setConfig(config);
|
|
85
|
+
this._shouldSetPanels = true;
|
|
86
|
+
}
|
|
87
|
+
get bleed() {
|
|
88
|
+
const extraPadding = 50; // Extra padding to take into account labels and selection outlines
|
|
89
|
+
return { top: extraPadding, bottom: extraPadding, left: extraPadding, right: extraPadding };
|
|
90
|
+
}
|
|
91
|
+
_render(customDuration) {
|
|
92
|
+
const { config: { disableZoom, duration, layoutAutofit, panels }, datamodel } = this;
|
|
93
|
+
if (!datamodel.nodes && !datamodel.links)
|
|
94
|
+
return;
|
|
95
|
+
const animDuration = isNumber(customDuration) ? customDuration : duration;
|
|
96
|
+
this._backgroundRect
|
|
97
|
+
.attr('width', this._width)
|
|
98
|
+
.attr('height', this._height)
|
|
99
|
+
.attr('opacity', 0);
|
|
100
|
+
if ((this._prevWidth !== this._width || this._prevHeight !== this._height) && layoutAutofit) {
|
|
101
|
+
// Fit layout on resize
|
|
102
|
+
this._shouldFitLayout = true;
|
|
103
|
+
this._prevWidth = this._width;
|
|
104
|
+
this._prevHeight = this._height;
|
|
105
|
+
}
|
|
106
|
+
// Apply layout and render
|
|
107
|
+
this._calculateLayout().then((isFirstRender) => {
|
|
108
|
+
// If the component has been destroyed while the layout calculation
|
|
109
|
+
// was in progress, we cancel the render
|
|
110
|
+
if (this.isDestroyed())
|
|
111
|
+
return;
|
|
112
|
+
if (this._shouldSetPanels) {
|
|
113
|
+
smartTransition(this._panelsGroup, duration / 2)
|
|
114
|
+
.style('opacity', (panels === null || panels === void 0 ? void 0 : panels.length) ? 1 : 0);
|
|
115
|
+
this._panels = initPanels(panels);
|
|
116
|
+
setPanelForNodes(this._panels, datamodel.nodes, this.config);
|
|
117
|
+
this._shouldSetPanels = false;
|
|
118
|
+
}
|
|
119
|
+
if (isFirstRender) {
|
|
120
|
+
this._fit();
|
|
121
|
+
this._shouldFitLayout = false;
|
|
122
|
+
}
|
|
123
|
+
else if (this._shouldFitLayout && !this._isAutoFitDisabled) {
|
|
124
|
+
this._fit(duration);
|
|
125
|
+
this._shouldFitLayout = false;
|
|
126
|
+
}
|
|
127
|
+
// Draw
|
|
128
|
+
this._drawNodes(animDuration);
|
|
129
|
+
this._drawLinks(animDuration);
|
|
130
|
+
// Select Links / Nodes
|
|
131
|
+
this._resetSelection();
|
|
132
|
+
if (this.config.selectedNodeId) {
|
|
133
|
+
const selectedNode = datamodel.nodes.find(node => node.id === this.config.selectedNodeId);
|
|
134
|
+
this._selectNode(selectedNode);
|
|
135
|
+
}
|
|
136
|
+
if (this.config.selectedLinkId) {
|
|
137
|
+
const selectedLink = datamodel.links.find(link => link.id === this.config.selectedLinkId);
|
|
138
|
+
this._selectLink(selectedLink);
|
|
139
|
+
}
|
|
140
|
+
// Link flow animation timer
|
|
141
|
+
if (!this._timer) {
|
|
142
|
+
const refreshRateMs = 35;
|
|
143
|
+
this._timer = interval(this._onLinkFlowTimerFrame.bind(this), refreshRateMs);
|
|
144
|
+
}
|
|
145
|
+
// Zoom
|
|
146
|
+
if (disableZoom)
|
|
147
|
+
this.g.on('.zoom', null);
|
|
148
|
+
else
|
|
149
|
+
this.g.call(this._zoomBehavior).on('dblclick.zoom', null);
|
|
150
|
+
if (!this._isFirstRender && !disableZoom) {
|
|
151
|
+
const transform = zoomTransform(this.g.node());
|
|
152
|
+
this._onZoom(transform);
|
|
153
|
+
}
|
|
154
|
+
// While the graph is animating we disable pointer events on the graph group
|
|
155
|
+
if (animDuration) {
|
|
156
|
+
this._graphGroup.attr('pointer-events', 'none');
|
|
157
|
+
}
|
|
158
|
+
smartTransition(this._graphGroup, animDuration)
|
|
159
|
+
.on('end interrupt', () => {
|
|
160
|
+
this._graphGroup.attr('pointer-events', null);
|
|
161
|
+
});
|
|
162
|
+
// We need to set up events and attributes again because the rendering might have been delayed by the layout
|
|
163
|
+
// calculation and they were not set up properly (see the render function of `ComponentCore`)
|
|
164
|
+
this._setUpComponentEventsThrottled();
|
|
165
|
+
this._setCustomAttributesThrottled();
|
|
166
|
+
});
|
|
167
|
+
this._isFirstRender = false;
|
|
168
|
+
}
|
|
169
|
+
_drawNodes(duration) {
|
|
170
|
+
const { config, datamodel } = this;
|
|
171
|
+
const nodes = datamodel.nodes;
|
|
172
|
+
const nodeGroups = this._nodesGroup
|
|
173
|
+
.selectAll(`.${gNode}:not(.${gNodeExit})`)
|
|
174
|
+
.data(nodes, d => String(d._id));
|
|
175
|
+
const nodeGroupsEnter = nodeGroups.enter().append('g')
|
|
176
|
+
.attr('class', gNode)
|
|
177
|
+
.call(createNodes, config, duration);
|
|
178
|
+
const nodeGroupsMerged = nodeGroups.merge(nodeGroupsEnter);
|
|
179
|
+
const nodeUpdateSelection = updateNodes(nodeGroupsMerged, config, duration, this._scale);
|
|
180
|
+
this._drawPanels(nodeUpdateSelection, duration);
|
|
181
|
+
const nodesGroupExit = nodeGroups.exit();
|
|
182
|
+
nodesGroupExit
|
|
183
|
+
.classed(gNodeExit, true)
|
|
184
|
+
.call(removeNodes, config, duration);
|
|
185
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
186
|
+
const thisRef = this;
|
|
187
|
+
if (!config.disableDrag) {
|
|
188
|
+
const dragBehaviour = drag()
|
|
189
|
+
.on('start', function (event, d) { thisRef._onDragStarted(d, event, select(this)); })
|
|
190
|
+
.on('drag', function (event, d) { thisRef._onDragged(d, event, nodeGroupsMerged); })
|
|
191
|
+
.on('end', function (event, d) { thisRef._onDragEnded(d, event, select(this)); });
|
|
192
|
+
nodeGroupsMerged.call(dragBehaviour);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
nodeGroupsMerged.on('.drag', null);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
_drawLinks(duration) {
|
|
199
|
+
const { config, datamodel: { links } } = this;
|
|
200
|
+
const linkGroups = this._linksGroup
|
|
201
|
+
.selectAll(`.${gLink}`)
|
|
202
|
+
.data(links, (d) => String(d._id));
|
|
203
|
+
const linkGroupsEnter = linkGroups.enter().append('g')
|
|
204
|
+
.attr('class', gLink)
|
|
205
|
+
.call(createLinks, config, duration);
|
|
206
|
+
const linkGroupsMerged = linkGroups.merge(linkGroupsEnter);
|
|
207
|
+
linkGroupsMerged.call(updateLinks, config, duration, this._scale, this._getMarkerId);
|
|
208
|
+
const linkGroupsExit = linkGroups.exit();
|
|
209
|
+
linkGroupsExit
|
|
210
|
+
.attr('class', gLinkExit)
|
|
211
|
+
.call(removeLinks, config, duration);
|
|
212
|
+
}
|
|
213
|
+
_drawPanels(nodeUpdateSelection, duration) {
|
|
214
|
+
const { config } = this;
|
|
215
|
+
if (!this._panels)
|
|
216
|
+
return;
|
|
217
|
+
const selection = (nodeUpdateSelection.duration)
|
|
218
|
+
? nodeUpdateSelection.selection()
|
|
219
|
+
: nodeUpdateSelection;
|
|
220
|
+
updatePanelNumNodes(selection, this._panels, config);
|
|
221
|
+
updatePanelBBoxSize(selection, this._panels, config);
|
|
222
|
+
const panelData = this._panels.filter(p => p._numNodes);
|
|
223
|
+
const panelGroup = this._panelsGroup
|
|
224
|
+
.selectAll(`.${gPanel}`)
|
|
225
|
+
.data(panelData, p => p.label);
|
|
226
|
+
const panelGroupExit = panelGroup.exit();
|
|
227
|
+
panelGroupExit.call(removePanels, config, duration);
|
|
228
|
+
const panelGroupEnter = panelGroup.enter().append('g')
|
|
229
|
+
.attr('class', gPanel)
|
|
230
|
+
.call(createPanels, selection);
|
|
231
|
+
const panelGroupMerged = panelGroup.merge(panelGroupEnter);
|
|
232
|
+
this._updatePanels(panelGroupMerged, duration);
|
|
233
|
+
}
|
|
234
|
+
_updatePanels(panelToUpdate, duration) {
|
|
235
|
+
const { config } = this;
|
|
236
|
+
if (!this._panels)
|
|
237
|
+
return;
|
|
238
|
+
panelToUpdate.call(updatePanels, config, duration);
|
|
239
|
+
}
|
|
240
|
+
_calculateLayout() {
|
|
241
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
242
|
+
const { config, datamodel } = this;
|
|
243
|
+
const firstRender = this._isFirstRender;
|
|
244
|
+
if (this._shouldRecalculateLayout) {
|
|
245
|
+
switch (config.layoutType) {
|
|
246
|
+
case GraphLayoutType.Parallel:
|
|
247
|
+
applyLayoutParallel(datamodel, config, this._width, this._height);
|
|
248
|
+
break;
|
|
249
|
+
case GraphLayoutType.ParallelHorizontal:
|
|
250
|
+
applyLayoutParallel(datamodel, config, this._width, this._height, 'horizontal');
|
|
251
|
+
break;
|
|
252
|
+
case GraphLayoutType.Dagre:
|
|
253
|
+
yield applyLayoutDagre(datamodel, config, this._width);
|
|
254
|
+
break;
|
|
255
|
+
case GraphLayoutType.Force:
|
|
256
|
+
yield applyLayoutForce(datamodel, config, this._width);
|
|
257
|
+
break;
|
|
258
|
+
case GraphLayoutType.Concentric:
|
|
259
|
+
applyLayoutConcentric(datamodel, config, this._width, this._height);
|
|
260
|
+
break;
|
|
261
|
+
case GraphLayoutType.Elk:
|
|
262
|
+
yield applyELKLayout(datamodel, config, this._width);
|
|
263
|
+
break;
|
|
264
|
+
case GraphLayoutType.Circular:
|
|
265
|
+
default:
|
|
266
|
+
applyLayoutCircular(datamodel, config, this._width, this._height);
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
this._shouldRecalculateLayout = false;
|
|
270
|
+
}
|
|
271
|
+
return firstRender;
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
_fit(duration = 0) {
|
|
275
|
+
var _a;
|
|
276
|
+
const { datamodel: { nodes } } = this;
|
|
277
|
+
if ((nodes === null || nodes === void 0 ? void 0 : nodes.length) && ((_a = this.g) === null || _a === void 0 ? void 0 : _a.size())) {
|
|
278
|
+
const transform = this._getTransform(nodes);
|
|
279
|
+
smartTransition(this.g, duration)
|
|
280
|
+
.call(this._zoomBehavior.transform, transform);
|
|
281
|
+
this._onZoom(transform);
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
console.warn('Unovis | Graph: Node data is not defined. Check if the component has been initialized.');
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
_getTransform(nodes) {
|
|
288
|
+
const { nodeSize, zoomScaleExtent } = this.config;
|
|
289
|
+
const { left, top, right, bottom } = this.bleed;
|
|
290
|
+
const maxNodeSize = getMaxNodeSize(nodes, nodeSize);
|
|
291
|
+
const w = this._width;
|
|
292
|
+
const h = this._height;
|
|
293
|
+
const xExtent = [
|
|
294
|
+
min(nodes, d => { var _a; return getX(d) - maxNodeSize / 2 - (max((_a = d._panels) === null || _a === void 0 ? void 0 : _a.map(p => p._padding.left)) || 0); }),
|
|
295
|
+
max(nodes, d => { var _a; return getX(d) + maxNodeSize / 2 + (max((_a = d._panels) === null || _a === void 0 ? void 0 : _a.map(p => p._padding.right)) || 0); }),
|
|
296
|
+
];
|
|
297
|
+
const yExtent = [
|
|
298
|
+
min(nodes, d => { var _a; return getY(d) - maxNodeSize / 2 - (max((_a = d._panels) === null || _a === void 0 ? void 0 : _a.map(p => p._padding.top)) || 0); }),
|
|
299
|
+
max(nodes, d => { var _a; return getY(d) + maxNodeSize / 2 + (max((_a = d._panels) === null || _a === void 0 ? void 0 : _a.map(p => p._padding.bottom)) || 0); }),
|
|
300
|
+
];
|
|
301
|
+
const xScale = w / (xExtent[1] - xExtent[0] + left + right);
|
|
302
|
+
const yScale = h / (yExtent[1] - yExtent[0] + top + bottom);
|
|
303
|
+
const clampedScale = clamp(min([xScale, yScale]), zoomScaleExtent[0], zoomScaleExtent[1]);
|
|
304
|
+
const xCenter = (xExtent[1] + xExtent[0]) / 2;
|
|
305
|
+
const yCenter = (yExtent[1] + yExtent[0]) / 2;
|
|
306
|
+
const translateX = this._width / 2 - xCenter * clampedScale;
|
|
307
|
+
const translateY = this._height / 2 - yCenter * clampedScale;
|
|
308
|
+
const transform = zoomIdentity
|
|
309
|
+
.translate(translateX, translateY)
|
|
310
|
+
.scale(clampedScale);
|
|
311
|
+
return transform;
|
|
312
|
+
}
|
|
313
|
+
_selectNode(node) {
|
|
314
|
+
const { datamodel: { nodes, links } } = this;
|
|
315
|
+
if (!node)
|
|
316
|
+
console.warn('Unovis | Graph: Select Node: Not found');
|
|
317
|
+
this._selectedNode = node;
|
|
318
|
+
// Apply grey out
|
|
319
|
+
// Grey out all nodes
|
|
320
|
+
nodes.forEach(n => {
|
|
321
|
+
n._state.selected = false;
|
|
322
|
+
n._state.greyout = true;
|
|
323
|
+
});
|
|
324
|
+
// Grey out all links
|
|
325
|
+
links.forEach(l => {
|
|
326
|
+
l._state.greyout = true;
|
|
327
|
+
l._state.selected = false;
|
|
328
|
+
});
|
|
329
|
+
// Highlight selected
|
|
330
|
+
if (node) {
|
|
331
|
+
node._state.selected = true;
|
|
332
|
+
node._state.greyout = false;
|
|
333
|
+
const connectedLinks = links.filter(l => (l.source === node) || (l.target === node));
|
|
334
|
+
connectedLinks.forEach(l => {
|
|
335
|
+
const source = l.source;
|
|
336
|
+
const target = l.target;
|
|
337
|
+
source._state.greyout = false;
|
|
338
|
+
target._state.greyout = false;
|
|
339
|
+
l._state.greyout = false;
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
this._updateSelectedElements();
|
|
343
|
+
}
|
|
344
|
+
_selectLink(link) {
|
|
345
|
+
const { datamodel: { nodes, links } } = this;
|
|
346
|
+
if (!link)
|
|
347
|
+
console.warn('Unovis: Graph: Select Link: Not found');
|
|
348
|
+
this._selectedLink = link;
|
|
349
|
+
const selectedLinkSource = link === null || link === void 0 ? void 0 : link.source;
|
|
350
|
+
const selectedLinkTarget = link === null || link === void 0 ? void 0 : link.target;
|
|
351
|
+
// Apply grey out
|
|
352
|
+
nodes.forEach(n => {
|
|
353
|
+
n._state.selected = false;
|
|
354
|
+
n._state.greyout = true;
|
|
355
|
+
if ((selectedLinkTarget === null || selectedLinkTarget === void 0 ? void 0 : selectedLinkTarget._id) === n._id || (selectedLinkSource === null || selectedLinkSource === void 0 ? void 0 : selectedLinkSource._id) === n._id) {
|
|
356
|
+
link._state.greyout = false;
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
links.forEach(l => {
|
|
360
|
+
l._state.greyout = true;
|
|
361
|
+
const source = l.source;
|
|
362
|
+
const target = l.target;
|
|
363
|
+
if ((source._id === (selectedLinkSource === null || selectedLinkSource === void 0 ? void 0 : selectedLinkSource._id)) && (target._id === (selectedLinkTarget === null || selectedLinkTarget === void 0 ? void 0 : selectedLinkTarget._id))) {
|
|
364
|
+
source._state.greyout = false;
|
|
365
|
+
target._state.greyout = false;
|
|
366
|
+
l._state.greyout = false;
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
links.forEach(l => {
|
|
370
|
+
delete l._state.selected;
|
|
371
|
+
});
|
|
372
|
+
if (link)
|
|
373
|
+
link._state.selected = true;
|
|
374
|
+
this._updateSelectedElements();
|
|
375
|
+
}
|
|
376
|
+
_resetSelection() {
|
|
377
|
+
const { datamodel: { nodes, links } } = this;
|
|
378
|
+
this._selectedNode = undefined;
|
|
379
|
+
this._selectedLink = undefined;
|
|
380
|
+
// Disable Grayout
|
|
381
|
+
nodes.forEach(n => {
|
|
382
|
+
delete n._state.selected;
|
|
383
|
+
delete n._state.greyout;
|
|
384
|
+
});
|
|
385
|
+
links.forEach(l => {
|
|
386
|
+
delete l._state.greyout;
|
|
387
|
+
delete l._state.selected;
|
|
388
|
+
});
|
|
389
|
+
this._updateSelectedElements();
|
|
390
|
+
}
|
|
391
|
+
_updateSelectedElements() {
|
|
392
|
+
const { config } = this;
|
|
393
|
+
const linkElements = this._linksGroup.selectAll(`.${gLink}`);
|
|
394
|
+
linkElements.call(updateSelectedLinks, config, this._scale);
|
|
395
|
+
const nodeElements = this._nodesGroup.selectAll(`.${gNode}`);
|
|
396
|
+
nodeElements.call(updateSelectedNodes, config);
|
|
397
|
+
// this._drawPanels(nodeElements, 0)
|
|
398
|
+
}
|
|
399
|
+
_onBackgroundClick() {
|
|
400
|
+
this._resetSelection();
|
|
401
|
+
}
|
|
402
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
403
|
+
_onNodeClick(d) {
|
|
404
|
+
}
|
|
405
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
406
|
+
_onNodeMouseOut(d) {
|
|
407
|
+
}
|
|
408
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
409
|
+
_onNodeMouseOver(d) {
|
|
410
|
+
}
|
|
411
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
412
|
+
_onLinkClick(d) {
|
|
413
|
+
}
|
|
414
|
+
_onLinkMouseOver(d) {
|
|
415
|
+
if (this._isDragging)
|
|
416
|
+
return;
|
|
417
|
+
d._state.hovered = true;
|
|
418
|
+
this._updateSelectedElements();
|
|
419
|
+
}
|
|
420
|
+
_onLinkMouseOut(d) {
|
|
421
|
+
if (this._isDragging)
|
|
422
|
+
return;
|
|
423
|
+
delete d._state.hovered;
|
|
424
|
+
this._updateSelectedElements();
|
|
425
|
+
}
|
|
426
|
+
_onLinkFlowTimerFrame(elapsed = 0) {
|
|
427
|
+
const { config: { linkFlow, linkFlowAnimDuration }, datamodel: { links } } = this;
|
|
428
|
+
const hasLinksWithFlow = links.some((d, i) => getBoolean(d, linkFlow, i));
|
|
429
|
+
if (!hasLinksWithFlow)
|
|
430
|
+
return;
|
|
431
|
+
const t = (elapsed % linkFlowAnimDuration) / linkFlowAnimDuration;
|
|
432
|
+
const linkElements = this._linksGroup.selectAll(`.${gLink}`);
|
|
433
|
+
const linksToAnimate = linkElements.filter(d => !d._state.greyout);
|
|
434
|
+
linksToAnimate.each(d => { d._state.flowAnimTime = t; });
|
|
435
|
+
animateLinkFlow(linksToAnimate, this.config, this._scale);
|
|
436
|
+
}
|
|
437
|
+
_onZoom(t, event) {
|
|
438
|
+
const { config, datamodel: { nodes } } = this;
|
|
439
|
+
const transform = t || event.transform;
|
|
440
|
+
this._scale = transform.k;
|
|
441
|
+
this._graphGroup.attr('transform', transform.toString());
|
|
442
|
+
if (isFunction(config.onZoom))
|
|
443
|
+
config.onZoom(this._scale, config.zoomScaleExtent);
|
|
444
|
+
if (!this._initialTransform)
|
|
445
|
+
this._initialTransform = transform;
|
|
446
|
+
// If the event was triggered by a mouse interaction (pan or zoom) we don't
|
|
447
|
+
// refit the layout after recalculation (e.g. on container resize)
|
|
448
|
+
if (event === null || event === void 0 ? void 0 : event.sourceEvent) {
|
|
449
|
+
const diff = Object.keys(transform).reduce((acc, prop) => {
|
|
450
|
+
const val = transform[prop];
|
|
451
|
+
const dVal = Math.abs(val - this._initialTransform[prop]);
|
|
452
|
+
return prop === 'k' ? 2 * dVal : dVal / 50;
|
|
453
|
+
}, 0);
|
|
454
|
+
if (diff > config.layoutAutofitTolerance)
|
|
455
|
+
this._isAutoFitDisabled = true;
|
|
456
|
+
else
|
|
457
|
+
this._isAutoFitDisabled = false;
|
|
458
|
+
}
|
|
459
|
+
this._nodesGroup.selectAll(`.${gNode}`)
|
|
460
|
+
.call((nodes.length > config.zoomThrottledUpdateNodeThreshold ? zoomNodesThrottled : zoomNodes), config, this._scale);
|
|
461
|
+
this._linksGroup.selectAll(`.${gLink}`)
|
|
462
|
+
.call((nodes.length > config.zoomThrottledUpdateNodeThreshold ? zoomLinksThrottled : zoomLinks), config, this._scale, this._getMarkerId);
|
|
463
|
+
}
|
|
464
|
+
_onDragStarted(d, event, nodeSelection) {
|
|
465
|
+
const { config } = this;
|
|
466
|
+
this._isDragging = true;
|
|
467
|
+
d._state.isDragged = true;
|
|
468
|
+
nodeSelection.call(updateNodes, config, 0, this._scale);
|
|
469
|
+
}
|
|
470
|
+
_onDragged(d, event, allNodesSelection) {
|
|
471
|
+
var _a, _b;
|
|
472
|
+
const { config } = this;
|
|
473
|
+
const transform = zoomTransform(this.g.node());
|
|
474
|
+
const scale = transform.k;
|
|
475
|
+
// Prevent the node from being dragged offscreen or outside its panel
|
|
476
|
+
const panels = (_b = (_a = this._panels) === null || _a === void 0 ? void 0 : _a.filter(p => p.nodes.includes(d._id))) !== null && _b !== void 0 ? _b : [];
|
|
477
|
+
const nodeSizeValue = getNodeSize(d, config.nodeSize, d._index);
|
|
478
|
+
const maxY = min([(this._height - transform.y) / scale, ...panels.map(p => p._y + p._height)]) - nodeSizeValue / 2;
|
|
479
|
+
const maxX = min([(this._width - transform.x) / scale, ...panels.map(p => p._x + p._width)]) - nodeSizeValue / 2;
|
|
480
|
+
const minY = max([-transform.y / scale, ...panels.map(p => p._y)]) + nodeSizeValue / 2;
|
|
481
|
+
const minX = max([-transform.x / scale, ...panels.map(p => p._x)]) + nodeSizeValue / 2;
|
|
482
|
+
let [x, y] = pointer(event, this._graphGroup.node());
|
|
483
|
+
if (y < minY)
|
|
484
|
+
y = minY;
|
|
485
|
+
else if (y > maxY)
|
|
486
|
+
y = maxY;
|
|
487
|
+
if (x < minX)
|
|
488
|
+
x = minX;
|
|
489
|
+
else if (x > maxX)
|
|
490
|
+
x = maxX;
|
|
491
|
+
// Snap to Layout
|
|
492
|
+
if (Math.sqrt(Math.pow(x - d.x, 2) + Math.pow(y - d.y, 2)) < 15) {
|
|
493
|
+
x = d.x;
|
|
494
|
+
y = d.y;
|
|
495
|
+
}
|
|
496
|
+
// Assign coordinates
|
|
497
|
+
d._state.fx = x;
|
|
498
|
+
d._state.fy = y;
|
|
499
|
+
if (d._state.fx === d.x)
|
|
500
|
+
delete d._state.fx;
|
|
501
|
+
if (d._state.fy === d.y)
|
|
502
|
+
delete d._state.fy;
|
|
503
|
+
// Update affected DOM elements
|
|
504
|
+
const nodeSelection = this._nodesGroup.selectAll(`.${gNode}`);
|
|
505
|
+
const nodeToUpdate = nodeSelection.filter((n) => n._id === d._id);
|
|
506
|
+
nodeToUpdate.call(updateNodes, config, 0, scale);
|
|
507
|
+
const linkSelection = this._linksGroup.selectAll(`.${gLink}`);
|
|
508
|
+
const linksToUpdate = linkSelection.filter((l) => {
|
|
509
|
+
const source = l.source;
|
|
510
|
+
const target = l.target;
|
|
511
|
+
return source._id === d._id || target._id === d._id;
|
|
512
|
+
});
|
|
513
|
+
linksToUpdate.call(updateLinks, config, 0, scale, this._getMarkerId);
|
|
514
|
+
const linksToAnimate = linksToUpdate.filter(d => d._state.greyout);
|
|
515
|
+
if (linksToAnimate.size())
|
|
516
|
+
animateLinkFlow(linksToAnimate, config, this._scale);
|
|
517
|
+
}
|
|
518
|
+
_onDragEnded(d, event, nodeSelection) {
|
|
519
|
+
const { config } = this;
|
|
520
|
+
this._isDragging = false;
|
|
521
|
+
d._state.isDragged = false;
|
|
522
|
+
nodeSelection.call(updateNodes, config, 0, this._scale);
|
|
523
|
+
}
|
|
524
|
+
_shouldLayoutRecalculate(nextConfig) {
|
|
525
|
+
const { config } = this;
|
|
526
|
+
if (config.layoutType !== nextConfig.layoutType)
|
|
527
|
+
return true;
|
|
528
|
+
if (config.layoutNonConnectedAside !== nextConfig.layoutNonConnectedAside)
|
|
529
|
+
return true;
|
|
530
|
+
if (config.layoutType === GraphLayoutType.Force) {
|
|
531
|
+
const forceSettingsDiff = shallowDiff(config.forceLayoutSettings, nextConfig.forceLayoutSettings);
|
|
532
|
+
if (Object.keys(forceSettingsDiff).length)
|
|
533
|
+
return true;
|
|
534
|
+
}
|
|
535
|
+
if (config.layoutType === GraphLayoutType.Dagre) {
|
|
536
|
+
const dagreSettingsDiff = shallowDiff(config.dagreLayoutSettings, nextConfig.dagreLayoutSettings);
|
|
537
|
+
if (Object.keys(dagreSettingsDiff).length)
|
|
538
|
+
return true;
|
|
539
|
+
}
|
|
540
|
+
if (config.layoutType === GraphLayoutType.Parallel ||
|
|
541
|
+
config.layoutType === GraphLayoutType.ParallelHorizontal ||
|
|
542
|
+
config.layoutType === GraphLayoutType.Concentric) {
|
|
543
|
+
if (config.layoutGroupOrder !== nextConfig.layoutGroupOrder)
|
|
544
|
+
return true;
|
|
545
|
+
if (config.layoutParallelNodesPerColumn !== nextConfig.layoutParallelNodesPerColumn)
|
|
546
|
+
return true;
|
|
547
|
+
if (config.layoutParallelSortConnectionsByGroup !== nextConfig.layoutParallelSortConnectionsByGroup)
|
|
548
|
+
return true;
|
|
549
|
+
}
|
|
550
|
+
return false;
|
|
551
|
+
}
|
|
552
|
+
_getMarkerId(d, color, arrow) {
|
|
553
|
+
const { config } = this;
|
|
554
|
+
const c = color !== null && color !== void 0 ? color : getLinkColor(d, config);
|
|
555
|
+
const a = arrow !== null && arrow !== void 0 ? arrow : getLinkArrow(d, this._scale, config);
|
|
556
|
+
return a && c ? `${this.uid}-${stringToHtmlId(c)}-${a}` : null;
|
|
557
|
+
}
|
|
558
|
+
_addSVGDefs() {
|
|
559
|
+
const { datamodel: { links } } = this;
|
|
560
|
+
// Clean up old defs
|
|
561
|
+
this._defs.selectAll('*').remove();
|
|
562
|
+
// Get all variations of link colors to create markers
|
|
563
|
+
const linkColors = unique(clean(links.map(d => getLinkColor(d, this.config))));
|
|
564
|
+
this._defs.selectAll('marker')
|
|
565
|
+
.data([
|
|
566
|
+
...linkColors.map(d => ({ color: d, arrow: GraphLinkArrowStyle.Single })),
|
|
567
|
+
...linkColors.map(d => ({ color: d, arrow: GraphLinkArrowStyle.Double })), // Double-sided arrows
|
|
568
|
+
]).enter()
|
|
569
|
+
.append('marker')
|
|
570
|
+
.attr('id', d => this._getMarkerId(null, d.color, d.arrow))
|
|
571
|
+
.attr('orient', 'auto')
|
|
572
|
+
.attr('markerWidth', d => d.arrow === GraphLinkArrowStyle.Double ? LINK_MARKER_WIDTH * 2 : LINK_MARKER_WIDTH)
|
|
573
|
+
.attr('markerHeight', d => d.arrow === GraphLinkArrowStyle.Double ? LINK_MARKER_HEIGHT * 2 : LINK_MARKER_HEIGHT)
|
|
574
|
+
.attr('markerUnits', 'userSpaceOnUse')
|
|
575
|
+
.attr('refX', LINK_MARKER_WIDTH - LINK_MARKER_HEIGHT / 2)
|
|
576
|
+
.attr('refY', LINK_MARKER_HEIGHT - LINK_MARKER_HEIGHT / 2)
|
|
577
|
+
.html(d => {
|
|
578
|
+
var _a;
|
|
579
|
+
return `
|
|
580
|
+
<path
|
|
581
|
+
d="${d.arrow === GraphLinkArrowStyle.Double ? getDoubleArrowPath() : getArrowPath()}"
|
|
582
|
+
fill="${(_a = d.color) !== null && _a !== void 0 ? _a : null}"
|
|
583
|
+
/>
|
|
584
|
+
`;
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
zoomIn(increment = 0.3) {
|
|
588
|
+
const scaleBy = 1 + increment;
|
|
589
|
+
smartTransition(this.g, this.config.duration / 2)
|
|
590
|
+
.call(this._zoomBehavior.scaleBy, scaleBy);
|
|
591
|
+
}
|
|
592
|
+
zoomOut(increment = 0.3) {
|
|
593
|
+
const scaleBy = 1 - increment;
|
|
594
|
+
smartTransition(this.g, this.config.duration / 2)
|
|
595
|
+
.call(this._zoomBehavior.scaleBy, scaleBy);
|
|
596
|
+
}
|
|
597
|
+
setZoom(zoomLevel) {
|
|
598
|
+
smartTransition(this.g, this.config.duration / 2)
|
|
599
|
+
.call(this._zoomBehavior.scaleTo, zoomLevel);
|
|
600
|
+
}
|
|
601
|
+
fitView() {
|
|
602
|
+
this._fit(this.config.duration / 2);
|
|
603
|
+
}
|
|
604
|
+
/** Enable automatic fitting to container if it was disabled due to previous zoom / pan interactions */
|
|
605
|
+
resetAutofitState() {
|
|
606
|
+
this._isAutoFitDisabled = false;
|
|
607
|
+
}
|
|
608
|
+
/** Get current coordinates of the nodes as an array of { id: string; x: number; y: number } objects */
|
|
609
|
+
getNodesCoordinates() {
|
|
610
|
+
const { datamodel: { nodes } } = this;
|
|
611
|
+
return nodes.map(n => ({
|
|
612
|
+
id: n._id,
|
|
613
|
+
x: n.x,
|
|
614
|
+
y: n.y,
|
|
615
|
+
}));
|
|
616
|
+
}
|
|
617
|
+
/** Get node coordinates by id as { id: string; x: number; y: number } */
|
|
618
|
+
getNodeCoordinatesById(id) {
|
|
619
|
+
const { datamodel: { nodes } } = this;
|
|
620
|
+
const node = nodes.find(n => n._id === id);
|
|
621
|
+
if (!node) {
|
|
622
|
+
console.warn(`Unovis | Graph: Node ${id} not found`);
|
|
623
|
+
return undefined;
|
|
624
|
+
}
|
|
625
|
+
else {
|
|
626
|
+
return {
|
|
627
|
+
id: node._id,
|
|
628
|
+
x: node.x,
|
|
629
|
+
y: node.y,
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
Graph.selectors = {
|
|
635
|
+
root: root,
|
|
636
|
+
background: background,
|
|
637
|
+
node: gNode,
|
|
638
|
+
nodeShape: node,
|
|
639
|
+
nodeGauge: nodeGauge,
|
|
640
|
+
nodeSideLabel: sideLabelGroup,
|
|
641
|
+
nodeLabel: label,
|
|
642
|
+
link: gLink,
|
|
643
|
+
linkLine: link,
|
|
644
|
+
panel: gPanel,
|
|
645
|
+
panelRect: panel,
|
|
646
|
+
panelSelection: panelSelection,
|
|
647
|
+
panelLabel: label$1,
|
|
648
|
+
panelLabelText: labelText,
|
|
649
|
+
panelSideIcon: sideIconGroup,
|
|
650
|
+
panelSideIconShape: sideIconShape,
|
|
651
|
+
panelSideIconSymbol: sideIconSymbol,
|
|
652
|
+
};
|
|
653
|
+
Graph.nodeSelectors = style;
|
|
654
|
+
|
|
655
|
+
export { Graph };
|
|
656
|
+
//# sourceMappingURL=index.js.map
|