@carbon/charts 0.39.0 → 0.40.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/axis-chart.js +32 -5
  3. package/axis-chart.js.map +1 -1
  4. package/build/demo/data/toolbar.d.ts +12 -0
  5. package/build/src/components/axes/toolbar.d.ts +34 -0
  6. package/build/src/components/graphs/scatter-stacked.d.ts +1 -1
  7. package/build/src/components/index.d.ts +1 -0
  8. package/build/src/configuration-non-customizable.d.ts +10 -0
  9. package/build/src/interfaces/a11y.d.ts +5 -1
  10. package/build/src/interfaces/components.d.ts +43 -1
  11. package/build/src/interfaces/enums.d.ts +8 -0
  12. package/build/src/interfaces/events.d.ts +7 -0
  13. package/build/src/services/zoom.d.ts +8 -0
  14. package/bundle.js +1 -1
  15. package/components/axes/toolbar.d.ts +34 -0
  16. package/components/axes/toolbar.js +388 -0
  17. package/components/axes/toolbar.js.map +1 -0
  18. package/components/axes/zoom-bar.js +5 -3
  19. package/components/axes/zoom-bar.js.map +1 -1
  20. package/components/essentials/legend.js +3 -2
  21. package/components/essentials/legend.js.map +1 -1
  22. package/components/essentials/title.js +3 -2
  23. package/components/essentials/title.js.map +1 -1
  24. package/components/essentials/tooltip-axis.js +2 -2
  25. package/components/essentials/tooltip-axis.js.map +1 -1
  26. package/components/graphs/bar-grouped.js +1 -1
  27. package/components/graphs/bar-grouped.js.map +1 -1
  28. package/components/graphs/bar-stacked.js +1 -1
  29. package/components/graphs/bar-stacked.js.map +1 -1
  30. package/components/graphs/radar.js +8 -2
  31. package/components/graphs/radar.js.map +1 -1
  32. package/components/graphs/scatter-stacked.d.ts +1 -1
  33. package/components/graphs/scatter-stacked.js +16 -7
  34. package/components/graphs/scatter-stacked.js.map +1 -1
  35. package/components/index.d.ts +1 -0
  36. package/components/index.js +1 -0
  37. package/components/index.js.map +1 -1
  38. package/configuration-non-customizable.d.ts +10 -0
  39. package/configuration-non-customizable.js +11 -1
  40. package/configuration-non-customizable.js.map +1 -1
  41. package/configuration.js +8 -1
  42. package/configuration.js.map +1 -1
  43. package/demo/data/bundle.js +1 -1
  44. package/demo/data/index.js +18 -0
  45. package/demo/data/index.js.map +1 -1
  46. package/demo/data/toolbar.d.ts +12 -0
  47. package/demo/data/toolbar.js +56 -0
  48. package/demo/data/toolbar.js.map +1 -0
  49. package/demo/styles.css +1958 -690
  50. package/demo/styles.css.map +1 -1
  51. package/demo/styles.min.css +1 -1
  52. package/demo/styles.min.css.map +1 -1
  53. package/demo/tsconfig.tsbuildinfo +24 -9
  54. package/interfaces/a11y.d.ts +5 -1
  55. package/interfaces/a11y.js +4 -0
  56. package/interfaces/a11y.js.map +1 -1
  57. package/interfaces/components.d.ts +43 -1
  58. package/interfaces/components.js.map +1 -1
  59. package/interfaces/enums.d.ts +8 -0
  60. package/interfaces/enums.js +9 -0
  61. package/interfaces/enums.js.map +1 -1
  62. package/interfaces/events.d.ts +7 -0
  63. package/interfaces/events.js +8 -0
  64. package/interfaces/events.js.map +1 -1
  65. package/model.js +8 -2
  66. package/model.js.map +1 -1
  67. package/package.json +1 -1
  68. package/services/scales-cartesian.js +7 -2
  69. package/services/scales-cartesian.js.map +1 -1
  70. package/services/zoom.d.ts +8 -0
  71. package/services/zoom.js +146 -1
  72. package/services/zoom.js.map +1 -1
  73. package/styles/components/_toolbar.scss +67 -0
  74. package/styles/components/index.scss +1 -0
  75. package/styles-g10.css +664 -0
  76. package/styles-g10.css.map +1 -1
  77. package/styles-g10.min.css +1 -1
  78. package/styles-g10.min.css.map +1 -1
  79. package/styles-g100.css +664 -0
  80. package/styles-g100.css.map +1 -1
  81. package/styles-g100.min.css +1 -1
  82. package/styles-g100.min.css.map +1 -1
  83. package/styles-g90.css +664 -0
  84. package/styles-g90.css.map +1 -1
  85. package/styles-g90.min.css +1 -1
  86. package/styles-g90.min.css.map +1 -1
  87. package/styles.css +664 -0
  88. package/styles.css.map +1 -1
  89. package/styles.min.css +1 -1
  90. package/styles.min.css.map +1 -1
  91. package/tsconfig.tsbuildinfo +53 -28
