@carbon/charts-vue 0.53.1 → 0.53.5
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/CHANGELOG.md +32 -0
- package/charts-vue.common.js +115 -35
- package/charts-vue.common.js.map +1 -1
- package/charts-vue.umd.js +115 -35
- package/charts-vue.umd.js.map +1 -1
- package/charts-vue.umd.min.js +1 -1
- package/charts-vue.umd.min.js.map +1 -1
- package/package.json +2 -2
package/charts-vue.umd.js
CHANGED
|
@@ -450,6 +450,7 @@ var events_Toolbar;
|
|
|
450
450
|
(function (Toolbar) {
|
|
451
451
|
Toolbar["SHOW_OVERFLOW_MENU"] = "show-toolbar-overflow-menu";
|
|
452
452
|
Toolbar["HIDE_OVERFLOW_MENU"] = "hide-toolbar-overflow-menu";
|
|
453
|
+
Toolbar["BUTTON_CLICK"] = "toolbar-button-click";
|
|
453
454
|
})(events_Toolbar || (events_Toolbar = {}));
|
|
454
455
|
/**
|
|
455
456
|
* enum of all events related to the zoom-bar
|
|
@@ -893,6 +894,7 @@ var ToolbarControlTypes;
|
|
|
893
894
|
ToolbarControlTypes["RESET_ZOOM"] = "Reset zoom";
|
|
894
895
|
ToolbarControlTypes["MAKE_FULLSCREEN"] = "Make fullscreen";
|
|
895
896
|
ToolbarControlTypes["SHOW_AS_DATATABLE"] = "Show as data-table";
|
|
897
|
+
ToolbarControlTypes["CUSTOM"] = "Custom";
|
|
896
898
|
})(ToolbarControlTypes || (ToolbarControlTypes = {}));
|
|
897
899
|
/**
|
|
898
900
|
* enum of title orientations for _vertical axes_
|
|
@@ -17537,6 +17539,11 @@ var zoom_Zoom = /** @class */ (function (_super) {
|
|
|
17537
17539
|
var cartesianScales = this.services.cartesianScales;
|
|
17538
17540
|
var mainXAxisPosition = cartesianScales.getMainXAxisPosition();
|
|
17539
17541
|
var domainIdentifier = cartesianScales.getDomainIdentifier();
|
|
17542
|
+
var customDomain = tools_Tools.getProperty(this.model.getOptions(), 'axes', mainXAxisPosition, 'domain');
|
|
17543
|
+
// return custom domain if exists && valid
|
|
17544
|
+
if (Array.isArray(customDomain) && customDomain.length === 2) {
|
|
17545
|
+
return customDomain;
|
|
17546
|
+
}
|
|
17540
17547
|
// default to full range with extended domain
|
|
17541
17548
|
return cartesianScales.extendsDomain(mainXAxisPosition, src_extent(allZoomBarData, function (d) { return d[domainIdentifier]; }));
|
|
17542
17549
|
};
|
|
@@ -23798,6 +23805,7 @@ var tooltip_axis_AxisChartsTooltip = /** @class */ (function (_super) {
|
|
|
23798
23805
|
var options = this.getOptions();
|
|
23799
23806
|
var cartesianScales = this.services.cartesianScales;
|
|
23800
23807
|
var domainIdentifier = cartesianScales.getDomainIdentifier();
|
|
23808
|
+
var dualAxes = cartesianScales.isDualAxes();
|
|
23801
23809
|
// Generate default tooltip
|
|
23802
23810
|
var groupMapsTo = options.data.groupMapsTo;
|
|
23803
23811
|
var domainLabel = cartesianScales.getDomainLabel();
|
|
@@ -23807,6 +23815,13 @@ var tooltip_axis_AxisChartsTooltip = /** @class */ (function (_super) {
|
|
|
23807
23815
|
if (data.length === 1) {
|
|
23808
23816
|
var datum = data[0];
|
|
23809
23817
|
var rangeIdentifier = cartesianScales.getRangeIdentifier(datum);
|
|
23818
|
+
if (dualAxes) {
|
|
23819
|
+
var position = cartesianScales.getRangeAxisPosition({
|
|
23820
|
+
datum: datum,
|
|
23821
|
+
groups: [datum[groupMapsTo]],
|
|
23822
|
+
});
|
|
23823
|
+
rangeLabel = cartesianScales.getScaleLabel(position);
|
|
23824
|
+
}
|
|
23810
23825
|
var value = datum[rangeIdentifier];
|
|
23811
23826
|
items = tooltip_axis_spreadArrays([
|
|
23812
23827
|
{
|
|
@@ -23866,7 +23881,6 @@ var tooltip_axis_AxisChartsTooltip = /** @class */ (function (_super) {
|
|
|
23866
23881
|
}),
|
|
23867
23882
|
}); })
|
|
23868
23883
|
.sort(function (a, b) { return b.value - a.value; }));
|
|
23869
|
-
var dualAxes = cartesianScales.isDualAxes();
|
|
23870
23884
|
if (!dualAxes &&
|
|
23871
23885
|
tools_Tools.getProperty(options, 'tooltip', 'showTotal') === true) {
|
|
23872
23886
|
// use the primary/only range id
|
|
@@ -38606,6 +38620,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38606
38620
|
var isDataLoading = tools_Tools.getProperty(this.getOptions(), 'data', 'loading');
|
|
38607
38621
|
if (isDataLoading) {
|
|
38608
38622
|
container.html('');
|
|
38623
|
+
// Set overflow menu to null if data is loading
|
|
38624
|
+
// This will render in a new overflow menu when data is done loading
|
|
38625
|
+
this.overflowMenu = null;
|
|
38609
38626
|
}
|
|
38610
38627
|
else {
|
|
38611
38628
|
if (!this.overflowMenu) {
|
|
@@ -38634,23 +38651,26 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38634
38651
|
var self_1 = this;
|
|
38635
38652
|
var allToolbarControls = enteringToolbarControls
|
|
38636
38653
|
.merge(toolbarControls)
|
|
38637
|
-
.classed('disabled', function (d) {
|
|
38638
|
-
|
|
38639
|
-
})
|
|
38640
|
-
.attr('aria-disabled', function (d) {
|
|
38641
|
-
return d.shouldBeDisabled ? d.shouldBeDisabled() : false;
|
|
38642
|
-
})
|
|
38654
|
+
.classed('disabled', function (d) { return d.shouldBeDisabled(); })
|
|
38655
|
+
.attr('aria-disabled', function (d) { return d.shouldBeDisabled(); })
|
|
38643
38656
|
.attr('aria-label', function (d) { return d.title; })
|
|
38644
|
-
.html(function (d) { return "\n\t\t\t<button\n\t\t\t\tclass=\"bx--overflow-menu__trigger\"\n\t\t\t\taria-haspopup=\"true\" aria-expanded=\"false\" id=\"" + _this.services.domUtils.generateElementIDString("control-" + d.id) + "\" aria-label=\"" + d.title + "\">\n\t\t\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" style=\"will-change: transform; width: " + (d.
|
|
38657
|
+
.html(function (d) { return "\n\t\t\t<button\n\t\t\t\tclass=\"bx--overflow-menu__trigger\"\n\t\t\t\taria-haspopup=\"true\" aria-expanded=\"false\" id=\"" + _this.services.domUtils.generateElementIDString("control-" + d.id) + "\" aria-label=\"" + d.title + "\">\n\t\t\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" style=\"will-change: transform; width: " + (d.iconSVG.width !== undefined ? d.iconSVG.width : '20px') + "; height: " + (d.iconSVG.height !== undefined
|
|
38658
|
+
? d.iconSVG.height
|
|
38659
|
+
: '20px') + "\" xmlns=\"http://www.w3.org/2000/svg\" class=\"bx--overflow-menu__icon\" viewBox=\"0 0 32 32\" aria-hidden=\"true\">\n\t\t\t\t\t" + d.iconSVG.content + "\n\t\t\t\t</svg>\n\t\t\t</button>"; })
|
|
38645
38660
|
.each(function (d, index) {
|
|
38661
|
+
var _this = this;
|
|
38646
38662
|
src_select(this)
|
|
38647
38663
|
.select('button')
|
|
38648
|
-
.on('click',
|
|
38664
|
+
.on('click', function (event) {
|
|
38665
|
+
if (!d.shouldBeDisabled()) {
|
|
38666
|
+
self_1.triggerFunctionAndEvent(d, event, _this);
|
|
38667
|
+
}
|
|
38668
|
+
})
|
|
38649
38669
|
.on('keydown', function (event) {
|
|
38650
38670
|
if ((event.key && event.key === 'Enter') ||
|
|
38651
38671
|
event.key === ' ') {
|
|
38652
38672
|
event.preventDefault();
|
|
38653
|
-
|
|
38673
|
+
self_1.triggerFunctionAndEvent(d, event, _this);
|
|
38654
38674
|
}
|
|
38655
38675
|
else if (event.key && event.key === 'ArrowLeft') {
|
|
38656
38676
|
self_1.focusOnPreviousEnabledToolbarItem(index);
|
|
@@ -38699,6 +38719,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38699
38719
|
};
|
|
38700
38720
|
// show/hide overflow menu
|
|
38701
38721
|
Toolbar.prototype.updateOverflowMenu = function (show) {
|
|
38722
|
+
if (!this.overflowMenu) {
|
|
38723
|
+
return;
|
|
38724
|
+
}
|
|
38702
38725
|
this.overflowMenu.classed('is-open', show);
|
|
38703
38726
|
// update overflow button background
|
|
38704
38727
|
if (this.overflowButton) {
|
|
@@ -38801,15 +38824,13 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38801
38824
|
var element = src_select("#" + _this.services.domUtils.generateElementIDString("control-" + menuItem.id));
|
|
38802
38825
|
if (element !== null) {
|
|
38803
38826
|
element.on('click', function () {
|
|
38804
|
-
|
|
38805
|
-
menuItem.clickFunction();
|
|
38827
|
+
self_2.triggerFunctionAndEvent(menuItem, event, element.node());
|
|
38806
38828
|
// hide overflow menu
|
|
38807
38829
|
self_2.updateOverflowMenu(false);
|
|
38808
38830
|
});
|
|
38809
38831
|
element.on('keydown', function (keyEvent) {
|
|
38810
38832
|
if (keyEvent && keyEvent.key === 'Enter') {
|
|
38811
|
-
|
|
38812
|
-
menuItem.clickFunction();
|
|
38833
|
+
self_2.triggerFunctionAndEvent(menuItem, event, element.node());
|
|
38813
38834
|
}
|
|
38814
38835
|
else if (keyEvent && keyEvent.key === 'ArrowUp') {
|
|
38815
38836
|
// focus on previous menu item
|
|
@@ -38836,35 +38857,75 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38836
38857
|
event.stopImmediatePropagation();
|
|
38837
38858
|
}
|
|
38838
38859
|
};
|
|
38860
|
+
// Calls passed function && dispatches event
|
|
38861
|
+
Toolbar.prototype.triggerFunctionAndEvent = function (control, event, element) {
|
|
38862
|
+
// Call custom function only if it exists
|
|
38863
|
+
if (typeof control.clickFunction === 'function') {
|
|
38864
|
+
control.clickFunction(event);
|
|
38865
|
+
}
|
|
38866
|
+
// Dispatch selection event
|
|
38867
|
+
this.services.events.dispatchEvent(Events.Toolbar.BUTTON_CLICK, {
|
|
38868
|
+
control: control,
|
|
38869
|
+
event: event,
|
|
38870
|
+
element: element,
|
|
38871
|
+
});
|
|
38872
|
+
};
|
|
38839
38873
|
Toolbar.prototype.getControlConfigs = function () {
|
|
38840
38874
|
var _this = this;
|
|
38841
|
-
var numberOfIcons = tools_Tools.getProperty(this.getOptions(), 'toolbar', 'numberOfIcons')
|
|
38875
|
+
var numberOfIcons = tools_Tools.getProperty(this.getOptions(), 'toolbar', 'numberOfIcons') -
|
|
38876
|
+
1;
|
|
38842
38877
|
var controls = tools_Tools.getProperty(this.getOptions(), 'toolbar', 'controls');
|
|
38843
|
-
var controlList = [];
|
|
38844
38878
|
var overflowSpecificControls = [];
|
|
38879
|
+
var buttonList = [];
|
|
38880
|
+
var overflowList = [];
|
|
38845
38881
|
controls.forEach(function (control) {
|
|
38846
|
-
var controlConfig =
|
|
38882
|
+
var controlConfig = null;
|
|
38883
|
+
// check if button is custom or default control
|
|
38884
|
+
if (control.type === ToolbarControlTypes.CUSTOM) {
|
|
38885
|
+
// add generic id if missing
|
|
38886
|
+
if (tools_Tools.getProperty(control, 'id') === null) {
|
|
38887
|
+
// add id directly to the data passed so that id isn't reassigned on rerender
|
|
38888
|
+
control.id = "toolbar-button-" + Toolbar.buttonID++;
|
|
38889
|
+
}
|
|
38890
|
+
// define function if missing
|
|
38891
|
+
if (tools_Tools.getProperty(control, 'shouldBeDisabled') === null) {
|
|
38892
|
+
control.shouldBeDisabled = function () { return false; };
|
|
38893
|
+
}
|
|
38894
|
+
controlConfig = control;
|
|
38895
|
+
}
|
|
38896
|
+
else {
|
|
38897
|
+
controlConfig = _this.getControlConfigByType(control.type);
|
|
38898
|
+
}
|
|
38847
38899
|
// add to list if config is valid
|
|
38848
38900
|
if (controlConfig) {
|
|
38849
38901
|
controlConfig.text = control.text ? control.text : control.type;
|
|
38850
38902
|
if (controlConfig.id.indexOf('toolbar-export') !== -1) {
|
|
38851
38903
|
overflowSpecificControls.push(controlConfig);
|
|
38852
38904
|
}
|
|
38905
|
+
else if (buttonList.length < numberOfIcons) {
|
|
38906
|
+
// check if icon exists else assign to the overflow list
|
|
38907
|
+
if (tools_Tools.getProperty(controlConfig, 'iconSVG', 'content') === null) {
|
|
38908
|
+
overflowList.push(controlConfig);
|
|
38909
|
+
}
|
|
38910
|
+
else {
|
|
38911
|
+
buttonList.push(controlConfig);
|
|
38912
|
+
}
|
|
38913
|
+
}
|
|
38853
38914
|
else {
|
|
38854
|
-
|
|
38915
|
+
overflowList.push(controlConfig);
|
|
38855
38916
|
}
|
|
38856
38917
|
}
|
|
38857
38918
|
});
|
|
38858
|
-
|
|
38859
|
-
|
|
38919
|
+
// Ensures the `export` controls are always at the bottom
|
|
38920
|
+
overflowList.push.apply(overflowList, overflowSpecificControls);
|
|
38921
|
+
if (!overflowList.length) {
|
|
38860
38922
|
return {
|
|
38861
|
-
buttonList:
|
|
38923
|
+
buttonList: buttonList,
|
|
38862
38924
|
};
|
|
38863
38925
|
}
|
|
38864
38926
|
return {
|
|
38865
|
-
|
|
38866
|
-
|
|
38867
|
-
overflowMenuItemList: controlList.concat(overflowSpecificControls),
|
|
38927
|
+
buttonList: buttonList,
|
|
38928
|
+
overflowMenuItemList: overflowList,
|
|
38868
38929
|
};
|
|
38869
38930
|
};
|
|
38870
38931
|
Toolbar.prototype.getToolbarButtonItems = function () {
|
|
@@ -38893,7 +38954,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38893
38954
|
id: 'toolbar-overflow-menu',
|
|
38894
38955
|
title: 'More options',
|
|
38895
38956
|
shouldBeDisabled: function () { return false; },
|
|
38896
|
-
|
|
38957
|
+
iconSVG: {
|
|
38958
|
+
content: "<circle cx=\"16\" cy=\"8\" r=\"2\"></circle>\n\t\t\t\t<circle cx=\"16\" cy=\"16\" r=\"2\"></circle>\n\t\t\t\t<circle cx=\"16\" cy=\"24\" r=\"2\"></circle>",
|
|
38959
|
+
},
|
|
38897
38960
|
clickFunction: function (event) { return _this.toggleOverflowMenu(event); },
|
|
38898
38961
|
};
|
|
38899
38962
|
};
|
|
@@ -38913,7 +38976,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38913
38976
|
shouldBeDisabled: function () {
|
|
38914
38977
|
return _this.services.zoom.isMinZoomDomain();
|
|
38915
38978
|
},
|
|
38916
|
-
|
|
38979
|
+
iconSVG: {
|
|
38980
|
+
content: this.getControlIconByType(controlType),
|
|
38981
|
+
},
|
|
38917
38982
|
clickFunction: function () { return _this.services.zoom.zoomIn(); },
|
|
38918
38983
|
};
|
|
38919
38984
|
}
|
|
@@ -38926,7 +38991,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38926
38991
|
shouldBeDisabled: function () {
|
|
38927
38992
|
return _this.services.zoom.isMaxZoomDomain();
|
|
38928
38993
|
},
|
|
38929
|
-
|
|
38994
|
+
iconSVG: {
|
|
38995
|
+
content: this.getControlIconByType(controlType),
|
|
38996
|
+
},
|
|
38930
38997
|
clickFunction: function () { return _this.services.zoom.zoomOut(); },
|
|
38931
38998
|
};
|
|
38932
38999
|
}
|
|
@@ -38939,7 +39006,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38939
39006
|
shouldBeDisabled: function () {
|
|
38940
39007
|
return _this.services.zoom.isMaxZoomDomain();
|
|
38941
39008
|
},
|
|
38942
|
-
|
|
39009
|
+
iconSVG: {
|
|
39010
|
+
content: this.getControlIconByType(controlType),
|
|
39011
|
+
},
|
|
38943
39012
|
clickFunction: function () {
|
|
38944
39013
|
return _this.services.zoom.resetZoomDomain();
|
|
38945
39014
|
},
|
|
@@ -38949,10 +39018,12 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38949
39018
|
case ToolbarControlTypes.MAKE_FULLSCREEN:
|
|
38950
39019
|
controlConfig = {
|
|
38951
39020
|
id: 'toolbar-makefullscreen',
|
|
39021
|
+
iconSVG: {
|
|
39022
|
+
content: this.getControlIconByType(controlType),
|
|
39023
|
+
width: '15px',
|
|
39024
|
+
height: '15px',
|
|
39025
|
+
},
|
|
38952
39026
|
title: 'Make fullscreen',
|
|
38953
|
-
iconSVGContent: this.getControlIconByType(controlType),
|
|
38954
|
-
iconWidth: '15px',
|
|
38955
|
-
iconHight: '15px',
|
|
38956
39027
|
shouldBeDisabled: function () { return false; },
|
|
38957
39028
|
clickFunction: function () {
|
|
38958
39029
|
_this.services.domUtils.toggleFullscreen();
|
|
@@ -38962,8 +39033,10 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38962
39033
|
case ToolbarControlTypes.SHOW_AS_DATATABLE:
|
|
38963
39034
|
controlConfig = {
|
|
38964
39035
|
id: 'toolbar-showasdatatable',
|
|
39036
|
+
iconSVG: {
|
|
39037
|
+
content: this.getControlIconByType(controlType),
|
|
39038
|
+
},
|
|
38965
39039
|
title: 'Show as table',
|
|
38966
|
-
iconSVGContent: this.getControlIconByType(controlType),
|
|
38967
39040
|
shouldBeDisabled: function () { return displayData.length === 0; },
|
|
38968
39041
|
clickFunction: function () {
|
|
38969
39042
|
return _this.services.events.dispatchEvent(Events.Modal.SHOW);
|
|
@@ -38975,7 +39048,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38975
39048
|
id: 'toolbar-export-CSV',
|
|
38976
39049
|
title: 'Export as CSV',
|
|
38977
39050
|
shouldBeDisabled: function () { return false; },
|
|
38978
|
-
|
|
39051
|
+
iconSVG: {
|
|
39052
|
+
content: this.getControlIconByType(controlType),
|
|
39053
|
+
},
|
|
38979
39054
|
clickFunction: function () { return _this.model.exportToCSV(); },
|
|
38980
39055
|
};
|
|
38981
39056
|
break;
|
|
@@ -38984,7 +39059,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38984
39059
|
id: 'toolbar-export-PNG',
|
|
38985
39060
|
title: 'Export as PNG',
|
|
38986
39061
|
shouldBeDisabled: function () { return false; },
|
|
38987
|
-
|
|
39062
|
+
iconSVG: {
|
|
39063
|
+
content: this.getControlIconByType(controlType),
|
|
39064
|
+
},
|
|
38988
39065
|
clickFunction: function () { return _this.services.domUtils.exportToPNG(); },
|
|
38989
39066
|
};
|
|
38990
39067
|
break;
|
|
@@ -38993,7 +39070,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38993
39070
|
id: 'toolbar-export-JPG',
|
|
38994
39071
|
title: 'Export as JPG',
|
|
38995
39072
|
shouldBeDisabled: function () { return false; },
|
|
38996
|
-
|
|
39073
|
+
iconSVG: {
|
|
39074
|
+
content: this.getControlIconByType(controlType),
|
|
39075
|
+
},
|
|
38997
39076
|
clickFunction: function () { return _this.services.domUtils.exportToJPG(); },
|
|
38998
39077
|
};
|
|
38999
39078
|
break;
|
|
@@ -39026,6 +39105,7 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
39026
39105
|
throw Error('Not supported toolbar control type: ' + controlType);
|
|
39027
39106
|
}
|
|
39028
39107
|
};
|
|
39108
|
+
Toolbar.buttonID = 0;
|
|
39029
39109
|
return Toolbar;
|
|
39030
39110
|
}(component_Component));
|
|
39031
39111
|
|