@gitlab/ui 37.1.0 → 37.2.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/CHANGELOG.md +7 -0
- package/dist/components/base/form/form_input_group/form_input_group.documentation.js +2 -26
- package/dist/components/base/form/form_input_group/form_input_group.js +7 -0
- package/dist/components/base/loading_icon/loading_icon.js +1 -1
- package/dist/components/base/pagination/pagination.js +22 -2
- package/dist/components/base/path/path.js +9 -3
- package/documentation/documented_stories.js +1 -0
- package/package.json +1 -1
- package/src/components/base/form/form_input_group/form_input_group.documentation.js +0 -28
- package/src/components/base/form/form_input_group/form_input_group.md +0 -4
- package/src/components/base/form/form_input_group/form_input_group.stories.js +84 -62
- package/src/components/base/form/form_input_group/form_input_group.vue +9 -0
- package/src/components/base/loading_icon/loading_icon.vue +1 -1
- package/src/components/base/pagination/pagination.spec.js +9 -2
- package/src/components/base/pagination/pagination.vue +22 -6
- package/src/components/base/path/path.spec.js +12 -0
- package/src/components/base/path/path.vue +8 -3
- package/src/components/base/tabs/tabs/tabs.stories.js +2 -4
- package/dist/components/base/form/form_input_group/examples/form_input_group.basic.example.js +0 -38
- package/dist/components/base/form/form_input_group/examples/form_input_group.predefined_options.example.js +0 -54
- package/dist/components/base/form/form_input_group/examples/form_input_group.predefined_reactive.example.js +0 -55
- package/dist/components/base/form/form_input_group/examples/form_input_group.reactive.example.js +0 -48
- package/dist/components/base/form/form_input_group/examples/index.js +0 -27
- package/src/components/base/form/form_input_group/examples/form_input_group.basic.example.vue +0 -10
- package/src/components/base/form/form_input_group/examples/form_input_group.predefined_options.example.vue +0 -25
- package/src/components/base/form/form_input_group/examples/form_input_group.predefined_reactive.example.vue +0 -32
- package/src/components/base/form/form_input_group/examples/form_input_group.reactive.example.vue +0 -25
- package/src/components/base/form/form_input_group/examples/index.js +0 -32
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [37.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.1.0...v37.2.0) (2022-03-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **GlPath:** allow changing selected index programmatically ([d711441](https://gitlab.com/gitlab-org/gitlab-ui/commit/d71144162363ae62ff4d1aeb3ee3dc956bd04108))
|
|
7
|
+
|
|
1
8
|
# [37.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.0.0...v37.1.0) (2022-02-28)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -1,32 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var description = "# Form Group Input\n\n<!-- STORY -->\n\nThe `GlFormInputGroup` component allows one to build more advanced text\ninput fields than generic `GlFormInput` when one needs that flexibility.\nBasic usage of the component:\n\n```html\n<div>\n <gl-form-input-group>\n <template #prepend>\n <!-- Content to prepend your text input field -->\n </template>\n <template #append>\n <!-- Content to append your text input field -->\n </template>\n </gl-form-input-group>\n</div>\n```\n\nOne can use any other component (custom or `<gl-*>`) in both slots or\nnot to use the slots at all. In the latter, the component will fallback\nto simple `GlFormInput`.\n\n## Predefined options\n\nSometimes custom text input from the user isn't desired. Instead, the\nuser should pick one of the predefined options that will automatically\npopulate the input field. Typically, such cases will also include an\nactionable button (like **Copy**) put into the `append` slot.\n\nTo achieve this effect, the `GlFormInputGroup` component accepts an\narray of options in the form of `predefinedOptions` param. For example:\n\n```javascript\nconst optionValues = [\n { name: 'Option #1', value: 'Option #1 is selected!' },\n { name: 'Option #2', value: 'Option #2 is selected!' },\n];\n...\n<gl-form-input-group :predefined-options=\"optionValues\" />\n```\n\nThis will tell `GlFormInputGroup` to render a dropdown in the `prepend`\nslot with all of the supplied options' `name`s. When one of the options\nis selected, the input field is automatically populated with the\noption's `value`. Check the \"Examples\" section below for \"With\npredefined options\" example.\n\n### Pro tips\n\nRead some useful tips below about specific usage of the component.\n\n### Readonly input\n\nOften you want to make sure user doesn't mess up the predefined content\npasted into the input field. In this case, you can set `readonly`\nparam to `true`. You can play with `Readonly` knob on the right.\n\n### Preselect the text to copy\n\nIf you set the `readonly` param on the `GlFormInputGroup` component,\nusers will still be able to manually select the text and copy it.\nHowever, it's more user-friendly to preselect the text for the users if\nthey click anywhere in the input field. This can be achieved by setting\nthe `select-on-click` param to `true`. You can play with\n`Select text on click` knob on the right. Even better, try enabling\n`Readonly`, `Select text on click`, and `Switch to predefined input`\naltogether. And, probably, remove `Prepend text`. Or leave it. It's your\ncall. :)\n";
|
|
1
|
+
var description = "The `GlFormInputGroup` component allows one to build more advanced text\ninput fields than generic `GlFormInput` when one needs that flexibility.\nBasic usage of the component:\n\n```html\n<div>\n <gl-form-input-group>\n <template #prepend>\n <!-- Content to prepend your text input field -->\n </template>\n <template #append>\n <!-- Content to append your text input field -->\n </template>\n </gl-form-input-group>\n</div>\n```\n\nOne can use any other component (custom or `<gl-*>`) in both slots or\nnot to use the slots at all. In the latter, the component will fallback\nto simple `GlFormInput`.\n\n## Predefined options\n\nSometimes custom text input from the user isn't desired. Instead, the\nuser should pick one of the predefined options that will automatically\npopulate the input field. Typically, such cases will also include an\nactionable button (like **Copy**) put into the `append` slot.\n\nTo achieve this effect, the `GlFormInputGroup` component accepts an\narray of options in the form of `predefinedOptions` param. For example:\n\n```javascript\nconst optionValues = [\n { name: 'Option #1', value: 'Option #1 is selected!' },\n { name: 'Option #2', value: 'Option #2 is selected!' },\n];\n...\n<gl-form-input-group :predefined-options=\"optionValues\" />\n```\n\nThis will tell `GlFormInputGroup` to render a dropdown in the `prepend`\nslot with all of the supplied options' `name`s. When one of the options\nis selected, the input field is automatically populated with the\noption's `value`. Check the \"Examples\" section below for \"With\npredefined options\" example.\n\n### Pro tips\n\nRead some useful tips below about specific usage of the component.\n\n### Readonly input\n\nOften you want to make sure user doesn't mess up the predefined content\npasted into the input field. In this case, you can set `readonly`\nparam to `true`. You can play with `Readonly` knob on the right.\n\n### Preselect the text to copy\n\nIf you set the `readonly` param on the `GlFormInputGroup` component,\nusers will still be able to manually select the text and copy it.\nHowever, it's more user-friendly to preselect the text for the users if\nthey click anywhere in the input field. This can be achieved by setting\nthe `select-on-click` param to `true`. You can play with\n`Select text on click` knob on the right. Even better, try enabling\n`Readonly`, `Select text on click`, and `Switch to predefined input`\naltogether. And, probably, remove `Prepend text`. Or leave it. It's your\ncall. :)\n";
|
|
4
2
|
|
|
5
3
|
var form_input_group_documentation = {
|
|
6
4
|
followsDesignSystem: false,
|
|
7
|
-
description
|
|
8
|
-
examples,
|
|
9
|
-
bootstrapComponent: 'b-form-input',
|
|
10
|
-
propsInfo: {
|
|
11
|
-
'select-on-click': {
|
|
12
|
-
type: Boolean,
|
|
13
|
-
additionalInfo: 'Automatically selects the content of the input field on click'
|
|
14
|
-
},
|
|
15
|
-
'predefined-options': {
|
|
16
|
-
type: Array,
|
|
17
|
-
additionalInfo: 'Array of options. Each option should have `name` and `value` information: {name: "Foo", value: "Bar"})'
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
slots: [{
|
|
21
|
-
name: 'default',
|
|
22
|
-
description: 'Allows replacement of default input field.'
|
|
23
|
-
}, {
|
|
24
|
-
name: 'prepend',
|
|
25
|
-
description: 'Is rendered in front of the input field.'
|
|
26
|
-
}, {
|
|
27
|
-
name: 'append',
|
|
28
|
-
description: 'Is rendered after the input field.'
|
|
29
|
-
}]
|
|
5
|
+
description
|
|
30
6
|
};
|
|
31
7
|
|
|
32
8
|
export default form_input_group_documentation;
|
|
@@ -16,11 +16,18 @@ var script = {
|
|
|
16
16
|
},
|
|
17
17
|
mixins: [InputGroupMixin],
|
|
18
18
|
props: {
|
|
19
|
+
/**
|
|
20
|
+
* Automatically selects the content of the input field on click.
|
|
21
|
+
*/
|
|
19
22
|
selectOnClick: {
|
|
20
23
|
type: Boolean,
|
|
21
24
|
required: false,
|
|
22
25
|
default: false
|
|
23
26
|
},
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Array of options. Each option should have `name` and `value` information: {name: "Foo", value: "Bar"})
|
|
30
|
+
*/
|
|
24
31
|
predefinedOptions: {
|
|
25
32
|
type: Array,
|
|
26
33
|
required: false,
|
|
@@ -67,7 +67,7 @@ var script = {
|
|
|
67
67
|
const __vue_script__ = script;
|
|
68
68
|
|
|
69
69
|
/* template */
|
|
70
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.rootElementType,{tag:"component",staticClass:"gl-spinner-container",attrs:{"role":"status"}},[_c('span',{staticClass:"align-text-bottom",class:_vm.cssClasses,attrs:{"aria-label":_vm.label}})])};
|
|
70
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.rootElementType,{tag:"component",staticClass:"gl-spinner-container",attrs:{"role":"status"}},[_c('span',{staticClass:"gl-vertical-align-text-bottom!",class:_vm.cssClasses,attrs:{"aria-label":_vm.label}})])};
|
|
71
71
|
var __vue_staticRenderFns__ = [];
|
|
72
72
|
|
|
73
73
|
/* style */
|
|
@@ -277,6 +277,26 @@ var script = {
|
|
|
277
277
|
|
|
278
278
|
nextPageIsDisabled() {
|
|
279
279
|
return this.pageIsDisabled(this.value + 1);
|
|
280
|
+
},
|
|
281
|
+
|
|
282
|
+
prevPageAriaLabel() {
|
|
283
|
+
return this.prevPageIsDisabled ? false : this.labelPrevPage || this.labelPage(this.value - 1);
|
|
284
|
+
},
|
|
285
|
+
|
|
286
|
+
nextPageAriaLabel() {
|
|
287
|
+
return this.nextPageIsDisabled ? false : this.labelNextPage || this.labelPage(this.value + 1);
|
|
288
|
+
},
|
|
289
|
+
|
|
290
|
+
prevPageHref() {
|
|
291
|
+
if (this.prevPageIsDisabled) return false;
|
|
292
|
+
if (this.isLinkBased) return this.linkGen(this.value - 1);
|
|
293
|
+
return '#';
|
|
294
|
+
},
|
|
295
|
+
|
|
296
|
+
nextPageHref() {
|
|
297
|
+
if (this.nextPageIsDisabled) return false;
|
|
298
|
+
if (this.isLinkBased) return this.linkGen(this.value + 1);
|
|
299
|
+
return '#';
|
|
280
300
|
}
|
|
281
301
|
|
|
282
302
|
},
|
|
@@ -392,13 +412,13 @@ const __vue_script__ = script;
|
|
|
392
412
|
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.isVisible)?_c('ul',{staticClass:"pagination gl-pagination text-nowrap",class:_vm.wrapperClasses,attrs:{"role":"navigation","aria-label":"Pagination"}},[_c('li',{staticClass:"page-item",class:{
|
|
393
413
|
disabled: _vm.prevPageIsDisabled,
|
|
394
414
|
'flex-fill': _vm.isFillAlign,
|
|
395
|
-
}},[_c(_vm.prevPageIsDisabled ? 'span' : 'a',{tag:"component",staticClass:"gl-link page-link prev-page-item gl-display-flex",attrs:{"aria-
|
|
415
|
+
},attrs:{"aria-hidden":_vm.prevPageIsDisabled}},[_c(_vm.prevPageIsDisabled ? 'span' : 'a',{tag:"component",staticClass:"gl-link page-link prev-page-item gl-display-flex",attrs:{"aria-label":_vm.prevPageAriaLabel,"href":_vm.prevPageHref},on:{"click":function($event){return _vm.handlePrevious($event, _vm.value - 1)}}},[_vm._t("previous",[_c('gl-icon',{attrs:{"name":"chevron-left"}}),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.prevText))])],null,{ page: _vm.value - 1, disabled: _vm.prevPageIsDisabled })],2)],1),_vm._v(" "),_vm._l((_vm.visibleItems),function(item){return _c('li',{key:item.key,staticClass:"page-item",class:{
|
|
396
416
|
disabled: item.disabled,
|
|
397
417
|
'flex-fill': _vm.isFillAlign,
|
|
398
418
|
}},[_c(item.component,_vm._g(_vm._b({tag:"component",staticClass:"page-link",attrs:{"size":"md","aria-disabled":item.disabled}},'component',item.attrs,false),item.listeners),[_vm._t(item.slot,[_vm._v(_vm._s(item.content))],null,item.slotData)],2)],1)}),_vm._v(" "),_c('li',{staticClass:"page-item",class:{
|
|
399
419
|
disabled: _vm.nextPageIsDisabled,
|
|
400
420
|
'flex-fill': _vm.isFillAlign,
|
|
401
|
-
}},[_c(_vm.nextPageIsDisabled ? 'span' : 'a',{tag:"component",staticClass:"gl-link page-link next-page-item gl-display-flex",attrs:{"aria-
|
|
421
|
+
},attrs:{"aria-hidden":_vm.nextPageIsDisabled}},[_c(_vm.nextPageIsDisabled ? 'span' : 'a',{tag:"component",staticClass:"gl-link page-link next-page-item gl-display-flex",attrs:{"aria-label":_vm.nextPageAriaLabel,"href":_vm.nextPageHref},on:{"click":function($event){return _vm.handleNext($event, _vm.value + 1)}}},[_vm._t("next",[_c('span',[_vm._v(_vm._s(_vm.nextText))]),_vm._v(" "),_c('gl-icon',{attrs:{"name":"chevron-right"}})],null,{ page: _vm.value + 1, disabled: _vm.nextPageIsDisabled })],2)],1)],2):_vm._e()};
|
|
402
422
|
var __vue_staticRenderFns__ = [];
|
|
403
423
|
|
|
404
424
|
/* style */
|
|
@@ -89,10 +89,16 @@ var script = {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
},
|
|
92
|
+
watch: {
|
|
93
|
+
items: {
|
|
94
|
+
immediate: true,
|
|
95
|
+
|
|
96
|
+
handler(items) {
|
|
97
|
+
const selectedIndex = items.findIndex(item => item.selected);
|
|
98
|
+
this.selectedIndex = selectedIndex > 0 ? selectedIndex : 0;
|
|
99
|
+
}
|
|
92
100
|
|
|
93
|
-
|
|
94
|
-
const selectedIndex = this.items.findIndex(item => item.selected);
|
|
95
|
-
this.selectedIndex = selectedIndex > 0 ? selectedIndex : 0;
|
|
101
|
+
}
|
|
96
102
|
},
|
|
97
103
|
|
|
98
104
|
beforeCreate() {
|
package/package.json
CHANGED
|
@@ -1,34 +1,6 @@
|
|
|
1
|
-
import examples from './examples';
|
|
2
1
|
import description from './form_input_group.md';
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
4
|
followsDesignSystem: false,
|
|
6
5
|
description,
|
|
7
|
-
examples,
|
|
8
|
-
bootstrapComponent: 'b-form-input',
|
|
9
|
-
propsInfo: {
|
|
10
|
-
'select-on-click': {
|
|
11
|
-
type: Boolean,
|
|
12
|
-
additionalInfo: 'Automatically selects the content of the input field on click',
|
|
13
|
-
},
|
|
14
|
-
'predefined-options': {
|
|
15
|
-
type: Array,
|
|
16
|
-
additionalInfo:
|
|
17
|
-
'Array of options. Each option should have `name` and `value` information: {name: "Foo", value: "Bar"})',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
slots: [
|
|
21
|
-
{
|
|
22
|
-
name: 'default',
|
|
23
|
-
description: 'Allows replacement of default input field.',
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: 'prepend',
|
|
27
|
-
description: 'Is rendered in front of the input field.',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'append',
|
|
31
|
-
description: 'Is rendered after the input field.',
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
6
|
};
|
|
@@ -1,73 +1,95 @@
|
|
|
1
|
-
import { withKnobs, boolean, object, text } from '@storybook/addon-knobs';
|
|
2
|
-
import { documentedStoriesOf } from '../../../../../documentation/documented_stories';
|
|
3
1
|
import { GlFormInputGroup, GlInputGroupText } from '../../../../index';
|
|
2
|
+
import { disableControls } from '../../../../utils/stories_utils';
|
|
4
3
|
import readme from './form_input_group.md';
|
|
5
4
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
const template = `
|
|
6
|
+
<gl-form-input-group
|
|
7
|
+
:readonly="readonly"
|
|
8
|
+
:select-on-click="selectOnClick"
|
|
9
|
+
:predefined-options="predefinedOptions"
|
|
10
|
+
:label="label"
|
|
11
|
+
:inputClass="inputClass">
|
|
12
|
+
<template #prepend v-if="prepend">
|
|
13
|
+
<gl-input-group-text>{{prepend}}</gl-input-group-text>
|
|
14
|
+
</template>
|
|
15
|
+
<template #append v-if="append">
|
|
16
|
+
<gl-input-group-text>{{append}}</gl-input-group-text>
|
|
17
|
+
</template>
|
|
18
|
+
</gl-form-input-group>
|
|
19
|
+
`;
|
|
14
20
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
const defaultValue = (prop) => GlFormInputGroup.props[prop].default;
|
|
22
|
+
|
|
23
|
+
const generateProps = ({
|
|
24
|
+
prepend = 'Username',
|
|
25
|
+
append = 'Add',
|
|
26
|
+
readonly = false,
|
|
27
|
+
selectOnClick = false,
|
|
28
|
+
predefinedOptions = defaultValue('predefinedOptions')(),
|
|
29
|
+
label = '',
|
|
30
|
+
inputClass = '',
|
|
31
|
+
} = {}) => ({
|
|
32
|
+
prepend,
|
|
33
|
+
append,
|
|
34
|
+
readonly,
|
|
35
|
+
selectOnClick,
|
|
36
|
+
predefinedOptions,
|
|
37
|
+
label,
|
|
38
|
+
inputClass,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const Template = (args, { argTypes }) => ({
|
|
42
|
+
components: { GlFormInputGroup, GlInputGroupText },
|
|
43
|
+
props: Object.keys(argTypes),
|
|
44
|
+
template,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const Default = Template.bind({});
|
|
48
|
+
Default.args = generateProps();
|
|
49
|
+
|
|
50
|
+
export const PredefinedOptions = Template.bind({});
|
|
51
|
+
PredefinedOptions.args = generateProps({
|
|
52
|
+
prepend: '',
|
|
53
|
+
predefinedOptions: [
|
|
54
|
+
{ name: 'Embed', value: 'https://embed.com' },
|
|
55
|
+
{ name: 'Share', value: 'https://share.org' },
|
|
56
|
+
],
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export default {
|
|
60
|
+
title: 'base/form/form-input-group',
|
|
61
|
+
component: GlFormInputGroup,
|
|
62
|
+
knobs: { disabled: true },
|
|
63
|
+
parameters: {
|
|
64
|
+
bootstrapComponent: 'b-form-input',
|
|
65
|
+
docs: {
|
|
66
|
+
description: {
|
|
67
|
+
component: readme,
|
|
31
68
|
},
|
|
32
69
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</template>
|
|
41
|
-
</gl-form-input-group>
|
|
42
|
-
`,
|
|
43
|
-
}))
|
|
44
|
-
.add('with predefined options', () => ({
|
|
45
|
-
components,
|
|
46
|
-
props: {
|
|
47
|
-
prepend: {
|
|
48
|
-
default: text('Prepend text', ''),
|
|
70
|
+
knobs: { disabled: true },
|
|
71
|
+
},
|
|
72
|
+
argTypes: {
|
|
73
|
+
...disableControls(['value']),
|
|
74
|
+
prepend: {
|
|
75
|
+
control: {
|
|
76
|
+
type: 'text',
|
|
49
77
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
default: boolean('Readonly', false),
|
|
78
|
+
},
|
|
79
|
+
append: {
|
|
80
|
+
control: {
|
|
81
|
+
type: 'text',
|
|
55
82
|
},
|
|
56
|
-
|
|
57
|
-
|
|
83
|
+
},
|
|
84
|
+
inputClass: {
|
|
85
|
+
control: {
|
|
86
|
+
type: 'text',
|
|
58
87
|
},
|
|
59
|
-
|
|
60
|
-
|
|
88
|
+
},
|
|
89
|
+
label: {
|
|
90
|
+
control: {
|
|
91
|
+
type: 'text',
|
|
61
92
|
},
|
|
62
93
|
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
<template #prepend v-if="prepend">
|
|
66
|
-
<gl-input-group-text>{{prepend}}</gl-input-group-text>
|
|
67
|
-
</template>
|
|
68
|
-
<template #append v-if="append">
|
|
69
|
-
<gl-input-group-text>{{append}}</gl-input-group-text>
|
|
70
|
-
</template>
|
|
71
|
-
</gl-form-input-group>
|
|
72
|
-
`,
|
|
73
|
-
}));
|
|
94
|
+
},
|
|
95
|
+
};
|
|
@@ -16,11 +16,17 @@ export default {
|
|
|
16
16
|
},
|
|
17
17
|
mixins: [InputGroupMixin],
|
|
18
18
|
props: {
|
|
19
|
+
/**
|
|
20
|
+
* Automatically selects the content of the input field on click.
|
|
21
|
+
*/
|
|
19
22
|
selectOnClick: {
|
|
20
23
|
type: Boolean,
|
|
21
24
|
required: false,
|
|
22
25
|
default: false,
|
|
23
26
|
},
|
|
27
|
+
/**
|
|
28
|
+
* Array of options. Each option should have `name` and `value` information: {name: "Foo", value: "Bar"})
|
|
29
|
+
*/
|
|
24
30
|
predefinedOptions: {
|
|
25
31
|
type: Array,
|
|
26
32
|
required: false,
|
|
@@ -61,6 +67,7 @@ export default {
|
|
|
61
67
|
<div>
|
|
62
68
|
<b-input-group>
|
|
63
69
|
<b-input-group-prepend v-if="activeOption || $scopedSlots.prepend">
|
|
70
|
+
<!-- @slot Is rendered in front of the input field. -->
|
|
64
71
|
<slot name="prepend"></slot>
|
|
65
72
|
<gl-dropdown v-if="activeOption" :text="activeOption">
|
|
66
73
|
<gl-dropdown-item
|
|
@@ -74,6 +81,7 @@ export default {
|
|
|
74
81
|
</gl-dropdown-item>
|
|
75
82
|
</gl-dropdown>
|
|
76
83
|
</b-input-group-prepend>
|
|
84
|
+
<!-- @slot Allows replacement of default input field. -->
|
|
77
85
|
<slot>
|
|
78
86
|
<b-form-input
|
|
79
87
|
ref="input"
|
|
@@ -86,6 +94,7 @@ export default {
|
|
|
86
94
|
/>
|
|
87
95
|
</slot>
|
|
88
96
|
<b-input-group-append v-if="$scopedSlots.append">
|
|
97
|
+
<!-- @slot Is rendered after the input field. -->
|
|
89
98
|
<slot name="append"></slot>
|
|
90
99
|
</b-input-group-append>
|
|
91
100
|
</b-input-group>
|
|
@@ -64,6 +64,6 @@ export default {
|
|
|
64
64
|
</script>
|
|
65
65
|
<template>
|
|
66
66
|
<component :is="rootElementType" class="gl-spinner-container" role="status">
|
|
67
|
-
<span :class="cssClasses" class="align-text-bottom" :aria-label="label"></span>
|
|
67
|
+
<span :class="cssClasses" class="gl-vertical-align-text-bottom!" :aria-label="label"></span>
|
|
68
68
|
</component>
|
|
69
69
|
</template>
|
|
@@ -16,6 +16,7 @@ const mockResizeWidth = (width) => {
|
|
|
16
16
|
describe('pagination component', () => {
|
|
17
17
|
let wrapper;
|
|
18
18
|
const findButtons = () => wrapper.findAll('.page-link');
|
|
19
|
+
const findItems = () => wrapper.findAll('.page-item');
|
|
19
20
|
const propsData = {
|
|
20
21
|
value: 3,
|
|
21
22
|
perPage: 5,
|
|
@@ -375,9 +376,12 @@ describe('pagination component', () => {
|
|
|
375
376
|
value: 1,
|
|
376
377
|
nextPage: 2,
|
|
377
378
|
});
|
|
379
|
+
const prevItem = findItems().at(0);
|
|
380
|
+
expect(prevItem.attributes('aria-hidden')).toBe('true');
|
|
378
381
|
const prevButton = findButtons().at(0);
|
|
379
382
|
expect(prevButton.element.tagName).toBe('SPAN');
|
|
380
|
-
expect(prevButton.attributes('
|
|
383
|
+
expect(prevButton.attributes('href')).toBeUndefined();
|
|
384
|
+
expect(prevButton.attributes('aria-label')).toBeUndefined();
|
|
381
385
|
});
|
|
382
386
|
|
|
383
387
|
it('disables next button when on last page', () => {
|
|
@@ -386,9 +390,12 @@ describe('pagination component', () => {
|
|
|
386
390
|
value: 2,
|
|
387
391
|
prevPage: 1,
|
|
388
392
|
});
|
|
393
|
+
const nextItem = findItems().at(1);
|
|
394
|
+
expect(nextItem.attributes('aria-hidden')).toBe('true');
|
|
389
395
|
const nextButton = findButtons().at(1);
|
|
390
396
|
expect(nextButton.element.tagName).toBe('SPAN');
|
|
391
|
-
expect(nextButton.attributes('
|
|
397
|
+
expect(nextButton.attributes('href')).toBeUndefined();
|
|
398
|
+
expect(nextButton.attributes('aria-label')).toBeUndefined();
|
|
392
399
|
});
|
|
393
400
|
});
|
|
394
401
|
});
|
|
@@ -261,6 +261,22 @@ export default {
|
|
|
261
261
|
nextPageIsDisabled() {
|
|
262
262
|
return this.pageIsDisabled(this.value + 1);
|
|
263
263
|
},
|
|
264
|
+
prevPageAriaLabel() {
|
|
265
|
+
return this.prevPageIsDisabled ? false : this.labelPrevPage || this.labelPage(this.value - 1);
|
|
266
|
+
},
|
|
267
|
+
nextPageAriaLabel() {
|
|
268
|
+
return this.nextPageIsDisabled ? false : this.labelNextPage || this.labelPage(this.value + 1);
|
|
269
|
+
},
|
|
270
|
+
prevPageHref() {
|
|
271
|
+
if (this.prevPageIsDisabled) return false;
|
|
272
|
+
if (this.isLinkBased) return this.linkGen(this.value - 1);
|
|
273
|
+
return '#';
|
|
274
|
+
},
|
|
275
|
+
nextPageHref() {
|
|
276
|
+
if (this.nextPageIsDisabled) return false;
|
|
277
|
+
if (this.isLinkBased) return this.linkGen(this.value + 1);
|
|
278
|
+
return '#';
|
|
279
|
+
},
|
|
264
280
|
},
|
|
265
281
|
created() {
|
|
266
282
|
window.addEventListener('resize', debounce(this.setBreakpoint, resizeDebounceTime));
|
|
@@ -369,13 +385,13 @@ export default {
|
|
|
369
385
|
disabled: prevPageIsDisabled,
|
|
370
386
|
'flex-fill': isFillAlign,
|
|
371
387
|
}"
|
|
388
|
+
:aria-hidden="prevPageIsDisabled"
|
|
372
389
|
>
|
|
373
390
|
<component
|
|
374
391
|
:is="prevPageIsDisabled ? 'span' : 'a'"
|
|
375
392
|
class="gl-link page-link prev-page-item gl-display-flex"
|
|
376
|
-
:aria-
|
|
377
|
-
:
|
|
378
|
-
:href="isLinkBased ? linkGen(value - 1) : '#'"
|
|
393
|
+
:aria-label="prevPageAriaLabel"
|
|
394
|
+
:href="prevPageHref"
|
|
379
395
|
@click="handlePrevious($event, value - 1)"
|
|
380
396
|
>
|
|
381
397
|
<!--
|
|
@@ -432,13 +448,13 @@ export default {
|
|
|
432
448
|
disabled: nextPageIsDisabled,
|
|
433
449
|
'flex-fill': isFillAlign,
|
|
434
450
|
}"
|
|
451
|
+
:aria-hidden="nextPageIsDisabled"
|
|
435
452
|
>
|
|
436
453
|
<component
|
|
437
454
|
:is="nextPageIsDisabled ? 'span' : 'a'"
|
|
438
455
|
class="gl-link page-link next-page-item gl-display-flex"
|
|
439
|
-
:aria-
|
|
440
|
-
:
|
|
441
|
-
:href="isLinkBased ? linkGen(value + 1) : '#'"
|
|
456
|
+
:aria-label="nextPageAriaLabel"
|
|
457
|
+
:href="nextPageHref"
|
|
442
458
|
@click="handleNext($event, value + 1)"
|
|
443
459
|
>
|
|
444
460
|
<!--
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { nextTick } from 'vue';
|
|
1
2
|
import { shallowMount } from '@vue/test-utils';
|
|
2
3
|
import { mockPathItems } from './data';
|
|
3
4
|
import GlPath from './path.vue';
|
|
@@ -143,6 +144,17 @@ describe('Path', () => {
|
|
|
143
144
|
it('selects the first item', () => {
|
|
144
145
|
expect(pathItemAt(0).classList).toContain(SELECTED_CLASS_INDIGO);
|
|
145
146
|
});
|
|
147
|
+
|
|
148
|
+
it('updates the selected item when props change', async () => {
|
|
149
|
+
const items = JSON.parse(JSON.stringify(mockPathItems));
|
|
150
|
+
items[3].selected = true;
|
|
151
|
+
|
|
152
|
+
wrapper.setProps({ items });
|
|
153
|
+
await nextTick();
|
|
154
|
+
|
|
155
|
+
expect(pathItemAt(0).classList).not.toContain(SELECTED_CLASS_INDIGO);
|
|
156
|
+
expect(pathItemAt(3).classList).toContain(SELECTED_CLASS_INDIGO);
|
|
157
|
+
});
|
|
146
158
|
});
|
|
147
159
|
|
|
148
160
|
describe('with a specifically selected item passed in', () => {
|
|
@@ -79,9 +79,14 @@ export default {
|
|
|
79
79
|
return this.scrollLeft + BOUNDARY_WIDTH;
|
|
80
80
|
},
|
|
81
81
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
watch: {
|
|
83
|
+
items: {
|
|
84
|
+
immediate: true,
|
|
85
|
+
handler(items) {
|
|
86
|
+
const selectedIndex = items.findIndex((item) => item.selected);
|
|
87
|
+
this.selectedIndex = selectedIndex > 0 ? selectedIndex : 0;
|
|
88
|
+
},
|
|
89
|
+
},
|
|
85
90
|
},
|
|
86
91
|
beforeCreate() {
|
|
87
92
|
this.pathUuid = uniqueId('path-');
|
|
@@ -7,10 +7,8 @@ const components = {
|
|
|
7
7
|
GlTab,
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
const defaultValue = (prop) => GlTabs.props[prop].default;
|
|
11
|
-
|
|
12
10
|
const generateProps = ({
|
|
13
|
-
justified
|
|
11
|
+
justified,
|
|
14
12
|
actionPrimary = null,
|
|
15
13
|
actionSecondary = null,
|
|
16
14
|
actionTertiary = null,
|
|
@@ -238,7 +236,7 @@ WithScrollAndGrowing.parameters = {
|
|
|
238
236
|
};
|
|
239
237
|
|
|
240
238
|
export default {
|
|
241
|
-
title: 'base/tabs
|
|
239
|
+
title: 'base/tabs',
|
|
242
240
|
component: GlTabs,
|
|
243
241
|
subcomponents: { GlTab, GlScrollableTabs },
|
|
244
242
|
parameters: {
|
package/dist/components/base/form/form_input_group/examples/form_input_group.basic.example.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
2
|
-
|
|
3
|
-
/* script */
|
|
4
|
-
|
|
5
|
-
/* template */
|
|
6
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-form-input-group',{scopedSlots:_vm._u([{key:"prepend",fn:function(){return [_c('gl-input-group-text',[_vm._v("Username")])]},proxy:true},{key:"append",fn:function(){return [_c('gl-button',{attrs:{"variant":"success"}},[_vm._v("Add")])]},proxy:true}])})};
|
|
7
|
-
var __vue_staticRenderFns__ = [];
|
|
8
|
-
|
|
9
|
-
/* style */
|
|
10
|
-
const __vue_inject_styles__ = undefined;
|
|
11
|
-
/* scoped */
|
|
12
|
-
const __vue_scope_id__ = undefined;
|
|
13
|
-
/* module identifier */
|
|
14
|
-
const __vue_module_identifier__ = undefined;
|
|
15
|
-
/* functional template */
|
|
16
|
-
const __vue_is_functional_template__ = false;
|
|
17
|
-
/* style inject */
|
|
18
|
-
|
|
19
|
-
/* style inject SSR */
|
|
20
|
-
|
|
21
|
-
/* style inject shadow dom */
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const __vue_component__ = __vue_normalize__(
|
|
26
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
27
|
-
__vue_inject_styles__,
|
|
28
|
-
{},
|
|
29
|
-
__vue_scope_id__,
|
|
30
|
-
__vue_is_functional_template__,
|
|
31
|
-
__vue_module_identifier__,
|
|
32
|
-
false,
|
|
33
|
-
undefined,
|
|
34
|
-
undefined,
|
|
35
|
-
undefined
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
export default __vue_component__;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
2
|
-
|
|
3
|
-
var script = {
|
|
4
|
-
data() {
|
|
5
|
-
return {
|
|
6
|
-
optionValues: [{
|
|
7
|
-
name: 'Embed',
|
|
8
|
-
value: 'https://embed.com'
|
|
9
|
-
}, {
|
|
10
|
-
name: 'Share',
|
|
11
|
-
value: 'https://share.org'
|
|
12
|
-
}]
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/* script */
|
|
19
|
-
const __vue_script__ = script;
|
|
20
|
-
|
|
21
|
-
/* template */
|
|
22
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-form-input-group',{attrs:{"predefined-options":_vm.optionValues},scopedSlots:_vm._u([{key:"append",fn:function(){return [_c('gl-button',{attrs:{"variant":"success"}},[_vm._v("Add")])]},proxy:true}])})};
|
|
23
|
-
var __vue_staticRenderFns__ = [];
|
|
24
|
-
|
|
25
|
-
/* style */
|
|
26
|
-
const __vue_inject_styles__ = undefined;
|
|
27
|
-
/* scoped */
|
|
28
|
-
const __vue_scope_id__ = undefined;
|
|
29
|
-
/* module identifier */
|
|
30
|
-
const __vue_module_identifier__ = undefined;
|
|
31
|
-
/* functional template */
|
|
32
|
-
const __vue_is_functional_template__ = false;
|
|
33
|
-
/* style inject */
|
|
34
|
-
|
|
35
|
-
/* style inject SSR */
|
|
36
|
-
|
|
37
|
-
/* style inject shadow dom */
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const __vue_component__ = __vue_normalize__(
|
|
42
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
43
|
-
__vue_inject_styles__,
|
|
44
|
-
__vue_script__,
|
|
45
|
-
__vue_scope_id__,
|
|
46
|
-
__vue_is_functional_template__,
|
|
47
|
-
__vue_module_identifier__,
|
|
48
|
-
false,
|
|
49
|
-
undefined,
|
|
50
|
-
undefined,
|
|
51
|
-
undefined
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
export default __vue_component__;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
2
|
-
|
|
3
|
-
var script = {
|
|
4
|
-
data() {
|
|
5
|
-
return {
|
|
6
|
-
testVal: 'foo',
|
|
7
|
-
optionValues: [{
|
|
8
|
-
name: 'Embed',
|
|
9
|
-
value: 'https://embed.com'
|
|
10
|
-
}, {
|
|
11
|
-
name: 'Share',
|
|
12
|
-
value: 'https://share.org'
|
|
13
|
-
}]
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/* script */
|
|
20
|
-
const __vue_script__ = script;
|
|
21
|
-
|
|
22
|
-
/* template */
|
|
23
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('label',[_vm._v("\n Data outside of the component\n "),_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.testVal),expression:"testVal"}],staticClass:"gl-form-input",attrs:{"type":"text"},domProps:{"value":(_vm.testVal)},on:{"input":function($event){if($event.target.composing){ return; }_vm.testVal=$event.target.value;}}})]),_vm._v(" "),_c('gl-form-input-group',{attrs:{"predefined-options":_vm.optionValues},scopedSlots:_vm._u([{key:"append",fn:function(){return [_c('gl-button',{attrs:{"variant":"success"}},[_vm._v("Add")])]},proxy:true}]),model:{value:(_vm.testVal),callback:function ($$v) {_vm.testVal=$$v;},expression:"testVal"}})],1)};
|
|
24
|
-
var __vue_staticRenderFns__ = [];
|
|
25
|
-
|
|
26
|
-
/* style */
|
|
27
|
-
const __vue_inject_styles__ = undefined;
|
|
28
|
-
/* scoped */
|
|
29
|
-
const __vue_scope_id__ = undefined;
|
|
30
|
-
/* module identifier */
|
|
31
|
-
const __vue_module_identifier__ = undefined;
|
|
32
|
-
/* functional template */
|
|
33
|
-
const __vue_is_functional_template__ = false;
|
|
34
|
-
/* style inject */
|
|
35
|
-
|
|
36
|
-
/* style inject SSR */
|
|
37
|
-
|
|
38
|
-
/* style inject shadow dom */
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const __vue_component__ = __vue_normalize__(
|
|
43
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
44
|
-
__vue_inject_styles__,
|
|
45
|
-
__vue_script__,
|
|
46
|
-
__vue_scope_id__,
|
|
47
|
-
__vue_is_functional_template__,
|
|
48
|
-
__vue_module_identifier__,
|
|
49
|
-
false,
|
|
50
|
-
undefined,
|
|
51
|
-
undefined,
|
|
52
|
-
undefined
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
export default __vue_component__;
|
package/dist/components/base/form/form_input_group/examples/form_input_group.reactive.example.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
2
|
-
|
|
3
|
-
var script = {
|
|
4
|
-
data() {
|
|
5
|
-
return {
|
|
6
|
-
testVal: 'foo'
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/* script */
|
|
13
|
-
const __vue_script__ = script;
|
|
14
|
-
|
|
15
|
-
/* template */
|
|
16
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('label',[_vm._v("\n Data outside of the component\n "),_c('gl-form-input',{attrs:{"type":"text"},model:{value:(_vm.testVal),callback:function ($$v) {_vm.testVal=$$v;},expression:"testVal"}})],1),_vm._v(" "),_c('gl-form-input-group',{scopedSlots:_vm._u([{key:"prepend",fn:function(){return [_c('gl-input-group-text',[_vm._v("Username")])]},proxy:true},{key:"append",fn:function(){return [_c('gl-button',{attrs:{"variant":"success"}},[_vm._v("Add")])]},proxy:true}]),model:{value:(_vm.testVal),callback:function ($$v) {_vm.testVal=$$v;},expression:"testVal"}})],1)};
|
|
17
|
-
var __vue_staticRenderFns__ = [];
|
|
18
|
-
|
|
19
|
-
/* style */
|
|
20
|
-
const __vue_inject_styles__ = undefined;
|
|
21
|
-
/* scoped */
|
|
22
|
-
const __vue_scope_id__ = undefined;
|
|
23
|
-
/* module identifier */
|
|
24
|
-
const __vue_module_identifier__ = undefined;
|
|
25
|
-
/* functional template */
|
|
26
|
-
const __vue_is_functional_template__ = false;
|
|
27
|
-
/* style inject */
|
|
28
|
-
|
|
29
|
-
/* style inject SSR */
|
|
30
|
-
|
|
31
|
-
/* style inject shadow dom */
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const __vue_component__ = __vue_normalize__(
|
|
36
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
37
|
-
__vue_inject_styles__,
|
|
38
|
-
__vue_script__,
|
|
39
|
-
__vue_scope_id__,
|
|
40
|
-
__vue_is_functional_template__,
|
|
41
|
-
__vue_module_identifier__,
|
|
42
|
-
false,
|
|
43
|
-
undefined,
|
|
44
|
-
undefined,
|
|
45
|
-
undefined
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
export default __vue_component__;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import BasicExample from './form_input_group.basic.example';
|
|
2
|
-
import PredefinedOptionsExample from './form_input_group.predefined_options.example';
|
|
3
|
-
import PredefinedReactiveExample from './form_input_group.predefined_reactive.example';
|
|
4
|
-
import ReactiveExample from './form_input_group.reactive.example';
|
|
5
|
-
|
|
6
|
-
var index = [{
|
|
7
|
-
name: 'Text Input Group',
|
|
8
|
-
items: [{
|
|
9
|
-
id: 'input-text-group',
|
|
10
|
-
name: 'Basic',
|
|
11
|
-
component: BasicExample
|
|
12
|
-
}, {
|
|
13
|
-
id: 'input-text-group-reactive',
|
|
14
|
-
name: 'Reactive update of/from the component',
|
|
15
|
-
component: ReactiveExample
|
|
16
|
-
}, {
|
|
17
|
-
id: 'input-text-group-predefined-options',
|
|
18
|
-
name: 'With predefined options',
|
|
19
|
-
component: PredefinedOptionsExample
|
|
20
|
-
}, {
|
|
21
|
-
id: 'input-text-group-predefined-reactive',
|
|
22
|
-
name: 'With predefined options and reactive updates',
|
|
23
|
-
component: PredefinedReactiveExample
|
|
24
|
-
}]
|
|
25
|
-
}];
|
|
26
|
-
|
|
27
|
-
export default index;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export default {
|
|
3
|
-
data() {
|
|
4
|
-
return {
|
|
5
|
-
optionValues: [
|
|
6
|
-
{ name: 'Embed', value: 'https://embed.com' },
|
|
7
|
-
{ name: 'Share', value: 'https://share.org' },
|
|
8
|
-
],
|
|
9
|
-
};
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
</script>
|
|
13
|
-
<template>
|
|
14
|
-
<!--
|
|
15
|
-
optionValues = [
|
|
16
|
-
{ name: 'Embed', value: 'https://embed.com' },
|
|
17
|
-
{ name: 'Share', value: 'https://share.org' },
|
|
18
|
-
]
|
|
19
|
-
-->
|
|
20
|
-
<gl-form-input-group :predefined-options="optionValues">
|
|
21
|
-
<template #append>
|
|
22
|
-
<gl-button variant="success">Add</gl-button>
|
|
23
|
-
</template>
|
|
24
|
-
</gl-form-input-group>
|
|
25
|
-
</template>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export default {
|
|
3
|
-
data() {
|
|
4
|
-
return {
|
|
5
|
-
testVal: 'foo',
|
|
6
|
-
optionValues: [
|
|
7
|
-
{ name: 'Embed', value: 'https://embed.com' },
|
|
8
|
-
{ name: 'Share', value: 'https://share.org' },
|
|
9
|
-
],
|
|
10
|
-
};
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
</script>
|
|
14
|
-
<template>
|
|
15
|
-
<!--
|
|
16
|
-
optionValues = [
|
|
17
|
-
{ name: 'Embed', value: 'https://embed.com' },
|
|
18
|
-
{ name: 'Share', value: 'https://share.org' },
|
|
19
|
-
]
|
|
20
|
-
-->
|
|
21
|
-
<div>
|
|
22
|
-
<label>
|
|
23
|
-
Data outside of the component
|
|
24
|
-
<input v-model="testVal" type="text" class="gl-form-input" />
|
|
25
|
-
</label>
|
|
26
|
-
<gl-form-input-group v-model="testVal" :predefined-options="optionValues">
|
|
27
|
-
<template #append>
|
|
28
|
-
<gl-button variant="success">Add</gl-button>
|
|
29
|
-
</template>
|
|
30
|
-
</gl-form-input-group>
|
|
31
|
-
</div>
|
|
32
|
-
</template>
|
package/src/components/base/form/form_input_group/examples/form_input_group.reactive.example.vue
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export default {
|
|
3
|
-
data() {
|
|
4
|
-
return {
|
|
5
|
-
testVal: 'foo',
|
|
6
|
-
};
|
|
7
|
-
},
|
|
8
|
-
};
|
|
9
|
-
</script>
|
|
10
|
-
<template>
|
|
11
|
-
<div>
|
|
12
|
-
<label>
|
|
13
|
-
Data outside of the component
|
|
14
|
-
<gl-form-input v-model="testVal" type="text" />
|
|
15
|
-
</label>
|
|
16
|
-
<gl-form-input-group v-model="testVal">
|
|
17
|
-
<template #prepend>
|
|
18
|
-
<gl-input-group-text>Username</gl-input-group-text>
|
|
19
|
-
</template>
|
|
20
|
-
<template #append>
|
|
21
|
-
<gl-button variant="success">Add</gl-button>
|
|
22
|
-
</template>
|
|
23
|
-
</gl-form-input-group>
|
|
24
|
-
</div>
|
|
25
|
-
</template>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import BasicExample from './form_input_group.basic.example.vue';
|
|
2
|
-
import PredefinedOptionsExample from './form_input_group.predefined_options.example.vue';
|
|
3
|
-
import PredefinedReactiveExample from './form_input_group.predefined_reactive.example.vue';
|
|
4
|
-
import ReactiveExample from './form_input_group.reactive.example.vue';
|
|
5
|
-
|
|
6
|
-
export default [
|
|
7
|
-
{
|
|
8
|
-
name: 'Text Input Group',
|
|
9
|
-
items: [
|
|
10
|
-
{
|
|
11
|
-
id: 'input-text-group',
|
|
12
|
-
name: 'Basic',
|
|
13
|
-
component: BasicExample,
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
id: 'input-text-group-reactive',
|
|
17
|
-
name: 'Reactive update of/from the component',
|
|
18
|
-
component: ReactiveExample,
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: 'input-text-group-predefined-options',
|
|
22
|
-
name: 'With predefined options',
|
|
23
|
-
component: PredefinedOptionsExample,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
id: 'input-text-group-predefined-reactive',
|
|
27
|
-
name: 'With predefined options and reactive updates',
|
|
28
|
-
component: PredefinedReactiveExample,
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
];
|