@gitlab/ui 72.12.0 → 72.12.1
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/charts.js +14 -0
- package/dist/components/base/accordion/accordion.js +73 -0
- package/dist/components/base/accordion/accordion_item.js +133 -0
- package/dist/components/base/alert/alert.js +222 -0
- package/dist/components/base/avatar/avatar.js +160 -0
- package/dist/components/base/avatar_labeled/avatar_labeled.js +107 -0
- package/dist/components/base/avatar_link/avatar_link.js +47 -0
- package/dist/components/base/avatars_inline/avatars_inline.js +119 -0
- package/dist/components/base/badge/badge.js +105 -0
- package/dist/components/base/banner/banner.js +139 -0
- package/dist/components/base/breadcrumb/breadcrumb.js +122 -0
- package/dist/components/base/breadcrumb/breadcrumb_item.js +73 -0
- package/dist/components/base/broadcast_message/broadcast_message.js +112 -0
- package/dist/components/base/broadcast_message/constants.js +5 -0
- package/dist/components/base/button/button.js +151 -0
- package/dist/components/base/button_group/button_group.js +47 -0
- package/dist/components/base/card/card.js +71 -0
- package/dist/components/base/carousel/carousel.js +48 -0
- package/dist/components/base/carousel/carousel_slide.js +47 -0
- package/dist/components/base/collapse/collapse.js +59 -0
- package/dist/components/base/datepicker/datepicker.js +386 -0
- package/dist/components/base/daterange_picker/daterange_picker.js +288 -0
- package/dist/components/base/drawer/drawer.js +127 -0
- package/dist/components/base/dropdown/dropdown.js +261 -0
- package/dist/components/base/dropdown/dropdown_divider.js +48 -0
- package/dist/components/base/dropdown/dropdown_form.js +48 -0
- package/dist/components/base/dropdown/dropdown_item.js +131 -0
- package/dist/components/base/dropdown/dropdown_section_header.js +48 -0
- package/dist/components/base/dropdown/dropdown_text.js +48 -0
- package/dist/components/base/filtered_search/common_story_options.js +14 -0
- package/dist/components/base/filtered_search/filtered_search.js +388 -0
- package/dist/components/base/filtered_search/filtered_search_suggestion.js +89 -0
- package/dist/components/base/filtered_search/filtered_search_suggestion_list.js +138 -0
- package/dist/components/base/filtered_search/filtered_search_term.js +203 -0
- package/dist/components/base/filtered_search/filtered_search_token.js +384 -0
- package/dist/components/base/filtered_search/filtered_search_token_segment.js +420 -0
- package/dist/components/base/filtered_search/filtered_search_utils.js +242 -0
- package/dist/components/base/form/form.js +49 -0
- package/dist/components/base/form/form_checkbox/form_checkbox.js +78 -0
- package/dist/components/base/form/form_checkbox/form_checkbox_group.js +60 -0
- package/dist/components/base/form/form_checkbox_tree/checkbox_tree_node.js +79 -0
- package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.js +138 -0
- package/dist/components/base/form/form_checkbox_tree/models/constants.js +12 -0
- package/dist/components/base/form/form_checkbox_tree/models/node.js +51 -0
- package/dist/components/base/form/form_checkbox_tree/models/tree.js +199 -0
- package/dist/components/base/form/form_combobox/constants.js +55 -0
- package/dist/components/base/form/form_combobox/form_combobox.js +230 -0
- package/dist/components/base/form/form_date/form_date.js +143 -0
- package/dist/components/base/form/form_fields/form_field_validator.js +93 -0
- package/dist/components/base/form/form_fields/form_fields.js +214 -0
- package/dist/components/base/form/form_fields/mappers.js +13 -0
- package/dist/components/base/form/form_fields/validators.js +48 -0
- package/dist/components/base/form/form_group/form_group.js +97 -0
- package/dist/components/base/form/form_input/form_input.js +121 -0
- package/dist/components/base/form/form_input_group/form_input_group.js +108 -0
- package/dist/components/base/form/form_input_group/form_input_group_mixin.js +41 -0
- package/dist/components/base/form/form_radio/form_radio.js +65 -0
- package/dist/components/base/form/form_radio_group/form_radio_group.js +78 -0
- package/dist/components/base/form/form_select/constants.js +12 -0
- package/dist/components/base/form/form_select/form_select.js +82 -0
- package/dist/components/base/form/form_text/form_text.js +38 -0
- package/dist/components/base/form/form_textarea/form_textarea.js +112 -0
- package/dist/components/base/form/input_group_text/input_group_text.js +48 -0
- package/dist/components/base/icon/icon.js +111 -0
- package/dist/components/base/infinite_scroll/infinite_scroll.js +197 -0
- package/dist/components/base/keyset_pagination/keyset_pagination.js +151 -0
- package/dist/components/base/label/label.js +163 -0
- package/dist/components/base/link/link.js +50 -0
- package/dist/components/base/loading_icon/loading_icon.js +111 -0
- package/dist/components/base/markdown/markdown.js +52 -0
- package/dist/components/base/modal/modal.js +204 -0
- package/dist/components/base/nav/nav.js +48 -0
- package/dist/components/base/nav/nav_item.js +48 -0
- package/dist/components/base/nav/nav_item_dropdown.js +62 -0
- package/dist/components/base/navbar/navbar.js +48 -0
- package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +453 -0
- package/dist/components/base/new_dropdowns/base_dropdown/constants.js +4 -0
- package/dist/components/base/new_dropdowns/constants.js +21 -0
- package/dist/components/base/new_dropdowns/disclosure/constants.js +8 -0
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown.js +370 -0
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_group.js +110 -0
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_item.js +143 -0
- package/dist/components/base/new_dropdowns/disclosure/mock_data.js +147 -0
- package/dist/components/base/new_dropdowns/disclosure/utils.js +39 -0
- package/dist/components/base/new_dropdowns/listbox/listbox.js +767 -0
- package/dist/components/base/new_dropdowns/listbox/listbox_group.js +58 -0
- package/dist/components/base/new_dropdowns/listbox/listbox_item.js +91 -0
- package/dist/components/base/new_dropdowns/listbox/listbox_search_input.js +93 -0
- package/dist/components/base/new_dropdowns/listbox/mock_data.js +118 -0
- package/dist/components/base/new_dropdowns/listbox/utils.js +34 -0
- package/dist/components/base/paginated_list/paginated_list.js +180 -0
- package/dist/components/base/pagination/pagination.js +399 -0
- package/dist/components/base/path/data.js +34 -0
- package/dist/components/base/path/path.js +189 -0
- package/dist/components/base/popover/popover.js +110 -0
- package/dist/components/base/progress_bar/progress_bar.js +48 -0
- package/dist/components/base/search_box_by_click/search_box_by_click.js +235 -0
- package/dist/components/base/search_box_by_type/search_box_by_type.js +167 -0
- package/dist/components/base/segmented_control/segmented_control.js +109 -0
- package/dist/components/base/skeleton_loader/skeleton_loader.js +224 -0
- package/dist/components/base/sorting/sorting.js +171 -0
- package/dist/components/base/sorting/sorting_item.js +109 -0
- package/dist/components/base/table/constants.js +5 -0
- package/dist/components/base/table/table.js +89 -0
- package/dist/components/base/table_lite/table_lite.js +72 -0
- package/dist/components/base/tabs/constants.js +3 -0
- package/dist/components/base/tabs/tab/tab.js +83 -0
- package/dist/components/base/tabs/tabs/scrollable_tabs.js +143 -0
- package/dist/components/base/tabs/tabs/tabs.js +224 -0
- package/dist/components/base/toast/toast.js +82 -0
- package/dist/components/base/toggle/toggle.js +180 -0
- package/dist/components/base/token/token.js +85 -0
- package/dist/components/base/token_selector/helpers.js +5 -0
- package/dist/components/base/token_selector/token_container.js +165 -0
- package/dist/components/base/token_selector/token_selector.js +403 -0
- package/dist/components/base/token_selector/token_selector_dropdown.js +199 -0
- package/dist/components/base/tooltip/tooltip.js +55 -0
- package/dist/components/charts/area/area.js +311 -0
- package/dist/components/charts/bar/bar.js +253 -0
- package/dist/components/charts/chart/chart.js +215 -0
- package/dist/components/charts/column/column.js +226 -0
- package/dist/components/charts/discrete_scatter/discrete_scatter.js +203 -0
- package/dist/components/charts/gauge/gauge.js +208 -0
- package/dist/components/charts/heatmap/heatmap.js +295 -0
- package/dist/components/charts/heatmap/index.js +2 -0
- package/dist/components/charts/legend/legend.js +228 -0
- package/dist/components/charts/line/line.js +308 -0
- package/dist/components/charts/series_label/series_label.js +100 -0
- package/dist/components/charts/single_stat/single_stat.js +152 -0
- package/dist/components/charts/sparkline/sparkline.js +261 -0
- package/dist/components/charts/stacked_column/stacked_column.js +335 -0
- package/dist/components/charts/tooltip/tooltip.js +251 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.js +83 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.js +100 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +35 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +115 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.js +104 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.js +64 -0
- package/dist/components/experimental/duo/chat/constants.js +23 -0
- package/dist/components/experimental/duo/chat/duo_chat.js +359 -0
- package/dist/components/experimental/duo/chat/mock_data.js +83 -0
- package/dist/components/experimental/duo/user_feedback/user_feedback.js +94 -0
- package/dist/components/experimental/duo/user_feedback/user_feedback_modal.js +124 -0
- package/dist/components/experimental/experiment_badge/constants.js +4 -0
- package/dist/components/experimental/experiment_badge/experiment_badge.js +107 -0
- package/dist/components/mixins/button_mixin.js +11 -0
- package/dist/components/mixins/safe_link_mixin.js +30 -0
- package/dist/components/mixins/tooltip_mixin.js +21 -0
- package/dist/components/regions/dashboard_skeleton/dashboard_skeleton.js +53 -0
- package/dist/components/regions/empty_state/empty_state.js +154 -0
- package/dist/components/shared_components/charts/tooltip_default_format.js +53 -0
- package/dist/components/shared_components/clear_icon_button/clear_icon_button.js +64 -0
- package/dist/components/shared_components/close_button/close_button.js +54 -0
- package/dist/components/utilities/animated_number/animated_number.js +131 -0
- package/dist/components/utilities/friendly_wrap/friendly_wrap.js +75 -0
- package/dist/components/utilities/intersection_observer/intersection_observer.js +88 -0
- package/dist/components/utilities/intersperse/intersperse.js +86 -0
- package/dist/components/utilities/sprintf/sprintf.js +172 -0
- package/dist/components/utilities/truncate/constants.js +7 -0
- package/dist/components/utilities/truncate/truncate.js +111 -0
- package/dist/components/utilities/truncate_text/constants.js +7 -0
- package/dist/components/utilities/truncate_text/truncate_text.js +146 -0
- package/dist/config.js +86 -0
- package/dist/directives/collapse_toggle.js +1 -0
- package/dist/directives/hover_load/hover_load.js +45 -0
- package/dist/directives/modal.js +1 -0
- package/dist/directives/outside/get_event_like_time_stamp.js +33 -0
- package/dist/directives/outside/outside.js +106 -0
- package/dist/directives/resize_observer/resize_observer.js +51 -0
- package/dist/directives/safe_html/constants.js +6 -0
- package/dist/directives/safe_html/safe_html.js +39 -0
- package/dist/directives/safe_link/mock_data.js +10 -0
- package/dist/directives/safe_link/safe_link.js +65 -0
- package/dist/directives/tooltip.js +1 -0
- package/dist/index.css +7 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +105 -0
- package/dist/tokens/common_story_options.js +54 -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/dist/utils/breakpoints.js +20 -0
- package/dist/utils/charts/config.js +556 -0
- package/dist/utils/charts/constants.js +63 -0
- package/dist/utils/charts/mock_data.js +211 -0
- package/dist/utils/charts/story_config.js +42 -0
- package/dist/utils/charts/theme.js +192 -0
- package/dist/utils/charts/utils.js +54 -0
- package/dist/utils/constants.js +288 -0
- package/dist/utils/data_utils.js +21 -0
- package/dist/utils/datetime_utility.js +61 -0
- package/dist/utils/i18n.js +15 -0
- package/dist/utils/is_slot_empty.js +38 -0
- package/dist/utils/number_utils.js +124 -0
- package/dist/utils/stories_constants.js +29 -0
- package/dist/utils/stories_utils.js +13 -0
- package/dist/utils/story_decorators/container.js +16 -0
- package/dist/utils/string_utils.js +69 -0
- package/dist/utils/svgs/svg_paths.js +7 -0
- package/dist/utils/test_utils.js +33 -0
- package/dist/utils/use_fake_date.js +29 -0
- package/dist/utils/use_mock_intersection_observer.js +108 -0
- package/dist/utils/utils.js +197 -0
- package/dist/utils.js +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import merge from 'lodash/merge';
|
|
2
|
+
import { yAxis, generateBarSeries, generateLineSeries, defaultChartOptions, gridWithSecondaryYAxis, grid, dataZoomAdjustments, mergeSeriesToOptions } from '../../../utils/charts/config';
|
|
3
|
+
import { LEGEND_AVERAGE_TEXT, LEGEND_MAX_TEXT, LEGEND_MIN_TEXT, LEGEND_CURRENT_TEXT, LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE, CHART_TYPE_LINE, HEIGHT_AUTO_CLASSES } from '../../../utils/charts/constants';
|
|
4
|
+
import { colorFromDefaultPalette } from '../../../utils/charts/theme';
|
|
5
|
+
import { columnOptions } from '../../../utils/constants';
|
|
6
|
+
import TooltipDefaultFormat from '../../shared_components/charts/tooltip_default_format';
|
|
7
|
+
import Chart from '../chart/chart';
|
|
8
|
+
import ChartLegend from '../legend/legend';
|
|
9
|
+
import ChartTooltip from '../tooltip/tooltip';
|
|
10
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
11
|
+
|
|
12
|
+
const yAxisDefaults = {
|
|
13
|
+
...yAxis,
|
|
14
|
+
nameLocation: 'center',
|
|
15
|
+
axisTick: {
|
|
16
|
+
show: false
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var script = {
|
|
20
|
+
name: 'GlStackedColumnChart',
|
|
21
|
+
components: {
|
|
22
|
+
Chart,
|
|
23
|
+
ChartTooltip,
|
|
24
|
+
ChartLegend,
|
|
25
|
+
TooltipDefaultFormat
|
|
26
|
+
},
|
|
27
|
+
inheritAttrs: false,
|
|
28
|
+
props: {
|
|
29
|
+
bars: {
|
|
30
|
+
type: Array,
|
|
31
|
+
required: false,
|
|
32
|
+
default: () => []
|
|
33
|
+
},
|
|
34
|
+
lines: {
|
|
35
|
+
type: Array,
|
|
36
|
+
required: false,
|
|
37
|
+
default: () => []
|
|
38
|
+
},
|
|
39
|
+
secondaryData: {
|
|
40
|
+
type: Array,
|
|
41
|
+
required: false,
|
|
42
|
+
default: () => []
|
|
43
|
+
},
|
|
44
|
+
option: {
|
|
45
|
+
type: Object,
|
|
46
|
+
required: false,
|
|
47
|
+
default: () => ({})
|
|
48
|
+
},
|
|
49
|
+
presentation: {
|
|
50
|
+
type: String,
|
|
51
|
+
required: false,
|
|
52
|
+
default: 'stacked',
|
|
53
|
+
validator: value => ['stacked', 'tiled'].indexOf(value) !== -1
|
|
54
|
+
},
|
|
55
|
+
groupBy: {
|
|
56
|
+
type: Array,
|
|
57
|
+
required: true
|
|
58
|
+
},
|
|
59
|
+
xAxisType: {
|
|
60
|
+
type: String,
|
|
61
|
+
required: true,
|
|
62
|
+
validator: value => ['value', 'category', 'time', 'log'].indexOf(value) !== -1
|
|
63
|
+
},
|
|
64
|
+
xAxisTitle: {
|
|
65
|
+
type: String,
|
|
66
|
+
required: true
|
|
67
|
+
},
|
|
68
|
+
yAxisTitle: {
|
|
69
|
+
type: String,
|
|
70
|
+
required: true
|
|
71
|
+
},
|
|
72
|
+
secondaryDataTitle: {
|
|
73
|
+
type: String,
|
|
74
|
+
required: false,
|
|
75
|
+
default: ''
|
|
76
|
+
},
|
|
77
|
+
seriesNames: {
|
|
78
|
+
type: Array,
|
|
79
|
+
required: false,
|
|
80
|
+
default: () => []
|
|
81
|
+
},
|
|
82
|
+
legendAverageText: {
|
|
83
|
+
type: String,
|
|
84
|
+
required: false,
|
|
85
|
+
default: LEGEND_AVERAGE_TEXT
|
|
86
|
+
},
|
|
87
|
+
legendMaxText: {
|
|
88
|
+
type: String,
|
|
89
|
+
required: false,
|
|
90
|
+
default: LEGEND_MAX_TEXT
|
|
91
|
+
},
|
|
92
|
+
legendMinText: {
|
|
93
|
+
type: String,
|
|
94
|
+
required: false,
|
|
95
|
+
default: LEGEND_MIN_TEXT
|
|
96
|
+
},
|
|
97
|
+
legendCurrentText: {
|
|
98
|
+
type: String,
|
|
99
|
+
required: false,
|
|
100
|
+
default: LEGEND_CURRENT_TEXT
|
|
101
|
+
},
|
|
102
|
+
legendLayout: {
|
|
103
|
+
type: String,
|
|
104
|
+
required: false,
|
|
105
|
+
default: LEGEND_LAYOUT_INLINE,
|
|
106
|
+
validator(layout) {
|
|
107
|
+
return [LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE].indexOf(layout) !== -1;
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
formatTooltipText: {
|
|
111
|
+
type: Function,
|
|
112
|
+
required: false,
|
|
113
|
+
default: null
|
|
114
|
+
},
|
|
115
|
+
customPalette: {
|
|
116
|
+
type: Array,
|
|
117
|
+
required: false,
|
|
118
|
+
default: null
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* Sets the chart's height in pixels. Set to `"auto"` to use the height of the container.
|
|
122
|
+
*/
|
|
123
|
+
height: {
|
|
124
|
+
type: [Number, String],
|
|
125
|
+
required: false,
|
|
126
|
+
default: null
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
data() {
|
|
130
|
+
return {
|
|
131
|
+
chart: null,
|
|
132
|
+
tooltipTitle: '',
|
|
133
|
+
tooltipContent: {}
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
computed: {
|
|
137
|
+
hasSecondaryAxis() {
|
|
138
|
+
return Boolean(this.secondaryData.length);
|
|
139
|
+
},
|
|
140
|
+
barSeries() {
|
|
141
|
+
return this.bars.map((_ref, index) => {
|
|
142
|
+
let {
|
|
143
|
+
name,
|
|
144
|
+
data
|
|
145
|
+
} = _ref;
|
|
146
|
+
const stack = this.presentation === 'stacked' ? this.groupBy : null;
|
|
147
|
+
const color = this.getColor(index);
|
|
148
|
+
return generateBarSeries({
|
|
149
|
+
stack,
|
|
150
|
+
name,
|
|
151
|
+
data,
|
|
152
|
+
color
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
lineSeries() {
|
|
157
|
+
const offset = this.bars.length;
|
|
158
|
+
return this.lines.map((_ref2, index) => {
|
|
159
|
+
let {
|
|
160
|
+
name,
|
|
161
|
+
data
|
|
162
|
+
} = _ref2;
|
|
163
|
+
const color = this.getColor(offset + index);
|
|
164
|
+
return generateLineSeries({
|
|
165
|
+
name,
|
|
166
|
+
data,
|
|
167
|
+
color
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
},
|
|
171
|
+
secondarySeries() {
|
|
172
|
+
const offset = this.bars.length + this.lines.length;
|
|
173
|
+
return this.secondaryData.map((_ref3, index) => {
|
|
174
|
+
let {
|
|
175
|
+
name,
|
|
176
|
+
data,
|
|
177
|
+
type,
|
|
178
|
+
stack = columnOptions.tiled
|
|
179
|
+
} = _ref3;
|
|
180
|
+
const color = this.getColor(offset + index);
|
|
181
|
+
return type === CHART_TYPE_LINE ? generateLineSeries({
|
|
182
|
+
color,
|
|
183
|
+
name,
|
|
184
|
+
data,
|
|
185
|
+
yAxisIndex: 1
|
|
186
|
+
}) : generateBarSeries({
|
|
187
|
+
color,
|
|
188
|
+
name,
|
|
189
|
+
data,
|
|
190
|
+
yAxisIndex: 1,
|
|
191
|
+
stack
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
series() {
|
|
196
|
+
return [...this.barSeries, ...this.lineSeries, ...this.secondarySeries];
|
|
197
|
+
},
|
|
198
|
+
options() {
|
|
199
|
+
const mergedOptions = merge({}, defaultChartOptions, {
|
|
200
|
+
grid: this.hasSecondaryAxis ? gridWithSecondaryYAxis : grid,
|
|
201
|
+
xAxis: {
|
|
202
|
+
boundaryGap: true,
|
|
203
|
+
axisLabel: {
|
|
204
|
+
margin: 20,
|
|
205
|
+
verticalAlign: 'bottom'
|
|
206
|
+
},
|
|
207
|
+
axisLine: {
|
|
208
|
+
show: false
|
|
209
|
+
},
|
|
210
|
+
axisPointer: {
|
|
211
|
+
show: true,
|
|
212
|
+
type: 'none',
|
|
213
|
+
label: {
|
|
214
|
+
formatter: this.onLabelChange
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
data: this.groupBy,
|
|
218
|
+
name: this.xAxisTitle,
|
|
219
|
+
type: this.xAxisType
|
|
220
|
+
},
|
|
221
|
+
yAxis: [{
|
|
222
|
+
...yAxisDefaults,
|
|
223
|
+
name: this.yAxisTitle
|
|
224
|
+
}, {
|
|
225
|
+
...yAxisDefaults,
|
|
226
|
+
name: this.secondaryDataTitle,
|
|
227
|
+
show: this.hasSecondaryAxis
|
|
228
|
+
}],
|
|
229
|
+
legend: {
|
|
230
|
+
show: false
|
|
231
|
+
}
|
|
232
|
+
}, this.option, dataZoomAdjustments(this.option.dataZoom));
|
|
233
|
+
// All chart options can be merged but series
|
|
234
|
+
// needs to be handled specially
|
|
235
|
+
return mergeSeriesToOptions(mergedOptions, this.series);
|
|
236
|
+
},
|
|
237
|
+
legendStyle() {
|
|
238
|
+
return {
|
|
239
|
+
paddingLeft: `${grid.left}px`
|
|
240
|
+
};
|
|
241
|
+
},
|
|
242
|
+
compiledOptions() {
|
|
243
|
+
return this.chart ? this.chart.getOption() : null;
|
|
244
|
+
},
|
|
245
|
+
seriesInfo() {
|
|
246
|
+
return this.compiledOptions.series.reduce((acc, series, index) => {
|
|
247
|
+
acc.push({
|
|
248
|
+
name: series.name,
|
|
249
|
+
type: series.type,
|
|
250
|
+
color: this.getColor(index),
|
|
251
|
+
data: series.data.map(data => data),
|
|
252
|
+
yAxisIndex: series.yAxisIndex
|
|
253
|
+
});
|
|
254
|
+
return acc;
|
|
255
|
+
}, []);
|
|
256
|
+
},
|
|
257
|
+
autoHeight() {
|
|
258
|
+
return this.height === 'auto';
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
methods: {
|
|
262
|
+
getColor(index) {
|
|
263
|
+
var _this$customPalette;
|
|
264
|
+
return this.customPalette ? (_this$customPalette = this.customPalette) === null || _this$customPalette === void 0 ? void 0 : _this$customPalette[index] : colorFromDefaultPalette(index);
|
|
265
|
+
},
|
|
266
|
+
onCreated(chart) {
|
|
267
|
+
this.chart = chart;
|
|
268
|
+
this.$emit('created', chart);
|
|
269
|
+
},
|
|
270
|
+
defaultFormatTooltipText(params) {
|
|
271
|
+
const {
|
|
272
|
+
tooltipContent
|
|
273
|
+
} = params.seriesData.reverse().reduce((acc, bar) => {
|
|
274
|
+
acc.tooltipContent[bar.seriesName] = {
|
|
275
|
+
value: bar.value,
|
|
276
|
+
index: bar.seriesIndex,
|
|
277
|
+
color: this.getColor(bar.seriesIndex)
|
|
278
|
+
};
|
|
279
|
+
return acc;
|
|
280
|
+
}, {
|
|
281
|
+
tooltipContent: {}
|
|
282
|
+
});
|
|
283
|
+
this.tooltipTitle = params.value;
|
|
284
|
+
this.$set(this, 'tooltipContent', tooltipContent);
|
|
285
|
+
},
|
|
286
|
+
onLabelChange(params) {
|
|
287
|
+
if (this.formatTooltipText) {
|
|
288
|
+
this.formatTooltipText(params);
|
|
289
|
+
} else {
|
|
290
|
+
this.defaultFormatTooltipText(params);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
HEIGHT_AUTO_CLASSES
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
/* script */
|
|
298
|
+
const __vue_script__ = script;
|
|
299
|
+
|
|
300
|
+
/* template */
|
|
301
|
+
var __vue_render__ = function () {
|
|
302
|
+
var _obj;
|
|
303
|
+
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 [_vm._t("tooltip-title",function(){return [_vm._v(_vm._s(_vm.tooltipTitle)+" ("+_vm._s(_vm.xAxisTitle)+")")]})]},proxy:true}],null,true)},[_vm._v(" "),_vm._t("tooltip-content",function(){return [_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltipContent}})]})],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,"min-text":_vm.legendMinText,"max-text":_vm.legendMaxText,"average-text":_vm.legendAverageText,"current-text":_vm.legendCurrentText,"layout":_vm.legendLayout}}):_vm._e()],1)};
|
|
304
|
+
var __vue_staticRenderFns__ = [];
|
|
305
|
+
|
|
306
|
+
/* style */
|
|
307
|
+
const __vue_inject_styles__ = undefined;
|
|
308
|
+
/* scoped */
|
|
309
|
+
const __vue_scope_id__ = undefined;
|
|
310
|
+
/* module identifier */
|
|
311
|
+
const __vue_module_identifier__ = undefined;
|
|
312
|
+
/* functional template */
|
|
313
|
+
const __vue_is_functional_template__ = false;
|
|
314
|
+
/* style inject */
|
|
315
|
+
|
|
316
|
+
/* style inject SSR */
|
|
317
|
+
|
|
318
|
+
/* style inject shadow dom */
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
const __vue_component__ = __vue_normalize__(
|
|
323
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
324
|
+
__vue_inject_styles__,
|
|
325
|
+
__vue_script__,
|
|
326
|
+
__vue_scope_id__,
|
|
327
|
+
__vue_is_functional_template__,
|
|
328
|
+
__vue_module_identifier__,
|
|
329
|
+
false,
|
|
330
|
+
undefined,
|
|
331
|
+
undefined,
|
|
332
|
+
undefined
|
|
333
|
+
);
|
|
334
|
+
|
|
335
|
+
export default __vue_component__;
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import * as echarts from 'echarts';
|
|
2
|
+
import { uid, debounceByAnimationFrame } from '../../../utils/utils';
|
|
3
|
+
import GlPopover from '../../base/popover/popover';
|
|
4
|
+
import { popoverPlacements } from '../../../utils/constants';
|
|
5
|
+
import { TOOLTIP_LEFT_OFFSET, TOOLTIP_TOP_OFFSET } from '../../../utils/charts/constants';
|
|
6
|
+
import { getTooltipTitle, getTooltipContent } from '../../../utils/charts/config';
|
|
7
|
+
import TooltipDefaultFormat from '../../shared_components/charts/tooltip_default_format';
|
|
8
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
9
|
+
|
|
10
|
+
//
|
|
11
|
+
var script = {
|
|
12
|
+
name: 'GlChartTooltip',
|
|
13
|
+
components: {
|
|
14
|
+
GlPopover,
|
|
15
|
+
TooltipDefaultFormat
|
|
16
|
+
},
|
|
17
|
+
inheritAttrs: false,
|
|
18
|
+
props: {
|
|
19
|
+
chart: {
|
|
20
|
+
type: Object,
|
|
21
|
+
required: true,
|
|
22
|
+
validator(chart) {
|
|
23
|
+
return Object.is(chart, echarts.getInstanceByDom(chart.getDom()));
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
id: {
|
|
27
|
+
type: String,
|
|
28
|
+
required: false,
|
|
29
|
+
default: () => uid()
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* Position of the popover respective to the chart.
|
|
33
|
+
* Sets the `top` style property.
|
|
34
|
+
*/
|
|
35
|
+
top: {
|
|
36
|
+
type: String,
|
|
37
|
+
required: false,
|
|
38
|
+
default: null
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Position of the popover respective to the chart.
|
|
42
|
+
* Sets the `bottom` style property.
|
|
43
|
+
*/
|
|
44
|
+
bottom: {
|
|
45
|
+
type: String,
|
|
46
|
+
required: false,
|
|
47
|
+
default: null
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Position of the popover respective to the chart.
|
|
51
|
+
* Sets the `left` style property.
|
|
52
|
+
*/
|
|
53
|
+
left: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: false,
|
|
56
|
+
default: null
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* Position of the popover respective to the chart.
|
|
60
|
+
* Sets the `right` style property.
|
|
61
|
+
*/
|
|
62
|
+
right: {
|
|
63
|
+
type: String,
|
|
64
|
+
required: false,
|
|
65
|
+
default: null
|
|
66
|
+
},
|
|
67
|
+
/**
|
|
68
|
+
* Set to `true` to show, set to `false` to not show.
|
|
69
|
+
* Set to `null` to show only when the mouse is in the chart.
|
|
70
|
+
*/
|
|
71
|
+
show: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
required: false,
|
|
74
|
+
default: null
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* Popover placement
|
|
78
|
+
*/
|
|
79
|
+
placement: {
|
|
80
|
+
type: String,
|
|
81
|
+
required: false,
|
|
82
|
+
default: popoverPlacements.right
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* Distance between the popover and the pointer when
|
|
86
|
+
* no position is defined
|
|
87
|
+
*/
|
|
88
|
+
xOffset: {
|
|
89
|
+
type: Number,
|
|
90
|
+
required: false,
|
|
91
|
+
default: TOOLTIP_LEFT_OFFSET,
|
|
92
|
+
validator(value) {
|
|
93
|
+
// popover target must have a size of at least 1
|
|
94
|
+
return value >= 1;
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
/**
|
|
98
|
+
* Distance between the popover and the pointer when
|
|
99
|
+
* no position is defined
|
|
100
|
+
*/
|
|
101
|
+
yOffset: {
|
|
102
|
+
type: Number,
|
|
103
|
+
required: false,
|
|
104
|
+
default: TOOLTIP_TOP_OFFSET,
|
|
105
|
+
validator(value) {
|
|
106
|
+
// popover target must have a size of at least 1
|
|
107
|
+
return value >= 1;
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
/**
|
|
111
|
+
* Set to true to use the default tooltip formatter.
|
|
112
|
+
*/
|
|
113
|
+
useDefaultTooltipFormatter: {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
required: false,
|
|
116
|
+
default: false
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
data() {
|
|
120
|
+
return {
|
|
121
|
+
pointerPosition: null,
|
|
122
|
+
isPointerInChart: false,
|
|
123
|
+
debouncedMouseHandler: debounceByAnimationFrame(this.mouseHandler),
|
|
124
|
+
title: null,
|
|
125
|
+
content: {},
|
|
126
|
+
params: null
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
computed: {
|
|
130
|
+
targetId() {
|
|
131
|
+
// if multiple tooltips are used in a chart component,
|
|
132
|
+
// `this.id` can be used to uniquely identify them
|
|
133
|
+
return `${this.chart.getDom().getAttribute('_echarts_instance_')}-tooltip-${this.id}`;
|
|
134
|
+
},
|
|
135
|
+
targetStyle() {
|
|
136
|
+
// the target is a rectangular space between cursor and popover
|
|
137
|
+
return {
|
|
138
|
+
marginTop: `${-this.yOffset}px`,
|
|
139
|
+
height: `${this.yOffset * 2}px`,
|
|
140
|
+
marginLeft: `${-this.xOffset}px`,
|
|
141
|
+
width: `${this.xOffset * 2}px`
|
|
142
|
+
};
|
|
143
|
+
},
|
|
144
|
+
fixedPosition() {
|
|
145
|
+
const {
|
|
146
|
+
top,
|
|
147
|
+
left,
|
|
148
|
+
bottom,
|
|
149
|
+
right
|
|
150
|
+
} = this;
|
|
151
|
+
if (top || left || bottom || right) {
|
|
152
|
+
return {
|
|
153
|
+
top,
|
|
154
|
+
left,
|
|
155
|
+
bottom,
|
|
156
|
+
right
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
160
|
+
},
|
|
161
|
+
shouldShowPopover() {
|
|
162
|
+
if (this.show !== null) {
|
|
163
|
+
return this.show;
|
|
164
|
+
}
|
|
165
|
+
return this.isPointerInChart;
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
created() {
|
|
169
|
+
this.chart.getZr().on('mousemove', this.debouncedMouseHandler);
|
|
170
|
+
this.chart.getZr().on('mouseout', this.debouncedMouseHandler);
|
|
171
|
+
if (this.useDefaultTooltipFormatter) {
|
|
172
|
+
this.chart.setOption({
|
|
173
|
+
xAxis: {
|
|
174
|
+
axisPointer: {
|
|
175
|
+
show: true,
|
|
176
|
+
label: {
|
|
177
|
+
formatter: params => {
|
|
178
|
+
var _options$xAxis, _options$xAxis$, _options$yAxis, _options$yAxis$;
|
|
179
|
+
const options = this.chart.getOption();
|
|
180
|
+
const titleAxisName = (_options$xAxis = options.xAxis) === null || _options$xAxis === void 0 ? void 0 : (_options$xAxis$ = _options$xAxis[0]) === null || _options$xAxis$ === void 0 ? void 0 : _options$xAxis$.name;
|
|
181
|
+
const valueAxisName = (_options$yAxis = options.yAxis) === null || _options$yAxis === void 0 ? void 0 : (_options$yAxis$ = _options$yAxis[0]) === null || _options$yAxis$ === void 0 ? void 0 : _options$yAxis$.name;
|
|
182
|
+
this.title = getTooltipTitle(params, titleAxisName);
|
|
183
|
+
this.content = getTooltipContent(params, valueAxisName);
|
|
184
|
+
this.params = params;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
beforeDestroy() {
|
|
193
|
+
this.chart.getZr().off('mousemove', this.debouncedMouseHandler);
|
|
194
|
+
this.chart.getZr().off('mouseout', this.debouncedMouseHandler);
|
|
195
|
+
},
|
|
196
|
+
methods: {
|
|
197
|
+
mouseHandler(event) {
|
|
198
|
+
let {
|
|
199
|
+
zrX: x,
|
|
200
|
+
zrY: y
|
|
201
|
+
} = event.event;
|
|
202
|
+
if (Number.isFinite(x) && Number.isFinite(y)) {
|
|
203
|
+
x = Math.round(x);
|
|
204
|
+
y = Math.round(y);
|
|
205
|
+
this.pointerPosition = {
|
|
206
|
+
left: `${x}px`,
|
|
207
|
+
top: `${y}px`
|
|
208
|
+
};
|
|
209
|
+
this.isPointerInChart = this.chart.containPixel('grid', [x, y]);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
/* script */
|
|
216
|
+
const __vue_script__ = script;
|
|
217
|
+
|
|
218
|
+
/* template */
|
|
219
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.chart)?_c('div',{staticClass:"gl-pointer-events-none"},[_c('div',{staticClass:"gl-chart-tooltip",style:(Object.assign({}, (_vm.fixedPosition || _vm.pointerPosition), _vm.targetStyle)),attrs:{"id":_vm.targetId}}),_vm._v(" "),_c('gl-popover',_vm._b({attrs:{"show":_vm.shouldShowPopover,"target":_vm.targetId,"container":_vm.targetId,"placement":_vm.placement,"triggers":""},scopedSlots:_vm._u([{key:"title",fn:function(){return [_vm._t("title",function(){return [_vm._v(_vm._s(_vm.title))]},null,{ title: _vm.title, params: _vm.params })]},proxy:true}],null,true)},'gl-popover',_vm.$attrs,false),[_vm._v(" "),_vm._t("default",function(){return [_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.content},scopedSlots:_vm._u([(_vm.$scopedSlots['tooltip-value'])?{key:"tooltip-value",fn:function(scope){return [_vm._t("tooltip-value",null,null,scope)]}}:null],null,true)})]},null,{ content: _vm.content, params: _vm.params })],2)],1):_vm._e()};
|
|
220
|
+
var __vue_staticRenderFns__ = [];
|
|
221
|
+
|
|
222
|
+
/* style */
|
|
223
|
+
const __vue_inject_styles__ = undefined;
|
|
224
|
+
/* scoped */
|
|
225
|
+
const __vue_scope_id__ = undefined;
|
|
226
|
+
/* module identifier */
|
|
227
|
+
const __vue_module_identifier__ = undefined;
|
|
228
|
+
/* functional template */
|
|
229
|
+
const __vue_is_functional_template__ = false;
|
|
230
|
+
/* style inject */
|
|
231
|
+
|
|
232
|
+
/* style inject SSR */
|
|
233
|
+
|
|
234
|
+
/* style inject shadow dom */
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
const __vue_component__ = __vue_normalize__(
|
|
239
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
240
|
+
__vue_inject_styles__,
|
|
241
|
+
__vue_script__,
|
|
242
|
+
__vue_scope_id__,
|
|
243
|
+
__vue_is_functional_template__,
|
|
244
|
+
__vue_module_identifier__,
|
|
245
|
+
false,
|
|
246
|
+
undefined,
|
|
247
|
+
undefined,
|
|
248
|
+
undefined
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
export default __vue_component__;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import GlDuoChatMessage from '../duo_chat_message/duo_chat_message';
|
|
2
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
3
|
+
|
|
4
|
+
const i18n = {
|
|
5
|
+
CONVERSATION_NEW_CHAT: 'New chat'
|
|
6
|
+
};
|
|
7
|
+
const isMessage = item => Boolean(item) && (item === null || item === void 0 ? void 0 : item.role);
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line unicorn/no-array-callback-reference
|
|
10
|
+
const itemsValidator = items => items.every(isMessage);
|
|
11
|
+
var script = {
|
|
12
|
+
name: 'GlDuoChatConversation',
|
|
13
|
+
components: {
|
|
14
|
+
GlDuoChatMessage
|
|
15
|
+
},
|
|
16
|
+
props: {
|
|
17
|
+
/**
|
|
18
|
+
* Messages to display
|
|
19
|
+
*/
|
|
20
|
+
messages: {
|
|
21
|
+
type: Array,
|
|
22
|
+
required: false,
|
|
23
|
+
default: () => [],
|
|
24
|
+
validator: itemsValidator
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* Whether to show the delimiter before this conversation
|
|
28
|
+
*/
|
|
29
|
+
showDelimiter: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
required: false,
|
|
32
|
+
default: true
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
methods: {
|
|
36
|
+
onTrackFeedback(event) {
|
|
37
|
+
/**
|
|
38
|
+
* Notify listeners about the feedback form submission on a response message.
|
|
39
|
+
* @param {*} event An event, containing the feedback choices and the extended feedback text.
|
|
40
|
+
*/
|
|
41
|
+
this.$emit('track-feedback', event);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
i18n
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/* script */
|
|
48
|
+
const __vue_script__ = script;
|
|
49
|
+
|
|
50
|
+
/* template */
|
|
51
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-display-flex gl-flex-direction-column gl-justify-content-end"},[(_vm.showDelimiter)?_c('div',{staticClass:"gl-my-5 gl-display-flex gl-align-items-center gl-text-gray-500 gl-gap-4",attrs:{"data-testid":"conversation-delimiter"}},[_c('hr',{staticClass:"gl-flex-grow-1"}),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.$options.i18n.CONVERSATION_NEW_CHAT))]),_vm._v(" "),_c('hr',{staticClass:"gl-flex-grow-1"})]):_vm._e(),_vm._v(" "),_vm._l((_vm.messages),function(msg,index){return _c('gl-duo-chat-message',{key:((msg.role) + "-" + index),attrs:{"message":msg},on:{"track-feedback":_vm.onTrackFeedback}})})],2)};
|
|
52
|
+
var __vue_staticRenderFns__ = [];
|
|
53
|
+
|
|
54
|
+
/* style */
|
|
55
|
+
const __vue_inject_styles__ = undefined;
|
|
56
|
+
/* scoped */
|
|
57
|
+
const __vue_scope_id__ = undefined;
|
|
58
|
+
/* module identifier */
|
|
59
|
+
const __vue_module_identifier__ = undefined;
|
|
60
|
+
/* functional template */
|
|
61
|
+
const __vue_is_functional_template__ = false;
|
|
62
|
+
/* style inject */
|
|
63
|
+
|
|
64
|
+
/* style inject SSR */
|
|
65
|
+
|
|
66
|
+
/* style inject shadow dom */
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
const __vue_component__ = __vue_normalize__(
|
|
71
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
72
|
+
__vue_inject_styles__,
|
|
73
|
+
__vue_script__,
|
|
74
|
+
__vue_scope_id__,
|
|
75
|
+
__vue_is_functional_template__,
|
|
76
|
+
__vue_module_identifier__,
|
|
77
|
+
false,
|
|
78
|
+
undefined,
|
|
79
|
+
undefined,
|
|
80
|
+
undefined
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
export default __vue_component__;
|