@unovis/ts 1.4.2-alpha.4 → 1.4.2

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.
Files changed (48) hide show
  1. package/components/axis/config.d.ts +2 -0
  2. package/components/axis/config.js.map +1 -1
  3. package/components/axis/index.js +15 -15
  4. package/components/axis/index.js.map +1 -1
  5. package/components/graph/config.d.ts +9 -9
  6. package/components/graph/config.js +2 -2
  7. package/components/graph/config.js.map +1 -1
  8. package/components/graph/index.d.ts +13 -2
  9. package/components/graph/index.js +173 -49
  10. package/components/graph/index.js.map +1 -1
  11. package/components/graph/modules/node/index.d.ts +3 -3
  12. package/components/graph/modules/node/index.js +24 -46
  13. package/components/graph/modules/node/index.js.map +1 -1
  14. package/components/graph/modules/node/style.d.ts +2 -0
  15. package/components/graph/modules/node/style.js +34 -4
  16. package/components/graph/modules/node/style.js.map +1 -1
  17. package/components/graph/style.d.ts +1 -0
  18. package/components/graph/style.js +22 -1
  19. package/components/graph/style.js.map +1 -1
  20. package/components/graph/types.d.ts +1 -0
  21. package/components/graph/types.js.map +1 -1
  22. package/components/tooltip/config.d.ts +0 -4
  23. package/components/tooltip/config.js +0 -2
  24. package/components/tooltip/config.js.map +1 -1
  25. package/components/tooltip/index.d.ts +0 -5
  26. package/components/tooltip/index.js +5 -61
  27. package/components/tooltip/index.js.map +1 -1
  28. package/components/tooltip/style.js +8 -6
  29. package/components/tooltip/style.js.map +1 -1
  30. package/containers/single-container/index.js +1 -0
  31. package/containers/single-container/index.js.map +1 -1
  32. package/containers/xy-container/index.js +1 -0
  33. package/containers/xy-container/index.js.map +1 -1
  34. package/core/container/index.d.ts +1 -0
  35. package/core/container/index.js +5 -4
  36. package/core/container/index.js.map +1 -1
  37. package/data-models/graph.d.ts +2 -0
  38. package/data-models/graph.js +6 -0
  39. package/data-models/graph.js.map +1 -1
  40. package/index.d.ts +0 -2
  41. package/index.js +0 -2
  42. package/index.js.map +1 -1
  43. package/package.json +1 -1
  44. package/types/text.d.ts +2 -0
  45. package/types/text.js.map +1 -1
  46. package/utils/text.d.ts +1 -1
  47. package/utils/text.js +27 -15
  48. package/utils/text.js.map +1 -1
@@ -47,6 +47,8 @@ export interface AxisConfigInterface<Datum> extends Partial<XYComponentConfigInt
47
47
  tickTextAlign?: TextAlign | string;
48
48
  /** Font color of the tick text as CSS string. Default: `null` */
49
49
  tickTextColor?: string | null;
50
+ /** Text rotation angle for ticks. Default: `undefined` */
51
+ tickTextAngle?: number;
50
52
  /** The spacing in pixels between the tick and it's label. Default: `8` */
51
53
  tickPadding?: number;
52
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../../src/components/axis/config.ts"],"sourcesContent":["import { XYComponentConfigInterface, XYComponentDefaultConfig } from 'core/xy-component/config'\n\n// Types\nimport { AxisType } from 'components/axis/types'\nimport { Position } from 'types/position'\nimport { FitMode, TrimMode, TextAlign } from 'types/text'\n\n// We extend partial XY config interface because x and y properties are optional for Axis\nexport interface AxisConfigInterface<Datum> extends Partial<XYComponentConfigInterface<Datum>> {\n /** Axis position: `Position.Top`, `Position.Bottom`, `Position.Right` or `Position.Left`. Default: `undefined` */\n position?: Position | string;\n /** Axis type: `AxisType.X` or `AxisType.Y` */\n type?: AxisType | string;\n /** Extend the axis domain line to be full width or full height. Default: `true` */\n fullSize?: boolean;\n /** Axis label. Default: `undefined` */\n label?: string;\n /** Font size of the axis label as CSS string. Default: `null` */\n labelFontSize?: string | null;\n /** Distance between the axis and the label in pixels. Default: `8` */\n labelMargin?: number;\n /** Font color of the axis label as CSS string. Default: `null` */\n labelColor?: string | null;\n /** Sets whether to draw the grid lines or not. Default: `true` */\n gridLine?: boolean;\n /** Sets whether to draw the tick lines or not. Default: `true` */\n tickLine?: boolean;\n /** Sets whether to draw the domain line or not. Default: `true` */\n domainLine?: boolean;\n /** Draw the min and max axis ticks only. Default: `false` */\n minMaxTicksOnly?: boolean;\n /** Tick label formatter function. Default: `undefined` */\n tickFormat?: ((tick: number | Date, i: number, ticks: number[] | Date[]) => string);\n /** Explicitly set tick values. Default: `undefined` */\n tickValues?: number[];\n /** Set the approximate number of axis ticks (will be passed to D3's axis constructor). Default: `undefined` */\n numTicks?: number;\n /** Tick text fit mode: `FitMode.Wrap` or `FitMode.Trim`. Default: `FitMode.Wrap`. */\n tickTextFitMode?: FitMode | string;\n /** Maximum width in pixels for the tick text to be wrapped or trimmed. Default: `undefined` */\n tickTextWidth?: number;\n /** Tick text wrapping separator. String or array of strings. Default: `undefined` */\n tickTextSeparator?: string | string[];\n /** Force word break for ticks when they don't fit. Default: `false` */\n tickTextForceWordBreak?: boolean;\n /** Tick text trim mode: `TrimMode.Start`, `TrimMode.Middle` or `TrimMode.End`. Default: `TrimMode.Middle` */\n tickTextTrimType?: TrimMode | string;\n /** Font size of the tick text as CSS string. Default: `null` */\n tickTextFontSize?: string | null;\n /** Text alignment for ticks: `TextAlign.Left`, `TextAlign.Center` or `TextAlign.Right`. Default: `undefined` */\n tickTextAlign?: TextAlign | string;\n /** Font color of the tick text as CSS string. Default: `null` */\n tickTextColor?: string | null;\n /** The spacing in pixels between the tick and it's label. Default: `8` */\n tickPadding?: number;\n}\n\nexport const AxisDefaultConfig: AxisConfigInterface<unknown> = {\n ...XYComponentDefaultConfig,\n position: undefined,\n type: undefined,\n label: undefined,\n labelFontSize: null,\n gridLine: true,\n tickLine: true,\n domainLine: true,\n numTicks: undefined,\n minMaxTicksOnly: false,\n tickTextWidth: undefined,\n tickTextSeparator: undefined,\n tickTextForceWordBreak: false,\n tickTextTrimType: TrimMode.Middle,\n tickTextFitMode: FitMode.Wrap,\n tickTextFontSize: null,\n tickTextAlign: undefined,\n tickTextColor: null,\n labelMargin: 8,\n labelColor: null,\n tickFormat: undefined,\n tickValues: undefined,\n fullSize: true,\n tickPadding: 8,\n}\n"],"names":[],"mappings":";;;MAyDa,iBAAiB,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACzB,wBAAwB,CAC3B,EAAA,EAAA,QAAQ,EAAE,SAAS,EACnB,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,IAAI,EACnB,QAAQ,EAAE,IAAI,EACd,QAAQ,EAAE,IAAI,EACd,UAAU,EAAE,IAAI,EAChB,QAAQ,EAAE,SAAS,EACnB,eAAe,EAAE,KAAK,EACtB,aAAa,EAAE,SAAS,EACxB,iBAAiB,EAAE,SAAS,EAC5B,sBAAsB,EAAE,KAAK,EAC7B,gBAAgB,EAAE,QAAQ,CAAC,MAAM,EACjC,eAAe,EAAE,OAAO,CAAC,IAAI,EAC7B,gBAAgB,EAAE,IAAI,EACtB,aAAa,EAAE,SAAS,EACxB,aAAa,EAAE,IAAI,EACnB,WAAW,EAAE,CAAC,EACd,UAAU,EAAE,IAAI,EAChB,UAAU,EAAE,SAAS,EACrB,UAAU,EAAE,SAAS,EACrB,QAAQ,EAAE,IAAI,EACd,WAAW,EAAE,CAAC,EAAA;;;;"}
1
+ {"version":3,"file":"config.js","sources":["../../../src/components/axis/config.ts"],"sourcesContent":["import { XYComponentConfigInterface, XYComponentDefaultConfig } from 'core/xy-component/config'\n\n// Types\nimport { AxisType } from 'components/axis/types'\nimport { Position } from 'types/position'\nimport { FitMode, TrimMode, TextAlign } from 'types/text'\n\n// We extend partial XY config interface because x and y properties are optional for Axis\nexport interface AxisConfigInterface<Datum> extends Partial<XYComponentConfigInterface<Datum>> {\n /** Axis position: `Position.Top`, `Position.Bottom`, `Position.Right` or `Position.Left`. Default: `undefined` */\n position?: Position | string;\n /** Axis type: `AxisType.X` or `AxisType.Y` */\n type?: AxisType | string;\n /** Extend the axis domain line to be full width or full height. Default: `true` */\n fullSize?: boolean;\n /** Axis label. Default: `undefined` */\n label?: string;\n /** Font size of the axis label as CSS string. Default: `null` */\n labelFontSize?: string | null;\n /** Distance between the axis and the label in pixels. Default: `8` */\n labelMargin?: number;\n /** Font color of the axis label as CSS string. Default: `null` */\n labelColor?: string | null;\n /** Sets whether to draw the grid lines or not. Default: `true` */\n gridLine?: boolean;\n /** Sets whether to draw the tick lines or not. Default: `true` */\n tickLine?: boolean;\n /** Sets whether to draw the domain line or not. Default: `true` */\n domainLine?: boolean;\n /** Draw the min and max axis ticks only. Default: `false` */\n minMaxTicksOnly?: boolean;\n /** Tick label formatter function. Default: `undefined` */\n tickFormat?: ((tick: number | Date, i: number, ticks: number[] | Date[]) => string);\n /** Explicitly set tick values. Default: `undefined` */\n tickValues?: number[];\n /** Set the approximate number of axis ticks (will be passed to D3's axis constructor). Default: `undefined` */\n numTicks?: number;\n /** Tick text fit mode: `FitMode.Wrap` or `FitMode.Trim`. Default: `FitMode.Wrap`. */\n tickTextFitMode?: FitMode | string;\n /** Maximum width in pixels for the tick text to be wrapped or trimmed. Default: `undefined` */\n tickTextWidth?: number;\n /** Tick text wrapping separator. String or array of strings. Default: `undefined` */\n tickTextSeparator?: string | string[];\n /** Force word break for ticks when they don't fit. Default: `false` */\n tickTextForceWordBreak?: boolean;\n /** Tick text trim mode: `TrimMode.Start`, `TrimMode.Middle` or `TrimMode.End`. Default: `TrimMode.Middle` */\n tickTextTrimType?: TrimMode | string;\n /** Font size of the tick text as CSS string. Default: `null` */\n tickTextFontSize?: string | null;\n /** Text alignment for ticks: `TextAlign.Left`, `TextAlign.Center` or `TextAlign.Right`. Default: `undefined` */\n tickTextAlign?: TextAlign | string;\n /** Font color of the tick text as CSS string. Default: `null` */\n tickTextColor?: string | null;\n /** Text rotation angle for ticks. Default: `undefined` */\n tickTextAngle?: number;\n /** The spacing in pixels between the tick and it's label. Default: `8` */\n tickPadding?: number;\n}\n\nexport const AxisDefaultConfig: AxisConfigInterface<unknown> = {\n ...XYComponentDefaultConfig,\n position: undefined,\n type: undefined,\n label: undefined,\n labelFontSize: null,\n gridLine: true,\n tickLine: true,\n domainLine: true,\n numTicks: undefined,\n minMaxTicksOnly: false,\n tickTextWidth: undefined,\n tickTextSeparator: undefined,\n tickTextForceWordBreak: false,\n tickTextTrimType: TrimMode.Middle,\n tickTextFitMode: FitMode.Wrap,\n tickTextFontSize: null,\n tickTextAlign: undefined,\n tickTextColor: null,\n labelMargin: 8,\n labelColor: null,\n tickFormat: undefined,\n tickValues: undefined,\n fullSize: true,\n tickPadding: 8,\n}\n"],"names":[],"mappings":";;;MA2Da,iBAAiB,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACzB,wBAAwB,CAC3B,EAAA,EAAA,QAAQ,EAAE,SAAS,EACnB,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,IAAI,EACnB,QAAQ,EAAE,IAAI,EACd,QAAQ,EAAE,IAAI,EACd,UAAU,EAAE,IAAI,EAChB,QAAQ,EAAE,SAAS,EACnB,eAAe,EAAE,KAAK,EACtB,aAAa,EAAE,SAAS,EACxB,iBAAiB,EAAE,SAAS,EAC5B,sBAAsB,EAAE,KAAK,EAC7B,gBAAgB,EAAE,QAAQ,CAAC,MAAM,EACjC,eAAe,EAAE,OAAO,CAAC,IAAI,EAC7B,gBAAgB,EAAE,IAAI,EACtB,aAAa,EAAE,SAAS,EACxB,aAAa,EAAE,IAAI,EACnB,WAAW,EAAE,CAAC,EACd,UAAU,EAAE,IAAI,EAChB,UAAU,EAAE,SAAS,EACrB,UAAU,EAAE,SAAS,EACrB,QAAQ,EAAE,IAAI,EACd,WAAW,EAAE,CAAC,EAAA;;;;"}
@@ -3,7 +3,7 @@ import { interrupt } from 'd3-transition';
3
3
  import { axisLeft, axisRight, axisBottom, axisTop } from 'd3-axis';
