@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
|
@@ -11,21 +11,19 @@ const pad = function (val) {
|
|
|
11
11
|
let len = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
12
12
|
return `0${val}`.slice(-len);
|
|
13
13
|
};
|
|
14
|
+
|
|
14
15
|
/**
|
|
15
16
|
* Used `onSelect` method in pickaday
|
|
16
17
|
* @param {Date} date UTC format
|
|
17
18
|
* @return {String} Date formated in yyyy-mm-dd
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
20
|
const defaultDateFormatter = date => {
|
|
21
21
|
const day = pad(date.getDate());
|
|
22
22
|
const month = pad(date.getMonth() + 1);
|
|
23
23
|
const year = date.getFullYear();
|
|
24
24
|
return `${year}-${month}-${day}`;
|
|
25
25
|
};
|
|
26
|
-
|
|
27
26
|
const isBefore = (compareTo, date) => compareTo && date && date.getTime() < compareTo.getTime();
|
|
28
|
-
|
|
29
27
|
const highlightPastDates = pikaday => {
|
|
30
28
|
const pikaButtons = pikaday.el.querySelectorAll('.pika-button');
|
|
31
29
|
const today = new Date();
|
|
@@ -36,13 +34,11 @@ const highlightPastDates = pikaday => {
|
|
|
36
34
|
pikaDay
|
|
37
35
|
} = pikaButton.dataset;
|
|
38
36
|
const pikaButtonDate = new Date(pikaYear, pikaMonth, pikaDay);
|
|
39
|
-
|
|
40
37
|
if (isBefore(today, pikaButtonDate)) {
|
|
41
38
|
pikaButton.classList.add('is-past-date');
|
|
42
39
|
}
|
|
43
40
|
});
|
|
44
41
|
};
|
|
45
|
-
|
|
46
42
|
var script = {
|
|
47
43
|
components: {
|
|
48
44
|
GlFormInput,
|
|
@@ -58,7 +54,6 @@ var script = {
|
|
|
58
54
|
required: false,
|
|
59
55
|
default: ''
|
|
60
56
|
},
|
|
61
|
-
|
|
62
57
|
/**
|
|
63
58
|
* DOM node to render calendar into. Defaults to the datepicker container. Pass `null` to use Pikaday default.
|
|
64
59
|
*/
|
|
@@ -92,7 +87,6 @@ var script = {
|
|
|
92
87
|
required: false,
|
|
93
88
|
default: null
|
|
94
89
|
},
|
|
95
|
-
|
|
96
90
|
/**
|
|
97
91
|
* Accepts a function that accepts a date as argument and returns true if the date is disabled.
|
|
98
92
|
*/
|
|
@@ -116,7 +110,6 @@ var script = {
|
|
|
116
110
|
required: false,
|
|
117
111
|
default: defaultDateFormat
|
|
118
112
|
},
|
|
119
|
-
|
|
120
113
|
/**
|
|
121
114
|
* Defaults to `off` when datepicker opens on focus, otherwise defaults to `null`.
|
|
122
115
|
*/
|
|
@@ -140,7 +133,6 @@ var script = {
|
|
|
140
133
|
required: false,
|
|
141
134
|
default: false
|
|
142
135
|
},
|
|
143
|
-
|
|
144
136
|
/**
|
|
145
137
|
* Use this prop to set the initial date for the datepicker.
|
|
146
138
|
*/
|
|
@@ -180,46 +172,36 @@ var script = {
|
|
|
180
172
|
default: null
|
|
181
173
|
}
|
|
182
174
|
},
|
|
183
|
-
|
|
184
175
|
data() {
|
|
185
176
|
return {
|
|
186
177
|
textInput: ''
|
|
187
178
|
};
|
|
188
179
|
},
|
|
189
|
-
|
|
190
180
|
computed: {
|
|
191
181
|
formattedDate() {
|
|
192
182
|
return 'calendar' in this && this.calendar.toString();
|
|
193
183
|
},
|
|
194
|
-
|
|
195
184
|
customTrigger() {
|
|
196
185
|
return _isString(this.target) && this.target !== '';
|
|
197
186
|
},
|
|
198
|
-
|
|
199
187
|
triggerOnFocus() {
|
|
200
188
|
return this.target === null;
|
|
201
189
|
},
|
|
202
|
-
|
|
203
190
|
showDefaultField() {
|
|
204
191
|
return !this.customTrigger || this.triggerOnFocus;
|
|
205
192
|
},
|
|
206
|
-
|
|
207
193
|
renderClearButton() {
|
|
208
194
|
return this.showClearButton && this.textInput !== '' && !this.disabled;
|
|
209
195
|
},
|
|
210
|
-
|
|
211
196
|
inputAutocomplete() {
|
|
212
197
|
if (this.autocomplete !== '') {
|
|
213
198
|
return this.autocomplete;
|
|
214
199
|
}
|
|
215
|
-
|
|
216
200
|
if (this.triggerOnFocus) {
|
|
217
201
|
return 'off';
|
|
218
202
|
}
|
|
219
|
-
|
|
220
203
|
return null;
|
|
221
204
|
}
|
|
222
|
-
|
|
223
205
|
},
|
|
224
206
|
watch: {
|
|
225
207
|
value(val) {
|
|
@@ -227,25 +209,19 @@ var script = {
|
|
|
227
209
|
this.calendar.setDate(val, true);
|
|
228
210
|
}
|
|
229
211
|
},
|
|
230
|
-
|
|
231
212
|
minDate(minDate) {
|
|
232
213
|
this.calendar.setMinDate(minDate);
|
|
233
214
|
},
|
|
234
|
-
|
|
235
215
|
maxDate(maxDate) {
|
|
236
216
|
this.calendar.setMaxDate(maxDate);
|
|
237
217
|
},
|
|
238
|
-
|
|
239
218
|
startRange(startRange) {
|
|
240
219
|
this.calendar.setStartRange(startRange);
|
|
241
220
|
},
|
|
242
|
-
|
|
243
221
|
endRange(endRange) {
|
|
244
222
|
this.calendar.setEndRange(endRange);
|
|
245
223
|
}
|
|
246
|
-
|
|
247
224
|
},
|
|
248
|
-
|
|
249
225
|
mounted() {
|
|
250
226
|
const $parentEl = this.$parent.$el;
|
|
251
227
|
const drawEvent = this.draw.bind(this);
|
|
@@ -274,44 +250,40 @@ var script = {
|
|
|
274
250
|
highlightPastDates(pikaday);
|
|
275
251
|
drawEvent();
|
|
276
252
|
}
|
|
277
|
-
};
|
|
253
|
+
};
|
|
278
254
|
|
|
255
|
+
// Pass `null` as `target` prop to use the `field` as the trigger (open on focus)
|
|
279
256
|
if (!this.triggerOnFocus && !this.disabled) {
|
|
280
257
|
const trigger = this.customTrigger ? $parentEl.querySelector(this.target) : this.$refs.calendarTriggerBtn.$el;
|
|
281
|
-
pikadayConfig.trigger = trigger;
|
|
258
|
+
pikadayConfig.trigger = trigger;
|
|
282
259
|
|
|
260
|
+
// Set `trigger` as the `field` if `field` element doesn't exist (not passed via the slot)
|
|
283
261
|
if (!pikadayConfig.field && this.customTrigger) {
|
|
284
262
|
pikadayConfig.field = trigger;
|
|
285
263
|
}
|
|
286
|
-
}
|
|
287
|
-
|
|
264
|
+
}
|
|
288
265
|
|
|
266
|
+
// Pass `null` as `container` prop to prevent passing the `container` option to Pikaday
|
|
289
267
|
if (this.container !== null) {
|
|
290
268
|
const container = this.container ? $parentEl.querySelector(this.container) : this.$el;
|
|
291
269
|
pikadayConfig.container = container;
|
|
292
270
|
}
|
|
293
|
-
|
|
294
271
|
if (this.i18n) {
|
|
295
272
|
pikadayConfig.i18n = this.i18n;
|
|
296
273
|
}
|
|
297
|
-
|
|
298
274
|
this.calendar = new Pikaday(pikadayConfig);
|
|
299
|
-
|
|
300
275
|
if (this.startOpened) {
|
|
301
276
|
this.calendar.show();
|
|
302
277
|
}
|
|
303
278
|
},
|
|
304
|
-
|
|
305
279
|
beforeDestroy() {
|
|
306
280
|
this.calendar.destroy();
|
|
307
281
|
},
|
|
308
|
-
|
|
309
282
|
methods: {
|
|
310
283
|
// is used to open datepicker programmatically
|
|
311
284
|
show() {
|
|
312
285
|
this.calendar.show();
|
|
313
286
|
},
|
|
314
|
-
|
|
315
287
|
selected(date) {
|
|
316
288
|
/**
|
|
317
289
|
* Emitted when a new date has been selected.
|
|
@@ -319,37 +291,31 @@ var script = {
|
|
|
319
291
|
*/
|
|
320
292
|
this.$emit('input', date);
|
|
321
293
|
},
|
|
322
|
-
|
|
323
294
|
closed() {
|
|
324
295
|
/**
|
|
325
296
|
* Emitted when the datepicker is hidden.
|
|
326
297
|
*/
|
|
327
298
|
this.$emit('close');
|
|
328
299
|
},
|
|
329
|
-
|
|
330
300
|
opened() {
|
|
331
301
|
/**
|
|
332
302
|
* Emitted when the datepicker becomes visible.
|
|
333
303
|
*/
|
|
334
304
|
this.$emit('open');
|
|
335
305
|
},
|
|
336
|
-
|
|
337
306
|
cleared() {
|
|
338
307
|
this.textInput = '';
|
|
339
308
|
/**
|
|
340
309
|
* Emitted when the clear button is clicked.
|
|
341
310
|
*/
|
|
342
|
-
|
|
343
311
|
this.$emit('clear');
|
|
344
312
|
},
|
|
345
|
-
|
|
346
313
|
draw() {
|
|
347
314
|
/**
|
|
348
315
|
* Emitted when the datepicker draws a new month.
|
|
349
316
|
*/
|
|
350
317
|
this.$emit('monthChange');
|
|
351
318
|
},
|
|
352
|
-
|
|
353
319
|
onKeydown() {
|
|
354
320
|
if (this.textInput === '') {
|
|
355
321
|
const resetDate = this.minDate || null;
|
|
@@ -357,7 +323,6 @@ var script = {
|
|
|
357
323
|
this.selected(resetDate);
|
|
358
324
|
}
|
|
359
325
|
}
|
|
360
|
-
|
|
361
326
|
}
|
|
362
327
|
};
|
|
363
328
|
|
|
@@ -103,7 +103,6 @@ var script = {
|
|
|
103
103
|
required: false,
|
|
104
104
|
default: false
|
|
105
105
|
},
|
|
106
|
-
|
|
107
106
|
/**
|
|
108
107
|
* If provided, renders an info icon with a tooltip.
|
|
109
108
|
*/
|
|
@@ -112,7 +111,6 @@ var script = {
|
|
|
112
111
|
required: false,
|
|
113
112
|
default: ''
|
|
114
113
|
},
|
|
115
|
-
|
|
116
114
|
/**
|
|
117
115
|
* Additional class(es) to apply to the date range indicator section.
|
|
118
116
|
*/
|
|
@@ -122,7 +120,6 @@ var script = {
|
|
|
122
120
|
default: ''
|
|
123
121
|
}
|
|
124
122
|
},
|
|
125
|
-
|
|
126
123
|
data() {
|
|
127
124
|
return {
|
|
128
125
|
fromCalendarMaxDate: this.defaultMaxDate ? getDateInPast(this.defaultMaxDate, 1) : null,
|
|
@@ -131,52 +128,41 @@ var script = {
|
|
|
131
128
|
openToCalendar: false
|
|
132
129
|
};
|
|
133
130
|
},
|
|
134
|
-
|
|
135
131
|
computed: {
|
|
136
132
|
effectiveMaxDateRange() {
|
|
137
133
|
return this.sameDaySelection ? this.maxDateRange - 1 : this.maxDateRange;
|
|
138
134
|
},
|
|
139
|
-
|
|
140
135
|
toCalendarMinDate() {
|
|
141
136
|
if (!this.startDate) return null;
|
|
142
137
|
return this.sameDaySelection ? this.startDate : getDateInFuture(this.startDate, 1);
|
|
143
138
|
},
|
|
144
|
-
|
|
145
139
|
toCalendarMaxDate() {
|
|
146
140
|
if (!this.startDate || !this.maxDateRange) return this.defaultMaxDate;
|
|
147
141
|
const computedMaxEndDate = getDateInFuture(this.startDate, this.effectiveMaxDateRange);
|
|
148
142
|
return new Date(Math.min(computedMaxEndDate, this.defaultMaxDate));
|
|
149
143
|
},
|
|
150
|
-
|
|
151
144
|
dateRangeViolation() {
|
|
152
145
|
return this.startDate >= this.endDate || this.exceedsDateRange;
|
|
153
146
|
},
|
|
154
|
-
|
|
155
147
|
exceedsDateRange() {
|
|
156
148
|
if (this.numberOfDays < 0) {
|
|
157
149
|
return false;
|
|
158
150
|
}
|
|
159
|
-
|
|
160
151
|
return this.maxDateRange && this.numberOfDays > this.maxDateRange;
|
|
161
152
|
},
|
|
162
|
-
|
|
163
153
|
toCalendarDefaultDate() {
|
|
164
154
|
return this.endDate || this.toCalendarMinDate;
|
|
165
155
|
},
|
|
166
|
-
|
|
167
156
|
numericStartTime() {
|
|
168
157
|
return this.startDate ? this.startDate.getTime() : null;
|
|
169
158
|
},
|
|
170
|
-
|
|
171
159
|
numberOfDays() {
|
|
172
160
|
if (!this.startDate || !this.endDate) {
|
|
173
161
|
return -1;
|
|
174
162
|
}
|
|
175
|
-
|
|
176
163
|
const numberOfDays = getDayDifference(this.startDate, this.endDate);
|
|
177
164
|
return this.sameDaySelection ? numberOfDays + 1 : numberOfDays;
|
|
178
165
|
}
|
|
179
|
-
|
|
180
166
|
},
|
|
181
167
|
watch: {
|
|
182
168
|
value(val) {
|
|
@@ -187,12 +173,10 @@ var script = {
|
|
|
187
173
|
this.startDate = startDate;
|
|
188
174
|
this.endDate = endDate;
|
|
189
175
|
}
|
|
190
|
-
|
|
191
176
|
},
|
|
192
177
|
methods: {
|
|
193
178
|
onStartDateSelected(startDate) {
|
|
194
179
|
this.startDate = startDate;
|
|
195
|
-
|
|
196
180
|
if (this.dateRangeViolation) {
|
|
197
181
|
this.openToCalendar = true;
|
|
198
182
|
this.endDate = null;
|
|
@@ -201,7 +185,6 @@ var script = {
|
|
|
201
185
|
endDate: this.endDate
|
|
202
186
|
});
|
|
203
187
|
},
|
|
204
|
-
|
|
205
188
|
onEndDateSelected(endDate) {
|
|
206
189
|
this.openToCalendar = false;
|
|
207
190
|
this.endDate = endDate;
|
|
@@ -210,13 +193,11 @@ var script = {
|
|
|
210
193
|
*
|
|
211
194
|
* @event input
|
|
212
195
|
* */
|
|
213
|
-
|
|
214
196
|
this.$emit('input', {
|
|
215
197
|
startDate: this.startDate,
|
|
216
198
|
endDate
|
|
217
199
|
});
|
|
218
200
|
},
|
|
219
|
-
|
|
220
201
|
onStartPickerOpen() {
|
|
221
202
|
/**
|
|
222
203
|
* Emitted when the primary action button is clicked.
|
|
@@ -225,7 +206,6 @@ var script = {
|
|
|
225
206
|
* */
|
|
226
207
|
this.$emit('start-picker-open');
|
|
227
208
|
},
|
|
228
|
-
|
|
229
209
|
onStartPickerClose() {
|
|
230
210
|
/**
|
|
231
211
|
* Emitted when the start date datepicker is hidden.
|
|
@@ -234,7 +214,6 @@ var script = {
|
|
|
234
214
|
* */
|
|
235
215
|
this.$emit('start-picker-close');
|
|
236
216
|
},
|
|
237
|
-
|
|
238
217
|
onEndPickerOpen() {
|
|
239
218
|
/**
|
|
240
219
|
* Emitted when the end date datepicker becomes visible.
|
|
@@ -243,7 +222,6 @@ var script = {
|
|
|
243
222
|
* */
|
|
244
223
|
this.$emit('end-picker-open');
|
|
245
224
|
},
|
|
246
|
-
|
|
247
225
|
onEndPickerClose() {
|
|
248
226
|
/**
|
|
249
227
|
* Emitted when the end date datepicker is hidden.
|
|
@@ -252,7 +230,6 @@ var script = {
|
|
|
252
230
|
* */
|
|
253
231
|
this.$emit('end-picker-close');
|
|
254
232
|
}
|
|
255
|
-
|
|
256
233
|
}
|
|
257
234
|
};
|
|
258
235
|
|
|
@@ -39,40 +39,32 @@ var script = {
|
|
|
39
39
|
positionFromTop() {
|
|
40
40
|
return !isEmpty(this.headerHeight) ? this.headerHeight : 0;
|
|
41
41
|
},
|
|
42
|
-
|
|
43
42
|
drawerStyles() {
|
|
44
43
|
const styles = {
|
|
45
44
|
top: this.positionFromTop,
|
|
46
45
|
zIndex: this.zIndex
|
|
47
46
|
};
|
|
48
|
-
|
|
49
47
|
if (this.positionFromTop) {
|
|
50
48
|
styles.maxHeight = `calc(100vh - ${this.positionFromTop})`;
|
|
51
49
|
}
|
|
52
|
-
|
|
53
50
|
return styles;
|
|
54
51
|
},
|
|
55
|
-
|
|
56
52
|
drawerHeaderStyles() {
|
|
57
53
|
return {
|
|
58
54
|
zIndex: this.headerSticky ? maxZIndex : null
|
|
59
55
|
};
|
|
60
56
|
},
|
|
61
|
-
|
|
62
57
|
shouldRenderFooter() {
|
|
63
58
|
// eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
|
|
64
59
|
return Boolean(this.$slots.footer);
|
|
65
60
|
},
|
|
66
|
-
|
|
67
61
|
variantClass() {
|
|
68
62
|
return `gl-drawer-${this.variant}`;
|
|
69
63
|
}
|
|
70
|
-
|
|
71
64
|
},
|
|
72
65
|
watch: {
|
|
73
66
|
open: {
|
|
74
67
|
immediate: true,
|
|
75
|
-
|
|
76
68
|
handler(open) {
|
|
77
69
|
if (open) {
|
|
78
70
|
document.addEventListener('keydown', this.handleEscape);
|
|
@@ -80,23 +72,18 @@ var script = {
|
|
|
80
72
|
document.removeEventListener('keydown', this.handleEscape);
|
|
81
73
|
}
|
|
82
74
|
}
|
|
83
|
-
|
|
84
75
|
}
|
|
85
76
|
},
|
|
86
|
-
|
|
87
77
|
beforeDestroy() {
|
|
88
78
|
document.removeEventListener('keydown', this.handleEscape);
|
|
89
79
|
},
|
|
90
|
-
|
|
91
80
|
methods: {
|
|
92
81
|
handleEscape(e) {
|
|
93
82
|
const ESC = 27;
|
|
94
|
-
|
|
95
83
|
if (this.open && e.keyCode === ESC) {
|
|
96
84
|
this.$emit('close');
|
|
97
85
|
}
|
|
98
86
|
}
|
|
99
|
-
|
|
100
87
|
}
|
|
101
88
|
};
|
|
102
89
|
|
|
@@ -10,20 +10,20 @@ import GlLoadingIcon from '../loading_icon/loading_icon';
|
|
|
10
10
|
import GlDropdownDivider from './dropdown_divider';
|
|
11
11
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
12
12
|
|
|
13
|
+
// Return an Array of visible items
|
|
13
14
|
function filterVisible(els) {
|
|
14
15
|
return (els || []).filter(isVisible);
|
|
15
16
|
}
|
|
16
|
-
|
|
17
17
|
const Selector = {
|
|
18
18
|
ITEM_SELECTOR: '.dropdown-item:not(.disabled):not([disabled]),.form-control:not(.disabled):not([disabled])'
|
|
19
|
-
};
|
|
19
|
+
};
|
|
20
20
|
|
|
21
|
+
// see https://gitlab.com/gitlab-org/gitlab-ui/merge_requests/130#note_126406721
|
|
21
22
|
const ExtendedBDropdown = Vue.extend(BDropdown, {
|
|
22
23
|
methods: {
|
|
23
24
|
getItems() {
|
|
24
25
|
return filterVisible(selectAll(Selector.ITEM_SELECTOR, this.$refs.menu));
|
|
25
26
|
}
|
|
26
|
-
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
const DefaultPopperOptions = {
|
|
@@ -157,19 +157,14 @@ var script = {
|
|
|
157
157
|
renderCaret() {
|
|
158
158
|
return !this.split;
|
|
159
159
|
},
|
|
160
|
-
|
|
161
160
|
isIconOnly() {
|
|
162
161
|
var _this$text;
|
|
163
|
-
|
|
164
162
|
return Boolean(this.icon && (!((_this$text = this.text) !== null && _this$text !== void 0 && _this$text.length) || this.textSrOnly) && !this.hasSlotContents('button-text'));
|
|
165
163
|
},
|
|
166
|
-
|
|
167
164
|
isIconWithText() {
|
|
168
165
|
var _this$text2;
|
|
169
|
-
|
|
170
166
|
return Boolean(this.icon && ((_this$text2 = this.text) === null || _this$text2 === void 0 ? void 0 : _this$text2.length) && !this.textSrOnly);
|
|
171
167
|
},
|
|
172
|
-
|
|
173
168
|
toggleButtonClasses() {
|
|
174
169
|
return [this.toggleClass, {
|
|
175
170
|
'gl-button': true,
|
|
@@ -180,7 +175,6 @@ var script = {
|
|
|
180
175
|
'dropdown-icon-text': this.isIconWithText
|
|
181
176
|
}];
|
|
182
177
|
},
|
|
183
|
-
|
|
184
178
|
splitButtonClasses() {
|
|
185
179
|
return [this.toggleClass, {
|
|
186
180
|
'gl-button': true,
|
|
@@ -189,38 +183,30 @@ var script = {
|
|
|
189
183
|
[`btn-${this.variant}-secondary`]: this.category === buttonCategoryOptions.secondary || this.category === buttonCategoryOptions.tertiary
|
|
190
184
|
}];
|
|
191
185
|
},
|
|
192
|
-
|
|
193
186
|
buttonText() {
|
|
194
187
|
return this.split && this.icon ? null : this.text;
|
|
195
188
|
},
|
|
196
|
-
|
|
197
189
|
hasHighlightedItemsContent() {
|
|
198
190
|
return this.hasSlotContents('highlighted-items');
|
|
199
191
|
},
|
|
200
|
-
|
|
201
192
|
hasHighlightedItemsOrClearAll() {
|
|
202
193
|
return this.hasHighlightedItemsContent && this.showHighlightedItemsTitle || this.showClearAll;
|
|
203
194
|
},
|
|
204
|
-
|
|
205
195
|
popperOptions() {
|
|
206
196
|
return _merge({}, DefaultPopperOptions, this.popperOpts);
|
|
207
197
|
}
|
|
208
|
-
|
|
209
198
|
},
|
|
210
199
|
methods: {
|
|
211
200
|
hasSlotContents(slotName) {
|
|
212
201
|
// eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
|
|
213
202
|
return Boolean(this.$slots[slotName]);
|
|
214
203
|
},
|
|
215
|
-
|
|
216
204
|
show() {
|
|
217
205
|
this.$refs.dropdown.show(...arguments);
|
|
218
206
|
},
|
|
219
|
-
|
|
220
207
|
hide() {
|
|
221
208
|
this.$refs.dropdown.hide(...arguments);
|
|
222
209
|
}
|
|
223
|
-
|
|
224
210
|
}
|
|
225
211
|
};
|
|
226
212
|
|
|
@@ -64,33 +64,27 @@ var script = {
|
|
|
64
64
|
const {
|
|
65
65
|
href,
|
|
66
66
|
to
|
|
67
|
-
} = this.$attrs;
|
|
68
|
-
|
|
67
|
+
} = this.$attrs;
|
|
68
|
+
// Support 'href' and Vue Router's 'to'
|
|
69
69
|
return href || to ? BDropdownItem : BDropdownItemButton;
|
|
70
70
|
},
|
|
71
|
-
|
|
72
71
|
iconColorCss() {
|
|
73
72
|
return variantCssColorMap[this.iconColor] || 'gl-text-gray-700';
|
|
74
73
|
},
|
|
75
|
-
|
|
76
74
|
shouldShowCheckIcon() {
|
|
77
75
|
return this.isChecked || this.isCheckItem;
|
|
78
76
|
},
|
|
79
|
-
|
|
80
77
|
checkedClasses() {
|
|
81
78
|
if (this.isCheckCentered) {
|
|
82
79
|
return '';
|
|
83
80
|
}
|
|
84
|
-
|
|
85
81
|
return 'gl-mt-3 gl-align-self-start';
|
|
86
82
|
}
|
|
87
|
-
|
|
88
83
|
},
|
|
89
84
|
methods: {
|
|
90
85
|
handleClickIconRight() {
|
|
91
86
|
this.$emit('click-icon-right');
|
|
92
87
|
}
|
|
93
|
-
|
|
94
88
|
}
|
|
95
89
|
};
|
|
96
90
|
|