@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
package/dist/es/sankey/sankey.js
CHANGED
|
@@ -13,6 +13,28 @@ import { defined } from '../drawing-utils';
|
|
|
13
13
|
var LINK = 'link';
|
|
14
14
|
var NODE = 'node';
|
|
15
15
|
|
|
16
|
+
var toRtl = function (sankey) {
|
|
17
|
+
var nodes = sankey.nodes;
|
|
18
|
+
var links = sankey.links;
|
|
19
|
+
var startX = Math.min.apply(Math, nodes.map(function (node) { return node.x0; }));
|
|
20
|
+
var endX = Math.max.apply(Math, nodes.map(function (node) { return node.x1; }));
|
|
21
|
+
var width = endX - startX;
|
|
22
|
+
|
|
23
|
+
nodes.forEach(function (node) {
|
|
24
|
+
var x0 = width - (node.x1 - 2 * startX);
|
|
25
|
+
var x1 = width - (node.x0 - 2 * startX);
|
|
26
|
+
node.x0 = x0;
|
|
27
|
+
node.x1 = x1;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
links.forEach(function (link) {
|
|
31
|
+
var x0 = width - (link.x1 - 2 * startX);
|
|
32
|
+
var x1 = width - (link.x0 - 2 * startX);
|
|
33
|
+
link.x1 = x0;
|
|
34
|
+
link.x0 = x1;
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
16
38
|
export var Sankey = (function (Observable) {
|
|
17
39
|
function Sankey(element, options, theme) {
|
|
18
40
|
Observable.call(this);
|
|
@@ -96,11 +118,15 @@ export var Sankey = (function (Observable) {
|
|
|
96
118
|
element.addEventListener('pointerdown', this._onDownHandler);
|
|
97
119
|
|
|
98
120
|
this._focusState = {
|
|
99
|
-
node: this.
|
|
121
|
+
node: this.firstFocusableNode(),
|
|
100
122
|
link: null
|
|
101
123
|
};
|
|
102
124
|
};
|
|
103
125
|
|
|
126
|
+
Sankey.prototype.firstFocusableNode = function firstFocusableNode () {
|
|
127
|
+
return this.columns[0][0];
|
|
128
|
+
};
|
|
129
|
+
|
|
104
130
|
Sankey.prototype._initResizeObserver = function _initResizeObserver () {
|
|
105
131
|
var this$1 = this;
|
|
106
132
|
|
|
@@ -160,10 +186,13 @@ export var Sankey = (function (Observable) {
|
|
|
160
186
|
};
|
|
161
187
|
|
|
162
188
|
Sankey.prototype.trigger = function trigger (name, ev) {
|
|
189
|
+
var dataItem = ev.element.dataItem;
|
|
190
|
+
var targetType = ev.element.type;
|
|
191
|
+
|
|
163
192
|
var event = Object.assign({}, ev,
|
|
164
193
|
{type: name,
|
|
165
|
-
targetType:
|
|
166
|
-
dataItem:
|
|
194
|
+
targetType: targetType,
|
|
195
|
+
dataItem: dataItem});
|
|
167
196
|
|
|
168
197
|
return Observable.prototype.trigger.call(this, name, event);
|
|
169
198
|
};
|
|
@@ -443,6 +472,13 @@ export var Sankey = (function (Observable) {
|
|
|
443
472
|
|
|
444
473
|
Sankey.prototype._keydown = function _keydown (ev) {
|
|
445
474
|
var handler = this['on' + ev.key];
|
|
475
|
+
var rtl = this.options.rtl;
|
|
476
|
+
|
|
477
|
+
if (rtl && ev.key === 'ArrowLeft') {
|
|
478
|
+
handler = this.onArrowRight;
|
|
479
|
+
} else if (rtl && ev.key === 'ArrowRight') {
|
|
480
|
+
handler = this.onArrowLeft;
|
|
481
|
+
}
|
|
446
482
|
|
|
447
483
|
if (handler) {
|
|
448
484
|
handler.call(this, ev);
|
|
@@ -452,7 +488,7 @@ export var Sankey = (function (Observable) {
|
|
|
452
488
|
Sankey.prototype.onEscape = function onEscape (ev) {
|
|
453
489
|
ev.preventDefault();
|
|
454
490
|
|
|
455
|
-
this._focusState = { node: this.
|
|
491
|
+
this._focusState = { node: this.firstFocusableNode(), link: null };
|
|
456
492
|
this._focusNode();
|
|
457
493
|
};
|
|
458
494
|
|
|
@@ -595,6 +631,7 @@ export var Sankey = (function (Observable) {
|
|
|
595
631
|
var nodeColors = sankeyOptions.nodeColors;
|
|
596
632
|
var disableAutoLayout = sankeyOptions.disableAutoLayout;
|
|
597
633
|
var disableKeyboardNavigation = sankeyOptions.disableKeyboardNavigation;
|
|
634
|
+
var rtl = sankeyOptions.rtl;
|
|
598
635
|
var autoLayout = !disableAutoLayout;
|
|
599
636
|
var padding = disableKeyboardNavigation ? 0 : highlightOptions.width / 2;
|
|
600
637
|
|
|
@@ -647,12 +684,21 @@ export var Sankey = (function (Observable) {
|
|
|
647
684
|
|
|
648
685
|
var box = new Box();
|
|
649
686
|
|
|
687
|
+
var diagramMinX = calculatedNodes.reduce(function (acc, node) { return Math.min(acc, node.x0); }, Infinity);
|
|
688
|
+
var diagramMaxX = calculatedNodes.reduce(function (acc, node) { return Math.max(acc, node.x1); }, 0);
|
|
689
|
+
|
|
650
690
|
calculatedNodes.forEach(function (nodeEl, i) {
|
|
691
|
+
if (rtl) {
|
|
692
|
+
var x0 = nodeEl.x0;
|
|
693
|
+
var x1 = nodeEl.x1;
|
|
694
|
+
nodeEl.x0 = diagramMaxX - x1;
|
|
695
|
+
nodeEl.x1 = diagramMaxX - x0;
|
|
696
|
+
}
|
|
651
697
|
var nodeOps = resolveNodeOptions(nodeEl, nodes, nodeColors, i);
|
|
652
698
|
var nodeInstance = new Node(nodeOps);
|
|
653
699
|
box.wrap(rectToBox(nodeInstance.exportVisual().rawBBox()));
|
|
654
700
|
|
|
655
|
-
var labelInstance = new Label(resolveLabelOptions(nodeEl, labels,
|
|
701
|
+
var labelInstance = new Label(resolveLabelOptions(nodeEl, labels, rtl, diagramMinX, diagramMaxX));
|
|
656
702
|
var labelVisual = labelInstance.exportVisual();
|
|
657
703
|
if (labelVisual) {
|
|
658
704
|
box.wrap(rectToBox(labelVisual.rawBBox()));
|
|
@@ -726,14 +772,15 @@ export var Sankey = (function (Observable) {
|
|
|
726
772
|
var sankeyOptions = options || this.options;
|
|
727
773
|
var sankeyContext = context || this;
|
|
728
774
|
|
|
729
|
-
var data = sankeyOptions.data;
|
|
730
775
|
var labelOptions = sankeyOptions.labels;
|
|
731
776
|
var nodesOptions = sankeyOptions.nodes;
|
|
732
777
|
var linkOptions = sankeyOptions.links;
|
|
733
778
|
var nodeColors = sankeyOptions.nodeColors;
|
|
734
779
|
var title = sankeyOptions.title;
|
|
735
780
|
var legend = sankeyOptions.legend;
|
|
781
|
+
var rtl = sankeyOptions.rtl;
|
|
736
782
|
var disableKeyboardNavigation = sankeyOptions.disableKeyboardNavigation;
|
|
783
|
+
var data = sankeyOptions.data;
|
|
737
784
|
var ref = sankeyContext.size;
|
|
738
785
|
var width = ref.width;
|
|
739
786
|
var height = ref.height;
|
|
@@ -743,6 +790,9 @@ export var Sankey = (function (Observable) {
|
|
|
743
790
|
var sankey = ref$1.sankey;
|
|
744
791
|
var titleBox = ref$1.titleBox;
|
|
745
792
|
var legendBox = ref$1.legendBox;
|
|
793
|
+
if (rtl) {
|
|
794
|
+
toRtl(sankey);
|
|
795
|
+
}
|
|
746
796
|
var nodes = sankey.nodes;
|
|
747
797
|
var links = sankey.links;
|
|
748
798
|
var columns = sankey.columns;
|
|
@@ -821,10 +871,11 @@ export var Sankey = (function (Observable) {
|
|
|
821
871
|
var target = link.target;
|
|
822
872
|
var sourceNode = visualNodes.get(source.id);
|
|
823
873
|
var targetNode = visualNodes.get(target.id);
|
|
824
|
-
var
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
874
|
+
var resolvedOptions = resolveLinkOptions(link, linkOptions, sourceNode, targetNode);
|
|
875
|
+
resolvedOptions.root = function () { return sankeyContext.element; };
|
|
876
|
+
resolvedOptions.navigatable = disableKeyboardNavigation !== true;
|
|
877
|
+
resolvedOptions.rtl = rtl;
|
|
878
|
+
var linkInstance = new Link(resolvedOptions);
|
|
828
879
|
var linkVisual = linkInstance.exportVisual();
|
|
829
880
|
|
|
830
881
|
linkVisual.type = LINK;
|
|
@@ -833,7 +884,7 @@ export var Sankey = (function (Observable) {
|
|
|
833
884
|
target: Object.assign({}, targetNode.dataItem),
|
|
834
885
|
value: link.value
|
|
835
886
|
};
|
|
836
|
-
linkVisual.linkOptions =
|
|
887
|
+
linkVisual.linkOptions = resolvedOptions;
|
|
837
888
|
linksVisuals.push(linkVisual);
|
|
838
889
|
|
|
839
890
|
sourceNode.links.push(linkVisual);
|
|
@@ -851,9 +902,11 @@ export var Sankey = (function (Observable) {
|
|
|
851
902
|
visual.append(linkVisual);
|
|
852
903
|
});
|
|
853
904
|
|
|
854
|
-
var
|
|
905
|
+
var diagramMinX = nodes.reduce(function (acc, node) { return Math.min(acc, node.x0); }, Infinity);
|
|
906
|
+
var diagramMaxX = nodes.reduce(function (acc, node) { return Math.max(acc, node.x1); }, 0);
|
|
907
|
+
|
|
855
908
|
nodes.forEach(function (node) {
|
|
856
|
-
var textOps = resolveLabelOptions(node, labelOptions,
|
|
909
|
+
var textOps = resolveLabelOptions(node, labelOptions, rtl, diagramMinX, diagramMaxX);
|
|
857
910
|
var labelInstance = new Label(textOps);
|
|
858
911
|
var labelVisual = labelInstance.exportVisual();
|
|
859
912
|
|
|
@@ -863,7 +916,7 @@ export var Sankey = (function (Observable) {
|
|
|
863
916
|
});
|
|
864
917
|
|
|
865
918
|
if (legendBox) {
|
|
866
|
-
var legendElement = new Legend(Object.assign({}, legend, {drawingRect: legendBox, nodes: nodes}));
|
|
919
|
+
var legendElement = new Legend(Object.assign({}, legend, {rtl: rtl, drawingRect: legendBox, nodes: nodes}));
|
|
867
920
|
var legendVisual = legendElement.exportVisual();
|
|
868
921
|
visual.append(legendVisual);
|
|
869
922
|
}
|
|
@@ -923,7 +976,6 @@ setDefaultOptions(Sankey, {
|
|
|
923
976
|
lineJoin: "round",
|
|
924
977
|
width: 1
|
|
925
978
|
},
|
|
926
|
-
align: LEFT,
|
|
927
979
|
offset: { left: 0, top: 0 }
|
|
928
980
|
},
|
|
929
981
|
nodes: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UserEvents } from '../
|
|
1
|
+
import { UserEvents } from '../common';
|
|
2
2
|
|
|
3
3
|
var current;
|
|
4
4
|
|
|
@@ -14,9 +14,7 @@ DomEventsBuilder.create = function create (element, events) {
|
|
|
14
14
|
if (current) {
|
|
15
15
|
builder = current.create(element, events);
|
|
16
16
|
} else {
|
|
17
|
-
builder = new UserEvents(element, Object.assign({}, {
|
|
18
|
-
multiTouch: true,
|
|
19
|
-
fastTap: true},
|
|
17
|
+
builder = new UserEvents(element, Object.assign({}, {multiTouch: true},
|
|
20
18
|
|
|
21
19
|
events));
|
|
22
20
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { drawing as draw } from '@progress/kendo-drawing';
|
|
2
2
|
|
|
3
3
|
import { ChartElement, Box, rectToBox } from '../../core';
|
|
4
|
-
import { CENTER, HORIZONTAL, START, VERTICAL } from '../../common/constants';
|
|
4
|
+
import { CENTER, HORIZONTAL, START, END, VERTICAL } from '../../common/constants';
|
|
5
|
+
|
|
6
|
+
const alignItems = rtl => (rtl ? END : START);
|
|
5
7
|
|
|
6
8
|
class LegendLayout extends ChartElement {
|
|
7
9
|
|
|
@@ -20,7 +22,7 @@ class LegendLayout extends ChartElement {
|
|
|
20
22
|
lineSpacing: vertical ? options.spacing : 0,
|
|
21
23
|
orientation: vertical ? VERTICAL : HORIZONTAL,
|
|
22
24
|
reverse: options.rtl,
|
|
23
|
-
alignItems: vertical ?
|
|
25
|
+
alignItems: vertical ? alignItems(options.rtl) : CENTER
|
|
24
26
|
});
|
|
25
27
|
|
|
26
28
|
for (let idx = 0; idx < children.length; idx++) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const eventMap = {
|
|
2
|
+
down: "pointerdown",
|
|
3
|
+
move: "pointermove",
|
|
4
|
+
up: "pointerup",
|
|
5
|
+
cancel: "pointercancel pointerleave"
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
function queryEventMap(e) {
|
|
9
|
+
return eventMap[e] || e;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const applyEventMap = (events) => {
|
|
13
|
+
const eventRegEx = /([^ ]+)/g;
|
|
14
|
+
const appliedEvents = events.replace(eventRegEx, queryEventMap);
|
|
15
|
+
|
|
16
|
+
return appliedEvents;
|
|
17
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import isFunction from './is-function';
|
|
2
|
+
import isArray from './is-array';
|
|
3
|
+
|
|
4
|
+
export function on(element, events, filter, handler, useCapture) {
|
|
5
|
+
addEventListeners(element, events, filter, handler, useCapture);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function off(element, events, filter, handler, useCapture) {
|
|
9
|
+
removeEventListeners(element, events, filter, handler, useCapture);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function isString(value) {
|
|
13
|
+
return typeof(value) === "string";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function addEventListeners(element, events, filter, handler, useCapture) {
|
|
17
|
+
const eventNames = isArray(events) ? events : (events || "").split(" ");
|
|
18
|
+
|
|
19
|
+
eventNames.forEach(function(eventName) {
|
|
20
|
+
addEventListener(element, eventName, filter, handler, useCapture);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function addEventListener(element, event, filter, handler, useCapture) {
|
|
25
|
+
let eventHandler = handler;
|
|
26
|
+
let eventFilter;
|
|
27
|
+
|
|
28
|
+
if (filter && isFunction(filter) && !handler) {
|
|
29
|
+
eventHandler = filter;
|
|
30
|
+
} else if (filter && isString(filter) && isFunction(eventHandler)) {
|
|
31
|
+
eventFilter = filter;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
element.addEventListener(event, function(e) {
|
|
35
|
+
const closestMatchingTarget = e.target ? e.target.closest(eventFilter) : null;
|
|
36
|
+
|
|
37
|
+
if (!eventFilter ||
|
|
38
|
+
(eventFilter && e.target && closestMatchingTarget)) {
|
|
39
|
+
const currentTarget = eventFilter ? closestMatchingTarget : e.currentTarget;
|
|
40
|
+
|
|
41
|
+
// reassign the property as it is a getters only
|
|
42
|
+
Object.defineProperty(e, "currentTarget", { value: currentTarget });
|
|
43
|
+
// keep a reference to the top-level target
|
|
44
|
+
Object.defineProperty(e, "delegateTarget", { value: element });
|
|
45
|
+
|
|
46
|
+
eventHandler(e);
|
|
47
|
+
}
|
|
48
|
+
}, Boolean(useCapture));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function removeEventListeners(element, events, handler, useCapture) {
|
|
52
|
+
const eventNames = isArray(events) ? events : (events || "").split(" ");
|
|
53
|
+
|
|
54
|
+
eventNames.forEach(function(eventName) {
|
|
55
|
+
removeEventListener(element, eventName, handler, useCapture);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function removeEventListener(element, event, handler, useCapture) {
|
|
60
|
+
element.removeEventListener(event, handler, Boolean(useCapture));
|
|
61
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export default function getSupportedFeatures() {
|
|
2
|
+
const os = detectOS(navigator.userAgent);
|
|
3
|
+
const support = {};
|
|
4
|
+
|
|
5
|
+
support.mobileOS = os;
|
|
6
|
+
|
|
7
|
+
return support;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function detectOS(ua) {
|
|
11
|
+
let os = false;
|
|
12
|
+
const agentRxs = {
|
|
13
|
+
wp: /(Windows Phone(?: OS)?)\s(\d+)\.(\d+(\.\d+)?)/,
|
|
14
|
+
fire: /(Silk)\/(\d+)\.(\d+(\.\d+)?)/,
|
|
15
|
+
android: /(Android|Android.*(?:Opera|Firefox).*?\/)\s*(\d+)\.?(\d+(\.\d+)?)?/,
|
|
16
|
+
iphone: /(iPhone|iPod).*OS\s+(\d+)[\._]([\d\._]+)/,
|
|
17
|
+
ipad: /(iPad).*OS\s+(\d+)[\._]([\d_]+)/,
|
|
18
|
+
playbook: /(PlayBook).*?Tablet\s*OS\s*(\d+)\.(\d+(\.\d+)?)/,
|
|
19
|
+
windows: /(MSIE)\s+(\d+)\.(\d+(\.\d+)?)/,
|
|
20
|
+
tizen: /(tizen).*?Version\/(\d+)\.(\d+(\.\d+)?)/i,
|
|
21
|
+
sailfish: /(sailfish).*rv:(\d+)\.(\d+(\.\d+)?).*firefox/i
|
|
22
|
+
},
|
|
23
|
+
osRxs = {
|
|
24
|
+
ios: /^i(phone|pad|pod)$/i,
|
|
25
|
+
android: /^android|fire$/i,
|
|
26
|
+
windows: /windows/,
|
|
27
|
+
wp: /wp/,
|
|
28
|
+
flat: /sailfish|ffos|tizen/i
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
for (let agent in agentRxs) {
|
|
32
|
+
let match = ua.match(agentRxs[agent]);
|
|
33
|
+
if (match) {
|
|
34
|
+
if (agent === "windows" && "plugins" in navigator) { return false; } // Break if not Metro/Mobile Windows
|
|
35
|
+
|
|
36
|
+
os = {};
|
|
37
|
+
os.device = agent;
|
|
38
|
+
os.name = testRegex(agent, osRxs);
|
|
39
|
+
os[os.name] = true;
|
|
40
|
+
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return os;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function testRegex(agent, regexes, dflt) {
|
|
49
|
+
for (let regex in regexes) {
|
|
50
|
+
if (regexes[regex].test(agent)) {
|
|
51
|
+
return regex;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return dflt !== undefined ? dflt : agent;
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function noop() {}
|