@gitlab/ui 49.0.0 → 49.0.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 (131) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/base/accordion/accordion.js +2 -8
  3. package/dist/components/base/accordion/accordion_item.js +0 -14
  4. package/dist/components/base/alert/alert.js +4 -22
  5. package/dist/components/base/avatar/avatar.js +0 -7
  6. package/dist/components/base/avatar_labeled/avatar_labeled.js +0 -2
  7. package/dist/components/base/avatars_inline/avatars_inline.js +2 -10
  8. package/dist/components/base/badge/badge.js +0 -8
  9. package/dist/components/base/banner/banner.js +0 -10
  10. package/dist/components/base/breadcrumb/breadcrumb.js +0 -12
  11. package/dist/components/base/breadcrumb/breadcrumb_item.js +0 -2
  12. package/dist/components/base/broadcast_message/broadcast_message.js +0 -3
  13. package/dist/components/base/button/button.js +0 -11
  14. package/dist/components/base/card/card.js +1 -2
  15. package/dist/components/base/datepicker/datepicker.js +7 -42
  16. package/dist/components/base/daterange_picker/daterange_picker.js +0 -23
  17. package/dist/components/base/drawer/drawer.js +0 -13
  18. package/dist/components/base/dropdown/dropdown.js +3 -17
  19. package/dist/components/base/dropdown/dropdown_item.js +2 -8
  20. package/dist/components/base/filtered_search/common_story_options.js +1 -2
  21. package/dist/components/base/filtered_search/filtered_search.js +9 -61
  22. package/dist/components/base/filtered_search/filtered_search_suggestion.js +0 -6
  23. package/dist/components/base/filtered_search/filtered_search_suggestion_list.js +0 -16
  24. package/dist/components/base/filtered_search/filtered_search_term.js +0 -9
  25. package/dist/components/base/filtered_search/filtered_search_token.js +10 -49
  26. package/dist/components/base/filtered_search/filtered_search_token_segment.js +3 -56
  27. package/dist/components/base/filtered_search/filtered_search_utils.js +7 -24
  28. package/dist/components/base/form/form_checkbox/form_checkbox.js +0 -2
  29. package/dist/components/base/form/form_checkbox_tree/checkbox_tree_node.js +0 -4
  30. package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.js +0 -10
  31. package/dist/components/base/form/form_checkbox_tree/models/node.js +1 -10
  32. package/dist/components/base/form/form_checkbox_tree/models/tree.js +16 -37
  33. package/dist/components/base/form/form_combobox/form_combobox.js +2 -36
  34. package/dist/components/base/form/form_group/form_group.js +2 -7
  35. package/dist/components/base/form/form_input/form_input.js +2 -8
  36. package/dist/components/base/form/form_input_group/form_input_group.js +0 -5
  37. package/dist/components/base/form/form_input_group/form_input_group_mixin.js +0 -8
  38. package/dist/components/base/form/form_radio_group/form_radio_group.js +0 -2
  39. package/dist/components/base/form/form_select/form_select.js +0 -3
  40. package/dist/components/base/form/form_textarea/form_textarea.js +2 -7
  41. package/dist/components/base/icon/icon.js +4 -14
  42. package/dist/components/base/infinite_scroll/infinite_scroll.js +7 -21
  43. package/dist/components/base/keyset_pagination/keyset_pagination.js +0 -9
  44. package/dist/components/base/label/label.js +0 -12
  45. package/dist/components/base/loading_icon/loading_icon.js +7 -10
  46. package/dist/components/base/markdown/markdown.js +1 -0
  47. package/dist/components/base/modal/modal.js +7 -27
  48. package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +14 -34
  49. package/dist/components/base/new_dropdowns/constants.js +4 -2
  50. package/dist/components/base/new_dropdowns/listbox/listbox.js +14 -81
  51. package/dist/components/base/new_dropdowns/listbox/listbox_group.js +0 -2
  52. package/dist/components/base/new_dropdowns/listbox/listbox_item.js +0 -5
  53. package/dist/components/base/new_dropdowns/listbox/utils.js +0 -7
  54. package/dist/components/base/paginated_list/paginated_list.js +0 -15
  55. package/dist/components/base/pagination/pagination.js +14 -72
  56. package/dist/components/base/path/path.js +0 -29
  57. package/dist/components/base/popover/popover.js +0 -5
  58. package/dist/components/base/search_box_by_click/search_box_by_click.js +1 -26
  59. package/dist/components/base/search_box_by_type/search_box_by_type.js +2 -12
  60. package/dist/components/base/segmented_control/segmented_control.js +0 -10
  61. package/dist/components/base/skeleton_loader/skeleton_loader.js +0 -19
  62. package/dist/components/base/skeleton_loading/skeleton_loading.js +0 -3
  63. package/dist/components/base/sorting/sorting.js +1 -9
  64. package/dist/components/base/sorting/sorting_item.js +4 -6
  65. package/dist/components/base/table/table.js +0 -4
  66. package/dist/components/base/tabs/tab/tab.js +2 -6
  67. package/dist/components/base/tabs/tabs/scrollable_tabs.js +0 -21
  68. package/dist/components/base/tabs/tabs/tabs.js +8 -33
  69. package/dist/components/base/toast/toast.js +3 -15
  70. package/dist/components/base/toggle/toggle.js +0 -18
  71. package/dist/components/base/token/token.js +0 -4
  72. package/dist/components/base/token_selector/token_container.js +0 -24
  73. package/dist/components/base/token_selector/token_selector.js +10 -61
  74. package/dist/components/base/token_selector/token_selector_dropdown.js +4 -32
  75. package/dist/components/charts/area/area.js +8 -32
  76. package/dist/components/charts/bar/bar.js +7 -19
  77. package/dist/components/charts/chart/chart.js +1 -22
  78. package/dist/components/charts/column/column.js +8 -18
  79. package/dist/components/charts/discrete_scatter/discrete_scatter.js +2 -13
  80. package/dist/components/charts/gauge/gauge.js +0 -15
  81. package/dist/components/charts/heatmap/heatmap.js +3 -16
  82. package/dist/components/charts/legend/legend.js +2 -24
  83. package/dist/components/charts/line/line.js +8 -34
  84. package/dist/components/charts/series_label/series_label.js +0 -12
  85. package/dist/components/charts/single_stat/single_stat.js +0 -8
  86. package/dist/components/charts/sparkline/sparkline.js +1 -16
  87. package/dist/components/charts/stacked_column/stacked_column.js +8 -26
  88. package/dist/components/charts/tooltip/tooltip.js +0 -6
  89. package/dist/components/mixins/button_mixin.js +0 -1
  90. package/dist/components/mixins/safe_link_mixin.js +0 -1
  91. package/dist/components/mixins/toolbox_mixin.js +0 -1
  92. package/dist/components/mixins/tooltip_mixin.js +1 -2
  93. package/dist/components/regions/empty_state/empty_state.js +0 -12
  94. package/dist/components/utilities/animated_number/animated_number.js +0 -16
  95. package/dist/components/utilities/friendly_wrap/friendly_wrap.js +0 -3
  96. package/dist/components/utilities/intersection_observer/intersection_observer.js +0 -7
  97. package/dist/components/utilities/intersperse/intersperse.js +3 -9
  98. package/dist/components/utilities/sprintf/sprintf.js +9 -23
  99. package/dist/components/utilities/truncate/truncate.js +0 -10
  100. package/dist/config.js +3 -4
  101. package/dist/directives/hover_load/hover_load.js +2 -8
  102. package/dist/directives/outside/get_event_like_time_stamp.js +4 -2
  103. package/dist/directives/outside/outside.js +5 -20
  104. package/dist/directives/resize_observer/resize_observer.js +0 -10
  105. package/dist/directives/safe_html/safe_html.js +5 -6
  106. package/dist/directives/safe_link/mock_data.js +1 -1
  107. package/dist/directives/safe_link/safe_link.js +0 -13
  108. package/dist/utils/breakpoints.js +0 -3
  109. package/dist/utils/charts/config.js +29 -42
  110. package/dist/utils/charts/constants.js +8 -8
  111. package/dist/utils/charts/mock_data.js +2 -2
  112. package/dist/utils/charts/story_config.js +1 -1
  113. package/dist/utils/charts/theme.js +1 -3
  114. package/dist/utils/charts/utils.js +2 -6
  115. package/dist/utils/constants.js +10 -7
  116. package/dist/utils/data_utils.js +5 -4
  117. package/dist/utils/datetime_utility.js +4 -4
  118. package/dist/utils/number_utils.js +7 -11
  119. package/dist/utils/stories_utils.js +1 -1
  120. package/dist/utils/story_decorators/container.js +0 -1
  121. package/dist/utils/string_utils.js +0 -14
  122. package/dist/utils/test_utils.js +3 -2
  123. package/dist/utils/use_fake_date.js +0 -4
  124. package/dist/utils/use_mock_intersection_observer.js +4 -19
  125. package/dist/utils/utils.js +5 -14
  126. package/package.json +3 -3
  127. package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.spec.js +1 -0
  128. package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.vue +13 -7
  129. package/src/components/base/new_dropdowns/listbox/listbox.spec.js +13 -7
  130. package/src/components/base/new_dropdowns/listbox/listbox.vue +12 -16
  131. package/src/components/base/pagination/pagination.vue +2 -2
