@gitlab/ui 132.2.1 → 133.0.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/dist/components/base/dropdown/dropdown_item.js +1 -1
- package/dist/components/base/form/form_input/form_input.js +2 -60
- package/dist/components/base/form/form_textarea/form_textarea.js +421 -45
- package/dist/components/base/new_dropdowns/listbox/listbox_item.js +1 -1
- package/dist/vendor/bootstrap-vue/src/constants/components.js +1 -2
- package/package.json +1 -1
- package/src/components/base/dropdown/dropdown_item.vue +1 -1
- package/src/components/base/form/form_input/form_input.vue +2 -60
- package/src/components/base/form/form_textarea/form_textarea.vue +462 -49
- package/src/components/base/new_dropdowns/listbox/listbox_item.vue +1 -1
- package/src/vendor/bootstrap-vue/src/constants/components.js +0 -1
- package/dist/vendor/bootstrap-vue/src/components/form-textarea/form-textarea.js +0 -233
- package/dist/vendor/bootstrap-vue/src/components/form-textarea/index.js +0 -1
- package/dist/vendor/bootstrap-vue/src/mixins/form-selection.js +0 -62
- package/dist/vendor/bootstrap-vue/src/mixins/form-text.js +0 -279
- package/dist/vendor/bootstrap-vue/src/mixins/form-validity.js +0 -50
- package/src/vendor/bootstrap-vue/src/components/form-textarea/form-textarea.js +0 -241
- package/src/vendor/bootstrap-vue/src/components/form-textarea/index.js +0 -3
- package/src/vendor/bootstrap-vue/src/mixins/form-selection.js +0 -60
- package/src/vendor/bootstrap-vue/src/mixins/form-text.js +0 -280
- package/src/vendor/bootstrap-vue/src/mixins/form-validity.js +0 -48
|
@@ -139,7 +139,7 @@ var script = {
|
|
|
139
139
|
const __vue_script__ = script;
|
|
140
140
|
|
|
141
141
|
/* template */
|
|
142
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.bootstrapComponent,_vm._g(_vm._b({tag:"component",staticClass:"gl-dropdown-item"},'component',_vm.bootstrapComponentProps,false),_vm.$listeners),[(_vm.shouldShowCheckIcon)?_c('gl-icon',{class:['gl-dropdown-item-check-icon', { 'gl-invisible': !_vm.isChecked }, _vm.checkedClasses],attrs:{"name":"
|
|
142
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.bootstrapComponent,_vm._g(_vm._b({tag:"component",staticClass:"gl-dropdown-item"},'component',_vm.bootstrapComponentProps,false),_vm.$listeners),[(_vm.shouldShowCheckIcon)?_c('gl-icon',{class:['gl-dropdown-item-check-icon', { 'gl-invisible': !_vm.isChecked }, _vm.checkedClasses],attrs:{"name":"check","data-testid":"dropdown-item-checkbox"}}):_vm._e(),_vm._v(" "),(_vm.iconName)?_c('gl-icon',{class:['gl-dropdown-item-icon', _vm.iconColorCss],attrs:{"name":_vm.iconName}}):_vm._e(),_vm._v(" "),(_vm.avatarUrl)?_c('gl-avatar',{attrs:{"size":32,"src":_vm.avatarUrl}}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-dropdown-item-text-wrapper"},[_c('p',{staticClass:"gl-dropdown-item-text-primary"},[_vm._t("default")],2),_vm._v(" "),(_vm.secondaryText)?_c('p',{staticClass:"gl-dropdown-item-text-secondary"},[_vm._v(_vm._s(_vm.secondaryText))]):_vm._e()]),_vm._v(" "),(_vm.iconRightName)?_c('gl-button',{attrs:{"size":"small","icon":_vm.iconRightName,"aria-label":_vm.iconRightAriaLabel || _vm.iconRightName},on:{"click":function($event){$event.stopPropagation();$event.preventDefault();return _vm.handleClickIconRight.apply(null, arguments)}}}):_vm._e()],1)};
|
|
143
143
|
var __vue_staticRenderFns__ = [];
|
|
144
144
|
|
|
145
145
|
/* style */
|
|
@@ -407,57 +407,6 @@ var script = {
|
|
|
407
407
|
},
|
|
408
408
|
noWheel() {
|
|
409
409
|
return this.type === 'number';
|
|
410
|
-
},
|
|
411
|
-
selectionStart: {
|
|
412
|
-
// Expose selectionStart for formatters, etc
|
|
413
|
-
cache: false,
|
|
414
|
-
get() {
|
|
415
|
-
return this.$refs.input.selectionStart;
|
|
416
|
-
},
|
|
417
|
-
set(val) {
|
|
418
|
-
this.$refs.input.selectionStart = val;
|
|
419
|
-
}
|
|
420
|
-
},
|
|
421
|
-
selectionEnd: {
|
|
422
|
-
// Expose selectionEnd for formatters, etc
|
|
423
|
-
cache: false,
|
|
424
|
-
get() {
|
|
425
|
-
return this.$refs.input.selectionEnd;
|
|
426
|
-
},
|
|
427
|
-
set(val) {
|
|
428
|
-
this.$refs.input.selectionEnd = val;
|
|
429
|
-
}
|
|
430
|
-
},
|
|
431
|
-
selectionDirection: {
|
|
432
|
-
// Expose selectionDirection for formatters, etc
|
|
433
|
-
cache: false,
|
|
434
|
-
get() {
|
|
435
|
-
return this.$refs.input.selectionDirection;
|
|
436
|
-
},
|
|
437
|
-
set(val) {
|
|
438
|
-
this.$refs.input.selectionDirection = val;
|
|
439
|
-
}
|
|
440
|
-
},
|
|
441
|
-
validity: {
|
|
442
|
-
// Expose validity property
|
|
443
|
-
cache: false,
|
|
444
|
-
get() {
|
|
445
|
-
return this.$refs.input.validity;
|
|
446
|
-
}
|
|
447
|
-
},
|
|
448
|
-
validationMessage: {
|
|
449
|
-
// Expose validationMessage property
|
|
450
|
-
cache: false,
|
|
451
|
-
get() {
|
|
452
|
-
return this.$refs.input.validationMessage;
|
|
453
|
-
}
|
|
454
|
-
},
|
|
455
|
-
willValidate: {
|
|
456
|
-
// Expose willValidate property
|
|
457
|
-
cache: false,
|
|
458
|
-
get() {
|
|
459
|
-
return this.$refs.input.willValidate;
|
|
460
|
-
}
|
|
461
410
|
}
|
|
462
411
|
},
|
|
463
412
|
watch: {
|
|
@@ -570,21 +519,14 @@ var script = {
|
|
|
570
519
|
};
|
|
571
520
|
// Only debounce the value update when a value greater than `0`
|
|
572
521
|
// is set and we are not in lazy mode or this is a forced update
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
this.$_inputDebounceTimer = setTimeout(doUpdate, debounce);
|
|
522
|
+
if (this.computedDebounce > 0 && !lazy && !force) {
|
|
523
|
+
this.$_inputDebounceTimer = setTimeout(doUpdate, this.computedDebounce);
|
|
576
524
|
} else {
|
|
577
525
|
// Immediately update the v-model
|
|
578
526
|
doUpdate();
|
|
579
527
|
}
|
|
580
528
|
},
|
|
581
529
|
onInput(event) {
|
|
582
|
-
// `event.target.composing` is set by Vue
|
|
583
|
-
// https://github.com/vuejs/vue/blob/dev/src/platforms/web/runtime/directives/model.js
|
|
584
|
-
// TODO: Is this needed now with the latest Vue?
|
|
585
|
-
if (event.target.composing) {
|
|
586
|
-
return;
|
|
587
|
-
}
|
|
588
530
|
const value = event.target.value;
|
|
589
531
|
const formattedValue = this.formatValue(value, event);
|
|
590
532
|
// Exit when the `formatter` function strictly returned `false`
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import { uniqueId } from 'lodash-es';
|
|
2
|
-
import {
|
|
1
|
+
import { toString, uniqueId, isBoolean, toInteger } from 'lodash-es';
|
|
2
|
+
import { toFloat } from '../../../../utils/number_utils';
|
|
3
|
+
import { stopEvent, isVisible } from '../../../../utils/utils';
|
|
4
|
+
import { VBVisible } from '../../../../vendor/bootstrap-vue/src/directives/visible/visible';
|
|
3
5
|
import GlFormCharacterCount from '../form_character_count/form_character_count';
|
|
4
6
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
5
7
|
|
|
6
|
-
const model = {
|
|
7
|
-
prop: 'value',
|
|
8
|
-
event: 'input'
|
|
9
|
-
};
|
|
10
8
|
var script = {
|
|
11
9
|
name: 'GlFormTextarea',
|
|
12
10
|
components: {
|
|
13
|
-
BFormTextarea,
|
|
14
11
|
GlFormCharacterCount
|
|
15
12
|
},
|
|
13
|
+
directives: {
|
|
14
|
+
'b-visible': VBVisible
|
|
15
|
+
},
|
|
16
16
|
inheritAttrs: false,
|
|
17
|
-
model
|
|
17
|
+
model: {
|
|
18
|
+
prop: 'value',
|
|
19
|
+
event: 'input'
|
|
20
|
+
},
|
|
18
21
|
props: {
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
/**
|
|
23
|
+
* The current value of the textarea.
|
|
24
|
+
*/
|
|
21
25
|
value: {
|
|
22
26
|
type: String,
|
|
23
27
|
required: false,
|
|
@@ -62,40 +66,224 @@ var script = {
|
|
|
62
66
|
type: [Number, String],
|
|
63
67
|
required: false,
|
|
64
68
|
default: 4
|
|
69
|
+
},
|
|
70
|
+
/**
|
|
71
|
+
* Used to set the `id` attribute on the rendered content.
|
|
72
|
+
*/
|
|
73
|
+
id: {
|
|
74
|
+
type: String,
|
|
75
|
+
required: false,
|
|
76
|
+
default: undefined
|
|
77
|
+
},
|
|
78
|
+
/**
|
|
79
|
+
* When set to `true`, attempts to auto-focus the control when it is mounted.
|
|
80
|
+
*/
|
|
81
|
+
autofocus: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
required: false,
|
|
84
|
+
default: false
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* When set to `true`, disables the component's functionality.
|
|
88
|
+
*/
|
|
89
|
+
disabled: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
required: false,
|
|
92
|
+
default: false
|
|
93
|
+
},
|
|
94
|
+
/**
|
|
95
|
+
* ID of the form that the form control belongs to. Sets the `form` attribute on the control.
|
|
96
|
+
*/
|
|
97
|
+
form: {
|
|
98
|
+
type: String,
|
|
99
|
+
required: false,
|
|
100
|
+
default: undefined
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* Sets the value of the `name` attribute on the form control.
|
|
104
|
+
*/
|
|
105
|
+
name: {
|
|
106
|
+
type: String,
|
|
107
|
+
required: false,
|
|
108
|
+
default: undefined
|
|
109
|
+
},
|
|
110
|
+
/**
|
|
111
|
+
* Adds the `required` attribute to the form control.
|
|
112
|
+
*/
|
|
113
|
+
required: {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
required: false,
|
|
116
|
+
default: false
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* Controls the validation state appearance of the component.
|
|
120
|
+
* `true` for valid, `false` for invalid, or `null` for no validation state.
|
|
121
|
+
*/
|
|
122
|
+
state: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
required: false,
|
|
125
|
+
default: null
|
|
126
|
+
},
|
|
127
|
+
/**
|
|
128
|
+
* Optional value to set for the 'aria-invalid' attribute.
|
|
129
|
+
*/
|
|
130
|
+
ariaInvalid: {
|
|
131
|
+
type: [Boolean, String],
|
|
132
|
+
required: false,
|
|
133
|
+
default: false
|
|
134
|
+
},
|
|
135
|
+
/**
|
|
136
|
+
* Sets the 'autocomplete' attribute value on the form control.
|
|
137
|
+
*/
|
|
138
|
+
autocomplete: {
|
|
139
|
+
type: String,
|
|
140
|
+
required: false,
|
|
141
|
+
default: undefined
|
|
142
|
+
},
|
|
143
|
+
/**
|
|
144
|
+
* When set to a number of milliseconds greater than zero, will debounce the user input.
|
|
145
|
+
*/
|
|
146
|
+
debounce: {
|
|
147
|
+
type: [Number, String],
|
|
148
|
+
required: false,
|
|
149
|
+
default: 0
|
|
150
|
+
},
|
|
151
|
+
/**
|
|
152
|
+
* Reference to a function for formatting the input.
|
|
153
|
+
*/
|
|
154
|
+
formatter: {
|
|
155
|
+
type: Function,
|
|
156
|
+
required: false,
|
|
157
|
+
default: undefined
|
|
158
|
+
},
|
|
159
|
+
/**
|
|
160
|
+
* Sets the `placeholder` attribute value on the form control.
|
|
161
|
+
*/
|
|
162
|
+
placeholder: {
|
|
163
|
+
type: String,
|
|
164
|
+
required: false,
|
|
165
|
+
default: undefined
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* Sets the `readonly` attribute on the form control.
|
|
169
|
+
*/
|
|
170
|
+
readonly: {
|
|
171
|
+
type: Boolean,
|
|
172
|
+
required: false,
|
|
173
|
+
default: false
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* Set the size of the component's appearance. 'sm' or 'lg'. Defaults to medium size when omitted.
|
|
177
|
+
*/
|
|
178
|
+
size: {
|
|
179
|
+
type: String,
|
|
180
|
+
required: false,
|
|
181
|
+
default: undefined
|
|
182
|
+
},
|
|
183
|
+
/**
|
|
184
|
+
* The maximum number of rows to show. When set, enables auto-height.
|
|
185
|
+
*/
|
|
186
|
+
maxRows: {
|
|
187
|
+
type: [Number, String],
|
|
188
|
+
required: false,
|
|
189
|
+
default: undefined
|
|
65
190
|
}
|
|
66
191
|
},
|
|
67
192
|
data() {
|
|
68
193
|
return {
|
|
194
|
+
localValue: toString(this.value),
|
|
195
|
+
vModelValue: this.value,
|
|
196
|
+
localId: null,
|
|
197
|
+
heightInPx: null,
|
|
69
198
|
characterCountTextId: uniqueId('form-textarea-character-count-')
|
|
70
199
|
};
|
|
71
200
|
},
|
|
72
201
|
computed: {
|
|
73
|
-
|
|
74
|
-
|
|
202
|
+
computedId() {
|
|
203
|
+
return this.id || this.localId;
|
|
204
|
+
},
|
|
205
|
+
computedState() {
|
|
206
|
+
return isBoolean(this.state) ? this.state : null;
|
|
207
|
+
},
|
|
208
|
+
stateClass() {
|
|
209
|
+
if (this.computedState === true) return 'is-valid';
|
|
210
|
+
if (this.computedState === false) return 'is-invalid';
|
|
211
|
+
return null;
|
|
212
|
+
},
|
|
213
|
+
computedAriaInvalid() {
|
|
214
|
+
const ariaInvalid = this.ariaInvalid;
|
|
215
|
+
if (ariaInvalid === true || ariaInvalid === 'true' || ariaInvalid === '') {
|
|
216
|
+
return 'true';
|
|
217
|
+
}
|
|
218
|
+
return this.computedState === false ? 'true' : ariaInvalid;
|
|
219
|
+
},
|
|
220
|
+
sizeClass() {
|
|
221
|
+
return this.size ? `form-control-${this.size}` : null;
|
|
222
|
+
},
|
|
223
|
+
computedDebounce() {
|
|
224
|
+
return Math.max(toInteger(this.debounce), 0);
|
|
225
|
+
},
|
|
226
|
+
hasFormatter() {
|
|
227
|
+
return typeof this.formatter === 'function';
|
|
228
|
+
},
|
|
229
|
+
computedMinRows() {
|
|
230
|
+
// Ensure rows is at least 2 and positive (2 is the native textarea value)
|
|
231
|
+
// A value of 1 can cause issues in some browsers, and most browsers
|
|
232
|
+
// only support 2 as the smallest value
|
|
233
|
+
return Math.max(toInteger(this.rows), 2);
|
|
234
|
+
},
|
|
235
|
+
computedMaxRows() {
|
|
236
|
+
return Math.max(this.computedMinRows, toInteger(this.maxRows));
|
|
237
|
+
},
|
|
238
|
+
computedRows() {
|
|
239
|
+
// This is used to set the attribute 'rows' on the textarea
|
|
240
|
+
// If auto-height is enabled, then we return `null` as we use CSS to control height
|
|
241
|
+
return this.computedMinRows === this.computedMaxRows ? this.computedMinRows : null;
|
|
242
|
+
},
|
|
243
|
+
computedStyle() {
|
|
244
|
+
const styles = {
|
|
245
|
+
// Setting `noResize` to true will disable the ability for the user to
|
|
246
|
+
// manually resize the textarea. We also disable when in auto height mode
|
|
247
|
+
resize: !this.computedRows || this.noResize ? 'none' : null
|
|
248
|
+
};
|
|
249
|
+
if (!this.computedRows) {
|
|
250
|
+
// Conditionally set the computed CSS height when auto rows/height is enabled
|
|
251
|
+
// We avoid setting the style to `null`, which can override user manual resize handle
|
|
252
|
+
styles.height = this.heightInPx;
|
|
253
|
+
// We always add a vertical scrollbar to the textarea when auto-height is
|
|
254
|
+
// enabled so that the computed height calculation returns a stable value
|
|
255
|
+
styles.overflowY = 'scroll';
|
|
256
|
+
}
|
|
257
|
+
return styles;
|
|
258
|
+
},
|
|
259
|
+
computedAttrs() {
|
|
260
|
+
const disabled = this.disabled,
|
|
261
|
+
required = this.required,
|
|
262
|
+
readonly = this.readonly;
|
|
263
|
+
return {
|
|
264
|
+
...this.$attrs,
|
|
265
|
+
id: this.computedId,
|
|
266
|
+
name: this.name || null,
|
|
267
|
+
form: this.form || null,
|
|
268
|
+
disabled,
|
|
269
|
+
placeholder: this.placeholder || null,
|
|
270
|
+
required,
|
|
271
|
+
autocomplete: this.autocomplete || null,
|
|
272
|
+
readonly,
|
|
273
|
+
rows: this.computedRows,
|
|
274
|
+
'aria-required': required ? 'true' : null,
|
|
275
|
+
'aria-invalid': this.computedAriaInvalid
|
|
276
|
+
};
|
|
277
|
+
},
|
|
278
|
+
computedClass() {
|
|
279
|
+
return ['gl-form-input', 'gl-form-textarea', 'form-control', this.textareaClasses, this.sizeClass, this.stateClass];
|
|
280
|
+
},
|
|
281
|
+
computedListeners() {
|
|
75
282
|
return {
|
|
76
283
|
...this.$listeners,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
81
|
-
args[_key] = arguments[_key];
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Emitted to update the v-model
|
|
85
|
-
*/
|
|
86
|
-
_this.$emit('update', ...args);
|
|
87
|
-
},
|
|
88
|
-
update: function () {
|
|
89
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
90
|
-
args[_key2] = arguments[_key2];
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Triggered by user interaction.
|
|
94
|
-
* Emitted after any formatting (not including 'trim' or 'number' props).
|
|
95
|
-
* Useful for getting the currently entered value when the 'debounce' or 'lazy' props are set.
|
|
96
|
-
*/
|
|
97
|
-
_this.$emit(model.event, ...args);
|
|
98
|
-
}
|
|
284
|
+
input: this.onInput,
|
|
285
|
+
change: this.onChange,
|
|
286
|
+
blur: this.onBlur
|
|
99
287
|
};
|
|
100
288
|
},
|
|
101
289
|
keypressEvent() {
|
|
@@ -103,22 +291,210 @@ var script = {
|
|
|
103
291
|
},
|
|
104
292
|
showCharacterCount() {
|
|
105
293
|
return this.characterCountLimit !== null;
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
watch: {
|
|
297
|
+
value(newValue) {
|
|
298
|
+
const stringifyValue = toString(newValue);
|
|
299
|
+
if (stringifyValue !== this.localValue || newValue !== this.vModelValue) {
|
|
300
|
+
this.clearDebounce();
|
|
301
|
+
this.localValue = stringifyValue;
|
|
302
|
+
this.vModelValue = newValue;
|
|
303
|
+
}
|
|
106
304
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
...this.$attrs,
|
|
110
|
-
class: ['gl-form-input gl-form-textarea', this.textareaClasses],
|
|
111
|
-
noResize: this.noResize,
|
|
112
|
-
value: this.value,
|
|
113
|
-
rows: this.rows
|
|
114
|
-
};
|
|
305
|
+
localValue() {
|
|
306
|
+
this.setHeight();
|
|
115
307
|
}
|
|
116
308
|
},
|
|
309
|
+
created() {
|
|
310
|
+
this.$_inputDebounceTimer = null;
|
|
311
|
+
},
|
|
312
|
+
mounted() {
|
|
313
|
+
this.handleAutofocus();
|
|
314
|
+
this.setHeight();
|
|
315
|
+
this.$nextTick(() => {
|
|
316
|
+
this.localId = uniqueId('gl-form-textarea-');
|
|
317
|
+
});
|
|
318
|
+
},
|
|
319
|
+
beforeDestroy() {
|
|
320
|
+
this.clearDebounce();
|
|
321
|
+
},
|
|
117
322
|
methods: {
|
|
323
|
+
focus() {
|
|
324
|
+
if (!this.disabled) {
|
|
325
|
+
var _this$$refs$input;
|
|
326
|
+
(_this$$refs$input = this.$refs.input) === null || _this$$refs$input === void 0 ? void 0 : _this$$refs$input.focus();
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
blur() {
|
|
330
|
+
if (!this.disabled) {
|
|
331
|
+
var _this$$refs$input2;
|
|
332
|
+
(_this$$refs$input2 = this.$refs.input) === null || _this$$refs$input2 === void 0 ? void 0 : _this$$refs$input2.blur();
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
clearDebounce() {
|
|
336
|
+
clearTimeout(this.$_inputDebounceTimer);
|
|
337
|
+
this.$_inputDebounceTimer = null;
|
|
338
|
+
},
|
|
339
|
+
formatValue(value, event) {
|
|
340
|
+
let newValue = toString(value);
|
|
341
|
+
if (this.hasFormatter) {
|
|
342
|
+
newValue = this.formatter(newValue, event);
|
|
343
|
+
}
|
|
344
|
+
return newValue;
|
|
345
|
+
},
|
|
346
|
+
updateValue(value) {
|
|
347
|
+
let force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
348
|
+
this.clearDebounce();
|
|
349
|
+
const doUpdate = () => {
|
|
350
|
+
if (value !== this.vModelValue) {
|
|
351
|
+
this.vModelValue = value;
|
|
352
|
+
/**
|
|
353
|
+
* Triggered by user interaction.
|
|
354
|
+
* Emitted after any formatting (not including 'trim' or 'number' props).
|
|
355
|
+
* Useful for getting the currently entered value when the 'debounce'is set.
|
|
356
|
+
*
|
|
357
|
+
* @event input
|
|
358
|
+
*/
|
|
359
|
+
this.$emit('input', value);
|
|
360
|
+
} else if (this.hasFormatter) {
|
|
361
|
+
const input = this.$refs.input;
|
|
362
|
+
if (input && value !== input.value) {
|
|
363
|
+
input.value = value;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
if (this.computedDebounce > 0 && !force) {
|
|
368
|
+
this.$_inputDebounceTimer = setTimeout(doUpdate, this.computedDebounce);
|
|
369
|
+
} else {
|
|
370
|
+
doUpdate();
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
onInput(event) {
|
|
374
|
+
const value = event.target.value;
|
|
375
|
+
const formattedValue = this.formatValue(value, event);
|
|
376
|
+
if (formattedValue === false || event.defaultPrevented) {
|
|
377
|
+
stopEvent(event, {
|
|
378
|
+
propagation: false
|
|
379
|
+
});
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
this.localValue = formattedValue;
|
|
383
|
+
this.updateValue(formattedValue);
|
|
384
|
+
/**
|
|
385
|
+
* The `input` and `update` events are swapped
|
|
386
|
+
* see https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/1628.
|
|
387
|
+
*
|
|
388
|
+
* @event update
|
|
389
|
+
*/
|
|
390
|
+
this.$emit('update', formattedValue);
|
|
391
|
+
},
|
|
392
|
+
onChange(event) {
|
|
393
|
+
const value = event.target.value;
|
|
394
|
+
const formattedValue = this.formatValue(value, event);
|
|
395
|
+
if (formattedValue === false || event.defaultPrevented) {
|
|
396
|
+
stopEvent(event, {
|
|
397
|
+
propagation: false
|
|
398
|
+
});
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
this.localValue = formattedValue;
|
|
402
|
+
this.updateValue(formattedValue, true);
|
|
403
|
+
/**
|
|
404
|
+
* Change event triggered by user interaction.
|
|
405
|
+
* Emitted after any formatting (not including 'trim' or 'number' props)
|
|
406
|
+
* and after the v-model is updated. The `input` and `update` events are swapped
|
|
407
|
+
* see https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/1628.
|
|
408
|
+
*
|
|
409
|
+
* @event change
|
|
410
|
+
*/
|
|
411
|
+
this.$emit('change', formattedValue);
|
|
412
|
+
},
|
|
413
|
+
onBlur(event) {
|
|
414
|
+
const value = event.target.value;
|
|
415
|
+
const formattedValue = this.formatValue(value, event);
|
|
416
|
+
if (formattedValue !== false) {
|
|
417
|
+
this.localValue = toString(formattedValue);
|
|
418
|
+
this.updateValue(formattedValue, true);
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Emitted after the textarea loses focus
|
|
422
|
+
*
|
|
423
|
+
* @event blur
|
|
424
|
+
*/
|
|
425
|
+
this.$emit('blur', event);
|
|
426
|
+
},
|
|
427
|
+
handleAutofocus() {
|
|
428
|
+
this.$nextTick(() => {
|
|
429
|
+
window.requestAnimationFrame(() => {
|
|
430
|
+
if (this.autofocus && isVisible(this.$refs.input)) {
|
|
431
|
+
this.focus();
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
});
|
|
435
|
+
},
|
|
118
436
|
handleKeyPress(e) {
|
|
119
|
-
if (e.keyCode === 13 && (e.metaKey || e.ctrlKey)) {
|
|
437
|
+
if (this.submitOnEnter && e.keyCode === 13 && (e.metaKey || e.ctrlKey)) {
|
|
438
|
+
/**
|
|
439
|
+
* Emitted after enter is pressed in textarea
|
|
440
|
+
*
|
|
441
|
+
* @event submit
|
|
442
|
+
*/
|
|
120
443
|
this.$emit('submit');
|
|
121
444
|
}
|
|
445
|
+
},
|
|
446
|
+
visibleCallback(visible) {
|
|
447
|
+
if (visible) {
|
|
448
|
+
this.$nextTick(this.setHeight);
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
setHeight() {
|
|
452
|
+
this.$nextTick(() => {
|
|
453
|
+
window.requestAnimationFrame(() => {
|
|
454
|
+
this.heightInPx = this.computeHeight();
|
|
455
|
+
});
|
|
456
|
+
});
|
|
457
|
+
},
|
|
458
|
+
computeHeight() {
|
|
459
|
+
if (this.computedRows !== null) {
|
|
460
|
+
return null;
|
|
461
|
+
}
|
|
462
|
+
const el = this.$refs.input;
|
|
463
|
+
if (!el || !isVisible(el)) {
|
|
464
|
+
return null;
|
|
465
|
+
}
|
|
466
|
+
const computedStyle = getComputedStyle(el);
|
|
467
|
+
const lineHeight = toFloat(computedStyle.lineHeight, 1);
|
|
468
|
+
const border = toFloat(computedStyle.borderTopWidth, 0) + toFloat(computedStyle.borderBottomWidth, 0);
|
|
469
|
+
const padding = toFloat(computedStyle.paddingTop, 0) + toFloat(computedStyle.paddingBottom, 0);
|
|
470
|
+
const offset = border + padding;
|
|
471
|
+
const minHeight = lineHeight * this.computedMinRows + offset;
|
|
472
|
+
const oldHeight = el.style.height || computedStyle.height;
|
|
473
|
+
el.style.height = 'auto';
|
|
474
|
+
const scrollHeight = el.scrollHeight;
|
|
475
|
+
el.style.height = oldHeight;
|
|
476
|
+
const contentRows = Math.max((scrollHeight - padding) / lineHeight, 2);
|
|
477
|
+
const rows = Math.min(Math.max(contentRows, this.computedMinRows), this.computedMaxRows);
|
|
478
|
+
const height = Math.max(Math.ceil(rows * lineHeight + offset), minHeight);
|
|
479
|
+
return `${height}px`;
|
|
480
|
+
},
|
|
481
|
+
select() {
|
|
482
|
+
this.$refs.input.select(...arguments);
|
|
483
|
+
},
|
|
484
|
+
setSelectionRange() {
|
|
485
|
+
this.$refs.input.setSelectionRange(...arguments);
|
|
486
|
+
},
|
|
487
|
+
setRangeText() {
|
|
488
|
+
this.$refs.input.setRangeText(...arguments);
|
|
489
|
+
},
|
|
490
|
+
setCustomValidity() {
|
|
491
|
+
return this.$refs.input.setCustomValidity(...arguments);
|
|
492
|
+
},
|
|
493
|
+
checkValidity() {
|
|
494
|
+
return this.$refs.input.checkValidity(...arguments);
|
|
495
|
+
},
|
|
496
|
+
reportValidity() {
|
|
497
|
+
return this.$refs.input.reportValidity(...arguments);
|
|
122
498
|
}
|
|
123
499
|
}
|
|
124
500
|
};
|
|
@@ -127,11 +503,11 @@ var script = {
|
|
|
127
503
|
const __vue_script__ = script;
|
|
128
504
|
|
|
129
505
|
/* template */
|
|
130
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.showCharacterCount)?_c('div',[_c('
|
|
506
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.showCharacterCount)?_c('div',[_c('textarea',_vm._g(_vm._b({directives:[{name:"b-visible",rawName:"v-b-visible.640",value:(_vm.visibleCallback),expression:"visibleCallback",modifiers:{"640":true}}],ref:"input",class:_vm.computedClass,style:(_vm.computedStyle),attrs:{"aria-describedby":_vm.characterCountTextId},domProps:{"value":_vm.localValue},on:{"keyup":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.handleKeyPress.apply(null, arguments)}}},'textarea',_vm.computedAttrs,false),_vm.computedListeners)),_vm._v(" "),_c('gl-form-character-count',{attrs:{"value":_vm.value,"limit":_vm.characterCountLimit,"count-text-id":_vm.characterCountTextId},scopedSlots:_vm._u([{key:"over-limit-text",fn:function(ref){
|
|
131
507
|
var count = ref.count;
|
|
132
508
|
return [_vm._t("character-count-over-limit-text",null,{"count":count})]}},{key:"remaining-count-text",fn:function(ref){
|
|
133
509
|
var count = ref.count;
|
|
134
|
-
return [_vm._t("remaining-character-count-text",null,{"count":count})]}}],null,true)})],1):_c('
|
|
510
|
+
return [_vm._t("remaining-character-count-text",null,{"count":count})]}}],null,true)})],1):_c('textarea',_vm._g(_vm._b({directives:[{name:"b-visible",rawName:"v-b-visible.640",value:(_vm.visibleCallback),expression:"visibleCallback",modifiers:{"640":true}}],ref:"input",class:_vm.computedClass,style:(_vm.computedStyle),domProps:{"value":_vm.localValue},on:{"keyup":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.handleKeyPress.apply(null, arguments)}}},'textarea',_vm.computedAttrs,false),_vm.computedListeners))};
|
|
135
511
|
var __vue_staticRenderFns__ = [];
|
|
136
512
|
|
|
137
513
|
/* style */
|
|
@@ -75,7 +75,7 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
|
|
|
75
75
|
} ],attrs:{"role":"option","tabindex":_vm.isFocused ? 0 : -1,"aria-selected":_vm.isSelected,"aria-disabled":_vm.isDisabled},on:{"mousedown":_vm.onMousedown,"click":_vm.toggleSelection,"keydown":_vm.onKeydown}},[_c('span',{staticClass:"gl-new-dropdown-item-content"},[_c('gl-icon',{class:[
|
|
76
76
|
'gl-new-dropdown-item-check-icon',
|
|
77
77
|
{ 'gl-invisible': !_vm.isSelected },
|
|
78
|
-
_vm.checkedClasses ],attrs:{"name":"
|
|
78
|
+
_vm.checkedClasses ],attrs:{"name":"check","data-testid":"dropdown-item-checkbox"}}),_vm._v(" "),_c('span',{staticClass:"gl-new-dropdown-item-text-wrapper"},[_vm._t("default")],2)],1)])};
|
|
79
79
|
var __vue_staticRenderFns__ = [];
|
|
80
80
|
|
|
81
81
|
/* style */
|
|
@@ -18,7 +18,6 @@ const NAME_FORM_SELECT = 'BFormSelect';
|
|
|
18
18
|
const NAME_FORM_SELECT_OPTION = 'BFormSelectOption';
|
|
19
19
|
const NAME_FORM_SELECT_OPTION_GROUP = 'BFormSelectOptionGroup';
|
|
20
20
|
const NAME_FORM_TEXT = 'BFormText';
|
|
21
|
-
const NAME_FORM_TEXTAREA = 'BFormTextarea';
|
|
22
21
|
const NAME_FORM_VALID_FEEDBACK = 'BFormValidFeedback';
|
|
23
22
|
const NAME_LINK = 'BLink';
|
|
24
23
|
const NAME_MODAL = 'BModal';
|
|
@@ -52,4 +51,4 @@ const NAME_TRANSITION = 'BVTransition';
|
|
|
52
51
|
const NAME_TRANSPORTER = 'BVTransporter';
|
|
53
52
|
const NAME_TRANSPORTER_TARGET = 'BVTransporterTarget';
|
|
54
53
|
|
|
55
|
-
export { NAME_BUTTON, NAME_BUTTON_CLOSE, NAME_COL, NAME_DROPDOWN, NAME_DROPDOWN_DIVIDER, NAME_DROPDOWN_FORM, NAME_DROPDOWN_GROUP, NAME_DROPDOWN_HEADER, NAME_DROPDOWN_ITEM, NAME_DROPDOWN_ITEM_BUTTON, NAME_DROPDOWN_TEXT, NAME_FORM, NAME_FORM_BUTTON_LABEL_CONTROL, NAME_FORM_GROUP, NAME_FORM_INVALID_FEEDBACK, NAME_FORM_RATING_STAR, NAME_FORM_ROW, NAME_FORM_SELECT, NAME_FORM_SELECT_OPTION, NAME_FORM_SELECT_OPTION_GROUP, NAME_FORM_TEXT,
|
|
54
|
+
export { NAME_BUTTON, NAME_BUTTON_CLOSE, NAME_COL, NAME_DROPDOWN, NAME_DROPDOWN_DIVIDER, NAME_DROPDOWN_FORM, NAME_DROPDOWN_GROUP, NAME_DROPDOWN_HEADER, NAME_DROPDOWN_ITEM, NAME_DROPDOWN_ITEM_BUTTON, NAME_DROPDOWN_TEXT, NAME_FORM, NAME_FORM_BUTTON_LABEL_CONTROL, NAME_FORM_GROUP, NAME_FORM_INVALID_FEEDBACK, NAME_FORM_RATING_STAR, NAME_FORM_ROW, NAME_FORM_SELECT, NAME_FORM_SELECT_OPTION, NAME_FORM_SELECT_OPTION_GROUP, NAME_FORM_TEXT, NAME_FORM_VALID_FEEDBACK, NAME_LINK, NAME_MODAL, NAME_POPOVER, NAME_POPOVER_HELPER, NAME_POPOVER_TEMPLATE, NAME_POPPER, NAME_TAB, NAME_TABLE, NAME_TABLE_CELL, NAME_TABLE_LITE, NAME_TABLE_SIMPLE, NAME_TABS, NAME_TAB_BUTTON_HELPER, NAME_TBODY, NAME_TFOOT, NAME_TH, NAME_THEAD, NAME_TOAST, NAME_TOASTER, NAME_TOAST_POP, NAME_TOOLTIP, NAME_TOOLTIP_HELPER, NAME_TOOLTIP_TEMPLATE, NAME_TR, NAME_TRANSITION, NAME_TRANSPORTER, NAME_TRANSPORTER_TARGET };
|
package/package.json
CHANGED
|
@@ -142,7 +142,7 @@ export default {
|
|
|
142
142
|
>
|
|
143
143
|
<gl-icon
|
|
144
144
|
v-if="shouldShowCheckIcon"
|
|
145
|
-
name="
|
|
145
|
+
name="check"
|
|
146
146
|
data-testid="dropdown-item-checkbox"
|
|
147
147
|
:class="['gl-dropdown-item-check-icon', { 'gl-invisible': !isChecked }, checkedClasses]"
|
|
148
148
|
/>
|