@unovis/ts 1.1.1-beta.5 → 1.1.1-beta.7
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/declaration.d.ts +1 -0
- package/index.ts +1 -0
- package/licences.txt +43 -0
- package/maps.ts +1 -0
- package/package.json +1 -1
- package/rollup.config.js +71 -0
- package/rules/ts-getter-setter.js +35 -0
- package/src/components/area/config.ts +29 -0
- package/src/components/area/index.ts +133 -0
- package/{components/area/style.js → src/components/area/style.ts} +9 -10
- package/src/components/area/types.ts +2 -0
- package/src/components/axis/config.ts +76 -0
- package/src/components/axis/index.ts +363 -0
- package/{components/axis/style.js → src/components/axis/style.ts} +27 -22
- package/src/components/axis/types.ts +4 -0
- package/src/components/brush/config.ts +51 -0
- package/src/components/brush/index.ts +233 -0
- package/{components/brush/style.js → src/components/brush/style.ts} +15 -14
- package/src/components/brush/types.ts +8 -0
- package/src/components/bullet-legend/config.ts +38 -0
- package/src/components/bullet-legend/index.ts +104 -0
- package/{components/bullet-legend/style.js → src/components/bullet-legend/style.ts} +18 -16
- package/src/components/bullet-legend/types.ts +7 -0
- package/src/components/chord-diagram/config.ts +53 -0
- package/src/components/chord-diagram/index.ts +401 -0
- package/src/components/chord-diagram/modules/label.ts +155 -0
- package/src/components/chord-diagram/modules/link.ts +91 -0
- package/src/components/chord-diagram/modules/node.ts +80 -0
- package/{components/chord-diagram/style.js → src/components/chord-diagram/style.ts} +39 -30
- package/src/components/chord-diagram/types.ts +68 -0
- package/src/components/crosshair/config.ts +48 -0
- package/src/components/crosshair/index.ts +220 -0
- package/{components/crosshair/style.js → src/components/crosshair/style.ts} +12 -12
- package/src/components/crosshair/types.ts +15 -0
- package/src/components/donut/config.ts +65 -0
- package/src/components/donut/index.ts +148 -0
- package/src/components/donut/modules/arc.ts +86 -0
- package/{components/donut/style.js → src/components/donut/style.ts} +20 -18
- package/src/components/donut/types.ts +17 -0
- package/src/components/flow-legend/config.ts +31 -0
- package/src/components/flow-legend/index.ts +103 -0
- package/{components/flow-legend/style.js → src/components/flow-legend/style.ts} +25 -21
- package/src/components/flow-legend/types.ts +10 -0
- package/src/components/free-brush/config.ts +54 -0
- package/src/components/free-brush/index.ts +207 -0
- package/{components/free-brush/style.js → src/components/free-brush/style.ts} +12 -12
- package/src/components/free-brush/types.ts +8 -0
- package/src/components/graph/config.ts +280 -0
- package/src/components/graph/index.ts +809 -0
- package/src/components/graph/modules/layout-helpers.ts +96 -0
- package/src/components/graph/modules/layout.ts +502 -0
- package/src/components/graph/modules/link/helper.ts +105 -0
- package/src/components/graph/modules/link/index.ts +302 -0
- package/{components/graph/modules/link/style.js → src/components/graph/modules/link/style.ts} +45 -34
- package/src/components/graph/modules/node/helper.ts +162 -0
- package/src/components/graph/modules/node/index.ts +343 -0
- package/{components/graph/modules/node/style.js → src/components/graph/modules/node/style.ts} +72 -52
- package/src/components/graph/modules/panel/helper.ts +160 -0
- package/src/components/graph/modules/panel/index.ts +137 -0
- package/{components/graph/modules/panel/style.js → src/components/graph/modules/panel/style.ts} +42 -32
- package/src/components/graph/modules/shape.ts +108 -0
- package/src/components/graph/modules/zoom-levels.ts +6 -0
- package/src/components/graph/style.ts +72 -0
- package/src/components/graph/types.ts +152 -0
- package/src/components/grouped-bar/config.ts +40 -0
- package/src/components/grouped-bar/index.ts +325 -0
- package/{components/grouped-bar/style.js → src/components/grouped-bar/style.ts} +15 -14
- package/src/components/leaflet-flow-map/config.ts +60 -0
- package/src/components/leaflet-flow-map/index.ts +279 -0
- package/src/components/leaflet-flow-map/renderer-utils.ts +14 -0
- package/src/components/leaflet-flow-map/renderer.ts +146 -0
- package/{components/leaflet-flow-map/shaders.js → src/components/leaflet-flow-map/shaders.ts} +4 -7
- package/src/components/leaflet-flow-map/types.ts +18 -0
- package/src/components/leaflet-map/config.ts +234 -0
- package/src/components/leaflet-map/index.ts +808 -0
- package/src/components/leaflet-map/leaflet.css +625 -0
- package/src/components/leaflet-map/modules/clusterBackground.ts +34 -0
- package/src/components/leaflet-map/modules/donut.ts +37 -0
- package/src/components/leaflet-map/modules/map.ts +178 -0
- package/src/components/leaflet-map/modules/node.ts +208 -0
- package/src/components/leaflet-map/modules/selectionRing.ts +63 -0
- package/src/components/leaflet-map/modules/utils.ts +290 -0
- package/{components → src/components}/leaflet-map/renderer/leaflet-maplibre-gl.js +76 -78
- package/src/components/leaflet-map/renderer/map-style.ts +24 -0
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json +35 -0
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json +35 -0
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json +2185 -0
- package/src/components/leaflet-map/renderer/mapboxgl-layer.ts +43 -0
- package/src/components/leaflet-map/renderer/mapboxgl-utils.ts +40 -0
- package/{components → src/components}/leaflet-map/renderer/maplibre-gl.css.js +2 -4
- package/src/components/leaflet-map/style.ts +217 -0
- package/src/components/leaflet-map/types.ts +75 -0
- package/src/components/line/config.ts +34 -0
- package/src/components/line/index.ts +188 -0
- package/{components/line/style.js → src/components/line/style.ts} +18 -16
- package/src/components/line/types.ts +3 -0
- package/src/components/nested-donut/config.ts +75 -0
- package/src/components/nested-donut/index.ts +176 -0
- package/src/components/nested-donut/modules/arc.ts +78 -0
- package/src/components/nested-donut/modules/label.ts +63 -0
- package/src/components/nested-donut/style.ts +82 -0
- package/src/components/nested-donut/types.ts +29 -0
- package/src/components/sankey/config.ts +195 -0
- package/src/components/sankey/index.ts +387 -0
- package/src/components/sankey/modules/label.ts +228 -0
- package/src/components/sankey/modules/link.ts +141 -0
- package/src/components/sankey/modules/node.ts +221 -0
- package/{components/sankey/style.js → src/components/sankey/style.ts} +60 -44
- package/src/components/sankey/types.ts +95 -0
- package/src/components/scatter/config.ts +49 -0
- package/src/components/scatter/index.ts +220 -0
- package/src/components/scatter/modules/point.ts +123 -0
- package/src/components/scatter/modules/utils.ts +150 -0
- package/{components/scatter/style.js → src/components/scatter/style.ts} +15 -14
- package/src/components/scatter/types.ts +21 -0
- package/src/components/stacked-bar/config.ts +42 -0
- package/src/components/stacked-bar/index.ts +267 -0
- package/{components/stacked-bar/style.js → src/components/stacked-bar/style.ts} +15 -14
- package/src/components/stacked-bar/types.ts +5 -0
- package/src/components/timeline/config.ts +49 -0
- package/src/components/timeline/index.ts +302 -0
- package/{components/timeline/style.js → src/components/timeline/style.ts} +39 -30
- package/src/components/tooltip/config.ts +69 -0
- package/src/components/tooltip/index.ts +220 -0
- package/{components → src/components}/tooltip/style.js +11 -14
- package/src/components/topojson-map/config.ts +124 -0
- package/src/components/topojson-map/index.ts +436 -0
- package/{components/topojson-map/style.js → src/components/topojson-map/style.ts} +33 -26
- package/src/components/topojson-map/types.ts +123 -0
- package/src/components/topojson-map/utils.ts +29 -0
- package/src/components/vis-controls/config.ts +16 -0
- package/src/components/vis-controls/index.ts +68 -0
- package/{components/vis-controls/style.js → src/components/vis-controls/style.ts} +34 -27
- package/src/components/vis-controls/types.ts +14 -0
- package/src/components/xy-labels/config.ts +56 -0
- package/src/components/xy-labels/index.ts +109 -0
- package/src/components/xy-labels/modules/label.ts +140 -0
- package/{components/xy-labels/style.js → src/components/xy-labels/style.ts} +15 -14
- package/src/components/xy-labels/types.ts +26 -0
- package/src/components.ts +56 -0
- package/src/containers/single-container/config.ts +15 -0
- package/src/containers/single-container/index.ts +150 -0
- package/src/containers/xy-container/config.ts +112 -0
- package/src/containers/xy-container/index.ts +407 -0
- package/src/containers.ts +6 -0
- package/src/core/component/config.ts +61 -0
- package/src/core/component/index.ts +154 -0
- package/src/core/component/types.ts +9 -0
- package/src/core/config/index.ts +12 -0
- package/src/core/container/config.ts +56 -0
- package/src/core/container/index.ts +136 -0
- package/src/core/xy-component/config.ts +46 -0
- package/src/core/xy-component/index.ts +90 -0
- package/src/data-models/core.ts +15 -0
- package/src/data-models/graph.ts +138 -0
- package/src/data-models/map-graph.ts +72 -0
- package/src/data-models/map.ts +18 -0
- package/src/data-models/series.ts +16 -0
- package/src/index.ts +7 -0
- package/src/maps/china-provinces.json +1 -0
- package/src/maps/fr-regions.json +1 -0
- package/src/maps/germany-regions.json +1 -0
- package/src/maps/ind-regions.json +1 -0
- package/src/maps/uk-regions.json +1 -0
- package/src/maps/us-counties.json +1 -0
- package/src/maps/us-states.json +1 -0
- package/src/maps/world-110m-alpha.json +1 -0
- package/src/maps/world-simple.json +1 -0
- package/src/maps/world-simplest.json +1 -0
- package/src/maps.ts +34 -0
- package/src/styles/colors.ts +28 -0
- package/src/styles/index.ts +38 -0
- package/{styles/sizes.js → src/styles/sizes.ts} +6 -8
- package/src/types/accessor.ts +5 -0
- package/src/types/component.ts +15 -0
- package/src/types/curve.ts +62 -0
- package/src/types/data.ts +5 -0
- package/src/types/direction.ts +6 -0
- package/src/types/graph.ts +40 -0
- package/src/types/map.ts +5 -0
- package/src/types/misc.ts +10 -0
- package/src/types/position.ts +23 -0
- package/src/types/scale.ts +47 -0
- package/src/types/shape.ts +7 -0
- package/src/types/spacing.ts +6 -0
- package/src/types/svg.ts +32 -0
- package/src/types/symbol.ts +21 -0
- package/src/types/text.ts +71 -0
- package/src/types.ts +31 -0
- package/src/utils/color.ts +41 -0
- package/src/utils/d3.ts +15 -0
- package/src/utils/data.ts +328 -0
- package/src/utils/html.ts +13 -0
- package/src/utils/map.ts +29 -0
- package/src/utils/misc.ts +54 -0
- package/src/utils/path.ts +196 -0
- package/src/utils/scale.ts +1 -0
- package/src/utils/style.ts +37 -0
- package/src/utils/svg.ts +49 -0
- package/src/utils/text.ts +529 -0
- package/src/utils/type.ts +9 -0
- package/tsconfig.json +29 -0
- package/components/area/config.d.ts +0 -25
- package/components/area/config.js +0 -16
- package/components/area/config.js.map +0 -1
- package/components/area/index.d.ts +0 -19
- package/components/area/index.js +0 -102
- package/components/area/index.js.map +0 -1
- package/components/area/style.d.ts +0 -3
- package/components/area/style.js.map +0 -1
- package/components/area/types.d.ts +0 -6
- package/components/axis/config.d.ts +0 -71
- package/components/axis/config.js +0 -32
- package/components/axis/config.js.map +0 -1
- package/components/axis/index.d.ts +0 -44
- package/components/axis/index.js +0 -305
- package/components/axis/index.js.map +0 -1
- package/components/axis/style.d.ts +0 -9
- package/components/axis/style.js.map +0 -1
- package/components/axis/types.d.ts +0 -4
- package/components/axis/types.js +0 -8
- package/components/axis/types.js.map +0 -1
- package/components/brush/config.d.ts +0 -42
- package/components/brush/config.js +0 -24
- package/components/brush/config.js.map +0 -1
- package/components/brush/index.d.ts +0 -28
- package/components/brush/index.js +0 -199
- package/components/brush/index.js.map +0 -1
- package/components/brush/style.d.ts +0 -5
- package/components/brush/style.js.map +0 -1
- package/components/brush/types.d.ts +0 -7
- package/components/brush/types.js +0 -8
- package/components/brush/types.js.map +0 -1
- package/components/bullet-legend/config.d.ts +0 -34
- package/components/bullet-legend/config.js +0 -16
- package/components/bullet-legend/config.js.map +0 -1
- package/components/bullet-legend/index.d.ts +0 -19
- package/components/bullet-legend/index.js +0 -79
- package/components/bullet-legend/index.js.map +0 -1
- package/components/bullet-legend/style.d.ts +0 -6
- package/components/bullet-legend/style.js.map +0 -1
- package/components/bullet-legend/types.d.ts +0 -7
- package/components/bullet-legend/types.js +0 -2
- package/components/bullet-legend/types.js.map +0 -1
- package/components/chord-diagram/config.d.ts +0 -44
- package/components/chord-diagram/config.js +0 -25
- package/components/chord-diagram/config.js.map +0 -1
- package/components/chord-diagram/index.d.ts +0 -42
- package/components/chord-diagram/index.js +0 -305
- package/components/chord-diagram/index.js.map +0 -1
- package/components/chord-diagram/modules/label.d.ts +0 -8
- package/components/chord-diagram/modules/label.js +0 -115
- package/components/chord-diagram/modules/label.js.map +0 -1
- package/components/chord-diagram/modules/link.d.ts +0 -21
- package/components/chord-diagram/modules/link.js +0 -63
- package/components/chord-diagram/modules/link.js.map +0 -1
- package/components/chord-diagram/modules/node.d.ts +0 -17
- package/components/chord-diagram/modules/node.js +0 -52
- package/components/chord-diagram/modules/node.js.map +0 -1
- package/components/chord-diagram/style.d.ts +0 -13
- package/components/chord-diagram/style.js.map +0 -1
- package/components/chord-diagram/types.d.ts +0 -58
- package/components/chord-diagram/types.js +0 -8
- package/components/chord-diagram/types.js.map +0 -1
- package/components/crosshair/config.d.ts +0 -43
- package/components/crosshair/config.js +0 -19
- package/components/crosshair/config.js.map +0 -1
- package/components/crosshair/index.d.ts +0 -35
- package/components/crosshair/index.js +0 -183
- package/components/crosshair/index.js.map +0 -1
- package/components/crosshair/style.d.ts +0 -4
- package/components/crosshair/style.js.map +0 -1
- package/components/crosshair/types.d.ts +0 -13
- package/components/crosshair/types.js +0 -2
- package/components/crosshair/types.js.map +0 -1
- package/components/donut/config.d.ts +0 -59
- package/components/donut/config.js +0 -28
- package/components/donut/config.js.map +0 -1
- package/components/donut/index.d.ts +0 -21
- package/components/donut/index.js +0 -107
- package/components/donut/index.js.map +0 -1
- package/components/donut/modules/arc.d.ts +0 -10
- package/components/donut/modules/arc.js +0 -59
- package/components/donut/modules/arc.js.map +0 -1
- package/components/donut/style.d.ts +0 -7
- package/components/donut/style.js.map +0 -1
- package/components/donut/types.d.ts +0 -20
- package/components/flow-legend/config.d.ts +0 -29
- package/components/flow-legend/config.js +0 -18
- package/components/flow-legend/config.js.map +0 -1
- package/components/flow-legend/index.d.ts +0 -16
- package/components/flow-legend/index.js +0 -75
- package/components/flow-legend/index.js.map +0 -1
- package/components/flow-legend/style.d.ts +0 -8
- package/components/flow-legend/style.js.map +0 -1
- package/components/flow-legend/types.d.ts +0 -9
- package/components/flow-legend/types.js +0 -8
- package/components/flow-legend/types.js.map +0 -1
- package/components/free-brush/config.d.ts +0 -45
- package/components/free-brush/config.js +0 -24
- package/components/free-brush/config.js.map +0 -1
- package/components/free-brush/index.d.ts +0 -20
- package/components/free-brush/index.js +0 -192
- package/components/free-brush/index.js.map +0 -1
- package/components/free-brush/style.d.ts +0 -4
- package/components/free-brush/style.js.map +0 -1
- package/components/free-brush/types.d.ts +0 -7
- package/components/free-brush/types.js +0 -9
- package/components/free-brush/types.js.map +0 -1
- package/components/graph/config.d.ts +0 -238
- package/components/graph/config.js +0 -84
- package/components/graph/config.js.map +0 -1
- package/components/graph/index.d.ts +0 -126
- package/components/graph/index.js +0 -656
- package/components/graph/index.js.map +0 -1
- package/components/graph/modules/layout-helpers.d.ts +0 -21
- package/components/graph/modules/layout-helpers.js +0 -69
- package/components/graph/modules/layout-helpers.js.map +0 -1
- package/components/graph/modules/layout.d.ts +0 -10
- package/components/graph/modules/layout.js +0 -399
- package/components/graph/modules/layout.js.map +0 -1
- package/components/graph/modules/link/helper.d.ts +0 -25
- package/components/graph/modules/link/helper.js +0 -74
- package/components/graph/modules/link/helper.js.map +0 -1
- package/components/graph/modules/link/index.d.ts +0 -11
- package/components/graph/modules/link/index.js +0 -212
- package/components/graph/modules/link/index.js.map +0 -1
- package/components/graph/modules/link/style.d.ts +0 -15
- package/components/graph/modules/link/style.js.map +0 -1
- package/components/graph/modules/node/helper.d.ts +0 -21
- package/components/graph/modules/node/helper.js +0 -126
- package/components/graph/modules/node/helper.js.map +0 -1
- package/components/graph/modules/node/index.d.ts +0 -11
- package/components/graph/modules/node/index.js +0 -252
- package/components/graph/modules/node/index.js.map +0 -1
- package/components/graph/modules/node/style.d.ts +0 -24
- package/components/graph/modules/node/style.js.map +0 -1
- package/components/graph/modules/panel/helper.d.ts +0 -18
- package/components/graph/modules/panel/helper.js +0 -111
- package/components/graph/modules/panel/helper.js.map +0 -1
- package/components/graph/modules/panel/index.d.ts +0 -7
- package/components/graph/modules/panel/index.js +0 -98
- package/components/graph/modules/panel/index.js.map +0 -1
- package/components/graph/modules/panel/style.d.ts +0 -14
- package/components/graph/modules/panel/style.js.map +0 -1
- package/components/graph/modules/shape.d.ts +0 -6
- package/components/graph/modules/shape.js +0 -80
- package/components/graph/modules/shape.js.map +0 -1
- package/components/graph/modules/zoom-levels.d.ts +0 -6
- package/components/graph/modules/zoom-levels.js +0 -10
- package/components/graph/modules/zoom-levels.js.map +0 -1
- package/components/graph/style.d.ts +0 -6
- package/components/graph/style.js +0 -66
- package/components/graph/style.js.map +0 -1
- package/components/graph/types.d.ts +0 -125
- package/components/graph/types.js +0 -30
- package/components/graph/types.js.map +0 -1
- package/components/grouped-bar/config.d.ts +0 -36
- package/components/grouped-bar/config.js +0 -20
- package/components/grouped-bar/config.js.map +0 -1
- package/components/grouped-bar/index.d.ts +0 -32
- package/components/grouped-bar/index.js +0 -249
- package/components/grouped-bar/index.js.map +0 -1
- package/components/grouped-bar/style.d.ts +0 -5
- package/components/grouped-bar/style.js.map +0 -1
- package/components/leaflet-flow-map/config.d.ts +0 -46
- package/components/leaflet-flow-map/config.js +0 -25
- package/components/leaflet-flow-map/config.js.map +0 -1
- package/components/leaflet-flow-map/index.d.ts +0 -52
- package/components/leaflet-flow-map/index.js +0 -220
- package/components/leaflet-flow-map/index.js.map +0 -1
- package/components/leaflet-flow-map/renderer-utils.d.ts +0 -5
- package/components/leaflet-flow-map/renderer-utils.js +0 -15
- package/components/leaflet-flow-map/renderer-utils.js.map +0 -1
- package/components/leaflet-flow-map/renderer.d.ts +0 -26
- package/components/leaflet-flow-map/renderer.js +0 -117
- package/components/leaflet-flow-map/renderer.js.map +0 -1
- package/components/leaflet-flow-map/shaders.d.ts +0 -2
- package/components/leaflet-flow-map/shaders.js.map +0 -1
- package/components/leaflet-flow-map/types.d.ts +0 -23
- package/components/leaflet-map/config.d.ts +0 -193
- package/components/leaflet-map/config.js +0 -71
- package/components/leaflet-map/config.js.map +0 -1
- package/components/leaflet-map/index.d.ts +0 -130
- package/components/leaflet-map/index.js +0 -690
- package/components/leaflet-map/index.js.map +0 -1
- package/components/leaflet-map/leaflet.css.js +0 -5
- package/components/leaflet-map/leaflet.css.js.map +0 -1
- package/components/leaflet-map/modules/clusterBackground.d.ts +0 -5
- package/components/leaflet-map/modules/clusterBackground.js +0 -27
- package/components/leaflet-map/modules/clusterBackground.js.map +0 -1
- package/components/leaflet-map/modules/donut.d.ts +0 -3
- package/components/leaflet-map/modules/donut.js +0 -25
- package/components/leaflet-map/modules/donut.js.map +0 -1
- package/components/leaflet-map/modules/map.d.ts +0 -14
- package/components/leaflet-map/modules/map.js +0 -154
- package/components/leaflet-map/modules/map.js.map +0 -1
- package/components/leaflet-map/modules/node.d.ts +0 -9
- package/components/leaflet-map/modules/node.js +0 -162
- package/components/leaflet-map/modules/node.js.map +0 -1
- package/components/leaflet-map/modules/selectionRing.d.ts +0 -7
- package/components/leaflet-map/modules/selectionRing.js +0 -41
- package/components/leaflet-map/modules/selectionRing.js.map +0 -1
- package/components/leaflet-map/modules/utils.d.ts +0 -50
- package/components/leaflet-map/modules/utils.js +0 -210
- package/components/leaflet-map/modules/utils.js.map +0 -1
- package/components/leaflet-map/renderer/leaflet-maplibre-gl.js.map +0 -1
- package/components/leaflet-map/renderer/map-style.d.ts +0 -4
- package/components/leaflet-map/renderer/map-style.js +0 -15
- package/components/leaflet-map/renderer/map-style.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js +0 -40
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js +0 -40
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js +0 -4981
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl-layer.d.ts +0 -8
- package/components/leaflet-map/renderer/mapboxgl-layer.js +0 -27
- package/components/leaflet-map/renderer/mapboxgl-layer.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl-utils.d.ts +0 -4
- package/components/leaflet-map/renderer/mapboxgl-utils.js +0 -39
- package/components/leaflet-map/renderer/mapboxgl-utils.js.map +0 -1
- package/components/leaflet-map/renderer/maplibre-gl.css.js.map +0 -1
- package/components/leaflet-map/style.d.ts +0 -52
- package/components/leaflet-map/style.js +0 -183
- package/components/leaflet-map/style.js.map +0 -1
- package/components/leaflet-map/types.d.ts +0 -75
- package/components/leaflet-map/types.js +0 -15
- package/components/leaflet-map/types.js.map +0 -1
- package/components/line/config.d.ts +0 -30
- package/components/line/config.js +0 -17
- package/components/line/config.js.map +0 -1
- package/components/line/index.d.ts +0 -27
- package/components/line/index.js +0 -152
- package/components/line/index.js.map +0 -1
- package/components/line/style.d.ts +0 -6
- package/components/line/style.js.map +0 -1
- package/components/line/types.d.ts +0 -12
- package/components/nested-donut/config.d.ts +0 -59
- package/components/nested-donut/config.js +0 -19
- package/components/nested-donut/config.js.map +0 -1
- package/components/nested-donut/index.d.ts +0 -38
- package/components/nested-donut/index.js +0 -133
- package/components/nested-donut/index.js.map +0 -1
- package/components/nested-donut/modules/arc.d.ts +0 -17
- package/components/nested-donut/modules/arc.js +0 -50
- package/components/nested-donut/modules/arc.js.map +0 -1
- package/components/nested-donut/modules/label.d.ts +0 -7
- package/components/nested-donut/modules/label.js +0 -34
- package/components/nested-donut/modules/label.js.map +0 -1
- package/components/nested-donut/style.d.ts +0 -26
- package/components/nested-donut/style.js +0 -70
- package/components/nested-donut/style.js.map +0 -1
- package/components/nested-donut/types.d.ts +0 -24
- package/components/nested-donut/types.js +0 -11
- package/components/nested-donut/types.js.map +0 -1
- package/components/sankey/config.d.ts +0 -162
- package/components/sankey/config.js +0 -65
- package/components/sankey/config.js.map +0 -1
- package/components/sankey/index.d.ts +0 -59
- package/components/sankey/index.js +0 -306
- package/components/sankey/index.js.map +0 -1
- package/components/sankey/modules/label.d.ts +0 -23
- package/components/sankey/modules/label.js +0 -168
- package/components/sankey/modules/label.js.map +0 -1
- package/components/sankey/modules/link.d.ts +0 -14
- package/components/sankey/modules/link.js +0 -108
- package/components/sankey/modules/link.js.map +0 -1
- package/components/sankey/modules/node.d.ts +0 -10
- package/components/sankey/modules/node.js +0 -156
- package/components/sankey/modules/node.js.map +0 -1
- package/components/sankey/style.d.ts +0 -20
- package/components/sankey/style.js.map +0 -1
- package/components/sankey/types.d.ts +0 -84
- package/components/sankey/types.js +0 -34
- package/components/sankey/types.js.map +0 -1
- package/components/scatter/config.d.ts +0 -44
- package/components/scatter/config.js +0 -23
- package/components/scatter/config.js.map +0 -1
- package/components/scatter/index.d.ts +0 -28
- package/components/scatter/index.js +0 -167
- package/components/scatter/index.js.map +0 -1
- package/components/scatter/modules/point.d.ts +0 -7
- package/components/scatter/modules/point.js +0 -86
- package/components/scatter/modules/point.js.map +0 -1
- package/components/scatter/modules/utils.d.ts +0 -11
- package/components/scatter/modules/utils.js +0 -112
- package/components/scatter/modules/utils.js.map +0 -1
- package/components/scatter/style.d.ts +0 -5
- package/components/scatter/style.js.map +0 -1
- package/components/scatter/types.d.ts +0 -19
- package/components/stacked-bar/config.d.ts +0 -38
- package/components/stacked-bar/config.js +0 -20
- package/components/stacked-bar/config.js.map +0 -1
- package/components/stacked-bar/index.d.ts +0 -28
- package/components/stacked-bar/index.js +0 -208
- package/components/stacked-bar/index.js.map +0 -1
- package/components/stacked-bar/style.d.ts +0 -5
- package/components/stacked-bar/style.js.map +0 -1
- package/components/stacked-bar/types.d.ts +0 -5
- package/components/timeline/config.d.ts +0 -43
- package/components/timeline/config.js +0 -24
- package/components/timeline/config.js.map +0 -1
- package/components/timeline/index.d.ts +0 -41
- package/components/timeline/index.js +0 -244
- package/components/timeline/index.js.map +0 -1
- package/components/timeline/style.d.ts +0 -13
- package/components/timeline/style.js.map +0 -1
- package/components/tooltip/config.d.ts +0 -68
- package/components/tooltip/config.js +0 -20
- package/components/tooltip/config.js.map +0 -1
- package/components/tooltip/index.d.ts +0 -36
- package/components/tooltip/index.js +0 -184
- package/components/tooltip/index.js.map +0 -1
- package/components/tooltip/style.js.map +0 -1
- package/components/topojson-map/config.d.ts +0 -99
- package/components/topojson-map/config.js +0 -42
- package/components/topojson-map/config.js.map +0 -1
- package/components/topojson-map/index.d.ts +0 -52
- package/components/topojson-map/index.js +0 -355
- package/components/topojson-map/index.js.map +0 -1
- package/components/topojson-map/style.d.ts +0 -11
- package/components/topojson-map/style.js.map +0 -1
- package/components/topojson-map/types.d.ts +0 -78
- package/components/topojson-map/types.js +0 -80
- package/components/topojson-map/types.js.map +0 -1
- package/components/topojson-map/utils.d.ts +0 -3
- package/components/topojson-map/utils.js +0 -30
- package/components/topojson-map/utils.js.map +0 -1
- package/components/vis-controls/config.d.ts +0 -12
- package/components/vis-controls/config.js +0 -13
- package/components/vis-controls/config.js.map +0 -1
- package/components/vis-controls/index.d.ts +0 -14
- package/components/vis-controls/index.js +0 -52
- package/components/vis-controls/index.js.map +0 -1
- package/components/vis-controls/style.d.ts +0 -11
- package/components/vis-controls/style.js.map +0 -1
- package/components/vis-controls/types.d.ts +0 -13
- package/components/vis-controls/types.js +0 -8
- package/components/vis-controls/types.js.map +0 -1
- package/components/xy-labels/config.d.ts +0 -48
- package/components/xy-labels/config.js +0 -25
- package/components/xy-labels/config.js.map +0 -1
- package/components/xy-labels/index.d.ts +0 -15
- package/components/xy-labels/index.js +0 -87
- package/components/xy-labels/index.js.map +0 -1
- package/components/xy-labels/modules/label.d.ts +0 -9
- package/components/xy-labels/modules/label.js +0 -107
- package/components/xy-labels/modules/label.js.map +0 -1
- package/components/xy-labels/style.d.ts +0 -5
- package/components/xy-labels/style.js.map +0 -1
- package/components/xy-labels/types.d.ts +0 -23
- package/components/xy-labels/types.js +0 -9
- package/components/xy-labels/types.js.map +0 -1
- package/components.d.ts +0 -51
- package/components.js +0 -29
- package/components.js.map +0 -1
- package/containers/single-container/config.d.ts +0 -12
- package/containers/single-container/config.js +0 -12
- package/containers/single-container/config.js.map +0 -1
- package/containers/single-container/index.d.ts +0 -19
- package/containers/single-container/index.js +0 -128
- package/containers/single-container/index.js.map +0 -1
- package/containers/xy-container/config.d.ts +0 -99
- package/containers/xy-container/config.js +0 -30
- package/containers/xy-container/config.js.map +0 -1
- package/containers/xy-container/index.d.ts +0 -34
- package/containers/xy-container/index.js +0 -330
- package/containers/xy-container/index.js.map +0 -1
- package/containers.d.ts +0 -6
- package/containers.js +0 -4
- package/containers.js.map +0 -1
- package/core/component/config.d.ts +0 -58
- package/core/component/config.js +0 -14
- package/core/component/config.js.map +0 -1
- package/core/component/index.d.ts +0 -43
- package/core/component/index.js +0 -118
- package/core/component/index.js.map +0 -1
- package/core/component/types.d.ts +0 -2
- package/core/component/types.js +0 -2
- package/core/component/types.js.map +0 -1
- package/core/config/index.d.ts +0 -3
- package/core/config/index.js +0 -16
- package/core/config/index.js.map +0 -1
- package/core/container/config.d.ts +0 -48
- package/core/container/config.js +0 -29
- package/core/container/config.js.map +0 -1
- package/core/container/index.d.ts +0 -26
- package/core/container/index.js +0 -105
- package/core/container/index.js.map +0 -1
- package/core/xy-component/config.d.ts +0 -38
- package/core/xy-component/config.js +0 -20
- package/core/xy-component/config.js.map +0 -1
- package/core/xy-component/index.d.ts +0 -27
- package/core/xy-component/index.js +0 -74
- package/core/xy-component/index.js.map +0 -1
- package/data-models/core.d.ts +0 -6
- package/data-models/core.js +0 -14
- package/data-models/core.js.map +0 -1
- package/data-models/graph.d.ts +0 -24
- package/data-models/graph.js +0 -107
- package/data-models/graph.js.map +0 -1
- package/data-models/map-graph.d.ts +0 -21
- package/data-models/map-graph.js +0 -62
- package/data-models/map-graph.js.map +0 -1
- package/data-models/map.d.ts +0 -5
- package/data-models/map.js +0 -12
- package/data-models/map.js.map +0 -1
- package/data-models/series.d.ts +0 -6
- package/data-models/series.js +0 -19
- package/data-models/series.js.map +0 -1
- package/index.d.ts +0 -7
- package/index.js +0 -55
- package/index.js.map +0 -1
- package/maps/china-provinces.json.js +0 -140373
- package/maps/fr-regions.json.js +0 -14162
- package/maps/germany-regions.json.js +0 -35760
- package/maps/ind-regions.json.js +0 -290584
- package/maps/uk-regions.json.js +0 -96233
- package/maps/us-counties.json.js +0 -206318
- package/maps/us-states.json.js +0 -16345
- package/maps/world-110m-alpha.json.js +0 -251366
- package/maps/world-simple.json.js +0 -89428
- package/maps/world-simplest.json.js +0 -28175
- package/maps.d.ts +0 -60
- package/maps.js +0 -23
- package/styles/colors.d.ts +0 -7
- package/styles/colors.js +0 -24
- package/styles/colors.js.map +0 -1
- package/styles/index.d.ts +0 -7
- package/styles/index.js +0 -38
- package/styles/index.js.map +0 -1
- package/styles/sizes.d.ts +0 -2
- package/styles/sizes.js.map +0 -1
- package/types/accessor.d.ts +0 -5
- package/types/accessor.js +0 -2
- package/types/accessor.js.map +0 -1
- package/types/component.d.ts +0 -13
- package/types/component.js +0 -14
- package/types/component.js.map +0 -1
- package/types/curve.d.ts +0 -40
- package/types/curve.js +0 -46
- package/types/curve.js.map +0 -1
- package/types/data.d.ts +0 -7
- package/types/data.js +0 -2
- package/types/data.js.map +0 -1
- package/types/direction.d.ts +0 -6
- package/types/direction.js +0 -10
- package/types/direction.js.map +0 -1
- package/types/graph.d.ts +0 -35
- package/types/graph.js +0 -2
- package/types/graph.js.map +0 -1
- package/types/map.d.ts +0 -4
- package/types/map.js +0 -2
- package/types/map.js.map +0 -1
- package/types/misc.d.ts +0 -8
- package/types/position.d.ts +0 -20
- package/types/position.js +0 -27
- package/types/position.js.map +0 -1
- package/types/scale.d.ts +0 -23
- package/types/scale.js +0 -27
- package/types/scale.js.map +0 -1
- package/types/shape.d.ts +0 -7
- package/types/shape.js +0 -11
- package/types/shape.js.map +0 -1
- package/types/spacing.d.ts +0 -6
- package/types/spacing.js +0 -2
- package/types/spacing.js.map +0 -1
- package/types/svg.d.ts +0 -18
- package/types/svg.js +0 -22
- package/types/svg.js.map +0 -1
- package/types/symbol.d.ts +0 -18
- package/types/symbol.js +0 -24
- package/types/symbol.js.map +0 -1
- package/types/text.d.ts +0 -46
- package/types/text.js +0 -26
- package/types/text.js.map +0 -1
- package/types.d.ts +0 -27
- package/types.js +0 -30
- package/types.js.map +0 -1
- package/utils/color.d.ts +0 -10
- package/utils/color.js +0 -32
- package/utils/color.js.map +0 -1
- package/utils/d3.d.ts +0 -3
- package/utils/d3.js +0 -16
- package/utils/d3.js.map +0 -1
- package/utils/data.d.ts +0 -45
- package/utils/data.js +0 -274
- package/utils/data.js.map +0 -1
- package/utils/html.d.ts +0 -1
- package/utils/html.js +0 -16
- package/utils/html.js.map +0 -1
- package/utils/map.d.ts +0 -2
- package/utils/map.js +0 -20
- package/utils/map.js.map +0 -1
- package/utils/misc.d.ts +0 -9
- package/utils/misc.js +0 -47
- package/utils/misc.js.map +0 -1
- package/utils/path.d.ts +0 -23
- package/utils/path.js +0 -144
- package/utils/path.js.map +0 -1
- package/utils/scale.d.ts +0 -1
- package/utils/style.d.ts +0 -6
- package/utils/style.js +0 -24
- package/utils/style.js.map +0 -1
- package/utils/svg.d.ts +0 -3
- package/utils/text.d.ts +0 -139
- package/utils/text.js +0 -417
- package/utils/text.js.map +0 -1
- package/utils/type.d.ts +0 -5
|
@@ -1,656 +0,0 @@
|
|
|
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
|