@@ -18,27 +18,22 @@ var script = {
18
18
  chart: {
19
19
  type: Object,
20
20
  required: true,
21
-
22
21
  validator(chart) {
23
22
  return Object.is(chart, echarts.getInstanceByDom(chart.getDom()));
24
23
  }
25
-
26
24
  },
27
25
  seriesInfo: {
28
26
  type: Array,
29
27
  required: true,
30
-
31
28
  validator(seriesInfo) {
32
29
  return seriesInfo.every(series => series.type && series.name && series.color);
33
30
  }
34
-
35
31
  },
36
32
  textStyle: {
37
33
  type: Object,
38
34
  required: false,
39
35
  default: () => ({})
40
36
  },
41
-
42
37
  /**
43
38
  * Text for data average (overridden by prop if needed for internationalization)
44
39
  */
@@ -57,7 +52,6 @@ var script = {
57
52
  required: false,
58
53
  default: LEGEND_MIN_TEXT
59
54
  },
60
-
61
55
  /**
62
56
  * Text for max amount (overridden by prop if needed for internationalization)
63
57
  */
@@ -66,7 +60,6 @@ var script = {
66
60
  required: false,
67
61
  default: LEGEND_MAX_TEXT
68
62
  },
69
-
70
63
  /**
71
64
  * Sets the display layout
72
65
  */
@@ -74,20 +67,16 @@ var script = {
74
67
  type: String,
75
68
  required: false,
76
69
  default: LEGEND_LAYOUT_INLINE,
77
-
78
70
  validator(layout) {
79
71
  return [LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE].indexOf(layout) !== -1;
80
72
  }
81
-
82
73
  }
83
74
  },
