@unovis/ts 1.3.0-beta.3 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/area/config.d.ts +6 -10
- package/components/area/config.js +3 -12
- package/components/area/config.js.map +1 -1
- package/components/area/index.d.ts +5 -6
- package/components/area/index.js +10 -9
- package/components/area/index.js.map +1 -1
- package/components/axis/config.d.ts +3 -27
- package/components/axis/config.js +3 -30
- package/components/axis/config.js.map +1 -1
- package/components/axis/index.d.ts +4 -3
- package/components/axis/index.js +8 -5
- package/components/axis/index.js.map +1 -1
- package/components/brush/config.d.ts +2 -12
- package/components/brush/config.js +11 -20
- package/components/brush/config.js.map +1 -1
- package/components/brush/index.d.ts +4 -3
- package/components/brush/index.js +4 -3
- package/components/brush/index.js.map +1 -1
- package/components/bullet-legend/config.d.ts +1 -10
- package/components/bullet-legend/config.js +11 -14
- package/components/bullet-legend/config.js.map +1 -1
- package/components/bullet-legend/index.d.ts +4 -3
- package/components/bullet-legend/index.js +5 -2
- package/components/bullet-legend/index.js.map +1 -1
- package/components/chord-diagram/config.d.ts +7 -23
- package/components/chord-diagram/config.js +4 -23
- package/components/chord-diagram/config.js.map +1 -1
- package/components/chord-diagram/index.d.ts +4 -3
- package/components/chord-diagram/index.js +8 -7
- package/components/chord-diagram/index.js.map +1 -1
- package/components/chord-diagram/modules/label.d.ts +3 -3
- package/components/chord-diagram/modules/label.js +1 -1
- package/components/chord-diagram/modules/label.js.map +1 -1
- package/components/chord-diagram/modules/link.d.ts +2 -2
- package/components/chord-diagram/modules/link.js.map +1 -1
- package/components/chord-diagram/modules/node.d.ts +2 -2
- package/components/chord-diagram/modules/node.js.map +1 -1
- package/components/chord-diagram/types.d.ts +3 -2
- package/components/chord-diagram/types.js.map +1 -1
- package/components/crosshair/config.d.ts +4 -14
- package/components/crosshair/config.js +3 -16
- package/components/crosshair/config.js.map +1 -1
- package/components/crosshair/index.d.ts +4 -3
- package/components/crosshair/index.js +4 -3
- package/components/crosshair/index.js.map +1 -1
- package/components/donut/config.d.ts +3 -20
- package/components/donut/config.js +3 -24
- package/components/donut/config.js.map +1 -1
- package/components/donut/index.d.ts +4 -3
- package/components/donut/index.js +5 -4
- package/components/donut/index.js.map +1 -1
- package/components/donut/modules/arc.d.ts +3 -3
- package/components/donut/modules/arc.js.map +1 -1
- package/components/flow-legend/config.d.ts +1 -11
- package/components/flow-legend/config.js +11 -16
- package/components/flow-legend/config.js.map +1 -1
- package/components/flow-legend/index.d.ts +4 -3
- package/components/flow-legend/index.js +5 -2
- package/components/flow-legend/index.js.map +1 -1
- package/components/free-brush/config.d.ts +2 -12
- package/components/free-brush/config.js +11 -20
- package/components/free-brush/config.js.map +1 -1
- package/components/free-brush/index.d.ts +4 -3
- package/components/free-brush/index.js +13 -12
- package/components/free-brush/index.js.map +1 -1
- package/components/graph/config.d.ts +3 -75
- package/components/graph/config.js +13 -79
- package/components/graph/config.js.map +1 -1
- package/components/graph/index.d.ts +8 -7
- package/components/graph/index.js +7 -5
- package/components/graph/index.js.map +1 -1
- package/components/graph/modules/layout.d.ts +7 -7
- package/components/graph/modules/layout.js +7 -2
- package/components/graph/modules/layout.js.map +1 -1
- package/components/graph/modules/link/helper.d.ts +5 -5
- package/components/graph/modules/link/helper.js.map +1 -1
- package/components/graph/modules/link/index.d.ts +6 -6
- package/components/graph/modules/link/index.js.map +1 -1
- package/components/graph/modules/node/helper.d.ts +1 -1
- package/components/graph/modules/node/helper.js.map +1 -1
- package/components/graph/modules/node/index.d.ts +9 -6
- package/components/graph/modules/node/index.js +7 -9
- package/components/graph/modules/node/index.js.map +1 -1
- package/components/graph/modules/panel/helper.d.ts +4 -4
- package/components/graph/modules/panel/helper.js.map +1 -1
- package/components/graph/modules/panel/index.d.ts +3 -3
- package/components/graph/modules/panel/index.js.map +1 -1
- package/components/graph/modules/shape.js +2 -2
- package/components/graph/modules/shape.js.map +1 -1
- package/components/grouped-bar/config.d.ts +5 -13
- package/components/grouped-bar/config.js +3 -16
- package/components/grouped-bar/config.js.map +1 -1
- package/components/grouped-bar/index.d.ts +5 -9
- package/components/grouped-bar/index.js +5 -15
- package/components/grouped-bar/index.js.map +1 -1
- package/components/leaflet-flow-map/config.d.ts +2 -16
- package/components/leaflet-flow-map/config.js +3 -21
- package/components/leaflet-flow-map/config.js.map +1 -1
- package/components/leaflet-flow-map/index.d.ts +4 -3
- package/components/leaflet-flow-map/index.js +3 -2
- package/components/leaflet-flow-map/index.js.map +1 -1
- package/components/leaflet-map/config.d.ts +4 -59
- package/components/leaflet-map/config.js +24 -68
- package/components/leaflet-map/config.js.map +1 -1
- package/components/leaflet-map/index.d.ts +5 -4
- package/components/leaflet-map/index.js +4 -3
- package/components/leaflet-map/index.js.map +1 -1
- package/components/leaflet-map/modules/clusterBackground.d.ts +4 -2
- package/components/leaflet-map/modules/clusterBackground.js.map +1 -1
- package/components/leaflet-map/modules/map.d.ts +4 -4
- package/components/leaflet-map/modules/map.js +6 -6
- package/components/leaflet-map/modules/map.js.map +1 -1
- package/components/leaflet-map/modules/node.d.ts +3 -0
- package/components/leaflet-map/modules/node.js +8 -12
- package/components/leaflet-map/modules/node.js.map +1 -1
- package/components/leaflet-map/modules/utils.d.ts +4 -4
- package/components/leaflet-map/modules/utils.js +6 -2
- package/components/leaflet-map/modules/utils.js.map +1 -1
- package/components/leaflet-map/renderer/mapboxgl-layer.d.ts +2 -2
- package/components/leaflet-map/renderer/mapboxgl-layer.js.map +1 -1
- package/components/leaflet-map/renderer/mapboxgl-utils.d.ts +5 -1
- package/components/leaflet-map/renderer/mapboxgl-utils.js +3 -3
- package/components/leaflet-map/renderer/mapboxgl-utils.js.map +1 -1
- package/components/leaflet-map/style.js.map +1 -1
- package/components/leaflet-map/types.d.ts +5 -1
- package/components/leaflet-map/types.js.map +1 -1
- package/components/line/config.d.ts +6 -11
- package/components/line/config.js +3 -13
- package/components/line/config.js.map +1 -1
- package/components/line/index.d.ts +6 -5
- package/components/line/index.js +7 -6
- package/components/line/index.js.map +1 -1
- package/components/nested-donut/config.d.ts +2 -21
- package/components/nested-donut/config.js +3 -24
- package/components/nested-donut/config.js.map +1 -1
- package/components/nested-donut/index.d.ts +4 -3
- package/components/nested-donut/index.js +18 -8
- package/components/nested-donut/index.js.map +1 -1
- package/components/nested-donut/modules/arc.d.ts +3 -3
- package/components/nested-donut/modules/arc.js.map +1 -1
- package/components/nested-donut/modules/label.d.ts +2 -2
- package/components/nested-donut/modules/label.js.map +1 -1
- package/components/nested-donut/style.js.map +1 -1
- package/components/sankey/config.d.ts +3 -48
- package/components/sankey/config.js +11 -58
- package/components/sankey/config.js.map +1 -1
- package/components/sankey/index.d.ts +4 -3
- package/components/sankey/index.js +3 -2
- package/components/sankey/index.js.map +1 -1
- package/components/sankey/modules/label.d.ts +7 -7
- package/components/sankey/modules/label.js.map +1 -1
- package/components/sankey/modules/link.d.ts +12 -2
- package/components/sankey/modules/link.js +4 -8
- package/components/sankey/modules/link.js.map +1 -1
- package/components/sankey/modules/node.d.ts +7 -7
- package/components/sankey/modules/node.js +1 -1
- package/components/sankey/modules/node.js.map +1 -1
- package/components/scatter/config.d.ts +5 -17
- package/components/scatter/config.js +3 -19
- package/components/scatter/config.js.map +1 -1
- package/components/scatter/index.d.ts +4 -3
- package/components/scatter/index.js +8 -8
- package/components/scatter/index.js.map +1 -1
- package/components/scatter/modules/point.d.ts +2 -2
- package/components/scatter/modules/point.js.map +1 -1
- package/components/scatter/modules/utils.d.ts +2 -2
- package/components/scatter/modules/utils.js.map +1 -1
- package/components/stacked-bar/config.d.ts +5 -13
- package/components/stacked-bar/config.js +3 -16
- package/components/stacked-bar/config.js.map +1 -1
- package/components/stacked-bar/index.d.ts +4 -3
- package/components/stacked-bar/index.js +4 -3
- package/components/stacked-bar/index.js.map +1 -1
- package/components/timeline/config.d.ts +5 -16
- package/components/timeline/config.js +3 -21
- package/components/timeline/config.js.map +1 -1
- package/components/timeline/index.d.ts +4 -3
- package/components/timeline/index.js +4 -3
- package/components/timeline/index.js.map +1 -1
- package/components/tooltip/config.d.ts +1 -15
- package/components/tooltip/config.js +12 -16
- package/components/tooltip/config.js.map +1 -1
- package/components/tooltip/index.d.ts +6 -4
- package/components/tooltip/index.js +15 -6
- package/components/tooltip/index.js.map +1 -1
- package/components/tooltip/style.d.ts +6 -0
- package/components/tooltip/style.js +13 -14
- package/components/tooltip/style.js.map +1 -1
- package/components/topojson-map/config.d.ts +4 -36
- package/components/topojson-map/config.js +3 -38
- package/components/topojson-map/config.js.map +1 -1
- package/components/topojson-map/index.d.ts +4 -3
- package/components/topojson-map/index.js +4 -5
- package/components/topojson-map/index.js.map +1 -1
- package/components/vis-controls/config.d.ts +1 -5
- package/components/vis-controls/config.js +6 -9
- package/components/vis-controls/config.js.map +1 -1
- package/components/vis-controls/index.d.ts +3 -2
- package/components/vis-controls/index.js +5 -2
- package/components/vis-controls/index.js.map +1 -1
- package/components/xy-labels/config.d.ts +4 -16
- package/components/xy-labels/config.js +3 -20
- package/components/xy-labels/config.js.map +1 -1
- package/components/xy-labels/index.d.ts +4 -3
- package/components/xy-labels/index.js +3 -2
- package/components/xy-labels/index.js.map +1 -1
- package/components/xy-labels/modules/label.d.ts +3 -3
- package/components/xy-labels/modules/label.js +1 -1
- package/components/xy-labels/modules/label.js.map +1 -1
- package/containers/single-container/config.d.ts +2 -4
- package/containers/single-container/config.js +3 -8
- package/containers/single-container/config.js.map +1 -1
- package/containers/single-container/index.d.ts +4 -3
- package/containers/single-container/index.js +2 -2
- package/containers/single-container/index.js.map +1 -1
- package/containers/xy-container/config.d.ts +2 -22
- package/containers/xy-container/config.js +3 -26
- package/containers/xy-container/config.js.map +1 -1
- package/containers/xy-container/index.d.ts +5 -2
- package/containers/xy-container/index.js +7 -6
- package/containers/xy-container/index.js.map +1 -1
- package/core/component/config.d.ts +1 -6
- package/core/component/config.js +6 -12
- package/core/component/config.js.map +1 -1
- package/core/component/index.d.ts +7 -5
- package/core/component/index.js +14 -9
- package/core/component/index.js.map +1 -1
- package/core/container/config.d.ts +1 -21
- package/core/container/config.js +21 -25
- package/core/container/config.js.map +1 -1
- package/core/container/index.d.ts +5 -4
- package/core/container/index.js +4 -3
- package/core/container/index.js.map +1 -1
- package/core/xy-component/config.d.ts +2 -10
- package/core/xy-component/config.js +3 -16
- package/core/xy-component/config.js.map +1 -1
- package/core/xy-component/index.d.ts +5 -4
- package/core/xy-component/index.js +2 -0
- package/core/xy-component/index.js.map +1 -1
- package/data-models/map-graph.d.ts +1 -1
- package/data-models/map-graph.js +4 -7
- package/data-models/map-graph.js.map +1 -1
- package/package.json +3 -1
- package/styles/colors.d.ts +2 -2
- package/styles/index.d.ts +1 -1
- package/styles/patterns.js +2 -1
- package/styles/patterns.js.map +1 -1
- package/types/accessor.d.ts +5 -5
- package/types/component.js +2 -0
- package/types/component.js.map +1 -1
- package/utils/d3.d.ts +10 -1
- package/utils/d3.js.map +1 -1
- package/utils/data.d.ts +7 -7
- package/utils/data.js +2 -1
- package/utils/data.js.map +1 -1
- package/utils/text.js +2 -2
- package/utils/text.js.map +1 -1
- package/core/config/index.d.ts +0 -3
- package/core/config/index.js +0 -16
- package/core/config/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../../src/components/timeline/config.ts"],"sourcesContent":["import { XYComponentConfigInterface,
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../src/components/timeline/config.ts"],"sourcesContent":["import { XYComponentConfigInterface, XYComponentDefaultConfig } from 'core/xy-component/config'\n\n// Types\nimport { WithOptional } from 'types/misc'\nimport { ColorAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\n\nexport interface TimelineConfigInterface<Datum> extends WithOptional<XYComponentConfigInterface<Datum>, 'y'> {\n /** Timeline item color accessor function. Default: `d => d.color` */\n color?: ColorAccessor<Datum>;\n /** Width of the timeline items. Default: `8` */\n lineWidth?: NumericAccessor<Datum>;\n /** Display rounded ends for timeline items. Default: `true` */\n lineCap?: boolean;\n /** Timeline row height. Default: `22` */\n rowHeight?: number;\n /** Timeline item length accessor function. Default: `d => d.length` */\n length?: NumericAccessor<Datum>;\n /** Timeline item type accessor function. Records of one type will be plotted in one row. Default: `d => d.type` */\n type?: StringAccessor<Datum>;\n /** Configurable Timeline item cursor when hovering over. Default: `null` */\n cursor?: StringAccessor<Datum>;\n /** Show item type labels when set to `true`. Default: `false` */\n showLabels?: boolean;\n /** Fixed label width in pixels. Labels longer than the specified value will be trimmed. Default: `undefined` */\n labelWidth?: number;\n /** Maximum label width in pixels. Labels longer than the specified value will be trimmed. Default: `120` */\n maxLabelWidth?: number;\n /** Alternating row colors. Default: `true` */\n alternatingRowColors?: boolean;\n /** Scrolling callback function: `(scrollTop: number) => void`. Default: `undefined` */\n onScroll?: (scrollTop: number) => void;\n /** Sets the minimum line length to 1 pixel for better visibility of small values. Default: `false` */\n showEmptySegments?: boolean;\n}\n\nexport const TimelineDefaultConfig: TimelineConfigInterface<unknown> = {\n ...XYComponentDefaultConfig,\n color: (d: unknown): string => (d as { color: string }).color,\n lineWidth: 8,\n lineCap: false,\n rowHeight: 22,\n length: (d: unknown): number => (d as { length: number }).length,\n type: (d: unknown): string => (d as { type: string }).type,\n cursor: null,\n labelWidth: undefined,\n showLabels: false,\n maxLabelWidth: 120,\n alternatingRowColors: true,\n onScroll: undefined,\n showEmptySegments: false,\n}\n"],"names":[],"mappings":";;AAmCa,MAAA,qBAAqB,GAC7B,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,wBAAwB,KAC3B,KAAK,EAAE,CAAC,CAAU,KAAc,CAAuB,CAAC,KAAK,EAC7D,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,KAAK,EACd,SAAS,EAAE,EAAE,EACb,MAAM,EAAE,CAAC,CAAU,KAAc,CAAwB,CAAC,MAAM,EAChE,IAAI,EAAE,CAAC,CAAU,KAAc,CAAsB,CAAC,IAAI,EAC1D,MAAM,EAAE,IAAI,EACZ,UAAU,EAAE,SAAS,EACrB,UAAU,EAAE,KAAK,EACjB,aAAa,EAAE,GAAG,EAClB,oBAAoB,EAAE,IAAI,EAC1B,QAAQ,EAAE,SAAS,EACnB,iBAAiB,EAAE,KAAK;;;;"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { XYComponentCore } from "../../core/xy-component";
|
|
2
|
-
import {
|
|
2
|
+
import { TimelineConfigInterface } from './config';
|
|
3
3
|
import * as s from './style';
|
|
4
|
-
export declare class Timeline<Datum> extends XYComponentCore<Datum,
|
|
4
|
+
export declare class Timeline<Datum> extends XYComponentCore<Datum, TimelineConfigInterface<Datum>> {
|
|
5
5
|
static selectors: typeof s;
|
|
6
|
-
|
|
6
|
+
protected _defaultConfig: TimelineConfigInterface<Datum>;
|
|
7
|
+
config: TimelineConfigInterface<Datum>;
|
|
7
8
|
events: {
|
|
8
9
|
[x: string]: {
|
|
9
10
|
wheel: (d: unknown, event: WheelEvent) => void;
|
|
@@ -7,14 +7,15 @@ import { isNumber, unique, arrayOfIndices, getString, getNumber, getMin, getMax
|
|
|
7
7
|
import { smartTransition } from '../../utils/d3.js';
|
|
8
8
|
import { getColor } from '../../utils/color.js';
|
|
9
9
|
import { trimSVGText } from '../../utils/text.js';
|
|
10
|
-
import {
|
|
10
|
+
import { TimelineDefaultConfig } from './config.js';
|
|
11
11
|
import * as style from './style.js';
|
|
12
12
|
import { background, rows, lines, labels, scrollbar, scrollbarBackground, scrollbarHandle, label, row, rowOdd, line } from './style.js';
|
|
13
13
|
|
|
14
14
|
class Timeline extends XYComponentCore {
|
|
15
15
|
constructor(config) {
|
|
16
16
|
super();
|
|
17
|
-
this.
|
|
17
|
+
this._defaultConfig = TimelineDefaultConfig;
|
|
18
|
+
this.config = this._defaultConfig;
|
|
18
19
|
this.events = {
|
|
19
20
|
[Timeline.selectors.rows]: {
|
|
20
21
|
wheel: this._onMouseWheel.bind(this),
|
|
@@ -30,7 +31,7 @@ class Timeline extends XYComponentCore {
|
|
|
30
31
|
this._scrollbarHeight = 0;
|
|
31
32
|
this._labelMargin = 5;
|
|
32
33
|
if (config)
|
|
33
|
-
this.
|
|
34
|
+
this.setConfig(config);
|
|
34
35
|
// Invisible background rect to track events
|
|
35
36
|
this._background = this.g.append('rect').attr('class', background);
|
|
36
37
|
// Group for content
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/timeline/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\nimport { Transition } from 'd3-transition'\nimport { scaleOrdinal, ScaleOrdinal } from 'd3-scale'\nimport { drag, D3DragEvent } from 'd3-drag'\nimport { max } from 'd3-array'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\n\n// Utils\nimport { isNumber, unique, arrayOfIndices, getMin, getMax, getString, getNumber } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { getColor } from 'utils/color'\nimport { trimSVGText } from 'utils/text'\n\n// Config\nimport { TimelineConfig, TimelineConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\nexport class Timeline<Datum> extends XYComponentCore<Datum, TimelineConfig<Datum>, TimelineConfigInterface<Datum>> {\n static selectors = s\n config: TimelineConfig<Datum> = new TimelineConfig()\n events = {\n [Timeline.selectors.rows]: {\n wheel: this._onMouseWheel.bind(this),\n },\n [Timeline.selectors.line]: {\n wheel: this._onMouseWheel.bind(this),\n },\n }\n\n private _background: Selection<SVGRectElement, unknown, SVGGElement, unknown>\n private _rowsGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _linesGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _labelsGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _scrollBarGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _scrollBarBackground: Selection<SVGRectElement, unknown, SVGGElement, unknown>\n private _scrollBarHandle: Selection<SVGRectElement, unknown, SVGGElement, unknown>\n private _scrollBarWidth = 5\n private _scrollDistance = 0\n private _scrollBarMargin = 5\n private _maxScroll = 0\n private _scrollbarHeight = 0\n private _labelMargin = 5\n\n constructor (config?: TimelineConfigInterface<Datum>) {\n super()\n if (config) this.config.init(config)\n\n // Invisible background rect to track events\n this._background = this.g.append('rect').attr('class', s.background)\n\n // Group for content\n this._rowsGroup = this.g.append('g').attr('class', s.rows)\n this._linesGroup = this.g.append('g').attr('class', s.lines)\n this._labelsGroup = this.g.append('g').attr('class', s.labels)\n this._scrollBarGroup = this.g.append('g').attr('class', s.scrollbar)\n\n // Scroll bar\n this._scrollBarBackground = this._scrollBarGroup.append('rect')\n .attr('class', s.scrollbarBackground)\n\n this._scrollBarHandle = this._scrollBarGroup.append('rect')\n .attr('class', s.scrollbarHandle)\n\n // Set up scrollbar drag event\n const dragBehaviour = drag<SVGRectElement, unknown>()\n .on('drag', this._onScrollbarDrag.bind(this))\n\n this._scrollBarHandle.call(dragBehaviour)\n }\n\n get bleed (): { top: number; bottom: number; left: number; right: number } {\n const { config, datamodel: { data } } = this\n\n // We calculate the longest label width to set the bleed values accordingly\n let labelsBleed = 0\n if (config.showLabels) {\n if (config.labelWidth) labelsBleed = config.labelWidth + this._labelMargin\n else {\n const recordLabels = this._getRecordLabels(data)\n const longestLabel = recordLabels.reduce((acc, val) => acc.length > val.length ? acc : val, '')\n const label = this._labelsGroup.append('text')\n .attr('class', s.label)\n .text(longestLabel)\n .call(trimSVGText, config.maxLabelWidth)\n const labelWidth = label.node().getBBox().width\n this._labelsGroup.empty()\n\n const tolerance = 1.15 // Some characters are wider than others so we add a little of extra space to take that into account\n labelsBleed = labelWidth ? tolerance * labelWidth + this._labelMargin : 0\n }\n }\n\n const maxLineWidth = this._getMaxLineWidth()\n return {\n top: 0,\n bottom: 0,\n left: maxLineWidth / 2 + labelsBleed,\n right: maxLineWidth / 2 + this._scrollBarWidth + this._scrollBarMargin,\n }\n }\n\n _render (customDuration?: number): void {\n super._render(customDuration)\n const { config, datamodel: { data } } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n const xRange = this.xScale.range()\n const yRange = this.yScale.range()\n const yStart = Math.min(...yRange)\n const yHeight = Math.abs(yRange[1] - yRange[0])\n const maxLineWidth = this._getMaxLineWidth()\n const recordLabels = this._getRecordLabels(data)\n const recordLabelsUnique = unique(recordLabels)\n const numUniqueRecords = recordLabelsUnique.length\n\n // Ordinal scale to handle records on the same type\n const ordinalScale: ScaleOrdinal<string, number> = scaleOrdinal()\n ordinalScale.range(arrayOfIndices(numUniqueRecords))\n\n // Invisible Background rect to track events\n this._background\n .attr('width', this._width)\n .attr('height', this._height)\n .attr('opacity', 0)\n\n // Labels\n const labels = this._labelsGroup.selectAll<SVGTextElement, string>(`.${s.label}`)\n .data(config.showLabels ? recordLabelsUnique : [])\n\n const labelsEnter = labels.enter().append('text')\n .attr('class', s.label)\n\n labelsEnter.merge(labels)\n .attr('x', xRange[0] - maxLineWidth / 2 - this._labelMargin)\n .attr('y', (label, i) => yStart + (ordinalScale(label) + 0.5) * config.rowHeight)\n .text(label => label)\n .each((label, i, els) => {\n trimSVGText(select(els[i]), config.labelWidth || config.maxLabelWidth)\n })\n\n labels.exit().remove()\n\n // Row background rects\n const xStart = xRange[0]\n const numRows = Math.max(Math.floor(yHeight / config.rowHeight), numUniqueRecords)\n const recordTypes: (string | undefined)[] = Array(numRows).fill(null).map((_, i) => recordLabelsUnique[i])\n const rects = this._rowsGroup.selectAll<SVGRectElement, number>(`.${s.row}`)\n .data(recordTypes)\n\n const rectsEnter = rects.enter().append('rect')\n .attr('class', s.row)\n\n rectsEnter.merge(rects)\n .classed(s.rowOdd, config.alternatingRowColors ? (_, i) => !(i % 2) : null)\n .attr('x', xStart - maxLineWidth / 2)\n .attr('width', xRange[1] - xStart + maxLineWidth)\n .attr('y', (_, i) => yStart + i * config.rowHeight)\n .attr('height', config.rowHeight)\n\n rects.exit().remove()\n\n // Lines\n const lines = this._linesGroup.selectAll<SVGRectElement, Datum>(`.${s.line}`)\n .data(data, (d: Datum, i) => `${getString(d, config.id, i) ?? i}`)\n const linesEnter = lines.enter().append('rect')\n .attr('class', s.line)\n .classed(s.rowOdd, config.alternatingRowColors\n ? (d, i) => !(recordLabelsUnique.indexOf(this._getRecordType(d, i)) % 2)\n : null)\n .style('fill', (d, i) => getColor(d, config.color, i))\n .attr('transform', 'translate(0, 10)')\n .style('opacity', 0)\n this._positionLines(linesEnter, ordinalScale)\n\n const linesMerged = smartTransition(linesEnter.merge(lines), duration)\n .style('fill', (d, i) => getColor(d, config.color, ordinalScale(this._getRecordType(d, i))))\n .attr('transform', 'translate(0, 0)')\n .style('cursor', (d, i) => getString(d, config.cursor, i))\n .style('opacity', 1)\n\n this._positionLines(linesMerged, ordinalScale)\n\n smartTransition(lines.exit(), duration)\n .style('opacity', 0)\n .remove()\n\n // Scroll Bar\n const contentBBox = this._rowsGroup.node().getBBox() // We determine content size using the rects group because lines are animated\n const absoluteContentHeight = contentBBox.height\n this._scrollbarHeight = yHeight * yHeight / absoluteContentHeight || 0\n this._maxScroll = Math.max(absoluteContentHeight - yHeight, 0)\n\n this._scrollBarGroup\n .attr('transform', `translate(${this._width - this._scrollBarWidth}, ${yStart})`)\n .attr('opacity', this._maxScroll ? 1 : 0)\n\n this._scrollBarBackground\n .attr('width', this._scrollBarWidth)\n .attr('height', this._height)\n .attr('rx', this._scrollBarWidth / 2)\n .attr('ry', this._scrollBarWidth / 2)\n\n this._scrollBarHandle\n .attr('width', this._scrollBarWidth)\n .attr('height', this._scrollbarHeight)\n .attr('rx', this._scrollBarWidth / 2)\n .attr('ry', this._scrollBarWidth / 2)\n\n this._updateScrollPosition(0)\n }\n\n private _positionLines (\n selection: Selection<SVGRectElement, Datum, SVGGElement, unknown> | Transition<SVGRectElement, Datum, SVGGElement, unknown>,\n ordinalScale: ScaleOrdinal<string, number>\n ): void {\n const { config, xScale, yScale } = this\n const yRange = yScale.range()\n const yStart = Math.min(...yRange)\n\n selection.each((d, i, elements) => {\n const x = getNumber(d, config.x, i)\n const y = ordinalScale(this._getRecordType(d, i)) * config.rowHeight\n const length = getNumber(d, config.length, i) ?? 0\n\n // Rect dimensions\n const height = getNumber(d, config.lineWidth, i)\n const width = xScale(x + length) - xScale(x)\n\n if (width < 0) {\n console.warn('Unovis | Timeline: Line segments should not have negative lengths. Setting to 0.')\n }\n\n select(elements[i])\n .attr('x', xScale(x))\n .attr('y', yStart + y + (config.rowHeight - height) / 2)\n .attr('width', config.showEmptySegments\n ? Math.max(config.lineCap ? height : 1, width)\n : Math.max(0, width))\n .attr('height', height)\n .attr('rx', config.lineCap ? height / 2 : null)\n .style('opacity', 1)\n })\n }\n\n private _onScrollbarDrag (event: D3DragEvent<any, any, any>): void {\n const yRange = this.yScale.range()\n const yHeight = Math.abs(yRange[1] - yRange[0])\n this._updateScrollPosition(event.dy * this._maxScroll / (yHeight - this._scrollbarHeight))\n }\n\n private _onMouseWheel (d: unknown, event: WheelEvent): void {\n const { config } = this\n\n this._updateScrollPosition(event?.deltaY)\n if (this._scrollDistance > 0 && this._scrollDistance < this._maxScroll) event?.preventDefault()\n\n config.onScroll?.(this._scrollDistance)\n\n // Programmatically trigger a mousemove event to update Tooltip or Crosshair if they were set up\n const e = new Event('mousemove')\n this.element.dispatchEvent(e)\n }\n\n private _updateScrollPosition (diff: number): void {\n const yRange = this.yScale.range()\n const yHeight = Math.abs(yRange[1] - yRange[0])\n\n this._scrollDistance += diff\n this._scrollDistance = Math.max(0, this._scrollDistance)\n this._scrollDistance = Math.min(this._maxScroll, this._scrollDistance)\n\n this._linesGroup.attr('transform', `translate(0,${-this._scrollDistance})`)\n this._rowsGroup.attr('transform', `translate(0,${-this._scrollDistance})`)\n this._labelsGroup.attr('transform', `translate(0,${-this._scrollDistance})`)\n const scrollBarPosition = (this._scrollDistance / this._maxScroll * (yHeight - this._scrollbarHeight)) || 0\n this._scrollBarHandle.attr('y', scrollBarPosition)\n }\n\n private _getMaxLineWidth (): number {\n const { config, datamodel: { data } } = this\n return max(data, (d, i) => getNumber(d, config.lineWidth, i)) ?? 0\n }\n\n private _getRecordType (d: Datum, i: number): string {\n return getString(d, this.config.type) || `__${i}`\n }\n\n private _getRecordLabels (data: Datum[]): string[] {\n return data.map((d, i) => getString(d, this.config.type) || `${i + 1}`)\n }\n\n // Override the default XYComponent getXDataExtent method to take into account line lengths\n getXDataExtent (): number[] {\n const { config, datamodel } = this\n const min = getMin(datamodel.data, config.x)\n const max = getMax(datamodel.data, (d, i) => getNumber(d, config.x, i) + (getNumber(d, config.length, i) ?? 0))\n return [min, max]\n }\n}\n"],"names":["s.background","s.rows","s.lines","s.labels","s.scrollbar","s.scrollbarBackground","s.scrollbarHandle","label","s.label","s.row","s.rowOdd","s.line","s"],"mappings":";;;;;;;;;;;;;AAqBM,MAAO,QAAgB,SAAQ,eAA6E,CAAA;AA0BhH,IAAA,WAAA,CAAa,MAAuC,EAAA;AAClD,QAAA,KAAK,EAAE,CAAA;AAzBT,QAAA,IAAA,CAAA,MAAM,GAA0B,IAAI,cAAc,EAAE,CAAA;AACpD,QAAA,IAAA,CAAA,MAAM,GAAG;AACP,YAAA,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,GAAG;gBACzB,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;AACrC,aAAA;AACD,YAAA,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,GAAG;gBACzB,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;AACrC,aAAA;SACF,CAAA;QASO,IAAe,CAAA,eAAA,GAAG,CAAC,CAAA;QACnB,IAAe,CAAA,eAAA,GAAG,CAAC,CAAA;QACnB,IAAgB,CAAA,gBAAA,GAAG,CAAC,CAAA;QACpB,IAAU,CAAA,UAAA,GAAG,CAAC,CAAA;QACd,IAAgB,CAAA,gBAAA,GAAG,CAAC,CAAA;QACpB,IAAY,CAAA,YAAA,GAAG,CAAC,CAAA;AAItB,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC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AC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAG,EAAA,CAAC,GAAG,CAAC,CAAE,CAAA,CAAC,CAAA;KACxE;;IAGD,cAAc,GAAA;AACZ,QAAA,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAA;AAClC,QAAA,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;QAC5C,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,EAAA,IAAA,EAAA,CAAA,CAAA,OAAA,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAA,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,CAAC,CAAC,CAAA,EAAA,CAAC,CAAA;AAC/G,QAAA,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;KAClB;;AAtRM,QAAS,CAAA,SAAA,GAAGE,KAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/timeline/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\nimport { Transition } from 'd3-transition'\nimport { scaleOrdinal, ScaleOrdinal } from 'd3-scale'\nimport { drag, D3DragEvent } from 'd3-drag'\nimport { max } from 'd3-array'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\n\n// Utils\nimport { isNumber, unique, arrayOfIndices, getMin, getMax, getString, getNumber } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { getColor } from 'utils/color'\nimport { trimSVGText } from 'utils/text'\n\n// Config\nimport { TimelineDefaultConfig, TimelineConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\nexport class Timeline<Datum> extends XYComponentCore<Datum, TimelineConfigInterface<Datum>> {\n static selectors = s\n protected _defaultConfig = TimelineDefaultConfig as TimelineConfigInterface<Datum>\n public config: TimelineConfigInterface<Datum> = this._defaultConfig\n\n events = {\n [Timeline.selectors.rows]: {\n wheel: this._onMouseWheel.bind(this),\n },\n [Timeline.selectors.line]: {\n wheel: this._onMouseWheel.bind(this),\n },\n }\n\n private _background: Selection<SVGRectElement, unknown, SVGGElement, unknown>\n private _rowsGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _linesGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _labelsGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _scrollBarGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _scrollBarBackground: Selection<SVGRectElement, unknown, SVGGElement, unknown>\n private _scrollBarHandle: Selection<SVGRectElement, unknown, SVGGElement, unknown>\n private _scrollBarWidth = 5\n private _scrollDistance = 0\n private _scrollBarMargin = 5\n private _maxScroll = 0\n private _scrollbarHeight = 0\n private _labelMargin = 5\n\n constructor (config?: TimelineConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n\n // Invisible background rect to track events\n this._background = this.g.append('rect').attr('class', s.background)\n\n // Group for content\n this._rowsGroup = this.g.append('g').attr('class', s.rows)\n this._linesGroup = this.g.append('g').attr('class', s.lines)\n this._labelsGroup = this.g.append('g').attr('class', s.labels)\n this._scrollBarGroup = this.g.append('g').attr('class', s.scrollbar)\n\n // Scroll bar\n this._scrollBarBackground = this._scrollBarGroup.append('rect')\n .attr('class', s.scrollbarBackground)\n\n this._scrollBarHandle = this._scrollBarGroup.append('rect')\n .attr('class', s.scrollbarHandle)\n\n // Set up scrollbar drag event\n const dragBehaviour = drag<SVGRectElement, unknown>()\n .on('drag', this._onScrollbarDrag.bind(this))\n\n this._scrollBarHandle.call(dragBehaviour)\n }\n\n get bleed (): { top: number; bottom: number; left: number; right: number } {\n const { config, datamodel: { data } } = this\n\n // We calculate the longest label width to set the bleed values accordingly\n let labelsBleed = 0\n if (config.showLabels) {\n if (config.labelWidth) labelsBleed = config.labelWidth + this._labelMargin\n else {\n const recordLabels = this._getRecordLabels(data)\n const longestLabel = recordLabels.reduce((acc, val) => acc.length > val.length ? acc : val, '')\n const label = this._labelsGroup.append('text')\n .attr('class', s.label)\n .text(longestLabel)\n .call(trimSVGText, config.maxLabelWidth)\n const labelWidth = label.node().getBBox().width\n this._labelsGroup.empty()\n\n const tolerance = 1.15 // Some characters are wider than others so we add a little of extra space to take that into account\n labelsBleed = labelWidth ? tolerance * labelWidth + this._labelMargin : 0\n }\n }\n\n const maxLineWidth = this._getMaxLineWidth()\n return {\n top: 0,\n bottom: 0,\n left: maxLineWidth / 2 + labelsBleed,\n right: maxLineWidth / 2 + this._scrollBarWidth + this._scrollBarMargin,\n }\n }\n\n _render (customDuration?: number): void {\n super._render(customDuration)\n const { config, datamodel: { data } } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n const xRange = this.xScale.range()\n const yRange = this.yScale.range()\n const yStart = Math.min(...yRange)\n const yHeight = Math.abs(yRange[1] - yRange[0])\n const maxLineWidth = this._getMaxLineWidth()\n const recordLabels = this._getRecordLabels(data)\n const recordLabelsUnique = unique(recordLabels)\n const numUniqueRecords = recordLabelsUnique.length\n\n // Ordinal scale to handle records on the same type\n const ordinalScale: ScaleOrdinal<string, number> = scaleOrdinal()\n ordinalScale.range(arrayOfIndices(numUniqueRecords))\n\n // Invisible Background rect to track events\n this._background\n .attr('width', this._width)\n .attr('height', this._height)\n .attr('opacity', 0)\n\n // Labels\n const labels = this._labelsGroup.selectAll<SVGTextElement, string>(`.${s.label}`)\n .data(config.showLabels ? recordLabelsUnique : [])\n\n const labelsEnter = labels.enter().append('text')\n .attr('class', s.label)\n\n labelsEnter.merge(labels)\n .attr('x', xRange[0] - maxLineWidth / 2 - this._labelMargin)\n .attr('y', (label, i) => yStart + (ordinalScale(label) + 0.5) * config.rowHeight)\n .text(label => label)\n .each((label, i, els) => {\n trimSVGText(select(els[i]), config.labelWidth || config.maxLabelWidth)\n })\n\n labels.exit().remove()\n\n // Row background rects\n const xStart = xRange[0]\n const numRows = Math.max(Math.floor(yHeight / config.rowHeight), numUniqueRecords)\n const recordTypes: (string | undefined)[] = Array(numRows).fill(null).map((_, i) => recordLabelsUnique[i])\n const rects = this._rowsGroup.selectAll<SVGRectElement, number>(`.${s.row}`)\n .data(recordTypes)\n\n const rectsEnter = rects.enter().append('rect')\n .attr('class', s.row)\n\n rectsEnter.merge(rects)\n .classed(s.rowOdd, config.alternatingRowColors ? (_, i) => !(i % 2) : null)\n .attr('x', xStart - maxLineWidth / 2)\n .attr('width', xRange[1] - xStart + maxLineWidth)\n .attr('y', (_, i) => yStart + i * config.rowHeight)\n .attr('height', config.rowHeight)\n\n rects.exit().remove()\n\n // Lines\n const lines = this._linesGroup.selectAll<SVGRectElement, Datum>(`.${s.line}`)\n .data(data, (d: Datum, i) => `${getString(d, config.id, i) ?? i}`)\n const linesEnter = lines.enter().append('rect')\n .attr('class', s.line)\n .classed(s.rowOdd, config.alternatingRowColors\n ? (d, i) => !(recordLabelsUnique.indexOf(this._getRecordType(d, i)) % 2)\n : null)\n .style('fill', (d, i) => getColor(d, config.color, i))\n .attr('transform', 'translate(0, 10)')\n .style('opacity', 0)\n this._positionLines(linesEnter, ordinalScale)\n\n const linesMerged = smartTransition(linesEnter.merge(lines), duration)\n .style('fill', (d, i) => getColor(d, config.color, ordinalScale(this._getRecordType(d, i))))\n .attr('transform', 'translate(0, 0)')\n .style('cursor', (d, i) => getString(d, config.cursor, i))\n .style('opacity', 1)\n\n this._positionLines(linesMerged, ordinalScale)\n\n smartTransition(lines.exit(), duration)\n .style('opacity', 0)\n .remove()\n\n // Scroll Bar\n const contentBBox = this._rowsGroup.node().getBBox() // We determine content size using the rects group because lines are animated\n const absoluteContentHeight = contentBBox.height\n this._scrollbarHeight = yHeight * yHeight / absoluteContentHeight || 0\n this._maxScroll = Math.max(absoluteContentHeight - yHeight, 0)\n\n this._scrollBarGroup\n .attr('transform', `translate(${this._width - this._scrollBarWidth}, ${yStart})`)\n .attr('opacity', this._maxScroll ? 1 : 0)\n\n this._scrollBarBackground\n .attr('width', this._scrollBarWidth)\n .attr('height', this._height)\n .attr('rx', this._scrollBarWidth / 2)\n .attr('ry', this._scrollBarWidth / 2)\n\n this._scrollBarHandle\n .attr('width', this._scrollBarWidth)\n .attr('height', this._scrollbarHeight)\n .attr('rx', this._scrollBarWidth / 2)\n .attr('ry', this._scrollBarWidth / 2)\n\n this._updateScrollPosition(0)\n }\n\n private _positionLines (\n selection: Selection<SVGRectElement, Datum, SVGGElement, unknown> | Transition<SVGRectElement, Datum, SVGGElement, unknown>,\n ordinalScale: ScaleOrdinal<string, number>\n ): void {\n const { config, xScale, yScale } = this\n const yRange = yScale.range()\n const yStart = Math.min(...yRange)\n\n selection.each((d, i, elements) => {\n const x = getNumber(d, config.x, i)\n const y = ordinalScale(this._getRecordType(d, i)) * config.rowHeight\n const length = getNumber(d, config.length, i) ?? 0\n\n // Rect dimensions\n const height = getNumber(d, config.lineWidth, i)\n const width = xScale(x + length) - xScale(x)\n\n if (width < 0) {\n console.warn('Unovis | Timeline: Line segments should not have negative lengths. Setting to 0.')\n }\n\n select(elements[i])\n .attr('x', xScale(x))\n .attr('y', yStart + y + (config.rowHeight - height) / 2)\n .attr('width', config.showEmptySegments\n ? Math.max(config.lineCap ? height : 1, width)\n : Math.max(0, width))\n .attr('height', height)\n .attr('rx', config.lineCap ? height / 2 : null)\n .style('opacity', 1)\n })\n }\n\n private _onScrollbarDrag (event: D3DragEvent<any, any, any>): void {\n const yRange = this.yScale.range()\n const yHeight = Math.abs(yRange[1] - yRange[0])\n this._updateScrollPosition(event.dy * this._maxScroll / (yHeight - this._scrollbarHeight))\n }\n\n private _onMouseWheel (d: unknown, event: WheelEvent): void {\n const { config } = this\n\n this._updateScrollPosition(event?.deltaY)\n if (this._scrollDistance > 0 && this._scrollDistance < this._maxScroll) event?.preventDefault()\n\n config.onScroll?.(this._scrollDistance)\n\n // Programmatically trigger a mousemove event to update Tooltip or Crosshair if they were set up\n const e = new Event('mousemove')\n this.element.dispatchEvent(e)\n }\n\n private _updateScrollPosition (diff: number): void {\n const yRange = this.yScale.range()\n const yHeight = Math.abs(yRange[1] - yRange[0])\n\n this._scrollDistance += diff\n this._scrollDistance = Math.max(0, this._scrollDistance)\n this._scrollDistance = Math.min(this._maxScroll, this._scrollDistance)\n\n this._linesGroup.attr('transform', `translate(0,${-this._scrollDistance})`)\n this._rowsGroup.attr('transform', `translate(0,${-this._scrollDistance})`)\n this._labelsGroup.attr('transform', `translate(0,${-this._scrollDistance})`)\n const scrollBarPosition = (this._scrollDistance / this._maxScroll * (yHeight - this._scrollbarHeight)) || 0\n this._scrollBarHandle.attr('y', scrollBarPosition)\n }\n\n private _getMaxLineWidth (): number {\n const { config, datamodel: { data } } = this\n return max(data, (d, i) => getNumber(d, config.lineWidth, i)) ?? 0\n }\n\n private _getRecordType (d: Datum, i: number): string {\n return getString(d, this.config.type) || `__${i}`\n }\n\n private _getRecordLabels (data: Datum[]): string[] {\n return data.map((d, i) => getString(d, this.config.type) || `${i + 1}`)\n }\n\n // Override the default XYComponent getXDataExtent method to take into account line lengths\n getXDataExtent (): number[] {\n const { config, datamodel } = this\n const min = getMin(datamodel.data, config.x)\n const max = getMax(datamodel.data, (d, i) => getNumber(d, config.x, i) + (getNumber(d, config.length, i) ?? 0))\n return [min, max]\n }\n}\n"],"names":["s.background","s.rows","s.lines","s.labels","s.scrollbar","s.scrollbarBackground","s.scrollbarHandle","label","s.label","s.row","s.rowOdd","s.line","s"],"mappings":";;;;;;;;;;;;;AAqBM,MAAO,QAAgB,SAAQ,eAAsD,CAAA;AA4BzF,IAAA,WAAA,CAAa,MAAuC,EAAA;AAClD,QAAA,KAAK,EAAE,CAAA;QA3BC,IAAc,CAAA,cAAA,GAAG,qBAAuD,CAAA;AAC3E,QAAA,IAAA,CAAA,MAAM,GAAmC,IAAI,CAAC,cAAc,CAAA;AAEnE,QAAA,IAAA,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AC,CAAA;AAC/G,QAAA,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;KAClB;;AAxRM,QAAS,CAAA,SAAA,GAAGE,KAAC;;;;"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Config } from "../../core/config";
|
|
2
1
|
import { ComponentCore } from "../../core/component";
|
|
3
2
|
import { Position } from "../../types/position";
|
|
4
3
|
export interface TooltipConfigInterface {
|
|
@@ -52,17 +51,4 @@ export interface TooltipConfigInterface {
|
|
|
52
51
|
[attr: string]: string | number | boolean;
|
|
53
52
|
};
|
|
54
53
|
}
|
|
55
|
-
export declare
|
|
56
|
-
components: ComponentCore<unknown>[];
|
|
57
|
-
container: any;
|
|
58
|
-
horizontalPlacement: Position;
|
|
59
|
-
horizontalShift: number;
|
|
60
|
-
verticalPlacement: Position;
|
|
61
|
-
verticalShift: number;
|
|
62
|
-
attributes: {
|
|
63
|
-
[attr: string]: string | number | boolean;
|
|
64
|
-
};
|
|
65
|
-
triggers: {
|
|
66
|
-
[selector: string]: (data: any, i: number, elements: (HTMLElement | SVGElement)[]) => string | HTMLElement | undefined | null;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
54
|
+
export declare const TooltipDefaultConfig: TooltipConfigInterface;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import { Config } from '../../core/config/index.js';
|
|
2
1
|
import { Position } from '../../types/position.js';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this.triggers = {};
|
|
16
|
-
}
|
|
17
|
-
}
|
|
3
|
+
// Types
|
|
4
|
+
const TooltipDefaultConfig = {
|
|
5
|
+
components: [],
|
|
6
|
+
container: undefined,
|
|
7
|
+
horizontalPlacement: Position.Auto,
|
|
8
|
+
horizontalShift: 0,
|
|
9
|
+
verticalPlacement: Position.Top,
|
|
10
|
+
verticalShift: 0,
|
|
11
|
+
attributes: {},
|
|
12
|
+
triggers: {},
|
|
13
|
+
};
|
|
18
14
|
|
|
19
|
-
export {
|
|
15
|
+
export { TooltipDefaultConfig };
|
|
20
16
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../../src/components/tooltip/config.ts"],"sourcesContent":["/* eslint-disable no-irregular-whitespace */\nimport {
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../src/components/tooltip/config.ts"],"sourcesContent":["/* eslint-disable no-irregular-whitespace */\nimport { ComponentCore } from 'core/component'\n\n// Types\nimport { Position } from 'types/position'\n\nexport interface TooltipConfigInterface {\n /** An array of visualization components to interact with. Default: `[]` */\n components?: ComponentCore<unknown>[];\n /** Container to where the Tooltip component should be inserted. Default: `undefined` */\n container?: HTMLElement;\n /** Horizontal placement of the tooltip. Default: `Position.Auto` */\n horizontalPlacement?: Position | string | undefined;\n /** Horizontal shift of the tooltip in pixels. Default: `0` */\n horizontalShift?: number;\n /** Vertical placement of the tooltip. Default: `Position.Top` */\n verticalPlacement?: Position | string | undefined;\n /** Vertical shift of the tooltip in pixels. Default: `0` */\n verticalShift?: number;\n /** Defines the content of the tooltip and hovering over which elements should trigger it.\n * An object containing properties in the following format:\n *\n * ```\n * {\n * [selectorString]: (d: unknown) => string | HTMLElement\n * }\n * ```\n * e.g.:\n * ```\n * {\n * [Area.selectors.area]: (d: AreaDatum[]) => `<div>${d.value.toString()}</div>\n * }\n * ```\n */\n triggers?: {\n [selector: string]: (data: any, i: number, elements: (HTMLElement | SVGElement)[]) => string | HTMLElement | undefined | null;\n };\n /** Custom DOM attributes for the tooltip. Useful when you need to refer to a specific tooltip instance\n * by using a CSS selector. Attributes configuration object has the following structure:\n *\n * ```\n * {\n * [attributeName]: attribute value\n * }\n * ```\n * e.g.:\n * ```\n * {\n * 'type': 'area-tooltip',\n * 'value': 42\n * }\n * ```\n */\n attributes?: { [attr: string]: string | number | boolean };\n}\n\nexport const TooltipDefaultConfig: TooltipConfigInterface = {\n components: [],\n container: undefined,\n horizontalPlacement: Position.Auto,\n horizontalShift: 0,\n verticalPlacement: Position.Top,\n verticalShift: 0,\n attributes: {},\n triggers: {},\n}\n\n"],"names":[],"mappings":";;AAGA;AAqDa,MAAA,oBAAoB,GAA2B;AAC1D,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,SAAS,EAAE,SAAS;IACpB,mBAAmB,EAAE,QAAQ,CAAC,IAAI;AAClC,IAAA,eAAe,EAAE,CAAC;IAClB,iBAAiB,EAAE,QAAQ,CAAC,GAAG;AAC/B,IAAA,aAAa,EAAE,CAAC;AAChB,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,QAAQ,EAAE,EAAE;;;;;"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { Selection } from 'd3-selection';
|
|
2
2
|
import { ComponentCore } from "../../core/component";
|
|
3
|
-
import {
|
|
3
|
+
import { TooltipConfigInterface } from './config';
|
|
4
|
+
import * as s from './style';
|
|
4
5
|
export declare class Tooltip {
|
|
5
6
|
element: HTMLElement;
|
|
6
7
|
div: Selection<HTMLElement, unknown, null, undefined>;
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
protected _defaultConfig: TooltipConfigInterface;
|
|
9
|
+
config: TooltipConfigInterface;
|
|
10
|
+
prevConfig: TooltipConfigInterface;
|
|
9
11
|
components: ComponentCore<unknown>[];
|
|
10
|
-
static selectors:
|
|
12
|
+
static selectors: typeof s;
|
|
11
13
|
private _setUpEventsThrottled;
|
|
12
14
|
private _setContainerPositionThrottled;
|
|
13
15
|
private _isShown;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { select, pointer } from 'd3-selection';
|
|
2
2
|
import { Position } from '../../types/position.js';
|
|
3
|
-
import { throttle } from '../../utils/data.js';
|
|
4
|
-
import {
|
|
3
|
+
import { throttle, merge } from '../../utils/data.js';
|
|
4
|
+
import { TooltipDefaultConfig } from './config.js';
|
|
5
5
|
import * as style from './style.js';
|
|
6
|
-
import { tooltip, show, positionFixed } from './style.js';
|
|
6
|
+
import { tooltip, hidden, show, positionFixed } from './style.js';
|
|
7
7
|
|
|
8
8
|
class Tooltip {
|
|
9
9
|
constructor(config = {}) {
|
|
10
|
+
this._defaultConfig = TooltipDefaultConfig;
|
|
11
|
+
this.config = this._defaultConfig;
|
|
10
12
|
this._setUpEventsThrottled = throttle(this._setUpEvents, 500);
|
|
11
13
|
this._setContainerPositionThrottled = throttle(this._setContainerPosition, 500);
|
|
12
14
|
this._isShown = false;
|
|
@@ -19,7 +21,7 @@ class Tooltip {
|
|
|
19
21
|
setConfig(config) {
|
|
20
22
|
var _a;
|
|
21
23
|
this.prevConfig = this.config;
|
|
22
|
-
this.config =
|
|
24
|
+
this.config = merge(this._defaultConfig, config);
|
|
23
25
|
if (this.config.container && (this.config.container !== ((_a = this.prevConfig) === null || _a === void 0 ? void 0 : _a.container))) {
|
|
24
26
|
this.setContainer(this.config.container);
|
|
25
27
|
}
|
|
@@ -55,12 +57,19 @@ class Tooltip {
|
|
|
55
57
|
else {
|
|
56
58
|
this.div.html(html);
|
|
57
59
|
}
|
|
58
|
-
this.div
|
|
60
|
+
this.div
|
|
61
|
+
.classed(hidden, false)
|
|
62
|
+
.classed(show, true);
|
|
59
63
|
this._isShown = true;
|
|
60
64
|
this.place(pos);
|
|
61
65
|
}
|
|
62
66
|
hide() {
|
|
63
|
-
this.div.classed(show, false)
|
|
67
|
+
this.div.classed(show, false)
|
|
68
|
+
.on('transitionend', () => {
|
|
69
|
+
// We hide the element once the transition completes
|
|
70
|
+
// This ensures container overflow will not occur when the window is resized
|
|
71
|
+
this.div.classed(hidden, !this._isShown);
|
|
72
|
+
});
|
|
64
73
|
this._isShown = false;
|
|
65
74
|
}
|
|
66
75
|
place(pos) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/tooltip/index.ts"],"sourcesContent":["import { select, Selection, pointer } from 'd3-selection'\n\n// Core\nimport { ComponentCore } from 'core/component'\n\n// Types\nimport { Position } from 'types/position'\n\n// Utils\nimport { throttle } from 'utils/data'\n\n// Config\nimport { TooltipConfig, TooltipConfigInterface } from './config'\n\n// Style\nimport * as s from './style'\n\nexport class Tooltip {\n element: HTMLElement\n div: Selection<HTMLElement, unknown, null, undefined>\n config: TooltipConfig\n prevConfig: TooltipConfig\n components: ComponentCore<unknown>[]\n static selectors = s\n private _setUpEventsThrottled = throttle(this._setUpEvents, 500)\n private _setContainerPositionThrottled = throttle(this._setContainerPosition, 500)\n private _isShown = false\n private _container: HTMLElement\n\n constructor (config: TooltipConfigInterface = {}) {\n this.element = document.createElement('div')\n this.div = select(this.element)\n .attr('class', s.tooltip)\n\n this.setConfig(config)\n this.components = this.config.components\n }\n\n public setConfig (config: TooltipConfigInterface): void {\n this.prevConfig = this.config\n this.config = new TooltipConfig().init(config)\n\n if (this.config.container && (this.config.container !== this.prevConfig?.container)) {\n this.setContainer(this.config.container)\n }\n\n this._setUpAttributes()\n }\n\n public setContainer (container: HTMLElement): void {\n this.element.parentNode?.removeChild(this.element)\n\n this._container = container\n this._container.appendChild(this.element)\n\n this._setContainerPositionThrottled()\n }\n\n public getContainer (): HTMLElement {\n return this._container\n }\n\n public hasContainer (): boolean {\n return !!this._container && this._container.isConnected\n }\n\n public setComponents (components: ComponentCore<unknown>[]): void {\n this.components = components\n }\n\n public update (): void {\n if (!this._container) return\n\n this._setUpEventsThrottled()\n }\n\n public show (html: string | HTMLElement, pos: { x: number; y: number }): void {\n if (html instanceof HTMLElement) {\n const node = this.div.select(':first-child').node()\n if (node !== html) this.div.html('').append(() => html)\n } else {\n this.div.html(html)\n }\n\n this.div.classed(s.show, true)\n this._isShown = true\n this.place(pos)\n }\n\n public hide (): void {\n this.div.classed(s.show, false)\n this._isShown = false\n }\n\n public place (pos: { x: number; y: number }): void {\n if (!this.hasContainer()) {\n console.warn('Unovis | Tooltip: Container was not set or is not initialized yet')\n return\n }\n const { config } = this\n const isContainerBody = this.isContainerBody()\n const width = this.element.offsetWidth\n const height = this.element.offsetHeight\n const containerHeight = isContainerBody ? window.innerHeight : this._container.scrollHeight\n const containerWidth = isContainerBody ? window.innerWidth : this._container.scrollWidth\n\n const horizontalPlacement = config.horizontalPlacement === Position.Auto\n ? (pos.x > containerWidth / 2 ? Position.Left : Position.Right)\n : config.horizontalPlacement\n\n const verticalPlacement = config.verticalPlacement === Position.Auto\n ? (pos.y > containerHeight / 2 ? Position.Top : Position.Bottom)\n : config.verticalPlacement\n\n // dx and dy variables shift the tooltip from the default position (above the cursor, centred horizontally)\n const margin = 5\n const dx = horizontalPlacement === Position.Left ? -width - margin - config.horizontalShift\n : horizontalPlacement === Position.Center ? -width / 2\n : margin + config.horizontalShift\n const dy = verticalPlacement === Position.Bottom ? height + margin + config.verticalShift\n : verticalPlacement === Position.Center ? height / 2\n : -margin - config.verticalShift\n\n // Constraint to container\n const paddingX = 10\n const hitRight = pos.x > (containerWidth - width - dx - paddingX)\n const hitLeft = pos.x < -dx + paddingX\n const constraintX = hitRight ? (containerWidth - width - dx) - pos.x - paddingX\n : hitLeft ? -dx - pos.x + paddingX : 0\n\n const paddingY = 10\n const hitBottom = pos.y > (containerHeight - dy - paddingY)\n const hitTop = pos.y < (height - dy + paddingY)\n const constraintY = hitBottom ? containerHeight - dy - pos.y - paddingY\n : hitTop ? height - dy - pos.y + paddingY : 0\n\n // Placing\n // If the container size is smaller than the the tooltip size we just stick the tooltip to the top / left\n const x = containerWidth < width ? 0 : pos.x + constraintX + dx\n const y = containerHeight < height ? height : pos.y + constraintY + dy\n\n this.div\n .classed(s.positionFixed, isContainerBody)\n .style('top', isContainerBody ? `${y - height}px` : 'unset')\n .style('bottom', !isContainerBody ? `${containerHeight - y}px` : 'unset')\n .style('left', `${x}px`)\n }\n\n public isContainerBody (): boolean {\n return this._container === document.body\n }\n\n private _setContainerPosition (): void {\n // Tooltip position calculation relies on the parent position\n // If it's not set (static), we set it to `relative` (not a good practice)\n if (getComputedStyle(this._container)?.position === 'static') {\n this._container.style.position = 'relative'\n }\n }\n\n private _setUpEvents (): void {\n const { config: { triggers } } = this\n const isContainerBody = this.isContainerBody()\n\n // We use the Event Delegation pattern to set up Tooltip events\n // Every component will have single `mousemove` and `mouseleave` event listener functions, where we'll check\n // the `path` of the event and trigger corresponding callbacks\n this.components.forEach(component => {\n const selection = select(component.element)\n selection\n .on('mousemove.tooltip', (e: MouseEvent) => {\n const [x, y] = isContainerBody ? [e.clientX, e.clientY] : pointer(e, this._container)\n const path: (HTMLElement | SVGGElement)[] = (e.composedPath && e.composedPath()) || (e as any).path || [e.target]\n\n // Go through all of the configured triggers\n for (const className of Object.keys(triggers)) {\n const template = triggers[className]\n const els = selection.selectAll<HTMLElement | SVGGElement, unknown>(`.${className}`).nodes()\n\n // Go through all of the elements in the event path (from the deepest element upwards)\n for (const el of path) {\n if (el === selection.node()) break // Break on the component's level (usually the `<g>` element)\n if (el.classList.contains(className)) { // If there's a match, show the tooltip\n const i = els.indexOf(el)\n const d = select(el).datum()\n const content = template(d, i, els)\n if (content) this.show(content, { x, y })\n else this.hide()\n\n e.stopPropagation() // Stop propagation to prevent other interfering events from being triggered, e.g. Crosshair\n return // Stop looking for other matches\n }\n }\n }\n\n // Hide the tooltip if the event didn't pass through any of the configured triggers.\n // We use the `this._isShown` condition as a little performance optimization tweak\n // (we don't want the tooltip to update its class on every mouse movement, see `this.hide()`).\n if (this._isShown) this.hide()\n })\n .on('mouseleave.tooltip', (e: MouseEvent) => {\n e.stopPropagation() // Stop propagation to prevent other interfering events from being triggered, e.g. Crosshair\n this.hide()\n })\n })\n }\n\n private _setUpAttributes (): void {\n const attributesMap = this.config.attributes\n if (!attributesMap) return\n\n Object.keys(attributesMap).forEach(attr => {\n this.div.attr(attr, attributesMap[attr])\n })\n }\n\n public destroy (): void {\n this.div?.remove()\n }\n}\n"],"names":["s.tooltip","s.show","s.positionFixed","s"],"mappings":";;;;;;;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,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAA;AACnC,4BAAA,IAAI,OAAO;gCAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;;gCACpC,IAAI,CAAC,IAAI,EAAE,CAAA;AAEhB,4BAAA,CAAC,CAAC,eAAe,EAAE,CAAA;AACnB,4BAAA,OAAM;AACP,yBAAA;AACF,qBAAA;AACF,iBAAA;;;;gBAKD,IAAI,IAAI,CAAC,QAAQ;oBAAE,IAAI,CAAC,IAAI,EAAE,CAAA;AAChC,aAAC,CAAC;AACD,iBAAA,EAAE,CAAC,oBAAoB,EAAE,CAAC,CAAa,KAAI;AAC1C,gBAAA,CAAC,CAAC,eAAe,EAAE,CAAA;gBACnB,IAAI,CAAC,IAAI,EAAE,CAAA;AACb,aAAC,CAAC,CAAA;AACN,SAAC,CAAC,CAAA;KACH;IAEO,gBAAgB,GAAA;AACtB,QAAA,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAA;AAC5C,QAAA,IAAI,CAAC,aAAa;YAAE,OAAM;QAE1B,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,IAAI,IAAG;AACxC,YAAA,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAA;AAC1C,SAAC,CAAC,CAAA;KACH;IAEM,OAAO,GAAA;;AACZ,QAAA,CAAA,EAAA,GAAA,IAAI,CAAC,GAAG,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAM,EAAE,CAAA;KACnB;;AAnMM,OAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/tooltip/index.ts"],"sourcesContent":["import { select, Selection, pointer } from 'd3-selection'\n\n// Core\nimport { ComponentCore } from 'core/component'\n\n// Types\nimport { Position } from 'types/position'\n\n// Utils\nimport { merge, throttle } from 'utils/data'\n\n// Config\nimport { TooltipDefaultConfig, TooltipConfigInterface } from './config'\n\n// Style\nimport * as s from './style'\n\nexport class Tooltip {\n element: HTMLElement\n div: Selection<HTMLElement, unknown, null, undefined>\n protected _defaultConfig = TooltipDefaultConfig as TooltipConfigInterface\n public config: TooltipConfigInterface = this._defaultConfig\n prevConfig: TooltipConfigInterface\n components: ComponentCore<unknown>[]\n static selectors = s\n private _setUpEventsThrottled = throttle(this._setUpEvents, 500)\n private _setContainerPositionThrottled = throttle(this._setContainerPosition, 500)\n private _isShown = false\n private _container: HTMLElement\n\n constructor (config: TooltipConfigInterface = {}) {\n this.element = document.createElement('div')\n this.div = select(this.element)\n .attr('class', s.tooltip)\n\n this.setConfig(config)\n this.components = this.config.components\n }\n\n public setConfig (config: TooltipConfigInterface): void {\n this.prevConfig = this.config\n this.config = merge(this._defaultConfig, config)\n\n if (this.config.container && (this.config.container !== this.prevConfig?.container)) {\n this.setContainer(this.config.container)\n }\n\n this._setUpAttributes()\n }\n\n public setContainer (container: HTMLElement): void {\n this.element.parentNode?.removeChild(this.element)\n\n this._container = container\n this._container.appendChild(this.element)\n\n this._setContainerPositionThrottled()\n }\n\n public getContainer (): HTMLElement {\n return this._container\n }\n\n public hasContainer (): boolean {\n return !!this._container && this._container.isConnected\n }\n\n public setComponents (components: ComponentCore<unknown>[]): void {\n this.components = components\n }\n\n public update (): void {\n if (!this._container) return\n\n this._setUpEventsThrottled()\n }\n\n public show (html: string | HTMLElement, pos: { x: number; y: number }): void {\n if (html instanceof HTMLElement) {\n const node = this.div.select(':first-child').node()\n if (node !== html) this.div.html('').append(() => html)\n } else {\n this.div.html(html)\n }\n\n this.div\n .classed(s.hidden, false)\n .classed(s.show, true)\n\n this._isShown = true\n this.place(pos)\n }\n\n public hide (): void {\n this.div.classed(s.show, false)\n .on('transitionend', () => {\n // We hide the element once the transition completes\n // This ensures container overflow will not occur when the window is resized\n this.div.classed(s.hidden, !this._isShown)\n })\n\n this._isShown = false\n }\n\n public place (pos: { x: number; y: number }): void {\n if (!this.hasContainer()) {\n console.warn('Unovis | Tooltip: Container was not set or is not initialized yet')\n return\n }\n const { config } = this\n const isContainerBody = this.isContainerBody()\n const width = this.element.offsetWidth\n const height = this.element.offsetHeight\n const containerHeight = isContainerBody ? window.innerHeight : this._container.scrollHeight\n const containerWidth = isContainerBody ? window.innerWidth : this._container.scrollWidth\n\n const horizontalPlacement = config.horizontalPlacement === Position.Auto\n ? (pos.x > containerWidth / 2 ? Position.Left : Position.Right)\n : config.horizontalPlacement\n\n const verticalPlacement = config.verticalPlacement === Position.Auto\n ? (pos.y > containerHeight / 2 ? Position.Top : Position.Bottom)\n : config.verticalPlacement\n\n // dx and dy variables shift the tooltip from the default position (above the cursor, centred horizontally)\n const margin = 5\n const dx = horizontalPlacement === Position.Left ? -width - margin - config.horizontalShift\n : horizontalPlacement === Position.Center ? -width / 2\n : margin + config.horizontalShift\n const dy = verticalPlacement === Position.Bottom ? height + margin + config.verticalShift\n : verticalPlacement === Position.Center ? height / 2\n : -margin - config.verticalShift\n\n // Constraint to container\n const paddingX = 10\n const hitRight = pos.x > (containerWidth - width - dx - paddingX)\n const hitLeft = pos.x < -dx + paddingX\n const constraintX = hitRight ? (containerWidth - width - dx) - pos.x - paddingX\n : hitLeft ? -dx - pos.x + paddingX : 0\n\n const paddingY = 10\n const hitBottom = pos.y > (containerHeight - dy - paddingY)\n const hitTop = pos.y < (height - dy + paddingY)\n const constraintY = hitBottom ? containerHeight - dy - pos.y - paddingY\n : hitTop ? height - dy - pos.y + paddingY : 0\n\n // Placing\n // If the container size is smaller than the the tooltip size we just stick the tooltip to the top / left\n const x = containerWidth < width ? 0 : pos.x + constraintX + dx\n const y = containerHeight < height ? height : pos.y + constraintY + dy\n\n this.div\n .classed(s.positionFixed, isContainerBody)\n .style('top', isContainerBody ? `${y - height}px` : 'unset')\n .style('bottom', !isContainerBody ? `${containerHeight - y}px` : 'unset')\n .style('left', `${x}px`)\n }\n\n public isContainerBody (): boolean {\n return this._container === document.body\n }\n\n private _setContainerPosition (): void {\n // Tooltip position calculation relies on the parent position\n // If it's not set (static), we set it to `relative` (not a good practice)\n if (getComputedStyle(this._container)?.position === 'static') {\n this._container.style.position = 'relative'\n }\n }\n\n private _setUpEvents (): void {\n const { config: { triggers } } = this\n const isContainerBody = this.isContainerBody()\n\n // We use the Event Delegation pattern to set up Tooltip events\n // Every component will have single `mousemove` and `mouseleave` event listener functions, where we'll check\n // the `path` of the event and trigger corresponding callbacks\n this.components.forEach(component => {\n const selection = select(component.element)\n selection\n .on('mousemove.tooltip', (e: MouseEvent) => {\n const [x, y] = isContainerBody ? [e.clientX, e.clientY] : pointer(e, this._container)\n const path: (HTMLElement | SVGGElement)[] = (e.composedPath && e.composedPath()) || (e as any).path || [e.target]\n\n // Go through all of the configured triggers\n for (const className of Object.keys(triggers)) {\n const template = triggers[className]\n const els = selection.selectAll<HTMLElement | SVGGElement, unknown>(`.${className}`).nodes()\n\n // Go through all of the elements in the event path (from the deepest element upwards)\n for (const el of path) {\n if (el === selection.node()) break // Break on the component's level (usually the `<g>` element)\n if (el.classList.contains(className)) { // If there's a match, show the tooltip\n const i = els.indexOf(el)\n const d = select(el).datum()\n const content = template(d, i, els)\n if (content) this.show(content, { x, y })\n else this.hide()\n\n e.stopPropagation() // Stop propagation to prevent other interfering events from being triggered, e.g. Crosshair\n return // Stop looking for other matches\n }\n }\n }\n\n // Hide the tooltip if the event didn't pass through any of the configured triggers.\n // We use the `this._isShown` condition as a little performance optimization tweak\n // (we don't want the tooltip to update its class on every mouse movement, see `this.hide()`).\n if (this._isShown) this.hide()\n })\n .on('mouseleave.tooltip', (e: MouseEvent) => {\n e.stopPropagation() // Stop propagation to prevent other interfering events from being triggered, e.g. Crosshair\n this.hide()\n })\n })\n }\n\n private _setUpAttributes (): void {\n const attributesMap = this.config.attributes\n if (!attributesMap) return\n\n Object.keys(attributesMap).forEach(attr => {\n this.div.attr(attr, attributesMap[attr])\n })\n }\n\n public destroy (): void {\n this.div?.remove()\n }\n}\n"],"names":["s.tooltip","s.hidden","s.show","s.positionFixed","s"],"mappings":";;;;;;;MAiBa,OAAO,CAAA;AAalB,IAAA,WAAA,CAAa,SAAiC,EAAE,EAAA;QAVtC,IAAc,CAAA,cAAA,GAAG,oBAA8C,CAAA;AAClE,QAAA,IAAA,CAAA,MAAM,GAA2B,IAAI,CAAC,cAAc,CAAA;QAInD,IAAqB,CAAA,qBAAA,GAAG,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,CAAA;QACxD,IAA8B,CAAA,8BAAA,GAAG,QAAQ,CAAC,IAAI,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAA;QAC1E,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAA;QAItB,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QAC5C,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;AAC5B,aAAA,IAAI,CAAC,OAAO,EAAEA,OAAS,CAAC,CAAA;AAE3B,QAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAA;KACzC;AAEM,IAAA,SAAS,CAAE,MAA8B,EAAA;;AAC9C,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAA;QAC7B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;QAEhD,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,KAAK,IAAI,CAAC,MAAM,CAAC,SAAS,MAAK,MAAA,IAAI,CAAC,UAAU,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,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AAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,IAAI,IAAG;AACxC,YAAA,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAA;AAC1C,SAAC,CAAC,CAAA;KACH;IAEM,OAAO,GAAA;;AACZ,QAAA,CAAA,EAAA,GAAA,IAAI,CAAC,GAAG,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAM,EAAE,CAAA;KACnB;;AA5MM,OAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { css, injectGlobal } from '@emotion/css';
|
|
2
2
|
|
|
3
|
-
const root = css`
|
|
3
|
+
const root = css `
|
|
4
4
|
label: tooltip;
|
|
5
|
-
`;
|
|
6
|
-
|
|
7
|
-
const variables = injectGlobal`
|
|
5
|
+
`;
|
|
6
|
+
const variables = injectGlobal `
|
|
8
7
|
:root {
|
|
9
8
|
--vis-tooltip-background-color: rgba(255, 255, 255, 0.95);
|
|
10
9
|
--vis-tooltip-border-color: #e5e9f7;
|
|
@@ -32,9 +31,8 @@ const variables = injectGlobal`
|
|
|
32
31
|
--vis-tooltip-border-color: var(--vis-color-grey);
|
|
33
32
|
--vis-tooltip-shadow-color: rgba(0,0,0, 0.95);
|
|
34
33
|
}
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
const tooltip = css`
|
|
34
|
+
`;
|
|
35
|
+
const tooltip = css `
|
|
38
36
|
label: tooltip;
|
|
39
37
|
display: inline-block;
|
|
40
38
|
left: 0;
|
|
@@ -57,16 +55,17 @@ const tooltip = css`
|
|
|
57
55
|
border: solid 1px var(--vis-tooltip-border-color);
|
|
58
56
|
background-color: var(--vis-tooltip-background-color);
|
|
59
57
|
backdrop-filter: var(--vis-tooltip-backdrop-filter);
|
|
60
|
-
`;
|
|
61
|
-
|
|
62
|
-
const positionFixed = css`
|
|
58
|
+
`;
|
|
59
|
+
const positionFixed = css `
|
|
63
60
|
bottom: unset;
|
|
64
61
|
position: fixed;
|
|
65
|
-
`;
|
|
66
|
-
|
|
67
|
-
const show = css`
|
|
62
|
+
`;
|
|
63
|
+
const show = css `
|
|
68
64
|
opacity: 1;
|
|
65
|
+
`;
|
|
66
|
+
const hidden = css `
|
|
67
|
+
display: none;
|
|
69
68
|
`;
|
|
70
69
|
|
|
71
|
-
export { positionFixed, root, show, tooltip, variables };
|
|
70
|
+
export { hidden, positionFixed, root, show, tooltip, variables };
|
|
72
71
|
//# sourceMappingURL=style.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sources":["../../../src/components/tooltip/style.
|
|
1
|
+
{"version":3,"file":"style.js","sources":["../../../src/components/tooltip/style.ts"],"sourcesContent":["import { css, injectGlobal } from '@emotion/css'\n\nexport const root = css`\n label: tooltip;\n`\n\nexport const variables = injectGlobal`\n :root {\n --vis-tooltip-background-color: rgba(255, 255, 255, 0.95);\n --vis-tooltip-border-color: #e5e9f7;\n --vis-tooltip-text-color: #000;\n --vis-tooltip-shadow-color: rgba(172, 179, 184, 0.35);\n --vis-tooltip-backdrop-filter: none;\n --vis-tooltip-padding: 10px 15px;\n\n --vis-dark-tooltip-background-color: rgba(30,30,30, 0.95);\n --vis-dark-tooltip-text-color: #e5e9f7;\n --vis-dark-tooltip-border-color: var(--vis-color-grey);\n --vis-dark-tooltip-shadow-color: rgba(0,0,0, 0.95);\n }\n\n body.theme-dark ${`.${root}`} {\n --vis-tooltip-background-color: var(--vis-dark-tooltip-background-color);\n --vis-tooltip-text-color: var(--vis-dark-tooltip-text-color);\n --vis-tooltip-border-color: var(--vis-dark-tooltip-border-color);\n --vis-tooltip-shadow-color: var(--vis-dark-tooltip-shadow-color);\n }\n\n body.theme-dark {\n --vis-tooltip-background-color: rgba(30,30,30, 0.95);\n --vis-tooltip-text-color: #e5e9f7;\n --vis-tooltip-border-color: var(--vis-color-grey);\n --vis-tooltip-shadow-color: rgba(0,0,0, 0.95);\n }\n`\n\nexport const tooltip = css`\n label: tooltip;\n display: inline-block;\n left: 0;\n bottom: 0;\n min-width: max-content;\n position: absolute;\n pointer-events: none;\n opacity: 0;\n transition: opacity;\n transition-duration: 300ms;\n user-select: none;\n z-index: 999999;\n padding: var(--vis-tooltip-padding);\n transform: translate(0, -5px);\n color: var(--vis-tooltip-text-color);\n\n /* object-fit: contain; */\n border-radius: 5px;\n box-shadow: 0 13px 25px 0 var(--vis-tooltip-box-shadow);\n border: solid 1px var(--vis-tooltip-border-color);\n background-color: var(--vis-tooltip-background-color);\n backdrop-filter: var(--vis-tooltip-backdrop-filter);\n`\n\nexport const positionFixed = css`\n bottom: unset;\n position: fixed;\n`\n\nexport const show = css`\n opacity: 1;\n`\n\nexport const hidden = css`\n display: none;\n`\n"],"names":[],"mappings":";;AAEO,MAAM,IAAI,GAAG,GAAG,CAAA,CAAA;;EAEtB;AAEM,MAAM,SAAS,GAAG,YAAY,CAAA,CAAA;;;;;;;;;;;;;;;AAejB,kBAAA,EAAA,CAAA,CAAA,EAAI,IAAI,CAAE,CAAA,CAAA;;;;;;;;;;;;;EAa7B;AAEM,MAAM,OAAO,GAAG,GAAG,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBzB;AAEM,MAAM,aAAa,GAAG,GAAG,CAAA,CAAA;;;EAG/B;AAEM,MAAM,IAAI,GAAG,GAAG,CAAA,CAAA;;EAEtB;AAEM,MAAM,MAAM,GAAG,GAAG,CAAA,CAAA;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GeoProjection } from 'd3-geo';
|
|
2
|
-
import { ComponentConfigInterface
|
|
2
|
+
import { ComponentConfigInterface } from "../../core/component/config";
|
|
3
3
|
import { ColorAccessor, NumericAccessor, StringAccessor } from "../../types/accessor";
|
|
4
4
|
import { MapPointLabelPosition } from './types';
|
|
5
5
|
export interface TopoJSONMapConfigInterface<AreaDatum, PointDatum = unknown, LinkDatum = unknown> extends ComponentConfigInterface {
|
|
@@ -24,7 +24,7 @@ export interface TopoJSONMapConfigInterface<AreaDatum, PointDatum = unknown, Lin
|
|
|
24
24
|
/** Link color value or accessor function. Default: `d => d.color ?? null` */
|
|
25
25
|
linkColor?: ColorAccessor<LinkDatum>;
|
|
26
26
|
/** Link cursor value or accessor function. Default: `null` */
|
|
27
|
-
linkCursor?: StringAccessor<
|
|
27
|
+
linkCursor?: StringAccessor<LinkDatum>;
|
|
28
28
|
/** Link id accessor function. Default: `d => d.id` */
|
|
29
29
|
linkId?: StringAccessor<LinkDatum>;
|
|
30
30
|
/** Link source accessor function. Default: `d => d.source` */
|
|
@@ -44,7 +44,7 @@ export interface TopoJSONMapConfigInterface<AreaDatum, PointDatum = unknown, Lin
|
|
|
44
44
|
/** Point stroke width accessor. Default: `d => d.strokeWidth ?? null` */
|
|
45
45
|
pointStrokeWidth?: NumericAccessor<PointDatum>;
|
|
46
46
|
/** Point cursor constant value or accessor function. Default: `null` */
|
|
47
|
-
pointCursor?: StringAccessor<
|
|
47
|
+
pointCursor?: StringAccessor<PointDatum>;
|
|
48
48
|
/** Point longitude accessor function. Default: `d => d.longitude ?? null` */
|
|
49
49
|
longitude?: NumericAccessor<PointDatum>;
|
|
50
50
|
/** Point latitude accessor function. Default: `d => d.latitude ?? null` */
|
|
@@ -64,36 +64,4 @@ export interface TopoJSONMapConfigInterface<AreaDatum, PointDatum = unknown, Lin
|
|
|
64
64
|
/** Zoom level at which the heatmap mode will be disabled. Default: `2.5` */
|
|
65
65
|
heatmapModeZoomLevelThreshold?: number;
|
|
66
66
|
}
|
|
67
|
-
export declare
|
|
68
|
-
projection: GeoProjection;
|
|
69
|
-
duration: number;
|
|
70
|
-
topojson: any;
|
|
71
|
-
mapFeatureName: string;
|
|
72
|
-
mapFitToPoints: boolean;
|
|
73
|
-
zoomExtent: number[];
|
|
74
|
-
zoomDuration: number;
|
|
75
|
-
disableZoom: boolean;
|
|
76
|
-
zoomFactor: any;
|
|
77
|
-
linkWidth: (d: LinkDatum) => number;
|
|
78
|
-
linkColor: (d: LinkDatum) => string;
|
|
79
|
-
linkCursor: any;
|
|
80
|
-
linkId: (d: LinkDatum, i: number | undefined) => string;
|
|
81
|
-
linkSource: (d: LinkDatum) => (number | string | PointDatum);
|
|
82
|
-
linkTarget: (d: LinkDatum) => (number | string | PointDatum);
|
|
83
|
-
areaId: (d: AreaDatum) => string;
|
|
84
|
-
areaColor: (d: AreaDatum) => string;
|
|
85
|
-
areaCursor: any;
|
|
86
|
-
longitude: (d: PointDatum) => number;
|
|
87
|
-
latitude: (d: PointDatum) => number;
|
|
88
|
-
pointColor: (d: PointDatum) => string;
|
|
89
|
-
pointRadius: (d: PointDatum) => number;
|
|
90
|
-
pointStrokeWidth: (d: PointDatum) => number;
|
|
91
|
-
pointCursor: any;
|
|
92
|
-
pointLabel: any;
|
|
93
|
-
pointLabelPosition: MapPointLabelPosition;
|
|
94
|
-
pointLabelTextBrightnessRatio: number;
|
|
95
|
-
pointId: (d: PointDatum) => string;
|
|
96
|
-
heatmapMode: boolean;
|
|
97
|
-
heatmapModeBlurStdDeviation: number;
|
|
98
|
-
heatmapModeZoomLevelThreshold: number;
|
|
99
|
-
}
|
|
67
|
+
export declare const TopoJSONMapDefaultConfig: TopoJSONMapConfigInterface<unknown, unknown, unknown>;
|
|
@@ -1,42 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentDefaultConfig } from '../../core/component/config.js';
|
|
2
2
|
import { MapProjection, MapPointLabelPosition } from './types.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.projection = MapProjection.Kavrayskiy7();
|
|
8
|
-
this.duration = 1500;
|
|
9
|
-
this.topojson = undefined;
|
|
10
|
-
this.mapFeatureName = 'countries';
|
|
11
|
-
this.mapFitToPoints = false;
|
|
12
|
-
this.zoomExtent = [0.5, 6];
|
|
13
|
-
this.zoomDuration = 400;
|
|
14
|
-
this.disableZoom = false;
|
|
15
|
-
this.zoomFactor = undefined;
|
|
16
|
-
this.linkWidth = (d) => { var _a; return (_a = d['width']) !== null && _a !== void 0 ? _a : 1; };
|
|
17
|
-
this.linkColor = (d) => { var _a; return (_a = d['color']) !== null && _a !== void 0 ? _a : null; };
|
|
18
|
-
this.linkCursor = null;
|
|
19
|
-
this.linkId = (d, i) => { var _a; return `${(_a = d['id']) !== null && _a !== void 0 ? _a : i}`; };
|
|
20
|
-
this.linkSource = (d) => d['source'];
|
|
21
|
-
this.linkTarget = (d) => d['target'];
|
|
22
|
-
this.areaId = (d) => { var _a; return (_a = d['id']) !== null && _a !== void 0 ? _a : ''; };
|
|
23
|
-
this.areaColor = (d) => { var _a; return (_a = d['color']) !== null && _a !== void 0 ? _a : null; };
|
|
24
|
-
this.areaCursor = null;
|
|
25
|
-
this.longitude = (d) => d['longitude'];
|
|
26
|
-
this.latitude = (d) => d['latitude'];
|
|
27
|
-
this.pointColor = (d) => { var _a; return (_a = d['color']) !== null && _a !== void 0 ? _a : null; };
|
|
28
|
-
this.pointRadius = (d) => { var _a; return (_a = d['radius']) !== null && _a !== void 0 ? _a : 8; };
|
|
29
|
-
this.pointStrokeWidth = (d) => { var _a; return (_a = d['strokeWidth']) !== null && _a !== void 0 ? _a : 0; };
|
|
30
|
-
this.pointCursor = null;
|
|
31
|
-
this.pointLabel = undefined;
|
|
32
|
-
this.pointLabelPosition = MapPointLabelPosition.Bottom;
|
|
33
|
-
this.pointLabelTextBrightnessRatio = 0.65;
|
|
34
|
-
this.pointId = (d) => d['id'];
|
|
35
|
-
this.heatmapMode = false;
|
|
36
|
-
this.heatmapModeBlurStdDeviation = 8;
|
|
37
|
-
this.heatmapModeZoomLevelThreshold = 2.5;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
4
|
+
const TopoJSONMapDefaultConfig = Object.assign(Object.assign({}, ComponentDefaultConfig), { projection: MapProjection.Kavrayskiy7(), duration: 1500, topojson: undefined, mapFeatureName: 'countries', mapFitToPoints: false, zoomExtent: [0.5, 6], zoomDuration: 400, disableZoom: false, zoomFactor: undefined, linkWidth: (d) => { var _a; return (_a = d.width) !== null && _a !== void 0 ? _a : 1; }, linkColor: (d) => { var _a; return (_a = d.color) !== null && _a !== void 0 ? _a : null; }, linkCursor: null, linkId: (d, i) => { var _a; return `${(_a = d.id) !== null && _a !== void 0 ? _a : i}`; }, linkSource: (d) => d.source, linkTarget: (d) => d.target, areaId: (d) => { var _a; return (_a = d.id) !== null && _a !== void 0 ? _a : ''; }, areaColor: (d) => { var _a; return (_a = d.color) !== null && _a !== void 0 ? _a : null; }, areaCursor: null, longitude: (d) => d.longitude, latitude: (d) => d.latitude, pointColor: (d) => { var _a; return (_a = d.color) !== null && _a !== void 0 ? _a : null; }, pointRadius: (d) => { var _a; return (_a = d.radius) !== null && _a !== void 0 ? _a : 8; }, pointStrokeWidth: (d) => { var _a; return (_a = d.strokeWidth) !== null && _a !== void 0 ? _a : 0; }, pointCursor: null, pointLabel: undefined, pointLabelPosition: MapPointLabelPosition.Bottom, pointLabelTextBrightnessRatio: 0.65, pointId: (d) => d.id, heatmapMode: false, heatmapModeBlurStdDeviation: 8, heatmapModeZoomLevelThreshold: 2.5 });
|
|
40
5
|
|
|
41
|
-
export {
|
|
6
|
+
export { TopoJSONMapDefaultConfig };
|
|
42
7
|
//# sourceMappingURL=config.js.map
|