@gitlab/ui 38.1.0 → 38.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 +13 -0
- package/dist/components/base/dropdown/dropdown.documentation.js +1 -5
- package/dist/components/base/dropdown/dropdown_item.documentation.js +2 -3
- package/dist/components/base/filtered_search/filtered_search_token.js +28 -16
- package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.documentation.js +2 -27
- package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.js +16 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/utils/use_mock_intersection_observer.js +2 -2
- package/documentation/components_documentation.js +0 -4
- package/documentation/documented_stories.js +4 -1
- package/package.json +3 -3
- package/src/components/base/avatar_link/avatar_link.stories.js +2 -2
- package/src/components/base/dropdown/dropdown.documentation.js +0 -3
- package/src/components/base/dropdown/dropdown.md +7 -2
- package/src/components/base/dropdown/dropdown.stories.js +487 -439
- package/src/components/base/dropdown/dropdown_item.documentation.js +0 -1
- package/src/components/base/dropdown/dropdown_item.md +0 -6
- package/src/components/base/dropdown/dropdown_item.stories.js +107 -35
- package/src/components/base/filtered_search/filtered_search.stories.js +3 -2
- package/src/components/base/filtered_search/filtered_search_token.spec.js +22 -0
- package/src/components/base/filtered_search/filtered_search_token.stories.js +1 -0
- package/src/components/base/filtered_search/filtered_search_token.vue +27 -19
- package/src/components/base/form/form.stories.js +2 -0
- package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.documentation.js +0 -26
- package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.md +0 -4
- package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.stories.js +123 -92
- package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.vue +13 -1
- package/src/components/base/form/form_radio_group/form_radio_group.stories.js +2 -1
- package/src/components/base/markdown/markdown.scss +21 -0
- package/src/components/base/markdown/markdown_typescale_demo.html +17 -6
- package/src/components/base/navbar/navbar.stories.js +2 -1
- package/src/components/base/tabs/tabs/tabs.stories.js +2 -2
- package/src/scss/typescale/typescale.md +0 -2
- package/src/scss/typescale/typescale.stories.js +17 -4
- package/src/utils/use_mock_intersection_observer.js +3 -3
- package/dist/components/base/dropdown/dropdown_divider.documentation.js +0 -8
- package/dist/components/base/dropdown/dropdown_form.documentation.js +0 -17
- package/dist/components/base/dropdown/dropdown_section_header.documentation.js +0 -8
- package/dist/components/base/dropdown/dropdown_text.documentation.js +0 -8
- package/dist/components/base/dropdown/examples/dropdown.default.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.links.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_avatar_and_secondary_text.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_checked_items.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_clear_all.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_divider.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_form.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_header.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_highlighted_items.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_icons.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_right_align.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_search.example.js +0 -67
- package/dist/components/base/dropdown/examples/dropdown.with_section_headers.example.js +0 -38
- package/dist/components/base/dropdown/examples/index.js +0 -85
- package/dist/components/base/form/form_checkbox_tree/examples/form_checkbox_tree.basic.example.js +0 -103
- package/dist/components/base/form/form_checkbox_tree/examples/index.js +0 -13
- package/src/components/base/dropdown/dropdown_divider.documentation.js +0 -6
- package/src/components/base/dropdown/dropdown_divider.md +0 -7
- package/src/components/base/dropdown/dropdown_divider.stories.js +0 -16
- package/src/components/base/dropdown/dropdown_form.documentation.js +0 -9
- package/src/components/base/dropdown/dropdown_form.md +0 -4
- package/src/components/base/dropdown/dropdown_form.stories.js +0 -17
- package/src/components/base/dropdown/dropdown_section_header.documentation.js +0 -6
- package/src/components/base/dropdown/dropdown_section_header.stories.js +0 -17
- package/src/components/base/dropdown/dropdown_text.documentation.js +0 -6
- package/src/components/base/dropdown/dropdown_text.stories.js +0 -16
- package/src/components/base/dropdown/examples/dropdown.default.example.vue +0 -7
- package/src/components/base/dropdown/examples/dropdown.links.example.vue +0 -7
- package/src/components/base/dropdown/examples/dropdown.with_avatar_and_secondary_text.example.vue +0 -7
- package/src/components/base/dropdown/examples/dropdown.with_checked_items.example.vue +0 -6
- package/src/components/base/dropdown/examples/dropdown.with_clear_all.example.vue +0 -7
- package/src/components/base/dropdown/examples/dropdown.with_divider.example.vue +0 -9
- package/src/components/base/dropdown/examples/dropdown.with_form.example.vue +0 -10
- package/src/components/base/dropdown/examples/dropdown.with_header.example.vue +0 -7
- package/src/components/base/dropdown/examples/dropdown.with_highlighted_items.example.vue +0 -9
- package/src/components/base/dropdown/examples/dropdown.with_icons.example.vue +0 -43
- package/src/components/base/dropdown/examples/dropdown.with_right_align.example.vue +0 -7
- package/src/components/base/dropdown/examples/dropdown.with_search.example.vue +0 -38
- package/src/components/base/dropdown/examples/dropdown.with_section_headers.example.vue +0 -10
- package/src/components/base/dropdown/examples/index.js +0 -99
- package/src/components/base/form/form_checkbox_tree/examples/form_checkbox_tree.basic.example.vue +0 -77
- package/src/components/base/form/form_checkbox_tree/examples/index.js +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# [38.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v38.1.0...v38.2.0) (2022-03-31)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **GlFilteredSearch:** Stop mutating value prop ([79aa5bc](https://gitlab.com/gitlab-org/gitlab-ui/commit/79aa5bc9712e293e08842c8c0234e29511de3401))
|
|
7
|
+
* **GlFilteredSearch:** Stop mutating value prop ([31808db](https://gitlab.com/gitlab-org/gitlab-ui/commit/31808dbcf6b3c412db7191fe12317009b0d95542))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **audio:** Implementation of GitLab Flavoured Markdown audio styles ([e4c613f](https://gitlab.com/gitlab-org/gitlab-ui/commit/e4c613f0892b7b1bf3bd97b17e64e4d2e6492ebe))
|
|
13
|
+
|
|
1
14
|
# [38.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v38.0.1...v38.1.0) (2022-03-28)
|
|
2
15
|
|
|
3
16
|
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var description = "## Usage\n\nThe dropdown component offers a user multiple items or actions to choose from which are initially\ncollapsed behind a button.\n\n### Icon-only dropdown\n\nIcon-only dropdowns must have an accessible name.\nYou can provide this with the combination of `text` and `text-sr-only` props.\n\nOptionally, you can use `no-caret` to remove the caret and `category=\"tertiary\"` to remove the border.\n\n```html\n<gl-dropdown\n icon=\"ellipsis_v\"\n text=\"More actions\"\n :text-sr-only=\"true\"\n category=\"tertiary\"\n no-caret\n>\n```\n\n### Button Content\n\nThere are 3 ways to set the dropdown button's content.\n\n1. Use the `text` attribute. This will display the text with the loading spinner (shown with the\n`loading` attribute), icon (if provided by the `icon` attribute), and dropdown caret:\n\n ```html\n <gl-dropdown text=\"Button text\">\n ```\n\n1. Use the `button-text` template. This allows custom content for the button's text, but keeps the\nloading spinner, icon, and dropdown caret:\n\n ```html\n <gl-dropdown>\n <template #button-text>\n <!-- Loading spinner shown here -->\n <!-- Icon shown here -->\n Custom <strong>Content</strong> with <em>HTML</em> via Slot\n <gl-truncate position=\"middle\" text=\"Truncated button text\"/>\n <!-- Dropdown arrow shown here -->\n </template>\n </gl-dropdown>\n ```\n\n1. Use the `button-content` template. This will replace everything in the button with the template:\n\n ```html\n <gl-dropdown>\n <template #button-content>\n Custom <strong>Content</strong> with <em>HTML</em> via Slot\n </template>\n </gl-dropdown>\n ```\n";
|
|
1
|
+
var description = "The dropdown component offers a user multiple items or actions to choose from which are initially\ncollapsed behind a button.\n\n### Icon-only dropdown\n\nIcon-only dropdowns must have an accessible name.\nYou can provide this with the combination of `text` and `text-sr-only` props.\n\nOptionally, you can use `no-caret` to remove the caret and `category=\"tertiary\"` to remove the border.\n\n```html\n<gl-dropdown\n icon=\"ellipsis_v\"\n text=\"More actions\"\n :text-sr-only=\"true\"\n category=\"tertiary\"\n no-caret\n>\n```\n\n### Button Content\n\nThere are 3 ways to set the dropdown button's content.\n\n1. Use the `text` attribute. This will display the text with the loading spinner (shown with the\n`loading` attribute), icon (if provided by the `icon` attribute), and dropdown caret:\n\n ```html\n <gl-dropdown text=\"Button text\">\n ```\n\n1. Use the `button-text` template. This allows custom content for the button's text, but keeps the\nloading spinner, icon, and dropdown caret:\n\n ```html\n <gl-dropdown>\n <template #button-text>\n <!-- Loading spinner shown here -->\n <!-- Icon shown here -->\n Custom <strong>Content</strong> with <em>HTML</em> via Slot\n <gl-truncate position=\"middle\" text=\"Truncated button text\"/>\n <!-- Dropdown arrow shown here -->\n </template>\n </gl-dropdown>\n ```\n\n1. Use the `button-content` template. This will replace everything in the button with the template:\n\n ```html\n <gl-dropdown>\n <template #button-content>\n Custom <strong>Content</strong> with <em>HTML</em> via Slot\n </template>\n </gl-dropdown>\n ```\n\n### GlDropdownForm\n\nUnlike `b-dropdown-form`, we do _not_ add any additional padding with the `gl-dropdown-form` component.\nThis is to prevent double padding with `gl-dropdown-item` and similar components, so in most cases\nshouldn't be needed. To add padding, either add a padding utility class to your form, or an inner\nelement with some padding.\n";
|
|
4
2
|
|
|
5
3
|
var dropdown_documentation = {
|
|
6
4
|
description,
|
|
7
|
-
bootstrapComponent: 'b-dropdown',
|
|
8
|
-
examples,
|
|
9
5
|
followsDesignSystem: false
|
|
10
6
|
};
|
|
11
7
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
var description = "
|
|
1
|
+
var description = "The dropdown item component is meant to be used for clickable entries inside a dropdown component.\nIf you provide the `href` attribute, it renders a link instead of a button.\n";
|
|
2
2
|
|
|
3
3
|
var dropdown_item_documentation = {
|
|
4
|
-
description
|
|
5
|
-
bootstrapComponent: 'b-dropdown'
|
|
4
|
+
description
|
|
6
5
|
};
|
|
7
6
|
|
|
8
7
|
export default dropdown_item_documentation;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _cloneDeep from 'lodash/cloneDeep';
|
|
1
2
|
import { COMMA } from '../../../utils/constants';
|
|
2
3
|
import GlToken from '../token/token';
|
|
3
4
|
import GlFilteredSearchTokenSegment from './filtered_search_token_segment';
|
|
@@ -77,7 +78,8 @@ var script = {
|
|
|
77
78
|
|
|
78
79
|
data() {
|
|
79
80
|
return {
|
|
80
|
-
activeSegment: null
|
|
81
|
+
activeSegment: null,
|
|
82
|
+
tokenValue: _cloneDeep(this.value)
|
|
81
83
|
};
|
|
82
84
|
},
|
|
83
85
|
|
|
@@ -87,7 +89,7 @@ var script = {
|
|
|
87
89
|
},
|
|
88
90
|
|
|
89
91
|
hasDataOrDataSegmentIsCurrentlyActive() {
|
|
90
|
-
return this.
|
|
92
|
+
return this.tokenValue.data !== '' || this.isSegmentActive(SEGMENT_DATA);
|
|
91
93
|
},
|
|
92
94
|
|
|
93
95
|
availableTokensWithSelf() {
|
|
@@ -97,7 +99,7 @@ var script = {
|
|
|
97
99
|
},
|
|
98
100
|
|
|
99
101
|
operatorDescription() {
|
|
100
|
-
const operator = this.operators.find(op => op.value === this.
|
|
102
|
+
const operator = this.operators.find(op => op.value === this.tokenValue.operator);
|
|
101
103
|
return this.showFriendlyText ? operator === null || operator === void 0 ? void 0 : operator.description : operator === null || operator === void 0 ? void 0 : operator.value;
|
|
102
104
|
}
|
|
103
105
|
|
|
@@ -108,7 +110,7 @@ var script = {
|
|
|
108
110
|
SEGMENT_OPERATOR
|
|
109
111
|
},
|
|
110
112
|
watch: {
|
|
111
|
-
|
|
113
|
+
tokenValue: {
|
|
112
114
|
deep: true,
|
|
113
115
|
|
|
114
116
|
handler(newValue) {
|
|
@@ -121,6 +123,16 @@ var script = {
|
|
|
121
123
|
this.$emit('input', newValue);
|
|
122
124
|
}
|
|
123
125
|
|
|
126
|
+
},
|
|
127
|
+
value: {
|
|
128
|
+
handler(newValue, oldValue) {
|
|
129
|
+
if ((newValue === null || newValue === void 0 ? void 0 : newValue.data) === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.data) && (newValue === null || newValue === void 0 ? void 0 : newValue.operator) === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.operator)) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
this.tokenValue = _cloneDeep(newValue);
|
|
134
|
+
}
|
|
135
|
+
|
|
124
136
|
},
|
|
125
137
|
active: {
|
|
126
138
|
immediate: true,
|
|
@@ -128,9 +140,9 @@ var script = {
|
|
|
128
140
|
handler(newValue) {
|
|
129
141
|
if (newValue) {
|
|
130
142
|
if (!this.activeSegment) {
|
|
131
|
-
this.activateSegment(this.
|
|
143
|
+
this.activateSegment(this.tokenValue.data !== '' ? SEGMENT_DATA : SEGMENT_OPERATOR);
|
|
132
144
|
}
|
|
133
|
-
} else if (this.
|
|
145
|
+
} else if (this.tokenValue.data === '') {
|
|
134
146
|
this.activeSegment = null;
|
|
135
147
|
/**
|
|
136
148
|
* Emitted when token is about to be destroyed.
|
|
@@ -146,15 +158,15 @@ var script = {
|
|
|
146
158
|
},
|
|
147
159
|
|
|
148
160
|
created() {
|
|
149
|
-
if (!('operator' in this.
|
|
161
|
+
if (!('operator' in this.tokenValue)) {
|
|
150
162
|
if (this.operators.length === 1) {
|
|
151
163
|
const operator = this.operators[0].value;
|
|
152
|
-
this.$emit('input', { ...this.
|
|
164
|
+
this.$emit('input', { ...this.tokenValue,
|
|
153
165
|
operator
|
|
154
166
|
});
|
|
155
167
|
this.activeSegment = SEGMENT_DATA;
|
|
156
168
|
} else {
|
|
157
|
-
this.$emit('input', { ...this.
|
|
169
|
+
this.$emit('input', { ...this.tokenValue,
|
|
158
170
|
operator: ''
|
|
159
171
|
});
|
|
160
172
|
}
|
|
@@ -186,7 +198,7 @@ var script = {
|
|
|
186
198
|
},
|
|
187
199
|
|
|
188
200
|
replaceWithTermIfEmpty() {
|
|
189
|
-
if (this.
|
|
201
|
+
if (this.tokenValue.operator === '' && this.tokenValue.data === '') {
|
|
190
202
|
/**
|
|
191
203
|
* Emitted when this token is converted to another type
|
|
192
204
|
* @property {object} token Replacement token configuration
|
|
@@ -219,7 +231,7 @@ var script = {
|
|
|
219
231
|
const isCompatible = this.config.dataType && this.config.dataType === newTokenConfig.dataType;
|
|
220
232
|
this.$emit('replace', {
|
|
221
233
|
type: newTokenConfig.type,
|
|
222
|
-
value: isCompatible ? this.
|
|
234
|
+
value: isCompatible ? this.tokenValue : {
|
|
223
235
|
data: ''
|
|
224
236
|
}
|
|
225
237
|
});
|
|
@@ -249,7 +261,7 @@ var script = {
|
|
|
249
261
|
} = _ref2;
|
|
250
262
|
return value.startsWith(potentialValue);
|
|
251
263
|
})) {
|
|
252
|
-
if (this.
|
|
264
|
+
if (this.tokenValue.data === '') {
|
|
253
265
|
applySuggestion(suggestedValue);
|
|
254
266
|
} else {
|
|
255
267
|
evt.preventDefault();
|
|
@@ -259,7 +271,7 @@ var script = {
|
|
|
259
271
|
|
|
260
272
|
activateDataSegment() {
|
|
261
273
|
if (this.config.multiSelect) {
|
|
262
|
-
this.$emit('input', { ...this.
|
|
274
|
+
this.$emit('input', { ...this.tokenValue,
|
|
263
275
|
data: ''
|
|
264
276
|
});
|
|
265
277
|
}
|
|
@@ -269,7 +281,7 @@ var script = {
|
|
|
269
281
|
|
|
270
282
|
handleComplete() {
|
|
271
283
|
if (this.config.multiSelect) {
|
|
272
|
-
this.$emit('input', { ...this.
|
|
284
|
+
this.$emit('input', { ...this.tokenValue,
|
|
273
285
|
data: this.multiSelectValues.join(COMMA)
|
|
274
286
|
});
|
|
275
287
|
}
|
|
@@ -301,14 +313,14 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
|
|
|
301
313
|
var inputValue = ref.inputValue;
|
|
302
314
|
return [_c('gl-token',{staticClass:"gl-filtered-search-token-type",class:_vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_TITLE),attrs:{"view-only":""}},[_vm._v(_vm._s(inputValue))])]}}])}),_vm._v(" "),_c('gl-filtered-search-token-segment',{key:"operator-segment",attrs:{"active":_vm.isSegmentActive(_vm.$options.segments.SEGMENT_OPERATOR),"options":_vm.operators,"custom-input-keydown-handler":_vm.handleOperatorKeydown,"view-only":""},on:{"activate":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_OPERATOR)},"backspace":_vm.replaceWithTermIfEmpty,"complete":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_DATA)},"deactivate":function($event){return _vm.$emit('deactivate')}},scopedSlots:_vm._u([{key:"view",fn:function(){return [_c('gl-token',{staticClass:"gl-filtered-search-token-operator",class:_vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_OPERATOR),attrs:{"variant":"search-value","view-only":""}},[_vm._v(_vm._s(_vm.operatorDescription))])]},proxy:true},{key:"option",fn:function(ref){
|
|
303
315
|
var option = ref.option;
|
|
304
|
-
return [_c('div',{staticClass:"gl-display-flex"},[_vm._v("\n "+_vm._s(option.value)+"\n "),(option.description)?_c('span',{staticClass:"gl-filtered-search-token-operator-description"},[_vm._v("\n "+_vm._s(option.description)+"\n ")]):_vm._e()])]}}]),model:{value:(_vm.
|
|
316
|
+
return [_c('div',{staticClass:"gl-display-flex"},[_vm._v("\n "+_vm._s(option.value)+"\n "),(option.description)?_c('span',{staticClass:"gl-filtered-search-token-operator-description"},[_vm._v("\n "+_vm._s(option.description)+"\n ")]):_vm._e()])]}}]),model:{value:(_vm.tokenValue.operator),callback:function ($$v) {_vm.$set(_vm.tokenValue, "operator", $$v);},expression:"tokenValue.operator"}}),_vm._v(" "),(_vm.hasDataOrDataSegmentIsCurrentlyActive)?_c('gl-filtered-search-token-segment',{key:"data-segment",attrs:{"active":_vm.isSegmentActive(_vm.$options.segments.SEGMENT_DATA),"multi-select":_vm.config.multiSelect,"options":_vm.config.options,"option-text-field":"title"},on:{"activate":_vm.activateDataSegment,"backspace":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_OPERATOR)},"complete":_vm.handleComplete,"select":function($event){return _vm.$emit('select', $event)},"submit":function($event){return _vm.$emit('submit')},"deactivate":function($event){return _vm.$emit('deactivate')},"split":function($event){return _vm.$emit('split', $event)}},scopedSlots:_vm._u([{key:"suggestions",fn:function(){return [_vm._t("suggestions")]},proxy:true},{key:"view",fn:function(ref){
|
|
305
317
|
var inputValue = ref.inputValue;
|
|
306
318
|
return [_vm._t("view-token",[_c('gl-token',{staticClass:"gl-filtered-search-token-data",class:_vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_DATA),attrs:{"variant":"search-value"},on:{"mousedown":_vm.destroyByClose}},[_c('span',{staticClass:"gl-filtered-search-token-data-content"},[_vm._t("view",[_vm._v(_vm._s(inputValue))],null,{ inputValue: inputValue })],2)])],null,{
|
|
307
319
|
inputValue: inputValue,
|
|
308
320
|
listeners: { mousedown: _vm.destroyByClose },
|
|
309
321
|
cssClasses: Object.assign({}, {'gl-filtered-search-token-data': true},
|
|
310
322
|
_vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_DATA)),
|
|
311
|
-
})]}}],null,true),model:{value:(_vm.
|
|
323
|
+
})]}}],null,true),model:{value:(_vm.tokenValue.data),callback:function ($$v) {_vm.$set(_vm.tokenValue, "data", $$v);},expression:"tokenValue.data"}}):_vm._e()],1)};
|
|
312
324
|
var __vue_staticRenderFns__ = [];
|
|
313
325
|
|
|
314
326
|
/* style */
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { V_MODEL } from './models/constants';
|
|
3
|
-
|
|
4
|
-
var form_checkbox_tree = "# GlFormCheckboxTree\n\n<!-- STORY -->\n\n`GlFormCheckboxTree` lets you display an options structure where any option can have n-level of\nchildren. It can be useful for creating a search filter that has nested facets.\n\n## Usage\n\n`GlFormCheckboxTree` accepts an `options` prop representing the available options in the form of\nan n-level deep tree. Each option should have a `value` and can have optional\n`label` and `children`. If `label` is omitted, `value` is used as the checkbox's label.\nHere's a simple `options` tree for example:\n\n```js\n[\n {\n label: 'Option #1',\n value: 1,\n children: [\n {\n label: 'Option #2',\n value: 2,\n },\n ],\n },\n {\n label: 'Option #3',\n value: 3,\n },\n]\n```\n\n`GlFormCheckboxTree` exposes the selected options via a `v-model` which is being kept in sync with\nthe `change` event.\n\n## Dos and don'ts\n\n### Don't\n\nWhen rendering a `GlFormCheckboxTree` with pre-selected options, all the selected values should be\npassed to the component via the `v-model`/`value` property. For example, with the options tree\nabove, if you wanted options `1` and `2` to be pre-selected, make sure that they are both included\nin the initial value, don't rely on the component to infer initially checked boxes by only passing\n`1` or `2`.\n\n```html\n<!-- Good -->\n<gl-form-checkbox-tree\n :value=\"[1, 2]\"\n :options=\"[\n {\n value: 1,\n children: [\n {\n value: 2,\n },\n ],\n },\n ]\"\n/>\n\n<!-- Bad -->\n<gl-form-checkbox-tree\n :value=\"[1]\"\n :options=\"[\n {\n value: 1,\n children: [\n {\n value: 2,\n },\n ],\n },\n ]\"\n/>\n```\n";
|
|
1
|
+
var form_checkbox_tree = "`GlFormCheckboxTree` lets you display an options structure where any option can have n-level of\nchildren. It can be useful for creating a search filter that has nested facets.\n\n## Usage\n\n`GlFormCheckboxTree` accepts an `options` prop representing the available options in the form of\nan n-level deep tree. Each option should have a `value` and can have optional\n`label` and `children`. If `label` is omitted, `value` is used as the checkbox's label.\nHere's a simple `options` tree for example:\n\n```js\n[\n {\n label: 'Option #1',\n value: 1,\n children: [\n {\n label: 'Option #2',\n value: 2,\n },\n ],\n },\n {\n label: 'Option #3',\n value: 3,\n },\n]\n```\n\n`GlFormCheckboxTree` exposes the selected options via a `v-model` which is being kept in sync with\nthe `change` event.\n\n## Dos and don'ts\n\n### Don't\n\nWhen rendering a `GlFormCheckboxTree` with pre-selected options, all the selected values should be\npassed to the component via the `v-model`/`value` property. For example, with the options tree\nabove, if you wanted options `1` and `2` to be pre-selected, make sure that they are both included\nin the initial value, don't rely on the component to infer initially checked boxes by only passing\n`1` or `2`.\n\n```html\n<!-- Good -->\n<gl-form-checkbox-tree\n :value=\"[1, 2]\"\n :options=\"[\n {\n value: 1,\n children: [\n {\n value: 2,\n },\n ],\n },\n ]\"\n/>\n\n<!-- Bad -->\n<gl-form-checkbox-tree\n :value=\"[1]\"\n :options=\"[\n {\n value: 1,\n children: [\n {\n value: 2,\n },\n ],\n },\n ]\"\n/>\n```\n";
|
|
5
2
|
|
|
6
3
|
var description = /*#__PURE__*/Object.freeze({
|
|
7
4
|
__proto__: null,
|
|
@@ -9,29 +6,7 @@ var description = /*#__PURE__*/Object.freeze({
|
|
|
9
6
|
});
|
|
10
7
|
|
|
11
8
|
var form_checkbox_tree_documentation = {
|
|
12
|
-
description
|
|
13
|
-
examples,
|
|
14
|
-
propsInfo: {
|
|
15
|
-
options: {
|
|
16
|
-
additionalInfo: 'The options tree.'
|
|
17
|
-
},
|
|
18
|
-
[V_MODEL.PROP]: {
|
|
19
|
-
additionalInfo: 'The selected options as an array of values.'
|
|
20
|
-
},
|
|
21
|
-
hideToggleAll: {
|
|
22
|
-
additionalInfo: 'Set to true to hide the "Select/unselect all" checkbox'
|
|
23
|
-
},
|
|
24
|
-
selectAllLabel: {
|
|
25
|
-
additionalInfo: 'Label for the toggle all checkbox when some or all options are unchecked'
|
|
26
|
-
},
|
|
27
|
-
unselectAllLabel: {
|
|
28
|
-
additionalInfo: 'Label for the toggle all checkbox when all options are checked'
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
events: [{
|
|
32
|
-
event: V_MODEL.EVENT,
|
|
33
|
-
description: 'Emitted the selection changes.'
|
|
34
|
-
}]
|
|
9
|
+
description
|
|
35
10
|
};
|
|
36
11
|
|
|
37
12
|
export default form_checkbox_tree_documentation;
|
|
@@ -37,23 +37,35 @@ var script = {
|
|
|
37
37
|
},
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* The selected options as an array of values
|
|
41
41
|
*/
|
|
42
42
|
value: {
|
|
43
43
|
type: Array,
|
|
44
44
|
required: false,
|
|
45
45
|
default: () => []
|
|
46
46
|
},
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Set to true to hide the "Select/unselect all" checkbox
|
|
50
|
+
*/
|
|
47
51
|
hideToggleAll: {
|
|
48
52
|
type: Boolean,
|
|
49
53
|
required: false,
|
|
50
54
|
default: false
|
|
51
55
|
},
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Label for the toggle all checkbox when some or all options are unchecked
|
|
59
|
+
*/
|
|
52
60
|
selectAllLabel: {
|
|
53
61
|
type: String,
|
|
54
62
|
required: false,
|
|
55
63
|
default: 'Select all'
|
|
56
64
|
},
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Label for the toggle all checkbox when all options are checked
|
|
68
|
+
*/
|
|
57
69
|
unselectAllLabel: {
|
|
58
70
|
type: String,
|
|
59
71
|
required: false,
|
|
@@ -86,6 +98,9 @@ var script = {
|
|
|
86
98
|
watch: {
|
|
87
99
|
'tree.selected': {
|
|
88
100
|
handler(selected) {
|
|
101
|
+
/**
|
|
102
|
+
* Emitted when the selection changes.
|
|
103
|
+
*/
|
|
89
104
|
this.$emit(V_MODEL.EVENT, selected);
|
|
90
105
|
}
|
|
91
106
|
|