@@ -0,0 +1,34 @@
1
+ import { Component } from "../component";
2
+ import { ToolbarControlTypes } from "../../interfaces";
3
+ export declare class Toolbar extends Component {
4
+ type: string;
5
+ overflowButton: any;
6
+ overflowMenu: any;
7
+ overflowMenuX: number;
8
+ overflowMenuY: number;
9
+ overflowMenuItemId: number;
10
+ init(): void;
11
+ render(animate?: boolean): void;
12
+ isOverflowMenuOpen(): boolean;
13
+ updateOverflowMenu(show: boolean): void;
14
+ focusOnPreviousEnabledMenuItem(currentItemIndex: any): void;
15
+ focusOnNextEnabledMenuItem(currentItemIndex: any): void;
16
+ toggleOverflowMenu(): void;
17
+ getOverflowMenuHTML(): any;
18
+ getControlConfigs(): {
19
+ buttonList: any[];
20
+ overflowMenuItemList?: undefined;
21
+ } | {
22
+ buttonList: any[];
23
+ overflowMenuItemList: any[];
24
+ };
25
+ getOverflowMenuItems(): any[];
26
+ getOverflowButtonConfig(): {
27
+ id: string;
28
+ shouldBeDisabled: () => boolean;
29
+ iconSVGContent: string;
30
+ clickFunction: () => void;
31
+ };
32
+ getControlConfigByType(controlType: ToolbarControlTypes): any;
33
+ getControlIconByType(controlType: ToolbarControlTypes): "<polygon points=\"19 13 15 13 15 9 13 9 13 13 9 13 9 15 13 15 13 19 15 19 15 15 19 15 19 13\"/>\n \t\t\t\t\t<path d=\"M22.45,21A10.87,10.87,0,0,0,25,14,11,11,0,1,0,14,25a10.87,10.87,0,0,0,7-2.55L28.59,30,30,28.59ZM14,23a9,9,0,1,1,9-9A9,9,0,0,1,14,23Z\"/>" | "<rect x=\"9\" y=\"13\" width=\"10\" height=\"2\"/>\n\t\t\t\t\t\t<path d=\"M22.45,21A10.87,10.87,0,0,0,25,14,11,11,0,1,0,14,25a10.87,10.87,0,0,0,7-2.55L28.59,30,30,28.59ZM14,23a9,9,0,1,1,9-9A9,9,0,0,1,14,23Z\"/>" | "<path d=\"M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z\"/>";
34
+ }
@@ -0,0 +1,388 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ // Internal Imports
15
+ import { Component } from "../component";
16
+ import { Events, Roles, ToolbarControlTypes } from "../../interfaces";
17
+ import { Tools } from "../../tools";
18
+ import { DOMUtils } from "../../services";
19
+ import * as Configuration from "../../configuration";
20
+ // D3 Imports
21
+ import { event, select } from "d3-selection";
22
+ // import the settings for the css prefix
23
+ import settings from "carbon-components/es/globals/js/settings";
24
+ var Toolbar = /** @class */ (function (_super) {
25
+ __extends(Toolbar, _super);
26
+ function Toolbar() {
27
+ var _this = _super !== null && _super.apply(this, arguments) || this;
28
+ _this.type = "toolbar";
29
+ // x, y coordinate of overflow menu
30
+ _this.overflowMenuX = 0;
31
+ _this.overflowMenuY = 0;
32
+ // Use a random number to create overflow menu item unique ID
33
+ // so they don't interfere the other overflow menu item in a page
34
+ _this.overflowMenuItemId = Math.floor(Math.random() * 99999999999);
35
+ return _this;
36
+ }
37
+ Toolbar.prototype.init = function () {
38
+ var _this = this;
39
+ var options = this.model.getOptions();
40
+ // Grab the tooltip element
41
+ var holder = select(this.services.domUtils.getHolder());
42
+ var chartPrefix = Tools.getProperty(options, "style", "prefix");
43
+ this.overflowMenu = DOMUtils.appendOrSelect(holder, "div." + settings.prefix + "--" + chartPrefix + "--overflowMenu");
44
+ this.overflowMenu.style("max-width", null);
45
+ // listen to show overflow menu event to render the overflow menu
46
+ this.services.events.addEventListener(Events.Toolbar.SHOW_OVERFLOW_MENU, function () {
47
+ _this.overflowMenu.html(_this.getOverflowMenuHTML());
48
+ });
49
+ // listen to hide overflow menu event to hide the overflow menu
50
+ this.services.events.addEventListener(Events.Toolbar.HIDE_OVERFLOW_MENU, function () {
51
+ _this.overflowMenu.html(null);
52
+ });
53
+ // hide overflow menu if user clicks on somewhere in web page
54
+ document.body.addEventListener("click", function () {
55
+ return _this.updateOverflowMenu(false);
56
+ });
57
+ };
58
+ Toolbar.prototype.render = function (animate) {
59
+ if (animate === void 0) { animate = true; }
60
+ var isDataLoading = Tools.getProperty(this.model.getOptions(), "data", "loading");
61
+ // size of toolbar button with background
62
+ var buttonSize = Configuration.toolbar.buttonSize;
63
+ var parentY = parseFloat(this.parent.node().getAttribute("y"));
64
+ var svg = this.getContainerSVG();
65
+ // TODO -- adjust toolbar Y position to align title component
66
+ // before layout component supports vertical alignment center
67
+ var Y_OFFSET = -6;
68
+ svg.attr("transform", "translate(0, " + (parentY + Y_OFFSET) + ")");
69
+ var width = DOMUtils.getSVGElementSize(this.services.domUtils.getMainSVG(), {
70
+ useAttrs: true
71
+ }).width;
72
+ // overflow menu width is 160px
73
+ // it's set by Carbon component
74
+ var overflowMenuWidth = 160;
75
+ // no good solution to get correct Toolbar position
76
+ // parent x doesn't work well
77
+ // assume the overflow icon has right alignment in layout
78
+ this.overflowMenuX = width - overflowMenuWidth;
79
+ this.overflowMenuY = parentY + Y_OFFSET + buttonSize;
80
+ var container = DOMUtils.appendOrSelect(svg, "svg.toolbar-container")
81
+ .attr("width", "100%")
82
+ .attr("height", Configuration.toolbar.height)
83
+ .attr("opacity", 1);
84
+ // clean children first
85
+ container.html(null);
86
+ // get the toolbar buttons
87
+ var _a = this.getControlConfigs(), buttonList = _a.buttonList, overflowMenuItemList = _a.overflowMenuItemList;
88
+ // overflow button is required only if overflow menu item list is valid
89
+ if (!!overflowMenuItemList) {
90
+ buttonList.push(this.getOverflowButtonConfig());
91
+ }
92
+ // loading or empty state
93
+ if (isDataLoading || buttonList.length === 0) {
94
+ // put an empty rect to keep space unchanged
95
+ DOMUtils.appendOrSelect(container, "svg.toolbar-loading-spacer")
96
+ .append("rect")
97
+ .attr("height", Configuration.toolbar.height)
98
+ .attr("width", buttonSize * 3) // value doesn't matter but can't be empty
99
+ .attr("opacity", 0);
100
+ }
101
+ else {
102
+ // render toolbar buttons sequentially
103
+ var buttonXPosition_1 = 0;
104
+ buttonList.forEach(function (button) {
105
+ // button container
106
+ var buttonContainer = DOMUtils.appendOrSelect(container, "svg." + button.id).classed("toolbar-button", true);
107
+ // add button background rect
108
+ var buttonBackground = DOMUtils.appendOrSelect(buttonContainer, "rect.toolbar-button-background")
109
+ .attr("x", buttonXPosition_1)
110
+ .attr("y", 0)
111
+ .attr("width", buttonSize)
112
+ .attr("height", buttonSize);
113
+ var buttonIcon = DOMUtils.appendOrSelect(buttonContainer, "svg.toolbar-button-icon")
114
+ .attr("x", buttonXPosition_1 + Configuration.toolbar.iconPadding)
115
+ .attr("y", Configuration.toolbar.iconPadding)
116
+ .attr("width", Configuration.toolbar.iconSize)
117
+ .attr("height", Configuration.toolbar.iconSize)
118
+ .attr("viewBox", "0 0 32 32")
119
+ .attr("role", Roles.IMG);
120
+ buttonIcon.html(button.iconSVGContent);
121
+ if (button.shouldBeDisabled()) {
122
+ buttonContainer
123
+ .classed("toolbar-button--disabled", true)
124
+ .classed("toolbar-button--focusable", false)
125
+ .attr("tabindex", -1)
126
+ .attr("role", null);
127
+ buttonIcon.classed("toolbar-button-icon--disabled", true);
128
+ buttonBackground.classed("toolbar-button-background--disabled", true);
129
+ buttonContainer.on("click", null).on("keyup", null);
130
+ }
131
+ else {
132
+ buttonContainer
133
+ .classed("toolbar-button--disabled", false)
134
+ .classed("toolbar-button--focusable", true)
135
+ .attr("tabindex", 0)
136
+ .attr("role", Roles.BUTTON);
137
+ buttonIcon.classed("toolbar-button-icon--disabled", false);
138
+ buttonBackground.classed("toolbar-button-background--disabled", false);
139
+ buttonContainer
140
+ .on("click", button.clickFunction)
141
+ .on("keyup", function () {
142
+ if ((event.key && event.key === "Enter") ||
143
+ event.key === " ") {
144
+ event.preventDefault();
145
+ button.clickFunction();
146
+ }
147
+ });
148
+ }
149
+ buttonXPosition_1 += buttonSize;
150
+ });
151
+ this.overflowButton = this.getContainerSVG().select("svg.toolbar-overflow-menu");
152
+ if (this.isOverflowMenuOpen()) {
153
+ // keep overflow menu displayed
154
+ this.updateOverflowMenu(true);
155
+ }
156
+ }
157
+ };
158
+ Toolbar.prototype.isOverflowMenuOpen = function () {
159
+ return (this.overflowMenu
160
+ .selectAll("ul.bx--overflow-menu-options--open")
161
+ .size() > 0);
162
+ };
163
+ // show/hide overflow menu
164
+ Toolbar.prototype.updateOverflowMenu = function (show) {
165
+ // update overflow button background
166
+ if (this.overflowButton) {
167
+ this.overflowButton.classed("toolbar-button--hovered", show);
168
+ }
169
+ if (show) {
170
+ this.services.events.dispatchEvent(Events.Toolbar.SHOW_OVERFLOW_MENU);
171
+ }
172
+ else {
173
+ this.services.events.dispatchEvent(Events.Toolbar.HIDE_OVERFLOW_MENU);
174
+ }
175
+ };
176
+ Toolbar.prototype.focusOnPreviousEnabledMenuItem = function (currentItemIndex) {
177
+ var overflowMenuItems = this.getOverflowMenuItems();
178
+ var previousItemIndex = overflowMenuItems.length;
179
+ for (var i = currentItemIndex - 1; i >= 0; i--) {
180
+ var previousOverflowMenuItem = overflowMenuItems[i];
181
+ if (!previousOverflowMenuItem.shouldBeDisabled()) {
182
+ previousItemIndex = i;
183
+ break;
184
+ }
185
+ }
186
+ // only if previous enabled menu item found
187
+ if (previousItemIndex < overflowMenuItems.length) {
188
+ var previousItemNode = select("#" +
189
+ overflowMenuItems[previousItemIndex].id +
190
+ this.overflowMenuItemId).node();
191
+ if ("focus" in previousItemNode) {
192
+ previousItemNode.focus();
193
+ }
194
+ }
195
+ };
196
+ Toolbar.prototype.focusOnNextEnabledMenuItem = function (currentItemIndex) {
197
+ var overflowMenuItems = this.getOverflowMenuItems();
198
+ var nextItemIndex = -1;
199
+ for (var i = currentItemIndex + 1; i < overflowMenuItems.length; i++) {
200
+ var nextOverflowMenuItem = overflowMenuItems[i];
201
+ if (!nextOverflowMenuItem.shouldBeDisabled()) {
202
+ nextItemIndex = i;
203
+ break;
204
+ }
205
+ }
206
+ // only if next enabled menu item found
207
+ if (nextItemIndex > -1) {
208
+ var nextItemNode = select("#" +
209
+ overflowMenuItems[nextItemIndex].id +
210
+ this.overflowMenuItemId).node();
211
+ if ("focus" in nextItemNode) {
212
+ nextItemNode.focus();
213
+ }
214
+ }
215
+ };
216
+ Toolbar.prototype.toggleOverflowMenu = function () {
217
+ var _this = this;
218
+ if (this.isOverflowMenuOpen()) {
219
+ // hide overflow menu
220
+ this.updateOverflowMenu(false);
221
+ }
222
+ else {
223
+ // show overflow menu
224
+ this.updateOverflowMenu(true);
225
+ // setup overflow menu item event listener
226
+ var self_1 = this;
227
+ var overflowMenuItems = this.getOverflowMenuItems();
228
+ overflowMenuItems.forEach(function (menuItem, index) {
229
+ var element = select("#" + menuItem.id + _this.overflowMenuItemId);
230
+ if (element !== null) {
231
+ element.on("click", function () {
232
+ // call the specified function
233
+ menuItem.clickFunction();
234
+ // hide overflow menu
235
+ self_1.updateOverflowMenu(false);
236
+ });
237
+ element.on("keyup", function () {
238
+ if (event.key === "Enter") {
239
+ // call the specified function
240
+ menuItem.clickFunction();
241
+ }
242
+ else if (event.key === "ArrowUp") {
243
+ // focus on previous menu item
244
+ self_1.focusOnPreviousEnabledMenuItem(index);
245
+ }
246
+ else if (event.key === "ArrowDown") {
247
+ // focus on next menu item
248
+ self_1.focusOnNextEnabledMenuItem(index);
249
+ }
250
+ // Not hide overflow menu by keyboard arrow up/down event
251
+ });
252
+ }
253
+ });
254
+ // default to focus on the first enabled menu item
255
+ self_1.focusOnNextEnabledMenuItem(-1);
256
+ }
257
+ event.stopImmediatePropagation();
258
+ };
259
+ Toolbar.prototype.getOverflowMenuHTML = function () {
260
+ var _this = this;
261
+ var overflowMenuItems = this.getOverflowMenuItems();
262
+ // don't render whole overflow menu if no overflow menu item
263
+ if (!overflowMenuItems || overflowMenuItems.length === 0) {
264
+ return "";
265
+ }
266
+ var overflowMenuHtml;
267
+ overflowMenuHtml = "<div data-floating-menu-container=\"true\" data-floating-menu-direction=\"bottom\" role=\"main\">\n\t\t\t<ul class=\"bx--overflow-menu-options bx--overflow-menu--flip bx--overflow-menu-options--open\"\n\t\t\t\ttabindex=\"-1\" role=\"" + Roles.MENU + "\" aria-label=\"Menu\" data-floating-menu-direction=\"bottom\"\n\t\t\t\tstyle=\"left:" + this.overflowMenuX + "px; top:" + this.overflowMenuY + "px;\">";
268
+ // generate html for each overflow menu items
269
+ overflowMenuItems.forEach(function (menuItem, index) {
270
+ var menuItemClasses = "bx--overflow-menu-options__option".concat(menuItem.shouldBeDisabled()
271
+ ? " bx--overflow-menu-options__option--disabled" // class for disabled menu item
272
+ : "");
273
+ overflowMenuHtml += "<li class=\"" + menuItemClasses + "\" role=\"" + Roles.MENU_ITEM + "\">\n\t\t\t\t<button class=\"bx--overflow-menu-options__btn\"\n\t\t\t\t\tdata-floating-menu-primary-focus=\"" + (index === 0) + "\"\n\t\t\t\t\ttabindex=\"-1\" index=\"" + index + "\" title=\"" + menuItem.text + "\"\n\t\t\t\t\tid=\"" + (menuItem.id + _this.overflowMenuItemId) + "\">\n\t\t\t\t\t<div class=\"bx--overflow-menu-options__option-content\">\n\t\t\t\t\t\t" + menuItem.text + "\n\t\t\t\t\t</div>\n\t\t\t\t</button>\n\t\t\t</li>";
274
+ });
275
+ overflowMenuHtml += "</ul></div>";
276
+ return overflowMenuHtml;
277
+ };
278
+ Toolbar.prototype.getControlConfigs = function () {
279
+ var _this = this;
280
+ var numberOfIcons = Tools.getProperty(this.model.getOptions(), "toolbar", "numberOfIcons");
281
+ var controls = Tools.getProperty(this.model.getOptions(), "toolbar", "controls");
282
+ var controlList = [];
283
+ controls.forEach(function (control) {
284
+ var controlConfig = _this.getControlConfigByType(control.type);
285
+ // add to list if config is valid
286
+ if (controlConfig) {
287
+ controlConfig.text = control.text ? control.text : control.type;
288
+ controlList.push(controlConfig);
289
+ }
290
+ });
291
+ if (controlList.length <= numberOfIcons) {
292
+ return {
293
+ buttonList: controlList
294
+ };
295
+ }
296
+ return {
297
+ // leave one button for overflow button
298
+ buttonList: controlList.splice(0, numberOfIcons - 1),
299
+ overflowMenuItemList: controlList
300
+ };
301
+ };
302
+ Toolbar.prototype.getOverflowMenuItems = function () {
303
+ var overflowMenuItemList = this.getControlConfigs().overflowMenuItemList;
304
+ if (!!overflowMenuItemList) {
305
+ return overflowMenuItemList;
306
+ }
307
+ else {
308
+ return [];
309
+ }
310
+ };
311
+ // special button config for overflow button
312
+ Toolbar.prototype.getOverflowButtonConfig = function () {
313
+ var _this = this;
314
+ return {
315
+ id: "toolbar-overflow-menu",
316
+ shouldBeDisabled: function () { return false; },
317
+ iconSVGContent: "<circle cx=\"16\" cy=\"8\" r=\"2\"></circle>\n\t\t\t\t\t\t\t <circle cx=\"16\" cy=\"16\" r=\"2\"></circle>\n\t\t\t\t\t\t\t <circle cx=\"16\" cy=\"24\" r=\"2\"></circle>",
318
+ clickFunction: function () { return _this.toggleOverflowMenu(); }
319
+ };
320
+ };
321
+ Toolbar.prototype.getControlConfigByType = function (controlType) {
322
+ var _this = this;
323
+ var isZoomBarEnabled = this.services.zoom.isZoomBarEnabled() &&
324
+ !this.services.zoom.isEmptyState();
325
+ var controlConfig;
326
+ switch (controlType) {
327
+ case ToolbarControlTypes.ZOOM_IN:
328
+ if (isZoomBarEnabled) {
329
+ controlConfig = {
330
+ id: "toolbar-zoomIn",
331
+ shouldBeDisabled: function () {
332
+ return _this.services.zoom.isMinZoomDomain();
333
+ },
334
+ iconSVGContent: this.getControlIconByType(controlType),
335
+ clickFunction: function () { return _this.services.zoom.zoomIn(); }
336
+ };
337
+ }
338
+ break;
339
+ case ToolbarControlTypes.ZOOM_OUT:
340
+ if (isZoomBarEnabled) {
341
+ controlConfig = {
342
+ id: "toolbar-zoomOut",
343
+ shouldBeDisabled: function () {
344
+ return _this.services.zoom.isMaxZoomDomain();
345
+ },
346
+ iconSVGContent: this.getControlIconByType(controlType),
347
+ clickFunction: function () { return _this.services.zoom.zoomOut(); }
348
+ };
349
+ }
350
+ break;
351
+ case ToolbarControlTypes.RESET_ZOOM:
352
+ if (isZoomBarEnabled) {
353
+ controlConfig = {
354
+ id: "toolbar-resetZoom",
355
+ shouldBeDisabled: function () {
356
+ return _this.services.zoom.isMaxZoomDomain();
357
+ },
358
+ iconSVGContent: this.getControlIconByType(controlType),
359
+ clickFunction: function () {
360
+ return _this.services.zoom.resetZoomDomain();
361
+ }
362
+ };
363
+ }
364
+ break;
365
+ // add more toolbar control configuration here
366
+ default:
367
+ throw Error("Not supported toolbar control type: " + controlType);
368
+ }
369
+ return controlConfig;
370
+ };
371
+ Toolbar.prototype.getControlIconByType = function (controlType) {
372
+ switch (controlType) {
373
+ case ToolbarControlTypes.ZOOM_IN:
374
+ return "<polygon points=\"19 13 15 13 15 9 13 9 13 13 9 13 9 15 13 15 13 19 15 19 15 15 19 15 19 13\"/>\n \t\t\t\t\t<path d=\"M22.45,21A10.87,10.87,0,0,0,25,14,11,11,0,1,0,14,25a10.87,10.87,0,0,0,7-2.55L28.59,30,30,28.59ZM14,23a9,9,0,1,1,9-9A9,9,0,0,1,14,23Z\"/>";
375
+ case ToolbarControlTypes.ZOOM_OUT:
376
+ return "<rect x=\"9\" y=\"13\" width=\"10\" height=\"2\"/>\n\t\t\t\t\t\t<path d=\"M22.45,21A10.87,10.87,0,0,0,25,14,11,11,0,1,0,14,25a10.87,10.87,0,0,0,7-2.55L28.59,30,30,28.59ZM14,23a9,9,0,1,1,9-9A9,9,0,0,1,14,23Z\"/>";
377
+ case ToolbarControlTypes.RESET_ZOOM:
378
+ return "<path d=\"M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z\"/>";
379
+ // add more icons here
380
+ // svg icon must be with 32x32 viewBox
381
+ default:
382
+ throw Error("Not supported toolbar control type: " + controlType);
383
+ }
384
+ };
385
+ return Toolbar;
386
+ }(Component));
387
+ export { Toolbar };
388
+ //# sourceMappingURL=../../../src/components/axes/toolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolbar.js","sourceRoot":"","sources":["toolbar.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAC;AAErD,aAAa;AACb,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE7C,yCAAyC;AACzC,OAAO,QAAQ,MAAM,0CAA0C,CAAC;AAEhE;IAA6B,2BAAS;IAAtC;QAAA,qEA4dC;QA3dA,UAAI,GAAG,SAAS,CAAC;QAQjB,mCAAmC;QACnC,mBAAa,GAAG,CAAC,CAAC;QAClB,mBAAa,GAAG,CAAC,CAAC;QAElB,6DAA6D;QAC7D,iEAAiE;QACjE,wBAAkB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,WAAW,CAAC,CAAC;;IA6c9D,CAAC;IA3cA,sBAAI,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,8CAA8C;YAE9C;gBACC,MAAM,KAAK,CACV,sCAAsC,GAAG,WAAW,CACpD,CAAC;SACH;QACD,OAAO,aAAa,CAAC;IACtB,CAAC;IAED,sCAAoB,GAApB,UAAqB,WAAgC;QACpD,QAAQ,WAAW,EAAE;YACpB,KAAK,mBAAmB,CAAC,OAAO;gBAC/B,OAAO,mQAC+I,CAAC;YACxJ,KAAK,mBAAmB,CAAC,QAAQ;gBAChC,OAAO,oNAC4I,CAAC;YACrJ,KAAK,mBAAmB,CAAC,UAAU;gBAClC,OAAO,iNAA+M,CAAC;YAExN,sBAAsB;YACtB,sCAAsC;YAEtC;gBACC,MAAM,KAAK,CACV,sCAAsC,GAAG,WAAW,CACpD,CAAC;SACH;IACF,CAAC;IACF,cAAC;AAAD,CAAC,AA5dD,CAA6B,SAAS,GA4drC","sourcesContent":["// Internal Imports\nimport { Component } from \"../component\";\nimport { Events, Roles, ToolbarControlTypes } from \"../../interfaces\";\nimport { Tools } from \"../../tools\";\nimport { DOMUtils } from \"../../services\";\nimport * as Configuration from \"../../configuration\";\n\n// D3 Imports\nimport { event, select } from \"d3-selection\";\n\n// import the settings for the css prefix\nimport settings from \"carbon-components/es/globals/js/settings\";\n\nexport class Toolbar extends Component {\n\ttype = \"toolbar\";\n\n\t// overflow menu button to control background color\n\toverflowButton: any;\n\n\t// ul options list element\n\toverflowMenu: any;\n\n\t// x, y coordinate of overflow menu\n\toverflowMenuX = 0;\n\toverflowMenuY = 0;\n\n\t// Use a random number to create overflow menu item unique ID\n\t// so they don't interfere the other overflow menu item in a page\n\toverflowMenuItemId = Math.floor(Math.random() * 99999999999);\n\n\tinit() {\n\t\tconst options = this.model.getOptions();\n\n\t\t// Grab the tooltip element\n\t\tconst holder = select(this.services.domUtils.getHolder());\n\t\tconst chartPrefix = Tools.getProperty(options, \"style\", \"prefix\");\n\n\t\tthis.overflowMenu = DOMUtils.appendOrSelect(\n\t\t\tholder,\n\t\t\t`div.${settings.prefix}--${chartPrefix}--overflowMenu`\n\t\t);\n\n\t\tthis.overflowMenu.style(\"max-width\", null);\n\n\t\t// listen to show overflow menu event to render the overflow menu\n\t\tthis.services.events.addEventListener(\n\t\t\tEvents.Toolbar.SHOW_OVERFLOW_MENU,\n\t\t\t() => {\n\t\t\t\tthis.overflowMenu.html(this.getOverflowMenuHTML());\n\t\t\t}\n\t\t);\n\n\t\t// listen to hide overflow menu event to hide the overflow menu\n\t\tthis.services.events.addEventListener(\n\t\t\tEvents.Toolbar.HIDE_OVERFLOW_MENU,\n\t\t\t() => {\n\t\t\t\tthis.overflowMenu.html(null);\n\t\t\t}\n\t\t);\n\t\t// hide overflow menu if user clicks on somewhere in web page\n\t\tdocument.body.addEventListener(\"click\", () =>\n\t\t\tthis.updateOverflowMenu(false)\n\t\t);\n\t}\n\n\trender(animate = true) {\n\t\tconst isDataLoading = Tools.getProperty(\n\t\t\tthis.model.getOptions(),\n\t\t\t\"data\",\n\t\t\t\"loading\"\n\t\t);\n\n\t\t// size of toolbar button with background\n\t\tconst buttonSize = Configuration.toolbar.buttonSize;\n\t\tconst parentY = parseFloat(this.parent.node().getAttribute(\"y\"));\n\n\t\tconst svg = this.getContainerSVG();\n\n\t\t// TODO -- adjust toolbar Y position to align title component\n\t\t// before layout component supports vertical alignment center\n\t\tconst Y_OFFSET = -6;\n\t\tsvg.attr(\"transform\", `translate(0, ${parentY + Y_OFFSET})`);\n\n\t\tconst { width } = DOMUtils.getSVGElementSize(\n\t\t\tthis.services.domUtils.getMainSVG(),\n\t\t\t{\n\t\t\t\tuseAttrs: true\n\t\t\t}\n\t\t);\n\n\t\t// overflow menu width is 160px\n\t\t// it's set by Carbon component\n\t\tconst overflowMenuWidth = 160;\n\t\t// no good solution to get correct Toolbar position\n\t\t// parent x doesn't work well\n\t\t// assume the overflow icon has right alignment in layout\n\t\tthis.overflowMenuX = width - overflowMenuWidth;\n\t\tthis.overflowMenuY = parentY + Y_OFFSET + buttonSize;\n\t\tconst container = DOMUtils.appendOrSelect(svg, \"svg.toolbar-container\")\n\t\t\t.attr(\"width\", \"100%\")\n\t\t\t.attr(\"height\", Configuration.toolbar.height)\n\t\t\t.attr(\"opacity\", 1);\n\n\t\t// clean children first\n\t\tcontainer.html(null);\n\n\t\t// get the toolbar buttons\n\t\tconst { buttonList, overflowMenuItemList } = this.getControlConfigs();\n\n\t\t// overflow button is required only if overflow menu item list is valid\n\t\tif (!!overflowMenuItemList) {\n\t\t\tbuttonList.push(this.getOverflowButtonConfig());\n\t\t}\n\n\t\t// loading or empty state\n\t\tif (isDataLoading || buttonList.length === 0) {\n\t\t\t// put an empty rect to keep space unchanged\n\t\t\tDOMUtils.appendOrSelect(container, \"svg.toolbar-loading-spacer\")\n\t\t\t\t.append(\"rect\")\n\t\t\t\t.attr(\"height\", Configuration.toolbar.height)\n\t\t\t\t.attr(\"width\", buttonSize * 3) // value doesn't matter but can't be empty\n\t\t\t\t.attr(\"opacity\", 0);\n\t\t} else {\n\t\t\t// render toolbar buttons sequentially\n\t\t\tlet buttonXPosition = 0;\n\t\t\tbuttonList.forEach((button) => {\n\t\t\t\t// button container\n\t\t\t\tconst buttonContainer = DOMUtils.appendOrSelect(\n\t\t\t\t\tcontainer,\n\t\t\t\t\t`svg.${button.id}`\n\t\t\t\t).classed(\"toolbar-button\", true);\n\n\t\t\t\t// add button background rect\n\t\t\t\tconst buttonBackground = DOMUtils.appendOrSelect(\n\t\t\t\t\tbuttonContainer,\n\t\t\t\t\t\"rect.toolbar-button-background\"\n\t\t\t\t)\n\t\t\t\t\t.attr(\"x\", buttonXPosition)\n\t\t\t\t\t.attr(\"y\", 0)\n\t\t\t\t\t.attr(\"width\", buttonSize)\n\t\t\t\t\t.attr(\"height\", buttonSize);\n\n\t\t\t\tconst buttonIcon = DOMUtils.appendOrSelect(\n\t\t\t\t\tbuttonContainer,\n\t\t\t\t\t\"svg.toolbar-button-icon\"\n\t\t\t\t)\n\t\t\t\t\t.attr(\n\t\t\t\t\t\t\"x\",\n\t\t\t\t\t\tbuttonXPosition + Configuration.toolbar.iconPadding\n\t\t\t\t\t)\n\t\t\t\t\t.attr(\"y\", Configuration.toolbar.iconPadding)\n\t\t\t\t\t.attr(\"width\", Configuration.toolbar.iconSize)\n\t\t\t\t\t.attr(\"height\", Configuration.toolbar.iconSize)\n\t\t\t\t\t.attr(\"viewBox\", \"0 0 32 32\")\n\t\t\t\t\t.attr(\"role\", Roles.IMG);\n\n\t\t\t\tbuttonIcon.html(button.iconSVGContent);\n\t\t\t\tif (button.shouldBeDisabled()) {\n\t\t\t\t\tbuttonContainer\n\t\t\t\t\t\t.classed(\"toolbar-button--disabled\", true)\n\t\t\t\t\t\t.classed(\"toolbar-button--focusable\", false)\n\t\t\t\t\t\t.attr(\"tabindex\", -1)\n\t\t\t\t\t\t.attr(\"role\", null);\n\t\t\t\t\tbuttonIcon.classed(\"toolbar-button-icon--disabled\", true);\n\t\t\t\t\tbuttonBackground.classed(\n\t\t\t\t\t\t\"toolbar-button-background--disabled\",\n\t\t\t\t\t\ttrue\n\t\t\t\t\t);\n\t\t\t\t\tbuttonContainer.on(\"click\", null).on(\"keyup\", null);\n\t\t\t\t} else {\n\t\t\t\t\tbuttonContainer\n\t\t\t\t\t\t.classed(\"toolbar-button--disabled\", false)\n\t\t\t\t\t\t.classed(\"toolbar-button--focusable\", true)\n\t\t\t\t\t\t.attr(\"tabindex\", 0)\n\t\t\t\t\t\t.attr(\"role\", Roles.BUTTON);\n\t\t\t\t\tbuttonIcon.classed(\"toolbar-button-icon--disabled\", false);\n\t\t\t\t\tbuttonBackground.classed(\n\t\t\t\t\t\t\"toolbar-button-background--disabled\",\n\t\t\t\t\t\tfalse\n\t\t\t\t\t);\n\t\t\t\t\tbuttonContainer\n\t\t\t\t\t\t.on(\"click\", button.clickFunction)\n\t\t\t\t\t\t.on(\"keyup\", () => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t(event.key && event.key === \"Enter\") ||\n\t\t\t\t\t\t\t\tevent.key === \" \"\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t\t\tbutton.clickFunction();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tbuttonXPosition += buttonSize;\n\t\t\t});\n\n\t\t\tthis.overflowButton = this.getContainerSVG().select(\n\t\t\t\t\"svg.toolbar-overflow-menu\"\n\t\t\t);\n\n\t\t\tif (this.isOverflowMenuOpen()) {\n\t\t\t\t// keep overflow menu displayed\n\t\t\t\tthis.updateOverflowMenu(true);\n\t\t\t}\n\t\t}\n\t}\n\n\tisOverflowMenuOpen() {\n\t\treturn (\n\t\t\tthis.overflowMenu\n\t\t\t\t.selectAll(\"ul.bx--overflow-menu-options--open\")\n\t\t\t\t.size() > 0\n\t\t);\n\t}\n\n\t// show/hide overflow menu\n\tupdateOverflowMenu(show: boolean) {\n\t\t// update overflow button background\n\t\tif (this.overflowButton) {\n\t\t\tthis.overflowButton.classed(\"toolbar-button--hovered\", show);\n\t\t}\n\t\tif (show) {\n\t\t\tthis.services.events.dispatchEvent(\n\t\t\t\tEvents.Toolbar.SHOW_OVERFLOW_MENU\n\t\t\t);\n\t\t} else {\n\t\t\tthis.services.events.dispatchEvent(\n\t\t\t\tEvents.Toolbar.HIDE_OVERFLOW_MENU\n\t\t\t);\n\t\t}\n\t}\n\n\tfocusOnPreviousEnabledMenuItem(currentItemIndex) {\n\t\tconst overflowMenuItems = this.getOverflowMenuItems();\n\t\tlet previousItemIndex = overflowMenuItems.length;\n\t\tfor (let i = currentItemIndex - 1; i >= 0; i--) {\n\t\t\tconst previousOverflowMenuItem = overflowMenuItems[i];\n\t\t\tif (!previousOverflowMenuItem.shouldBeDisabled()) {\n\t\t\t\tpreviousItemIndex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// only if previous enabled menu item found\n\t\tif (previousItemIndex < overflowMenuItems.length) {\n\t\t\tconst previousItemNode = select(\n\t\t\t\t\"#\" +\n\t\t\t\t\toverflowMenuItems[previousItemIndex].id +\n\t\t\t\t\tthis.overflowMenuItemId\n\t\t\t).node();\n\t\t\tif (\"focus\" in previousItemNode) {\n\t\t\t\tpreviousItemNode.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tfocusOnNextEnabledMenuItem(currentItemIndex) {\n\t\tconst overflowMenuItems = this.getOverflowMenuItems();\n\t\tlet nextItemIndex = -1;\n\t\tfor (let i = currentItemIndex + 1; i < overflowMenuItems.length; i++) {\n\t\t\tconst nextOverflowMenuItem = overflowMenuItems[i];\n\t\t\tif (!nextOverflowMenuItem.shouldBeDisabled()) {\n\t\t\t\tnextItemIndex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// only if next enabled menu item found\n\t\tif (nextItemIndex > -1) {\n\t\t\tconst nextItemNode = select(\n\t\t\t\t\"#\" +\n\t\t\t\t\toverflowMenuItems[nextItemIndex].id +\n\t\t\t\t\tthis.overflowMenuItemId\n\t\t\t).node();\n\t\t\tif (\"focus\" in nextItemNode) {\n\t\t\t\tnextItemNode.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\ttoggleOverflowMenu() {\n\t\tif (this.isOverflowMenuOpen()) {\n\t\t\t// hide overflow menu\n\t\t\tthis.updateOverflowMenu(false);\n\t\t} else {\n\t\t\t// show overflow menu\n\t\t\tthis.updateOverflowMenu(true);\n\n\t\t\t// setup overflow menu item event listener\n\t\t\tconst self = this;\n\t\t\tconst overflowMenuItems = this.getOverflowMenuItems();\n\t\t\toverflowMenuItems.forEach((menuItem, index) => {\n\t\t\t\tconst element = select(\n\t\t\t\t\t\"#\" + menuItem.id + this.overflowMenuItemId\n\t\t\t\t);\n\t\t\t\tif (element !== null) {\n\t\t\t\t\telement.on(\"click\", () => {\n\t\t\t\t\t\t// call the specified function\n\t\t\t\t\t\tmenuItem.clickFunction();\n\n\t\t\t\t\t\t// hide overflow menu\n\t\t\t\t\t\tself.updateOverflowMenu(false);\n\t\t\t\t\t});\n\t\t\t\t\telement.on(\"keyup\", () => {\n\t\t\t\t\t\tif (event.key === \"Enter\") {\n\t\t\t\t\t\t\t// call the specified function\n\t\t\t\t\t\t\tmenuItem.clickFunction();\n\t\t\t\t\t\t} else if (event.key === \"ArrowUp\") {\n\t\t\t\t\t\t\t// focus on previous menu item\n\t\t\t\t\t\t\tself.focusOnPreviousEnabledMenuItem(index);\n\t\t\t\t\t\t} else if (event.key === \"ArrowDown\") {\n\t\t\t\t\t\t\t// focus on next menu item\n\t\t\t\t\t\t\tself.focusOnNextEnabledMenuItem(index);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Not hide overflow menu by keyboard arrow up/down event\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// default to focus on the first enabled menu item\n\t\t\tself.focusOnNextEnabledMenuItem(-1);\n\t\t}\n\t\tevent.stopImmediatePropagation();\n\t}\n\n\tgetOverflowMenuHTML() {\n\t\tconst overflowMenuItems = this.getOverflowMenuItems();\n\t\t// don't render whole overflow menu if no overflow menu item\n\t\tif (!overflowMenuItems || overflowMenuItems.length === 0) {\n\t\t\treturn \"\";\n\t\t}\n\n\t\tlet overflowMenuHtml;\n\t\toverflowMenuHtml = `<div data-floating-menu-container=\"true\" data-floating-menu-direction=\"bottom\" role=\"main\">\n\t\t\t<ul class=\"bx--overflow-menu-options bx--overflow-menu--flip bx--overflow-menu-options--open\"\n\t\t\t\ttabindex=\"-1\" role=\"${Roles.MENU}\" aria-label=\"Menu\" data-floating-menu-direction=\"bottom\"\n\t\t\t\tstyle=\"left:${this.overflowMenuX}px; top:${this.overflowMenuY}px;\">`;\n\n\t\t// generate html for each overflow menu items\n\t\toverflowMenuItems.forEach((menuItem, index) => {\n\t\t\tconst menuItemClasses = \"bx--overflow-menu-options__option\".concat(\n\t\t\t\tmenuItem.shouldBeDisabled()\n\t\t\t\t\t? \" bx--overflow-menu-options__option--disabled\" // class for disabled menu item\n\t\t\t\t\t: \"\"\n\t\t\t);\n\t\t\toverflowMenuHtml += `<li class=\"${menuItemClasses}\" role=\"${\n\t\t\t\tRoles.MENU_ITEM\n\t\t\t}\">\n\t\t\t\t<button class=\"bx--overflow-menu-options__btn\"\n\t\t\t\t\tdata-floating-menu-primary-focus=\"${index === 0}\"\n\t\t\t\t\ttabindex=\"-1\" index=\"${index}\" title=\"${menuItem.text}\"\n\t\t\t\t\tid=\"${menuItem.id + this.overflowMenuItemId}\">\n\t\t\t\t\t<div class=\"bx--overflow-menu-options__option-content\">\n\t\t\t\t\t\t${menuItem.text}\n\t\t\t\t\t</div>\n\t\t\t\t</button>\n\t\t\t</li>`;\n\t\t});\n\n\t\toverflowMenuHtml += `</ul></div>`;\n\t\treturn overflowMenuHtml;\n\t}\n\n\tgetControlConfigs() {\n\t\tconst numberOfIcons = Tools.getProperty(\n\t\t\tthis.model.getOptions(),\n\t\t\t\"toolbar\",\n\t\t\t\"numberOfIcons\"\n\t\t);\n\t\tconst controls = Tools.getProperty(\n\t\t\tthis.model.getOptions(),\n\t\t\t\"toolbar\",\n\t\t\t\"controls\"\n\t\t);\n\t\tconst controlList = [];\n\t\tcontrols.forEach((control) => {\n\t\t\tconst controlConfig = this.getControlConfigByType(control.type);\n\n\t\t\t// add to list if config is valid\n\t\t\tif (controlConfig) {\n\t\t\t\tcontrolConfig.text = control.text ? control.text : control.type;\n\t\t\t\tcontrolList.push(controlConfig);\n\t\t\t}\n\t\t});\n\n\t\tif (controlList.length <= numberOfIcons) {\n\t\t\treturn {\n\t\t\t\tbuttonList: controlList\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\t// leave one button for overflow button\n\t\t\tbuttonList: controlList.splice(0, numberOfIcons - 1),\n\t\t\toverflowMenuItemList: controlList\n\t\t};\n\t}\n\n\tgetOverflowMenuItems() {\n\t\tconst { overflowMenuItemList } = this.getControlConfigs();\n\t\tif (!!overflowMenuItemList) {\n\t\t\treturn overflowMenuItemList;\n\t\t} else {\n\t\t\treturn [];\n\t\t}\n\t}\n\n\t// special button config for overflow button\n\tgetOverflowButtonConfig() {\n\t\treturn {\n\t\t\tid: \"toolbar-overflow-menu\",\n\t\t\tshouldBeDisabled: () => false,\n\t\t\ticonSVGContent: `<circle cx=\"16\" cy=\"8\" r=\"2\"></circle>\n\t\t\t\t\t\t\t <circle cx=\"16\" cy=\"16\" r=\"2\"></circle>\n\t\t\t\t\t\t\t <circle cx=\"16\" cy=\"24\" r=\"2\"></circle>`,\n\t\t\tclickFunction: () => this.toggleOverflowMenu()\n\t\t};\n\t}\n\n\tgetControlConfigByType(controlType: ToolbarControlTypes) {\n\t\tconst isZoomBarEnabled =\n\t\t\tthis.services.zoom.isZoomBarEnabled() &&\n\t\t\t!this.services.zoom.isEmptyState();\n\n\t\tlet controlConfig;\n\t\tswitch (controlType) {\n\t\t\tcase ToolbarControlTypes.ZOOM_IN:\n\t\t\t\tif (isZoomBarEnabled) {\n\t\t\t\t\tcontrolConfig = {\n\t\t\t\t\t\tid: \"toolbar-zoomIn\",\n\t\t\t\t\t\tshouldBeDisabled: () =>\n\t\t\t\t\t\t\tthis.services.zoom.isMinZoomDomain(),\n\t\t\t\t\t\ticonSVGContent: this.getControlIconByType(controlType),\n\t\t\t\t\t\tclickFunction: () => this.services.zoom.zoomIn()\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase ToolbarControlTypes.ZOOM_OUT:\n\t\t\t\tif (isZoomBarEnabled) {\n\t\t\t\t\tcontrolConfig = {\n\t\t\t\t\t\tid: \"toolbar-zoomOut\",\n\t\t\t\t\t\tshouldBeDisabled: () =>\n\t\t\t\t\t\t\tthis.services.zoom.isMaxZoomDomain(),\n\t\t\t\t\t\ticonSVGContent: this.getControlIconByType(controlType),\n\t\t\t\t\t\tclickFunction: () => this.services.zoom.zoomOut()\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase ToolbarControlTypes.RESET_ZOOM:\n\t\t\t\tif (isZoomBarEnabled) {\n\t\t\t\t\tcontrolConfig = {\n\t\t\t\t\t\tid: \"toolbar-resetZoom\",\n\t\t\t\t\t\tshouldBeDisabled: () =>\n\t\t\t\t\t\t\tthis.services.zoom.isMaxZoomDomain(),\n\t\t\t\t\t\ticonSVGContent: this.getControlIconByType(controlType),\n\t\t\t\t\t\tclickFunction: () =>\n\t\t\t\t\t\t\tthis.services.zoom.resetZoomDomain()\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\t// add more toolbar control configuration here\n\n\t\t\tdefault:\n\t\t\t\tthrow Error(\n\t\t\t\t\t\"Not supported toolbar control type: \" + controlType\n\t\t\t\t);\n\t\t}\n\t\treturn controlConfig;\n\t}\n\n\tgetControlIconByType(controlType: ToolbarControlTypes) {\n\t\tswitch (controlType) {\n\t\t\tcase ToolbarControlTypes.ZOOM_IN:\n\t\t\t\treturn `<polygon points=\"19 13 15 13 15 9 13 9 13 13 9 13 9 15 13 15 13 19 15 19 15 15 19 15 19 13\"/>\n \t\t\t\t\t<path d=\"M22.45,21A10.87,10.87,0,0,0,25,14,11,11,0,1,0,14,25a10.87,10.87,0,0,0,7-2.55L28.59,30,30,28.59ZM14,23a9,9,0,1,1,9-9A9,9,0,0,1,14,23Z\"/>`;\n\t\t\tcase ToolbarControlTypes.ZOOM_OUT:\n\t\t\t\treturn `<rect x=\"9\" y=\"13\" width=\"10\" height=\"2\"/>\n\t\t\t\t\t\t<path d=\"M22.45,21A10.87,10.87,0,0,0,25,14,11,11,0,1,0,14,25a10.87,10.87,0,0,0,7-2.55L28.59,30,30,28.59ZM14,23a9,9,0,1,1,9-9A9,9,0,0,1,14,23Z\"/>`;\n\t\t\tcase ToolbarControlTypes.RESET_ZOOM:\n\t\t\t\treturn `<path d=\"M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z\"/>`;\n\n\t\t\t// add more icons here\n\t\t\t// svg icon must be with 32x32 viewBox\n\n\t\t\tdefault:\n\t\t\t\tthrow Error(\n\t\t\t\t\t\"Not supported toolbar control type: \" + controlType\n\t\t\t\t);\n\t\t}\n\t}\n}\n"]}
@@ -246,12 +246,14 @@ var ZoomBar = /** @class */ (function (_super) {
246
246
  };
247
247
  ZoomBar.prototype.updateBrushHandle = function (svg, selection, domain) {
248
248
  var self = this;
249
- var handleWidth = 5;
249
+ var handleWidth = Configuration.zoomBar.handleWidth;
250
250
  var zoombarType = Tools.getProperty(this.model.getOptions(), "zoomBar", "top", "type");
251
251
  var handleHeight = Configuration.zoomBar.height[zoombarType];
252
252
  var handleXDiff = -handleWidth / 2;
253
- var handleBarWidth = 1;
254
- var handleBarHeight = zoombarType === ZoomBarTypes.GRAPH_VIEW ? 12 : 6;
253
+ var handleBarWidth = Configuration.zoomBar.handleBarWidth;
254
+ var handleBarHeight = zoombarType === ZoomBarTypes.GRAPH_VIEW
255
+ ? Configuration.zoomBar.handleBarHeight
256
+ : 6;
255
257
  var handleBarXDiff = -handleBarWidth / 2;
256
258
  var handleYBarDiff = (handleHeight - handleBarHeight) / 2;
257
259
  // handle