@progress/kendo-charts 2.4.0-dev.202405211537 → 2.4.0-dev.202406100726
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/dist/cdn/js/kendo-charts.js +1 -1
- package/dist/cdn/main.js +1 -1
- package/dist/es/chart/legend/legend-layout.js +4 -2
- package/dist/es/common/event-map.js +17 -0
- package/dist/es/common/event-utils.js +61 -0
- package/dist/es/common/get-supported-features.js +55 -0
- package/dist/es/common/noop.js +1 -0
- package/dist/es/common/now.js +3 -0
- package/dist/es/common/observable.js +1 -3
- package/dist/es/{map/scroller → common}/user-events.js +43 -131
- package/dist/es/common.js +7 -0
- package/dist/es/map/layers/layer.js +2 -5
- package/dist/es/map/layers/marker.js +3 -3
- package/dist/es/map/map.js +6 -6
- package/dist/es/map/navigator.js +3 -3
- package/dist/es/map/scroller/draggable.js +6 -11
- package/dist/es/map/scroller/fx.js +2 -2
- package/dist/es/map/scroller/scroller.js +7 -12
- package/dist/es/map/utils.js +9 -339
- package/dist/es/map/zoom.js +3 -3
- package/dist/es/sankey/label.js +21 -7
- package/dist/es/sankey/legend.js +16 -4
- package/dist/es/sankey/link.js +11 -4
- package/dist/es/sankey/sankey.js +67 -15
- package/dist/es/services/dom-events-builder.js +2 -4
- package/dist/es2015/chart/legend/legend-layout.js +4 -2
- package/dist/es2015/common/event-map.js +17 -0
- package/dist/es2015/common/event-utils.js +61 -0
- package/dist/es2015/common/get-supported-features.js +55 -0
- package/dist/es2015/common/noop.js +1 -0
- package/dist/es2015/common/now.js +3 -0
- package/dist/es2015/common/observable.js +1 -3
- package/dist/es2015/{map/scroller → common}/user-events.js +39 -131
- package/dist/es2015/common.js +7 -0
- package/dist/es2015/map/layers/layer.js +2 -5
- package/dist/es2015/map/layers/marker.js +3 -3
- package/dist/es2015/map/map.js +6 -6
- package/dist/es2015/map/navigator.js +3 -3
- package/dist/es2015/map/scroller/draggable.js +6 -11
- package/dist/es2015/map/scroller/fx.js +2 -2
- package/dist/es2015/map/scroller/scroller.js +7 -12
- package/dist/es2015/map/utils.js +8 -339
- package/dist/es2015/map/zoom.js +3 -3
- package/dist/es2015/sankey/label.js +19 -6
- package/dist/es2015/sankey/legend.js +15 -5
- package/dist/es2015/sankey/link.js +9 -4
- package/dist/es2015/sankey/sankey.js +66 -17
- package/dist/es2015/services/dom-events-builder.js +2 -4
- package/dist/npm/main.js +2795 -2975
- package/dist/npm/sankey.d.ts +4 -0
- package/dist/systemjs/kendo-charts.js +1 -1
- package/package.json +1 -1
|
@@ -13,6 +13,27 @@ import { defined } from '../drawing-utils';
|
|
|
13
13
|
const LINK = 'link';
|
|
14
14
|
const NODE = 'node';
|
|
15
15
|
|
|
16
|
+
const toRtl = sankey => {
|
|
17
|
+
const { nodes, links } = sankey;
|
|
18
|
+
const startX = Math.min(...nodes.map(node => node.x0));
|
|
19
|
+
const endX = Math.max(...nodes.map(node => node.x1));
|
|
20
|
+
const width = endX - startX;
|
|
21
|
+
|
|
22
|
+
nodes.forEach(node => {
|
|
23
|
+
const x0 = width - (node.x1 - 2 * startX);
|
|
24
|
+
const x1 = width - (node.x0 - 2 * startX);
|
|
25
|
+
node.x0 = x0;
|
|
26
|
+
node.x1 = x1;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
links.forEach(link => {
|
|
30
|
+
const x0 = width - (link.x1 - 2 * startX);
|
|
31
|
+
const x1 = width - (link.x0 - 2 * startX);
|
|
32
|
+
link.x1 = x0;
|
|
33
|
+
link.x0 = x1;
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
16
37
|
export class Sankey extends Observable {
|
|
17
38
|
constructor(element, options, theme) {
|
|
18
39
|
super();
|
|
@@ -91,11 +112,15 @@ export class Sankey extends Observable {
|
|
|
91
112
|
element.addEventListener('pointerdown', this._onDownHandler);
|
|
92
113
|
|
|
93
114
|
this._focusState = {
|
|
94
|
-
node: this.
|
|
115
|
+
node: this.firstFocusableNode(),
|
|
95
116
|
link: null
|
|
96
117
|
};
|
|
97
118
|
}
|
|
98
119
|
|
|
120
|
+
firstFocusableNode() {
|
|
121
|
+
return this.columns[0][0];
|
|
122
|
+
}
|
|
123
|
+
|
|
99
124
|
_initResizeObserver() {
|
|
100
125
|
const observer = new ResizeObserver((entries) => {
|
|
101
126
|
entries.forEach(entry => {
|
|
@@ -147,10 +172,13 @@ export class Sankey extends Observable {
|
|
|
147
172
|
}
|
|
148
173
|
|
|
149
174
|
trigger(name, ev) {
|
|
175
|
+
let dataItem = ev.element.dataItem;
|
|
176
|
+
const targetType = ev.element.type;
|
|
177
|
+
|
|
150
178
|
const event = Object.assign({}, ev,
|
|
151
179
|
{type: name,
|
|
152
|
-
targetType
|
|
153
|
-
dataItem:
|
|
180
|
+
targetType,
|
|
181
|
+
dataItem: dataItem});
|
|
154
182
|
|
|
155
183
|
return super.trigger(name, event);
|
|
156
184
|
}
|
|
@@ -416,7 +444,14 @@ export class Sankey extends Observable {
|
|
|
416
444
|
}
|
|
417
445
|
|
|
418
446
|
_keydown(ev) {
|
|
419
|
-
|
|
447
|
+
let handler = this['on' + ev.key];
|
|
448
|
+
const rtl = this.options.rtl;
|
|
449
|
+
|
|
450
|
+
if (rtl && ev.key === 'ArrowLeft') {
|
|
451
|
+
handler = this.onArrowRight;
|
|
452
|
+
} else if (rtl && ev.key === 'ArrowRight') {
|
|
453
|
+
handler = this.onArrowLeft;
|
|
454
|
+
}
|
|
420
455
|
|
|
421
456
|
if (handler) {
|
|
422
457
|
handler.call(this, ev);
|
|
@@ -426,7 +461,7 @@ export class Sankey extends Observable {
|
|
|
426
461
|
onEscape(ev) {
|
|
427
462
|
ev.preventDefault();
|
|
428
463
|
|
|
429
|
-
this._focusState = { node: this.
|
|
464
|
+
this._focusState = { node: this.firstFocusableNode(), link: null };
|
|
430
465
|
this._focusNode();
|
|
431
466
|
}
|
|
432
467
|
|
|
@@ -557,7 +592,7 @@ export class Sankey extends Observable {
|
|
|
557
592
|
}
|
|
558
593
|
|
|
559
594
|
calculateSankey(calcOptions, sankeyOptions) {
|
|
560
|
-
const { title, legend, data, nodes, labels, nodeColors, disableAutoLayout, disableKeyboardNavigation } = sankeyOptions;
|
|
595
|
+
const { title, legend, data, nodes, labels, nodeColors, disableAutoLayout, disableKeyboardNavigation, rtl } = sankeyOptions;
|
|
561
596
|
const autoLayout = !disableAutoLayout;
|
|
562
597
|
const padding = disableKeyboardNavigation ? 0 : highlightOptions.width / 2;
|
|
563
598
|
|
|
@@ -608,12 +643,20 @@ export class Sankey extends Observable {
|
|
|
608
643
|
|
|
609
644
|
const box = new Box();
|
|
610
645
|
|
|
646
|
+
const diagramMinX = calculatedNodes.reduce((acc, node) => Math.min(acc, node.x0), Infinity);
|
|
647
|
+
const diagramMaxX = calculatedNodes.reduce((acc, node) => Math.max(acc, node.x1), 0);
|
|
648
|
+
|
|
611
649
|
calculatedNodes.forEach((nodeEl, i) => {
|
|
650
|
+
if (rtl) {
|
|
651
|
+
const { x0, x1 } = nodeEl;
|
|
652
|
+
nodeEl.x0 = diagramMaxX - x1;
|
|
653
|
+
nodeEl.x1 = diagramMaxX - x0;
|
|
654
|
+
}
|
|
612
655
|
const nodeOps = resolveNodeOptions(nodeEl, nodes, nodeColors, i);
|
|
613
656
|
const nodeInstance = new Node(nodeOps);
|
|
614
657
|
box.wrap(rectToBox(nodeInstance.exportVisual().rawBBox()));
|
|
615
658
|
|
|
616
|
-
const labelInstance = new Label(resolveLabelOptions(nodeEl, labels,
|
|
659
|
+
const labelInstance = new Label(resolveLabelOptions(nodeEl, labels, rtl, diagramMinX, diagramMaxX));
|
|
617
660
|
const labelVisual = labelInstance.exportVisual();
|
|
618
661
|
if (labelVisual) {
|
|
619
662
|
box.wrap(rectToBox(labelVisual.rawBBox()));
|
|
@@ -687,11 +730,15 @@ export class Sankey extends Observable {
|
|
|
687
730
|
const sankeyOptions = options || this.options;
|
|
688
731
|
const sankeyContext = context || this;
|
|
689
732
|
|
|
690
|
-
const {
|
|
733
|
+
const { labels: labelOptions, nodes: nodesOptions, links: linkOptions, nodeColors, title, legend, rtl, disableKeyboardNavigation } = sankeyOptions;
|
|
734
|
+
let data = sankeyOptions.data;
|
|
691
735
|
const { width, height } = sankeyContext.size;
|
|
692
736
|
|
|
693
737
|
const calcOptions = Object.assign({}, data, {width, height, nodesOptions, title, legend});
|
|
694
738
|
const { sankey, titleBox, legendBox } = this.calculateSankey(calcOptions, sankeyOptions);
|
|
739
|
+
if (rtl) {
|
|
740
|
+
toRtl(sankey);
|
|
741
|
+
}
|
|
695
742
|
const { nodes, links, columns } = sankey;
|
|
696
743
|
|
|
697
744
|
sankeyContext.columns = columns.map(column => {
|
|
@@ -767,10 +814,11 @@ export class Sankey extends Observable {
|
|
|
767
814
|
const { source, target } = link;
|
|
768
815
|
const sourceNode = visualNodes.get(source.id);
|
|
769
816
|
const targetNode = visualNodes.get(target.id);
|
|
770
|
-
const
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
817
|
+
const resolvedOptions = resolveLinkOptions(link, linkOptions, sourceNode, targetNode);
|
|
818
|
+
resolvedOptions.root = () => sankeyContext.element;
|
|
819
|
+
resolvedOptions.navigatable = disableKeyboardNavigation !== true;
|
|
820
|
+
resolvedOptions.rtl = rtl;
|
|
821
|
+
const linkInstance = new Link(resolvedOptions);
|
|
774
822
|
const linkVisual = linkInstance.exportVisual();
|
|
775
823
|
|
|
776
824
|
linkVisual.type = LINK;
|
|
@@ -779,7 +827,7 @@ export class Sankey extends Observable {
|
|
|
779
827
|
target: Object.assign({}, targetNode.dataItem),
|
|
780
828
|
value: link.value
|
|
781
829
|
};
|
|
782
|
-
linkVisual.linkOptions =
|
|
830
|
+
linkVisual.linkOptions = resolvedOptions;
|
|
783
831
|
linksVisuals.push(linkVisual);
|
|
784
832
|
|
|
785
833
|
sourceNode.links.push(linkVisual);
|
|
@@ -797,9 +845,11 @@ export class Sankey extends Observable {
|
|
|
797
845
|
visual.append(linkVisual);
|
|
798
846
|
});
|
|
799
847
|
|
|
800
|
-
const
|
|
848
|
+
const diagramMinX = nodes.reduce((acc, node) => Math.min(acc, node.x0), Infinity);
|
|
849
|
+
const diagramMaxX = nodes.reduce((acc, node) => Math.max(acc, node.x1), 0);
|
|
850
|
+
|
|
801
851
|
nodes.forEach((node) => {
|
|
802
|
-
const textOps = resolveLabelOptions(node, labelOptions,
|
|
852
|
+
const textOps = resolveLabelOptions(node, labelOptions, rtl, diagramMinX, diagramMaxX);
|
|
803
853
|
const labelInstance = new Label(textOps);
|
|
804
854
|
const labelVisual = labelInstance.exportVisual();
|
|
805
855
|
|
|
@@ -809,7 +859,7 @@ export class Sankey extends Observable {
|
|
|
809
859
|
});
|
|
810
860
|
|
|
811
861
|
if (legendBox) {
|
|
812
|
-
const legendElement = new Legend(Object.assign({}, legend, {drawingRect: legendBox, nodes}));
|
|
862
|
+
const legendElement = new Legend(Object.assign({}, legend, {rtl, drawingRect: legendBox, nodes}));
|
|
813
863
|
const legendVisual = legendElement.exportVisual();
|
|
814
864
|
visual.append(legendVisual);
|
|
815
865
|
}
|
|
@@ -867,7 +917,6 @@ setDefaultOptions(Sankey, {
|
|
|
867
917
|
lineJoin: "round",
|
|
868
918
|
width: 1
|
|
869
919
|
},
|
|
870
|
-
align: LEFT,
|
|
871
920
|
offset: { left: 0, top: 0 }
|
|
872
921
|
},
|
|
873
922
|
nodes: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UserEvents } from '../
|
|
1
|
+
import { UserEvents } from '../common';
|
|
2
2
|
|
|
3
3
|
let current;
|
|
4
4
|
|
|
@@ -13,9 +13,7 @@ class DomEventsBuilder {
|
|
|
13
13
|
if (current) {
|
|
14
14
|
builder = current.create(element, events);
|
|
15
15
|
} else {
|
|
16
|
-
builder = new UserEvents(element, Object.assign({}, {
|
|
17
|
-
multiTouch: true,
|
|
18
|
-
fastTap: true},
|
|
16
|
+
builder = new UserEvents(element, Object.assign({}, {multiTouch: true},
|
|
19
17
|
|
|
20
18
|
events));
|
|
21
19
|
}
|