@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
@@ -12,25 +12,25 @@ import ChartTooltip from '../tooltip/tooltip';
12
12
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
13
13
 
14
14
  //
15
+
15
16
  /**
16
17
  * `nameGap` in charts/config is set to 50 but it is not
17
18
  * used for bar charts as the axes are flipped. That is why
18
19
  * we're explicitly setting it here
19
20
  */
20
-
21
21
  const DEFAULT_NAME_GAP = 50;
22
+
22
23
  /**
23
24
  * This is the magic number at which the y-axis name
24
25
  * and y-axis labels don't overlap
25
26
  * @Number
26
27
  */
27
-
28
28
  const AXIS_LABEL_LENGTH = 7;
29
+
29
30
  /**
30
31
  * Because the axes are reversed in bar charts defaultChartOptions
31
32
  * xAxis and yAxis needs to be handled specifically.
32
33
  */
33
-
34
34
  const defaultOptions = {
35
35
  grid,
36
36
  xAxis: {
@@ -87,7 +87,6 @@ var script = {
87
87
  default: 'value'
88
88
  }
89
89
  },
90
-
91
90
  data() {
92
91
  return {
93
92
  chart: null,
@@ -101,7 +100,6 @@ var script = {
101
100
  debouncedMoveShowTooltip: debounceByAnimationFrame(this.moveShowTooltip)
102
101
  };
103
102
  },
104
-
105
103
  computed: {
106
104
  series() {
107
105
  return Object.keys(this.data).map((key, index) => {
@@ -125,7 +123,6 @@ var script = {
125
123
  };
126
124
  });
127
125
  },
128
-
129
126
  options() {
130
127
  const mergedOptions = merge({}, defaultOptions, {
131
128
  xAxis: {
@@ -152,21 +149,18 @@ var script = {
152
149
  legend: {
153
150
  show: false
154
151
  }
155
- }, this.option, dataZoomAdjustments(this.option.dataZoom), this.toolboxAdjustments); // All chart options can be merged but series
152
+ }, this.option, dataZoomAdjustments(this.option.dataZoom), this.toolboxAdjustments);
153
+ // All chart options can be merged but series
156
154
  // needs to be handled specially
157
-
158
155
  return mergeSeriesToOptions(mergedOptions, this.series);
159
156
  }
160
-
161
157
  },
162
-
163
158
  beforeDestroy() {
164
159
  if (this.chart) {
165
160
  this.chart.getDom().removeEventListener('mousemove', this.debouncedMoveShowTooltip);
166
161
  this.chart.getDom().removeEventListener('mouseout', this.debouncedMoveShowTooltip);
167
162
  }
168
163
  },
169
-
170
164
  methods: {
171
165
  moveShowTooltip(mouseEvent) {
172
166
  this.tooltipPosition = {
@@ -175,14 +169,12 @@ var script = {
175
169
  };
176
170
  this.showTooltip = this.chart.containPixel('grid', [mouseEvent.zrX, mouseEvent.zrY]);
177
171
  },
178
-
179
172
  onCreated(chart) {
180
173
  this.chart = chart;
181
174
  this.$emit('created', chart);
182
175
  chart.getDom().addEventListener('mousemove', this.debouncedMoveShowTooltip);
183
176
  chart.getDom().addEventListener('mouseout', this.debouncedMoveShowTooltip);
184
177
  },
185
-
186
178
  onLabelChange(params) {
187
179
  const {
188
180
  yLabels,
@@ -191,7 +183,6 @@ var script = {
191
183
  this.$set(this, 'tooltipContent', tooltipContent);
192
184
  this.tooltipTitle = yLabels.join(', ');
193
185
  },
194
-
195
186
  /**
196
187
  * The existing getDefaultTooltipContent in utils works against the y-axis value.
197
188
  * However, for bar charts, the tooltip should be against x-axis values.
@@ -208,19 +199,17 @@ var script = {
208
199
  yLabels,
209
200
  tooltipContent
210
201
  } = params.seriesData.reduce((acc, chartItem) => {
211
- const [value, title] = chartItem.value || []; // The x axis title is used instead of y axis
212
-
202
+ const [value, title] = chartItem.value || [];
203
+ // The x axis title is used instead of y axis
213
204
  const seriesName = seriesDataLength === 1 && xAxisTitle ? xAxisTitle : chartItem.seriesName;
214
205
  const color = seriesDataLength === 1 ? '' : chartItem.color;
215
206
  acc.tooltipContent[seriesName] = {
216
207
  value,
217
208
  color
218
209
  };
219
-
220
210
  if (!acc.yLabels.includes(title)) {
221
211
  acc.yLabels.push(title);
222
212
  }
223
-
224
213
  return acc;
225
214
  }, {
226
215
  yLabels: [],
@@ -231,7 +220,6 @@ var script = {
231
220
  tooltipContent
232
221
  };
233
222
  }
234
-
235
223
  }
236
224
  };
237
225
 
@@ -5,13 +5,12 @@ import { GlResizeObserverDirective } from '../../../directives/resize_observer/r
5
5
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
6
6
 
7
7
  //
8
+
8
9
  /**
9
10
  * Allowed values by eCharts
10
11
  * https://echarts.apache.org/en/api.html#echartsInstance.resize
11
12
  */
12
-
13
13
  const sizeValidator = size => Number.isFinite(size) || size === 'auto' || size == null;
14
-
15
14
  var script = {
16
15
  directives: {
17
16
  resizeObserver: GlResizeObserverDirective
@@ -21,7 +20,6 @@ var script = {
21
20
  type: Object,
22
21
  required: true
23
22
  },
24
-
25
23
  /**
26
24
  * Warning: this prop is deprecated and will soon be removed
27
25
  * Please do not utilize `disableTheme` for formatting
@@ -53,11 +51,9 @@ var script = {
53
51
  type: String,
54
52
  required: false,
55
53
  default: 'svg',
56
-
57
54
  validator(renderer) {
58
55
  return validRenderers.includes(renderer);
59
56
  }
60
-
61
57
  },
62
58
  responsive: {
63
59
  type: Boolean,
@@ -65,36 +61,29 @@ var script = {
65
61
  default: false
66
62
  }
67
63
  },
68
-
69
64
  data() {
70
65
  return {
71
66
  chart: null
72
67
  };
73
68
  },
74
-
75
69
  watch: {
76
70
  options() {
77
71
  if (this.chart) {
78
72
  this.draw();
79
73
  }
80
74
  },
81
-
82
75
  width() {
83
76
  this.setChartSize();
84
77
  },
85
-
86
78
  height() {
87
79
  this.setChartSize();
88
80
  }
89
-
90
81
  },
91
-
92
82
  created() {
93
83
  if (!this.disableTheme) {
94
84
  echarts.registerTheme(themeName, createTheme(this.options));
95
85
  }
96
86
  },
97
-
98
87
  async mounted() {
99
88
  await this.$nextTick();
100
89
  this.chart = echarts.init(this.$refs.chart, this.disableTheme ? null : themeName, {
@@ -102,43 +91,35 @@ var script = {
102
91
  width: defaultWidth,
103
92
  height: defaultHeight
104
93
  });
105
-
106
94
  if (this.groupId.length) {
107
95
  this.chart.group = this.groupId;
108
96
  echarts.connect(this.groupId);
109
97
  }
110
-
111
98
  this.chart.on('click', this.handleClick);
112
99
  /**
113
100
  * Emitted after calling `echarts.init`
114
101
  */
115
-
116
102
  this.$emit('created', this.chart);
117
103
  this.draw();
118
104
  this.setChartSize();
119
105
  },
120
-
121
106
  beforeDestroy() {
122
107
  this.chart.off('click', this.handleClick);
123
108
  },
124
-
125
109
  methods: {
126
110
  draw() {
127
111
  this.chart.setOption(this.options);
128
112
  /**
129
113
  * Emitted after calling `echarts.setOption`
130
114
  */
131
-
132
115
  this.$emit('updated', this.chart);
133
116
  },
134
-
135
117
  setChartSize() {
136
118
  this.chart.resize({
137
119
  width: this.width || 'auto',
138
120
  height: this.height || defaultHeight
139
121
  });
140
122
  },
141
-
142
123
  handleClick(params) {
143
124
  /**
144
125
  * Emitted when clicked on a data item in the chart (e.g., a bar/column).
@@ -151,11 +132,9 @@ var script = {
151
132
  params
152
133
  });
153
134
  },
154
-
155
135
  handleResize() {
156
136
  if (this.responsive) this.chart.resize();
157
137
  }
158
-
159
138
  }
160
139
  };
161
140
 
@@ -11,7 +11,8 @@ import ChartTooltip from '../tooltip/tooltip';
11
11
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
12
12
 
13
13
  //
14
- const yAxisDefaults = { ...yAxis,
14
+ const yAxisDefaults = {
15
+ ...yAxis,
15
16
  nameLocation: 'center',
16
17
  axisTick: {
17
18
  show: false
@@ -65,7 +66,6 @@ var script = {
65
66
  validator: value => ['value', 'category', 'time', 'log'].indexOf(value) !== -1
66
67
  }
67
68
  },
68
-
69
69
  data() {
70
70
  return {
71
71
  chart: null,
@@ -79,12 +79,10 @@ var script = {
79
79
  debouncedMoveShowTooltip: debounceByAnimationFrame(this.moveShowTooltip)
80
80
  };
81
81
  },
82
-
83
82
  computed: {
84
83
  hasSecondaryAxis() {
85
84
  return Boolean(this.secondaryData.length);
86
85
  },
87
-
88
86
  barSeries() {
89
87
  return this.bars.map((_ref, index) => {
90
88
  let {
@@ -99,7 +97,6 @@ var script = {
99
97
  });
100
98
  });
101
99
  },
102
-
103
100
  lineSeries() {
104
101
  const offset = this.bars.length;
105
102
  return this.lines.map((_ref2, index) => {
@@ -115,7 +112,6 @@ var script = {
115
112
  });
116
113
  });
117
114
  },
118
-
119
115
  secondarySeries() {
120
116
  const offset = this.bars.length + this.lines.length;
121
117
  return this.secondaryData.map((_ref3, index) => {
@@ -140,13 +136,12 @@ var script = {
140
136
  });
141
137
  });
142
138
  },
143
-
144
139
  series() {
145
140
  return [...this.barSeries, ...this.lineSeries, ...this.secondarySeries];
146
141
  },
147
-
148
142
  options() {
149
- const yAxisPrimary = { ...yAxisDefaults,
143
+ const yAxisPrimary = {
144
+ ...yAxisDefaults,
150
145
  name: this.yAxisTitle
151
146
  };
152
147
  const mergedOptions = merge({}, defaultChartOptions, {
@@ -170,26 +165,24 @@ var script = {
170
165
  name: this.xAxisTitle,
171
166
  type: this.xAxisType
172
167
  },
173
- yAxis: this.hasSecondaryAxis ? [yAxisPrimary, { ...yAxisDefaults,
168
+ yAxis: this.hasSecondaryAxis ? [yAxisPrimary, {
169
+ ...yAxisDefaults,
174
170
  name: this.secondaryDataTitle,
175
171
  show: this.hasSecondaryAxis
176
172
  }] : yAxisPrimary,
177
173
  legend: {
178
174
  show: false
179
175
  }
180
- }, this.option, dataZoomAdjustments(this.option.dataZoom), this.toolboxAdjustments); // All chart options can be merged but series
176
+ }, this.option, dataZoomAdjustments(this.option.dataZoom), this.toolboxAdjustments);
177
+ // All chart options can be merged but series
181
178
  // needs to be handled specially
182
-
183
179
  return mergeSeriesToOptions(mergedOptions, this.series);
184
180
  }
185
-
186
181
  },
187
-
188
182
  beforeDestroy() {
189
183
  this.chart.getDom().removeEventListener('mousemove', this.debouncedMoveShowTooltip);
190
184
  this.chart.getDom().removeEventListener('mouseout', this.debouncedMoveShowTooltip);
191
185
  },
192
-
193
186
  methods: {
194
187
  moveShowTooltip(mouseEvent) {
195
188
  this.tooltipPosition = {
@@ -198,14 +191,12 @@ var script = {
198
191
  };
199
192
  this.showTooltip = this.chart.containPixel('grid', [mouseEvent.zrX, mouseEvent.zrY]);
200
193
  },
201
-
202
194
  onCreated(chart) {
203
195
  chart.getDom().addEventListener('mousemove', this.debouncedMoveShowTooltip);
204
196
  chart.getDom().addEventListener('mouseout', this.debouncedMoveShowTooltip);
205
197
  this.chart = chart;
206
198
  this.$emit('created', chart);
207
199
  },
208
-
209
200
  onLabelChange(params) {
210
201
  const {
211
202
  xLabels,
@@ -214,7 +205,6 @@ var script = {
214
205
  this.$set(this, 'tooltipContent', tooltipContent);
215
206
  this.tooltipTitle = xLabels.join(', ');
216
207
  }
217
-
218
208
  }
219
209
  };
220
210
 
@@ -47,7 +47,6 @@ var script = {
47
47
  default: null
48
48
  }
49
49
  },
50
-
51
50
  data() {
52
51
  return {
53
52
  chart: null,
@@ -62,14 +61,11 @@ var script = {
62
61
  selectedFormatTooltipText: this.formatTooltipText || this.defaultFormatTooltipText
63
62
  };
64
63
  },
65
-
66
64
  computed: {
67
65
  series() {
68
66
  return this.data.map((series, index) => {
69
67
  const defaultColor = colorFromDefaultPalette(index);
70
-
71
68
  const getColor = type => series[type] && series[type].color ? series[type].color : defaultColor;
72
-
73
69
  return merge({
74
70
  symbolSize: this.symbolSize,
75
71
  lineStyle: {
@@ -81,7 +77,6 @@ var script = {
81
77
  }, series);
82
78
  });
83
79
  },
84
-
85
80
  options() {
86
81
  const mergedOptions = merge({}, defaultChartOptions, {
87
82
  tooltip: {
@@ -109,12 +104,11 @@ var script = {
109
104
  legend: {
110
105
  show: false
111
106
  }
112
- }, this.option, dataZoomAdjustments(this.option.dataZoom), this.toolboxAdjustments); // All chart options can be merged but series
107
+ }, this.option, dataZoomAdjustments(this.option.dataZoom), this.toolboxAdjustments);
108
+ // All chart options can be merged but series
113
109
  // needs to be handled specially
114
-
115
110
  return mergeSeriesToOptions(mergedOptions, this.series);
116
111
  }
117
-
118
112
  },
119
113
  methods: {
120
114
  defaultFormatTooltipText(params) {
@@ -132,24 +126,20 @@ var script = {
132
126
  };
133
127
  this.$set(this, 'tooltipContent', tooltipContent);
134
128
  },
135
-
136
129
  showHideTooltip(mouseEvent) {
137
130
  this.showTooltip = this.chart.containPixel('grid', [mouseEvent.zrX, mouseEvent.zrY]);
138
131
  },
139
-
140
132
  onCreated(chart) {
141
133
  chart.getDom().addEventListener('mousemove', this.debouncedShowHideTooltip);
142
134
  chart.getDom().addEventListener('mouseout', this.debouncedShowHideTooltip);
143
135
  this.chart = chart;
144
136
  this.$emit('created', chart);
145
137
  },
146
-
147
138
  onLabelChange(params) {
148
139
  this.selectedFormatTooltipText(params);
149
140
  const {
150
141
  data = []
151
142
  } = params;
152
-
153
143
  if (data.length) {
154
144
  const [left, top] = this.chart.convertToPixel('grid', data);
155
145
  this.tooltipPosition = {
@@ -158,7 +148,6 @@ var script = {
158
148
  };
159
149
  }
160
150
  }
161
-
162
151
  }
163
152
  };
164
153
 
@@ -14,7 +14,6 @@ const DETAIL_FONT_FAMILY = 'sans-serif';
14
14
  const DETAIL_FONT_WEIGHT = 'bold';
15
15
  const POINTER_LENGTH = '65%';
16
16
  const POINTER_WIDTH_PX = 5;
17
-
18
17
  const gaugeChartSeries = _ref => {
19
18
  let {
20
19
  value,
@@ -61,7 +60,6 @@ const gaugeChartSeries = _ref => {
61
60
  splitNumber
62
61
  }];
63
62
  };
64
-
65
63
  var script = {
66
64
  components: {
67
65
  Chart
@@ -118,10 +116,8 @@ var script = {
118
116
  axisColor: this.axisColor
119
117
  })
120
118
  }, this.option, this.toolboxAdjustments);
121
-
122
119
  return mergedOptions;
123
120
  },
124
-
125
121
  validThresholds() {
126
122
  const {
127
123
  thresholds,
@@ -129,23 +125,17 @@ var script = {
129
125
  max
130
126
  } = this;
131
127
  if (!(thresholds !== null && thresholds !== void 0 && thresholds.length)) return [];
132
-
133
128
  const uniqueThresholds = _uniq(thresholds);
134
-
135
129
  const filteredThresholds = uniqueThresholds.filter(threshold => {
136
130
  return _isFinite(threshold) && threshold > min && threshold < max;
137
131
  });
138
132
  /**
139
133
  * Only the first two thresholds will be used
140
134
  */
141
-
142
135
  const reducedThresholdsList = filteredThresholds.length > 2 ? [filteredThresholds[0], filteredThresholds[1]] : [...filteredThresholds];
143
-
144
136
  const sortedThresholds = _sortBy(reducedThresholdsList);
145
-
146
137
  return sortedThresholds;
147
138
  },
148
-
149
139
  valueIsInLastThreshold() {
150
140
  const {
151
141
  validThresholds,
@@ -153,14 +143,12 @@ var script = {
153
143
  } = this;
154
144
  return validThresholds.length > 0 && value >= validThresholds[validThresholds.length - 1];
155
145
  },
156
-
157
146
  axisColor() {
158
147
  const {
159
148
  validThresholds,
160
149
  max
161
150
  } = this;
162
151
  let color;
163
-
164
152
  if (validThresholds.length === 0) {
165
153
  color = [[1, gaugeSafeHues[0]]];
166
154
  } else if (validThresholds.length === 1) {
@@ -172,16 +160,13 @@ var script = {
172
160
  */
173
161
  color = [[validThresholds[0] / max, gaugeSafeHues[0]], [validThresholds[1] / max, gaugeSafeHues[1]], [1, gaugeWarningHue]];
174
162
  }
175
-
176
163
  return color;
177
164
  }
178
-
179
165
  },
180
166
  methods: {
181
167
  onCreated(chart) {
182
168
  this.$emit('created', chart);
183
169
  }
184
-
185
170
  }
186
171
  };
187
172
 
@@ -26,12 +26,12 @@ const defaultOptions = {
26
26
  type: 'heatmap'
27
27
  }
28
28
  };
29
+
29
30
  /*
30
31
  * The series is an array of arrays containing [x, y, value]
31
32
  * x and y are position, value determines the color
32
33
  * We want the min and max from value field to make the range of colors
33
34
  */
34
-
35
35
  function getRange(series) {
36
36
  return series.reduce((acc, curr) => {
37
37
  const value = curr[2] || 0;
@@ -43,7 +43,6 @@ function getRange(series) {
43
43
  max: 0
44
44
  });
45
45
  }
46
-
47
46
  var script = {
48
47
  components: {
49
48
  Chart,
@@ -103,7 +102,6 @@ var script = {
103
102
  default: true
104
103
  }
105
104
  },
106
-
107
105
  data() {
108
106
  return {
109
107
  chart: null,
@@ -118,7 +116,6 @@ var script = {
118
116
  selectedFormatTooltipText: this.formatTooltipText || this.defaultFormatTooltipText
119
117
  };
120
118
  },
121
-
122
119
  computed: {
123
120
  computedOptions() {
124
121
  const {
@@ -193,18 +190,15 @@ var script = {
193
190
  }
194
191
  }, this.toolboxAdjustments, this.options);
195
192
  },
196
-
197
193
  legendStyle() {
198
194
  return {
199
195
  paddingLeft: this.computedOptions.grid.left,
200
196
  marginTop: '-32px'
201
197
  };
202
198
  },
203
-
204
199
  compiledOptions() {
205
200
  return this.chart ? this.chart.getOption() : null;
206
201
  },
207
-
208
202
  seriesInfo() {
209
203
  const {
210
204
  min,
@@ -221,14 +215,11 @@ var script = {
221
215
  };
222
216
  });
223
217
  }
224
-
225
218
  },
226
-
227
219
  beforeDestroy() {
228
220
  this.chart.getDom().removeEventListener('mousemove', this.debouncedShowHideTooltip);
229
221
  this.chart.getDom().removeEventListener('mouseout', this.debouncedShowHideTooltip);
230
222
  },
231
-
232
223
  methods: {
233
224
  defaultFormatTooltipText(params) {
234
225
  const {
@@ -238,24 +229,20 @@ var script = {
238
229
  this.$set(this.tooltip, 'content', tooltipContent);
239
230
  this.tooltip.title = xLabels.join(', ');
240
231
  },
241
-
242
232
  onCreated(chart) {
243
233
  chart.getDom().addEventListener('mousemove', this.debouncedShowHideTooltip);
244
234
  chart.getDom().addEventListener('mouseout', this.debouncedShowHideTooltip);
245
235
  this.chart = chart;
246
236
  this.$emit('created', chart);
247
237
  },
248
-
249
238
  showHideTooltip(mouseEvent) {
250
239
  this.tooltip.show = this.chart.containPixel('grid', [mouseEvent.zrX, mouseEvent.zrY]);
251
240
  },
252
-
253
241
  onLabelChange(params) {
254
242
  this.selectedFormatTooltipText(params);
255
243
  const {
256
244
  seriesData = []
257
245
  } = params;
258
-
259
246
  if (seriesData.length && seriesData[0].value) {
260
247
  const {
261
248
  seriesId,
@@ -264,13 +251,13 @@ var script = {
264
251
  const [left, top] = this.chart.convertToPixel({
265
252
  seriesId
266
253
  }, value);
267
- this.tooltip = { ...this.tooltip,
254
+ this.tooltip = {
255
+ ...this.tooltip,
268
256
  left: `${left + TOOLTIP_LEFT_OFFSET}px`,
269
257
  top: `${top}px`
270
258
  };
271
259
  }
272
260
  }
273
-
274
261
  }
275
262
  };
276
263