4
4
  import { XYComponentCore } from '../../core/xy-component/index.js';
5
5
  import { Position } from '../../types/position.js';
6
- import { FitMode, VerticalAlign, TextAlign } from '../../types/text.js';
6
+ import { VerticalAlign, FitMode, TextAlign } from '../../types/text.js';
7
7
  import { smartTransition } from '../../utils/d3.js';
8
8
  import { trimSVGText, renderTextToSvgTextElement } from '../../utils/text.js';
9
9
  import { isEqual } from '../../utils/data.js';
@@ -174,26 +174,26 @@ class Axis extends XYComponentCore {
174
174
  tickText.nodes().forEach(node => interrupt(node));
175
175
  tickText.each((value, i, elements) => {
176
176
  var _a, _b;
177
- const text = (_b = (_a = config.tickFormat) === null || _a === void 0 ? void 0 : _a.call(config, value, i, tickValues)) !== null && _b !== void 0 ? _b : `${value}`;
177
+ let text = (_b = (_a = config.tickFormat) === null || _a === void 0 ? void 0 : _a.call(config, value, i, tickValues)) !== null && _b !== void 0 ? _b : `${value}`;
178
178
  const textElement = elements[i];
179
179
  const textMaxWidth = config.tickTextWidth || (config.type === AxisType.X ? this._containerWidth / (ticks.size() + 1) : this._containerWidth / 5);
180
180
  const styleDeclaration = getComputedStyle(textElement);
181
181
  const fontSize = Number.parseFloat(styleDeclaration.fontSize);
182
182
  const fontFamily = styleDeclaration.fontFamily;
183
+ const textOptions = {
184
+ verticalAlign: config.type === AxisType.X ? VerticalAlign.Top : VerticalAlign.Middle,
185
+ width: textMaxWidth,
186
+ textRotationAngle: config.tickTextAngle,
187
+ separator: config.tickTextSeparator,
188
+ wordBreak: config.tickTextForceWordBreak,
189
+ };
183
190
  if (config.tickTextFitMode === FitMode.Trim) {
184
191
  const textElementSelection = select(textElement).text(text);
185
192
  trimSVGText(textElementSelection, textMaxWidth, config.tickTextTrimType, true, fontSize, 0.58);
193
+ text = select(textElement).text();
186
194
  }
187
- else {
188
- const textBlock = { text, fontFamily, fontSize };
189
- const textOptions = {
190
- verticalAlign: config.type === AxisType.X ? VerticalAlign.Top : VerticalAlign.Middle,
191
- width: textMaxWidth,
192
- separator: config.tickTextSeparator,
193
- wordBreak: config.tickTextForceWordBreak,
194
- };
195
- renderTextToSvgTextElement(textElement, textBlock, textOptions);
196
- }
195
+ const textBlock = { text, fontFamily, fontSize };
196
+ renderTextToSvgTextElement(textElement, textBlock, textOptions);
197
197
  });
198
198
  selection
199
199
  .classed(axis, true)
@@ -282,15 +282,15 @@ class Axis extends XYComponentCore {
282
282
  }
283
283
  }
284
284
  _alignTickLabels() {
285
- const { config: { type, tickTextAlign, position } } = this;
285
+ const { config: { type, tickTextAlign, tickTextAngle, position } } = this;
286
286
  const tickText = this.g.selectAll('g.tick > text');
287
287
  const textAnchor = this._getTickTextAnchor(tickTextAlign);
288
288
  const translateX = type === AxisType.X
289
289
  ? 0
290
290
  : this._getYTickTextTranslate(tickTextAlign, position);
291
291
  tickText
292
- .attr('text-anchor', textAnchor)
293
- .attr('transform', `translate(${translateX},0)`);
292
+ .attr('transform', `translate(${translateX},0) rotate(${tickTextAngle})`)
293
+ .attr('text-anchor', textAnchor);
294
294
  }
