@gitlab/ui 137.3.1 → 138.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -12
- package/dist/components/base/alert/alert.js +0 -1
- package/dist/components/base/drawer/drawer.js +0 -1
- package/dist/components/base/filtered_search/filtered_search_suggestion_list.js +1 -1
- package/dist/components/base/filtered_search/filtered_search_token_segment.js +0 -1
- package/dist/components/base/form/form_group/form_group.js +0 -1
- package/dist/components/base/form/form_select/form_select.js +322 -6
- package/dist/components/base/modal/modal.js +1 -5
- package/dist/components/base/new_dropdowns/base_dropdown/dropdown_container.js +1 -1
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown.js +1 -3
- package/dist/components/base/toast/index.js +1 -1
- package/dist/components/base/toggle/toggle.js +0 -1
- package/dist/components/mixins/tooltip_mixin.js +1 -1
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/dist/tokens/build/js/tokens.dark.js +299 -299
- package/dist/tokens/build/js/tokens.js +302 -302
- package/dist/utils/confetti/confetti.js +189 -0
- package/dist/utils/confetti/constants.js +36 -0
- package/dist/utils/confetti/field.js +114 -0
- package/dist/utils/confetti/palette.js +6 -0
- package/dist/utils/confetti/particles.js +92 -0
- package/dist/utils/matrix/columns.js +54 -0
- package/dist/utils/matrix/constants.js +19 -0
- package/dist/utils/matrix/matrix.js +157 -0
- package/dist/utils/matrix/palette.js +9 -0
- package/dist/utils.js +2 -0
- package/dist/vendor/bootstrap-vue/src/components/popover/helpers/bv-popover-template.js +4 -2
- package/dist/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip-template.js +3 -1
- package/dist/vendor/bootstrap-vue/src/constants/components.js +1 -4
- package/package.json +4 -11
- package/src/components/base/alert/alert.vue +0 -1
- package/src/components/base/drawer/drawer.vue +0 -1
- package/src/components/base/filtered_search/filtered_search_suggestion_list.vue +2 -1
- package/src/components/base/filtered_search/filtered_search_token_segment.vue +0 -1
- package/src/components/base/form/form_group/form_group.vue +0 -2
- package/src/components/base/form/form_select/form_select.vue +389 -10
- package/src/components/base/modal/modal.vue +0 -3
- package/src/components/base/new_dropdowns/base_dropdown/dropdown_container.js +1 -1
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.vue +0 -1
- package/src/components/base/tabs/tabs/scrollable_tabs.vue +0 -1
- package/src/components/base/tabs/tabs/tabs.vue +0 -1
- package/src/components/base/toast/index.js +1 -1
- package/src/components/base/toggle/toggle.vue +0 -1
- package/src/components/charts/heatmap/index.js +1 -1
- package/src/components/mixins/tooltip_mixin.js +1 -1
- package/src/tokens/build/css/tokens.css +74 -74
- package/src/tokens/build/css/tokens.dark.css +70 -70
- package/src/tokens/build/docs/tokens-tailwind-docs.dark.json +303 -303
- package/src/tokens/build/docs/tokens-tailwind-docs.json +323 -323
- package/src/tokens/build/figma/constants.dark.json +207 -207
- package/src/tokens/build/figma/constants.json +207 -207
- package/src/tokens/build/figma/mode.dark.json +37 -37
- package/src/tokens/build/figma/mode.json +35 -35
- package/src/tokens/build/js/tokens.dark.js +299 -300
- package/src/tokens/build/js/tokens.js +302 -303
- package/src/tokens/build/json/tokens.dark.json +369 -369
- package/src/tokens/build/json/tokens.json +376 -376
- package/src/tokens/build/scss/_tokens.dark.scss +70 -70
- package/src/tokens/build/scss/_tokens.scss +74 -74
- package/src/tokens/constant/color.blue.tokens.json +39 -39
- package/src/tokens/constant/color.green.tokens.json +41 -41
- package/src/tokens/constant/color.orange.tokens.json +43 -43
- package/src/tokens/constant/color.purple.tokens.json +40 -40
- package/src/tokens/constant/color.red.tokens.json +44 -44
- package/src/tokens/contextual/avatar.tokens.json +13 -13
- package/src/tokens/contextual/button.tokens.json +22 -22
- package/src/tokens/contextual/chart.tokens.json +3 -3
- package/src/tokens/semantic/action.tokens.json +18 -18
- package/src/utils/confetti/confetti.js +191 -0
- package/src/utils/confetti/constants.js +42 -0
- package/src/utils/confetti/field.js +134 -0
- package/src/utils/confetti/palette.js +15 -0
- package/src/utils/confetti/particles.js +98 -0
- package/src/utils/matrix/columns.js +53 -0
- package/src/utils/matrix/constants.js +19 -0
- package/src/utils/matrix/matrix.js +185 -0
- package/src/utils/matrix/palette.js +18 -0
- package/src/utils.js +2 -0
- package/src/vendor/bootstrap-vue/src/components/popover/helpers/bv-popover-template.js +7 -2
- package/src/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip-template.js +2 -1
- package/src/vendor/bootstrap-vue/src/constants/components.js +0 -3
- package/translations.js +1 -1
- package/dist/vendor/bootstrap-vue/src/components/form-select/form-select-option-group.js +0 -51
- package/dist/vendor/bootstrap-vue/src/components/form-select/form-select-option.js +0 -41
- package/dist/vendor/bootstrap-vue/src/components/form-select/form-select.js +0 -153
- package/dist/vendor/bootstrap-vue/src/components/form-select/helpers/mixin-options.js +0 -63
- package/dist/vendor/bootstrap-vue/src/components/form-select/index.js +0 -3
- package/src/vendor/bootstrap-vue/src/components/form-select/form-select-option-group.js +0 -46
- package/src/vendor/bootstrap-vue/src/components/form-select/form-select-option.js +0 -35
- package/src/vendor/bootstrap-vue/src/components/form-select/form-select.js +0 -156
- package/src/vendor/bootstrap-vue/src/components/form-select/helpers/mixin-options.js +0 -60
- package/src/vendor/bootstrap-vue/src/components/form-select/index.js +0 -5
package/README.md
CHANGED
|
@@ -48,20 +48,11 @@ See <https://design.gitlab.com/storybook> for documentation.
|
|
|
48
48
|
[GitPod](https://www.gitpod.io/docs/configure/authentication/gitlab) can be used to set up a
|
|
49
49
|
UNIX-like environment in which to build it.
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
Complete the [project setup](../../README.md#project-setup) in the repository root README, then
|
|
52
|
+
build and launch Storybook:
|
|
53
53
|
|
|
54
54
|
```sh
|
|
55
|
-
|
|
56
|
-
git clone git@gitlab.com:gitlab-org/gitlab-services/design.gitlab.com.git
|
|
57
|
-
|
|
58
|
-
# Navigate to the root of the project
|
|
59
|
-
cd design.gitlab.com/packages/gitlab-ui
|
|
60
|
-
|
|
61
|
-
# Install all the dependencies of the project
|
|
62
|
-
yarn # or yarn install
|
|
63
|
-
|
|
64
|
-
# Build and launch storybook to see the components in the browser
|
|
55
|
+
cd packages/gitlab-ui
|
|
65
56
|
yarn storybook
|
|
66
57
|
```
|
|
67
58
|
|
|
@@ -136,7 +136,6 @@ var script = {
|
|
|
136
136
|
return alertVariantIconMap[this.variant];
|
|
137
137
|
},
|
|
138
138
|
shouldRenderActions() {
|
|
139
|
-
// eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
|
|
140
139
|
return Boolean(this.$slots.actions || this.actionButtons.length);
|
|
141
140
|
},
|
|
142
141
|
actionButtons() {
|
|
@@ -104,7 +104,7 @@ var script = {
|
|
|
104
104
|
const __vue_script__ = script;
|
|
105
105
|
|
|
106
106
|
/* template */
|
|
107
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('ul',{class:_vm.listClasses},[_c('li',{ref:"top"}),_vm._v(" "),_vm._t("default")],2)};
|
|
107
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('ul',{class:_vm.listClasses},[_c('li',{ref:"top",attrs:{"aria-hidden":"true","role":"presentation"}}),_vm._v(" "),_vm._t("default")],2)};
|
|
108
108
|
var __vue_staticRenderFns__ = [];
|
|
109
109
|
|
|
110
110
|
/* style */
|
|
@@ -224,7 +224,6 @@ var script = {
|
|
|
224
224
|
},
|
|
225
225
|
hasOptionsOrSuggestions() {
|
|
226
226
|
var _this$options2;
|
|
227
|
-
// eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
|
|
228
227
|
return ((_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.length) || isSlotNotEmpty(this.$slots.suggestions);
|
|
229
228
|
},
|
|
230
229
|
defaultSuggestedValue() {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { isObject } from 'lodash-es';
|
|
2
|
-
import { BFormSelect } from '../../../../vendor/bootstrap-vue/src/components/form-select/form-select';
|
|
1
|
+
import { isObject, isBoolean, uniqueId, isPlainObject, get, isNull, isUndefined } from 'lodash-es';
|
|
3
2
|
import { formInputWidths } from '../../../../utils/constants';
|
|
3
|
+
import { isVisible } from '../../../../utils/utils';
|
|
4
|
+
import { SafeHtmlDirective } from '../../../../directives/safe_html/safe_html';
|
|
4
5
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
5
6
|
|
|
6
7
|
function _arrayLikeToArray(r, a) {
|
|
@@ -75,13 +76,180 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
75
76
|
const _excluded = ["default"];
|
|
76
77
|
var script = {
|
|
77
78
|
name: 'GlFormSelect',
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
directives: {
|
|
80
|
+
SafeHtml: SafeHtmlDirective
|
|
80
81
|
},
|
|
81
82
|
inheritAttrs: false,
|
|
82
83
|
props: {
|
|
83
84
|
/**
|
|
84
|
-
*
|
|
85
|
+
* Current value of the select. Should be set to an array when the 'multiple' prop is set
|
|
86
|
+
*/
|
|
87
|
+
value: {
|
|
88
|
+
// Value can be any type!
|
|
89
|
+
type: undefined,
|
|
90
|
+
required: false,
|
|
91
|
+
default: undefined
|
|
92
|
+
},
|
|
93
|
+
/**
|
|
94
|
+
* Array of items to render in the component
|
|
95
|
+
*/
|
|
96
|
+
options: {
|
|
97
|
+
type: [Array, Object],
|
|
98
|
+
required: false,
|
|
99
|
+
default: undefined
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* When set to a number larger than 0, will set the number of display option rows. Note not all browser will respect this setting
|
|
103
|
+
* @deprecated Only useful with `multiple`, which is also deprecated.
|
|
104
|
+
*/
|
|
105
|
+
selectSize: {
|
|
106
|
+
type: Number,
|
|
107
|
+
required: false,
|
|
108
|
+
default: 0
|
|
109
|
+
},
|
|
110
|
+
/**
|
|
111
|
+
* Used to set the `id` attribute on the rendered content, and used as the base to generate any additional element IDs as needed
|
|
112
|
+
*/
|
|
113
|
+
id: {
|
|
114
|
+
type: String,
|
|
115
|
+
required: false,
|
|
116
|
+
default: undefined
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* Render the form control in plain mode, rather than custom styled mode
|
|
120
|
+
* @deprecated Use a native <select> element instead.
|
|
121
|
+
*/
|
|
122
|
+
plain: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
required: false,
|
|
125
|
+
default: false
|
|
126
|
+
},
|
|
127
|
+
/**
|
|
128
|
+
* Set the size of the component's appearance. 'sm', 'md' (default), or 'lg'
|
|
129
|
+
* @deprecated Has no effect. Use the `width` prop instead.
|
|
130
|
+
*/
|
|
131
|
+
size: {
|
|
132
|
+
type: String,
|
|
133
|
+
required: false,
|
|
134
|
+
default: undefined
|
|
135
|
+
},
|
|
136
|
+
/**
|
|
137
|
+
* Optional value to set for the 'aria-invalid' attribute. Supported values are 'true' and 'false'. If not set, the 'state' prop will dictate the value
|
|
138
|
+
*/
|
|
139
|
+
ariaInvalid: {
|
|
140
|
+
type: [Boolean, String],
|
|
141
|
+
required: false,
|
|
142
|
+
default: false
|
|
143
|
+
},
|
|
144
|
+
/**
|
|
145
|
+
* Controls the validation state appearance of the component. `true` for valid, `false` for invalid, or `null` for no validation state
|
|
146
|
+
*/
|
|
147
|
+
state: {
|
|
148
|
+
// Tri-state prop: true, false, null (or undefined)
|
|
149
|
+
type: Boolean,
|
|
150
|
+
required: false,
|
|
151
|
+
default: null
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* Field name in the `options` array that should be used for the value
|
|
155
|
+
*/
|
|
156
|
+
valueField: {
|
|
157
|
+
type: String,
|
|
158
|
+
required: false,
|
|
159
|
+
default: 'value'
|
|
160
|
+
},
|
|
161
|
+
/**
|
|
162
|
+
* The key to use from the option object to get the label
|
|
163
|
+
*/
|
|
164
|
+
labelField: {
|
|
165
|
+
type: String,
|
|
166
|
+
required: false,
|
|
167
|
+
default: 'label'
|
|
168
|
+
},
|
|
169
|
+
/**
|
|
170
|
+
* The key to use from the option object to get the options
|
|
171
|
+
*/
|
|
172
|
+
optionsField: {
|
|
173
|
+
type: String,
|
|
174
|
+
required: false,
|
|
175
|
+
default: 'options'
|
|
176
|
+
},
|
|
177
|
+
/**
|
|
178
|
+
* Field name in the `options` array that should be used for the text label
|
|
179
|
+
*/
|
|
180
|
+
textField: {
|
|
181
|
+
type: String,
|
|
182
|
+
required: false,
|
|
183
|
+
default: 'text'
|
|
184
|
+
},
|
|
185
|
+
/**
|
|
186
|
+
* Field name in the `options` array that should be used for the disabled state
|
|
187
|
+
*/
|
|
188
|
+
disabledField: {
|
|
189
|
+
type: String,
|
|
190
|
+
required: false,
|
|
191
|
+
default: 'disabled'
|
|
192
|
+
},
|
|
193
|
+
/**
|
|
194
|
+
* Field name in the `options` array that should be used for the html label instead of text field
|
|
195
|
+
* @deprecated Using the `.html` field (whatever its name) is potentially unsafe.
|
|
196
|
+
*/
|
|
197
|
+
htmlField: {
|
|
198
|
+
type: String,
|
|
199
|
+
required: false,
|
|
200
|
+
default: 'html'
|
|
201
|
+
},
|
|
202
|
+
/**
|
|
203
|
+
* When set, allows multiple options to be selected (multi-select)
|
|
204
|
+
* @deprecated Use GlCollapsibleListbox instead.
|
|
205
|
+
*/
|
|
206
|
+
multiple: {
|
|
207
|
+
type: Boolean,
|
|
208
|
+
required: false,
|
|
209
|
+
default: false
|
|
210
|
+
},
|
|
211
|
+
/**
|
|
212
|
+
* When set to `true`, attempts to auto-focus the control when it is mounted, or re-activated when in a keep-alive. Does not set the `autofocus` attribute on the control
|
|
213
|
+
*/
|
|
214
|
+
autofocus: {
|
|
215
|
+
type: Boolean,
|
|
216
|
+
required: false,
|
|
217
|
+
default: false
|
|
218
|
+
},
|
|
219
|
+
/**
|
|
220
|
+
* When set to `true`, disables the component's functionality and places it in a disabled state
|
|
221
|
+
*/
|
|
222
|
+
disabled: {
|
|
223
|
+
type: Boolean,
|
|
224
|
+
required: false,
|
|
225
|
+
default: false
|
|
226
|
+
},
|
|
227
|
+
/**
|
|
228
|
+
* ID of the form that the form control belongs to. Sets the `form` attribute on the control
|
|
229
|
+
*/
|
|
230
|
+
form: {
|
|
231
|
+
type: String,
|
|
232
|
+
required: false,
|
|
233
|
+
default: undefined
|
|
234
|
+
},
|
|
235
|
+
/**
|
|
236
|
+
* Sets the value of the `name` attribute on the form control
|
|
237
|
+
*/
|
|
238
|
+
name: {
|
|
239
|
+
type: String,
|
|
240
|
+
required: false,
|
|
241
|
+
default: undefined
|
|
242
|
+
},
|
|
243
|
+
/**
|
|
244
|
+
* Adds the `required` attribute to the form control
|
|
245
|
+
*/
|
|
246
|
+
required: {
|
|
247
|
+
type: Boolean,
|
|
248
|
+
required: false,
|
|
249
|
+
default: false
|
|
250
|
+
},
|
|
251
|
+
/**
|
|
252
|
+
* Maximum width of the Select
|
|
85
253
|
*/
|
|
86
254
|
width: {
|
|
87
255
|
type: [String, Object],
|
|
@@ -101,7 +269,32 @@ var script = {
|
|
|
101
269
|
default: ''
|
|
102
270
|
}
|
|
103
271
|
},
|
|
272
|
+
data() {
|
|
273
|
+
return {
|
|
274
|
+
localValue: this.value,
|
|
275
|
+
localId: null
|
|
276
|
+
};
|
|
277
|
+
},
|
|
104
278
|
computed: {
|
|
279
|
+
computedId() {
|
|
280
|
+
return this.id || this.localId;
|
|
281
|
+
},
|
|
282
|
+
computedSelectSize() {
|
|
283
|
+
// Custom selects with a size of zero causes the arrows to be hidden,
|
|
284
|
+
// so dont render the size attribute in this case
|
|
285
|
+
return !this.plain && this.selectSize === 0 ? null : this.selectSize;
|
|
286
|
+
},
|
|
287
|
+
computedAriaInvalid() {
|
|
288
|
+
const ariaInvalid = this.ariaInvalid;
|
|
289
|
+
if (ariaInvalid === true || ariaInvalid === 'true' || ariaInvalid === '') {
|
|
290
|
+
return 'true';
|
|
291
|
+
}
|
|
292
|
+
return this.computedState === false ? 'true' : ariaInvalid;
|
|
293
|
+
},
|
|
294
|
+
computedState() {
|
|
295
|
+
// If not a boolean, ensure that value is null
|
|
296
|
+
return isBoolean(this.state) ? this.state : null;
|
|
297
|
+
},
|
|
105
298
|
cssClasses() {
|
|
106
299
|
if (this.width === null) {
|
|
107
300
|
return [];
|
|
@@ -124,6 +317,129 @@ var script = {
|
|
|
124
317
|
|
|
125
318
|
// eslint-disable-next-line @gitlab/tailwind-no-interpolation -- Not a CSS utility
|
|
126
319
|
return [`gl-form-select-${this.width}`];
|
|
320
|
+
},
|
|
321
|
+
stateClass() {
|
|
322
|
+
if (this.computedState === true) return 'is-valid';
|
|
323
|
+
if (this.computedState === false) return 'is-invalid';
|
|
324
|
+
return null;
|
|
325
|
+
},
|
|
326
|
+
inputClass() {
|
|
327
|
+
return ['gl-form-select', this.plain ? 'form-control' : 'custom-select', this.size && this.plain ? `form-control-${this.size}` : null, this.size && !this.plain ? `custom-select-${this.size}` : null, this.stateClass, this.selectClass];
|
|
328
|
+
},
|
|
329
|
+
normalizedOptions() {
|
|
330
|
+
return this.normalizeOptions(this.options);
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
watch: {
|
|
334
|
+
value(newValue) {
|
|
335
|
+
this.localValue = newValue;
|
|
336
|
+
},
|
|
337
|
+
localValue(newValue) {
|
|
338
|
+
/**
|
|
339
|
+
* Emitted when the select value changes
|
|
340
|
+
*
|
|
341
|
+
* @event input
|
|
342
|
+
* @type {any}
|
|
343
|
+
*/
|
|
344
|
+
this.$emit('input', newValue);
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
activated() {
|
|
348
|
+
this.handleAutofocus();
|
|
349
|
+
},
|
|
350
|
+
async mounted() {
|
|
351
|
+
this.handleAutofocus();
|
|
352
|
+
await this.$nextTick();
|
|
353
|
+
// Update DOM with auto-generated ID after mount
|
|
354
|
+
// to prevent SSR hydration errors
|
|
355
|
+
this.localId = uniqueId('gl-form-select-');
|
|
356
|
+
},
|
|
357
|
+
methods: {
|
|
358
|
+
focus() {
|
|
359
|
+
var _this$$refs$select;
|
|
360
|
+
(_this$$refs$select = this.$refs.select) === null || _this$$refs$select === void 0 ? void 0 : _this$$refs$select.focus();
|
|
361
|
+
},
|
|
362
|
+
blur() {
|
|
363
|
+
var _this$$refs$select2;
|
|
364
|
+
(_this$$refs$select2 = this.$refs.select) === null || _this$$refs$select2 === void 0 ? void 0 : _this$$refs$select2.blur();
|
|
365
|
+
},
|
|
366
|
+
normalizeOptions(options) {
|
|
367
|
+
// Normalize the given options array
|
|
368
|
+
if (Array.isArray(options)) return options.map(option => this.normalizeOption(option));
|
|
369
|
+
if (isPlainObject(options)) {
|
|
370
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
371
|
+
// Deprecate the object options format
|
|
372
|
+
// eslint-disable-next-line no-console
|
|
373
|
+
console.warn('[@gitlab/ui] GlFormSelect - Setting prop "options" to an object is deprecated. Use the array format instead.');
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// Normalize a `options` object to an array of options
|
|
377
|
+
return Object.keys(options).map(key => this.normalizeOption(options[key] || {}, key));
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// If not an array or object, return an empty array
|
|
381
|
+
return [];
|
|
382
|
+
},
|
|
383
|
+
normalizeOption(option) {
|
|
384
|
+
let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
385
|
+
// When the option is an object, normalize it
|
|
386
|
+
if (isPlainObject(option)) {
|
|
387
|
+
const value = get(option, this.valueField);
|
|
388
|
+
const text = get(option, this.textField);
|
|
389
|
+
const options = get(option, this.optionsField, null);
|
|
390
|
+
// When it has options, create an <optgroup> object
|
|
391
|
+
if (!isNull(options)) {
|
|
392
|
+
return {
|
|
393
|
+
label: String(get(option, this.labelField) || text),
|
|
394
|
+
options: this.normalizeOptions(options)
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
// Otherwise create an <option> object
|
|
398
|
+
return {
|
|
399
|
+
value: isUndefined(value) ? key || text : value,
|
|
400
|
+
text: String(isUndefined(text) ? key : text),
|
|
401
|
+
html: get(option, this.htmlField),
|
|
402
|
+
disabled: Boolean(get(option, this.disabledField))
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
// Otherwise create an <option> object from the given value
|
|
406
|
+
return {
|
|
407
|
+
value: key || option,
|
|
408
|
+
text: String(option),
|
|
409
|
+
disabled: false
|
|
410
|
+
};
|
|
411
|
+
},
|
|
412
|
+
isOptionGroup(option) {
|
|
413
|
+
return Array.isArray(option.options);
|
|
414
|
+
},
|
|
415
|
+
async onChange(event) {
|
|
416
|
+
const target = event.target;
|
|
417
|
+
const selectedValue = Array.from(target.options).filter(option => option.selected)
|
|
418
|
+
// NOTE: the _value property is set up by both Vue 2 and 3 explicitly for the
|
|
419
|
+
// purpose of handling non-string values on form elements.
|
|
420
|
+
//
|
|
421
|
+
// See:
|
|
422
|
+
// - https://github.com/vuejs/vue/blob/v2.7.16/src/platforms/web/runtime/modules/dom-props.ts#L42-L44
|
|
423
|
+
// - https://github.com/vuejs/vue/blob/v2.7.16/test/unit/modules/vdom/modules/dom-props.spec.ts#L38
|
|
424
|
+
// - https://github.com/vuejs/core/blob/v3.4.27/packages/runtime-dom/src/modules/props.ts#L48-L50
|
|
425
|
+
// - https://github.com/vuejs/core/blob/v3.4.27/packages/runtime-dom/__tests__/patchProps.spec.ts#L25
|
|
426
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
427
|
+
.map(option => '_value' in option ? option._value : option.value);
|
|
428
|
+
this.localValue = target.multiple ? selectedValue : selectedValue[0];
|
|
429
|
+
await this.$nextTick();
|
|
430
|
+
/**
|
|
431
|
+
* Emitted when the select value changes via user interaction
|
|
432
|
+
*
|
|
433
|
+
* @event change
|
|
434
|
+
* @type {any}
|
|
435
|
+
*/
|
|
436
|
+
this.$emit('change', this.localValue);
|
|
437
|
+
},
|
|
438
|
+
async handleAutofocus() {
|
|
439
|
+
await this.$nextTick();
|
|
440
|
+
window.requestAnimationFrame(() => {
|
|
441
|
+
if (this.autofocus && isVisible(this.$refs.select)) this.focus();
|
|
442
|
+
});
|
|
127
443
|
}
|
|
128
444
|
}
|
|
129
445
|
};
|
|
@@ -132,7 +448,7 @@ var script = {
|
|
|
132
448
|
const __vue_script__ = script;
|
|
133
449
|
|
|
134
450
|
/* template */
|
|
135
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('span',{staticClass:"gl-form-select-wrapper",class:_vm.cssClasses},[_c('
|
|
451
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('span',{staticClass:"gl-form-select-wrapper",class:_vm.cssClasses},[_c('select',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.localValue),expression:"localValue"}],ref:"select",class:_vm.inputClass,attrs:{"id":_vm.computedId,"aria-invalid":_vm.computedAriaInvalid,"aria-required":_vm.required ? 'true' : null,"disabled":_vm.disabled,"form":_vm.form,"multiple":_vm.multiple,"name":_vm.name,"required":_vm.required,"size":_vm.computedSelectSize},on:{"change":[function($event){var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return val}); _vm.localValue=$event.target.multiple ? $$selectedVal : $$selectedVal[0];},_vm.onChange]}},'select',_vm.$attrs,false),[_vm._t("first"),_vm._v(" "),_vm._l((_vm.normalizedOptions),function(option,index){return [(_vm.isOptionGroup(option))?[_c('optgroup',{key:index,attrs:{"label":option.label}},[_vm._l((option.options),function(childOption,childIndex){return [(childOption.html)?_c('option',{directives:[{name:"safe-html",rawName:"v-safe-html",value:(childOption.html),expression:"childOption.html"}],key:(childIndex + "-html"),attrs:{"disabled":childOption.disabled},domProps:{"value":childOption.value}}):_c('option',{key:childIndex,attrs:{"disabled":childOption.disabled},domProps:{"value":childOption.value}},[_vm._v("\n "+_vm._s(childOption.text)+"\n ")])]})],2)]:[(option.html)?_c('option',{directives:[{name:"safe-html",rawName:"v-safe-html",value:(option.html),expression:"option.html"}],key:(index + "-html"),attrs:{"disabled":option.disabled},domProps:{"value":option.value}}):_c('option',{key:index,attrs:{"disabled":option.disabled},domProps:{"value":option.value}},[_vm._v("\n "+_vm._s(option.text)+"\n ")])]]}),_vm._v(" "),_vm._t("default")],2)])};
|
|
136
452
|
var __vue_staticRenderFns__ = [];
|
|
137
453
|
|
|
138
454
|
/* style */
|
|
@@ -140,17 +140,13 @@ var script = {
|
|
|
140
140
|
},
|
|
141
141
|
computed: {
|
|
142
142
|
shouldRenderModalOk() {
|
|
143
|
-
// eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
|
|
144
143
|
return Boolean(this.$slots['modal-ok']);
|
|
145
144
|
},
|
|
146
145
|
shouldRenderModalCancel() {
|
|
147
|
-
// eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
|
|
148
146
|
return Boolean(this.$slots['modal-cancel']);
|
|
149
147
|
},
|
|
150
148
|
shouldRenderModalFooter() {
|
|
151
|
-
return Boolean(this.actionCancel || this.actionSecondary || this.actionPrimary ||
|
|
152
|
-
// eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
|
|
153
|
-
this.$slots['modal-footer']);
|
|
149
|
+
return Boolean(this.actionCancel || this.actionSecondary || this.actionPrimary || this.$slots['modal-footer']);
|
|
154
150
|
}
|
|
155
151
|
},
|
|
156
152
|
mounted() {
|
|
@@ -226,9 +226,7 @@ var script = {
|
|
|
226
226
|
computed: {
|
|
227
227
|
disclosureTag() {
|
|
228
228
|
var _this$items;
|
|
229
|
-
if ((_this$items = this.items) !== null && _this$items !== void 0 && _this$items.length ||
|
|
230
|
-
// eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
|
|
231
|
-
hasOnlyListItems(this.$scopedSlots.default || this.$slots.default)) {
|
|
229
|
+
if ((_this$items = this.items) !== null && _this$items !== void 0 && _this$items.length || hasOnlyListItems(this.$scopedSlots.default || this.$slots.default)) {
|
|
232
230
|
return 'ul';
|
|
233
231
|
}
|
|
234
232
|
return 'div';
|
|
@@ -2,7 +2,7 @@ import Vue from 'vue';
|
|
|
2
2
|
import { createNewChildComponent } from '../../../vendor/bootstrap-vue/src/utils/create-new-child-component';
|
|
3
3
|
import GlToaster from './toaster';
|
|
4
4
|
|
|
5
|
-
/* eslint-disable import/no-default-export */
|
|
5
|
+
/* eslint-disable import-x/no-default-export */
|
|
6
6
|
let toastsCount = 0;
|
|
7
7
|
let toasterInstance = null;
|
|
8
8
|
function ensureToaster(vm) {
|
|
@@ -95,7 +95,6 @@ var script = {
|
|
|
95
95
|
return Boolean(this.$scopedSlots.description || this.description) && this.isVerticalLayout;
|
|
96
96
|
},
|
|
97
97
|
shouldRenderHelp() {
|
|
98
|
-
// eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
|
|
99
98
|
return Boolean(this.$slots.help || this.help) && this.isVerticalLayout;
|
|
100
99
|
},
|
|
101
100
|
toggleClasses() {
|