@gitlab/ui 72.11.1 → 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 +7 -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/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 -39
- 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,208 +0,0 @@
|
|
|
1
|
-
import merge from 'lodash/merge';
|
|
2
|
-
import uniq from 'lodash/uniq';
|
|
3
|
-
import sortBy from 'lodash/sortBy';
|
|
4
|
-
import { gaugeNeutralHues, gaugeSafeHues, gaugeWarningHue } from '../../../utils/charts/theme';
|
|
5
|
-
import Chart from '../chart/chart';
|
|
6
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
7
|
-
|
|
8
|
-
//
|
|
9
|
-
const AXIS_LABEL_FONT_SIZE_PX = 14;
|
|
10
|
-
const ARC_RADIUS = '80%';
|
|
11
|
-
const DETAIL_FONT_SIZE_PX = 30;
|
|
12
|
-
const DETAIL_FONT_FAMILY = 'sans-serif';
|
|
13
|
-
const DETAIL_FONT_WEIGHT = 'bold';
|
|
14
|
-
const POINTER_LENGTH = '65%';
|
|
15
|
-
const POINTER_WIDTH_PX = 5;
|
|
16
|
-
const gaugeChartSeries = _ref => {
|
|
17
|
-
let {
|
|
18
|
-
value,
|
|
19
|
-
text,
|
|
20
|
-
min,
|
|
21
|
-
max,
|
|
22
|
-
splitNumber,
|
|
23
|
-
axisColor
|
|
24
|
-
} = _ref;
|
|
25
|
-
return [{
|
|
26
|
-
type: 'gauge',
|
|
27
|
-
detail: {
|
|
28
|
-
show: true,
|
|
29
|
-
formatter: () => {
|
|
30
|
-
const currentValue = Number.isFinite(value) ? value : null;
|
|
31
|
-
return text || (currentValue !== null && currentValue !== void 0 ? currentValue : '--');
|
|
32
|
-
},
|
|
33
|
-
color: `${gaugeNeutralHues[0]}`,
|
|
34
|
-
fontSize: DETAIL_FONT_SIZE_PX,
|
|
35
|
-
fontFamily: DETAIL_FONT_FAMILY,
|
|
36
|
-
fontWeight: DETAIL_FONT_WEIGHT
|
|
37
|
-
},
|
|
38
|
-
axisLabel: {
|
|
39
|
-
show: true,
|
|
40
|
-
fontSize: AXIS_LABEL_FONT_SIZE_PX,
|
|
41
|
-
formatter: theValue => Number.isFinite(theValue) ? theValue : '--',
|
|
42
|
-
color: `${gaugeNeutralHues[1]}`
|
|
43
|
-
},
|
|
44
|
-
axisLine: {
|
|
45
|
-
lineStyle: {
|
|
46
|
-
color: axisColor
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
radius: ARC_RADIUS,
|
|
50
|
-
pointer: {
|
|
51
|
-
length: POINTER_LENGTH,
|
|
52
|
-
width: POINTER_WIDTH_PX
|
|
53
|
-
},
|
|
54
|
-
data: [{
|
|
55
|
-
value
|
|
56
|
-
}],
|
|
57
|
-
min,
|
|
58
|
-
max,
|
|
59
|
-
splitNumber
|
|
60
|
-
}];
|
|
61
|
-
};
|
|
62
|
-
var script = {
|
|
63
|
-
name: 'GlGaugeChart',
|
|
64
|
-
components: {
|
|
65
|
-
Chart
|
|
66
|
-
},
|
|
67
|
-
props: {
|
|
68
|
-
value: {
|
|
69
|
-
type: Number,
|
|
70
|
-
required: true
|
|
71
|
-
},
|
|
72
|
-
min: {
|
|
73
|
-
type: Number,
|
|
74
|
-
required: false,
|
|
75
|
-
default: 0
|
|
76
|
-
},
|
|
77
|
-
max: {
|
|
78
|
-
type: Number,
|
|
79
|
-
required: false,
|
|
80
|
-
default: 100
|
|
81
|
-
},
|
|
82
|
-
thresholds: {
|
|
83
|
-
type: Array,
|
|
84
|
-
required: false,
|
|
85
|
-
default: () => [],
|
|
86
|
-
validator: value => {
|
|
87
|
-
return value !== null && value !== void 0 && value.length ? value.every(item => Number.isFinite(item)) : true;
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
text: {
|
|
91
|
-
type: String,
|
|
92
|
-
required: false,
|
|
93
|
-
default: ''
|
|
94
|
-
},
|
|
95
|
-
splitNumber: {
|
|
96
|
-
type: Number,
|
|
97
|
-
required: false,
|
|
98
|
-
default: 10
|
|
99
|
-
},
|
|
100
|
-
option: {
|
|
101
|
-
type: Object,
|
|
102
|
-
required: false,
|
|
103
|
-
default: () => ({})
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
computed: {
|
|
107
|
-
options() {
|
|
108
|
-
const mergedOptions = merge({}, {
|
|
109
|
-
series: gaugeChartSeries({
|
|
110
|
-
value: this.value,
|
|
111
|
-
text: this.text,
|
|
112
|
-
min: this.min,
|
|
113
|
-
max: this.max,
|
|
114
|
-
splitNumber: this.splitNumber,
|
|
115
|
-
axisColor: this.axisColor
|
|
116
|
-
})
|
|
117
|
-
}, this.option);
|
|
118
|
-
return mergedOptions;
|
|
119
|
-
},
|
|
120
|
-
validThresholds() {
|
|
121
|
-
const {
|
|
122
|
-
thresholds,
|
|
123
|
-
min,
|
|
124
|
-
max
|
|
125
|
-
} = this;
|
|
126
|
-
if (!(thresholds !== null && thresholds !== void 0 && thresholds.length)) return [];
|
|
127
|
-
const uniqueThresholds = uniq(thresholds);
|
|
128
|
-
const filteredThresholds = uniqueThresholds.filter(threshold => {
|
|
129
|
-
return Number.isFinite(threshold) && threshold > min && threshold < max;
|
|
130
|
-
});
|
|
131
|
-
/**
|
|
132
|
-
* Only the first two thresholds will be used
|
|
133
|
-
*/
|
|
134
|
-
const reducedThresholdsList = filteredThresholds.length > 2 ? [filteredThresholds[0], filteredThresholds[1]] : [...filteredThresholds];
|
|
135
|
-
const sortedThresholds = sortBy(reducedThresholdsList);
|
|
136
|
-
return sortedThresholds;
|
|
137
|
-
},
|
|
138
|
-
valueIsInLastThreshold() {
|
|
139
|
-
const {
|
|
140
|
-
validThresholds,
|
|
141
|
-
value
|
|
142
|
-
} = this;
|
|
143
|
-
return validThresholds.length > 0 && value >= validThresholds[validThresholds.length - 1];
|
|
144
|
-
},
|
|
145
|
-
axisColor() {
|
|
146
|
-
const {
|
|
147
|
-
validThresholds,
|
|
148
|
-
max
|
|
149
|
-
} = this;
|
|
150
|
-
let color;
|
|
151
|
-
if (validThresholds.length === 0) {
|
|
152
|
-
color = [[1, gaugeSafeHues[0]]];
|
|
153
|
-
} else if (validThresholds.length === 1) {
|
|
154
|
-
color = [[validThresholds[0] / max, gaugeSafeHues[0]], [1, gaugeWarningHue]];
|
|
155
|
-
} else if (validThresholds.length >= 2) {
|
|
156
|
-
/**
|
|
157
|
-
* If there are more than two ranges set, only the first two will
|
|
158
|
-
* be used
|
|
159
|
-
*/
|
|
160
|
-
color = [[validThresholds[0] / max, gaugeSafeHues[0]], [validThresholds[1] / max, gaugeSafeHues[1]], [1, gaugeWarningHue]];
|
|
161
|
-
}
|
|
162
|
-
return color;
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
methods: {
|
|
166
|
-
onCreated(chart) {
|
|
167
|
-
this.$emit('created', chart);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
/* script */
|
|
173
|
-
const __vue_script__ = script;
|
|
174
|
-
|
|
175
|
-
/* template */
|
|
176
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('chart',_vm._g(_vm._b({attrs:{"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners))};
|
|
177
|
-
var __vue_staticRenderFns__ = [];
|
|
178
|
-
|
|
179
|
-
/* style */
|
|
180
|
-
const __vue_inject_styles__ = undefined;
|
|
181
|
-
/* scoped */
|
|
182
|
-
const __vue_scope_id__ = undefined;
|
|
183
|
-
/* module identifier */
|
|
184
|
-
const __vue_module_identifier__ = undefined;
|
|
185
|
-
/* functional template */
|
|
186
|
-
const __vue_is_functional_template__ = false;
|
|
187
|
-
/* style inject */
|
|
188
|
-
|
|
189
|
-
/* style inject SSR */
|
|
190
|
-
|
|
191
|
-
/* style inject shadow dom */
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
const __vue_component__ = __vue_normalize__(
|
|
196
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
197
|
-
__vue_inject_styles__,
|
|
198
|
-
__vue_script__,
|
|
199
|
-
__vue_scope_id__,
|
|
200
|
-
__vue_is_functional_template__,
|
|
201
|
-
__vue_module_identifier__,
|
|
202
|
-
false,
|
|
203
|
-
undefined,
|
|
204
|
-
undefined,
|
|
205
|
-
undefined
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
export default __vue_component__;
|
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
import merge from 'lodash/merge';
|
|
2
|
-
import { GRAY_100, WHITE } from '../../../../dist/tokens/js/tokens';
|
|
3
|
-
import { getTooltipTitle, getTooltipContent } from '../../../utils/charts/config';
|
|
4
|
-
import { HEIGHT_AUTO_CLASSES } from '../../../utils/charts/constants';
|
|
5
|
-
import { heatmapHues } from '../../../utils/charts/theme';
|
|
6
|
-
import { engineeringNotation } from '../../../utils/number_utils';
|
|
7
|
-
import TooltipDefaultFormat from '../../shared_components/charts/tooltip_default_format';
|
|
8
|
-
import Chart from '../chart/chart';
|
|
9
|
-
import ChartLegend from '../legend/legend';
|
|
10
|
-
import ChartTooltip from '../tooltip/tooltip';
|
|
11
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
12
|
-
|
|
13
|
-
//
|
|
14
|
-
const defaultOptions = {
|
|
15
|
-
visualMap: {
|
|
16
|
-
show: false,
|
|
17
|
-
inRange: {
|
|
18
|
-
color: heatmapHues
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
series: {
|
|
22
|
-
type: 'heatmap'
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/*
|
|
27
|
-
* The series is an array of arrays containing [x, y, value]
|
|
28
|
-
* x and y are position, value determines the color
|
|
29
|
-
* We want the min and max from value field to make the range of colors
|
|
30
|
-
*/
|
|
31
|
-
function getRange(series) {
|
|
32
|
-
return series.reduce((acc, curr) => {
|
|
33
|
-
const value = curr[2] || 0;
|
|
34
|
-
if (value < acc.min) acc.min = value;
|
|
35
|
-
if (value > acc.max) acc.max = value;
|
|
36
|
-
return acc;
|
|
37
|
-
}, {
|
|
38
|
-
min: 0,
|
|
39
|
-
max: 0
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
var script = {
|
|
43
|
-
name: 'GlHeatmap',
|
|
44
|
-
components: {
|
|
45
|
-
Chart,
|
|
46
|
-
ChartLegend,
|
|
47
|
-
ChartTooltip,
|
|
48
|
-
TooltipDefaultFormat
|
|
49
|
-
},
|
|
50
|
-
props: {
|
|
51
|
-
options: {
|
|
52
|
-
type: Object,
|
|
53
|
-
required: false,
|
|
54
|
-
default: () => ({})
|
|
55
|
-
},
|
|
56
|
-
dataSeries: {
|
|
57
|
-
type: Array,
|
|
58
|
-
required: true
|
|
59
|
-
},
|
|
60
|
-
xAxisLabels: {
|
|
61
|
-
type: Array,
|
|
62
|
-
required: false,
|
|
63
|
-
default: () => []
|
|
64
|
-
},
|
|
65
|
-
yAxisLabels: {
|
|
66
|
-
type: Array,
|
|
67
|
-
required: false,
|
|
68
|
-
default: () => []
|
|
69
|
-
},
|
|
70
|
-
xAxisName: {
|
|
71
|
-
type: String,
|
|
72
|
-
required: false,
|
|
73
|
-
default: ''
|
|
74
|
-
},
|
|
75
|
-
yAxisName: {
|
|
76
|
-
type: String,
|
|
77
|
-
required: false,
|
|
78
|
-
default: ''
|
|
79
|
-
},
|
|
80
|
-
formatTooltipText: {
|
|
81
|
-
type: Function,
|
|
82
|
-
required: false,
|
|
83
|
-
default: null
|
|
84
|
-
},
|
|
85
|
-
legendAverageText: {
|
|
86
|
-
type: String,
|
|
87
|
-
required: false,
|
|
88
|
-
default: 'Avg'
|
|
89
|
-
},
|
|
90
|
-
legendMaxText: {
|
|
91
|
-
type: String,
|
|
92
|
-
required: false,
|
|
93
|
-
default: 'Max'
|
|
94
|
-
},
|
|
95
|
-
responsive: {
|
|
96
|
-
type: Boolean,
|
|
97
|
-
required: false,
|
|
98
|
-
default: true
|
|
99
|
-
},
|
|
100
|
-
/**
|
|
101
|
-
* Sets the chart's height in pixels. Set to `"auto"` to use the height of the container.
|
|
102
|
-
*/
|
|
103
|
-
height: {
|
|
104
|
-
type: [Number, String],
|
|
105
|
-
required: false,
|
|
106
|
-
default: null
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
data() {
|
|
110
|
-
return {
|
|
111
|
-
chart: null,
|
|
112
|
-
tooltip: {
|
|
113
|
-
title: '',
|
|
114
|
-
content: {},
|
|
115
|
-
left: '0',
|
|
116
|
-
top: '0'
|
|
117
|
-
},
|
|
118
|
-
selectedFormatTooltipText: this.formatTooltipText || this.defaultFormatTooltipText
|
|
119
|
-
};
|
|
120
|
-
},
|
|
121
|
-
computed: {
|
|
122
|
-
computedOptions() {
|
|
123
|
-
const {
|
|
124
|
-
min,
|
|
125
|
-
max
|
|
126
|
-
} = getRange(this.dataSeries);
|
|
127
|
-
return merge({}, defaultOptions, {
|
|
128
|
-
series: {
|
|
129
|
-
data: this.dataSeries,
|
|
130
|
-
z: 2
|
|
131
|
-
},
|
|
132
|
-
grid: {
|
|
133
|
-
left: '64px',
|
|
134
|
-
right: '32px',
|
|
135
|
-
show: true,
|
|
136
|
-
borderWidth: 0,
|
|
137
|
-
backgroundColor: GRAY_100
|
|
138
|
-
},
|
|
139
|
-
visualMap: {
|
|
140
|
-
min,
|
|
141
|
-
max
|
|
142
|
-
},
|
|
143
|
-
xAxis: {
|
|
144
|
-
data: this.xAxisLabels,
|
|
145
|
-
z: 3,
|
|
146
|
-
axisTick: false,
|
|
147
|
-
axisLabel: {
|
|
148
|
-
margin: 2
|
|
149
|
-
},
|
|
150
|
-
name: this.xAxisName,
|
|
151
|
-
nameGap: 16,
|
|
152
|
-
nameLocation: 'middle',
|
|
153
|
-
nameTextStyle: {
|
|
154
|
-
verticalAlign: 'middle'
|
|
155
|
-
},
|
|
156
|
-
offset: 0,
|
|
157
|
-
splitLine: {
|
|
158
|
-
show: true,
|
|
159
|
-
interval: 0,
|
|
160
|
-
lineStyle: {
|
|
161
|
-
color: WHITE,
|
|
162
|
-
width: 2
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
axisPointer: {
|
|
166
|
-
show: true,
|
|
167
|
-
label: {
|
|
168
|
-
formatter: this.onLabelChange
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
yAxis: {
|
|
173
|
-
data: this.yAxisLabels,
|
|
174
|
-
z: 3,
|
|
175
|
-
type: 'category',
|
|
176
|
-
axisTick: false,
|
|
177
|
-
axisLabel: {
|
|
178
|
-
margin: 8
|
|
179
|
-
},
|
|
180
|
-
name: this.yAxisName,
|
|
181
|
-
nameLocation: 'center',
|
|
182
|
-
nameGap: 50,
|
|
183
|
-
nameRotate: 90,
|
|
184
|
-
splitLine: {
|
|
185
|
-
show: true,
|
|
186
|
-
interval: 0,
|
|
187
|
-
lineStyle: {
|
|
188
|
-
color: WHITE,
|
|
189
|
-
width: 2
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}, this.options);
|
|
194
|
-
},
|
|
195
|
-
legendStyle() {
|
|
196
|
-
return {
|
|
197
|
-
paddingLeft: this.computedOptions.grid.left,
|
|
198
|
-
marginTop: '-32px'
|
|
199
|
-
};
|
|
200
|
-
},
|
|
201
|
-
compiledOptions() {
|
|
202
|
-
return this.chart ? this.chart.getOption() : null;
|
|
203
|
-
},
|
|
204
|
-
seriesInfo() {
|
|
205
|
-
const {
|
|
206
|
-
min,
|
|
207
|
-
max
|
|
208
|
-
} = getRange(this.dataSeries);
|
|
209
|
-
const step = (max - min) / heatmapHues.length;
|
|
210
|
-
return heatmapHues.map((color, index) => {
|
|
211
|
-
const lowerBound = engineeringNotation(min + step * index);
|
|
212
|
-
const upperBound = engineeringNotation(min + step * (index + 1));
|
|
213
|
-
return {
|
|
214
|
-
name: `${lowerBound} - ${upperBound}`,
|
|
215
|
-
color,
|
|
216
|
-
type: 'solid'
|
|
217
|
-
};
|
|
218
|
-
});
|
|
219
|
-
},
|
|
220
|
-
autoHeight() {
|
|
221
|
-
return this.height === 'auto';
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
methods: {
|
|
225
|
-
defaultFormatTooltipText(params) {
|
|
226
|
-
this.tooltip.title = getTooltipTitle(params, this.computedOptions.xAxis.name);
|
|
227
|
-
this.tooltip.content = getTooltipContent(params, this.computedOptions.yAxis.name);
|
|
228
|
-
},
|
|
229
|
-
onCreated(chart) {
|
|
230
|
-
this.chart = chart;
|
|
231
|
-
this.$emit('created', chart);
|
|
232
|
-
},
|
|
233
|
-
onLabelChange(params) {
|
|
234
|
-
this.selectedFormatTooltipText(params);
|
|
235
|
-
const {
|
|
236
|
-
seriesData = []
|
|
237
|
-
} = params;
|
|
238
|
-
if (seriesData.length && seriesData[0].value) {
|
|
239
|
-
const {
|
|
240
|
-
seriesId,
|
|
241
|
-
value
|
|
242
|
-
} = seriesData[0];
|
|
243
|
-
const [left, top] = this.chart.convertToPixel({
|
|
244
|
-
seriesId
|
|
245
|
-
}, value);
|
|
246
|
-
this.tooltip = {
|
|
247
|
-
...this.tooltip,
|
|
248
|
-
left: `${left}px`,
|
|
249
|
-
top: `${top}px`
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
HEIGHT_AUTO_CLASSES
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
/* script */
|
|
258
|
-
const __vue_script__ = script;
|
|
259
|
-
|
|
260
|
-
/* template */
|
|
261
|
-
var __vue_render__ = function () {
|
|
262
|
-
var _obj;
|
|
263
|
-
var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-heatmap",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.computedOptions},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"chart":_vm.chart,"top":_vm.tooltip.top,"left":_vm.tooltip.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [(_vm.formatTooltipText)?_vm._t("tooltip-title"):_c('div',[_vm._v(_vm._s(_vm.tooltip.title))])]},proxy:true}],null,true)},[_vm._v(" "),(_vm.formatTooltipText)?_vm._t("tooltip-content"):_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltip.content}})],2):_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,"max-text":_vm.legendMaxText,"average-text":_vm.legendAverageText}}):_vm._e()],1)};
|
|
264
|
-
var __vue_staticRenderFns__ = [];
|
|
265
|
-
|
|
266
|
-
/* style */
|
|
267
|
-
const __vue_inject_styles__ = undefined;
|
|
268
|
-
/* scoped */
|
|
269
|
-
const __vue_scope_id__ = undefined;
|
|
270
|
-
/* module identifier */
|
|
271
|
-
const __vue_module_identifier__ = undefined;
|
|
272
|
-
/* functional template */
|
|
273
|
-
const __vue_is_functional_template__ = false;
|
|
274
|
-
/* style inject */
|
|
275
|
-
|
|
276
|
-
/* style inject SSR */
|
|
277
|
-
|
|
278
|
-
/* style inject shadow dom */
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
const __vue_component__ = __vue_normalize__(
|
|
283
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
284
|
-
__vue_inject_styles__,
|
|
285
|
-
__vue_script__,
|
|
286
|
-
__vue_scope_id__,
|
|
287
|
-
__vue_is_functional_template__,
|
|
288
|
-
__vue_module_identifier__,
|
|
289
|
-
false,
|
|
290
|
-
undefined,
|
|
291
|
-
undefined,
|
|
292
|
-
undefined
|
|
293
|
-
);
|
|
294
|
-
|
|
295
|
-
export default __vue_component__;
|