@gitlab/ui 49.0.0 → 49.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/components/base/accordion/accordion.js +2 -8
- package/dist/components/base/accordion/accordion_item.js +0 -14
- package/dist/components/base/alert/alert.js +4 -22
- package/dist/components/base/avatar/avatar.js +0 -7
- package/dist/components/base/avatar_labeled/avatar_labeled.js +0 -2
- package/dist/components/base/avatars_inline/avatars_inline.js +2 -10
- package/dist/components/base/badge/badge.js +0 -8
- package/dist/components/base/banner/banner.js +0 -10
- package/dist/components/base/breadcrumb/breadcrumb.js +0 -12
- package/dist/components/base/breadcrumb/breadcrumb_item.js +0 -2
- package/dist/components/base/broadcast_message/broadcast_message.js +0 -3
- package/dist/components/base/button/button.js +0 -11
- package/dist/components/base/card/card.js +1 -2
- package/dist/components/base/datepicker/datepicker.js +7 -42
- package/dist/components/base/daterange_picker/daterange_picker.js +0 -23
- package/dist/components/base/drawer/drawer.js +0 -13
- package/dist/components/base/dropdown/dropdown.js +3 -17
- package/dist/components/base/dropdown/dropdown_item.js +2 -8
- package/dist/components/base/filtered_search/common_story_options.js +1 -2
- package/dist/components/base/filtered_search/filtered_search.js +9 -61
- package/dist/components/base/filtered_search/filtered_search_suggestion.js +0 -6
- package/dist/components/base/filtered_search/filtered_search_suggestion_list.js +0 -16
- package/dist/components/base/filtered_search/filtered_search_term.js +0 -9
- package/dist/components/base/filtered_search/filtered_search_token.js +10 -49
- package/dist/components/base/filtered_search/filtered_search_token_segment.js +3 -56
- package/dist/components/base/filtered_search/filtered_search_utils.js +7 -24
- package/dist/components/base/form/form_checkbox/form_checkbox.js +0 -2
- package/dist/components/base/form/form_checkbox_tree/checkbox_tree_node.js +0 -4
- package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.js +0 -10
- package/dist/components/base/form/form_checkbox_tree/models/node.js +1 -10
- package/dist/components/base/form/form_checkbox_tree/models/tree.js +16 -37
- package/dist/components/base/form/form_combobox/form_combobox.js +2 -36
- package/dist/components/base/form/form_group/form_group.js +2 -7
- package/dist/components/base/form/form_input/form_input.js +2 -8
- package/dist/components/base/form/form_input_group/form_input_group.js +0 -5
- package/dist/components/base/form/form_input_group/form_input_group_mixin.js +0 -8
- package/dist/components/base/form/form_radio_group/form_radio_group.js +0 -2
- package/dist/components/base/form/form_select/form_select.js +0 -3
- package/dist/components/base/form/form_textarea/form_textarea.js +2 -7
- package/dist/components/base/icon/icon.js +4 -14
- package/dist/components/base/infinite_scroll/infinite_scroll.js +7 -21
- package/dist/components/base/keyset_pagination/keyset_pagination.js +0 -9
- package/dist/components/base/label/label.js +0 -12
- package/dist/components/base/loading_icon/loading_icon.js +7 -10
- package/dist/components/base/markdown/markdown.js +1 -0
- package/dist/components/base/modal/modal.js +7 -27
- package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +14 -34
- package/dist/components/base/new_dropdowns/constants.js +4 -2
- package/dist/components/base/new_dropdowns/listbox/listbox.js +14 -81
- package/dist/components/base/new_dropdowns/listbox/listbox_group.js +0 -2
- package/dist/components/base/new_dropdowns/listbox/listbox_item.js +0 -5
- package/dist/components/base/new_dropdowns/listbox/utils.js +0 -7
- package/dist/components/base/paginated_list/paginated_list.js +0 -15
- package/dist/components/base/pagination/pagination.js +14 -72
- package/dist/components/base/path/path.js +0 -29
- package/dist/components/base/popover/popover.js +0 -5
- package/dist/components/base/search_box_by_click/search_box_by_click.js +1 -26
- package/dist/components/base/search_box_by_type/search_box_by_type.js +2 -12
- package/dist/components/base/segmented_control/segmented_control.js +0 -10
- package/dist/components/base/skeleton_loader/skeleton_loader.js +0 -19
- package/dist/components/base/skeleton_loading/skeleton_loading.js +0 -3
- package/dist/components/base/sorting/sorting.js +1 -9
- package/dist/components/base/sorting/sorting_item.js +4 -6
- package/dist/components/base/table/table.js +0 -4
- package/dist/components/base/tabs/tab/tab.js +2 -6
- package/dist/components/base/tabs/tabs/scrollable_tabs.js +0 -21
- package/dist/components/base/tabs/tabs/tabs.js +8 -33
- package/dist/components/base/toast/toast.js +3 -15
- package/dist/components/base/toggle/toggle.js +0 -18
- package/dist/components/base/token/token.js +0 -4
- package/dist/components/base/token_selector/token_container.js +0 -24
- package/dist/components/base/token_selector/token_selector.js +10 -61
- package/dist/components/base/token_selector/token_selector_dropdown.js +4 -32
- package/dist/components/charts/area/area.js +8 -32
- package/dist/components/charts/bar/bar.js +7 -19
- package/dist/components/charts/chart/chart.js +1 -22
- package/dist/components/charts/column/column.js +8 -18
- package/dist/components/charts/discrete_scatter/discrete_scatter.js +2 -13
- package/dist/components/charts/gauge/gauge.js +0 -15
- package/dist/components/charts/heatmap/heatmap.js +3 -16
- package/dist/components/charts/legend/legend.js +2 -24
- package/dist/components/charts/line/line.js +8 -34
- package/dist/components/charts/series_label/series_label.js +0 -12
- package/dist/components/charts/single_stat/single_stat.js +0 -8
- package/dist/components/charts/sparkline/sparkline.js +1 -16
- package/dist/components/charts/stacked_column/stacked_column.js +8 -26
- package/dist/components/charts/tooltip/tooltip.js +0 -6
- package/dist/components/mixins/button_mixin.js +0 -1
- package/dist/components/mixins/safe_link_mixin.js +0 -1
- package/dist/components/mixins/toolbox_mixin.js +0 -1
- package/dist/components/mixins/tooltip_mixin.js +1 -2
- package/dist/components/regions/empty_state/empty_state.js +0 -12
- package/dist/components/utilities/animated_number/animated_number.js +0 -16
- package/dist/components/utilities/friendly_wrap/friendly_wrap.js +0 -3
- package/dist/components/utilities/intersection_observer/intersection_observer.js +0 -7
- package/dist/components/utilities/intersperse/intersperse.js +3 -9
- package/dist/components/utilities/sprintf/sprintf.js +9 -23
- package/dist/components/utilities/truncate/truncate.js +0 -10
- package/dist/config.js +3 -4
- package/dist/directives/hover_load/hover_load.js +2 -8
- package/dist/directives/outside/get_event_like_time_stamp.js +4 -2
- package/dist/directives/outside/outside.js +5 -20
- package/dist/directives/resize_observer/resize_observer.js +0 -10
- package/dist/directives/safe_html/safe_html.js +5 -6
- package/dist/directives/safe_link/mock_data.js +1 -1
- package/dist/directives/safe_link/safe_link.js +0 -13
- package/dist/utils/breakpoints.js +0 -3
- package/dist/utils/charts/config.js +29 -42
- package/dist/utils/charts/constants.js +8 -8
- package/dist/utils/charts/mock_data.js +2 -2
- package/dist/utils/charts/story_config.js +1 -1
- package/dist/utils/charts/theme.js +1 -3
- package/dist/utils/charts/utils.js +2 -6
- package/dist/utils/constants.js +10 -7
- package/dist/utils/data_utils.js +5 -4
- package/dist/utils/datetime_utility.js +4 -4
- package/dist/utils/number_utils.js +7 -11
- package/dist/utils/stories_utils.js +1 -1
- package/dist/utils/story_decorators/container.js +0 -1
- package/dist/utils/string_utils.js +0 -14
- package/dist/utils/test_utils.js +3 -2
- package/dist/utils/use_fake_date.js +0 -4
- package/dist/utils/use_mock_intersection_observer.js +4 -19
- package/dist/utils/utils.js +5 -14
- package/package.json +3 -3
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.spec.js +1 -0
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.vue +13 -7
- package/src/components/base/new_dropdowns/listbox/listbox.spec.js +13 -7
- package/src/components/base/new_dropdowns/listbox/listbox.vue +12 -16
- package/src/components/base/pagination/pagination.vue +2 -2
|
@@ -26,7 +26,6 @@ var script = {
|
|
|
26
26
|
required: false,
|
|
27
27
|
default: () => []
|
|
28
28
|
},
|
|
29
|
-
|
|
30
29
|
/**
|
|
31
30
|
* Should users be allowed to add tokens that are not in `dropdown-items`
|
|
32
31
|
*/
|
|
@@ -35,7 +34,6 @@ var script = {
|
|
|
35
34
|
required: false,
|
|
36
35
|
default: false
|
|
37
36
|
},
|
|
38
|
-
|
|
39
37
|
/**
|
|
40
38
|
* Dropdown items are loading, can be used when requesting new dropdown items
|
|
41
39
|
*/
|
|
@@ -44,7 +42,6 @@ var script = {
|
|
|
44
42
|
required: false,
|
|
45
43
|
default: false
|
|
46
44
|
},
|
|
47
|
-
|
|
48
45
|
/**
|
|
49
46
|
* Hide the dropdown if `dropdown-items` is empty. Will show `no-results-content` slot if this is `false`
|
|
50
47
|
*/
|
|
@@ -53,7 +50,6 @@ var script = {
|
|
|
53
50
|
required: false,
|
|
54
51
|
default: false
|
|
55
52
|
},
|
|
56
|
-
|
|
57
53
|
/**
|
|
58
54
|
* CSS classes to add to the main token selector container (`.gl-token-selector`)
|
|
59
55
|
*/
|
|
@@ -62,7 +58,6 @@ var script = {
|
|
|
62
58
|
required: false,
|
|
63
59
|
default: ''
|
|
64
60
|
},
|
|
65
|
-
|
|
66
61
|
/**
|
|
67
62
|
* CSS classes to add to dropdown menu `ul` element
|
|
68
63
|
*/
|
|
@@ -71,7 +66,6 @@ var script = {
|
|
|
71
66
|
required: false,
|
|
72
67
|
default: ''
|
|
73
68
|
},
|
|
74
|
-
|
|
75
69
|
/**
|
|
76
70
|
* The autocomplete attribute value for the underlying `input` element
|
|
77
71
|
*/
|
|
@@ -80,7 +74,6 @@ var script = {
|
|
|
80
74
|
required: false,
|
|
81
75
|
default: 'off'
|
|
82
76
|
},
|
|
83
|
-
|
|
84
77
|
/**
|
|
85
78
|
* The `aria-labelledby` attribute value for the underlying `input` element
|
|
86
79
|
*/
|
|
@@ -89,7 +82,6 @@ var script = {
|
|
|
89
82
|
required: false,
|
|
90
83
|
default: null
|
|
91
84
|
},
|
|
92
|
-
|
|
93
85
|
/**
|
|
94
86
|
* The `placeholder` attribute value for the underlying `input` element
|
|
95
87
|
*/
|
|
@@ -98,7 +90,6 @@ var script = {
|
|
|
98
90
|
required: false,
|
|
99
91
|
default: null
|
|
100
92
|
},
|
|
101
|
-
|
|
102
93
|
/**
|
|
103
94
|
* HTML attributes to add to the text input. Helpful for adding `data-testid` and `data-qa-selector` attributes
|
|
104
95
|
*/
|
|
@@ -107,7 +98,6 @@ var script = {
|
|
|
107
98
|
required: false,
|
|
108
99
|
default: null
|
|
109
100
|
},
|
|
110
|
-
|
|
111
101
|
/**
|
|
112
102
|
* Controls the validation state appearance of the component. `true` for valid, `false` for invalid, or `null` for no validation state
|
|
113
103
|
*/
|
|
@@ -116,7 +106,6 @@ var script = {
|
|
|
116
106
|
required: false,
|
|
117
107
|
default: null
|
|
118
108
|
},
|
|
119
|
-
|
|
120
109
|
/**
|
|
121
110
|
* Tokens that are selected. This prop will automatically be added when using `v-model`
|
|
122
111
|
*/
|
|
@@ -126,7 +115,6 @@ var script = {
|
|
|
126
115
|
validator: tokensValidator,
|
|
127
116
|
required: true
|
|
128
117
|
},
|
|
129
|
-
|
|
130
118
|
/**
|
|
131
119
|
* Controls the `view-only` mode for the tokens
|
|
132
120
|
*/
|
|
@@ -135,7 +123,6 @@ var script = {
|
|
|
135
123
|
required: false,
|
|
136
124
|
default: false
|
|
137
125
|
},
|
|
138
|
-
|
|
139
126
|
/**
|
|
140
127
|
* Allows user to bulk delete tokens when enabled
|
|
141
128
|
*/
|
|
@@ -145,7 +132,6 @@ var script = {
|
|
|
145
132
|
default: false
|
|
146
133
|
}
|
|
147
134
|
},
|
|
148
|
-
|
|
149
135
|
data() {
|
|
150
136
|
return {
|
|
151
137
|
inputText: '',
|
|
@@ -164,52 +150,40 @@ var script = {
|
|
|
164
150
|
focusOnToken: () => {}
|
|
165
151
|
};
|
|
166
152
|
},
|
|
167
|
-
|
|
168
153
|
computed: {
|
|
169
154
|
filteredDropdownItems() {
|
|
170
155
|
return this.dropdownItems.filter(dropdownItem => this.selectedTokens.findIndex(token => token.id === dropdownItem.id) === -1);
|
|
171
156
|
},
|
|
172
|
-
|
|
173
157
|
dropdownHasNoItems() {
|
|
174
158
|
return !this.filteredDropdownItems.length;
|
|
175
159
|
},
|
|
176
|
-
|
|
177
160
|
userDefinedTokenCanBeAdded() {
|
|
178
161
|
return this.allowUserDefinedTokens && this.dropdownHasNoItems && this.inputText !== '';
|
|
179
162
|
},
|
|
180
|
-
|
|
181
163
|
hideDropdown() {
|
|
182
164
|
if (this.userDefinedTokenCanBeAdded) {
|
|
183
165
|
return false;
|
|
184
166
|
}
|
|
185
|
-
|
|
186
167
|
if (this.hideDropdownWithNoItems && this.dropdownHasNoItems) {
|
|
187
168
|
return true;
|
|
188
169
|
}
|
|
189
|
-
|
|
190
170
|
return false;
|
|
191
171
|
},
|
|
192
|
-
|
|
193
172
|
stateClass() {
|
|
194
173
|
if (this.state === null) {
|
|
195
174
|
return 'gl-inset-border-1-gray-400!';
|
|
196
175
|
}
|
|
197
|
-
|
|
198
176
|
return this.state ? 'is-valid gl-inset-border-1-gray-400!' : 'is-invalid gl-inset-border-1-red-500!';
|
|
199
177
|
},
|
|
200
|
-
|
|
201
178
|
hasSelectedTokens() {
|
|
202
179
|
return this.selectedTokens.length > 0;
|
|
203
180
|
},
|
|
204
|
-
|
|
205
181
|
showEmptyPlaceholder() {
|
|
206
182
|
return !this.hasSelectedTokens && !this.inputFocused;
|
|
207
183
|
},
|
|
208
|
-
|
|
209
184
|
showClearAllButton() {
|
|
210
185
|
return this.hasSelectedTokens && this.allowClearAll;
|
|
211
186
|
}
|
|
212
|
-
|
|
213
187
|
},
|
|
214
188
|
watch: {
|
|
215
189
|
inputText(newValue, oldValue) {
|
|
@@ -221,16 +195,15 @@ var script = {
|
|
|
221
195
|
*/
|
|
222
196
|
this.$emit('text-input', newValue);
|
|
223
197
|
this.resetFocusedDropdownItem();
|
|
224
|
-
|
|
225
198
|
if (newValue !== '') {
|
|
226
199
|
this.triggerTokenFocusNextBackspace = false;
|
|
227
200
|
} else {
|
|
228
201
|
this.triggerTokenFocusNextBackspace = true;
|
|
229
|
-
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Wait a tick so `text-input` event can be used to validate
|
|
230
205
|
// the value and change the `allowUserDefinedTokens` and/or
|
|
231
206
|
// `hideDropdownWithNoItems` props
|
|
232
|
-
|
|
233
|
-
|
|
234
207
|
this.$nextTick(() => {
|
|
235
208
|
if (this.hideDropdown) {
|
|
236
209
|
this.closeDropdown();
|
|
@@ -240,7 +213,6 @@ var script = {
|
|
|
240
213
|
});
|
|
241
214
|
}
|
|
242
215
|
}
|
|
243
|
-
|
|
244
216
|
},
|
|
245
217
|
methods: {
|
|
246
218
|
handleFocus(event) {
|
|
@@ -253,12 +225,10 @@ var script = {
|
|
|
253
225
|
this.openDropdown();
|
|
254
226
|
this.inputFocused = true;
|
|
255
227
|
this.focusOnToken();
|
|
256
|
-
|
|
257
228
|
if (this.inputText === '') {
|
|
258
229
|
this.triggerTokenFocusNextBackspace = true;
|
|
259
230
|
}
|
|
260
231
|
},
|
|
261
|
-
|
|
262
232
|
handleBlur(event) {
|
|
263
233
|
/**
|
|
264
234
|
* Fired when the token selector is blurred
|
|
@@ -266,20 +236,19 @@ var script = {
|
|
|
266
236
|
* @property {FocusEvent} event
|
|
267
237
|
*/
|
|
268
238
|
this.$emit('blur', event);
|
|
269
|
-
this.inputFocused = false;
|
|
239
|
+
this.inputFocused = false;
|
|
240
|
+
|
|
241
|
+
// `event.relatedTarget` returns `null` on Safari because buttons are not focused on click (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus)
|
|
270
242
|
// Workaround is to:
|
|
271
243
|
// 1. Explicitly focus the dropdown menu item button on `mousedown` event. (see './token_selector_dropdown.vue')
|
|
272
244
|
// 2. Use `nextTick` so `blur` event is fired after the `mousedown` event
|
|
273
|
-
|
|
274
245
|
this.$nextTick(() => {
|
|
275
246
|
var _event$relatedTarget, _event$relatedTarget$;
|
|
276
|
-
|
|
277
247
|
if (!((_event$relatedTarget = event.relatedTarget) !== null && _event$relatedTarget !== void 0 && (_event$relatedTarget$ = _event$relatedTarget.closest) !== null && _event$relatedTarget$ !== void 0 && _event$relatedTarget$.call(_event$relatedTarget, '.dropdown-item'))) {
|
|
278
248
|
this.closeDropdown();
|
|
279
249
|
}
|
|
280
250
|
});
|
|
281
251
|
},
|
|
282
|
-
|
|
283
252
|
handleEnter() {
|
|
284
253
|
if (this.userDefinedTokenCanBeAdded) {
|
|
285
254
|
this.addToken();
|
|
@@ -287,20 +256,17 @@ var script = {
|
|
|
287
256
|
this.addToken(this.focusedDropdownItem);
|
|
288
257
|
}
|
|
289
258
|
},
|
|
290
|
-
|
|
291
259
|
handleEscape() {
|
|
292
260
|
this.inputText = '';
|
|
293
261
|
this.closeDropdown();
|
|
294
262
|
},
|
|
295
|
-
|
|
296
263
|
handleBackspace(event) {
|
|
297
264
|
if (this.inputText !== '' || !this.selectedTokens.length) {
|
|
298
265
|
return;
|
|
299
|
-
}
|
|
300
|
-
|
|
266
|
+
}
|
|
301
267
|
|
|
268
|
+
// Prevent triggering the browser back button
|
|
302
269
|
event.preventDefault();
|
|
303
|
-
|
|
304
270
|
if (this.triggerTokenFocusNextBackspace) {
|
|
305
271
|
this.$refs.textInput.blur();
|
|
306
272
|
this.focusOnToken(this.selectedTokens.length - 1);
|
|
@@ -308,51 +274,45 @@ var script = {
|
|
|
308
274
|
this.triggerTokenFocusNextBackspace = true;
|
|
309
275
|
}
|
|
310
276
|
},
|
|
311
|
-
|
|
312
277
|
handleInputClick() {
|
|
313
278
|
// Open the dropdown if the user clicks an already focused input
|
|
314
279
|
if (this.inputFocused && this.inputText === '' && !this.dropdownIsOpen) {
|
|
315
280
|
this.openDropdown();
|
|
316
281
|
}
|
|
317
282
|
},
|
|
318
|
-
|
|
319
283
|
handleContainerClick(event) {
|
|
320
284
|
// Bail if token is clicked
|
|
321
285
|
const {
|
|
322
286
|
target
|
|
323
287
|
} = event;
|
|
324
|
-
|
|
325
288
|
if ((target === null || target === void 0 ? void 0 : target.closest('.gl-token')) !== null || this.inputFocused) {
|
|
326
289
|
return;
|
|
327
290
|
}
|
|
328
|
-
|
|
329
291
|
this.focusTextInput();
|
|
330
292
|
},
|
|
331
|
-
|
|
332
293
|
addToken() {
|
|
333
294
|
let dropdownItem = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
334
295
|
const token = dropdownItem !== null ? dropdownItem : {
|
|
335
296
|
id: _uniqueId('user-defined-token'),
|
|
336
297
|
name: this.inputText
|
|
337
298
|
};
|
|
299
|
+
|
|
338
300
|
/**
|
|
339
301
|
* Fired when a token is added or removed
|
|
340
302
|
*
|
|
341
303
|
* @property {array} selectedTokens
|
|
342
304
|
*/
|
|
343
|
-
|
|
344
305
|
this.$emit('input', [...this.selectedTokens, token]);
|
|
345
306
|
this.inputText = '';
|
|
346
307
|
this.closeDropdown();
|
|
308
|
+
|
|
347
309
|
/**
|
|
348
310
|
* Fired when a token is added
|
|
349
311
|
*
|
|
350
312
|
* @property {object} token
|
|
351
313
|
*/
|
|
352
|
-
|
|
353
314
|
this.$emit('token-add', token);
|
|
354
315
|
},
|
|
355
|
-
|
|
356
316
|
removeToken(token) {
|
|
357
317
|
/**
|
|
358
318
|
* Fired when user types in the token selector
|
|
@@ -365,49 +325,38 @@ var script = {
|
|
|
365
325
|
*
|
|
366
326
|
* @property {object} token
|
|
367
327
|
*/
|
|
368
|
-
|
|
369
328
|
this.$emit('token-remove', token);
|
|
370
329
|
},
|
|
371
|
-
|
|
372
330
|
cancelTokenFocus() {
|
|
373
331
|
this.focusTextInput();
|
|
374
332
|
},
|
|
375
|
-
|
|
376
333
|
closeDropdown() {
|
|
377
334
|
this.dropdownIsOpen = false;
|
|
378
335
|
this.resetFocusedDropdownItem();
|
|
379
336
|
},
|
|
380
|
-
|
|
381
337
|
openDropdown() {
|
|
382
338
|
if (this.hideDropdown) {
|
|
383
339
|
return;
|
|
384
340
|
}
|
|
385
|
-
|
|
386
341
|
this.dropdownIsOpen = true;
|
|
387
342
|
},
|
|
388
|
-
|
|
389
343
|
focusTextInput() {
|
|
390
344
|
this.$refs.textInput.focus();
|
|
391
345
|
},
|
|
392
|
-
|
|
393
346
|
// Register methods passed as props from child components
|
|
394
347
|
registerDropdownEventHandlers(dropdownEventHandlers) {
|
|
395
348
|
this.dropdownEventHandlers = dropdownEventHandlers;
|
|
396
349
|
},
|
|
397
|
-
|
|
398
350
|
registerResetFocusedDropdownItem(resetFocusedDropdownItem) {
|
|
399
351
|
this.resetFocusedDropdownItem = resetFocusedDropdownItem;
|
|
400
352
|
},
|
|
401
|
-
|
|
402
353
|
registerFocusOnToken(focusOnToken) {
|
|
403
354
|
this.focusOnToken = focusOnToken;
|
|
404
355
|
},
|
|
405
|
-
|
|
406
356
|
clearAll() {
|
|
407
357
|
this.$emit('input', []);
|
|
408
358
|
this.focusTextInput();
|
|
409
359
|
}
|
|
410
|
-
|
|
411
360
|
}
|
|
412
361
|
};
|
|
413
362
|
|
|
@@ -49,30 +49,24 @@ var script = {
|
|
|
49
49
|
required: true
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
-
|
|
53
52
|
data() {
|
|
54
53
|
return {
|
|
55
54
|
focusedDropdownItemIndex: 0
|
|
56
55
|
};
|
|
57
56
|
},
|
|
58
|
-
|
|
59
57
|
computed: {
|
|
60
58
|
focusedDropdownItem() {
|
|
61
59
|
return this.dropdownItems[this.focusedDropdownItemIndex];
|
|
62
60
|
}
|
|
63
|
-
|
|
64
61
|
},
|
|
65
62
|
watch: {
|
|
66
63
|
focusedDropdownItem(newValue, oldValue) {
|
|
67
64
|
if ((newValue === null || newValue === void 0 ? void 0 : newValue.id) !== (oldValue === null || oldValue === void 0 ? void 0 : oldValue.id)) {
|
|
68
65
|
this.$emit('input', newValue);
|
|
69
|
-
|
|
70
66
|
if (!newValue) {
|
|
71
67
|
return;
|
|
72
68
|
}
|
|
73
|
-
|
|
74
69
|
const dropdownItemRef = this.getDropdownItemRef(newValue);
|
|
75
|
-
|
|
76
70
|
if (dropdownItemRef !== null && dropdownItemRef !== void 0 && dropdownItemRef.$el) {
|
|
77
71
|
dropdownItemRef.$el.scrollIntoView({
|
|
78
72
|
block: 'nearest',
|
|
@@ -81,9 +75,7 @@ var script = {
|
|
|
81
75
|
}
|
|
82
76
|
}
|
|
83
77
|
}
|
|
84
|
-
|
|
85
78
|
},
|
|
86
|
-
|
|
87
79
|
created() {
|
|
88
80
|
this.registerDropdownEventHandlers({
|
|
89
81
|
handleUpArrow: this.handleUpArrow,
|
|
@@ -94,97 +86,77 @@ var script = {
|
|
|
94
86
|
this.registerResetFocusedDropdownItem(this.resetFocusedDropdownItem);
|
|
95
87
|
this.$emit('input', this.focusedDropdownItem);
|
|
96
88
|
},
|
|
97
|
-
|
|
98
89
|
methods: {
|
|
99
90
|
handleDropdownItemClick(dropdownItem) {
|
|
100
91
|
this.$emit('dropdown-item-click', dropdownItem);
|
|
101
92
|
},
|
|
102
|
-
|
|
103
93
|
handleMousedown(dropdownItem) {
|
|
104
94
|
// `event.relatedTarget` returns `null` on Safari because buttons are not focused on click (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus)
|
|
105
95
|
// Because of this we need to manually focus on the button. We do this in `mousedown` because it is fired before the `blur` event
|
|
106
96
|
const dropdownItemRef = dropdownItem === null ? this.$refs.userDefinedTokenDropdownItem : this.getDropdownItemRef(dropdownItem);
|
|
107
|
-
|
|
108
97
|
if (dropdownItemRef !== null && dropdownItemRef !== void 0 && dropdownItemRef.$el) {
|
|
109
98
|
dropdownItemRef.$el.querySelector('button').focus();
|
|
110
99
|
}
|
|
111
100
|
},
|
|
112
|
-
|
|
113
101
|
handleUpArrow() {
|
|
114
102
|
if (!this.show) {
|
|
115
103
|
return;
|
|
116
|
-
}
|
|
117
|
-
|
|
104
|
+
}
|
|
118
105
|
|
|
106
|
+
// First dropdown item has been reached
|
|
119
107
|
if (this.focusedDropdownItemIndex === 0) {
|
|
120
108
|
return;
|
|
121
109
|
}
|
|
122
|
-
|
|
123
110
|
this.focusPrevDropdownItem();
|
|
124
111
|
},
|
|
125
|
-
|
|
126
112
|
handleDownArrow() {
|
|
127
113
|
if (!this.show) {
|
|
128
114
|
this.$emit('show');
|
|
129
115
|
return;
|
|
130
|
-
}
|
|
131
|
-
|
|
116
|
+
}
|
|
132
117
|
|
|
118
|
+
// Last dropdown item has been reached
|
|
133
119
|
if (this.focusedDropdownItemIndex === this.dropdownItems.length - 1) {
|
|
134
120
|
return;
|
|
135
121
|
}
|
|
136
|
-
|
|
137
122
|
this.focusNextDropdownItem();
|
|
138
123
|
},
|
|
139
|
-
|
|
140
124
|
handleHomeKey(event) {
|
|
141
125
|
event.preventDefault();
|
|
142
126
|
this.focusFirstDropdownItem();
|
|
143
127
|
},
|
|
144
|
-
|
|
145
128
|
handleEndKey(event) {
|
|
146
129
|
event.preventDefault();
|
|
147
130
|
this.focusLastDropdownItem();
|
|
148
131
|
},
|
|
149
|
-
|
|
150
132
|
focusLastDropdownItem() {
|
|
151
133
|
this.focusedDropdownItemIndex = this.dropdownItems.length - 1;
|
|
152
134
|
},
|
|
153
|
-
|
|
154
135
|
focusFirstDropdownItem() {
|
|
155
136
|
this.focusedDropdownItemIndex = 0;
|
|
156
137
|
},
|
|
157
|
-
|
|
158
138
|
focusNextDropdownItem() {
|
|
159
139
|
this.focusedDropdownItemIndex += 1;
|
|
160
140
|
},
|
|
161
|
-
|
|
162
141
|
focusPrevDropdownItem() {
|
|
163
142
|
this.focusedDropdownItemIndex -= 1;
|
|
164
143
|
},
|
|
165
|
-
|
|
166
144
|
resetFocusedDropdownItem() {
|
|
167
145
|
this.focusedDropdownItemIndex = 0;
|
|
168
146
|
},
|
|
169
|
-
|
|
170
147
|
dropdownItemIsFocused(dropdownItem) {
|
|
171
148
|
if (!this.focusedDropdownItem) {
|
|
172
149
|
return false;
|
|
173
150
|
}
|
|
174
|
-
|
|
175
151
|
return dropdownItem.id === this.focusedDropdownItem.id;
|
|
176
152
|
},
|
|
177
|
-
|
|
178
153
|
getDropdownItemRef(dropdownItem) {
|
|
179
154
|
var _this$$refs$dropdownI;
|
|
180
|
-
|
|
181
155
|
return (_this$$refs$dropdownI = this.$refs.dropdownItems) === null || _this$$refs$dropdownI === void 0 ? void 0 : _this$$refs$dropdownI.find(ref => ref.$attrs['data-dropdown-item-id'] === dropdownItem.id);
|
|
182
156
|
},
|
|
183
|
-
|
|
184
157
|
dropdownItemIdAttribute(dropdownItem) {
|
|
185
158
|
return dropdownItem ? `${this.componentId}-dropdown-item-${dropdownItem.id}` : null;
|
|
186
159
|
}
|
|
187
|
-
|
|
188
160
|
}
|
|
189
161
|
};
|
|
190
162
|
|
|
@@ -80,14 +80,11 @@ var script = {
|
|
|
80
80
|
type: String,
|
|
81
81
|
required: false,
|
|
82
82
|
default: LEGEND_LAYOUT_INLINE,
|
|
83
|
-
|
|
84
83
|
validator(layout) {
|
|
85
84
|
return [LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE].indexOf(layout) !== -1;
|
|
86
85
|
}
|
|
87
|
-
|
|
88
86
|
}
|
|
89
87
|
},
|
|
90
|
-
|
|
91
88
|
data() {
|
|
92
89
|
// Part of the tooltip related data can be
|
|
93
90
|
// moved into the tooltip component.
|
|
@@ -113,14 +110,11 @@ var script = {
|
|
|
113
110
|
selectedFormatTooltipText: this.formatTooltipText || this.defaultFormatTooltipText
|
|
114
111
|
};
|
|
115
112
|
},
|
|
116
|
-
|
|
117
113
|
computed: {
|
|
118
114
|
series() {
|
|
119
115
|
const dataSeries = this.data.map((series, index) => {
|
|
120
116
|
const defaultColor = colorFromDefaultPalette(index);
|
|
121
|
-
|
|
122
117
|
const getColor = type => series[type] && series[type].color ? series[type].color : defaultColor;
|
|
123
|
-
|
|
124
118
|
return merge({
|
|
125
119
|
areaStyle: {
|
|
126
120
|
opacity: defaultAreaOpacity,
|
|
@@ -134,20 +128,17 @@ var script = {
|
|
|
134
128
|
color: getColor('itemStyle')
|
|
135
129
|
}
|
|
136
130
|
}, lineStyle, series, getThresholdConfig(this.thresholds));
|
|
137
|
-
});
|
|
131
|
+
});
|
|
132
|
+
// if annotation series exists, append it
|
|
138
133
|
// along with data series
|
|
139
|
-
|
|
140
134
|
if (this.annotationSeries) {
|
|
141
135
|
return [...dataSeries, this.annotationSeries];
|
|
142
136
|
}
|
|
143
|
-
|
|
144
137
|
return dataSeries;
|
|
145
138
|
},
|
|
146
|
-
|
|
147
139
|
annotationSeries() {
|
|
148
140
|
return generateAnnotationSeries(this.annotations);
|
|
149
141
|
},
|
|
150
|
-
|
|
151
142
|
options() {
|
|
152
143
|
const defaultAreaChartOptions = {
|
|
153
144
|
xAxis: {
|
|
@@ -170,12 +161,11 @@ var script = {
|
|
|
170
161
|
show: false
|
|
171
162
|
}
|
|
172
163
|
};
|
|
173
|
-
const mergedOptions = merge({}, defaultChartOptions, defaultAreaChartOptions, this.option, dataZoomAdjustments(this.option.dataZoom), this.toolboxAdjustments);
|
|
164
|
+
const mergedOptions = merge({}, defaultChartOptions, defaultAreaChartOptions, this.option, dataZoomAdjustments(this.option.dataZoom), this.toolboxAdjustments);
|
|
165
|
+
// All chart options can be merged but series
|
|
174
166
|
// needs to be handled specially.
|
|
175
|
-
|
|
176
167
|
return mergeSeriesToOptions(mergeAnnotationAxisToOptions(mergedOptions, this.hasAnnotations), this.series);
|
|
177
168
|
},
|
|
178
|
-
|
|
179
169
|
/**
|
|
180
170
|
* Annotations currently are passed as series options in monitoring dashboard.
|
|
181
171
|
* Once https://gitlab.com/gitlab-org/gitlab/-/issues/213390 is closed,
|
|
@@ -186,21 +176,17 @@ var script = {
|
|
|
186
176
|
hasAnnotations() {
|
|
187
177
|
return this.annotations.length !== 0 || seriesHasAnnotations(this.option.series);
|
|
188
178
|
},
|
|
189
|
-
|
|
190
179
|
shouldShowAnnotationsTooltip() {
|
|
191
180
|
return this.chart && this.hasAnnotations;
|
|
192
181
|
},
|
|
193
|
-
|
|
194
182
|
compiledOptions() {
|
|
195
183
|
return this.chart ? this.chart.getOption() : null;
|
|
196
184
|
},
|
|
197
|
-
|
|
198
185
|
legendStyle() {
|
|
199
186
|
return {
|
|
200
187
|
paddingLeft: `${grid.left}px`
|
|
201
188
|
};
|
|
202
189
|
},
|
|
203
|
-
|
|
204
190
|
seriesInfo() {
|
|
205
191
|
return this.compiledOptions.series.reduce((acc, series, index) => {
|
|
206
192
|
if (series.type === 'line') {
|
|
@@ -211,20 +197,16 @@ var script = {
|
|
|
211
197
|
data: this.includeLegendAvgMax ? series.data.map(data => data[1]) : undefined
|
|
212
198
|
});
|
|
213
199
|
}
|
|
214
|
-
|
|
215
200
|
return acc;
|
|
216
201
|
}, []);
|
|
217
202
|
}
|
|
218
|
-
|
|
219
203
|
},
|
|
220
|
-
|
|
221
204
|
beforeDestroy() {
|
|
222
205
|
this.chart.getDom().removeEventListener('mousemove', this.debouncedShowHideTooltip);
|
|
223
206
|
this.chart.getDom().removeEventListener('mouseout', this.debouncedShowHideTooltip);
|
|
224
207
|
this.chart.off('mouseout', this.hideAnnotationsTooltip);
|
|
225
208
|
this.chart.off('mouseover', this.onChartMouseOver);
|
|
226
209
|
},
|
|
227
|
-
|
|
228
210
|
methods: {
|
|
229
211
|
defaultFormatTooltipText(params) {
|
|
230
212
|
const {
|
|
@@ -234,26 +216,26 @@ var script = {
|
|
|
234
216
|
this.$set(this, 'dataTooltipContent', tooltipContent);
|
|
235
217
|
this.dataTooltipTitle = xLabels.join(', ');
|
|
236
218
|
},
|
|
237
|
-
|
|
238
219
|
defaultAnnotationTooltipText(params) {
|
|
239
220
|
var _params$data$tooltipD;
|
|
240
|
-
|
|
241
221
|
return {
|
|
242
222
|
title: params.data.xAxis,
|
|
243
223
|
content: (_params$data$tooltipD = params.data.tooltipData) === null || _params$data$tooltipD === void 0 ? void 0 : _params$data$tooltipD.content
|
|
244
224
|
};
|
|
245
225
|
},
|
|
246
|
-
|
|
247
226
|
onCreated(chart) {
|
|
248
227
|
// These listeners are used to show/hide data tooltips
|
|
249
228
|
// when the mouse is hovered over the parent container
|
|
250
229
|
// of echarts' svg element. This works only for data points
|
|
251
230
|
// and not markPoints.
|
|
252
231
|
chart.getDom().addEventListener('mousemove', this.debouncedShowHideTooltip);
|
|
253
|
-
chart.getDom().addEventListener('mouseout', this.debouncedShowHideTooltip);
|
|
232
|
+
chart.getDom().addEventListener('mouseout', this.debouncedShowHideTooltip);
|
|
233
|
+
|
|
234
|
+
// eCharts inbuild mouse events
|
|
254
235
|
// https://echarts.apache.org/en/api.html#events.Mouse%20events
|
|
255
236
|
// is used to attach listeners to markPoints. These listeners
|
|
256
237
|
// are currently used for annotation arrows at the bottom of the chart.
|
|
238
|
+
|
|
257
239
|
// Because data points and annotations arrows are in different
|
|
258
240
|
// sections of the charts with their own mouseovers and mouseouts,
|
|
259
241
|
// there shouldn't be an overlapping situation where both tooltips
|
|
@@ -263,11 +245,9 @@ var script = {
|
|
|
263
245
|
chart.on('mouseout', this.onChartDataPointMouseOut);
|
|
264
246
|
chart.on('mouseover', this.onChartDataPointMouseOver);
|
|
265
247
|
}
|
|
266
|
-
|
|
267
248
|
this.chart = chart;
|
|
268
249
|
this.$emit('created', chart);
|
|
269
250
|
},
|
|
270
|
-
|
|
271
251
|
showHideTooltip(mouseEvent) {
|
|
272
252
|
this.showDataTooltip = this.chart.containPixel('grid', [mouseEvent.zrX, mouseEvent.zrY]);
|
|
273
253
|
this.dataTooltipPosition = {
|
|
@@ -275,11 +255,9 @@ var script = {
|
|
|
275
255
|
top: `${mouseEvent.zrY}px`
|
|
276
256
|
};
|
|
277
257
|
},
|
|
278
|
-
|
|
279
258
|
onChartDataPointMouseOut() {
|
|
280
259
|
this.showAnnotationsTooltip = false;
|
|
281
260
|
},
|
|
282
|
-
|
|
283
261
|
/**
|
|
284
262
|
* Check if the hovered data point is an annotation
|
|
285
263
|
* point to show the annotation tooltip.
|
|
@@ -303,11 +281,9 @@ var script = {
|
|
|
303
281
|
};
|
|
304
282
|
}
|
|
305
283
|
},
|
|
306
|
-
|
|
307
284
|
onLabelChange(params) {
|
|
308
285
|
this.selectedFormatTooltipText(params);
|
|
309
286
|
}
|
|
310
|
-
|
|
311
287
|
}
|
|
312
288
|
};
|
|
313
289
|
|