84
-
85
75
  data() {
86
76
  return {
87
77
  disabledSeries: {}
88
78
  };
89
79
  },
90
-
91
80
  computed: {
92
81
  fontStyle() {
93
82
  return {
@@ -95,67 +84,56 @@ var script = {
95
84
  fontSize: `${this.textStyle.fontSize || defaultFontSize}px`
96
85
  };
97
86
  }
98
-
99
87
  },
100
88
  methods: {
101
89
  sanitizeSeriesData(seriesData) {
102
90
  var _seriesData$filter;
103
-
104
91
  return (_seriesData$filter = seriesData === null || seriesData === void 0 ? void 0 : seriesData.filter(d => !Number.isNaN(d))) !== null && _seriesData$filter !== void 0 ? _seriesData$filter : [];
105
92
  },
106
-
107
93
  seriesAverage(seriesData) {
108
94
  const sanitized = this.sanitizeSeriesData(seriesData);
109
95
  return engineeringNotation(average(...sanitized));
110
96
  },
111
-
112
97
  seriesMax(seriesData) {
113
98
  const sanitized = this.sanitizeSeriesData(seriesData);
114
99
  return engineeringNotation(Math.max(...sanitized));
115
100
  },
116
-
117
101
  seriesMin(seriesData) {
118
102
  const sanitized = this.sanitizeSeriesData(seriesData);
119
103
  return engineeringNotation(Math.min(...sanitized));
120
104
  },
121
-
122
105
  seriesLast(seriesData) {
123
106
  const sanitized = this.sanitizeSeriesData(seriesData);
124
107
  return engineeringNotation(sanitized[sanitized.length - 1]);
125
108
  },
126
-
127
109
  seriesNameIsLong(seriesName) {
128
110
  return seriesName.length > 120;
129
111
  },
130
-
131
112
  handleClick(name, key) {
132
113
  this.chart.dispatchAction({
133
114
  type: 'legendToggleSelect',
134
115
  name
135
116
  });
136
- this.disabledSeries = { ...this.disabledSeries,
117
+ this.disabledSeries = {
118
+ ...this.disabledSeries,
137
119
  [key]: !this.disabledSeries[key]
138
120
  };
139
121
  },
140
-
141
122
  handleMouseEnter(name) {
142
123
  this.chart.dispatchAction({
143
124
  type: 'highlight',
144
125
  seriesName: name
145
126
  });
146
127
  },
147
-
148
128
  handleMouseLeave(name) {
149
129
  this.chart.dispatchAction({
150
130
  type: 'downplay',
151
131
  seriesName: name
152
132
  });
153
133
  },
154
-
155
134
  getColor(color, key) {
156
135
  return this.disabledSeries[key] ? gray200 : color;
157
136
  }
158
-
159
137
  },
160
138
  legendLayoutTypes: {
161
139
  LEGEND_LAYOUT_INLINE,
@@ -77,11 +77,9 @@ var script = {
77
77
  type: String,
78
78
  required: false,
79
79
  default: LEGEND_LAYOUT_INLINE,
80
-
81
80
  validator(layout) {
82
81
  return [LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE].indexOf(layout) !== -1;
83
82
  }
84
-
85
83
  },
86
84
  showLegend: {
87
85
  type: Boolean,
@@ -89,7 +87,6 @@ var script = {
89
87
  default: true
90
88
  }
91
89
  },
92
-
93
90
  data() {
94
91
  // Part of the tooltip related data can be
95
92
  // moved into the tooltip component.
@@ -115,18 +112,14 @@ var script = {
115
112
  selectedFormatTooltipText: this.formatTooltipText || this.defaultFormatTooltipText
116
113
  };
117
114
  },
118
-
119
115
  computed: {
120
116
  series() {
121
117
  const dataSeries = this.data.map((series, index) => {
122
118
  const defaultColor = colorFromDefaultPalette(index);
123
-
124
119
  const getColor = type => {
125
120
  var _series$type$color, _series$type;
126
-
127
121
  return (_series$type$color = (_series$type = series[type]) === null || _series$type === void 0 ? void 0 : _series$type.color) !== null && _series$type$color !== void 0 ? _series$type$color : defaultColor;
128
122
  };
129
-
130
123
  return merge({
131
124
  showSymbol: true,
132
125
  lineStyle: {
@@ -136,20 +129,17 @@ var script = {
136
129
  color: getColor('itemStyle')
137
130
  }
138
131
  }, symbolSize, lineStyle, series, getThresholdConfig(this.thresholds));
139
- }); // if annotation series exists, append it
132
+ });
133
+ // if annotation series exists, append it
140
134
  // along with data series
141
-
142
135
  if (this.annotationSeries) {
143
136
  return [...dataSeries, this.annotationSeries];
144
137
  }
145
-
146
138
  return dataSeries;
147
139
  },
148
-
149
140
  annotationSeries() {
150
141
  return generateAnnotationSeries(this.annotations);
151
142
  },
152
-
153
143
  options() {
154
144
  const defaultLineChartOptions = {
155
145
  xAxis: {
@@ -171,12 +161,11 @@ var script = {
171
161
  show: false
172
162
  }
173
163
  };
174
- const mergedOptions = merge({}, defaultChartOptions, defaultLineChartOptions, this.option, dataZoomAdjustments(this.option.dataZoom), this.toolboxAdjustments); // All chart options can be merged but series
164
+ const mergedOptions = merge({}, defaultChartOptions, defaultLineChartOptions, this.option, dataZoomAdjustments(this.option.dataZoom), this.toolboxAdjustments);
165
+ // All chart options can be merged but series
175
166
  // needs to be handled specially
176
-
177
167
  return mergeSeriesToOptions(mergeAnnotationAxisToOptions(mergedOptions, this.hasAnnotations), this.series);
178
168
  },
179
-
180
169
  /**
181
170
  * Annotations currently are passed as series options in monitoring dashboard.
182
171
  * Once https://gitlab.com/gitlab-org/gitlab/-/issues/213390 is closed,
@@ -187,25 +176,20 @@ var script = {
187
176
  hasAnnotations() {
188
177
  return this.annotations.length !== 0 || seriesHasAnnotations(this.option.series);
189
178
  },
190
-
191
179
  shouldShowAnnotationsTooltip() {
192
180
  return this.chart && this.hasAnnotations;
193
181
  },
194
-
195
182
  compiledOptions() {
196
183
  return this.chart ? this.chart.getOption() : null;
197
184
  },
198
-
199
185
  legendStyle() {
200
186
  return {
201
187
  paddingLeft: `${grid.left}px`
202
188
  };
203
189
  },
204
-
205
190
  hasLegend() {
206
191
  return this.compiledOptions && this.showLegend;
207
192
  },
208
-
209
193
  seriesInfo() {
210
194
  return this.compiledOptions.series.reduce((acc, series, index) => {
211
195
  if (series.type === 'line') {
@@ -216,20 +200,16 @@ var script = {
216
200
  data: this.includeLegendAvgMax ? series.data.map(data => data[1]) : undefined
217
201
  });
218
202
  }
219
-
220
203
  return acc;
221
204
  }, []);
222
205
  }
223
-
224
206
  },
225
-
226
207
  beforeDestroy() {
227
208
  this.chart.getDom().removeEventListener('mousemove', this.debouncedShowHideTooltip);
228
209
  this.chart.getDom().removeEventListener('mouseout', this.debouncedShowHideTooltip);
229
210
  this.chart.off('mouseout', this.onChartDataPointMouseOut);
230
211
  this.chart.off('mouseover', this.onChartDataPointMouseOver);
231
212
  },
232
-
233
213
  methods: {
234
214
  defaultFormatTooltipText(params) {
235
215
  const {
@@ -239,26 +219,26 @@ var script = {
239
219
  this.$set(this, 'dataTooltipContent', tooltipContent);
240
220
  this.dataTooltipTitle = xLabels.join(', ');
241
221
  },
242
-
243
222
  defaultAnnotationTooltipText(params) {
244
223
  var _params$data$tooltipD;
245
-
246
224
  return {
247
225
  title: params.data.xAxis,
248
226
  content: (_params$data$tooltipD = params.data.tooltipData) === null || _params$data$tooltipD === void 0 ? void 0 : _params$data$tooltipD.content
249
227
  };
250
228
  },
251
-
252
229
  onCreated(chart) {
253
230
  // These listeners are used to show/hide data tooltips
254
231
  // when the mouse is hovered over the parent container
255
232
  // of echarts' svg element. This works only for data points
256
233
  // and not markPoints.
257
234
  chart.getDom().addEventListener('mousemove', this.debouncedShowHideTooltip);
258
- chart.getDom().addEventListener('mouseout', this.debouncedShowHideTooltip); // eCharts inbuild mouse events
235
+ chart.getDom().addEventListener('mouseout', this.debouncedShowHideTooltip);
236
+
237
+ // eCharts inbuild mouse events
259
238
  // https://echarts.apache.org/en/api.html#events.Mouse%20events
260
239
  // is used to attach listeners to markPoints. These listeners
261
240
  // are currently used for annotation arrows at the bottom of the chart.
241
+
262
242
  // Because data points and annotations arrows are in different
263
243
  // sections of the charts with their own mouseovers and mouseouts,
264
244
  // there shouldn't be an overlapping situation where both tooltips
@@ -268,11 +248,9 @@ var script = {
268
248
  chart.on('mouseout', this.onChartDataPointMouseOut);
269
249
  chart.on('mouseover', this.onChartDataPointMouseOver);
270
250
  }
271
-
272
251
  this.chart = chart;
273
252
  this.$emit('created', chart);
274
253
  },
275
-
276
254
  showHideTooltip(mouseEvent) {
277
255
  this.showDataTooltip = this.chart.containPixel('grid', [mouseEvent.zrX, mouseEvent.zrY]);
278
256
  this.dataTooltipPosition = {
@@ -280,11 +258,9 @@ var script = {
280
258
  top: `${mouseEvent.zrY}px`
281
259
  };
282
260
  },
283
-
284
261
  onChartDataPointMouseOut() {
285
262
  this.showAnnotationsTooltip = false;
286
263
  },
287
-
288
264
  /**
289
265
  * Check if the hovered data point is an annotation
290
266
  * point to show the annotation tooltip.
@@ -308,11 +284,9 @@ var script = {
308
284
  };
309
285
  }
310
286
  },
311
-
312
287
  onLabelChange(params) {
313
288
  this.selectedFormatTooltipText(params);
314
289
  }
315
-
316
290
  }
317
291
  };
318
292
 
@@ -1,7 +1,6 @@
1
1
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
2
2
 
3
3
  const makePathRect = (startX, startY, width, height) => `M${startX},${startY}H${startX + width}V${startY + height}H${startX}Z`;
4
-
5
4
  var script = {
6
5
  props: {
7
6
  color: {
@@ -14,28 +13,23 @@ var script = {
14
13
  default: 'solid'
15
14
  }
16
15
  },
17
-
18
16
  data() {
19
17
  return {
20
18
  labelLineHeight: 0
21
19
  };
22
20
  },
23
-
24
21
  computed: {
25
22
  pathContent() {
26
23
  const width = this.$options.svgWidth;
27
24
  const height = this.$options.svgHeight;
28
-
29
25
  if (this.type === 'dashed') {
30
26
  const dashWidth = Math.ceil(width / 3);
31
27
  const firstDash = makePathRect(0, 0, dashWidth, height);
32
28
  const secondDash = makePathRect(width - dashWidth, 0, dashWidth, height);
33
29
  return `${firstDash}${secondDash}`;
34
30
  }
35
-
36
31
  return makePathRect(0, 0, width, height);
37
32
  },
38
-
39
33
  svgStyles() {
40
34
  return {
41
35
  fill: this.color,
@@ -43,30 +37,24 @@ var script = {
43
37
  width: 'auto'
44
38
  };
45
39
  },
46
-
47
40
  svgYTranslationValue() {
48
41
  const value = this.labelLineHeight / 2 - this.$options.svgHeight / 2;
49
42
  return Math.round(value) || 0;
50
43
  }
51
-
52
44
  },
53
-
54
45
  mounted() {
55
46
  if (getComputedStyle && this.$refs.label) {
56
47
  const computedStyle = getComputedStyle(this.$refs.label);
57
48
  const lineHeight = computedStyle['line-height'].match(/(\d+)px/);
58
-
59
49
  if (lineHeight !== null) {
60
50
  this.labelLineHeight = parseFloat(lineHeight[1]);
61
51
  }
62
52
  }
63
53
  },
64
-
65
54
  methods: {
66
55
  formatPixelDimension(dimension) {
67
56
  return `${dimension}px`;
68
57
  }
69
-
70
58
  },
71
59
  svgWidth: 16,
72
60
  svgHeight: 4
@@ -56,40 +56,32 @@ var script = {
56
56
  default: 0
57
57
  }
58
58
  },
59
-
60
59
  data() {
61
60
  return {
62
61
  hideUnits: false
63
62
  };
64
63
  },
65
-
66
64
  computed: {
67
65
  showMetaIcon() {
68
66
  return Boolean(this.metaIcon && !this.metaText);
69
67
  },
70
-
71
68
  showBadge() {
72
69
  return Boolean(this.metaText);
73
70
  },
74
-
75
71
  showTitleIcon() {
76
72
  return Boolean(this.titleIcon);
77
73
  },
78
-
79
74
  textColor() {
80
75
  return variantCssColorMap[this.variant];
81
76
  },
82
-
83
77
  canAnimate() {
84
78
  return this.shouldAnimate && !Number.isNaN(Number(this.value));
85
79
  }
86
-
87
80
  },
88
81
  methods: {
89
82
  setHideUnits(flag) {
90
83
  this.hideUnits = flag;
91
84
  }
92
-
93
85
  }
94
86
  };
95
87
 
@@ -7,6 +7,7 @@ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
7
7
 
8
8
  //
9
9
 
10
+ // the padding is needed so the mark points don't overflow when visible
10
11
  const gridPadding = symbolSize / 2;
11
12
  var script = {
12
13
  components: {
@@ -24,7 +25,6 @@ var script = {
24
25
  type: Array,
25
26
  required: true
26
27
  },
27
-
28
28
  /**
29
29
  * Controls the label that is shown within the chart's tooltip. Use it to describe your data.
30
30
  */
@@ -33,7 +33,6 @@ var script = {
33
33
  required: false,
34
34
  default: ''
35
35
  },
36
-
37
36
  /**
38
37
  * Sets the chart's height in pixel.
39
38
  */
@@ -42,7 +41,6 @@ var script = {
42
41
  required: false,
43
42
  default: 50
44
43
  },
45
-
46
44
  /**
47
45
  * If enabled will show the value of the latest "y" data-point on the side right of the chart.
48
46
  */
@@ -52,7 +50,6 @@ var script = {
52
50
  default: true
53
51
  }
54
52
  },
55
-
56
53
  data() {
57
54
  return {
58
55
  chartInstance: null,
@@ -67,7 +64,6 @@ var script = {
67
64
  }
68
65
  };
69
66
  },
70
-
71
67
  computed: {
72
68
  options() {
73
69
  const sparkLineChartOptions = {
@@ -100,7 +96,6 @@ var script = {
100
96
  const mergedOptions = merge({}, defaultChartOptions, sparkLineChartOptions);
101
97
  return mergeSeriesToOptions(mergedOptions, this.series);
102
98
  },
103
-
104
99
  series() {
105
100
  const {
106
101
  data
@@ -125,12 +120,10 @@ var script = {
125
120
  data
126
121
  };
127
122
  },
128
-
129
123
  lastYValue() {
130
124
  const latestEntry = this.data.slice(-1)[0];
131
125
  return latestEntry[1];
132
126
  }
133
-
134
127
  },
135
128
  methods: {
136
129
  onChartCreated(chartInstance) {
@@ -141,24 +134,19 @@ var script = {
141
134
  * @event chartCreated
142
135
  * @type {object}
143
136
  */
144
-
145
137
  this.$emit('chartCreated', chartInstance);
146
138
  },
147
-
148
139
  handleResize() {
149
140
  this.chartInstance.resize();
150
141
  },
151
-
152
142
  hideTooltip() {
153
143
  this.tooltip.show = false;
154
144
  },
155
-
156
145
  formatTooltipText(_ref) {
157
146
  let [xValue, yValue] = _ref;
158
147
  this.tooltip.title = xValue;
159
148
  this.tooltip.content = yValue;
160
149
  },
161
-
162
150
  setTooltipPosition(data) {
163
151
  const [left, top] = this.chartInstance.convertToPixel('grid', data);
164
152
  this.tooltip.position = {
@@ -166,7 +154,6 @@ var script = {
166
154
  top: `${top}px`
167
155
  };
168
156
  },
169
-
170
157
  // This function is called any time the axis pointer is changed (the black bubble showing which
171
158
  // point on the line is selected). Note that it will not trigger if the axis pointer is removed,
172
159
  // only when it changes from one point to another or is shown for the first time.
@@ -181,14 +168,12 @@ var script = {
181
168
  const {
182
169
  data
183
170
  } = firstEntry;
184
-
185
171
  if (data) {
186
172
  this.tooltip.show = true;
187
173
  this.formatTooltipText(data);
188
174
  this.setTooltipPosition(data);
189
175
  }
190
176
  }
191
-
192
177
  }
193
178
  };
194
179
 
@@ -11,7 +11,8 @@ import ChartLegend from '../legend/legend';
11
11
  import ChartTooltip from '../tooltip/tooltip';
12
12
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
13
13
 
14
- const yAxisDefaults = { ...yAxis,
14
+ const yAxisDefaults = {
15
+ ...yAxis,
15
16
  nameLocation: 'center',
16
17
  axisTick: {
17
18
  show: false
@@ -104,11 +105,9 @@ var script = {
104
105
  type: String,
105
106
  required: false,
106
107
  default: LEGEND_LAYOUT_INLINE,
107
-
108
108
  validator(layout) {
109
109
  return [LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE].indexOf(layout) !== -1;
110
110
  }
111
-
112
111
  },
113
112
  formatTooltipText: {
114
113
  type: Function,
@@ -121,7 +120,6 @@ var script = {
121
120
  default: null
122
121
  }
123
122
  },
124
-
125
123
  data() {
126
124
  return {
127
125
  chart: null,
@@ -135,12 +133,10 @@ var script = {
135
133
  debouncedMoveShowTooltip: debounceByAnimationFrame(this.moveShowTooltip)
136
134
  };
137
135
  },
138
-
139
136
  computed: {
140
137
  hasSecondaryAxis() {
141
138
  return Boolean(this.secondaryData.length);
142
139
  },
143
-
144
140
  barSeries() {
145
141
  return this.bars.map((_ref, index) => {
146
142
  let {
@@ -157,7 +153,6 @@ var script = {
157
153
  });
158
154
  });
159
155
  },
160
-
161
156
  lineSeries() {
162
157
  const offset = this.bars.length;
163
158
  return this.lines.map((_ref2, index) => {
@@ -173,7 +168,6 @@ var script = {
173
168
  });
174
169
  });
175
170
  },
176
-
177
171
  secondarySeries() {
178
172
  const offset = this.bars.length + this.lines.length;
179
173
  return this.secondaryData.map((_ref3, index) => {
@@ -198,11 +192,9 @@ var script = {
198
192
  });
199
193
  });
200
194
  },
201
-
202
195
  series() {
203
196
  return [...this.barSeries, ...this.lineSeries, ...this.secondarySeries];
204
197
  },
205
-
206
198
  options() {
207
199
  const mergedOptions = merge({}, defaultChartOptions, {
208
200
  grid: this.hasSecondaryAxis ? gridWithSecondaryYAxis : grid,
@@ -226,31 +218,30 @@ var script = {
226
218
  name: this.xAxisTitle,
227
219
  type: this.xAxisType
228
220
  },
229
- yAxis: [{ ...yAxisDefaults,
221
+ yAxis: [{
222
+ ...yAxisDefaults,
230
223
  name: this.yAxisTitle
231
- }, { ...yAxisDefaults,
224
+ }, {
225
+ ...yAxisDefaults,
232
226
  name: this.secondaryDataTitle,
233
227
  show: this.hasSecondaryAxis
234
228
  }],
235
229
  legend: {
236
230
  show: false
237
231
  }
238
- }, this.option, dataZoomAdjustments(this.option.dataZoom), this.toolboxAdjustments); // All chart options can be merged but series
232
+ }, this.option, dataZoomAdjustments(this.option.dataZoom), this.toolboxAdjustments);
233
+ // All chart options can be merged but series
239
234
  // needs to be handled specially
240
-
241
235
  return mergeSeriesToOptions(mergedOptions, this.series);
242
236
  },
243
-
244
237
  legendStyle() {
245
238
  return {
246
239
  paddingLeft: `${grid.left}px`
247
240
  };
248
241
  },
249
-
250
242
  compiledOptions() {
251
243
  return this.chart ? this.chart.getOption() : null;
252
244
  },
253
-
254
245
  seriesInfo() {
255
246
  return this.compiledOptions.series.reduce((acc, series, index) => {
256
247
  acc.push({
@@ -263,21 +254,16 @@ var script = {
263
254
  return acc;
264
255
  }, []);
265
256
  }
266
-
267
257
  },
268
-
269
258
  beforeDestroy() {
270
259
  this.chart.getDom().removeEventListener('mousemove', this.debouncedMoveShowTooltip);
271
260
  this.chart.getDom().removeEventListener('mouseout', this.debouncedMoveShowTooltip);
272
261
  },
273
-
274
262
  methods: {
275
263
  getColor(index) {
276
264
  var _this$customPalette;
277
-
278
265
  return this.customPalette ? (_this$customPalette = this.customPalette) === null || _this$customPalette === void 0 ? void 0 : _this$customPalette[index] : colorFromDefaultPalette(index);
279
266
  },
280
-
281
267
  moveShowTooltip(mouseEvent) {
282
268
  this.tooltipPosition = {
283
269
  left: `${mouseEvent.zrX}px`,
@@ -285,14 +271,12 @@ var script = {
285
271
  };
286
272
  this.showTooltip = this.chart.containPixel('grid', [mouseEvent.zrX, mouseEvent.zrY]);
287
273
  },
288
-
289
274
  onCreated(chart) {
290
275
  chart.getDom().addEventListener('mousemove', this.debouncedMoveShowTooltip);
291
276
  chart.getDom().addEventListener('mouseout', this.debouncedMoveShowTooltip);
292
277
  this.chart = chart;
293
278
  this.$emit('created', chart);
294
279
  },
295
-
296
280
  defaultFormatTooltipText(params) {
297
281
  const {
298
282
  tooltipContent
@@ -309,7 +293,6 @@ var script = {
309
293
  this.tooltipTitle = params.value;
310
294
  this.$set(this, 'tooltipContent', tooltipContent);
311
295
  },
312
-
313
296
  onLabelChange(params) {
314
297
  if (this.formatTooltipText) {
315
298
  this.formatTooltipText(params);
@@ -317,7 +300,6 @@ var script = {
317
300
  this.defaultFormatTooltipText(params);
318
301
  }
319
302
  }
320
-
321
303
  }
322
304
  };
323
305