@gitlab/ui 72.11.0 → 72.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/tokens/css/tokens.css +1 -1
- package/dist/tokens/css/tokens.dark.css +1 -1
- package/dist/tokens/js/tokens.dark.js +1 -1
- package/dist/tokens/js/tokens.js +1 -1
- package/dist/tokens/scss/_tokens.dark.scss +1 -1
- package/dist/tokens/scss/_tokens.scss +1 -1
- package/package.json +1 -1
- package/src/directives/safe_html/safe_html.js +5 -0
- package/src/directives/safe_html/safe_html.spec.js +17 -0
- package/src/internal/color_contrast/color_contrast.md +8 -0
- package/src/internal/color_contrast/color_contrast.spec.js +34 -0
- package/src/internal/color_contrast/color_contrast.stories.js +41 -0
- package/src/internal/color_contrast/color_contrast.vue +52 -0
- package/src/tokens/color.dark.tokens.stories.js +36 -22
- package/src/tokens/color.data_viz.dark.tokens.stories.js +13 -30
- package/src/tokens/color.data_viz.tokens.stories.js +13 -30
- package/src/tokens/color.theme.dark.tokens.stories.js +15 -30
- package/src/tokens/color.theme.tokens.stories.js +15 -30
- package/src/tokens/color.tokens.stories.js +36 -22
- package/src/tokens/color.transparency.tokens.stories.js +9 -12
- package/src/tokens/common_story_options.js +22 -80
- package/src/utils/constants.js +25 -0
- package/src/utils/utils.js +21 -1
- package/dist/charts.js +0 -14
- package/dist/components/base/accordion/accordion.js +0 -73
- package/dist/components/base/accordion/accordion_item.js +0 -133
- package/dist/components/base/alert/alert.js +0 -222
- package/dist/components/base/avatar/avatar.js +0 -160
- package/dist/components/base/avatar_labeled/avatar_labeled.js +0 -107
- package/dist/components/base/avatar_link/avatar_link.js +0 -47
- package/dist/components/base/avatars_inline/avatars_inline.js +0 -119
- package/dist/components/base/badge/badge.js +0 -105
- package/dist/components/base/banner/banner.js +0 -139
- package/dist/components/base/breadcrumb/breadcrumb.js +0 -122
- package/dist/components/base/breadcrumb/breadcrumb_item.js +0 -73
- package/dist/components/base/broadcast_message/broadcast_message.js +0 -112
- package/dist/components/base/broadcast_message/constants.js +0 -5
- package/dist/components/base/button/button.js +0 -151
- package/dist/components/base/button_group/button_group.js +0 -47
- package/dist/components/base/card/card.js +0 -71
- package/dist/components/base/carousel/carousel.js +0 -48
- package/dist/components/base/carousel/carousel_slide.js +0 -47
- package/dist/components/base/collapse/collapse.js +0 -59
- package/dist/components/base/datepicker/datepicker.js +0 -386
- package/dist/components/base/daterange_picker/daterange_picker.js +0 -288
- package/dist/components/base/drawer/drawer.js +0 -127
- package/dist/components/base/dropdown/dropdown.js +0 -261
- package/dist/components/base/dropdown/dropdown_divider.js +0 -48
- package/dist/components/base/dropdown/dropdown_form.js +0 -48
- package/dist/components/base/dropdown/dropdown_item.js +0 -131
- package/dist/components/base/dropdown/dropdown_section_header.js +0 -48
- package/dist/components/base/dropdown/dropdown_text.js +0 -48
- package/dist/components/base/filtered_search/common_story_options.js +0 -14
- package/dist/components/base/filtered_search/filtered_search.js +0 -388
- package/dist/components/base/filtered_search/filtered_search_suggestion.js +0 -89
- package/dist/components/base/filtered_search/filtered_search_suggestion_list.js +0 -138
- package/dist/components/base/filtered_search/filtered_search_term.js +0 -203
- package/dist/components/base/filtered_search/filtered_search_token.js +0 -384
- package/dist/components/base/filtered_search/filtered_search_token_segment.js +0 -420
- package/dist/components/base/filtered_search/filtered_search_utils.js +0 -242
- package/dist/components/base/form/form.js +0 -49
- package/dist/components/base/form/form_checkbox/form_checkbox.js +0 -78
- package/dist/components/base/form/form_checkbox/form_checkbox_group.js +0 -60
- package/dist/components/base/form/form_checkbox_tree/checkbox_tree_node.js +0 -79
- package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.js +0 -138
- package/dist/components/base/form/form_checkbox_tree/models/constants.js +0 -12
- package/dist/components/base/form/form_checkbox_tree/models/node.js +0 -51
- package/dist/components/base/form/form_checkbox_tree/models/tree.js +0 -199
- package/dist/components/base/form/form_combobox/constants.js +0 -55
- package/dist/components/base/form/form_combobox/form_combobox.js +0 -230
- package/dist/components/base/form/form_date/form_date.js +0 -143
- package/dist/components/base/form/form_fields/form_field_validator.js +0 -93
- package/dist/components/base/form/form_fields/form_fields.js +0 -214
- package/dist/components/base/form/form_fields/mappers.js +0 -13
- package/dist/components/base/form/form_fields/validators.js +0 -48
- package/dist/components/base/form/form_group/form_group.js +0 -97
- package/dist/components/base/form/form_input/form_input.js +0 -121
- package/dist/components/base/form/form_input_group/form_input_group.js +0 -108
- package/dist/components/base/form/form_input_group/form_input_group_mixin.js +0 -41
- package/dist/components/base/form/form_radio/form_radio.js +0 -65
- package/dist/components/base/form/form_radio_group/form_radio_group.js +0 -78
- package/dist/components/base/form/form_select/constants.js +0 -12
- package/dist/components/base/form/form_select/form_select.js +0 -82
- package/dist/components/base/form/form_text/form_text.js +0 -38
- package/dist/components/base/form/form_textarea/form_textarea.js +0 -112
- package/dist/components/base/form/input_group_text/input_group_text.js +0 -48
- package/dist/components/base/icon/icon.js +0 -111
- package/dist/components/base/infinite_scroll/infinite_scroll.js +0 -197
- package/dist/components/base/keyset_pagination/keyset_pagination.js +0 -151
- package/dist/components/base/label/label.js +0 -163
- package/dist/components/base/link/link.js +0 -50
- package/dist/components/base/loading_icon/loading_icon.js +0 -111
- package/dist/components/base/markdown/markdown.js +0 -52
- package/dist/components/base/modal/modal.js +0 -204
- package/dist/components/base/nav/nav.js +0 -48
- package/dist/components/base/nav/nav_item.js +0 -48
- package/dist/components/base/nav/nav_item_dropdown.js +0 -62
- package/dist/components/base/navbar/navbar.js +0 -48
- package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +0 -453
- package/dist/components/base/new_dropdowns/base_dropdown/constants.js +0 -4
- package/dist/components/base/new_dropdowns/constants.js +0 -21
- package/dist/components/base/new_dropdowns/disclosure/constants.js +0 -8
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown.js +0 -370
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_group.js +0 -110
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_item.js +0 -143
- package/dist/components/base/new_dropdowns/disclosure/mock_data.js +0 -147
- package/dist/components/base/new_dropdowns/disclosure/utils.js +0 -39
- package/dist/components/base/new_dropdowns/listbox/listbox.js +0 -767
- package/dist/components/base/new_dropdowns/listbox/listbox_group.js +0 -58
- package/dist/components/base/new_dropdowns/listbox/listbox_item.js +0 -91
- package/dist/components/base/new_dropdowns/listbox/listbox_search_input.js +0 -93
- package/dist/components/base/new_dropdowns/listbox/mock_data.js +0 -118
- package/dist/components/base/new_dropdowns/listbox/utils.js +0 -34
- package/dist/components/base/paginated_list/paginated_list.js +0 -180
- package/dist/components/base/pagination/pagination.js +0 -399
- package/dist/components/base/path/data.js +0 -34
- package/dist/components/base/path/path.js +0 -189
- package/dist/components/base/popover/popover.js +0 -110
- package/dist/components/base/progress_bar/progress_bar.js +0 -48
- package/dist/components/base/search_box_by_click/search_box_by_click.js +0 -235
- package/dist/components/base/search_box_by_type/search_box_by_type.js +0 -167
- package/dist/components/base/segmented_control/segmented_control.js +0 -109
- package/dist/components/base/skeleton_loader/skeleton_loader.js +0 -224
- package/dist/components/base/sorting/sorting.js +0 -171
- package/dist/components/base/sorting/sorting_item.js +0 -109
- package/dist/components/base/table/constants.js +0 -5
- package/dist/components/base/table/table.js +0 -89
- package/dist/components/base/table_lite/table_lite.js +0 -72
- package/dist/components/base/tabs/constants.js +0 -3
- package/dist/components/base/tabs/tab/tab.js +0 -83
- package/dist/components/base/tabs/tabs/scrollable_tabs.js +0 -143
- package/dist/components/base/tabs/tabs/tabs.js +0 -224
- package/dist/components/base/toast/toast.js +0 -82
- package/dist/components/base/toggle/toggle.js +0 -180
- package/dist/components/base/token/token.js +0 -85
- package/dist/components/base/token_selector/helpers.js +0 -5
- package/dist/components/base/token_selector/token_container.js +0 -165
- package/dist/components/base/token_selector/token_selector.js +0 -403
- package/dist/components/base/token_selector/token_selector_dropdown.js +0 -199
- package/dist/components/base/tooltip/tooltip.js +0 -55
- package/dist/components/charts/area/area.js +0 -311
- package/dist/components/charts/bar/bar.js +0 -253
- package/dist/components/charts/chart/chart.js +0 -215
- package/dist/components/charts/column/column.js +0 -226
- package/dist/components/charts/discrete_scatter/discrete_scatter.js +0 -203
- package/dist/components/charts/gauge/gauge.js +0 -208
- package/dist/components/charts/heatmap/heatmap.js +0 -295
- package/dist/components/charts/heatmap/index.js +0 -2
- package/dist/components/charts/legend/legend.js +0 -228
- package/dist/components/charts/line/line.js +0 -308
- package/dist/components/charts/series_label/series_label.js +0 -100
- package/dist/components/charts/single_stat/single_stat.js +0 -152
- package/dist/components/charts/sparkline/sparkline.js +0 -261
- package/dist/components/charts/stacked_column/stacked_column.js +0 -335
- package/dist/components/charts/tooltip/tooltip.js +0 -251
- package/dist/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.js +0 -83
- package/dist/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.js +0 -100
- package/dist/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +0 -35
- package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +0 -115
- package/dist/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.js +0 -104
- package/dist/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.js +0 -64
- package/dist/components/experimental/duo/chat/constants.js +0 -23
- package/dist/components/experimental/duo/chat/duo_chat.js +0 -359
- package/dist/components/experimental/duo/chat/mock_data.js +0 -83
- package/dist/components/experimental/duo/user_feedback/user_feedback.js +0 -94
- package/dist/components/experimental/duo/user_feedback/user_feedback_modal.js +0 -124
- package/dist/components/experimental/experiment_badge/constants.js +0 -4
- package/dist/components/experimental/experiment_badge/experiment_badge.js +0 -107
- package/dist/components/mixins/button_mixin.js +0 -11
- package/dist/components/mixins/safe_link_mixin.js +0 -30
- package/dist/components/mixins/tooltip_mixin.js +0 -21
- package/dist/components/regions/dashboard_skeleton/dashboard_skeleton.js +0 -53
- package/dist/components/regions/empty_state/empty_state.js +0 -154
- package/dist/components/shared_components/charts/tooltip_default_format.js +0 -53
- package/dist/components/shared_components/clear_icon_button/clear_icon_button.js +0 -64
- package/dist/components/shared_components/close_button/close_button.js +0 -54
- package/dist/components/utilities/animated_number/animated_number.js +0 -131
- package/dist/components/utilities/friendly_wrap/friendly_wrap.js +0 -75
- package/dist/components/utilities/intersection_observer/intersection_observer.js +0 -88
- package/dist/components/utilities/intersperse/intersperse.js +0 -86
- package/dist/components/utilities/sprintf/sprintf.js +0 -172
- package/dist/components/utilities/truncate/constants.js +0 -7
- package/dist/components/utilities/truncate/truncate.js +0 -111
- package/dist/components/utilities/truncate_text/constants.js +0 -7
- package/dist/components/utilities/truncate_text/truncate_text.js +0 -146
- package/dist/config.js +0 -86
- package/dist/directives/collapse_toggle.js +0 -1
- package/dist/directives/hover_load/hover_load.js +0 -45
- package/dist/directives/modal.js +0 -1
- package/dist/directives/outside/get_event_like_time_stamp.js +0 -33
- package/dist/directives/outside/outside.js +0 -106
- package/dist/directives/resize_observer/resize_observer.js +0 -51
- package/dist/directives/safe_html/constants.js +0 -6
- package/dist/directives/safe_html/safe_html.js +0 -35
- package/dist/directives/safe_link/mock_data.js +0 -10
- package/dist/directives/safe_link/safe_link.js +0 -65
- package/dist/directives/tooltip.js +0 -1
- package/dist/index.css +0 -7
- package/dist/index.css.map +0 -1
- package/dist/index.js +0 -105
- package/dist/tokens/common_story_options.js +0 -109
- package/dist/utils/breakpoints.js +0 -20
- package/dist/utils/charts/config.js +0 -556
- package/dist/utils/charts/constants.js +0 -63
- package/dist/utils/charts/mock_data.js +0 -211
- package/dist/utils/charts/story_config.js +0 -42
- package/dist/utils/charts/theme.js +0 -192
- package/dist/utils/charts/utils.js +0 -54
- package/dist/utils/constants.js +0 -270
- package/dist/utils/data_utils.js +0 -21
- package/dist/utils/datetime_utility.js +0 -61
- package/dist/utils/i18n.js +0 -15
- package/dist/utils/is_slot_empty.js +0 -38
- package/dist/utils/number_utils.js +0 -124
- package/dist/utils/stories_constants.js +0 -29
- package/dist/utils/stories_utils.js +0 -13
- package/dist/utils/story_decorators/container.js +0 -16
- package/dist/utils/string_utils.js +0 -69
- package/dist/utils/svgs/svg_paths.js +0 -7
- package/dist/utils/test_utils.js +0 -33
- package/dist/utils/use_fake_date.js +0 -29
- package/dist/utils/use_mock_intersection_observer.js +0 -108
- package/dist/utils/utils.js +0 -177
- package/dist/utils.js +0 -5
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
import merge from 'lodash/merge';
|
|
2
|
-
import { defaultAreaOpacity, lineStyle, getThresholdConfig, generateAnnotationSeries, defaultChartOptions, dataZoomAdjustments, mergeSeriesToOptions, mergeAnnotationAxisToOptions, grid } from '../../../utils/charts/config';
|
|
3
|
-
import { LEGEND_AVERAGE_TEXT, LEGEND_MAX_TEXT, LEGEND_MIN_TEXT, LEGEND_CURRENT_TEXT, LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE, HEIGHT_AUTO_CLASSES } from '../../../utils/charts/constants';
|
|
4
|
-
import { colorFromDefaultPalette } from '../../../utils/charts/theme';
|
|
5
|
-
import { seriesHasAnnotations, isDataPointAnnotation } from '../../../utils/charts/utils';
|
|
6
|
-
import Chart from '../chart/chart';
|
|
7
|
-
import ChartLegend from '../legend/legend';
|
|
8
|
-
import ChartTooltip from '../tooltip/tooltip';
|
|
9
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
10
|
-
|
|
11
|
-
//
|
|
12
|
-
var script = {
|
|
13
|
-
name: 'GlAreaChart',
|
|
14
|
-
components: {
|
|
15
|
-
Chart,
|
|
16
|
-
ChartLegend,
|
|
17
|
-
ChartTooltip
|
|
18
|
-
},
|
|
19
|
-
inheritAttrs: false,
|
|
20
|
-
props: {
|
|
21
|
-
data: {
|
|
22
|
-
type: Array,
|
|
23
|
-
required: true
|
|
24
|
-
},
|
|
25
|
-
option: {
|
|
26
|
-
type: Object,
|
|
27
|
-
required: false,
|
|
28
|
-
default: () => ({})
|
|
29
|
-
},
|
|
30
|
-
thresholds: {
|
|
31
|
-
type: Array,
|
|
32
|
-
required: false,
|
|
33
|
-
default: () => []
|
|
34
|
-
},
|
|
35
|
-
annotations: {
|
|
36
|
-
type: Array,
|
|
37
|
-
required: false,
|
|
38
|
-
default: () => []
|
|
39
|
-
},
|
|
40
|
-
includeLegendAvgMax: {
|
|
41
|
-
type: Boolean,
|
|
42
|
-
required: false,
|
|
43
|
-
default: true
|
|
44
|
-
},
|
|
45
|
-
formatAnnotationsTooltipText: {
|
|
46
|
-
type: Function,
|
|
47
|
-
required: false,
|
|
48
|
-
default: null
|
|
49
|
-
},
|
|
50
|
-
/**
|
|
51
|
-
* Callback called when showing or refreshing a tooltip.
|
|
52
|
-
* **Deprecated:** Use slots `#tooltip-title`, `#tooltip-content` or `#tooltip-value`.
|
|
53
|
-
*
|
|
54
|
-
* @deprecated Use slots `#tooltip-title`, `#tooltip-content` or `#tooltip-value`.
|
|
55
|
-
*/
|
|
56
|
-
formatTooltipText: {
|
|
57
|
-
type: Function,
|
|
58
|
-
required: false,
|
|
59
|
-
default: null
|
|
60
|
-
},
|
|
61
|
-
legendAverageText: {
|
|
62
|
-
type: String,
|
|
63
|
-
required: false,
|
|
64
|
-
default: LEGEND_AVERAGE_TEXT
|
|
65
|
-
},
|
|
66
|
-
legendMaxText: {
|
|
67
|
-
type: String,
|
|
68
|
-
required: false,
|
|
69
|
-
default: LEGEND_MAX_TEXT
|
|
70
|
-
},
|
|
71
|
-
legendMinText: {
|
|
72
|
-
type: String,
|
|
73
|
-
required: false,
|
|
74
|
-
default: LEGEND_MIN_TEXT
|
|
75
|
-
},
|
|
76
|
-
legendCurrentText: {
|
|
77
|
-
type: String,
|
|
78
|
-
required: false,
|
|
79
|
-
default: LEGEND_CURRENT_TEXT
|
|
80
|
-
},
|
|
81
|
-
legendLayout: {
|
|
82
|
-
type: String,
|
|
83
|
-
required: false,
|
|
84
|
-
default: LEGEND_LAYOUT_INLINE,
|
|
85
|
-
validator(layout) {
|
|
86
|
-
return [LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE].indexOf(layout) !== -1;
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
/**
|
|
90
|
-
* Sets the chart's height in pixels. Set to `"auto"` to use the height of the container.
|
|
91
|
-
*/
|
|
92
|
-
height: {
|
|
93
|
-
type: [Number, String],
|
|
94
|
-
required: false,
|
|
95
|
-
default: null
|
|
96
|
-
},
|
|
97
|
-
legendSeriesInfo: {
|
|
98
|
-
type: Array,
|
|
99
|
-
required: false,
|
|
100
|
-
default: () => []
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
data() {
|
|
104
|
-
// Part of the tooltip related data can be
|
|
105
|
-
// moved into the tooltip component.
|
|
106
|
-
// Tracking that progress in
|
|
107
|
-
// https://gitlab.com/gitlab-org/gitlab-ui/-/issues/618
|
|
108
|
-
return {
|
|
109
|
-
chart: null,
|
|
110
|
-
showAnnotationsTooltip: false,
|
|
111
|
-
annotationsTooltipTitle: '',
|
|
112
|
-
annotationsTooltipContent: '',
|
|
113
|
-
annotationsTooltipPosition: {
|
|
114
|
-
left: '0',
|
|
115
|
-
top: '0'
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
},
|
|
119
|
-
computed: {
|
|
120
|
-
series() {
|
|
121
|
-
const dataSeries = this.data.map((series, index) => {
|
|
122
|
-
const defaultColor = colorFromDefaultPalette(index);
|
|
123
|
-
const getColor = type => series[type] && series[type].color ? series[type].color : defaultColor;
|
|
124
|
-
return merge({
|
|
125
|
-
areaStyle: {
|
|
126
|
-
opacity: defaultAreaOpacity,
|
|
127
|
-
color: getColor('areaStyle')
|
|
128
|
-
},
|
|
129
|
-
showSymbol: false,
|
|
130
|
-
lineStyle: {
|
|
131
|
-
color: getColor('lineStyle')
|
|
132
|
-
},
|
|
133
|
-
itemStyle: {
|
|
134
|
-
color: getColor('itemStyle')
|
|
135
|
-
}
|
|
136
|
-
}, lineStyle, series, getThresholdConfig(this.thresholds));
|
|
137
|
-
});
|
|
138
|
-
// if annotation series exists, append it
|
|
139
|
-
// along with data series
|
|
140
|
-
if (this.annotationSeries) {
|
|
141
|
-
return [...dataSeries, this.annotationSeries];
|
|
142
|
-
}
|
|
143
|
-
return dataSeries;
|
|
144
|
-
},
|
|
145
|
-
annotationSeries() {
|
|
146
|
-
return generateAnnotationSeries(this.annotations);
|
|
147
|
-
},
|
|
148
|
-
options() {
|
|
149
|
-
const defaultAreaChartOptions = {
|
|
150
|
-
xAxis: {
|
|
151
|
-
axisPointer: {
|
|
152
|
-
show: true,
|
|
153
|
-
lineStyle: {
|
|
154
|
-
type: 'solid'
|
|
155
|
-
},
|
|
156
|
-
label: {
|
|
157
|
-
formatter: this.formatTooltipText
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
yAxis: {
|
|
162
|
-
axisTick: {
|
|
163
|
-
show: false
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
legend: {
|
|
167
|
-
show: false
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
const mergedOptions = merge({}, defaultChartOptions, defaultAreaChartOptions, this.option, dataZoomAdjustments(this.option.dataZoom));
|
|
171
|
-
// All chart options can be merged but series
|
|
172
|
-
// needs to be handled specially.
|
|
173
|
-
return mergeSeriesToOptions(mergeAnnotationAxisToOptions(mergedOptions, this.hasAnnotations), this.series);
|
|
174
|
-
},
|
|
175
|
-
/**
|
|
176
|
-
* Annotations currently are passed as series options in monitoring dashboard.
|
|
177
|
-
* Once https://gitlab.com/gitlab-org/gitlab/-/issues/213390 is closed,
|
|
178
|
-
* annotations will be passed as props and not as series options.
|
|
179
|
-
*
|
|
180
|
-
* For backward compatibility, we're having to check for both.
|
|
181
|
-
*/
|
|
182
|
-
hasAnnotations() {
|
|
183
|
-
return this.annotations.length !== 0 || seriesHasAnnotations(this.option.series);
|
|
184
|
-
},
|
|
185
|
-
shouldShowAnnotationsTooltip() {
|
|
186
|
-
return this.chart && this.hasAnnotations;
|
|
187
|
-
},
|
|
188
|
-
compiledOptions() {
|
|
189
|
-
return this.chart ? this.chart.getOption() : null;
|
|
190
|
-
},
|
|
191
|
-
legendStyle() {
|
|
192
|
-
return {
|
|
193
|
-
paddingLeft: `${grid.left}px`
|
|
194
|
-
};
|
|
195
|
-
},
|
|
196
|
-
seriesInfo() {
|
|
197
|
-
if (this.legendSeriesInfo.length > 0) return this.legendSeriesInfo;
|
|
198
|
-
return this.compiledOptions.series.reduce((acc, series, index) => {
|
|
199
|
-
if (series.type === 'line') {
|
|
200
|
-
acc.push({
|
|
201
|
-
name: series.name,
|
|
202
|
-
type: series.lineStyle.type,
|
|
203
|
-
color: series.lineStyle.color || colorFromDefaultPalette(index),
|
|
204
|
-
data: this.includeLegendAvgMax ? series.data.map(data => data[1]) : undefined
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
return acc;
|
|
208
|
-
}, []);
|
|
209
|
-
},
|
|
210
|
-
autoHeight() {
|
|
211
|
-
return this.height === 'auto';
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
beforeDestroy() {
|
|
215
|
-
this.chart.off('mouseout', this.hideAnnotationsTooltip);
|
|
216
|
-
this.chart.off('mouseover', this.onChartMouseOver);
|
|
217
|
-
},
|
|
218
|
-
methods: {
|
|
219
|
-
defaultAnnotationTooltipText(params) {
|
|
220
|
-
var _params$data$tooltipD;
|
|
221
|
-
return {
|
|
222
|
-
title: params.data.xAxis,
|
|
223
|
-
content: (_params$data$tooltipD = params.data.tooltipData) === null || _params$data$tooltipD === void 0 ? void 0 : _params$data$tooltipD.content
|
|
224
|
-
};
|
|
225
|
-
},
|
|
226
|
-
onCreated(chart) {
|
|
227
|
-
// eCharts inbuild mouse events
|
|
228
|
-
// https://echarts.apache.org/en/api.html#events.Mouse%20events
|
|
229
|
-
// is used to attach listeners to markPoints. These listeners
|
|
230
|
-
// are currently used for annotation arrows at the bottom of the chart.
|
|
231
|
-
|
|
232
|
-
// Because data points and annotations arrows are in different
|
|
233
|
-
// sections of the charts with their own mouseovers and mouseouts,
|
|
234
|
-
// there shouldn't be an overlapping situation where both tooltips
|
|
235
|
-
// are visible.
|
|
236
|
-
if (this.hasAnnotations) {
|
|
237
|
-
chart.on('mouseout', this.onChartDataPointMouseOut);
|
|
238
|
-
chart.on('mouseover', this.onChartDataPointMouseOver);
|
|
239
|
-
}
|
|
240
|
-
this.chart = chart;
|
|
241
|
-
this.$emit('created', chart);
|
|
242
|
-
},
|
|
243
|
-
onChartDataPointMouseOut() {
|
|
244
|
-
this.showAnnotationsTooltip = false;
|
|
245
|
-
},
|
|
246
|
-
/**
|
|
247
|
-
* Check if the hovered data point is an annotation
|
|
248
|
-
* point to show the annotation tooltip.
|
|
249
|
-
*/
|
|
250
|
-
onChartDataPointMouseOver(params) {
|
|
251
|
-
if (isDataPointAnnotation(params)) {
|
|
252
|
-
const {
|
|
253
|
-
event
|
|
254
|
-
} = params;
|
|
255
|
-
const toolTipFormatter = this.formatAnnotationsTooltipText || this.defaultAnnotationTooltipText;
|
|
256
|
-
const {
|
|
257
|
-
title = '',
|
|
258
|
-
content = ''
|
|
259
|
-
} = toolTipFormatter(params);
|
|
260
|
-
this.showAnnotationsTooltip = true;
|
|
261
|
-
this.annotationsTooltipTitle = title;
|
|
262
|
-
this.annotationsTooltipContent = content;
|
|
263
|
-
this.annotationsTooltipPosition = {
|
|
264
|
-
left: `${event.event.zrX}px`,
|
|
265
|
-
top: `${event.event.zrY}px`
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
},
|
|
270
|
-
HEIGHT_AUTO_CLASSES
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
/* script */
|
|
274
|
-
const __vue_script__ = script;
|
|
275
|
-
|
|
276
|
-
/* template */
|
|
277
|
-
var __vue_render__ = function () {
|
|
278
|
-
var _obj;
|
|
279
|
-
var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative",class:( _obj = {}, _obj[_vm.$options.HEIGHT_AUTO_CLASSES] = _vm.autoHeight, _obj )},[_c('chart',_vm._g(_vm._b({class:{ 'gl-flex-grow-1': _vm.autoHeight },attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.shouldShowAnnotationsTooltip)?_c('chart-tooltip',{ref:"annotationsTooltip",attrs:{"id":"annotationsTooltip","show":_vm.showAnnotationsTooltip,"top":_vm.annotationsTooltipPosition.top,"left":_vm.annotationsTooltipPosition.left,"chart":_vm.chart,"placement":"bottom"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',[_vm._v(_vm._s(_vm.annotationsTooltipTitle))])]},proxy:true}],null,false,1889294429)},[_vm._v(" "),_c('div',[_vm._v(_vm._s(_vm.annotationsTooltipContent))])]):_vm._e(),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{ref:"dataTooltip",attrs:{"chart":_vm.chart,"use-default-tooltip-formatter":!_vm.formatTooltipText},scopedSlots:_vm._u([(_vm.$scopedSlots['tooltip-title'])?{key:"title",fn:function(scope){return [_vm._t("tooltip-title",null,null,scope)]}}:null,(_vm.$scopedSlots['tooltip-content'])?{key:"default",fn:function(scope){return [_vm._t("tooltip-content",null,null,scope)]}}:null,(_vm.$scopedSlots['tooltip-value'])?{key:"tooltip-value",fn:function(scope){return [_vm._t("tooltip-value",null,null,scope)]}}:null],null,true)}):_vm._e(),_vm._v(" "),(_vm.compiledOptions)?_c('chart-legend',{style:(_vm.legendStyle),attrs:{"chart":_vm.chart,"series-info":_vm.seriesInfo,"text-style":_vm.compiledOptions.textStyle,"min-text":_vm.legendMinText,"max-text":_vm.legendMaxText,"average-text":_vm.legendAverageText,"current-text":_vm.legendCurrentText,"layout":_vm.legendLayout}}):_vm._e()],1)};
|
|
280
|
-
var __vue_staticRenderFns__ = [];
|
|
281
|
-
|
|
282
|
-
/* style */
|
|
283
|
-
const __vue_inject_styles__ = undefined;
|
|
284
|
-
/* scoped */
|
|
285
|
-
const __vue_scope_id__ = undefined;
|
|
286
|
-
/* module identifier */
|
|
287
|
-
const __vue_module_identifier__ = undefined;
|
|
288
|
-
/* functional template */
|
|
289
|
-
const __vue_is_functional_template__ = false;
|
|
290
|
-
/* style inject */
|
|
291
|
-
|
|
292
|
-
/* style inject SSR */
|
|
293
|
-
|
|
294
|
-
/* style inject shadow dom */
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
const __vue_component__ = __vue_normalize__(
|
|
299
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
300
|
-
__vue_inject_styles__,
|
|
301
|
-
__vue_script__,
|
|
302
|
-
__vue_scope_id__,
|
|
303
|
-
__vue_is_functional_template__,
|
|
304
|
-
__vue_module_identifier__,
|
|
305
|
-
false,
|
|
306
|
-
undefined,
|
|
307
|
-
undefined,
|
|
308
|
-
undefined
|
|
309
|
-
);
|
|
310
|
-
|
|
311
|
-
export default __vue_component__;
|
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import merge from 'lodash/merge';
|
|
2
|
-
import truncate from 'lodash/truncate';
|
|
3
|
-
import { dataZoomAdjustments, mergeSeriesToOptions, grid } from '../../../utils/charts/config';
|
|
4
|
-
import { HEIGHT_AUTO_CLASSES } from '../../../utils/charts/constants';
|
|
5
|
-
import { colorFromDefaultPalette } from '../../../utils/charts/theme';
|
|
6
|
-
import { engineeringNotation } from '../../../utils/number_utils';
|
|
7
|
-
import { hexToRgba } from '../../../utils/utils';
|
|
8
|
-
import TooltipDefaultFormat from '../../shared_components/charts/tooltip_default_format';
|
|
9
|
-
import Chart from '../chart/chart';
|
|
10
|
-
import ChartTooltip from '../tooltip/tooltip';
|
|
11
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
12
|
-
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* `nameGap` in charts/config is set to 50 but it is not
|
|
17
|
-
* used for bar charts as the axes are flipped. That is why
|
|
18
|
-
* we're explicitly setting it here
|
|
19
|
-
*/
|
|
20
|
-
const DEFAULT_NAME_GAP = 50;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* This is the magic number at which the y-axis name
|
|
24
|
-
* and y-axis labels don't overlap
|
|
25
|
-
* @Number
|
|
26
|
-
*/
|
|
27
|
-
const AXIS_LABEL_LENGTH = 7;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Because the axes are reversed in bar charts defaultChartOptions
|
|
31
|
-
* xAxis and yAxis needs to be handled specifically.
|
|
32
|
-
*/
|
|
33
|
-
const defaultOptions = {
|
|
34
|
-
grid,
|
|
35
|
-
xAxis: {
|
|
36
|
-
nameLocation: 'center',
|
|
37
|
-
axisLabel: {
|
|
38
|
-
formatter: num => engineeringNotation(num, 2)
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
yAxis: {
|
|
42
|
-
nameGap: DEFAULT_NAME_GAP,
|
|
43
|
-
boundaryGap: true,
|
|
44
|
-
nameLocation: 'center',
|
|
45
|
-
splitLine: {
|
|
46
|
-
show: false
|
|
47
|
-
},
|
|
48
|
-
axisLabel: {
|
|
49
|
-
interval: 0,
|
|
50
|
-
formatter: str => truncate(str, {
|
|
51
|
-
length: AXIS_LABEL_LENGTH,
|
|
52
|
-
separator: '...'
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
var script = {
|
|
58
|
-
name: 'GlBarChart',
|
|
59
|
-
components: {
|
|
60
|
-
Chart,
|
|
61
|
-
ChartTooltip,
|
|
62
|
-
TooltipDefaultFormat
|
|
63
|
-
},
|
|
64
|
-
inheritAttrs: false,
|
|
65
|
-
props: {
|
|
66
|
-
data: {
|
|
67
|
-
type: Object,
|
|
68
|
-
required: true
|
|
69
|
-
},
|
|
70
|
-
option: {
|
|
71
|
-
type: Object,
|
|
72
|
-
required: false,
|
|
73
|
-
default: () => ({})
|
|
74
|
-
},
|
|
75
|
-
yAxisTitle: {
|
|
76
|
-
type: String,
|
|
77
|
-
required: true
|
|
78
|
-
},
|
|
79
|
-
xAxisTitle: {
|
|
80
|
-
type: String,
|
|
81
|
-
required: true
|
|
82
|
-
},
|
|
83
|
-
xAxisType: {
|
|
84
|
-
type: String,
|
|
85
|
-
required: false,
|
|
86
|
-
default: 'value'
|
|
87
|
-
},
|
|
88
|
-
/**
|
|
89
|
-
* Sets the chart's height in pixels. Set to `"auto"` to use the height of the container.
|
|
90
|
-
*/
|
|
91
|
-
height: {
|
|
92
|
-
type: [Number, String],
|
|
93
|
-
required: false,
|
|
94
|
-
default: null
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
data() {
|
|
98
|
-
return {
|
|
99
|
-
chart: null,
|
|
100
|
-
tooltipTitle: '',
|
|
101
|
-
tooltipContent: {}
|
|
102
|
-
};
|
|
103
|
-
},
|
|
104
|
-
computed: {
|
|
105
|
-
series() {
|
|
106
|
-
return Object.keys(this.data).map((key, index) => {
|
|
107
|
-
const barColor = colorFromDefaultPalette(index);
|
|
108
|
-
return {
|
|
109
|
-
name: key,
|
|
110
|
-
data: this.data[key],
|
|
111
|
-
type: 'bar',
|
|
112
|
-
stack: 'chart',
|
|
113
|
-
itemStyle: {
|
|
114
|
-
color: hexToRgba(barColor, 0.2),
|
|
115
|
-
borderColor: barColor,
|
|
116
|
-
borderWidth: 1
|
|
117
|
-
},
|
|
118
|
-
emphasis: {
|
|
119
|
-
itemStyle: {
|
|
120
|
-
color: hexToRgba(barColor, 0.4)
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
barMaxWidth: '50%'
|
|
124
|
-
};
|
|
125
|
-
});
|
|
126
|
-
},
|
|
127
|
-
options() {
|
|
128
|
-
const mergedOptions = merge({}, defaultOptions, {
|
|
129
|
-
xAxis: {
|
|
130
|
-
axisLine: {
|
|
131
|
-
show: false
|
|
132
|
-
},
|
|
133
|
-
name: this.xAxisTitle,
|
|
134
|
-
type: this.xAxisType
|
|
135
|
-
},
|
|
136
|
-
yAxis: {
|
|
137
|
-
name: this.yAxisTitle,
|
|
138
|
-
type: 'category',
|
|
139
|
-
axisTick: {
|
|
140
|
-
show: true
|
|
141
|
-
},
|
|
142
|
-
axisPointer: {
|
|
143
|
-
show: true,
|
|
144
|
-
type: 'none',
|
|
145
|
-
label: {
|
|
146
|
-
formatter: this.onLabelChange
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
legend: {
|
|
151
|
-
show: false
|
|
152
|
-
}
|
|
153
|
-
}, this.option, dataZoomAdjustments(this.option.dataZoom));
|
|
154
|
-
// All chart options can be merged but series
|
|
155
|
-
// needs to be handled specially
|
|
156
|
-
return mergeSeriesToOptions(mergedOptions, this.series);
|
|
157
|
-
},
|
|
158
|
-
autoHeight() {
|
|
159
|
-
return this.height === 'auto';
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
methods: {
|
|
163
|
-
onCreated(chart) {
|
|
164
|
-
this.chart = chart;
|
|
165
|
-
this.$emit('created', chart);
|
|
166
|
-
},
|
|
167
|
-
onLabelChange(params) {
|
|
168
|
-
const {
|
|
169
|
-
yLabels,
|
|
170
|
-
tooltipContent
|
|
171
|
-
} = this.getTooltipContent(params, this.xAxisTitle);
|
|
172
|
-
this.$set(this, 'tooltipContent', tooltipContent);
|
|
173
|
-
this.tooltipTitle = yLabels.join(', ');
|
|
174
|
-
},
|
|
175
|
-
/**
|
|
176
|
-
* For bar charts, the tooltip should be against x-axis values.
|
|
177
|
-
* This method will be removed after https://gitlab.com/gitlab-org/gitlab-ui/-/issues/674
|
|
178
|
-
*
|
|
179
|
-
* @param {Object} params series data
|
|
180
|
-
* @param {String} xAxisTitle x-axis title
|
|
181
|
-
* @returns {Object} tooltip title and content
|
|
182
|
-
*/
|
|
183
|
-
getTooltipContent(params) {
|
|
184
|
-
let xAxisTitle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
185
|
-
const seriesDataLength = params.seriesData.length;
|
|
186
|
-
const {
|
|
187
|
-
yLabels,
|
|
188
|
-
tooltipContent
|
|
189
|
-
} = params.seriesData.reduce((acc, chartItem) => {
|
|
190
|
-
const [value, title] = chartItem.value || [];
|
|
191
|
-
// The x axis title is used instead of y axis
|
|
192
|
-
const seriesName = seriesDataLength === 1 && xAxisTitle ? xAxisTitle : chartItem.seriesName;
|
|
193
|
-
const color = seriesDataLength === 1 ? '' : chartItem.color;
|
|
194
|
-
acc.tooltipContent[seriesName] = {
|
|
195
|
-
value,
|
|
196
|
-
color
|
|
197
|
-
};
|
|
198
|
-
if (!acc.yLabels.includes(title)) {
|
|
199
|
-
acc.yLabels.push(title);
|
|
200
|
-
}
|
|
201
|
-
return acc;
|
|
202
|
-
}, {
|
|
203
|
-
yLabels: [],
|
|
204
|
-
tooltipContent: {}
|
|
205
|
-
});
|
|
206
|
-
return {
|
|
207
|
-
yLabels,
|
|
208
|
-
tooltipContent
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
HEIGHT_AUTO_CLASSES
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
/* script */
|
|
216
|
-
const __vue_script__ = script;
|
|
217
|
-
|
|
218
|
-
/* template */
|
|
219
|
-
var __vue_render__ = function () {
|
|
220
|
-
var _obj;
|
|
221
|
-
var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative",class:( _obj = {}, _obj[_vm.$options.HEIGHT_AUTO_CLASSES] = _vm.autoHeight, _obj )},[_c('chart',_vm._g(_vm._b({class:{ 'gl-flex-grow-1': _vm.autoHeight },attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"chart":_vm.chart},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',[_vm._v(_vm._s(_vm.tooltipTitle)+" ("+_vm._s(_vm.yAxisTitle)+")")])]},proxy:true}],null,false,1644826356)},[_vm._v(" "),_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltipContent}})],1):_vm._e()],1)};
|
|
222
|
-
var __vue_staticRenderFns__ = [];
|
|
223
|
-
|
|
224
|
-
/* style */
|
|
225
|
-
const __vue_inject_styles__ = undefined;
|
|
226
|
-
/* scoped */
|
|
227
|
-
const __vue_scope_id__ = undefined;
|
|
228
|
-
/* module identifier */
|
|
229
|
-
const __vue_module_identifier__ = undefined;
|
|
230
|
-
/* functional template */
|
|
231
|
-
const __vue_is_functional_template__ = false;
|
|
232
|
-
/* style inject */
|
|
233
|
-
|
|
234
|
-
/* style inject SSR */
|
|
235
|
-
|
|
236
|
-
/* style inject shadow dom */
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
const __vue_component__ = __vue_normalize__(
|
|
241
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
242
|
-
__vue_inject_styles__,
|
|
243
|
-
__vue_script__,
|
|
244
|
-
__vue_scope_id__,
|
|
245
|
-
__vue_is_functional_template__,
|
|
246
|
-
__vue_module_identifier__,
|
|
247
|
-
false,
|
|
248
|
-
undefined,
|
|
249
|
-
undefined,
|
|
250
|
-
undefined
|
|
251
|
-
);
|
|
252
|
-
|
|
253
|
-
export default __vue_component__;
|