@unovis/ts 1.6.2-pre.6 → 1.7.0-Phoenix.0
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/crosshair/index.js +1 -2
- package/components/crosshair/index.js.map +1 -1
- package/components/sankey/config.d.ts +8 -0
- package/components/sankey/config.js +1 -1
- package/components/sankey/config.js.map +1 -1
- package/components/sankey/index.d.ts +29 -0
- package/components/sankey/index.js +70 -0
- package/components/sankey/index.js.map +1 -1
- package/components/sankey/modules/link.js +16 -3
- package/components/sankey/modules/link.js.map +1 -1
- package/components/sankey/types.d.ts +2 -0
- package/components/sankey/types.js.map +1 -1
- package/components/treemap/config.d.ts +17 -10
- package/components/treemap/config.js +2 -1
- package/components/treemap/config.js.map +1 -1
- package/components/treemap/index.d.ts +0 -2
- package/components/treemap/index.js +78 -91
- package/components/treemap/index.js.map +1 -1
- package/components/treemap/style.d.ts +3 -8
- package/components/treemap/style.js +10 -15
- package/components/treemap/style.js.map +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/utils/color.d.ts +1 -0
- package/utils/color.js +7 -1
- package/utils/color.js.map +1 -1
- package/utils/index.js +1 -1
|
@@ -106,8 +106,7 @@ class Crosshair extends XYComponentCore {
|
|
|
106
106
|
shouldShow = false;
|
|
107
107
|
}
|
|
108
108
|
const tooltip = (_d = config.tooltip) !== null && _d !== void 0 ? _d : this.tooltip;
|
|
109
|
-
|
|
110
|
-
if (tooltipShouldShow && tooltip && this._isContainerInViewport()) {
|
|
109
|
+
if (shouldShow && tooltip && this._isContainerInViewport()) {
|
|
111
110
|
const container = tooltip.getContainer() || this.container.node();
|
|
112
111
|
const isContainerBody = tooltip.isContainerBody();
|
|
113
112
|
if (isForceShowAtDefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/crosshair/index.ts"],"sourcesContent":["import { Selection, pointer } from 'd3-selection'\nimport { easeLinear } from 'd3-ease'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\nimport { Tooltip } from 'components/tooltip'\n\n// Utils\nimport { isNumber, isArray, getNumber, clamp, getStackedValues, getNearest, isFunction } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { getColor } from 'utils/color'\n\n// Types\nimport { Position } from 'types/position'\nimport { FindNearestDirection } from 'types/data'\n\n// Local Types\nimport { CrosshairAccessors, CrosshairCircle } from './types'\n\n// Config\nimport { CrosshairDefaultConfig, CrosshairConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\n\nexport class Crosshair<Datum> extends XYComponentCore<Datum, CrosshairConfigInterface<Datum>> {\n static selectors = s\n clippable = true // Don't apply clipping path to this component. See XYContainer\n protected _defaultConfig = CrosshairDefaultConfig as CrosshairConfigInterface<Datum>\n public config: CrosshairConfigInterface<Datum> = this._defaultConfig\n container: Selection<SVGSVGElement, any, SVGSVGElement, any>\n line: Selection<SVGLineElement, any, SVGElement, any>\n private _xPx: number | undefined = undefined\n private _yPx: number | undefined = undefined\n private _mouseEvent: MouseEvent | undefined = undefined\n private _animFrameId: number = null\n\n /** Tooltip component to be used by Crosshair if not provided by the config.\n * This property is supposed to be set externally by a container component like XYContainer. */\n public tooltip: Tooltip\n\n /** Accessors passed externally (e.g. from XYContainer) */\n private _accessors: CrosshairAccessors<Datum> = {\n x: undefined,\n y: undefined,\n yStacked: undefined,\n baseline: undefined,\n }\n\n public set accessors (accessors: CrosshairAccessors<Datum>) { this._accessors = accessors }\n public get accessors (): CrosshairAccessors<Datum> {\n const { config } = this\n\n const hasConfig = !!(config.x || config.y || config.yStacked)\n const x = hasConfig ? config.x : this._accessors.x\n const yAcc = hasConfig ? config.y : this._accessors.y\n const y = yAcc ? (isArray(yAcc) ? yAcc : [yAcc]) : undefined\n const yStacked = hasConfig ? config.yStacked : this._accessors.yStacked\n const baseline = config.baseline ?? this._accessors.baseline\n\n return { x, y, yStacked, baseline }\n }\n\n private _isContainerInViewport (): boolean {\n if (!this.container?.node()) return false\n\n const containerRect = this.container.node().getBoundingClientRect()\n const viewportWidth = window.innerWidth || document.documentElement.clientWidth\n const viewportHeight = window.innerHeight || document.documentElement.clientHeight\n\n // Calculate the visible area of the container\n const visibleWidth = Math.max(0, Math.min(containerRect.right, viewportWidth) - Math.max(containerRect.left, 0))\n const visibleHeight = Math.max(0, Math.min(containerRect.bottom, viewportHeight) - Math.max(containerRect.top, 0))\n const containerArea = containerRect.width * containerRect.height\n const visibleArea = visibleWidth * visibleHeight\n\n // Container must be at least 35% visible\n return containerArea > 0 && (visibleArea / containerArea) >= 0.35\n }\n\n constructor (config?: CrosshairConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n\n this.g.style('opacity', 0)\n this.line = this.g.append('line')\n .attr('class', s.line)\n }\n\n setContainer (containerSvg: Selection<SVGSVGElement, unknown, SVGSVGElement, unknown>): void {\n if (this.container === containerSvg) return\n\n this.container = containerSvg\n this.container.on('mousemove.crosshair', this._onMouseMove.bind(this))\n this.container.on('mouseout.crosshair', this._onMouseOut.bind(this))\n this.container.on('wheel.crosshair', this._onWheel.bind(this))\n }\n\n _render (customDuration?: number): void {\n const { config, datamodel } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n const isForceShowAtDefined = config.forceShowAt !== undefined\n const xPx = isForceShowAtDefined ? this.xScale(config.forceShowAt) : this._xPx\n\n const xValue = this.xScale.invert(xPx) as number\n\n const leftNearestDatumIndex = (datamodel.data?.length && this.accessors.x)\n ? datamodel.data.indexOf(\n getNearest(datamodel.data, xValue, this.accessors.x, FindNearestDirection.Left)\n ) : undefined\n\n // If `snapToData` is `true`, we need to find the nearest datum to the crosshair\n // It can be from a mouse interaction or from a `forceShowAt` setting\n let nearestDatum: Datum | undefined\n let nearestDatumIndex: number | undefined\n if (config.snapToData) {\n if (!this.accessors.y && !this.accessors.yStacked && datamodel.data?.length) {\n console.warn('Unovis | Crosshair: Y accessors have not been configured. Please check if they\\'re present in the configuration object')\n }\n\n // Emit a warning if there's no data to snap to.\n // To keep the console clean, only emit the warning when there's mouse interaction.\n if (!datamodel.data?.length && this._mouseEvent) {\n console.warn('Unovis | Crosshair: No data to snap to. Make sure the data has been passed to the container or to the crosshair itself')\n }\n\n nearestDatum = getNearest(datamodel.data, xValue, this.accessors.x)\n nearestDatumIndex = datamodel.data.indexOf(nearestDatum)\n }\n\n const xRange = this.xScale.range()\n const yRange = this.yScale.range()\n const xClamped = config.snapToData && nearestDatum\n ? clamp(Math.round(this.xScale(getNumber(nearestDatum, this.accessors.x, nearestDatumIndex))), 0, this._width)\n : clamp(xPx, xRange[0], xRange[1])\n\n const isCrosshairWithinXRange = (xPx >= xRange[0]) && (xPx <= xRange[1])\n const isCrosshairWithinYRange = (this._yPx >= Math.min(yRange[0], yRange[1])) && (this._yPx <= Math.max(yRange[0], yRange[1]))\n let shouldShow = config.skipRangeCheck ? !!this._xPx : (this._xPx ? isCrosshairWithinXRange && isCrosshairWithinYRange : isCrosshairWithinXRange)\n\n // If the crosshair is far from the mouse pointer (usually when `snapToData` is `true` and data resolution is low), hide it\n if (config.hideWhenFarFromPointer && ((Math.abs(xClamped - (+xPx)) >= config.hideWhenFarFromPointerDistance))) {\n shouldShow = false\n }\n\n const tooltip = config.tooltip ?? this.tooltip\n const tooltipShouldShow = config.skipRangeCheck ? !!this._xPx : shouldShow\n if (tooltipShouldShow && tooltip && this._isContainerInViewport()) {\n const container = tooltip.getContainer() || this.container.node()\n const isContainerBody = tooltip.isContainerBody()\n\n if (isForceShowAtDefined) {\n // Convert SVG coordinates to screen coordinates\n const containerRect = this.container.node().getBoundingClientRect()\n\n // Use the actual left margin from the container\n const screenX = (isContainerBody ? xPx + containerRect.left : xPx) + this._containerMargin.left\n const screenY = this._height / 2 + (isContainerBody ? containerRect.top : 0)\n const pos = [screenX, screenY] as [number, number]\n this._showTooltip(nearestDatum, xValue, pos, leftNearestDatumIndex)\n } else if (this._mouseEvent) {\n const pos = (isContainerBody ? [this._mouseEvent.clientX, this._mouseEvent.clientY] : pointer(this._mouseEvent, container)) as [number, number]\n this._showTooltip(nearestDatum, xValue, pos, leftNearestDatumIndex)\n }\n } else this._hideTooltip()\n\n // Trigger `onCrosshairMove` if the render was triggered by a mouse move event\n if (this._mouseEvent) {\n config.onCrosshairMove?.(shouldShow ? this.xScale.invert(this._xPx) as number : undefined, nearestDatum, nearestDatumIndex, this._mouseEvent)\n this._mouseEvent = undefined\n }\n\n smartTransition(this.g, duration)\n .style('opacity', shouldShow ? 1 : 0)\n\n // When `config.forceShowAt` becomes `undefined`, the crosshair \"jumps\" to the edge of the chart.\n // This looks off, so we stop further rendering when the `xPx` value is not finite.\n if (!isFinite(xPx)) return\n\n this.line\n .attr('y1', 0)\n .attr('y2', this._height)\n\n smartTransition(this.line, duration, easeLinear)\n .attr('x1', xClamped)\n .attr('x2', xClamped)\n\n const circleData = isFunction(config.getCircles)\n ? config.getCircles(xValue, datamodel.data, this.yScale, leftNearestDatumIndex)\n : this.getCircleData(nearestDatum, nearestDatumIndex)\n\n const circles = this.g\n .selectAll<SVGCircleElement, CrosshairCircle>('circle')\n .data(circleData, (d, i) => d.id ?? i)\n\n const circlesEnter = circles.enter()\n .append('circle')\n .attr('class', s.circle)\n .attr('r', 0)\n .attr('cx', xClamped)\n .attr('cy', d => d.y)\n .style('fill', d => d.color)\n .style('stroke', d => d.strokeColor)\n .style('stroke-width', d => d.strokeWidth)\n\n smartTransition(circlesEnter.merge(circles), duration, easeLinear)\n .attr('cx', xClamped)\n .attr('cy', d => d.y)\n .attr('r', 4)\n .style('opacity', d => d.opacity)\n .style('fill', d => d.color)\n .style('stroke', d => d.strokeColor)\n .style('stroke-width', d => d.strokeWidth)\n\n circles.exit().remove()\n }\n\n hide (sourceEvent?: MouseEvent | WheelEvent): void {\n window.cancelAnimationFrame(this._animFrameId)\n this._animFrameId = window.requestAnimationFrame(() => {\n this._xPx = undefined\n this._yPx = undefined\n this._mouseEvent = undefined\n // We call `onCrosshairMove` with all the arguments set to `undefined` because we want\n // the users to be able to hide the crosshair easily when using `forceShowAt`\n this.config.onCrosshairMove?.(undefined, undefined, undefined, sourceEvent)\n this._render()\n })\n }\n\n _onMouseMove (event: MouseEvent): void {\n const { datamodel, element } = this\n if (!this.accessors.x && datamodel.data?.length) {\n console.warn('Unovis | Crosshair: X accessor function has not been configured. Please check if it\\'s present in the configuration object')\n }\n const [x, y] = pointer(event, element)\n this._xPx = x\n this._yPx = y\n this._mouseEvent = event\n\n window.cancelAnimationFrame(this._animFrameId)\n this._animFrameId = window.requestAnimationFrame(() => {\n // We'll call `config.onCrosshairMove` in `_render` with the found `nearestDatum` and `nearestDatumIndex`,\n // which can come from the mouse interaction or from the `forceShowAt` setting\n this._render()\n })\n }\n\n _onMouseOut (event?: MouseEvent): void {\n // Only hide if the mouse actually left the SVG, not just moved to a child\n if (!event || !this.container?.node().contains((event as MouseEvent).relatedTarget as Node)) {\n this.hide(event)\n }\n }\n\n _onWheel (event: WheelEvent): void {\n this.hide(event)\n }\n\n _showTooltip (datum: Datum, xValue: number, pos: [number, number], nearestDatumIndex: number | undefined): void {\n const { config, datamodel } = this\n const tooltip = config.tooltip ?? this.tooltip\n if (!tooltip || !pos) return\n\n const [x, y] = pos\n const content = config.template(datum, xValue, datamodel.data, nearestDatumIndex)\n // Force set `followCursor` to `true` because we don't want Crosshair's tooltip to be hoverable\n tooltip.config.followCursor = true\n\n // Set tooltip placement based on Crosshair's position (left / right)\n if (!tooltip.config.horizontalPlacement || tooltip.config.horizontalPlacement === Position.Auto) {\n const xRelative = tooltip.isContainerBody() ? x - this.container.node().getBoundingClientRect().left : x\n tooltip.overrideHorizontalPlacement(xRelative > this._containerWidth / 2 ? Position.Left : Position.Right)\n }\n\n if (content) tooltip.show(content, { x, y })\n }\n\n _hideTooltip (): void {\n const { config } = this\n const tooltip = config.tooltip ?? this.tooltip\n tooltip?.hide()\n }\n\n // We don't want Crosshair to be be taken in to account in domain calculations\n getYDataExtent (): number[] {\n return [undefined, undefined]\n }\n\n private getCircleData (datum: Datum, datumIndex: number): CrosshairCircle[] {\n const { config } = this\n\n if (config.snapToData && datum) {\n const yAccessors = this.accessors.y ?? []\n const yStackedAccessors = this.accessors.yStacked ?? []\n const baselineValue = getNumber(datum, this.accessors.baseline, datumIndex) || 0\n const stackedValues: CrosshairCircle[] = getStackedValues(datum, datumIndex, ...yStackedAccessors)\n .map((value, index) => ({\n y: this.yScale(value + baselineValue),\n opacity: isNumber(getNumber(datum, yStackedAccessors[index], index)) ? 1 : 0,\n color: getColor(datum, config.color, index),\n strokeColor: config.strokeColor ? getColor(datum, config.strokeColor, index) : undefined,\n strokeWidth: config.strokeWidth ? getNumber(datum, config.strokeWidth, index) : undefined,\n }))\n\n const regularValues: CrosshairCircle[] = yAccessors\n .map((a, index) => {\n const value = getNumber(datum, a, datumIndex)\n return {\n y: this.yScale(value),\n opacity: isNumber(value) ? 1 : 0,\n color: getColor(datum, config.color, stackedValues.length + index),\n strokeColor: config.strokeColor ? getColor(datum, config.strokeColor, index) : undefined,\n strokeWidth: config.strokeWidth ? getNumber(datum, config.strokeWidth, index) : undefined,\n }\n })\n\n return stackedValues.concat(regularValues)\n }\n\n return []\n }\n}\n"],"names":["s.line","s.circle","s"],"mappings":";;;;;;;;;;;;AA0BM,MAAO,SAAiB,SAAQ,eAAuD,CAAA;AAuD3F,IAAA,WAAA,CAAa,MAAwC,EAAA;AACnD,QAAA,KAAK,EAAE,CAAA;AAtDT,QAAA,IAAA,CAAA,SAAS,GAAG,IAAI,CAAA;QACN,IAAc,CAAA,cAAA,GAAG,sBAAyD,CAAA;AAC7E,QAAA,IAAA,CAAA,MAAM,GAAoC,IAAI,CAAC,cAAc,CAAA;QAG5D,IAAI,CAAA,IAAA,GAAuB,SAAS,CAAA;QACpC,IAAI,CAAA,IAAA,GAAuB,SAAS,CAAA;QACpC,IAAW,CAAA,WAAA,GAA2B,SAAS,CAAA;QAC/C,IAAY,CAAA,YAAA,GAAW,IAAI,CAAA;;AAO3B,QAAA,IAAA,CAAA,UAAU,G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AACrB,oBAAA,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;AAChC,oBAAA,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,KAAK,CAAC;oBAClE,WAAW,EAAE,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG,SAAS;oBACxF,WAAW,EAAE,MAAM,CAAC,WAAW,GAAG,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG,SAAS;iBAC1F,CAAA;AACH,aAAC,CAAC,CAAA;AAEJ,YAAA,OAAO,aAAa,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;AAC3C,SAAA;AAED,QAAA,OAAO,EAAE,CAAA;KACV;;AAvSM,SAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/crosshair/index.ts"],"sourcesContent":["import { Selection, pointer } from 'd3-selection'\nimport { easeLinear } from 'd3-ease'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\nimport { Tooltip } from 'components/tooltip'\n\n// Utils\nimport { isNumber, isArray, getNumber, clamp, getStackedValues, getNearest, isFunction } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { getColor } from 'utils/color'\n\n// Types\nimport { Position } from 'types/position'\nimport { FindNearestDirection } from 'types/data'\n\n// Local Types\nimport { CrosshairAccessors, CrosshairCircle } from './types'\n\n// Config\nimport { CrosshairDefaultConfig, CrosshairConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\n\nexport class Crosshair<Datum> extends XYComponentCore<Datum, CrosshairConfigInterface<Datum>> {\n static selectors = s\n clippable = true // Don't apply clipping path to this component. See XYContainer\n protected _defaultConfig = CrosshairDefaultConfig as CrosshairConfigInterface<Datum>\n public config: CrosshairConfigInterface<Datum> = this._defaultConfig\n container: Selection<SVGSVGElement, any, SVGSVGElement, any>\n line: Selection<SVGLineElement, any, SVGElement, any>\n private _xPx: number | undefined = undefined\n private _yPx: number | undefined = undefined\n private _mouseEvent: MouseEvent | undefined = undefined\n private _animFrameId: number = null\n\n /** Tooltip component to be used by Crosshair if not provided by the config.\n * This property is supposed to be set externally by a container component like XYContainer. */\n public tooltip: Tooltip\n\n /** Accessors passed externally (e.g. from XYContainer) */\n private _accessors: CrosshairAccessors<Datum> = {\n x: undefined,\n y: undefined,\n yStacked: undefined,\n baseline: undefined,\n }\n\n public set accessors (accessors: CrosshairAccessors<Datum>) { this._accessors = accessors }\n public get accessors (): CrosshairAccessors<Datum> {\n const { config } = this\n\n const hasConfig = !!(config.x || config.y || config.yStacked)\n const x = hasConfig ? config.x : this._accessors.x\n const yAcc = hasConfig ? config.y : this._accessors.y\n const y = yAcc ? (isArray(yAcc) ? yAcc : [yAcc]) : undefined\n const yStacked = hasConfig ? config.yStacked : this._accessors.yStacked\n const baseline = config.baseline ?? this._accessors.baseline\n\n return { x, y, yStacked, baseline }\n }\n\n private _isContainerInViewport (): boolean {\n if (!this.container?.node()) return false\n\n const containerRect = this.container.node().getBoundingClientRect()\n const viewportWidth = window.innerWidth || document.documentElement.clientWidth\n const viewportHeight = window.innerHeight || document.documentElement.clientHeight\n\n // Calculate the visible area of the container\n const visibleWidth = Math.max(0, Math.min(containerRect.right, viewportWidth) - Math.max(containerRect.left, 0))\n const visibleHeight = Math.max(0, Math.min(containerRect.bottom, viewportHeight) - Math.max(containerRect.top, 0))\n const containerArea = containerRect.width * containerRect.height\n const visibleArea = visibleWidth * visibleHeight\n\n // Container must be at least 35% visible\n return containerArea > 0 && (visibleArea / containerArea) >= 0.35\n }\n\n constructor (config?: CrosshairConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n\n this.g.style('opacity', 0)\n this.line = this.g.append('line')\n .attr('class', s.line)\n }\n\n setContainer (containerSvg: Selection<SVGSVGElement, unknown, SVGSVGElement, unknown>): void {\n if (this.container === containerSvg) return\n\n this.container = containerSvg\n this.container.on('mousemove.crosshair', this._onMouseMove.bind(this))\n this.container.on('mouseout.crosshair', this._onMouseOut.bind(this))\n this.container.on('wheel.crosshair', this._onWheel.bind(this))\n }\n\n _render (customDuration?: number): void {\n const { config, datamodel } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n const isForceShowAtDefined = config.forceShowAt !== undefined\n const xPx = isForceShowAtDefined ? this.xScale(config.forceShowAt) : this._xPx\n\n const xValue = this.xScale.invert(xPx) as number\n\n const leftNearestDatumIndex = (datamodel.data?.length && this.accessors.x)\n ? datamodel.data.indexOf(\n getNearest(datamodel.data, xValue, this.accessors.x, FindNearestDirection.Left)\n ) : undefined\n\n // If `snapToData` is `true`, we need to find the nearest datum to the crosshair\n // It can be from a mouse interaction or from a `forceShowAt` setting\n let nearestDatum: Datum | undefined\n let nearestDatumIndex: number | undefined\n if (config.snapToData) {\n if (!this.accessors.y && !this.accessors.yStacked && datamodel.data?.length) {\n console.warn('Unovis | Crosshair: Y accessors have not been configured. Please check if they\\'re present in the configuration object')\n }\n\n // Emit a warning if there's no data to snap to.\n // To keep the console clean, only emit the warning when there's mouse interaction.\n if (!datamodel.data?.length && this._mouseEvent) {\n console.warn('Unovis | Crosshair: No data to snap to. Make sure the data has been passed to the container or to the crosshair itself')\n }\n\n nearestDatum = getNearest(datamodel.data, xValue, this.accessors.x)\n nearestDatumIndex = datamodel.data.indexOf(nearestDatum)\n }\n\n const xRange = this.xScale.range()\n const yRange = this.yScale.range()\n const xClamped = config.snapToData && nearestDatum\n ? clamp(Math.round(this.xScale(getNumber(nearestDatum, this.accessors.x, nearestDatumIndex))), 0, this._width)\n : clamp(xPx, xRange[0], xRange[1])\n\n const isCrosshairWithinXRange = (xPx >= xRange[0]) && (xPx <= xRange[1])\n const isCrosshairWithinYRange = (this._yPx >= Math.min(yRange[0], yRange[1])) && (this._yPx <= Math.max(yRange[0], yRange[1]))\n let shouldShow = config.skipRangeCheck ? !!this._xPx : (this._xPx ? isCrosshairWithinXRange && isCrosshairWithinYRange : isCrosshairWithinXRange)\n\n // If the crosshair is far from the mouse pointer (usually when `snapToData` is `true` and data resolution is low), hide it\n if (config.hideWhenFarFromPointer && ((Math.abs(xClamped - (+xPx)) >= config.hideWhenFarFromPointerDistance))) {\n shouldShow = false\n }\n\n const tooltip = config.tooltip ?? this.tooltip\n if (shouldShow && tooltip && this._isContainerInViewport()) {\n const container = tooltip.getContainer() || this.container.node()\n const isContainerBody = tooltip.isContainerBody()\n\n if (isForceShowAtDefined) {\n // Convert SVG coordinates to screen coordinates\n const containerRect = this.container.node().getBoundingClientRect()\n\n // Use the actual left margin from the container\n const screenX = (isContainerBody ? xPx + containerRect.left : xPx) + this._containerMargin.left\n const screenY = this._height / 2 + (isContainerBody ? containerRect.top : 0)\n const pos = [screenX, screenY] as [number, number]\n this._showTooltip(nearestDatum, xValue, pos, leftNearestDatumIndex)\n } else if (this._mouseEvent) {\n const pos = (isContainerBody ? [this._mouseEvent.clientX, this._mouseEvent.clientY] : pointer(this._mouseEvent, container)) as [number, number]\n this._showTooltip(nearestDatum, xValue, pos, leftNearestDatumIndex)\n }\n } else this._hideTooltip()\n\n // Trigger `onCrosshairMove` if the render was triggered by a mouse move event\n if (this._mouseEvent) {\n config.onCrosshairMove?.(shouldShow ? this.xScale.invert(this._xPx) as number : undefined, nearestDatum, nearestDatumIndex, this._mouseEvent)\n this._mouseEvent = undefined\n }\n\n smartTransition(this.g, duration)\n .style('opacity', shouldShow ? 1 : 0)\n\n // When `config.forceShowAt` becomes `undefined`, the crosshair \"jumps\" to the edge of the chart.\n // This looks off, so we stop further rendering when the `xPx` value is not finite.\n if (!isFinite(xPx)) return\n\n this.line\n .attr('y1', 0)\n .attr('y2', this._height)\n\n smartTransition(this.line, duration, easeLinear)\n .attr('x1', xClamped)\n .attr('x2', xClamped)\n\n const circleData = isFunction(config.getCircles)\n ? config.getCircles(xValue, datamodel.data, this.yScale, leftNearestDatumIndex)\n : this.getCircleData(nearestDatum, nearestDatumIndex)\n\n const circles = this.g\n .selectAll<SVGCircleElement, CrosshairCircle>('circle')\n .data(circleData, (d, i) => d.id ?? i)\n\n const circlesEnter = circles.enter()\n .append('circle')\n .attr('class', s.circle)\n .attr('r', 0)\n .attr('cx', xClamped)\n .attr('cy', d => d.y)\n .style('fill', d => d.color)\n .style('stroke', d => d.strokeColor)\n .style('stroke-width', d => d.strokeWidth)\n\n smartTransition(circlesEnter.merge(circles), duration, easeLinear)\n .attr('cx', xClamped)\n .attr('cy', d => d.y)\n .attr('r', 4)\n .style('opacity', d => d.opacity)\n .style('fill', d => d.color)\n .style('stroke', d => d.strokeColor)\n .style('stroke-width', d => d.strokeWidth)\n\n circles.exit().remove()\n }\n\n hide (sourceEvent?: MouseEvent | WheelEvent): void {\n window.cancelAnimationFrame(this._animFrameId)\n this._animFrameId = window.requestAnimationFrame(() => {\n this._xPx = undefined\n this._yPx = undefined\n this._mouseEvent = undefined\n // We call `onCrosshairMove` with all the arguments set to `undefined` because we want\n // the users to be able to hide the crosshair easily when using `forceShowAt`\n this.config.onCrosshairMove?.(undefined, undefined, undefined, sourceEvent)\n this._render()\n })\n }\n\n _onMouseMove (event: MouseEvent): void {\n const { datamodel, element } = this\n if (!this.accessors.x && datamodel.data?.length) {\n console.warn('Unovis | Crosshair: X accessor function has not been configured. Please check if it\\'s present in the configuration object')\n }\n const [x, y] = pointer(event, element)\n this._xPx = x\n this._yPx = y\n this._mouseEvent = event\n\n window.cancelAnimationFrame(this._animFrameId)\n this._animFrameId = window.requestAnimationFrame(() => {\n // We'll call `config.onCrosshairMove` in `_render` with the found `nearestDatum` and `nearestDatumIndex`,\n // which can come from the mouse interaction or from the `forceShowAt` setting\n this._render()\n })\n }\n\n _onMouseOut (event?: MouseEvent): void {\n // Only hide if the mouse actually left the SVG, not just moved to a child\n if (!event || !this.container?.node().contains((event as MouseEvent).relatedTarget as Node)) {\n this.hide(event)\n }\n }\n\n _onWheel (event: WheelEvent): void {\n this.hide(event)\n }\n\n _showTooltip (datum: Datum, xValue: number, pos: [number, number], nearestDatumIndex: number | undefined): void {\n const { config, datamodel } = this\n const tooltip = config.tooltip ?? this.tooltip\n if (!tooltip || !pos) return\n\n const [x, y] = pos\n const content = config.template(datum, xValue, datamodel.data, nearestDatumIndex)\n // Force set `followCursor` to `true` because we don't want Crosshair's tooltip to be hoverable\n tooltip.config.followCursor = true\n\n // Set tooltip placement based on Crosshair's position (left / right)\n if (!tooltip.config.horizontalPlacement || tooltip.config.horizontalPlacement === Position.Auto) {\n const xRelative = tooltip.isContainerBody() ? x - this.container.node().getBoundingClientRect().left : x\n tooltip.overrideHorizontalPlacement(xRelative > this._containerWidth / 2 ? Position.Left : Position.Right)\n }\n\n if (content) tooltip.show(content, { x, y })\n }\n\n _hideTooltip (): void {\n const { config } = this\n const tooltip = config.tooltip ?? this.tooltip\n tooltip?.hide()\n }\n\n // We don't want Crosshair to be be taken in to account in domain calculations\n getYDataExtent (): number[] {\n return [undefined, undefined]\n }\n\n private getCircleData (datum: Datum, datumIndex: number): CrosshairCircle[] {\n const { config } = this\n\n if (config.snapToData && datum) {\n const yAccessors = this.accessors.y ?? []\n const yStackedAccessors = this.accessors.yStacked ?? []\n const baselineValue = getNumber(datum, this.accessors.baseline, datumIndex) || 0\n const stackedValues: CrosshairCircle[] = getStackedValues(datum, datumIndex, ...yStackedAccessors)\n .map((value, index) => ({\n y: this.yScale(value + baselineValue),\n opacity: isNumber(getNumber(datum, yStackedAccessors[index], index)) ? 1 : 0,\n color: getColor(datum, config.color, index),\n strokeColor: config.strokeColor ? getColor(datum, config.strokeColor, index) : undefined,\n strokeWidth: config.strokeWidth ? getNumber(datum, config.strokeWidth, index) : undefined,\n }))\n\n const regularValues: CrosshairCircle[] = yAccessors\n .map((a, index) => {\n const value = getNumber(datum, a, datumIndex)\n return {\n y: this.yScale(value),\n opacity: isNumber(value) ? 1 : 0,\n color: getColor(datum, config.color, stackedValues.length + index),\n strokeColor: config.strokeColor ? getColor(datum, config.strokeColor, index) : undefined,\n strokeWidth: config.strokeWidth ? getNumber(datum, config.strokeWidth, index) : undefined,\n }\n })\n\n return stackedValues.concat(regularValues)\n }\n\n return []\n }\n}\n"],"names":["s.line","s.circle","s"],"mappings":";;;;;;;;;;;;AA0BM,MAAO,SAAiB,SAAQ,eAAuD,CAAA;AAuD3F,IAAA,WAAA,CAAa,MAAwC,EAAA;AACnD,QAAA,KAAK,EAAE,CAAA;AAtDT,QAAA,IAAA,CAAA,SAAS,GAAG,IAAI,CAAA;QACN,IAAc,CAAA,cAAA,GAAG,sBAAyD,CAAA;AAC7E,QAAA,IAAA,CAAA,MAAM,GAAoC,IAAI,CAAC,cAAc,CAAA;QAG5D,IAAI,CAAA,IAAA,GAAuB,SAAS,CAAA;QACpC,IAAI,CAAA,IAAA,GAAuB,SAAS,CAAA;QACpC,IAAW,CAAA,WAAA,GAA2B,SAAS,CAAA;QAC/C,IAAY,CAAA,YAAA,GAAW,IAAI,CAAA;;AAO3B,QAAA,IAAA,CAAA,UAAU,GAA8B;AAC9C,YAAA,CAAC,EAAE,SAAS;AACZ,YAAA,CAAC,EAAE,SAAS;AACZ,YAAA,QAAQ,EAAE,SAAS;AACnB,YAAA,QAAQ,EAAE,SAAS;SACpB,CAAA;AAmCC,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QAElC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;AAC9B,aAAA,IAAI,CAAC,OAAO,EAAEA,IAAM,CAAC,CAAA;KACzB;IAtCD,IAAW,SAAS,CAAE,SAAoC,EAAI,EAAA,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA,EAAE;AAC3F,IAAA,IAAW,SAAS,GAAA;;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Node, L extends Sank
|
|
|
20
20
|
highlightDelay?: number;
|
|
21
21
|
/** Sankey algorithm iterations. Default: `32` */
|
|
22
22
|
iterations?: number;
|
|
23
|
+
/** Enable node collapse functionality. When enabled, clicking on nodes will toggle their collapse state. Default: `false` */
|
|
24
|
+
enableNodeCollapse?: boolean;
|
|
25
|
+
/** Node collapse animation duration, ms. Default: `300` */
|
|
26
|
+
collapseAnimationDuration?: number;
|
|
27
|
+
/** Field name in the node data that indicates if a node should be pre-collapsed.
|
|
28
|
+
* For example, if set to "disabled", nodes with `disabled: true` will start collapsed.
|
|
29
|
+
* Default: `undefined` */
|
|
30
|
+
disabledField?: string;
|
|
23
31
|
/** Sankey node sorting function. Default: `undefined`.
|
|
24
32
|
* Node sorting is applied to nodes in one layer (column). Layer by layer.
|
|
25
33
|
* Options: `undefined` - the order is determined by the layout;
|
|
@@ -5,7 +5,7 @@ import { Position } from '../../types/position.js';
|
|
|
5
5
|
import { SankeyExitTransitionType, SankeyEnterTransitionType, SankeyNodeAlign, SankeySubLabelPlacement } from './types.js';
|
|
6
6
|
|
|
7
7
|
// Config
|
|
8
|
-
const SankeyDefaultConfig = (Object.assign(Object.assign({}, ComponentDefaultConfig), { heightNormalizationCoeff: 1 / 16, exitTransitionType: SankeyExitTransitionType.Default, enterTransitionType: SankeyEnterTransitionType.Default, id: (d, i) => { var _a; return (_a = d._id) !== null && _a !== void 0 ? _a : `${i}`; }, highlightSubtreeOnHover: false, highlightDuration: 300, highlightDelay: 1000, iterations: 32, nodeSort: undefined, nodeWidth: 25, nodeAlign: SankeyNodeAlign.Justify, nodeHorizontalSpacing: 150, nodeMinHeight: 20, nodeMaxHeight: 100, nodePadding: 2, nodeColor: (d) => d.color, nodeFixedValue: (d) => d.fixedValue, showSingleNode: true, nodeCursor: undefined, nodeIcon: undefined, nodeIconColor: undefined, label: (d) => d.label, labelPosition: Position.Auto, labelVerticalAlign: VerticalAlign.Middle, labelBackground: false, labelTextSeparator: [' ', '-'], labelFit: FitMode.Trim, labelTrimMode: TrimMode.Middle, labelForceWordBreak: true, labelFontSize: undefined, labelCursor: undefined, labelColor: undefined, labelMaxWidth: 70, labelExpandTrimmedOnHover: true, labelVisibility: undefined, subLabel: undefined, subLabelFontSize: undefined, subLabelColor: undefined, subLabelPlacement: SankeySubLabelPlacement.Below, subLabelToLabelInlineWidthRatio: 0.4, linkValue: (d) => d.value, linkColor: (d) => d.color, linkCursor: undefined,
|
|
8
|
+
const SankeyDefaultConfig = (Object.assign(Object.assign({}, ComponentDefaultConfig), { heightNormalizationCoeff: 1 / 16, exitTransitionType: SankeyExitTransitionType.Default, enterTransitionType: SankeyEnterTransitionType.Default, id: (d, i) => { var _a; return (_a = d._id) !== null && _a !== void 0 ? _a : `${i}`; }, highlightSubtreeOnHover: false, highlightDuration: 300, highlightDelay: 1000, iterations: 32, enableNodeCollapse: false, collapseAnimationDuration: 300, disabledField: undefined, nodeSort: undefined, nodeWidth: 25, nodeAlign: SankeyNodeAlign.Justify, nodeHorizontalSpacing: 150, nodeMinHeight: 20, nodeMaxHeight: 100, nodePadding: 2, nodeColor: (d) => d.color, nodeFixedValue: (d) => d.fixedValue, showSingleNode: true, nodeCursor: undefined, nodeIcon: undefined, nodeIconColor: undefined, label: (d) => d.label, labelPosition: Position.Auto, labelVerticalAlign: VerticalAlign.Middle, labelBackground: false, labelTextSeparator: [' ', '-'], labelFit: FitMode.Trim, labelTrimMode: TrimMode.Middle, labelForceWordBreak: true, labelFontSize: undefined, labelCursor: undefined, labelColor: undefined, labelMaxWidth: 70, labelExpandTrimmedOnHover: true, labelVisibility: undefined, subLabel: undefined, subLabelFontSize: undefined, subLabelColor: undefined, subLabelPlacement: SankeySubLabelPlacement.Below, subLabelToLabelInlineWidthRatio: 0.4, linkValue: (d) => d.value, linkColor: (d) => d.color, linkCursor: undefined,
|
|
9
9
|
// https://stackoverflow.com/a/21648197/2040291
|
|
10
10
|
init: function () {
|
|
11
11
|
this.linkSort =
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../../src/components/sankey/config.ts"],"sourcesContent":["// Config\nimport { ComponentConfigInterface, ComponentDefaultConfig } from 'core/component/config'\n\n// Utils\nimport { getNumber } from 'utils/data'\n\n// Types\nimport { ColorAccessor, GenericAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\nimport { TrimMode, VerticalAlign, FitMode } from 'types/text'\nimport { Position } from 'types/position'\nimport {\n SankeyInputLink,\n SankeyInputNode,\n SankeyNodeAlign,\n SankeySubLabelPlacement,\n SankeyExitTransitionType,\n SankeyEnterTransitionType,\n SankeyLink,\n SankeyNode,\n} from './types'\n\nexport interface SankeyConfigInterface<N extends SankeyInputNode, L extends SankeyInputLink> extends ComponentConfigInterface {\n // General\n /** Node / Link id accessor function. Used for mapping of data updates to corresponding SVG objects. Default: `(d, i) => d.id ?? i.toString()` */\n id?: (d: SankeyInputNode | SankeyInputLink, i: number, ...any: unknown[]) => string;\n /** Coefficient to scale the height of the diagram when the amount of links is low: `C * links.length`, clamped to `[height / 2, height]`. Default: `1/16` */\n heightNormalizationCoeff?: number;\n /** Type of animation on removing nodes. Default: `ExitTransitionType.Default` */\n exitTransitionType?: SankeyExitTransitionType;\n /** Type of animation on creating nodes. Default: `EnterTransitionType.Default` */\n enterTransitionType?: SankeyEnterTransitionType;\n /** Highlight the corresponding subtree on node / link hover. Default: `false` */\n highlightSubtreeOnHover?: boolean;\n /** Highlight animation duration, ms. Default: `400` */\n highlightDuration?: number;\n /** Highlight delay, ms. Default: `1000` */\n highlightDelay?: number;\n /** Sankey algorithm iterations. Default: `32` */\n iterations?: number;\n\n // Sorting\n /** Sankey node sorting function. Default: `undefined`.\n * Node sorting is applied to nodes in one layer (column). Layer by layer.\n * Options: `undefined` - the order is determined by the layout;\n * `null` - the order is fixed by the input;\n * sort function - the order is determined by the function.\n */\n nodeSort?: ((node1: SankeyNode<N, L>, node2: SankeyNode<N, L>) => number) | null | undefined;\n /** Sankey link sorting function. Default: `(link2, link1) => link1.value - link2.value`.\n * Link sorting is applied to the source (exiting) links within one node.\n * Options: `undefined` - the order is determined by the layout;\n * `null` - the order is fixed by the input;\n * sort function - the order is determined by the function.\n */\n linkSort?: ((link1: SankeyLink<N, L>, link2: SankeyLink<N, L>) => number) | null | undefined;\n\n // Nodes\n /** Sankey node width in pixels */\n nodeWidth?: number;\n /** Sankey node alignment method */\n nodeAlign?: SankeyNodeAlign;\n /** Horizontal space between the nodes. Extended Sizing property only. Default: `150` */\n nodeHorizontalSpacing?: number;\n /** Minimum node height. Extended Sizing property only. Default: `20` */\n nodeMinHeight?: number;\n /** Maximum node height. Extended Sizing property only. Default: `100` */\n nodeMaxHeight?: number;\n /** Sankey vertical separation between nodes in pixels. Default: `2` */\n nodePadding?: number;\n /** Display the graph when data has just one element */\n showSingleNode?: boolean;\n /** Node cursor on hover. Default: `undefined` */\n nodeCursor?: StringAccessor<SankeyNode<N, L>>;\n /** Node icon accessor function or value. Default: `undefined` */\n nodeIcon?: StringAccessor<SankeyNode<N, L>>;\n /** Node color accessor function or value. Default: `undefined` */\n nodeColor?: ColorAccessor<SankeyNode<N, L>>;\n /** Node `fixedValue` accessor function or constant. It defines the node value that will be used to calculate\n * the height of the nodes by d3-sankey (by default the height will be based on aggregated `linkValue`).\n * Default: `n => n.fixedValue`\n */\n nodeFixedValue?: NumericAccessor<N>;\n /** Icon color accessor function or value. Default: `undefined` */\n nodeIconColor?: ColorAccessor<SankeyNode<N, L>>;\n\n // Links\n /** Link color accessor function or value. Default: `l => l.color` */\n linkColor?: StringAccessor<SankeyLink<N, L>>;\n /** Link flow accessor function or value. Default: `l => l.value` */\n linkValue?: NumericAccessor<L>;\n /** Link cursor on hover. Default: `undefined` */\n linkCursor?: StringAccessor<SankeyLink<N, L>>;\n\n // Labels\n /** Node label accessor function or value. Default: `n => n.label` */\n label?: StringAccessor<SankeyNode<N, L>>;\n /** Node sub-label accessor function or value. Default: `undefined` */\n subLabel?: StringAccessor<SankeyNode<N, L>>;\n /** Label position relative to the Node. Default: `Position.AUTO` */\n labelPosition?: GenericAccessor<Position.Auto | Position.Left | Position.Right | string, SankeyNode<N, L>>;\n /** Label vertical alignment */\n labelVerticalAlign?: VerticalAlign | string;\n /** Label background */\n labelBackground?: boolean;\n /** Label fit mode (wrap or trim). Default: `FitMode.TRIM` **/\n labelFit?: FitMode;\n /** Maximum label with in pixels. Default: `70` */\n labelMaxWidth?: number;\n /** Expand trimmed label on hover. Default: `true` */\n labelExpandTrimmedOnHover?: boolean;\n /** Label trimming mode. Default: `TrimMode.Middle` */\n labelTrimMode?: TrimMode;\n /** Label font size in pixels. If not provided, the value of CSS variable `--vis-sankey-node-label-font-size` will be used. Default: `undefined` */\n labelFontSize?: number;\n /** Label text separators for wrapping. Default: `[' ', '-']` */\n labelTextSeparator?: string[];\n /** Force break words to fit long labels. Default: `true` */\n labelForceWordBreak?: boolean;\n /** Label color. Default: `undefined` */\n labelColor?: ColorAccessor<SankeyNode<N, L>>;\n /** Label cursor on hover. Default: `undefined` */\n labelCursor?: StringAccessor<SankeyNode<N, L>>;\n /** Custom function to set the label visibility. Default: `undefined` */\n labelVisibility?: ((d: SankeyNode<N, L>, bbox: { x: number; y: number; width: number; height: number }, hovered: boolean) => boolean) | undefined;\n /** Sub-label font size in pixels. If not provided, the value of CSS variable `--vis-sankey-node-sublabel-font-size` will be used. Default: `undefined` */\n subLabelFontSize?: number;\n /** Sub-label color. Default: `undefined` */\n subLabelColor?: ColorAccessor<SankeyNode<N, L>>;\n /** Sub-label position. Default: `SankeySubLabelPlacement.Below` */\n subLabelPlacement?: SankeySubLabelPlacement | string;\n /**\n * Sub-label to label width ratio when `subLabelPlacement` is set to `SankeySubLabelPlacement.Inline`\n * Default: `0.4`, which means that 40% of `labelMaxWidth` will be given to sub-label, and 60% to the main label.\n */\n subLabelToLabelInlineWidthRatio?: number;\n}\n\nexport const SankeyDefaultConfig: SankeyConfigInterface<SankeyInputNode, SankeyInputLink> = ({\n ...ComponentDefaultConfig,\n heightNormalizationCoeff: 1 / 16,\n exitTransitionType: SankeyExitTransitionType.Default,\n enterTransitionType: SankeyEnterTransitionType.Default,\n id: (d: SankeyInputNode, i: number) => (d as { _id: string })._id ?? `${i}`,\n highlightSubtreeOnHover: false,\n highlightDuration: 300,\n highlightDelay: 1000,\n iterations: 32,\n nodeSort: undefined,\n nodeWidth: 25,\n nodeAlign: SankeyNodeAlign.Justify,\n nodeHorizontalSpacing: 150,\n nodeMinHeight: 20,\n nodeMaxHeight: 100,\n nodePadding: 2,\n nodeColor: (d: SankeyInputNode) => (d as { color: string }).color,\n nodeFixedValue: (d: SankeyInputNode) => (d as { fixedValue: number }).fixedValue,\n showSingleNode: true,\n nodeCursor: undefined,\n nodeIcon: undefined,\n nodeIconColor: undefined,\n label: (d: SankeyInputNode) => (d as { label: string }).label,\n labelPosition: Position.Auto,\n labelVerticalAlign: VerticalAlign.Middle,\n labelBackground: false,\n labelTextSeparator: [' ', '-'],\n labelFit: FitMode.Trim,\n labelTrimMode: TrimMode.Middle,\n labelForceWordBreak: true,\n labelFontSize: undefined,\n labelCursor: undefined,\n labelColor: undefined,\n labelMaxWidth: 70,\n labelExpandTrimmedOnHover: true,\n labelVisibility: undefined,\n subLabel: undefined,\n subLabelFontSize: undefined,\n subLabelColor: undefined,\n subLabelPlacement: SankeySubLabelPlacement.Below,\n subLabelToLabelInlineWidthRatio: 0.4,\n linkValue: (d: SankeyInputNode) => (d as { value: number }).value,\n linkColor: (d: SankeyInputNode) => (d as { color: string }).color,\n linkCursor: undefined,\n\n // https://stackoverflow.com/a/21648197/2040291\n init: function () {\n (this as SankeyConfigInterface<SankeyInputNode, SankeyInputLink>).linkSort =\n (link2, link1) => getNumber(link1, this.linkValue) - getNumber(link2, this.linkValue)\n delete this.init\n return this\n },\n}).init()\n\n"],"names":[],"mappings":";;;;;;AAAA;AAyIa,MAAA,mBAAmB,GAA4D,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACvF,sB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EAAE,SAAS,EACrB,aAAa,EAAE,EAAE,EACjB,yBAAyB,EAAE,IAAI,EAC/B,eAAe,EAAE,SAAS,EAC1B,QAAQ,EAAE,SAAS,EACnB,gBAAgB,EAAE,SAAS,EAC3B,aAAa,EAAE,SAAS,EACxB,iBAAiB,EAAE,uBAAuB,CAAC,KAAK,EAChD,+BAA+B,EAAE,GAAG,EACpC,SAAS,EAAE,CAAC,CAAkB,KAAM,CAAuB,CAAC,KAAK,EACjE,SAAS,EAAE,CAAC,CAAkB,KAAM,CAAuB,CAAC,KAAK,EACjE,UAAU,EAAE,SAAS;;AAGrB,IAAA,IAAI,EAAE,YAAA;AACH,QAAA,IAAgE,CAAC,QAAQ;YACxE,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;QACvF,OAAO,IAAI,CAAC,IAAI,CAAA;AAChB,QAAA,OAAO,IAAI,CAAA;AACb,KAAC,EACD,CAAA,EAAC,IAAI;;;;"}
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../src/components/sankey/config.ts"],"sourcesContent":["// Config\nimport { ComponentConfigInterface, ComponentDefaultConfig } from 'core/component/config'\n\n// Utils\nimport { getNumber } from 'utils/data'\n\n// Types\nimport { ColorAccessor, GenericAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\nimport { TrimMode, VerticalAlign, FitMode } from 'types/text'\nimport { Position } from 'types/position'\nimport {\n SankeyInputLink,\n SankeyInputNode,\n SankeyNodeAlign,\n SankeySubLabelPlacement,\n SankeyExitTransitionType,\n SankeyEnterTransitionType,\n SankeyLink,\n SankeyNode,\n} from './types'\n\nexport interface SankeyConfigInterface<N extends SankeyInputNode, L extends SankeyInputLink> extends ComponentConfigInterface {\n // General\n /** Node / Link id accessor function. Used for mapping of data updates to corresponding SVG objects. Default: `(d, i) => d.id ?? i.toString()` */\n id?: (d: SankeyInputNode | SankeyInputLink, i: number, ...any: unknown[]) => string;\n /** Coefficient to scale the height of the diagram when the amount of links is low: `C * links.length`, clamped to `[height / 2, height]`. Default: `1/16` */\n heightNormalizationCoeff?: number;\n /** Type of animation on removing nodes. Default: `ExitTransitionType.Default` */\n exitTransitionType?: SankeyExitTransitionType;\n /** Type of animation on creating nodes. Default: `EnterTransitionType.Default` */\n enterTransitionType?: SankeyEnterTransitionType;\n /** Highlight the corresponding subtree on node / link hover. Default: `false` */\n highlightSubtreeOnHover?: boolean;\n /** Highlight animation duration, ms. Default: `400` */\n highlightDuration?: number;\n /** Highlight delay, ms. Default: `1000` */\n highlightDelay?: number;\n /** Sankey algorithm iterations. Default: `32` */\n iterations?: number;\n\n // Collapse/Expand\n /** Enable node collapse functionality. When enabled, clicking on nodes will toggle their collapse state. Default: `false` */\n enableNodeCollapse?: boolean;\n /** Node collapse animation duration, ms. Default: `300` */\n collapseAnimationDuration?: number;\n /** Field name in the node data that indicates if a node should be pre-collapsed.\n * For example, if set to \"disabled\", nodes with `disabled: true` will start collapsed.\n * Default: `undefined` */\n disabledField?: string;\n\n // Sorting\n /** Sankey node sorting function. Default: `undefined`.\n * Node sorting is applied to nodes in one layer (column). Layer by layer.\n * Options: `undefined` - the order is determined by the layout;\n * `null` - the order is fixed by the input;\n * sort function - the order is determined by the function.\n */\n nodeSort?: ((node1: SankeyNode<N, L>, node2: SankeyNode<N, L>) => number) | null | undefined;\n /** Sankey link sorting function. Default: `(link2, link1) => link1.value - link2.value`.\n * Link sorting is applied to the source (exiting) links within one node.\n * Options: `undefined` - the order is determined by the layout;\n * `null` - the order is fixed by the input;\n * sort function - the order is determined by the function.\n */\n linkSort?: ((link1: SankeyLink<N, L>, link2: SankeyLink<N, L>) => number) | null | undefined;\n\n // Nodes\n /** Sankey node width in pixels */\n nodeWidth?: number;\n /** Sankey node alignment method */\n nodeAlign?: SankeyNodeAlign;\n /** Horizontal space between the nodes. Extended Sizing property only. Default: `150` */\n nodeHorizontalSpacing?: number;\n /** Minimum node height. Extended Sizing property only. Default: `20` */\n nodeMinHeight?: number;\n /** Maximum node height. Extended Sizing property only. Default: `100` */\n nodeMaxHeight?: number;\n /** Sankey vertical separation between nodes in pixels. Default: `2` */\n nodePadding?: number;\n /** Display the graph when data has just one element */\n showSingleNode?: boolean;\n /** Node cursor on hover. Default: `undefined` */\n nodeCursor?: StringAccessor<SankeyNode<N, L>>;\n /** Node icon accessor function or value. Default: `undefined` */\n nodeIcon?: StringAccessor<SankeyNode<N, L>>;\n /** Node color accessor function or value. Default: `undefined` */\n nodeColor?: ColorAccessor<SankeyNode<N, L>>;\n /** Node `fixedValue` accessor function or constant. It defines the node value that will be used to calculate\n * the height of the nodes by d3-sankey (by default the height will be based on aggregated `linkValue`).\n * Default: `n => n.fixedValue`\n */\n nodeFixedValue?: NumericAccessor<N>;\n /** Icon color accessor function or value. Default: `undefined` */\n nodeIconColor?: ColorAccessor<SankeyNode<N, L>>;\n\n // Links\n /** Link color accessor function or value. Default: `l => l.color` */\n linkColor?: StringAccessor<SankeyLink<N, L>>;\n /** Link flow accessor function or value. Default: `l => l.value` */\n linkValue?: NumericAccessor<L>;\n /** Link cursor on hover. Default: `undefined` */\n linkCursor?: StringAccessor<SankeyLink<N, L>>;\n\n // Labels\n /** Node label accessor function or value. Default: `n => n.label` */\n label?: StringAccessor<SankeyNode<N, L>>;\n /** Node sub-label accessor function or value. Default: `undefined` */\n subLabel?: StringAccessor<SankeyNode<N, L>>;\n /** Label position relative to the Node. Default: `Position.AUTO` */\n labelPosition?: GenericAccessor<Position.Auto | Position.Left | Position.Right | string, SankeyNode<N, L>>;\n /** Label vertical alignment */\n labelVerticalAlign?: VerticalAlign | string;\n /** Label background */\n labelBackground?: boolean;\n /** Label fit mode (wrap or trim). Default: `FitMode.TRIM` **/\n labelFit?: FitMode;\n /** Maximum label with in pixels. Default: `70` */\n labelMaxWidth?: number;\n /** Expand trimmed label on hover. Default: `true` */\n labelExpandTrimmedOnHover?: boolean;\n /** Label trimming mode. Default: `TrimMode.Middle` */\n labelTrimMode?: TrimMode;\n /** Label font size in pixels. If not provided, the value of CSS variable `--vis-sankey-node-label-font-size` will be used. Default: `undefined` */\n labelFontSize?: number;\n /** Label text separators for wrapping. Default: `[' ', '-']` */\n labelTextSeparator?: string[];\n /** Force break words to fit long labels. Default: `true` */\n labelForceWordBreak?: boolean;\n /** Label color. Default: `undefined` */\n labelColor?: ColorAccessor<SankeyNode<N, L>>;\n /** Label cursor on hover. Default: `undefined` */\n labelCursor?: StringAccessor<SankeyNode<N, L>>;\n /** Custom function to set the label visibility. Default: `undefined` */\n labelVisibility?: ((d: SankeyNode<N, L>, bbox: { x: number; y: number; width: number; height: number }, hovered: boolean) => boolean) | undefined;\n /** Sub-label font size in pixels. If not provided, the value of CSS variable `--vis-sankey-node-sublabel-font-size` will be used. Default: `undefined` */\n subLabelFontSize?: number;\n /** Sub-label color. Default: `undefined` */\n subLabelColor?: ColorAccessor<SankeyNode<N, L>>;\n /** Sub-label position. Default: `SankeySubLabelPlacement.Below` */\n subLabelPlacement?: SankeySubLabelPlacement | string;\n /**\n * Sub-label to label width ratio when `subLabelPlacement` is set to `SankeySubLabelPlacement.Inline`\n * Default: `0.4`, which means that 40% of `labelMaxWidth` will be given to sub-label, and 60% to the main label.\n */\n subLabelToLabelInlineWidthRatio?: number;\n}\n\nexport const SankeyDefaultConfig: SankeyConfigInterface<SankeyInputNode, SankeyInputLink> = ({\n ...ComponentDefaultConfig,\n heightNormalizationCoeff: 1 / 16,\n exitTransitionType: SankeyExitTransitionType.Default,\n enterTransitionType: SankeyEnterTransitionType.Default,\n id: (d: SankeyInputNode, i: number) => (d as { _id: string })._id ?? `${i}`,\n highlightSubtreeOnHover: false,\n highlightDuration: 300,\n highlightDelay: 1000,\n iterations: 32,\n enableNodeCollapse: false,\n collapseAnimationDuration: 300,\n disabledField: undefined,\n nodeSort: undefined,\n nodeWidth: 25,\n nodeAlign: SankeyNodeAlign.Justify,\n nodeHorizontalSpacing: 150,\n nodeMinHeight: 20,\n nodeMaxHeight: 100,\n nodePadding: 2,\n nodeColor: (d: SankeyInputNode) => (d as { color: string }).color,\n nodeFixedValue: (d: SankeyInputNode) => (d as { fixedValue: number }).fixedValue,\n showSingleNode: true,\n nodeCursor: undefined,\n nodeIcon: undefined,\n nodeIconColor: undefined,\n label: (d: SankeyInputNode) => (d as { label: string }).label,\n labelPosition: Position.Auto,\n labelVerticalAlign: VerticalAlign.Middle,\n labelBackground: false,\n labelTextSeparator: [' ', '-'],\n labelFit: FitMode.Trim,\n labelTrimMode: TrimMode.Middle,\n labelForceWordBreak: true,\n labelFontSize: undefined,\n labelCursor: undefined,\n labelColor: undefined,\n labelMaxWidth: 70,\n labelExpandTrimmedOnHover: true,\n labelVisibility: undefined,\n subLabel: undefined,\n subLabelFontSize: undefined,\n subLabelColor: undefined,\n subLabelPlacement: SankeySubLabelPlacement.Below,\n subLabelToLabelInlineWidthRatio: 0.4,\n linkValue: (d: SankeyInputNode) => (d as { value: number }).value,\n linkColor: (d: SankeyInputNode) => (d as { color: string }).color,\n linkCursor: undefined,\n\n // https://stackoverflow.com/a/21648197/2040291\n init: function () {\n (this as SankeyConfigInterface<SankeyInputNode, SankeyInputLink>).linkSort =\n (link2, link1) => getNumber(link1, this.linkValue) - getNumber(link2, this.linkValue)\n delete this.init\n return this\n },\n}).init()\n\n"],"names":[],"mappings":";;;;;;AAAA;AAmJO,MAAM,mBAAmB,GAA4D,CACvF,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,sBAAsB,CACzB,EAAA,EAAA,wBAAwB,EAAE,CAAC,GAAG,EAAE,EAChC,kBAAkB,EAAE,wBAAwB,CAAC,OAAO,EACpD,mBAAmB,EAAE,yBAAyB,CAAC,OAAO,EACtD,EAAE,EAAE,CAAC,CAAkB,EAAE,CAAS,KAAK,EAAA,IAAA,EAAA,CAAA,CAAA,OAAA,CAAC,EAAA,GAAA,CAAqB,CAAC,G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B,EAAE,uBAAuB,CAAC,KAAK,EAChD,+BAA+B,EAAE,GAAG,EACpC,SAAS,EAAE,CAAC,CAAkB,KAAM,CAAuB,CAAC,KAAK,EACjE,SAAS,EAAE,CAAC,CAAkB,KAAM,CAAuB,CAAC,KAAK,EACjE,UAAU,EAAE,SAAS;;AAGrB,IAAA,IAAI,EAAE,YAAA;AACH,QAAA,IAAgE,CAAC,QAAQ;YACxE,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;QACvF,OAAO,IAAI,CAAC,IAAI,CAAA;AAChB,QAAA,OAAO,IAAI,CAAA;AACb,KAAC,EACD,CAAA,EAAC,IAAI;;;;"}
|
|
@@ -26,9 +26,15 @@ export declare class Sankey<N extends SankeyInputNode, L extends SankeyInputLink
|
|
|
26
26
|
[x: string]: {
|
|
27
27
|
mouseenter: (d: SankeyNode<N, L>, event: MouseEvent) => void;
|
|
28
28
|
mouseleave: (d: SankeyNode<N, L>, event: MouseEvent) => void;
|
|
29
|
+
click?: undefined;
|
|
30
|
+
} | {
|
|
31
|
+
mouseenter: (d: SankeyNode<N, L>) => void;
|
|
32
|
+
mouseleave: (d: SankeyNode<N, L>) => void;
|
|
33
|
+
click: (d: SankeyNode<N, L>, event: MouseEvent) => void;
|
|
29
34
|
} | {
|
|
30
35
|
mouseenter: (d: SankeyLink<N, L>, event: MouseEvent) => void;
|
|
31
36
|
mouseleave: (d: SankeyLink<N, L>, event: MouseEvent) => void;
|
|
37
|
+
click?: undefined;
|
|
32
38
|
};
|
|
33
39
|
};
|
|
34
40
|
constructor(config?: SankeyConfigInterface<N, L>);
|
|
@@ -50,11 +56,34 @@ export declare class Sankey<N extends SankeyInputNode, L extends SankeyInputLink
|
|
|
50
56
|
highlightSubtree(node: SankeyNode<N, L>): void;
|
|
51
57
|
recursiveSetSubtreeState(node: SankeyNode<N, L>, linksKey: 'sourceLinks' | 'targetLinks', nodeKey: 'source' | 'target', key: string, value: unknown): void;
|
|
52
58
|
disableHighlight(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Collapses a node by hiding only the links directly connected to it.
|
|
61
|
+
* All other nodes (including children and descendants) remain visible in their original positions.
|
|
62
|
+
* Only the immediate incoming and outgoing links of the collapsed node are hidden.
|
|
63
|
+
*/
|
|
64
|
+
collapseNode(node: SankeyNode<N, L>): void;
|
|
65
|
+
/**
|
|
66
|
+
* Expands a previously collapsed node by showing its directly connected links.
|
|
67
|
+
*/
|
|
68
|
+
expandNode(node: SankeyNode<N, L>): void;
|
|
69
|
+
/**
|
|
70
|
+
* Toggles the collapse state of a node.
|
|
71
|
+
*
|
|
72
|
+
* @param node The node to toggle
|
|
73
|
+
*/
|
|
74
|
+
toggleNodeCollapse(node: SankeyNode<N, L>): void;
|
|
53
75
|
private _hasLinks;
|
|
76
|
+
/**
|
|
77
|
+
* Applies initial collapse state to nodes based on the disabledField configuration.
|
|
78
|
+
* If disabledField is set (e.g., "disabled"), nodes with that field set to true
|
|
79
|
+
* will be pre-collapsed when the component loads.
|
|
80
|
+
*/
|
|
81
|
+
private _applyInitialCollapseState;
|
|
54
82
|
private _onNodeMouseOver;
|
|
55
83
|
private _onNodeMouseOut;
|
|
56
84
|
private _onNodeRectMouseOver;
|
|
57
85
|
private _onNodeRectMouseOut;
|
|
58
86
|
private _onLinkMouseOver;
|
|
59
87
|
private _onLinkMouseOut;
|
|
88
|
+
private _onNodeClick;
|
|
60
89
|
}
|
|
@@ -38,6 +38,7 @@ class Sankey extends ComponentCore {
|
|
|
38
38
|
[Sankey.selectors.node]: {
|
|
39
39
|
mouseenter: this._onNodeRectMouseOver.bind(this),
|
|
40
40
|
mouseleave: this._onNodeRectMouseOut.bind(this),
|
|
41
|
+
click: this._onNodeClick.bind(this),
|
|
41
42
|
},
|
|
42
43
|
[Sankey.selectors.link]: {
|
|
43
44
|
mouseenter: this._onLinkMouseOver.bind(this),
|
|
@@ -80,12 +81,16 @@ class Sankey extends ComponentCore {
|
|
|
80
81
|
}
|
|
81
82
|
setData(data) {
|
|
82
83
|
super.setData(data);
|
|
84
|
+
// Pre-collapse nodes based on disabledField
|
|
85
|
+
this._applyInitialCollapseState();
|
|
83
86
|
// Pre-calculate component size for Sizing.EXTEND
|
|
84
87
|
if ((this.sizing !== Sizing.Fit) || !this._hasLinks())
|
|
85
88
|
this._preCalculateComponentSize();
|
|
86
89
|
}
|
|
87
90
|
setConfig(config) {
|
|
88
91
|
super.setConfig(config);
|
|
92
|
+
// Apply initial collapse state if disabledField is set
|
|
93
|
+
this._applyInitialCollapseState();
|
|
89
94
|
// Pre-calculate component size for Sizing.EXTEND
|
|
90
95
|
if ((this.sizing !== Sizing.Fit) || !this._hasLinks())
|
|
91
96
|
this._preCalculateComponentSize();
|
|
@@ -274,10 +279,69 @@ class Sankey extends ComponentCore {
|
|
|
274
279
|
this._render(config.highlightDuration);
|
|
275
280
|
}
|
|
276
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
* Collapses a node by hiding only the links directly connected to it.
|
|
284
|
+
* All other nodes (including children and descendants) remain visible in their original positions.
|
|
285
|
+
* Only the immediate incoming and outgoing links of the collapsed node are hidden.
|
|
286
|
+
*/
|
|
287
|
+
collapseNode(node) {
|
|
288
|
+
const { config } = this;
|
|
289
|
+
// Clear any active highlights before collapsing
|
|
290
|
+
this.disableHighlight();
|
|
291
|
+
node._state = node._state || {};
|
|
292
|
+
node._state.collapsed = true;
|
|
293
|
+
this._render(config.collapseAnimationDuration);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Expands a previously collapsed node by showing its directly connected links.
|
|
297
|
+
*/
|
|
298
|
+
expandNode(node) {
|
|
299
|
+
const { config } = this;
|
|
300
|
+
// Clear any active highlights before expanding
|
|
301
|
+
this.disableHighlight();
|
|
302
|
+
node._state = node._state || {};
|
|
303
|
+
node._state.collapsed = false;
|
|
304
|
+
this._render(config.collapseAnimationDuration);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Toggles the collapse state of a node.
|
|
308
|
+
*
|
|
309
|
+
* @param node The node to toggle
|
|
310
|
+
*/
|
|
311
|
+
toggleNodeCollapse(node) {
|
|
312
|
+
var _a;
|
|
313
|
+
if ((_a = node._state) === null || _a === void 0 ? void 0 : _a.collapsed) {
|
|
314
|
+
this.expandNode(node);
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
this.collapseNode(node);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
277
320
|
_hasLinks() {
|
|
278
321
|
const { datamodel } = this;
|
|
279
322
|
return datamodel.links.length > 0;
|
|
280
323
|
}
|
|
324
|
+
/**
|
|
325
|
+
* Applies initial collapse state to nodes based on the disabledField configuration.
|
|
326
|
+
* If disabledField is set (e.g., "disabled"), nodes with that field set to true
|
|
327
|
+
* will be pre-collapsed when the component loads.
|
|
328
|
+
*/
|
|
329
|
+
_applyInitialCollapseState() {
|
|
330
|
+
const { config, datamodel } = this;
|
|
331
|
+
if (!config.disabledField)
|
|
332
|
+
return;
|
|
333
|
+
// Check each node for the disabled field and set initial collapse state
|
|
334
|
+
for (const node of datamodel.nodes) {
|
|
335
|
+
const inputData = node;
|
|
336
|
+
const isDisabled = inputData && typeof inputData === 'object' &&
|
|
337
|
+
config.disabledField in inputData &&
|
|
338
|
+
inputData[config.disabledField] === true;
|
|
339
|
+
if (isDisabled) {
|
|
340
|
+
node._state = node._state || {};
|
|
341
|
+
node._state.collapsed = true;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
281
345
|
_onNodeMouseOver(d, event) {
|
|
282
346
|
onNodeMouseOver(d, select(event.currentTarget), this.config, this._width);
|
|
283
347
|
}
|
|
@@ -300,6 +364,12 @@ class Sankey extends ComponentCore {
|
|
|
300
364
|
_onLinkMouseOut(d, event) {
|
|
301
365
|
this.disableHighlight();
|
|
302
366
|
}
|
|
367
|
+
_onNodeClick(d, event) {
|
|
368
|
+
const { config } = this;
|
|
369
|
+
if (config.enableNodeCollapse) {
|
|
370
|
+
this.toggleNodeCollapse(d);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
303
373
|
}
|
|
304
374
|
Sankey.selectors = style;
|
|
305
375
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/sankey/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\nimport { sankey, SankeyGraph } from 'd3-sankey'\nimport { extent, max, sum } from 'd3-array'\nimport { scaleLinear } from 'd3-scale'\n\n// Core\nimport { ComponentCore } from 'core/component'\nimport { GraphDataModel } from 'data-models/graph'\n\n// Types\nimport { ExtendedSizeComponent, Sizing } from 'types/component'\nimport { Position } from 'types/position'\nimport { Spacing } from 'types/spacing'\nimport { VerticalAlign } from 'types/text'\n\n// Utils\nimport { smartTransition } from 'utils/d3'\nimport { getNumber, getString, groupBy, isNumber } from 'utils/data'\nimport { getCSSVariableValueInPixels } from 'utils/misc'\n\n// Config\nimport { SankeyDefaultConfig, SankeyConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\n// Local Types\nimport { SankeyInputLink, SankeyInputNode, SankeyLayout, SankeyLink, SankeyNode } from './types'\n\n// Modules\nimport { createLinks, removeLinks, updateLinks } from './modules/link'\nimport { createNodes, onNodeMouseOut, onNodeMouseOver, removeNodes, updateNodes } from './modules/node'\nimport { getLabelOrientation, requiredLabelSpace } from './modules/label'\n\nexport class Sankey<\n N extends SankeyInputNode,\n L extends SankeyInputLink,\n> extends ComponentCore<\n {nodes: N[]; links?: L[]},\n SankeyConfigInterface<N, L>\n > implements ExtendedSizeComponent {\n static selectors = s\n protected _defaultConfig = SankeyDefaultConfig as SankeyConfigInterface<N, L>\n public config: SankeyConfigInterface<N, L> = this._defaultConfig\n datamodel: GraphDataModel<N, L, SankeyNode<N, L>, SankeyLink<N, L>> = new GraphDataModel()\n private _extendedWidth: number | undefined = undefined\n private _extendedHeight: number | undefined = undefined\n private _extendedHeightIncreased: number | undefined = undefined\n private _linksGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _nodesGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _backgroundRect: Selection<SVGRectElement, unknown, SVGGElement, unknown>\n private _sankey = sankey<SankeyGraph<N, L>, SankeyNode<N, L>, SankeyLink<N, L>>()\n private _highlightTimeoutId: ReturnType<typeof setTimeout> | null = null\n private _highlightActive = false\n events = {\n [Sankey.selectors.nodeGroup]: {\n mouseenter: this._onNodeMouseOver.bind(this),\n mouseleave: this._onNodeMouseOut.bind(this),\n },\n [Sankey.selectors.node]: {\n mouseenter: this._onNodeRectMouseOver.bind(this),\n mouseleave: this._onNodeRectMouseOut.bind(this),\n },\n [Sankey.selectors.link]: {\n mouseenter: this._onLinkMouseOver.bind(this),\n mouseleave: this._onLinkMouseOut.bind(this),\n },\n }\n\n constructor (config?: SankeyConfigInterface<N, L>) {\n super()\n if (config) this.setConfig(config)\n this._backgroundRect = this.g.append('rect').attr('class', s.background)\n this._linksGroup = this.g.append('g').attr('class', s.links)\n this._nodesGroup = this.g.append('g').attr('class', s.nodes)\n }\n\n get bleed (): Spacing {\n const { config, datamodel: { nodes, links } } = this\n const labelFontSize = config.labelFontSize ?? getCSSVariableValueInPixels('var(--vis-sankey-label-font-size)', this.element)\n const labelSize = requiredLabelSpace(config.labelMaxWidth, labelFontSize)\n\n let left = 0\n let right = 0\n\n // We pre-calculate sankey layout to get information about node labels placement and calculate bleed properly\n // Potentially it can be a performance bottleneck for large layouts, but generally rendering of such layouts is much more computationally heavy\n if (nodes.length) {\n const sankeyProbeSize = 1000\n this._populateLinkAndNodeValues()\n this._sankey.size([sankeyProbeSize, sankeyProbeSize])\n this._sankey({ nodes, links })\n const maxDepth = max(nodes, d => d.depth)\n const zeroDepthNodes = nodes.filter(d => d.depth === 0)\n const maxDepthNodes = nodes.filter(d => d.depth === maxDepth)\n\n left = zeroDepthNodes.some(d => getLabelOrientation(d, sankeyProbeSize, config.labelPosition) === Position.Left) ? labelSize.width : 0\n right = maxDepthNodes.some(d => getLabelOrientation(d, sankeyProbeSize, config.labelPosition) === Position.Right) ? labelSize.width : 0\n }\n\n const top = config.labelVerticalAlign === VerticalAlign.Top ? 0\n : config.labelVerticalAlign === VerticalAlign.Bottom ? labelSize.height\n : labelSize.height / 2\n\n const bottom = config.labelVerticalAlign === VerticalAlign.Top ? labelSize.height\n : config.labelVerticalAlign === VerticalAlign.Bottom ? 0\n : labelSize.height / 2\n\n return { top, bottom, left, right }\n }\n\n setData (data: { nodes: N[]; links?: L[] }): void {\n super.setData(data)\n\n // Pre-calculate component size for Sizing.EXTEND\n if ((this.sizing !== Sizing.Fit) || !this._hasLinks()) this._preCalculateComponentSize()\n }\n\n setConfig (config: SankeyConfigInterface<N, L>): void {\n super.setConfig(config)\n\n // Pre-calculate component size for Sizing.EXTEND\n if ((this.sizing !== Sizing.Fit) || !this._hasLinks()) this._preCalculateComponentSize()\n\n // Using \"as any\" because typings are not full (\"@types/d3-sankey\": \"^0.11.2\")\n const nodeId = ((d: SankeyInputNode, i: number) => getString(d, this.config.id, i)) as any;\n (this._sankey as any).linkSort(this.config.linkSort)\n this._sankey\n .nodeId(nodeId)\n .nodeWidth(this.config.nodeWidth)\n .nodePadding(this.config.nodePadding)\n .nodeAlign(SankeyLayout[this.config.nodeAlign])\n .nodeSort(this.config.nodeSort)\n .iterations(this.config.iterations)\n }\n\n _render (customDuration?: number): void {\n const { config, bleed, datamodel: { nodes, links } } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n\n if (\n (nodes.length === 0) ||\n (nodes.length === 1 && links.length > 0) ||\n (nodes.length === 1 && !config.showSingleNode) ||\n (nodes.length > 1 && links.length === 0)\n ) {\n this._linksGroup.selectAll<SVGGElement, SankeyLink<N, L>>(`.${s.link}`).call(removeLinks, duration)\n this._nodesGroup.selectAll<SVGGElement, SankeyNode<N, L>>(`.${s.nodeGroup}`).call(removeNodes, config, duration)\n }\n\n // Prepare Layout\n this._prepareLayout()\n\n // Links\n smartTransition(this._linksGroup, duration).attr('transform', `translate(${bleed.left},${bleed.top})`)\n const linkSelection = this._linksGroup.selectAll<SVGGElement, SankeyLink<N, L>>(`.${s.link}`)\n .data(links, (d, i) => config.id(d, i) ?? i)\n const linkSelectionEnter = linkSelection.enter().append('g').attr('class', s.link)\n linkSelectionEnter.call(createLinks)\n linkSelection.merge(linkSelectionEnter).call(updateLinks, config, duration)\n linkSelection.exit<SankeyLink<N, L>>().call(removeLinks)\n\n // Nodes\n smartTransition(this._nodesGroup, duration).attr('transform', `translate(${bleed.left},${bleed.top})`)\n\n const nodeSelection = this._nodesGroup.selectAll<SVGGElement, SankeyNode<N, L>>(`.${s.nodeGroup}`)\n .data(nodes, (d, i) => config.id(d, i) ?? i)\n const nodeSelectionEnter = nodeSelection.enter().append('g').attr('class', s.nodeGroup)\n nodeSelectionEnter.call(createNodes, this.config, this._width, bleed)\n nodeSelection.merge(nodeSelectionEnter).call(updateNodes, config, this._width, bleed, this._hasLinks(), duration)\n nodeSelection.exit<SankeyNode<N, L>>()\n .attr('class', s.nodeExit)\n .call(removeNodes, config, duration)\n\n // Background\n this._backgroundRect\n .attr('width', this.getWidth())\n .attr('height', this.getHeight())\n .attr('opacity', 0)\n }\n\n private _populateLinkAndNodeValues (): void {\n const { config, datamodel } = this\n\n const nodes = datamodel.nodes\n const links = datamodel.links\n\n // For d3-sankey each link must be an object with the `value` property\n links.forEach((link, i) => {\n link.value = getNumber(link, d => getNumber(d, config.linkValue, i))\n })\n\n // Populating node.fixedValue for d3-sankey\n nodes.forEach((node, i) => {\n node.fixedValue = getNumber(node, config.nodeFixedValue, i)\n })\n }\n\n private _preCalculateComponentSize (): void {\n const { bleed, config, datamodel } = this\n const nodes = datamodel.nodes\n\n\n if (nodes.length) {\n this._populateLinkAndNodeValues()\n this._sankey(datamodel)\n }\n\n const scaleExtent = extent(nodes, d => d.value || undefined)\n const scaleRange = [config.nodeMinHeight, config.nodeMaxHeight]\n const scale = scaleLinear().domain(scaleExtent).range(scaleRange).clamp(true)\n nodes.forEach(n => { n._state.precalculatedHeight = scale(n.value) || config.nodeMinHeight })\n\n const groupedByColumn: { [key: string]: SankeyNode<N, L>[] } = groupBy(nodes, d => d.layer)\n const values = Object.values(groupedByColumn)\n .map((group) =>\n sum(group.map(n => n._state.precalculatedHeight + config.nodePadding)) - config.nodePadding\n )\n\n const height = max(values) || config.nodeMinHeight\n this._extendedHeight = height + bleed.top + bleed.bottom\n this._extendedWidth = Math.max(0, (config.nodeWidth + config.nodeHorizontalSpacing) * Object.keys(groupedByColumn).length - config.nodeHorizontalSpacing + bleed.left + bleed.right)\n }\n\n private _prepareLayout (): void {\n const { config, bleed, datamodel } = this\n const isExtendedSize = this.sizing === Sizing.Extend\n const sankeyHeight = this.sizing === Sizing.Fit ? this._height : this._extendedHeight\n const sankeyWidth = this.sizing === Sizing.Fit ? this._width : this._extendedWidth\n this._sankey\n .size([\n Math.max(sankeyWidth - bleed.left - bleed.right, 0),\n Math.max(sankeyHeight - bleed.top - bleed.bottom, 0),\n ])\n\n const nodes = datamodel.nodes\n const links = datamodel.links\n\n // If there are no links we manually calculate the visualization layout\n if (!this._hasLinks()) {\n let y = 0\n const nodesTotalHeight = sum(nodes, n => n._state.precalculatedHeight || 1)\n for (const node of nodes) {\n const sankeyHeight = this.getHeight() - bleed.top - bleed.bottom\n const nodeHeight = node._state.precalculatedHeight || 1\n const h = isExtendedSize ? nodeHeight : (sankeyHeight - config.nodePadding * (nodes.length - 1)) * nodeHeight / nodesTotalHeight\n\n node.width = Math.max(10, config.nodeWidth)\n node.x0 = 0\n node.x1 = node.width\n node.y0 = y\n node.y1 = y + Math.max(1, h)\n node.layer = 0\n\n y = node.y1 + config.nodePadding\n }\n\n this._extendedHeightIncreased = undefined\n return\n }\n\n // Calculate sankey\n this._populateLinkAndNodeValues()\n this._sankey({ nodes, links })\n\n // Setting minimum node height\n // Default: 1px\n // Extended size nodes that have no links: config.nodeMinHeight\n for (const node of nodes) {\n const singleExtendedSize = isExtendedSize && !node.sourceLinks?.length && !node.targetLinks?.length\n const h = Math.max(singleExtendedSize ? config.nodeMinHeight : 1, node.y1 - node.y0)\n const y = (node.y0 + node.y1) / 2\n node.y0 = y - h / 2\n node.y1 = y + h / 2\n }\n\n if (isExtendedSize) {\n const height = max(nodes, d => d.y1)\n this._extendedHeightIncreased = height + bleed.top + bleed.bottom\n }\n }\n\n getWidth (): number {\n return this.sizing === Sizing.Fit ? this._width : (this._extendedWidth || 0)\n }\n\n getHeight (): number {\n return this.sizing === Sizing.Fit ? this._height : Math.max(this._extendedHeightIncreased || 0, this._extendedHeight || 0)\n }\n\n getLayoutWidth (): number {\n return this.sizing === Sizing.Fit ? this._width : this._extendedWidth\n }\n\n getLayoutHeight (): number {\n return this.sizing === Sizing.Fit ? this._height : (this._extendedHeightIncreased || this._extendedHeight)\n }\n\n getColumnCenters (): number[] {\n const { datamodel } = this\n const nodes = datamodel.nodes as SankeyNode<N, L>[]\n const centers = nodes.reduce((pos, node) => {\n const idx = node.layer\n if (!isFinite(pos[idx])) {\n pos[idx] = (node.x0 + node.x1) / 2\n }\n return pos\n }, [])\n\n return centers\n }\n\n highlightSubtree (node: SankeyNode<N, L>): void {\n const { config, datamodel } = this\n\n clearTimeout(this._highlightTimeoutId)\n this._highlightTimeoutId = setTimeout(() => {\n for (const n of datamodel.nodes) n._state.greyout = true\n for (const l of datamodel.links) l._state.greyout = true\n\n this.recursiveSetSubtreeState(node, 'sourceLinks', 'target', 'greyout', false)\n this.recursiveSetSubtreeState(node, 'targetLinks', 'source', 'greyout', false)\n this._render(config.highlightDuration)\n this._highlightActive = true\n }, config.highlightDelay)\n }\n\n recursiveSetSubtreeState (\n node: SankeyNode<N, L>,\n linksKey: 'sourceLinks' | 'targetLinks',\n nodeKey: 'source' | 'target',\n key: string,\n value: unknown\n ): void {\n node._state[key] = value\n\n for (const l of node[linksKey]) {\n l._state[key] = value\n this.recursiveSetSubtreeState(l[nodeKey] as SankeyNode<N, L>, linksKey, nodeKey, key, value)\n }\n }\n\n disableHighlight (): void {\n const { config, datamodel } = this\n\n clearTimeout(this._highlightTimeoutId)\n if (this._highlightActive) {\n this._highlightActive = false\n\n for (const n of datamodel.nodes) n._state.greyout = false\n for (const l of datamodel.links) l._state.greyout = false\n this._render(config.highlightDuration)\n }\n }\n\n private _hasLinks (): boolean {\n const { datamodel } = this\n return datamodel.links.length > 0\n }\n\n private _onNodeMouseOver (d: SankeyNode<N, L>, event: MouseEvent): void {\n onNodeMouseOver(d, select(event.currentTarget as SVGGElement), this.config, this._width)\n }\n\n private _onNodeMouseOut (d: SankeyNode<N, L>, event: MouseEvent): void {\n onNodeMouseOut(d, select(event.currentTarget as SVGGElement), this.config, this._width)\n }\n\n private _onNodeRectMouseOver (d: SankeyNode<N, L>): void {\n const { config } = this\n if (config.highlightSubtreeOnHover) this.highlightSubtree(d)\n }\n\n private _onNodeRectMouseOut (d: SankeyNode<N, L>): void {\n this.disableHighlight()\n }\n\n private _onLinkMouseOver (d: SankeyLink<N, L>, event: MouseEvent): void {\n const { config } = this\n\n if (config.highlightSubtreeOnHover) this.highlightSubtree(d.target as SankeyNode<N, L>)\n }\n\n private _onLinkMouseOut (d: SankeyLink<N, L>, event: MouseEvent): void {\n this.disableHighlight()\n }\n}\n"],"names":["s.background","s.links","s.nodes","s.link","s.nodeGroup","s.nodeExit","s"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkCM,MAAO,MAGX,SAAQ,aAGP,CAAA;AA6BD,IAAA,WAAA,CAAa,MAAoC,EAAA;AAC/C,QAAA,KAAK,EAAE,CAAA;QA5BC,IAAc,CAAA,cAAA,GAAG,mBAAkD,CAAA;AACtE,QAAA,IAAA,CAAA,MAAM,GAAgC,IAAI,CAAC,cAAc,CAAA;AAChE,QAAA,IAAA,CAAA,SAAS,GAA6D,IAAI,cAAc,EAAE,CAAA;QAClF,IAAc,CAAA,cAAA,GAAuB,SAAS,CAAA;QAC9C,IAAe,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AAK,CAAC,MAAM,GAAG,CAAC,CAAA;KAClC;IAEO,gBAAgB,CAAE,CAAmB,EAAE,KAAiB,EAAA;AAC9D,QAAA,eAAe,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,aAA4B,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;KACzF;IAEO,eAAe,CAAE,CAAmB,EAAE,KAAiB,EAAA;AAC7D,QAAA,cAAc,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,aAA4B,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;KACxF;AAEO,IAAA,oBAAoB,CAAE,CAAmB,EAAA;AAC/C,QAAA,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;QACvB,IAAI,MAAM,CAAC,uBAAuB;AAAE,YAAA,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;KAC7D;AAEO,IAAA,mBAAmB,CAAE,CAAmB,EAAA;QAC9C,IAAI,CAAC,gBAAgB,EAAE,CAAA;KACxB;IAEO,gBAAgB,CAAE,CAAmB,EAAE,KAAiB,EAAA;AAC9D,QAAA,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;QAEvB,IAAI,MAAM,CAAC,uBAAuB;AAAE,YAAA,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAA0B,CAAC,CAAA;KACxF;IAEO,eAAe,CAAE,CAAmB,EAAE,KAAiB,EAAA;QAC7D,IAAI,CAAC,gBAAgB,EAAE,CAAA;KACxB;;AAxVM,MAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/sankey/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\nimport { sankey, SankeyGraph } from 'd3-sankey'\nimport { extent, max, sum } from 'd3-array'\nimport { scaleLinear } from 'd3-scale'\n\n// Core\nimport { ComponentCore } from 'core/component'\nimport { GraphDataModel } from 'data-models/graph'\n\n// Types\nimport { ExtendedSizeComponent, Sizing } from 'types/component'\nimport { Position } from 'types/position'\nimport { Spacing } from 'types/spacing'\nimport { VerticalAlign } from 'types/text'\n\n// Utils\nimport { smartTransition } from 'utils/d3'\nimport { getNumber, getString, groupBy, isNumber } from 'utils/data'\nimport { getCSSVariableValueInPixels } from 'utils/misc'\n\n// Config\nimport { SankeyDefaultConfig, SankeyConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\n// Local Types\nimport { SankeyInputLink, SankeyInputNode, SankeyLayout, SankeyLink, SankeyNode } from './types'\n\n// Modules\nimport { createLinks, removeLinks, updateLinks } from './modules/link'\nimport { createNodes, onNodeMouseOut, onNodeMouseOver, removeNodes, updateNodes } from './modules/node'\nimport { getLabelOrientation, requiredLabelSpace } from './modules/label'\n\nexport class Sankey<\n N extends SankeyInputNode,\n L extends SankeyInputLink,\n> extends ComponentCore<\n {nodes: N[]; links?: L[]},\n SankeyConfigInterface<N, L>\n > implements ExtendedSizeComponent {\n static selectors = s\n protected _defaultConfig = SankeyDefaultConfig as SankeyConfigInterface<N, L>\n public config: SankeyConfigInterface<N, L> = this._defaultConfig\n datamodel: GraphDataModel<N, L, SankeyNode<N, L>, SankeyLink<N, L>> = new GraphDataModel()\n private _extendedWidth: number | undefined = undefined\n private _extendedHeight: number | undefined = undefined\n private _extendedHeightIncreased: number | undefined = undefined\n private _linksGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _nodesGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _backgroundRect: Selection<SVGRectElement, unknown, SVGGElement, unknown>\n private _sankey = sankey<SankeyGraph<N, L>, SankeyNode<N, L>, SankeyLink<N, L>>()\n private _highlightTimeoutId: ReturnType<typeof setTimeout> | null = null\n private _highlightActive = false\n events = {\n [Sankey.selectors.nodeGroup]: {\n mouseenter: this._onNodeMouseOver.bind(this),\n mouseleave: this._onNodeMouseOut.bind(this),\n },\n [Sankey.selectors.node]: {\n mouseenter: this._onNodeRectMouseOver.bind(this),\n mouseleave: this._onNodeRectMouseOut.bind(this),\n click: this._onNodeClick.bind(this),\n },\n [Sankey.selectors.link]: {\n mouseenter: this._onLinkMouseOver.bind(this),\n mouseleave: this._onLinkMouseOut.bind(this),\n },\n }\n\n constructor (config?: SankeyConfigInterface<N, L>) {\n super()\n if (config) this.setConfig(config)\n this._backgroundRect = this.g.append('rect').attr('class', s.background)\n this._linksGroup = this.g.append('g').attr('class', s.links)\n this._nodesGroup = this.g.append('g').attr('class', s.nodes)\n }\n\n get bleed (): Spacing {\n const { config, datamodel: { nodes, links } } = this\n const labelFontSize = config.labelFontSize ?? getCSSVariableValueInPixels('var(--vis-sankey-label-font-size)', this.element)\n const labelSize = requiredLabelSpace(config.labelMaxWidth, labelFontSize)\n\n let left = 0\n let right = 0\n\n // We pre-calculate sankey layout to get information about node labels placement and calculate bleed properly\n // Potentially it can be a performance bottleneck for large layouts, but generally rendering of such layouts is much more computationally heavy\n if (nodes.length) {\n const sankeyProbeSize = 1000\n this._populateLinkAndNodeValues()\n this._sankey.size([sankeyProbeSize, sankeyProbeSize])\n this._sankey({ nodes, links })\n const maxDepth = max(nodes, d => d.depth)\n const zeroDepthNodes = nodes.filter(d => d.depth === 0)\n const maxDepthNodes = nodes.filter(d => d.depth === maxDepth)\n\n left = zeroDepthNodes.some(d => getLabelOrientation(d, sankeyProbeSize, config.labelPosition) === Position.Left) ? labelSize.width : 0\n right = maxDepthNodes.some(d => getLabelOrientation(d, sankeyProbeSize, config.labelPosition) === Position.Right) ? labelSize.width : 0\n }\n\n const top = config.labelVerticalAlign === VerticalAlign.Top ? 0\n : config.labelVerticalAlign === VerticalAlign.Bottom ? labelSize.height\n : labelSize.height / 2\n\n const bottom = config.labelVerticalAlign === VerticalAlign.Top ? labelSize.height\n : config.labelVerticalAlign === VerticalAlign.Bottom ? 0\n : labelSize.height / 2\n\n return { top, bottom, left, right }\n }\n\n setData (data: { nodes: N[]; links?: L[] }): void {\n super.setData(data)\n\n // Pre-collapse nodes based on disabledField\n this._applyInitialCollapseState()\n\n // Pre-calculate component size for Sizing.EXTEND\n if ((this.sizing !== Sizing.Fit) || !this._hasLinks()) this._preCalculateComponentSize()\n }\n\n setConfig (config: SankeyConfigInterface<N, L>): void {\n super.setConfig(config)\n\n // Apply initial collapse state if disabledField is set\n this._applyInitialCollapseState()\n\n // Pre-calculate component size for Sizing.EXTEND\n if ((this.sizing !== Sizing.Fit) || !this._hasLinks()) this._preCalculateComponentSize()\n\n // Using \"as any\" because typings are not full (\"@types/d3-sankey\": \"^0.11.2\")\n const nodeId = ((d: SankeyInputNode, i: number) => getString(d, this.config.id, i)) as any;\n (this._sankey as any).linkSort(this.config.linkSort)\n this._sankey\n .nodeId(nodeId)\n .nodeWidth(this.config.nodeWidth)\n .nodePadding(this.config.nodePadding)\n .nodeAlign(SankeyLayout[this.config.nodeAlign])\n .nodeSort(this.config.nodeSort)\n .iterations(this.config.iterations)\n }\n\n _render (customDuration?: number): void {\n const { config, bleed, datamodel: { nodes, links } } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n\n if (\n (nodes.length === 0) ||\n (nodes.length === 1 && links.length > 0) ||\n (nodes.length === 1 && !config.showSingleNode) ||\n (nodes.length > 1 && links.length === 0)\n ) {\n this._linksGroup.selectAll<SVGGElement, SankeyLink<N, L>>(`.${s.link}`).call(removeLinks, duration)\n this._nodesGroup.selectAll<SVGGElement, SankeyNode<N, L>>(`.${s.nodeGroup}`).call(removeNodes, config, duration)\n }\n\n // Prepare Layout\n this._prepareLayout()\n\n // Links\n smartTransition(this._linksGroup, duration).attr('transform', `translate(${bleed.left},${bleed.top})`)\n const linkSelection = this._linksGroup.selectAll<SVGGElement, SankeyLink<N, L>>(`.${s.link}`)\n .data(links, (d, i) => config.id(d, i) ?? i)\n const linkSelectionEnter = linkSelection.enter().append('g').attr('class', s.link)\n linkSelectionEnter.call(createLinks)\n linkSelection.merge(linkSelectionEnter).call(updateLinks, config, duration)\n linkSelection.exit<SankeyLink<N, L>>().call(removeLinks)\n\n // Nodes\n smartTransition(this._nodesGroup, duration).attr('transform', `translate(${bleed.left},${bleed.top})`)\n\n const nodeSelection = this._nodesGroup.selectAll<SVGGElement, SankeyNode<N, L>>(`.${s.nodeGroup}`)\n .data(nodes, (d, i) => config.id(d, i) ?? i)\n const nodeSelectionEnter = nodeSelection.enter().append('g').attr('class', s.nodeGroup)\n nodeSelectionEnter.call(createNodes, this.config, this._width, bleed)\n nodeSelection.merge(nodeSelectionEnter).call(updateNodes, config, this._width, bleed, this._hasLinks(), duration)\n nodeSelection.exit<SankeyNode<N, L>>()\n .attr('class', s.nodeExit)\n .call(removeNodes, config, duration)\n\n // Background\n this._backgroundRect\n .attr('width', this.getWidth())\n .attr('height', this.getHeight())\n .attr('opacity', 0)\n }\n\n private _populateLinkAndNodeValues (): void {\n const { config, datamodel } = this\n\n const nodes = datamodel.nodes\n const links = datamodel.links\n\n // For d3-sankey each link must be an object with the `value` property\n links.forEach((link, i) => {\n link.value = getNumber(link, d => getNumber(d, config.linkValue, i))\n })\n\n // Populating node.fixedValue for d3-sankey\n nodes.forEach((node, i) => {\n node.fixedValue = getNumber(node, config.nodeFixedValue, i)\n })\n }\n\n private _preCalculateComponentSize (): void {\n const { bleed, config, datamodel } = this\n const nodes = datamodel.nodes\n\n\n if (nodes.length) {\n this._populateLinkAndNodeValues()\n this._sankey(datamodel)\n }\n\n const scaleExtent = extent(nodes, d => d.value || undefined)\n const scaleRange = [config.nodeMinHeight, config.nodeMaxHeight]\n const scale = scaleLinear().domain(scaleExtent).range(scaleRange).clamp(true)\n nodes.forEach(n => { n._state.precalculatedHeight = scale(n.value) || config.nodeMinHeight })\n\n const groupedByColumn: { [key: string]: SankeyNode<N, L>[] } = groupBy(nodes, d => d.layer)\n const values = Object.values(groupedByColumn)\n .map((group) =>\n sum(group.map(n => n._state.precalculatedHeight + config.nodePadding)) - config.nodePadding\n )\n\n const height = max(values) || config.nodeMinHeight\n this._extendedHeight = height + bleed.top + bleed.bottom\n this._extendedWidth = Math.max(0, (config.nodeWidth + config.nodeHorizontalSpacing) * Object.keys(groupedByColumn).length - config.nodeHorizontalSpacing + bleed.left + bleed.right)\n }\n\n private _prepareLayout (): void {\n const { config, bleed, datamodel } = this\n const isExtendedSize = this.sizing === Sizing.Extend\n const sankeyHeight = this.sizing === Sizing.Fit ? this._height : this._extendedHeight\n const sankeyWidth = this.sizing === Sizing.Fit ? this._width : this._extendedWidth\n this._sankey\n .size([\n Math.max(sankeyWidth - bleed.left - bleed.right, 0),\n Math.max(sankeyHeight - bleed.top - bleed.bottom, 0),\n ])\n\n const nodes = datamodel.nodes\n const links = datamodel.links\n\n // If there are no links we manually calculate the visualization layout\n if (!this._hasLinks()) {\n let y = 0\n const nodesTotalHeight = sum(nodes, n => n._state.precalculatedHeight || 1)\n for (const node of nodes) {\n const sankeyHeight = this.getHeight() - bleed.top - bleed.bottom\n const nodeHeight = node._state.precalculatedHeight || 1\n const h = isExtendedSize ? nodeHeight : (sankeyHeight - config.nodePadding * (nodes.length - 1)) * nodeHeight / nodesTotalHeight\n\n node.width = Math.max(10, config.nodeWidth)\n node.x0 = 0\n node.x1 = node.width\n node.y0 = y\n node.y1 = y + Math.max(1, h)\n node.layer = 0\n\n y = node.y1 + config.nodePadding\n }\n\n this._extendedHeightIncreased = undefined\n return\n }\n\n // Calculate sankey\n this._populateLinkAndNodeValues()\n this._sankey({ nodes, links })\n\n // Setting minimum node height\n // Default: 1px\n // Extended size nodes that have no links: config.nodeMinHeight\n for (const node of nodes) {\n const singleExtendedSize = isExtendedSize && !node.sourceLinks?.length && !node.targetLinks?.length\n const h = Math.max(singleExtendedSize ? config.nodeMinHeight : 1, node.y1 - node.y0)\n const y = (node.y0 + node.y1) / 2\n node.y0 = y - h / 2\n node.y1 = y + h / 2\n }\n\n if (isExtendedSize) {\n const height = max(nodes, d => d.y1)\n this._extendedHeightIncreased = height + bleed.top + bleed.bottom\n }\n }\n\n getWidth (): number {\n return this.sizing === Sizing.Fit ? this._width : (this._extendedWidth || 0)\n }\n\n getHeight (): number {\n return this.sizing === Sizing.Fit ? this._height : Math.max(this._extendedHeightIncreased || 0, this._extendedHeight || 0)\n }\n\n getLayoutWidth (): number {\n return this.sizing === Sizing.Fit ? this._width : this._extendedWidth\n }\n\n getLayoutHeight (): number {\n return this.sizing === Sizing.Fit ? this._height : (this._extendedHeightIncreased || this._extendedHeight)\n }\n\n getColumnCenters (): number[] {\n const { datamodel } = this\n const nodes = datamodel.nodes as SankeyNode<N, L>[]\n const centers = nodes.reduce((pos, node) => {\n const idx = node.layer\n if (!isFinite(pos[idx])) {\n pos[idx] = (node.x0 + node.x1) / 2\n }\n return pos\n }, [])\n\n return centers\n }\n\n highlightSubtree (node: SankeyNode<N, L>): void {\n const { config, datamodel } = this\n\n clearTimeout(this._highlightTimeoutId)\n this._highlightTimeoutId = setTimeout(() => {\n for (const n of datamodel.nodes) n._state.greyout = true\n for (const l of datamodel.links) l._state.greyout = true\n\n this.recursiveSetSubtreeState(node, 'sourceLinks', 'target', 'greyout', false)\n this.recursiveSetSubtreeState(node, 'targetLinks', 'source', 'greyout', false)\n this._render(config.highlightDuration)\n this._highlightActive = true\n }, config.highlightDelay)\n }\n\n recursiveSetSubtreeState (\n node: SankeyNode<N, L>,\n linksKey: 'sourceLinks' | 'targetLinks',\n nodeKey: 'source' | 'target',\n key: string,\n value: unknown\n ): void {\n node._state[key] = value\n\n for (const l of node[linksKey]) {\n l._state[key] = value\n this.recursiveSetSubtreeState(l[nodeKey] as SankeyNode<N, L>, linksKey, nodeKey, key, value)\n }\n }\n\n disableHighlight (): void {\n const { config, datamodel } = this\n\n clearTimeout(this._highlightTimeoutId)\n if (this._highlightActive) {\n this._highlightActive = false\n\n for (const n of datamodel.nodes) n._state.greyout = false\n for (const l of datamodel.links) l._state.greyout = false\n this._render(config.highlightDuration)\n }\n }\n\n /**\n * Collapses a node by hiding only the links directly connected to it.\n * All other nodes (including children and descendants) remain visible in their original positions.\n * Only the immediate incoming and outgoing links of the collapsed node are hidden.\n */\n collapseNode (node: SankeyNode<N, L>): void {\n const { config } = this\n\n // Clear any active highlights before collapsing\n this.disableHighlight()\n\n node._state = node._state || {}\n node._state.collapsed = true\n this._render(config.collapseAnimationDuration)\n }\n\n /**\n * Expands a previously collapsed node by showing its directly connected links.\n */\n expandNode (node: SankeyNode<N, L>): void {\n const { config } = this\n\n // Clear any active highlights before expanding\n this.disableHighlight()\n\n node._state = node._state || {}\n node._state.collapsed = false\n this._render(config.collapseAnimationDuration)\n }\n\n /**\n * Toggles the collapse state of a node.\n *\n * @param node The node to toggle\n */\n toggleNodeCollapse (node: SankeyNode<N, L>): void {\n if (node._state?.collapsed) {\n this.expandNode(node)\n } else {\n this.collapseNode(node)\n }\n }\n\n private _hasLinks (): boolean {\n const { datamodel } = this\n return datamodel.links.length > 0\n }\n\n /**\n * Applies initial collapse state to nodes based on the disabledField configuration.\n * If disabledField is set (e.g., \"disabled\"), nodes with that field set to true\n * will be pre-collapsed when the component loads.\n */\n private _applyInitialCollapseState (): void {\n const { config, datamodel } = this\n\n if (!config.disabledField) return\n\n // Check each node for the disabled field and set initial collapse state\n for (const node of datamodel.nodes) {\n const inputData = node as unknown as N\n const isDisabled = inputData && typeof inputData === 'object' &&\n config.disabledField in inputData &&\n (inputData as any)[config.disabledField] === true\n\n if (isDisabled) {\n node._state = node._state || {}\n node._state.collapsed = true\n }\n }\n }\n\n private _onNodeMouseOver (d: SankeyNode<N, L>, event: MouseEvent): void {\n onNodeMouseOver(d, select(event.currentTarget as SVGGElement), this.config, this._width)\n }\n\n private _onNodeMouseOut (d: SankeyNode<N, L>, event: MouseEvent): void {\n onNodeMouseOut(d, select(event.currentTarget as SVGGElement), this.config, this._width)\n }\n\n private _onNodeRectMouseOver (d: SankeyNode<N, L>): void {\n const { config } = this\n if (config.highlightSubtreeOnHover) this.highlightSubtree(d)\n }\n\n private _onNodeRectMouseOut (d: SankeyNode<N, L>): void {\n this.disableHighlight()\n }\n\n private _onLinkMouseOver (d: SankeyLink<N, L>, event: MouseEvent): void {\n const { config } = this\n\n if (config.highlightSubtreeOnHover) this.highlightSubtree(d.target as SankeyNode<N, L>)\n }\n\n private _onLinkMouseOut (d: SankeyLink<N, L>, event: MouseEvent): void {\n this.disableHighlight()\n }\n\n private _onNodeClick (d: SankeyNode<N, L>, event: MouseEvent): void {\n const { config } = this\n if (config.enableNodeCollapse) {\n this.toggleNodeCollapse(d)\n }\n }\n}\n"],"names":["s.background","s.links","s.nodes","s.link","s.nodeGroup","s.nodeExit","s"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkCM,MAAO,MAGX,SAAQ,aAGP,CAAA;AA8BD,IAAA,WAAA,CAAa,MAAoC,EAAA;AAC/C,QAAA,KAAK,EAAE,CAAA;QA7BC,IAAc,CAAA,cAAA,GAAG,mBAAkD,CAAA;AACtE,QAAA,IAAA,CAAA,MAAM,GAAgC,IAAI,CAAC,cAAc,CAAA;AAChE,QAAA,IAAA,CAAA,SAAS,GAA6D,IAAI,cAAc,EAAE,CAAA;QAClF,IAAc,CAAA,cAAA,GAAuB,SAAS,CAAA;QAC9C,IAAe,CAAA,eAAA,GAAuB,SAAS,CAAA;QAC/C,IAAwB,CAAA,wBAAA,GAAuB,SAAS,CAAA;QAIxD,IAAO,CAAA,OAAA,GAAG,MAAM,EAAyD,CAAA;QACzE,IAAmB,CAAA,mBAAA,GAAyC,IAAI,CAAA;QAChE,IAAgB,CAAA,gBAAA,GAAG,KAAK,CAAA;AAChC,QAAA,IAAA,CAAA,MAAM,GAAG;AACP,YAAA,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,GAAG;gBAC5B,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC5C,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;AAC5C,aAAA;AACD,YAAA,CAAC,MAAM,CAAC,SAAS,CAAC,I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,CAAC,CAAC,CAAA;AAC3B,SAAA;KACF;;AAzaM,MAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
|
|
@@ -42,9 +42,21 @@ function createLinks(sel) {
|
|
|
42
42
|
}
|
|
43
43
|
function updateLinks(sel, config, duration) {
|
|
44
44
|
smartTransition(sel, duration)
|
|
45
|
-
.style('opacity', (d) =>
|
|
45
|
+
.style('opacity', (d) => {
|
|
46
|
+
var _a, _b, _c;
|
|
47
|
+
// Hide links if either connected node is collapsed
|
|
48
|
+
if (((_a = d.source._state) === null || _a === void 0 ? void 0 : _a.collapsed) || ((_b = d.target._state) === null || _b === void 0 ? void 0 : _b.collapsed))
|
|
49
|
+
return 0;
|
|
50
|
+
// Apply greyout effect
|
|
51
|
+
return ((_c = d._state) === null || _c === void 0 ? void 0 : _c.greyout) ? 0.2 : 1;
|
|
52
|
+
});
|
|
46
53
|
const linkSelection = sel.select(`.${linkPath$1}`)
|
|
47
|
-
.style('cursor', (d) => getString(d, config.linkCursor))
|
|
54
|
+
.style('cursor', (d) => getString(d, config.linkCursor))
|
|
55
|
+
.style('pointer-events', (d) => {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
// Disable pointer events for collapsed links to prevent hover interference
|
|
58
|
+
return (((_a = d.source._state) === null || _a === void 0 ? void 0 : _a.collapsed) || ((_b = d.target._state) === null || _b === void 0 ? void 0 : _b.collapsed)) ? 'none' : null;
|
|
59
|
+
});
|
|
48
60
|
const selectionTransition = smartTransition(linkSelection, duration)
|
|
49
61
|
.style('fill', (link) => getColor(link, config.linkColor));
|
|
50
62
|
if (duration) {
|
|
@@ -94,7 +106,8 @@ function updateLinks(sel, config, duration) {
|
|
|
94
106
|
y1: d.y1,
|
|
95
107
|
width: Math.max(10, d.width),
|
|
96
108
|
}))
|
|
97
|
-
.style('cursor', d => getString(d, config.linkCursor))
|
|
109
|
+
.style('cursor', d => getString(d, config.linkCursor))
|
|
110
|
+
.style('pointer-events', (d) => { var _a, _b; return (((_a = d.source._state) === null || _a === void 0 ? void 0 : _a.collapsed) || ((_b = d.target._state) === null || _b === void 0 ? void 0 : _b.collapsed)) ? 'none' : null; });
|
|
98
111
|
}
|
|
99
112
|
function removeLinks(sel) {
|
|
100
113
|
sel.remove();
|