295
295
  _getTickTextAnchor(textAlign) {
296
296
  switch (textAlign) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/axis/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\nimport { interrupt } from 'd3-transition'\nimport { Axis as D3Axis, axisBottom, axisLeft, axisRight, axisTop } from 'd3-axis'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\n\n// Types\nimport { Position } from 'types/position'\nimport { ContinuousScale } from 'types/scale'\nimport { Spacing } from 'types/spacing'\nimport { FitMode, TextAlign, TrimMode, UnovisText, UnovisTextOptions, VerticalAlign } from 'types/text'\n\n// Utils\nimport { smartTransition } from 'utils/d3'\nimport { renderTextToSvgTextElement, trimSVGText } from 'utils/text'\nimport { isEqual } from 'utils/data'\n\n// Local Types\nimport { AxisType } from './types'\n\n// Config\nimport { AxisDefaultConfig, AxisConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\nexport class Axis<Datum> extends XYComponentCore<Datum, AxisConfigInterface<Datum>> {\n static selectors = s\n protected _defaultConfig: AxisConfigInterface<Datum> = AxisDefaultConfig\n public config: AxisConfigInterface<Datum> = this._defaultConfig\n axisGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n gridGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n\n private _axisRawBBox: DOMRect\n private _axisSizeBBox: SVGRect\n private _requiredMargin: Spacing\n private _defaultNumTicks = 3\n private _minMaxTicksOnlyEnforceWidth = 250\n\n events = {}\n\n constructor (config?: AxisConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n\n this.axisGroup = this.g.append('g')\n this.gridGroup = this.g.append('g')\n .attr('class', s.grid)\n }\n\n /** Renders axis to an invisible grouped to calculate automatic chart margins */\n preRender (): void {\n const { config } = this\n const axisRenderHelperGroup = this.g.append('g').attr('opacity', 0)\n\n this._renderAxis(axisRenderHelperGroup, 0)\n\n // Store axis raw BBox (without the label) for further label positioning (see _renderAxisLabel)\n this._axisRawBBox = axisRenderHelperGroup.node().getBBox()\n\n // Align tick text\n if (config.tickTextAlign) this._alignTickLabels()\n\n // Render label and store total axis size and required margins\n this._renderAxisLabel(axisRenderHelperGroup)\n this._axisSizeBBox = this._getAxisSize(axisRenderHelperGroup)\n this._requiredMargin = this._getRequiredMargin(this._axisSizeBBox)\n\n axisRenderHelperGroup.remove()\n }\n\n getPosition (): Position {\n const { config: { type, position } } = this\n return (position ?? ((type === AxisType.X) ? Position.Bottom : Position.Left)) as Position\n }\n\n _getAxisSize (selection: Selection<SVGGElement, unknown, SVGGElement, undefined>): SVGRect {\n const bBox = selection.node().getBBox()\n return bBox\n }\n\n _getRequiredMargin (axisSize = this._axisSizeBBox): Spacing {\n const { config: { type, position } } = this\n\n switch (type) {\n case AxisType.X: {\n const tolerancePx = 1\n const xEnd = this._axisSizeBBox.x + this._axisSizeBBox.width\n\n const left = this._axisSizeBBox.x < 0 ? Math.abs(this._axisSizeBBox.x) : 0\n const right = (xEnd - this._width) > tolerancePx ? xEnd - this._width : 0\n\n switch (position) {\n case Position.Top: return { top: axisSize.height, left, right }\n case Position.Bottom: default: return { bottom: axisSize.height, left, right }\n }\n }\n case AxisType.Y: {\n const bleedY = axisSize.height > this._height ? (axisSize.height - this._height) / 2 : 0\n const top = bleedY\n const bottom = bleedY\n\n switch (position) {\n case Position.Right: return { right: axisSize.width, top, bottom }\n case Position.Left: default: return { left: axisSize.width, top, bottom }\n }\n }\n }\n }\n\n getRequiredMargin (): Spacing {\n return this._requiredMargin\n }\n\n /** Calculates axis transform:translate offset based on passed container margins */\n getOffset (containerMargin: Spacing): {left: number; top: number} {\n const { config: { type, position } } = this\n\n switch (type) {\n case AxisType.X:\n switch (position) {\n case Position.Top: return { top: containerMargin.top, left: containerMargin.left }\n case Position.Bottom: default: return { top: containerMargin.top + this._height, left: containerMargin.left }\n }\n case AxisType.Y:\n switch (position) {\n case Position.Right: return { top: containerMargin.top, left: containerMargin.left + this._width }\n case Position.Left: default: return { top: containerMargin.top, left: containerMargin.left }\n }\n }\n }\n\n _render (duration = this.config.duration, selection = this.axisGroup): void {\n const { config } = this\n\n this._renderAxis(selection, duration)\n this._renderAxisLabel(selection)\n\n if (config.gridLine) {\n const gridGen = this._buildGrid().tickFormat(() => '')\n gridGen.tickValues(this._getConfiguredTickValues())\n // Interrupting all active transitions first to prevent them from being stuck.\n // Somehow we see it happening in Angular apps.\n this.gridGroup.selectAll('*').interrupt()\n smartTransition(this.gridGroup, duration).call(gridGen).style('opacity', 1)\n } else {\n smartTransition(this.gridGroup, duration).style('opacity', 0)\n }\n\n if (config.tickTextAlign) this._alignTickLabels()\n }\n\n _buildAxis (): D3Axis<any> {\n const { config: { type, position, tickPadding } } = this\n\n const ticks = this._getNumTicks()\n switch (type) {\n case AxisType.X:\n switch (position) {\n case Position.Top: return axisTop(this.xScale).ticks(ticks).tickPadding(tickPadding)\n case Position.Bottom: default: return axisBottom(this.xScale).ticks(ticks).tickPadding(tickPadding)\n }\n case AxisType.Y:\n switch (position) {\n case Position.Right: return axisRight(this.yScale).ticks(ticks).tickPadding(tickPadding)\n case Position.Left: default: return axisLeft(this.yScale).ticks(ticks).tickPadding(tickPadding)\n }\n }\n }\n\n _buildGrid (): D3Axis<any> {\n const { config: { type, position } } = this\n\n const ticks = this._getNumTicks()\n switch (type) {\n case AxisType.X:\n switch (position) {\n case Position.Top: return axisTop(this.xScale).ticks(ticks * 2).tickSize(-this._height).tickSizeOuter(0)\n case Position.Bottom: default: return axisBottom(this.xScale).ticks(ticks * 2).tickSize(-this._height).tickSizeOuter(0)\n }\n case AxisType.Y:\n switch (position) {\n case Position.Right: return axisRight(this.yScale).ticks(ticks * 2).tickSize(-this._width).tickSizeOuter(0)\n case Position.Left: default: return axisLeft(this.yScale).ticks(ticks * 2).tickSize(-this._width).tickSizeOuter(0)\n }\n }\n }\n\n _renderAxis (selection = this.axisGroup, duration = this.config.duration): void {\n const { config } = this\n\n const axisGen = this._buildAxis()\n const tickValues: (number[] | Date[]) = this._getConfiguredTickValues() || axisGen.scale<ContinuousScale>().ticks(this._getNumTicks())\n axisGen.tickValues(tickValues)\n\n // Interrupting all active transitions first to prevent them from being stuck.\n // Somehow we see it happening in Angular apps.\n selection.selectAll('*').interrupt()\n smartTransition(selection, duration).call(axisGen)\n\n const ticks = selection.selectAll<SVGGElement, number | Date>('g.tick')\n\n ticks\n .classed(s.tick, true)\n .style('font-size', config.tickTextFontSize)\n\n // Selecting the <text> elements of the ticks to apply formatting. By default, this selection\n // will include exiting elements, so we're filtering them out.\n const tickText = selection.selectAll<SVGTextElement, number | Date>('g.tick > text')\n .filter(tickValue => tickValues.some((t: number | Date) => isEqual(tickValue, t))) // We use isEqual to compare Dates\n .classed(s.tickLabel, true)\n .style('fill', config.tickTextColor) as Selection<SVGTextElement, number, SVGGElement, unknown> | Selection<SVGTextElement, Date, SVGGElement, unknown>\n\n\n // We interrupt the transition on tick's <text> to make it 'wrappable'\n tickText.nodes().forEach(node => interrupt(node))\n\n tickText.each((value: number | Date, i: number, elements: ArrayLike<SVGTextElement>) => {\n const text = config.tickFormat?.(value, i, tickValues) ?? `${value}`\n const textElement = elements[i] as SVGTextElement\n const textMaxWidth = config.tickTextWidth || (config.type === AxisType.X ? this._containerWidth / (ticks.size() + 1) : this._containerWidth / 5)\n const styleDeclaration = getComputedStyle(textElement)\n const fontSize = Number.parseFloat(styleDeclaration.fontSize)\n const fontFamily = styleDeclaration.fontFamily\n\n if (config.tickTextFitMode === FitMode.Trim) {\n const textElementSelection = select<SVGTextElement, string>(textElement).text(text)\n trimSVGText(textElementSelection, textMaxWidth, config.tickTextTrimType as TrimMode, true, fontSize, 0.58)\n } else {\n const textBlock: UnovisText = { text, fontFamily, fontSize }\n const textOptions: UnovisTextOptions = {\n verticalAlign: config.type === AxisType.X ? VerticalAlign.Top : VerticalAlign.Middle,\n width: textMaxWidth,\n separator: config.tickTextSeparator,\n wordBreak: config.tickTextForceWordBreak,\n }\n renderTextToSvgTextElement(textElement, textBlock, textOptions)\n }\n })\n\n selection\n .classed(s.axis, true)\n .classed(s.hideTickLine, !config.tickLine)\n .classed(s.hideDomain, !config.domainLine)\n\n if (config.fullSize) {\n const path = this._getFullDomainPath(0)\n smartTransition(selection.select('.domain'), duration).attr('d', path)\n }\n }\n\n _getNumTicks (): number {\n const { config: { type, numTicks } } = this\n\n if (numTicks) return numTicks\n\n if (type === AxisType.X) {\n const xRange = this.xScale.range() as [number, number]\n const width = xRange[1] - xRange[0]\n return Math.floor(width / 175)\n }\n\n if (type === AxisType.Y) {\n const yRange = this.yScale.range() as [number, number]\n const height = Math.abs(yRange[0] - yRange[1])\n return Math.pow(height, 0.85) / 25\n }\n\n return this._defaultNumTicks\n }\n\n _getConfiguredTickValues (): number[] | null {\n const { config: { tickValues, type, minMaxTicksOnly } } = this\n const scale = type === AxisType.X ? this.xScale : this.yScale\n const scaleDomain = scale?.domain() as [number, number]\n\n if (tickValues) {\n return tickValues.filter(v => (v >= scaleDomain[0]) && (v <= scaleDomain[1]))\n }\n\n if (minMaxTicksOnly || (type === AxisType.X && this._width < this._minMaxTicksOnlyEnforceWidth)) {\n return scaleDomain as number[]\n }\n\n return null\n }\n\n _getFullDomainPath (tickSize = 0): string {\n const { config: { type } } = this\n switch (type) {\n case AxisType.X: return `M0.5, ${tickSize} V0.5 H${this._width + 0.5} V${tickSize}`\n case AxisType.Y: return `M${-tickSize}, ${this._height + 0.5} H0.5 V0.5 H${-tickSize}`\n }\n }\n\n _renderAxisLabel (selection = this.axisGroup): void {\n const { type, label, labelMargin, labelFontSize } = this.config\n\n // Remove the old label first to calculate the axis size properly\n selection.selectAll(`.${s.label}`).remove()\n\n // Calculate label position and rotation\n const axisPosition = this.getPosition()\n // We always use this.axisRenderHelperGroup to calculate the size of the axis because\n // this.axisGroup will give us incorrect values due to animation\n const { width: axisWidth, height: axisHeight } = this._axisRawBBox ?? selection.node().getBBox()\n\n const offsetX = type === AxisType.X ? this._width / 2 : (-1) ** (+(axisPosition === Position.Left)) * axisWidth\n const offsetY = type === AxisType.X ? (-1) ** (+(axisPosition === Position.Top)) * axisHeight : this._height / 2\n\n const marginX = type === AxisType.X ? 0 : (-1) ** (+(axisPosition === Position.Left)) * labelMargin\n const marginY = type === AxisType.X ? (-1) ** (+(axisPosition === Position.Top)) * labelMargin : 0\n\n const rotation = type === AxisType.Y ? -90 : 0\n\n // Append new label\n selection\n .append('text')\n .attr('class', s.label)\n .text(label)\n .attr('dy', `${this._getLabelDY()}em`)\n .attr('transform', `translate(${offsetX + marginX},${offsetY + marginY}) rotate(${rotation})`)\n .style('font-size', labelFontSize)\n .style('fill', this.config.labelColor)\n }\n\n _getLabelDY (): number {\n const { type, position } = this.config\n switch (type) {\n case AxisType.X:\n switch (position) {\n case Position.Top: return 0\n case Position.Bottom: default: return 0.75\n }\n case AxisType.Y:\n switch (position) {\n case Position.Right: return 0.75\n case Position.Left: default: return -0.25\n }\n }\n }\n\n _alignTickLabels (): void {\n const { config: { type, tickTextAlign, position } } = this\n\n const tickText = this.g.selectAll('g.tick > text')\n const textAnchor = this._getTickTextAnchor(tickTextAlign as TextAlign)\n const translateX = type === AxisType.X\n ? 0\n : this._getYTickTextTranslate(tickTextAlign as TextAlign, position as Position)\n\n tickText\n .attr('text-anchor', textAnchor)\n .attr('transform', `translate(${translateX},0)`)\n }\n\n _getTickTextAnchor (textAlign: TextAlign): string {\n switch (textAlign) {\n case TextAlign.Left: return 'start'\n case TextAlign.Right: return 'end'\n case TextAlign.Center: return 'middle'\n default: return null\n }\n }\n\n _getYTickTextTranslate (textAlign: TextAlign, axisPosition: Position = Position.Left): number {\n const defaultTickTextSpacingPx = 9 // Default in D3\n const width = this._axisRawBBox.width - defaultTickTextSpacingPx\n\n switch (textAlign) {\n case TextAlign.Left: return axisPosition === Position.Left ? width * -1 : 0\n case TextAlign.Right: return axisPosition === Position.Left ? 0 : width\n case TextAlign.Center: return axisPosition === Position.Left ? width * (-0.5) : width * 0.5\n default: return 0\n }\n }\n}\n"],"names":["s.grid","s.tick","s.tickLabel","s.axis","s.hideTickLine","s.hideDomain","label","s.label","s"],"mappings":";;;;;;;;;;;;;;AA2BM,MAAO,IAAY,SAAQ,eAAkD,CAAA;AAejF,IAAA,WAAA,CAAa,MAAmC,EAAA;AAC9C,QAAA,KAAK,EAAE,CAAA;QAdC,IAAc,CAAA,cAAA,GAA+B,iBAAiB,CAAA;AACjE,QAAA,IAAA,CAAA,MAAM,GAA+B,IAAI,CAAC,cAAc,CAAA;QAOvD,IAAgB,CAAA,gBAAA,GAAG,CAAC,CAAA;QACpB,IAA4B,CAAA,4BAAA,GAAG,GAAG,CAAA;QAE1C,IAAM,CAAA,MAAA,GAAG,EAAE,CAAA;AAIT,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QAElC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACnC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;AAChC,aAAA,IAAI,CAAC,OAAO,EAAEA,IAAM,CAAC,CAAA;KACzB;;IAGD,SAAS,GAAA;AACP,QAAA,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;AACvB,QAAA,MAAM,qBAAqB,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,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KACnD;AAED,IAAA,kBAAkB,CAAE,SAAoB,EAAA;AACtC,QAAA,QAAQ,SAAS;AACf,YAAA,KAAK,SAAS,CAAC,IAAI,EAAE,OAAO,OAAO,CAAA;AACnC,YAAA,KAAK,SAAS,CAAC,KAAK,EAAE,OAAO,KAAK,CAAA;AAClC,YAAA,KAAK,SAAS,CAAC,MAAM,EAAE,OAAO,QAAQ,CAAA;AACtC,YAAA,SAAS,OAAO,IAAI,CAAA;AACrB,SAAA;KACF;AAED,IAAA,sBAAsB,CAAE,SAAoB,EAAE,YAAyB,GAAA,QAAQ,CAAC,IAAI,EAAA;AAClF,QAAA,MAAM,wBAAwB,GAAG,CAAC,CAAA;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,GAAG,wBAAwB,CAAA;AAEhE,QAAA,QAAQ,SAAS;YACf,KAAK,SAAS,CAAC,IAAI,EAAE,OAAO,YAAY,KAAK,QAAQ,CAAC,IAAI,GAAG,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;AAC3E,YAAA,KAAK,SAAS,CAAC,KAAK,EAAE,OAAO,YAAY,KAAK,QAAQ,CAAC,IAAI,GAAG,CAAC,GAAG,KAAK,CAAA;YACvE,KAAK,SAAS,CAAC,MAAM,EAAE,OAAO,YAAY,KAAK,QAAQ,CAAC,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,GAAG,CAAA;AAC3F,YAAA,SAAS,OAAO,CAAC,CAAA;AAClB,SAAA;KACF;;AA5VM,IAAS,CAAA,SAAA,GAAGE,KAAC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/axis/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\nimport { interrupt } from 'd3-transition'\nimport { Axis as D3Axis, axisBottom, axisLeft, axisRight, axisTop } from 'd3-axis'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\n\n// Types\nimport { Position } from 'types/position'\nimport { ContinuousScale } from 'types/scale'\nimport { Spacing } from 'types/spacing'\nimport { FitMode, TextAlign, TrimMode, UnovisText, UnovisTextOptions, VerticalAlign } from 'types/text'\n\n// Utils\nimport { smartTransition } from 'utils/d3'\nimport { renderTextToSvgTextElement, trimSVGText } from 'utils/text'\nimport { isEqual } from 'utils/data'\n\n// Local Types\nimport { AxisType } from './types'\n\n// Config\nimport { AxisDefaultConfig, AxisConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\nexport class Axis<Datum> extends XYComponentCore<Datum, AxisConfigInterface<Datum>> {\n static selectors = s\n protected _defaultConfig: AxisConfigInterface<Datum> = AxisDefaultConfig\n public config: AxisConfigInterface<Datum> = this._defaultConfig\n axisGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n gridGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n\n private _axisRawBBox: DOMRect\n private _axisSizeBBox: SVGRect\n private _requiredMargin: Spacing\n private _defaultNumTicks = 3\n private _minMaxTicksOnlyEnforceWidth = 250\n\n events = {}\n\n constructor (config?: AxisConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n this.axisGroup = this.g.append('g')\n this.gridGroup = this.g.append('g')\n .attr('class', s.grid)\n }\n\n /** Renders axis to an invisible grouped to calculate automatic chart margins */\n preRender (): void {\n const { config } = this\n const axisRenderHelperGroup = this.g.append('g').attr('opacity', 0)\n\n this._renderAxis(axisRenderHelperGroup, 0)\n\n // Store axis raw BBox (without the label) for further label positioning (see _renderAxisLabel)\n this._axisRawBBox = axisRenderHelperGroup.node().getBBox()\n\n // Align tick text\n if (config.tickTextAlign) this._alignTickLabels()\n\n // Render label and store total axis size and required margins\n this._renderAxisLabel(axisRenderHelperGroup)\n this._axisSizeBBox = this._getAxisSize(axisRenderHelperGroup)\n this._requiredMargin = this._getRequiredMargin(this._axisSizeBBox)\n\n axisRenderHelperGroup.remove()\n }\n\n getPosition (): Position {\n const { config: { type, position } } = this\n return (position ?? ((type === AxisType.X) ? Position.Bottom : Position.Left)) as Position\n }\n\n _getAxisSize (selection: Selection<SVGGElement, unknown, SVGGElement, undefined>): SVGRect {\n const bBox = selection.node().getBBox()\n return bBox\n }\n\n _getRequiredMargin (axisSize = this._axisSizeBBox): Spacing {\n const { config: { type, position } } = this\n\n switch (type) {\n case AxisType.X: {\n const tolerancePx = 1\n const xEnd = this._axisSizeBBox.x + this._axisSizeBBox.width\n\n const left = this._axisSizeBBox.x < 0 ? Math.abs(this._axisSizeBBox.x) : 0\n const right = (xEnd - this._width) > tolerancePx ? xEnd - this._width : 0\n\n switch (position) {\n case Position.Top: return { top: axisSize.height, left, right }\n case Position.Bottom: default: return { bottom: axisSize.height, left, right }\n }\n }\n case AxisType.Y: {\n const bleedY = axisSize.height > this._height ? (axisSize.height - this._height) / 2 : 0\n const top = bleedY\n const bottom = bleedY\n\n switch (position) {\n case Position.Right: return { right: axisSize.width, top, bottom }\n case Position.Left: default: return { left: axisSize.width, top, bottom }\n }\n }\n }\n }\n\n getRequiredMargin (): Spacing {\n return this._requiredMargin\n }\n\n /** Calculates axis transform:translate offset based on passed container margins */\n getOffset (containerMargin: Spacing): {left: number; top: number} {\n const { config: { type, position } } = this\n\n switch (type) {\n case AxisType.X:\n switch (position) {\n case Position.Top: return { top: containerMargin.top, left: containerMargin.left }\n case Position.Bottom: default: return { top: containerMargin.top + this._height, left: containerMargin.left }\n }\n case AxisType.Y:\n switch (position) {\n case Position.Right: return { top: containerMargin.top, left: containerMargin.left + this._width }\n case Position.Left: default: return { top: containerMargin.top, left: containerMargin.left }\n }\n }\n }\n\n _render (duration = this.config.duration, selection = this.axisGroup): void {\n const { config } = this\n\n this._renderAxis(selection, duration)\n this._renderAxisLabel(selection)\n\n if (config.gridLine) {\n const gridGen = this._buildGrid().tickFormat(() => '')\n gridGen.tickValues(this._getConfiguredTickValues())\n // Interrupting all active transitions first to prevent them from being stuck.\n // Somehow we see it happening in Angular apps.\n this.gridGroup.selectAll('*').interrupt()\n smartTransition(this.gridGroup, duration).call(gridGen).style('opacity', 1)\n } else {\n smartTransition(this.gridGroup, duration).style('opacity', 0)\n }\n\n if (config.tickTextAlign) this._alignTickLabels()\n }\n\n _buildAxis (): D3Axis<any> {\n const { config: { type, position, tickPadding } } = this\n\n const ticks = this._getNumTicks()\n switch (type) {\n case AxisType.X:\n switch (position) {\n case Position.Top: return axisTop(this.xScale).ticks(ticks).tickPadding(tickPadding)\n case Position.Bottom: default: return axisBottom(this.xScale).ticks(ticks).tickPadding(tickPadding)\n }\n case AxisType.Y:\n switch (position) {\n case Position.Right: return axisRight(this.yScale).ticks(ticks).tickPadding(tickPadding)\n case Position.Left: default: return axisLeft(this.yScale).ticks(ticks).tickPadding(tickPadding)\n }\n }\n }\n\n _buildGrid (): D3Axis<any> {\n const { config: { type, position } } = this\n\n const ticks = this._getNumTicks()\n switch (type) {\n case AxisType.X:\n switch (position) {\n case Position.Top: return axisTop(this.xScale).ticks(ticks * 2).tickSize(-this._height).tickSizeOuter(0)\n case Position.Bottom: default: return axisBottom(this.xScale).ticks(ticks * 2).tickSize(-this._height).tickSizeOuter(0)\n }\n case AxisType.Y:\n switch (position) {\n case Position.Right: return axisRight(this.yScale).ticks(ticks * 2).tickSize(-this._width).tickSizeOuter(0)\n case Position.Left: default: return axisLeft(this.yScale).ticks(ticks * 2).tickSize(-this._width).tickSizeOuter(0)\n }\n }\n }\n\n _renderAxis (selection = this.axisGroup, duration = this.config.duration): void {\n const { config } = this\n\n const axisGen = this._buildAxis()\n const tickValues: (number[] | Date[]) = this._getConfiguredTickValues() || axisGen.scale<ContinuousScale>().ticks(this._getNumTicks())\n axisGen.tickValues(tickValues)\n\n // Interrupting all active transitions first to prevent them from being stuck.\n // Somehow we see it happening in Angular apps.\n selection.selectAll('*').interrupt()\n smartTransition(selection, duration).call(axisGen)\n\n const ticks = selection.selectAll<SVGGElement, number | Date>('g.tick')\n\n ticks\n .classed(s.tick, true)\n .style('font-size', config.tickTextFontSize)\n\n // Selecting the <text> elements of the ticks to apply formatting. By default, this selection\n // will include exiting elements, so we're filtering them out.\n const tickText = selection.selectAll<SVGTextElement, number | Date>('g.tick > text')\n .filter(tickValue => tickValues.some((t: number | Date) => isEqual(tickValue, t))) // We use isEqual to compare Dates\n .classed(s.tickLabel, true)\n .style('fill', config.tickTextColor) as Selection<SVGTextElement, number, SVGGElement, unknown> | Selection<SVGTextElement, Date, SVGGElement, unknown>\n\n\n // We interrupt the transition on tick's <text> to make it 'wrappable'\n tickText.nodes().forEach(node => interrupt(node))\n\n tickText.each((value: number | Date, i: number, elements: ArrayLike<SVGTextElement>) => {\n let text = config.tickFormat?.(value, i, tickValues) ?? `${value}`\n const textElement = elements[i] as SVGTextElement\n const textMaxWidth = config.tickTextWidth || (config.type === AxisType.X ? this._containerWidth / (ticks.size() + 1) : this._containerWidth / 5)\n const styleDeclaration = getComputedStyle(textElement)\n const fontSize = Number.parseFloat(styleDeclaration.fontSize)\n const fontFamily = styleDeclaration.fontFamily\n const textOptions: UnovisTextOptions = {\n verticalAlign: config.type === AxisType.X ? VerticalAlign.Top : VerticalAlign.Middle,\n width: textMaxWidth,\n textRotationAngle: config.tickTextAngle,\n separator: config.tickTextSeparator,\n wordBreak: config.tickTextForceWordBreak,\n }\n\n if (config.tickTextFitMode === FitMode.Trim) {\n const textElementSelection = select<SVGTextElement, string>(textElement).text(text)\n trimSVGText(textElementSelection, textMaxWidth, config.tickTextTrimType as TrimMode, true, fontSize, 0.58)\n text = select<SVGTextElement, string>(textElement).text()\n }\n\n const textBlock: UnovisText = { text, fontFamily, fontSize }\n renderTextToSvgTextElement(textElement, textBlock, textOptions)\n })\n\n selection\n .classed(s.axis, true)\n .classed(s.hideTickLine, !config.tickLine)\n .classed(s.hideDomain, !config.domainLine)\n\n if (config.fullSize) {\n const path = this._getFullDomainPath(0)\n smartTransition(selection.select('.domain'), duration).attr('d', path)\n }\n }\n\n _getNumTicks (): number {\n const { config: { type, numTicks } } = this\n\n if (numTicks) return numTicks\n\n if (type === AxisType.X) {\n const xRange = this.xScale.range() as [number, number]\n const width = xRange[1] - xRange[0]\n return Math.floor(width / 175)\n }\n\n if (type === AxisType.Y) {\n const yRange = this.yScale.range() as [number, number]\n const height = Math.abs(yRange[0] - yRange[1])\n return Math.pow(height, 0.85) / 25\n }\n\n return this._defaultNumTicks\n }\n\n _getConfiguredTickValues (): number[] | null {\n const { config: { tickValues, type, minMaxTicksOnly } } = this\n const scale = type === AxisType.X ? this.xScale : this.yScale\n const scaleDomain = scale?.domain() as [number, number]\n\n if (tickValues) {\n return tickValues.filter(v => (v >= scaleDomain[0]) && (v <= scaleDomain[1]))\n }\n\n if (minMaxTicksOnly || (type === AxisType.X && this._width < this._minMaxTicksOnlyEnforceWidth)) {\n return scaleDomain as number[]\n }\n\n return null\n }\n\n _getFullDomainPath (tickSize = 0): string {\n const { config: { type } } = this\n switch (type) {\n case AxisType.X: return `M0.5, ${tickSize} V0.5 H${this._width + 0.5} V${tickSize}`\n case AxisType.Y: return `M${-tickSize}, ${this._height + 0.5} H0.5 V0.5 H${-tickSize}`\n }\n }\n\n _renderAxisLabel (selection = this.axisGroup): void {\n const { type, label, labelMargin, labelFontSize } = this.config\n\n // Remove the old label first to calculate the axis size properly\n selection.selectAll(`.${s.label}`).remove()\n\n // Calculate label position and rotation\n const axisPosition = this.getPosition()\n // We always use this.axisRenderHelperGroup to calculate the size of the axis because\n // this.axisGroup will give us incorrect values due to animation\n const { width: axisWidth, height: axisHeight } = this._axisRawBBox ?? selection.node().getBBox()\n\n const offsetX = type === AxisType.X ? this._width / 2 : (-1) ** (+(axisPosition === Position.Left)) * axisWidth\n const offsetY = type === AxisType.X ? (-1) ** (+(axisPosition === Position.Top)) * axisHeight : this._height / 2\n\n const marginX = type === AxisType.X ? 0 : (-1) ** (+(axisPosition === Position.Left)) * labelMargin\n const marginY = type === AxisType.X ? (-1) ** (+(axisPosition === Position.Top)) * labelMargin : 0\n\n const rotation = type === AxisType.Y ? -90 : 0\n // Append new label\n selection\n .append('text')\n .attr('class', s.label)\n .text(label)\n .attr('dy', `${this._getLabelDY()}em`)\n .attr('transform', `translate(${offsetX + marginX},${offsetY + marginY}) rotate(${rotation})`)\n .style('font-size', labelFontSize)\n .style('fill', this.config.labelColor)\n }\n\n _getLabelDY (): number {\n const { type, position } = this.config\n switch (type) {\n case AxisType.X:\n switch (position) {\n case Position.Top: return 0\n case Position.Bottom: default: return 0.75\n }\n case AxisType.Y:\n switch (position) {\n case Position.Right: return 0.75\n case Position.Left: default: return -0.25\n }\n }\n }\n\n _alignTickLabels (): void {\n const { config: { type, tickTextAlign, tickTextAngle, position } } = this\n const tickText = this.g.selectAll('g.tick > text')\n\n const textAnchor = this._getTickTextAnchor(tickTextAlign as TextAlign)\n const translateX = type === AxisType.X\n ? 0\n : this._getYTickTextTranslate(tickTextAlign as TextAlign, position as Position)\n\n tickText\n .attr('transform', `translate(${translateX},0) rotate(${tickTextAngle})`)\n .attr('text-anchor', textAnchor)\n }\n\n _getTickTextAnchor (textAlign: TextAlign): string {\n switch (textAlign) {\n case TextAlign.Left: return 'start'\n case TextAlign.Right: return 'end'\n case TextAlign.Center: return 'middle'\n default: return null\n }\n }\n\n _getYTickTextTranslate (textAlign: TextAlign, axisPosition: Position = Position.Left): number {\n const defaultTickTextSpacingPx = 9 // Default in D3\n const width = this._axisRawBBox.width - defaultTickTextSpacingPx\n\n switch (textAlign) {\n case TextAlign.Left: return axisPosition === Position.Left ? width * -1 : 0\n case TextAlign.Right: return axisPosition === Position.Left ? 0 : width\n case TextAlign.Center: return axisPosition === Position.Left ? width * (-0.5) : width * 0.5\n default: return 0\n }\n }\n}\n"],"names":["s.grid","s.tick","s.tickLabel","s.axis","s.hideTickLine","s.hideDomain","label","s.label","s"],"mappings":";;;;;;;;;;;;;;AA2BM,MAAO,IAAY,SAAQ,eAAkD,CAAA;AAejF,IAAA,WAAA,CAAa,MAAmC,EAAA;AAC9C,QAAA,KAAK,EAAE,CAAA;QAdC,IAAc,CAAA,cAAA,GAA+B,iBAAiB,CAAA;AACjE,Q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AAEhE,QAAA,QAAQ,SAAS;YACf,KAAK,SAAS,CAAC,IAAI,EAAE,OAAO,YAAY,KAAK,QAAQ,CAAC,IAAI,GAAG,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;AAC3E,YAAA,KAAK,SAAS,CAAC,KAAK,EAAE,OAAO,YAAY,KAAK,QAAQ,CAAC,IAAI,GAAG,CAAC,GAAG,KAAK,CAAA;YACvE,KAAK,SAAS,CAAC,MAAM,EAAE,OAAO,YAAY,KAAK,QAAQ,CAAC,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,GAAG,CAAA;AAC3F,YAAA,SAAS,OAAO,CAAC,CAAA;AAClB,SAAA;KACF;;AA5VM,IAAS,CAAA,SAAA,GAAGE,KAAC;;;;"}
@@ -1,6 +1,6 @@
1
+ import { D3BrushEvent } from 'd3-brush';
1
2
  import { D3DragEvent } from 'd3-drag';
2
3
  import { D3ZoomEvent } from 'd3-zoom';
3
- import { Selection } from 'd3-selection';
4
4
  import { ComponentConfigInterface } from "../../core/component/config";
5
5
  import { TrimMode } from "../../types/text";
6
6
  import { GraphInputLink, GraphInputNode } from "../../types/graph";
@@ -13,6 +13,8 @@ export interface GraphConfigInterface<N extends GraphInputNode, L extends GraphI
13
13
  disableZoom?: boolean;
14
14
  /** Disable node dragging. Default: `false` */
15
15
  disableDrag?: boolean;
16
+ /** Disable brush for multiple node selection. Default: `false` */
17
+ disableBrush?: boolean;
16
18
  /** Interval to re-render the graph when zooming. Default: `100` */
17
19
  zoomThrottledUpdateNodeThreshold?: number;
18
20
  /** Type of the graph layout. Default: `GraphLayoutType.Force` */
@@ -156,14 +158,10 @@ export interface GraphConfigInterface<N extends GraphInputNode, L extends GraphI
156
158
  nodeExitPosition?: GenericAccessor<[number, number], N> | undefined;
157
159
  /** Specify the destination scale for exiting nodes in the range [0,1]. Default: `0.75` */
158
160
  nodeExitScale?: NumericAccessor<N> | undefined;
159
- /** Custom "enter" function for node rendering. Default: `undefined` */
160
- nodeEnterCustomRenderFunction?: (datum: GraphNode<N, L>, nodeGroupElement: SVGGElement, config: GraphConfigInterface<N, L>, duration: number, zoomLevel: number) => void;
161
- /** Custom "update" function for node rendering. Default: `undefined` */
162
- nodeUpdateCustomRenderFunction?: (datum: GraphNode<N, L>, nodeGroupElement: SVGGElement, config: GraphConfigInterface<N, L>, duration: number, zoomLevel: number) => void;
163
- /** Custom "exit" function for node rendering. Default: `undefined` */
164
- nodeExitCustomRenderFunction?: (datum: GraphNode<N, L>, nodeGroupElement: SVGGElement, config: GraphConfigInterface<N, L>, duration: number, zoomLevel: number) => void;
165
161
  /** Set selected node by unique id. Default: `undefined` */
166
162
  selectedNodeId?: number | string;
163
+ /** Set selected nodes by unique id. Default: `undefined` */
164
+ selectedNodeIds?: number[] | string[];
167
165
  /** Panels configuration. An array of `GraphPanelConfig` objects. Default: `[]` */
168
166
  panels?: GraphPanelConfig[] | undefined;
169
167
  /** Graph node drag start callback function. Default: `undefined` */
@@ -176,7 +174,9 @@ export interface GraphConfigInterface<N extends GraphInputNode, L extends GraphI
176
174
  onZoom?: (zoomScale: number, zoomScaleExtent: [number, number], event: D3ZoomEvent<SVGGElement, unknown> | undefined) => void;
177
175
  /** Callback function to be called when the graph layout is calculated. Default: `undefined` */
178
176
  onLayoutCalculated?: (n: GraphNode<N, L>[], links: GraphLink<N, L>[]) => void;
179
- /** Callback function to be called when the graph rendering is complete. Default: `undefined` */
180
- onRenderComplete?: (g: Selection<SVGGElement, unknown, null, undefined>, nodes: GraphNode<N, L>[], links: GraphLink<N, L>[], config: GraphConfigInterface<N, L>, duration: number, zoomLevel: number) => void;
177
+ /** Graph node selection brush callback function. Default: `undefined` */
178
+ onNodeSelectionBrush?: (selectedNodes: GraphNode<N, L>[], event: D3BrushEvent<SVGGElement> | undefined) => void;
179
+ /** Graph multiple node drag callback function. Default: `undefined` */
180
+ onNodeSelectionDrag?: (selectedNodes: GraphNode<N, L>[], event: D3DragEvent<SVGGElement, GraphNode<N, L>, unknown>) => void;
181
181
  }
182
182
  export declare const GraphDefaultConfig: GraphConfigInterface<GraphInputNode, GraphInputLink>;
@@ -3,7 +3,7 @@ import { TrimMode } from '../../types/text.js';
3
3
  import { GraphLayoutType, GraphLinkStyle, GraphNodeShape } from './types.js';
4
4
 
5
5
  // Config
6
- const GraphDefaultConfig = Object.assign(Object.assign({}, ComponentDefaultConfig), { duration: 1000, zoomScaleExtent: [0.35, 1.25], disableZoom: false, disableDrag: false, zoomThrottledUpdateNodeThreshold: 100, layoutType: GraphLayoutType.Force, layoutAutofit: true, layoutAutofitTolerance: 8.0, layoutNonConnectedAside: false, layoutGroupOrder: [], layoutParallelSubGroupsPerRow: 1, layoutParallelNodesPerColumn: 6, layoutParallelGroupSpacing: undefined, layoutParallelSortConnectionsByGroup: undefined, layoutNodeGroup: (n) => n.group, layoutParallelNodeSubGroup: (n) => n.subgroup, forceLayoutSettings: {
6
+ const GraphDefaultConfig = Object.assign(Object.assign({}, ComponentDefaultConfig), { duration: 1000, zoomScaleExtent: [0.35, 1.25], disableZoom: false, disableDrag: false, disableBrush: false, zoomThrottledUpdateNodeThreshold: 100, layoutType: GraphLayoutType.Force, layoutAutofit: true, layoutAutofitTolerance: 8.0, layoutNonConnectedAside: false, layoutGroupOrder: [], layoutParallelSubGroupsPerRow: 1, layoutParallelNodesPerColumn: 6, layoutParallelGroupSpacing: undefined, layoutParallelSortConnectionsByGroup: undefined, layoutNodeGroup: (n) => n.group, layoutParallelNodeSubGroup: (n) => n.subgroup, forceLayoutSettings: {
7
7
  linkDistance: 60,
8
8
  linkStrength: 0.45,
9
9
  charge: -500,
@@ -14,7 +14,7 @@ const GraphDefaultConfig = Object.assign(Object.assign({}, ComponentDefaultConfi
14
14
  }, dagreLayoutSettings: {
15
15
  rankdir: 'BT',
16
16
  ranker: 'longest-path',
17
- }, layoutElkSettings: undefined, layoutElkNodeGroups: undefined, linkFlowAnimDuration: 20000, linkFlowParticleSize: 2, linkWidth: 1, linkStyle: GraphLinkStyle.Solid, linkBandWidth: 0, linkArrow: undefined, linkStroke: undefined, linkFlow: false, linkLabel: undefined, linkLabelShiftFromCenter: true, linkNeighborSpacing: 8, linkDisabled: false, linkCurvature: 0, selectedLinkId: undefined, nodeGaugeAnimDuration: 1500, nodeSize: 30, nodeStrokeWidth: 3, nodeShape: GraphNodeShape.Circle, nodeGaugeValue: 0, nodeIcon: (n) => n.icon, nodeIconSize: undefined, nodeLabel: (n) => n.label, nodeLabelTrim: true, nodeLabelTrimLength: 15, nodeLabelTrimMode: TrimMode.Middle, nodeSubLabel: '', nodeSubLabelTrim: true, nodeSubLabelTrimLength: 15, nodeSubLabelTrimMode: TrimMode.Middle, nodeSideLabels: undefined, nodeBottomIcon: undefined, nodeDisabled: false, nodeFill: (n) => n.fill, nodeGaugeFill: undefined, nodeStroke: (n) => n.stroke, nodeEnterPosition: undefined, nodeEnterScale: 0.75, nodeExitPosition: undefined, nodeExitScale: 0.75, nodeSort: undefined, selectedNodeId: undefined, panels: undefined, onNodeDragStart: undefined, onNodeDrag: undefined, onNodeDragEnd: undefined, onZoom: undefined, onLayoutCalculated: undefined, onRenderComplete: undefined });
17
+ }, layoutElkSettings: undefined, layoutElkNodeGroups: undefined, linkFlowAnimDuration: 20000, linkFlowParticleSize: 2, linkWidth: 1, linkStyle: GraphLinkStyle.Solid, linkBandWidth: 0, linkArrow: undefined, linkStroke: undefined, linkFlow: false, linkLabel: undefined, linkLabelShiftFromCenter: true, linkNeighborSpacing: 8, linkDisabled: false, linkCurvature: 0, selectedLinkId: undefined, nodeGaugeAnimDuration: 1500, nodeSize: 30, nodeStrokeWidth: 3, nodeShape: GraphNodeShape.Circle, nodeGaugeValue: 0, nodeIcon: (n) => n.icon, nodeIconSize: undefined, nodeLabel: (n) => n.label, nodeLabelTrim: true, nodeLabelTrimLength: 15, nodeLabelTrimMode: TrimMode.Middle, nodeSubLabel: '', nodeSubLabelTrim: true, nodeSubLabelTrimLength: 15, nodeSubLabelTrimMode: TrimMode.Middle, nodeSideLabels: undefined, nodeBottomIcon: undefined, nodeDisabled: false, nodeFill: (n) => n.fill, nodeGaugeFill: undefined, nodeStroke: (n) => n.stroke, nodeEnterPosition: undefined, nodeEnterScale: 0.75, nodeExitPosition: undefined, nodeExitScale: 0.75, nodeSort: undefined, selectedNodeId: undefined, selectedNodeIds: undefined, panels: undefined, onNodeDragStart: undefined, onNodeDrag: undefined, onNodeDragEnd: undefined, onZoom: undefined, onLayoutCalculated: undefined, onNodeSelectionBrush: undefined, onNodeSelectionDrag: undefined });
18
18
 
19
19
  export { GraphDefaultConfig };
20
20
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../../src/components/graph/config.ts"],"sourcesContent":["import { D3DragEvent } from 'd3-drag'\nimport { D3ZoomEvent } from 'd3-zoom'\nimport { Selection } from 'd3-selection'\n\n// Config\nimport { ComponentConfigInterface, ComponentDefaultConfig } from 'core/component/config'\n\n// Types\nimport { TrimMode } from 'types/text'\nimport { GraphInputLink, GraphInputNode } from 'types/graph'\nimport { BooleanAccessor, ColorAccessor, NumericAccessor, StringAccessor, GenericAccessor } from 'types/accessor'\n\n// Local Types\nimport {\n GraphLayoutType,\n GraphCircleLabel,\n GraphLinkStyle,\n GraphLinkArrowStyle,\n GraphPanelConfig,\n GraphForceLayoutSettings,\n GraphElkLayoutSettings,\n GraphNodeShape,\n GraphDagreLayoutSetting,\n GraphNode,\n GraphLink,\n} from './types'\n\nexport interface GraphConfigInterface<N extends GraphInputNode, L extends GraphInputLink> extends ComponentConfigInterface {\n // Zoom and drag\n /** Zoom level constraints. Default: [0.35, 1.25] */\n zoomScaleExtent?: [number, number];\n /** Disable zooming. Default: `false` */\n disableZoom?: boolean;\n /** Disable node dragging. Default: `false` */\n disableDrag?: boolean;\n /** Interval to re-render the graph when zooming. Default: `100` */\n zoomThrottledUpdateNodeThreshold?: number;\n\n // Layout general settings\n /** Type of the graph layout. Default: `GraphLayoutType.Force` */\n layoutType?: GraphLayoutType | string;\n /** Fit the graph to container on data or config updates, or on container resize. Default: `true` */\n layoutAutofit?: boolean;\n /** Tolerance constant defining whether the graph should be fitted to container\n * (on data or config update, or container resize) after a zoom / pan interaction or not.\n * `0` — Stop fitting after any pan or zoom\n * `Number.POSITIVE_INFINITY` — Always fit\n * Default: `8.0` */\n layoutAutofitTolerance?: number;\n /** Place non-connected nodes at the bottom of the graph. Default: `false` */\n layoutNonConnectedAside?: boolean;\n\n // Settings for Parallel and Concentric layouts\n /** Node group accessor function.\n * Only for `GraphLayoutType.Parallel`, `GraphLayoutType.ParallelHorizontal` and `GraphLayoutType.Concentric` layouts.\n * Default: `node => node.group` */\n layoutNodeGroup?: StringAccessor<N>;\n /** Order of the layout groups.\n * Only for `GraphLayoutType.Parallel`, `GraphLayoutType.ParallelHorizontal` and `GraphLayoutType.Concentric` layouts.\n * Default: `[]` */\n layoutGroupOrder?: string[];\n\n // Setting for Parallel layouts only\n /** Sets the number of nodes in a sub-group after which they'll continue on the next column (or row if `layoutType` is\n * `GraphLayoutType.ParallelHorizontal`).\n * Only for `GraphLayoutType.Parallel` and `GraphLayoutType.ParallelHorizontal` layouts.\n * Default: `6` */\n layoutParallelNodesPerColumn?: number;\n /** Node sub-group accessor function.\n * Only for `GraphLayoutType.Parallel` and `GraphLayoutType.ParallelHorizontal` layouts.\n * Default: `node => node.subgroup` */\n layoutParallelNodeSubGroup?: StringAccessor<N>;\n /** Number of sub-groups per row (or column if `layoutType` is `GraphLayoutType.ParallelHorizontal`) in a group.\n * Only for `GraphLayoutType.Parallel` and `GraphLayoutType.ParallelHorizontal` layouts.\n * Default: `1` */\n layoutParallelSubGroupsPerRow?: number;\n /** Spacing between groups.\n * Only for `GraphLayoutType.Parallel` and `GraphLayoutType.ParallelHorizontal` layouts.\n * Default: `undefined` */\n layoutParallelGroupSpacing?: number;\n /** Set a group by name to have priority in sorting the graph links.\n * Only for `GraphLayoutType.Parallel` and `GraphLayoutType.ParallelHorizontal` layouts.\n * Default: `undefined` */\n layoutParallelSortConnectionsByGroup?: string;\n\n // Force layout\n /** Force Layout settings, see the `d3-force` package for more details */\n forceLayoutSettings?: GraphForceLayoutSettings<N, L>;\n\n // Dagre layout\n /** Darge Layout settings, see the `dagrejs` package\n * for more details: https://github.com/dagrejs/dagre/wiki#configuring-the-layout\n */\n dagreLayoutSettings?: GraphDagreLayoutSetting;\n\n // ELK layout\n /** ELK layout options, see the `elkjs` package for more details: https://github.com/kieler/elkjs.\n * If you want to specify custom layout option for each node group, you can provide an accessor function that\n * receives group name ('root' for the top-level configuration) as the first argument and returns an object containing\n * layout options. Default: `undefined`\n */\n layoutElkSettings?: GenericAccessor<GraphElkLayoutSettings, string> | undefined;\n /** Array of accessor functions to define nested node groups for the ELK Layered layout.\n * E.g.: `[n => n.group, n => n.subGroup]`.\n * Default: `undefined` */\n layoutElkNodeGroups?: StringAccessor<N>[];\n\n // Links\n /** Link width accessor function ot constant value. Default: `1` */\n linkWidth?: NumericAccessor<L>;\n /** Link style accessor function or constant value. Default: `GraphLinkStyle.Solid` */\n linkStyle?: GenericAccessor<GraphLinkStyle, L>;\n /** Link band width accessor function or constant value. Default: `0` */\n linkBandWidth?: NumericAccessor<L>;\n /** Link arrow accessor function or constant value. Default: `undefined` */\n linkArrow?: GenericAccessor<GraphLinkArrowStyle | string | boolean, L> | undefined;\n /** Link stroke color accessor function or constant value. Default: `undefined` */\n linkStroke?: ColorAccessor<L>;\n /** Link disabled state accessor function or constant value. Default: `false` */\n linkDisabled?: BooleanAccessor<L>;\n /** Link flow animation accessor function or constant value. Default: `false` */\n linkFlow?: BooleanAccessor<L>;\n /** Animation duration of the flow (traffic) circles. Default: `20000` */\n linkFlowAnimDuration?: number;\n /** Size of the moving particles that represent traffic flow. Default: `2` */\n linkFlowParticleSize?: number;\n /** Link label accessor function or constant value. Default: `undefined` */\n linkLabel?: GenericAccessor<GraphCircleLabel, L> | undefined;\n /** Shift label along the link center a little bit to avoid overlap with the link arrow. Default: `true` */\n linkLabelShiftFromCenter?: BooleanAccessor<L>;\n /** Spacing between neighboring links. Default: `8` */\n linkNeighborSpacing?: number;\n /** Curvature of the link. Recommended value range: [0:1.5].\n * `0` - straight line,\n * `1` - nice curvature,\n * `1.5` - very curve.\n * Default: `0` */\n linkCurvature?: NumericAccessor<L>;\n /** Set selected link by its unique id. Default: `undefined` */\n selectedLinkId?: number | string;\n\n // Nodes\n /** Node size accessor function or constant value. Default: `30` */\n nodeSize?: NumericAccessor<N>;\n /** Node stroke width accessor function or constant value. Default: `3` */\n nodeStrokeWidth?: NumericAccessor<N>;\n /** Node shape accessor function or constant value. Default: `GraphNodeShape.Circle` */\n nodeShape?: GenericAccessor<GraphNodeShape | string, N>;\n /** Node gauge outline accessor function or constant value in the range [0,100]. Default: `0` */\n nodeGaugeValue?: NumericAccessor<N>;\n /** Node gauge outline fill color accessor function or constant value. Default: `undefined` */\n nodeGaugeFill?: ColorAccessor<N>;\n /** Animation duration of the node gauge outline. Default: `1500` */\n nodeGaugeAnimDuration?: number;\n /** Node central icon accessor function or constant value. Default: `node => node.icon` */\n nodeIcon?: StringAccessor<N>;\n /** Node central icon size accessor function or constant value. Default: `undefined` */\n nodeIconSize?: NumericAccessor<N>;\n /** Node label accessor function or constant value. Default: `node => node.label` */\n nodeLabel?: StringAccessor<N>;\n /** Defines whether to trim the node labels or not. Default: `true` */\n nodeLabelTrim?: BooleanAccessor<N>;\n /** Node label trimming mode. Default: `TrimMode.Middle` */\n nodeLabelTrimMode?: GenericAccessor<TrimMode | string, N>;\n /** Node label maximum allowed text length above which the label will be trimmed. Default: `15` */\n nodeLabelTrimLength?: NumericAccessor<N>;\n /** Node sub-label accessor function or constant value: Default: `''` */\n nodeSubLabel?: StringAccessor<N>;\n /** Defines whether to trim the node sub-labels or not. Default: `true` */\n nodeSubLabelTrim?: BooleanAccessor<N>;\n /** Node sub-label trimming mode. Default: `TrimMode.Middle` */\n nodeSubLabelTrimMode?: GenericAccessor<TrimMode | string, N>;\n /** Node sub-label maximum allowed text length above which the label will be trimmed. Default: `15` */\n nodeSubLabelTrimLength?: NumericAccessor<N>;\n /** Node circular side labels accessor function. The function should return an array of GraphCircleLabel objects. Default: `undefined` */\n nodeSideLabels?: GenericAccessor<GraphCircleLabel[], N>;\n /** Node bottom icon accessor function. Default: `undefined` */\n nodeBottomIcon?: StringAccessor<N>;\n /** Node disabled state accessor function or constant value. Default: `false` */\n nodeDisabled?: BooleanAccessor<N>;\n /** Node fill color accessor function or constant value. Default: `node => node.fill` */\n nodeFill?: ColorAccessor<N>;\n /** Node stroke color accessor function or constant value. Default: `node => node.stroke` */\n nodeStroke?: ColorAccessor<N>;\n /** Sorting function to determine node placement. Default: `undefined` */\n nodeSort?: ((a: N, b: N) => number);\n /** Specify the initial position for entering nodes as [x, y]. Default: `undefined` */\n nodeEnterPosition?: GenericAccessor<[number, number], N> | undefined;\n /** Specify the initial scale for entering nodes in the range [0,1]. Default: `0.75` */\n nodeEnterScale?: NumericAccessor<N> | undefined;\n /** Specify the destination position for exiting nodes as [x, y]. Default: `undefined` */\n nodeExitPosition?: GenericAccessor<[number, number], N> | undefined;\n /** Specify the destination scale for exiting nodes in the range [0,1]. Default: `0.75` */\n nodeExitScale?: NumericAccessor<N> | undefined;\n /** Custom \"enter\" function for node rendering. Default: `undefined` */\n nodeEnterCustomRenderFunction?: (datum: GraphNode<N, L>, nodeGroupElement: SVGGElement, config: GraphConfigInterface<N, L>, duration: number, zoomLevel: number) => void;\n /** Custom \"update\" function for node rendering. Default: `undefined` */\n nodeUpdateCustomRenderFunction?: (datum: GraphNode<N, L>, nodeGroupElement: SVGGElement, config: GraphConfigInterface<N, L>, duration: number, zoomLevel: number) => void;\n /** Custom \"exit\" function for node rendering. Default: `undefined` */\n nodeExitCustomRenderFunction?: (datum: GraphNode<N, L>, nodeGroupElement: SVGGElement, config: GraphConfigInterface<N, L>, duration: number, zoomLevel: number) => void;\n /** Set selected node by unique id. Default: `undefined` */\n selectedNodeId?: number | string;\n\n /** Panels configuration. An array of `GraphPanelConfig` objects. Default: `[]` */\n panels?: GraphPanelConfig[] | undefined;\n\n // Events\n /** Graph node drag start callback function. Default: `undefined` */\n onNodeDragStart?: (n: GraphNode<N, L>, event: D3DragEvent<SVGGElement, GraphNode<N, L>, unknown>) => void | undefined;\n /** Graph node drag callback function. Default: `undefined` */\n onNodeDrag?: (n: GraphNode<N, L>, event: D3DragEvent<SVGGElement, GraphNode<N, L>, unknown>) => void | undefined;\n /** Graph node drag end callback function. Default: `undefined` */\n onNodeDragEnd?: (n: GraphNode<N, L>, event: D3DragEvent<SVGGElement, GraphNode<N, L>, unknown>) => void | undefined;\n /** Zoom event callback. Default: `undefined` */\n onZoom?: (zoomScale: number, zoomScaleExtent: [number, number], event: D3ZoomEvent<SVGGElement, unknown> | undefined) => void;\n /** Callback function to be called when the graph layout is calculated. Default: `undefined` */\n onLayoutCalculated?: (n: GraphNode<N, L>[], links: GraphLink<N, L>[]) => void;\n /** Callback function to be called when the graph rendering is complete. Default: `undefined` */\n onRenderComplete?: (\n g: Selection<SVGGElement, unknown, null, undefined>,\n nodes: GraphNode<N, L>[],\n links: GraphLink<N, L>[],\n config: GraphConfigInterface<N, L>,\n duration: number,\n zoomLevel: number\n ) => void;\n}\n\nexport const GraphDefaultConfig: GraphConfigInterface<GraphInputNode, GraphInputLink> = {\n ...ComponentDefaultConfig,\n duration: 1000,\n zoomScaleExtent: [0.35, 1.25],\n disableZoom: false,\n disableDrag: false,\n zoomThrottledUpdateNodeThreshold: 100,\n layoutType: GraphLayoutType.Force,\n layoutAutofit: true,\n layoutAutofitTolerance: 8.0,\n layoutNonConnectedAside: false,\n\n layoutGroupOrder: [],\n layoutParallelSubGroupsPerRow: 1,\n layoutParallelNodesPerColumn: 6,\n layoutParallelGroupSpacing: undefined,\n layoutParallelSortConnectionsByGroup: undefined,\n layoutNodeGroup: (n: GraphInputNode): string => (n as { group: string }).group,\n layoutParallelNodeSubGroup: (n: GraphInputNode): string => (n as { subgroup: string }).subgroup,\n\n forceLayoutSettings: {\n linkDistance: 60,\n linkStrength: 0.45,\n charge: -500,\n forceXStrength: 0.15,\n forceYStrength: 0.25,\n numIterations: undefined,\n fixNodePositionAfterSimulation: false,\n },\n\n dagreLayoutSettings: {\n rankdir: 'BT',\n ranker: 'longest-path',\n },\n\n layoutElkSettings: undefined,\n layoutElkNodeGroups: undefined,\n\n linkFlowAnimDuration: 20000,\n linkFlowParticleSize: 2,\n linkWidth: 1,\n linkStyle: GraphLinkStyle.Solid,\n linkBandWidth: 0,\n linkArrow: undefined,\n linkStroke: undefined,\n linkFlow: false,\n linkLabel: undefined,\n linkLabelShiftFromCenter: true,\n linkNeighborSpacing: 8,\n linkDisabled: false,\n linkCurvature: 0,\n selectedLinkId: undefined,\n nodeGaugeAnimDuration: 1500,\n\n nodeSize: 30,\n nodeStrokeWidth: 3,\n nodeShape: GraphNodeShape.Circle,\n nodeGaugeValue: 0,\n nodeIcon: (n: GraphInputNode): string => (n as { icon: string }).icon,\n nodeIconSize: undefined,\n nodeLabel: (n: GraphInputNode): string => (n as { label: string }).label,\n nodeLabelTrim: true,\n nodeLabelTrimLength: 15,\n nodeLabelTrimMode: TrimMode.Middle,\n nodeSubLabel: '',\n nodeSubLabelTrim: true,\n nodeSubLabelTrimLength: 15,\n nodeSubLabelTrimMode: TrimMode.Middle,\n nodeSideLabels: undefined,\n nodeBottomIcon: undefined,\n nodeDisabled: false,\n nodeFill: (n: GraphInputNode): string => (n as { fill: string }).fill,\n nodeGaugeFill: undefined,\n nodeStroke: (n: GraphInputNode): string => (n as { stroke: string }).stroke,\n nodeEnterPosition: undefined,\n nodeEnterScale: 0.75,\n nodeExitPosition: undefined,\n nodeExitScale: 0.75,\n nodeSort: undefined,\n\n selectedNodeId: undefined,\n panels: undefined,\n\n onNodeDragStart: undefined,\n onNodeDrag: undefined,\n onNodeDragEnd: undefined,\n onZoom: undefined,\n onLayoutCalculated: undefined,\n onRenderComplete: undefined,\n}\n"],"names":[],"mappings":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mBAAmB,EAAE,CAAC,EACtB,YAAY,EAAE,KAAK,EACnB,aAAa,EAAE,CAAC,EAChB,cAAc,EAAE,SAAS,EACzB,qBAAqB,EAAE,IAAI,EAE3B,QAAQ,EAAE,EAAE,EACZ,eAAe,EAAE,CAAC,EAClB,SAAS,EAAE,cAAc,CAAC,MAAM,EAChC,cAAc,EAAE,CAAC,EACjB,QAAQ,EAAE,CAAC,CAAiB,KAAc,CAAsB,CAAC,IAAI,EACrE,YAAY,EAAE,SAAS,EACvB,SAAS,EAAE,CAAC,CAAiB,KAAc,CAAuB,CAAC,KAAK,EACxE,aAAa,EAAE,IAAI,EACnB,mBAAmB,EAAE,EAAE,EACvB,iBAAiB,EAAE,QAAQ,CAAC,MAAM,EAClC,YAAY,EAAE,EAAE,EAChB,gBAAgB,EAAE,IAAI,EACtB,sBAAsB,EAAE,EAAE,EAC1B,oBAAoB,EAAE,QAAQ,CAAC,MAAM,EACrC,cAAc,EAAE,SAAS,EACzB,cAAc,EAAE,SAAS,EACzB,YAAY,EAAE,KAAK,EACnB,QAAQ,EAAE,CAAC,CAAiB,KAAc,CAAsB,CAAC,IAAI,EACrE,aAAa,EAAE,SAAS,EACxB,UAAU,EAAE,CAAC,CAAiB,KAAc,CAAwB,CAAC,MAAM,EAC3E,iBAAiB,EAAE,SAAS,EAC5B,cAAc,EAAE,IAAI,EACpB,gBAAgB,EAAE,SAAS,EAC3B,aAAa,EAAE,IAAI,EACnB,QAAQ,EAAE,SAAS,EAEnB,cAAc,EAAE,SAAS,EACzB,MAAM,EAAE,SAAS,EAEjB,eAAe,EAAE,SAAS,EAC1B,UAAU,EAAE,SAAS,EACrB,aAAa,EAAE,SAAS,EACxB,MAAM,EAAE,SAAS,EACjB,kBAAkB,EAAE,SAAS,EAC7B,gBAAgB,EAAE,SAAS,EAAA;;;;"}
1
+ {"version":3,"file":"config.js","sources":["../../../src/components/graph/config.ts"],"sourcesContent":["import { D3BrushEvent } from 'd3-brush'\nimport { D3DragEvent } from 'd3-drag'\nimport { D3ZoomEvent } from 'd3-zoom'\n\n// Config\nimport { ComponentConfigInterface, ComponentDefaultConfig } from 'core/component/config'\n\n// Types\nimport { TrimMode } from 'types/text'\nimport { GraphInputLink, GraphInputNode } from 'types/graph'\nimport { BooleanAccessor, ColorAccessor, NumericAccessor, StringAccessor, GenericAccessor } from 'types/accessor'\n\n// Local Types\nimport {\n GraphLayoutType,\n GraphCircleLabel,\n GraphLinkStyle,\n GraphLinkArrowStyle,\n GraphPanelConfig,\n GraphForceLayoutSettings,\n GraphElkLayoutSettings,\n GraphNodeShape,\n GraphDagreLayoutSetting,\n GraphNode,\n GraphLink,\n} from './types'\n\n\nexport interface GraphConfigInterface<N extends GraphInputNode, L extends GraphInputLink> extends ComponentConfigInterface {\n // Zoom and drag\n /** Zoom level constraints. Default: [0.35, 1.25] */\n zoomScaleExtent?: [number, number];\n /** Disable zooming. Default: `false` */\n disableZoom?: boolean;\n /** Disable node dragging. Default: `false` */\n disableDrag?: boolean;\n /** Disable brush for multiple node selection. Default: `false` */\n disableBrush?: boolean;\n /** Interval to re-render the graph when zooming. Default: `100` */\n zoomThrottledUpdateNodeThreshold?: number;\n\n // Layout general settings\n /** Type of the graph layout. Default: `GraphLayoutType.Force` */\n layoutType?: GraphLayoutType | string;\n /** Fit the graph to container on data or config updates, or on container resize. Default: `true` */\n layoutAutofit?: boolean;\n /** Tolerance constant defining whether the graph should be fitted to container\n * (on data or config update, or container resize) after a zoom / pan interaction or not.\n * `0` — Stop fitting after any pan or zoom\n * `Number.POSITIVE_INFINITY` — Always fit\n * Default: `8.0` */\n layoutAutofitTolerance?: number;\n /** Place non-connected nodes at the bottom of the graph. Default: `false` */\n layoutNonConnectedAside?: boolean;\n\n // Settings for Parallel and Concentric layouts\n /** Node group accessor function.\n * Only for `GraphLayoutType.Parallel`, `GraphLayoutType.ParallelHorizontal` and `GraphLayoutType.Concentric` layouts.\n * Default: `node => node.group` */\n layoutNodeGroup?: StringAccessor<N>;\n /** Order of the layout groups.\n * Only for `GraphLayoutType.Parallel`, `GraphLayoutType.ParallelHorizontal` and `GraphLayoutType.Concentric` layouts.\n * Default: `[]` */\n layoutGroupOrder?: string[];\n\n // Setting for Parallel layouts only\n /** Sets the number of nodes in a sub-group after which they'll continue on the next column (or row if `layoutType` is\n * `GraphLayoutType.ParallelHorizontal`).\n * Only for `GraphLayoutType.Parallel` and `GraphLayoutType.ParallelHorizontal` layouts.\n * Default: `6` */\n layoutParallelNodesPerColumn?: number;\n /** Node sub-group accessor function.\n * Only for `GraphLayoutType.Parallel` and `GraphLayoutType.ParallelHorizontal` layouts.\n * Default: `node => node.subgroup` */\n layoutParallelNodeSubGroup?: StringAccessor<N>;\n /** Number of sub-groups per row (or column if `layoutType` is `GraphLayoutType.ParallelHorizontal`) in a group.\n * Only for `GraphLayoutType.Parallel` and `GraphLayoutType.ParallelHorizontal` layouts.\n * Default: `1` */\n layoutParallelSubGroupsPerRow?: number;\n /** Spacing between groups.\n * Only for `GraphLayoutType.Parallel` and `GraphLayoutType.ParallelHorizontal` layouts.\n * Default: `undefined` */\n layoutParallelGroupSpacing?: number;\n /** Set a group by name to have priority in sorting the graph links.\n * Only for `GraphLayoutType.Parallel` and `GraphLayoutType.ParallelHorizontal` layouts.\n * Default: `undefined` */\n layoutParallelSortConnectionsByGroup?: string;\n\n // Force layout\n /** Force Layout settings, see the `d3-force` package for more details */\n forceLayoutSettings?: GraphForceLayoutSettings<N, L>;\n\n // Dagre layout\n /** Darge Layout settings, see the `dagrejs` package\n * for more details: https://github.com/dagrejs/dagre/wiki#configuring-the-layout\n */\n dagreLayoutSettings?: GraphDagreLayoutSetting;\n\n // ELK layout\n /** ELK layout options, see the `elkjs` package for more details: https://github.com/kieler/elkjs.\n * If you want to specify custom layout option for each node group, you can provide an accessor function that\n * receives group name ('root' for the top-level configuration) as the first argument and returns an object containing\n * layout options. Default: `undefined`\n */\n layoutElkSettings?: GenericAccessor<GraphElkLayoutSettings, string> | undefined;\n /** Array of accessor functions to define nested node groups for the ELK Layered layout.\n * E.g.: `[n => n.group, n => n.subGroup]`.\n * Default: `undefined` */\n layoutElkNodeGroups?: StringAccessor<N>[];\n\n // Links\n /** Link width accessor function ot constant value. Default: `1` */\n linkWidth?: NumericAccessor<L>;\n /** Link style accessor function or constant value. Default: `GraphLinkStyle.Solid` */\n linkStyle?: GenericAccessor<GraphLinkStyle, L>;\n /** Link band width accessor function or constant value. Default: `0` */\n linkBandWidth?: NumericAccessor<L>;\n /** Link arrow accessor function or constant value. Default: `undefined` */\n linkArrow?: GenericAccessor<GraphLinkArrowStyle | string | boolean, L> | undefined;\n /** Link stroke color accessor function or constant value. Default: `undefined` */\n linkStroke?: ColorAccessor<L>;\n /** Link disabled state accessor function or constant value. Default: `false` */\n linkDisabled?: BooleanAccessor<L>;\n /** Link flow animation accessor function or constant value. Default: `false` */\n linkFlow?: BooleanAccessor<L>;\n /** Animation duration of the flow (traffic) circles. Default: `20000` */\n linkFlowAnimDuration?: number;\n /** Size of the moving particles that represent traffic flow. Default: `2` */\n linkFlowParticleSize?: number;\n /** Link label accessor function or constant value. Default: `undefined` */\n linkLabel?: GenericAccessor<GraphCircleLabel, L> | undefined;\n /** Shift label along the link center a little bit to avoid overlap with the link arrow. Default: `true` */\n linkLabelShiftFromCenter?: BooleanAccessor<L>;\n /** Spacing between neighboring links. Default: `8` */\n linkNeighborSpacing?: number;\n /** Curvature of the link. Recommended value range: [0:1.5].\n * `0` - straight line,\n * `1` - nice curvature,\n * `1.5` - very curve.\n * Default: `0` */\n linkCurvature?: NumericAccessor<L>;\n /** Set selected link by its unique id. Default: `undefined` */\n selectedLinkId?: number | string;\n\n // Nodes\n /** Node size accessor function or constant value. Default: `30` */\n nodeSize?: NumericAccessor<N>;\n /** Node stroke width accessor function or constant value. Default: `3` */\n nodeStrokeWidth?: NumericAccessor<N>;\n /** Node shape accessor function or constant value. Default: `GraphNodeShape.Circle` */\n nodeShape?: GenericAccessor<GraphNodeShape | string, N>;\n /** Node gauge outline accessor function or constant value in the range [0,100]. Default: `0` */\n nodeGaugeValue?: NumericAccessor<N>;\n /** Node gauge outline fill color accessor function or constant value. Default: `undefined` */\n nodeGaugeFill?: ColorAccessor<N>;\n /** Animation duration of the node gauge outline. Default: `1500` */\n nodeGaugeAnimDuration?: number;\n /** Node central icon accessor function or constant value. Default: `node => node.icon` */\n nodeIcon?: StringAccessor<N>;\n /** Node central icon size accessor function or constant value. Default: `undefined` */\n nodeIconSize?: NumericAccessor<N>;\n /** Node label accessor function or constant value. Default: `node => node.label` */\n nodeLabel?: StringAccessor<N>;\n /** Defines whether to trim the node labels or not. Default: `true` */\n nodeLabelTrim?: BooleanAccessor<N>;\n /** Node label trimming mode. Default: `TrimMode.Middle` */\n nodeLabelTrimMode?: GenericAccessor<TrimMode | string, N>;\n /** Node label maximum allowed text length above which the label will be trimmed. Default: `15` */\n nodeLabelTrimLength?: NumericAccessor<N>;\n /** Node sub-label accessor function or constant value: Default: `''` */\n nodeSubLabel?: StringAccessor<N>;\n /** Defines whether to trim the node sub-labels or not. Default: `true` */\n nodeSubLabelTrim?: BooleanAccessor<N>;\n /** Node sub-label trimming mode. Default: `TrimMode.Middle` */\n nodeSubLabelTrimMode?: GenericAccessor<TrimMode | string, N>;\n /** Node sub-label maximum allowed text length above which the label will be trimmed. Default: `15` */\n nodeSubLabelTrimLength?: NumericAccessor<N>;\n /** Node circular side labels accessor function. The function should return an array of GraphCircleLabel objects. Default: `undefined` */\n nodeSideLabels?: GenericAccessor<GraphCircleLabel[], N>;\n /** Node bottom icon accessor function. Default: `undefined` */\n nodeBottomIcon?: StringAccessor<N>;\n /** Node disabled state accessor function or constant value. Default: `false` */\n nodeDisabled?: BooleanAccessor<N>;\n /** Node fill color accessor function or constant value. Default: `node => node.fill` */\n nodeFill?: ColorAccessor<N>;\n /** Node stroke color accessor function or constant value. Default: `node => node.stroke` */\n nodeStroke?: ColorAccessor<N>;\n /** Sorting function to determine node placement. Default: `undefined` */\n nodeSort?: ((a: N, b: N) => number);\n /** Specify the initial position for entering nodes as [x, y]. Default: `undefined` */\n nodeEnterPosition?: GenericAccessor<[number, number], N> | undefined;\n /** Specify the initial scale for entering nodes in the range [0,1]. Default: `0.75` */\n nodeEnterScale?: NumericAccessor<N> | undefined;\n /** Specify the destination position for exiting nodes as [x, y]. Default: `undefined` */\n nodeExitPosition?: GenericAccessor<[number, number], N> | undefined;\n /** Specify the destination scale for exiting nodes in the range [0,1]. Default: `0.75` */\n nodeExitScale?: NumericAccessor<N> | undefined;\n /** Set selected node by unique id. Default: `undefined` */\n selectedNodeId?: number | string;\n /** Set selected nodes by unique id. Default: `undefined` */\n selectedNodeIds?: number[] | string[];\n\n /** Panels configuration. An array of `GraphPanelConfig` objects. Default: `[]` */\n panels?: GraphPanelConfig[] | undefined;\n\n // Events\n /** Graph node drag start callback function. Default: `undefined` */\n onNodeDragStart?: (n: GraphNode<N, L>, event: D3DragEvent<SVGGElement, GraphNode<N, L>, unknown>) => void | undefined;\n /** Graph node drag callback function. Default: `undefined` */\n onNodeDrag?: (n: GraphNode<N, L>, event: D3DragEvent<SVGGElement, GraphNode<N, L>, unknown>) => void | undefined;\n /** Graph node drag end callback function. Default: `undefined` */\n onNodeDragEnd?: (n: GraphNode<N, L>, event: D3DragEvent<SVGGElement, GraphNode<N, L>, unknown>) => void | undefined;\n /** Zoom event callback. Default: `undefined` */\n onZoom?: (zoomScale: number, zoomScaleExtent: [number, number], event: D3ZoomEvent<SVGGElement, unknown> | undefined) => void;\n /** Callback function to be called when the graph layout is calculated. Default: `undefined` */\n onLayoutCalculated?: (n: GraphNode<N, L>[], links: GraphLink<N, L>[]) => void;\n /** Graph node selection brush callback function. Default: `undefined` */\n onNodeSelectionBrush?: (selectedNodes: GraphNode<N, L>[], event: D3BrushEvent<SVGGElement> | undefined) => void;\n /** Graph multiple node drag callback function. Default: `undefined` */\n onNodeSelectionDrag?: (selectedNodes: GraphNode<N, L>[], event: D3DragEvent<SVGGElement, GraphNode<N, L>, unknown>) => void;\n}\n\nexport const GraphDefaultConfig: GraphConfigInterface<GraphInputNode, GraphInputLink> = {\n ...ComponentDefaultConfig,\n duration: 1000,\n zoomScaleExtent: [0.35, 1.25],\n disableZoom: false,\n disableDrag: false,\n disableBrush: false,\n zoomThrottledUpdateNodeThreshold: 100,\n layoutType: GraphLayoutType.Force,\n layoutAutofit: true,\n layoutAutofitTolerance: 8.0,\n layoutNonConnectedAside: false,\n\n layoutGroupOrder: [],\n layoutParallelSubGroupsPerRow: 1,\n layoutParallelNodesPerColumn: 6,\n layoutParallelGroupSpacing: undefined,\n layoutParallelSortConnectionsByGroup: undefined,\n layoutNodeGroup: (n: GraphInputNode): string => (n as { group: string }).group,\n layoutParallelNodeSubGroup: (n: GraphInputNode): string => (n as { subgroup: string }).subgroup,\n\n forceLayoutSettings: {\n linkDistance: 60,\n linkStrength: 0.45,\n charge: -500,\n forceXStrength: 0.15,\n forceYStrength: 0.25,\n numIterations: undefined,\n fixNodePositionAfterSimulation: false,\n },\n\n dagreLayoutSettings: {\n rankdir: 'BT',\n ranker: 'longest-path',\n },\n\n layoutElkSettings: undefined,\n layoutElkNodeGroups: undefined,\n\n linkFlowAnimDuration: 20000,\n linkFlowParticleSize: 2,\n linkWidth: 1,\n linkStyle: GraphLinkStyle.Solid,\n linkBandWidth: 0,\n linkArrow: undefined,\n linkStroke: undefined,\n linkFlow: false,\n linkLabel: undefined,\n linkLabelShiftFromCenter: true,\n linkNeighborSpacing: 8,\n linkDisabled: false,\n linkCurvature: 0,\n selectedLinkId: undefined,\n nodeGaugeAnimDuration: 1500,\n\n nodeSize: 30,\n nodeStrokeWidth: 3,\n nodeShape: GraphNodeShape.Circle,\n nodeGaugeValue: 0,\n nodeIcon: (n: GraphInputNode): string => (n as { icon: string }).icon,\n nodeIconSize: undefined,\n nodeLabel: (n: GraphInputNode): string => (n as { label: string }).label,\n nodeLabelTrim: true,\n nodeLabelTrimLength: 15,\n nodeLabelTrimMode: TrimMode.Middle,\n nodeSubLabel: '',\n nodeSubLabelTrim: true,\n nodeSubLabelTrimLength: 15,\n nodeSubLabelTrimMode: TrimMode.Middle,\n nodeSideLabels: undefined,\n nodeBottomIcon: undefined,\n nodeDisabled: false,\n nodeFill: (n: GraphInputNode): string => (n as { fill: string }).fill,\n nodeGaugeFill: undefined,\n nodeStroke: (n: GraphInputNode): string => (n as { stroke: string }).stroke,\n nodeEnterPosition: undefined,\n nodeEnterScale: 0.75,\n nodeExitPosition: undefined,\n nodeExitScale: 0.75,\n nodeSort: undefined,\n\n selectedNodeId: undefined,\n selectedNodeIds: undefined,\n panels: undefined,\n\n onNodeDragStart: undefined,\n onNodeDrag: undefined,\n onNodeDragEnd: undefined,\n onZoom: undefined,\n onLayoutCalculated: undefined,\n onNodeSelectionBrush: undefined,\n onNodeSelectionDrag: undefined,\n}\n"],"names":[],"mappings":";;;;AAIA;MA0Na,kBAAkB,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAC1B,sBAAsB,CACzB,EAAA,EAAA,QAAQ,EAAE,IAAI,EACd,eAAe,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAC7B,WAAW,EAAE,KAAK,EAClB,WAAW,EAAE,KAAK,EAClB,YAAY,EAAE,KAAK,EACnB,gCAAgC,EAAE,GAAG,EACrC,UAAU,EAAE,eAAe,CAAC,KAAK,EACjC,aAAa,EAAE,IAAI,EACnB,sBAAsB,EAAE,GAAG,EAC3B,uBAAuB,EAAE,KAAK,EAE9B,gBAAgB,EAAE,EAAE,EACpB,6BAA6B,EAAE,CAAC,EAChC,4BAA4B,EAAE,CAAC,EAC/B,0BAA0B,EAAE,SAAS,EACrC,oCAAoC,EAAE,SAAS,EAC/C,eAAe,EAAE,CAAC,CAAiB,KAAc,CAAuB,CAAC,KAAK,EAC9E,0BAA0B,EAAE,CAAC,CAAiB,KAAc,CAA0B,CAAC,QAAQ,EAE/F,mBAAmB,EAAE;AACnB,QAAA,YAAY,EAAE,EAAE;AAChB,QA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AAE,KAAK,EACnB,QAAQ,EAAE,CAAC,CAAiB,KAAc,CAAsB,CAAC,IAAI,EACrE,aAAa,EAAE,SAAS,EACxB,UAAU,EAAE,CAAC,CAAiB,KAAc,CAAwB,CAAC,MAAM,EAC3E,iBAAiB,EAAE,SAAS,EAC5B,cAAc,EAAE,IAAI,EACpB,gBAAgB,EAAE,SAAS,EAC3B,aAAa,EAAE,IAAI,EACnB,QAAQ,EAAE,SAAS,EAEnB,cAAc,EAAE,SAAS,EACzB,eAAe,EAAE,SAAS,EAC1B,MAAM,EAAE,SAAS,EAEjB,eAAe,EAAE,SAAS,EAC1B,UAAU,EAAE,SAAS,EACrB,aAAa,EAAE,SAAS,EACxB,MAAM,EAAE,SAAS,EACjB,kBAAkB,EAAE,SAAS,EAC7B,oBAAoB,EAAE,SAAS,EAC/B,mBAAmB,EAAE,SAAS,EAAA;;;;"}
@@ -12,7 +12,6 @@ export declare class Graph<N extends GraphInputNode, L extends GraphInputLink> e
12
12
  }, GraphConfigInterface<N, L>> {
13
13
  static selectors: {
14
14
  root: string;
15
- graphGroup: string;
16
15
  background: string;
17
16
  node: string;
18
17
  nodeShape: string;
@@ -37,17 +36,19 @@ export declare class Graph<N extends GraphInputNode, L extends GraphInputLink> e
37
36
  protected _defaultConfig: GraphConfigInterface<N, L>;
38
37
  config: GraphConfigInterface<N, L>;
39
38
  datamodel: GraphDataModel<N, L, GraphNode<N, L>, GraphLink<N, L>>;
40
- private _selectedNode;
39
+ private _selectedNodes;
41
40
  private _selectedLink;
42
41
  private _graphGroup;
43
42
  private _panelsGroup;
44
43
  private _linksGroup;
45
44
  private _nodesGroup;
45
+ private _brush;
46
46
  private _timer;
47
47
  private _isFirstRender;
48
48
  private _prevWidth;
49
49
  private _prevHeight;
50
50
  private _shouldRecalculateLayout;
51
+ private _currentLayoutType;
51
52
  private _layoutCalculationPromise;
52
53
  private _shouldFitLayout;
53
54
  private _shouldSetPanels;
@@ -59,6 +60,8 @@ export declare class Graph<N extends GraphInputNode, L extends GraphInputLink> e
59
60
  private _scale;
60
61
  private _initialTransform;
61
62
  private _isDragging;
63
+ private _brushBehavior;
64
+ private _groupDragInit;
62
65
  events: {
63
66
  [x: string]: {
64
67
  click: () => void;
@@ -75,6 +78,7 @@ export declare class Graph<N extends GraphInputNode, L extends GraphInputLink> e
75
78
  };
76
79
  };
77
80
  get selectedNode(): GraphNode<N, L>;
81
+ get selectedNodes(): GraphNode<N, L>[];
78
82
  get selectedLink(): GraphLink<N, L>;
79
83
  constructor(config?: GraphConfigInterface<N, L>);
80
84
  setData(data: {
@@ -93,6 +97,7 @@ export declare class Graph<N extends GraphInputNode, L extends GraphInputLink> e
93
97
  private _fit;
94
98
  private _getTransform;
95
99
  private _selectNode;
100
+ private _selectNodes;
96
101
  private _selectLink;
97
102
  private _resetSelection;
98
103
  private _updateSelectedElements;
@@ -105,9 +110,15 @@ export declare class Graph<N extends GraphInputNode, L extends GraphInputLink> e
105
110
  private _onLinkMouseOut;
106
111
  private _onLinkFlowTimerFrame;
107
112
  private _onZoom;
113
+ private _updateNodePosition;
114
+ private _onBrush;
115
+ private _handleDrag;
108
116
  private _onDragStarted;
109
117
  private _onDragged;
110
118
  private _onDragEnded;
119
+ private _dragSelectedNodes;
120
+ private _activateBrush;
121
+ private _clearBrush;
111
122
  private _shouldLayoutRecalculate;
112
123
  private _getLinkArrowDefId;
113
124
  private _addSVGDefs;