@gitlab/ui 116.0.0 → 117.0.1
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/index.js +0 -3
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/package.json +4 -5
- package/src/components/index.js +0 -3
- package/src/scss/components.scss +0 -1
- package/src/scss/typography.scss +4 -0
- package/dist/components/base/form/form_checkbox_tree/checkbox_tree_node.js +0 -79
- package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.js +0 -138
- package/dist/components/base/form/form_checkbox_tree/models/constants.js +0 -12
- package/dist/components/base/form/form_checkbox_tree/models/node.js +0 -51
- package/dist/components/base/form/form_checkbox_tree/models/tree.js +0 -200
- package/dist/components/base/nav/nav.js +0 -132
- package/dist/components/base/nav/nav_item.js +0 -125
- package/src/components/base/form/form_checkbox_tree/checkbox_tree_node.vue +0 -58
- package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.md +0 -73
- package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.vue +0 -116
- package/src/components/base/form/form_checkbox_tree/models/constants.js +0 -12
- package/src/components/base/form/form_checkbox_tree/models/node.js +0 -48
- package/src/components/base/form/form_checkbox_tree/models/tree.js +0 -186
- package/src/components/base/nav/nav.md +0 -184
- package/src/components/base/nav/nav.scss +0 -7
- package/src/components/base/nav/nav.vue +0 -70
- package/src/components/base/nav/nav_item.vue +0 -109
- package/src/components/base/token_selector/token_selector.md +0 -78
- package/src/components/experimental/experiment_badge/experiment_badge.md +0 -10
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
2
|
-
|
|
3
|
-
var script = {
|
|
4
|
-
name: 'GlNav',
|
|
5
|
-
props: {
|
|
6
|
-
/**
|
|
7
|
-
* Align the nav items in the nav: 'start' (or 'left'), 'center', 'end' (or 'right')
|
|
8
|
-
*/
|
|
9
|
-
align: {
|
|
10
|
-
type: String,
|
|
11
|
-
required: false,
|
|
12
|
-
default: ''
|
|
13
|
-
},
|
|
14
|
-
/**
|
|
15
|
-
* Set this prop when the nav is placed inside a card header
|
|
16
|
-
*/
|
|
17
|
-
cardHeader: {
|
|
18
|
-
type: Boolean,
|
|
19
|
-
required: false,
|
|
20
|
-
default: false
|
|
21
|
-
},
|
|
22
|
-
/**
|
|
23
|
-
* Proportionately fills all horizontal space with nav items.
|
|
24
|
-
* All horizontal space is occupied, but not every nav item has the same width
|
|
25
|
-
*/
|
|
26
|
-
fill: {
|
|
27
|
-
type: Boolean,
|
|
28
|
-
required: false,
|
|
29
|
-
default: false
|
|
30
|
-
},
|
|
31
|
-
/**
|
|
32
|
-
* Fills all horizontal space with nav items, but unlike 'fill', every nav item will be the same width
|
|
33
|
-
*/
|
|
34
|
-
justified: {
|
|
35
|
-
type: Boolean,
|
|
36
|
-
required: false,
|
|
37
|
-
default: false
|
|
38
|
-
},
|
|
39
|
-
/**
|
|
40
|
-
* Renders the nav items with the appearance of pill buttons
|
|
41
|
-
*/
|
|
42
|
-
pills: {
|
|
43
|
-
type: Boolean,
|
|
44
|
-
required: false,
|
|
45
|
-
default: false
|
|
46
|
-
},
|
|
47
|
-
/**
|
|
48
|
-
* Makes the nav smaller
|
|
49
|
-
*/
|
|
50
|
-
small: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
required: false,
|
|
53
|
-
default: false
|
|
54
|
-
},
|
|
55
|
-
/**
|
|
56
|
-
* Renders the nav items with the appearance of tabs
|
|
57
|
-
*/
|
|
58
|
-
tabs: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
required: false,
|
|
61
|
-
default: false
|
|
62
|
-
},
|
|
63
|
-
/**
|
|
64
|
-
* Specify the HTML tag to render instead of the default tag
|
|
65
|
-
*/
|
|
66
|
-
tag: {
|
|
67
|
-
type: String,
|
|
68
|
-
required: false,
|
|
69
|
-
default: 'ul'
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
computed: {
|
|
73
|
-
justifyContent() {
|
|
74
|
-
if (!this.align) return '';
|
|
75
|
-
const alignMapping = {
|
|
76
|
-
left: 'start',
|
|
77
|
-
right: 'end'
|
|
78
|
-
};
|
|
79
|
-
return `justify-content-${alignMapping[this.align] || this.align}`;
|
|
80
|
-
},
|
|
81
|
-
classes() {
|
|
82
|
-
return {
|
|
83
|
-
'nav-tabs': this.tabs,
|
|
84
|
-
'nav-pills': this.pills && !this.tabs,
|
|
85
|
-
'card-header-tabs': this.cardHeader && this.tabs,
|
|
86
|
-
'card-header-pills': this.cardHeader && this.pills && !this.tabs,
|
|
87
|
-
'nav-fill': this.fill,
|
|
88
|
-
'nav-justified': this.justified,
|
|
89
|
-
[this.justifyContent]: this.align,
|
|
90
|
-
small: this.small
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
/* script */
|
|
97
|
-
const __vue_script__ = script;
|
|
98
|
-
|
|
99
|
-
/* template */
|
|
100
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.tag,_vm._g({tag:"component",staticClass:"nav",class:_vm.classes},_vm.$listeners),[_vm._t("default")],2)};
|
|
101
|
-
var __vue_staticRenderFns__ = [];
|
|
102
|
-
|
|
103
|
-
/* style */
|
|
104
|
-
const __vue_inject_styles__ = undefined;
|
|
105
|
-
/* scoped */
|
|
106
|
-
const __vue_scope_id__ = undefined;
|
|
107
|
-
/* module identifier */
|
|
108
|
-
const __vue_module_identifier__ = undefined;
|
|
109
|
-
/* functional template */
|
|
110
|
-
const __vue_is_functional_template__ = false;
|
|
111
|
-
/* style inject */
|
|
112
|
-
|
|
113
|
-
/* style inject SSR */
|
|
114
|
-
|
|
115
|
-
/* style inject shadow dom */
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const __vue_component__ = /*#__PURE__*/__vue_normalize__(
|
|
120
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
121
|
-
__vue_inject_styles__,
|
|
122
|
-
__vue_script__,
|
|
123
|
-
__vue_scope_id__,
|
|
124
|
-
__vue_is_functional_template__,
|
|
125
|
-
__vue_module_identifier__,
|
|
126
|
-
false,
|
|
127
|
-
undefined,
|
|
128
|
-
undefined,
|
|
129
|
-
undefined
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
export { __vue_component__ as default };
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import GlLink from '../link/link';
|
|
2
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
3
|
-
|
|
4
|
-
var script = {
|
|
5
|
-
name: 'GlNavItem',
|
|
6
|
-
components: {
|
|
7
|
-
GlLink
|
|
8
|
-
},
|
|
9
|
-
props: {
|
|
10
|
-
/**
|
|
11
|
-
* When set to `true`, places the component in the active state with active styling
|
|
12
|
-
*/
|
|
13
|
-
active: {
|
|
14
|
-
type: Boolean,
|
|
15
|
-
required: false,
|
|
16
|
-
default: false
|
|
17
|
-
},
|
|
18
|
-
/**
|
|
19
|
-
* When set to `true`, disables the component's functionality and places it in a disabled state.
|
|
20
|
-
*/
|
|
21
|
-
disabled: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
required: false,
|
|
24
|
-
default: false
|
|
25
|
-
},
|
|
26
|
-
/**
|
|
27
|
-
* Denotes the target URL of the link for standard links.
|
|
28
|
-
*/
|
|
29
|
-
href: {
|
|
30
|
-
type: String,
|
|
31
|
-
required: false,
|
|
32
|
-
default: undefined
|
|
33
|
-
},
|
|
34
|
-
/**
|
|
35
|
-
* <router-link> prop: Denotes the target route of the link.
|
|
36
|
-
* When clicked, the value of the to prop will be passed to `router.push()` internally,
|
|
37
|
-
* so the value can be either a string or a Location descriptor object.
|
|
38
|
-
*/
|
|
39
|
-
to: {
|
|
40
|
-
type: [Object, String],
|
|
41
|
-
required: false,
|
|
42
|
-
default: undefined
|
|
43
|
-
},
|
|
44
|
-
/**
|
|
45
|
-
* <router-link> prop: Configure the active CSS class applied when the link is active.
|
|
46
|
-
*/
|
|
47
|
-
activeClass: {
|
|
48
|
-
type: String,
|
|
49
|
-
required: false,
|
|
50
|
-
default: undefined
|
|
51
|
-
},
|
|
52
|
-
/**
|
|
53
|
-
* <router-link> prop: Configure the active CSS class applied when the link is active with exact match.
|
|
54
|
-
*/
|
|
55
|
-
exactActiveClass: {
|
|
56
|
-
type: String,
|
|
57
|
-
required: false,
|
|
58
|
-
default: undefined
|
|
59
|
-
},
|
|
60
|
-
/**
|
|
61
|
-
* Attributes for the link element
|
|
62
|
-
*/
|
|
63
|
-
linkAttrs: {
|
|
64
|
-
type: Object,
|
|
65
|
-
required: false,
|
|
66
|
-
default: null
|
|
67
|
-
},
|
|
68
|
-
/**
|
|
69
|
-
* Classes for the link element
|
|
70
|
-
*/
|
|
71
|
-
linkClasses: {
|
|
72
|
-
type: Array,
|
|
73
|
-
required: false,
|
|
74
|
-
default: () => []
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
computed: {
|
|
78
|
-
computedLinkClasses() {
|
|
79
|
-
const classes = this.linkClasses;
|
|
80
|
-
|
|
81
|
-
// the `unstyled` link variant does not do this by itself
|
|
82
|
-
if (this.disabled) classes.push('disabled');
|
|
83
|
-
if (this.active) classes.push('active');
|
|
84
|
-
return classes;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
/* script */
|
|
90
|
-
const __vue_script__ = script;
|
|
91
|
-
|
|
92
|
-
/* template */
|
|
93
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('li',{staticClass:"nav-item"},[_c('gl-link',_vm._g(_vm._b({staticClass:"nav-link",class:_vm.computedLinkClasses,attrs:{"variant":"unstyled","active":_vm.active,"disabled":_vm.disabled,"href":_vm.href,"to":_vm.to,"active-class":_vm.activeClass,"exact-active-class":_vm.exactActiveClass}},'gl-link',_vm.linkAttrs,false),_vm.$listeners),[_vm._t("default")],2)],1)};
|
|
94
|
-
var __vue_staticRenderFns__ = [];
|
|
95
|
-
|
|
96
|
-
/* style */
|
|
97
|
-
const __vue_inject_styles__ = undefined;
|
|
98
|
-
/* scoped */
|
|
99
|
-
const __vue_scope_id__ = undefined;
|
|
100
|
-
/* module identifier */
|
|
101
|
-
const __vue_module_identifier__ = undefined;
|
|
102
|
-
/* functional template */
|
|
103
|
-
const __vue_is_functional_template__ = false;
|
|
104
|
-
/* style inject */
|
|
105
|
-
|
|
106
|
-
/* style inject SSR */
|
|
107
|
-
|
|
108
|
-
/* style inject shadow dom */
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const __vue_component__ = /*#__PURE__*/__vue_normalize__(
|
|
113
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
114
|
-
__vue_inject_styles__,
|
|
115
|
-
__vue_script__,
|
|
116
|
-
__vue_scope_id__,
|
|
117
|
-
__vue_is_functional_template__,
|
|
118
|
-
__vue_module_identifier__,
|
|
119
|
-
false,
|
|
120
|
-
undefined,
|
|
121
|
-
undefined,
|
|
122
|
-
undefined
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
export { __vue_component__ as default };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import GlFormCheckbox from '../form_checkbox/form_checkbox.vue';
|
|
3
|
-
import { QA_PREFIX } from './models/constants';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'GlFormCheckboxTreeNode',
|
|
7
|
-
qaPrefix: QA_PREFIX,
|
|
8
|
-
components: {
|
|
9
|
-
GlFormCheckbox,
|
|
10
|
-
},
|
|
11
|
-
inject: ['tree'],
|
|
12
|
-
props: {
|
|
13
|
-
option: {
|
|
14
|
-
type: Object,
|
|
15
|
-
required: true,
|
|
16
|
-
},
|
|
17
|
-
isNested: {
|
|
18
|
-
type: Boolean,
|
|
19
|
-
required: false,
|
|
20
|
-
default: false,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
computed: {
|
|
24
|
-
node() {
|
|
25
|
-
return this.tree.getNode(this.option.value);
|
|
26
|
-
},
|
|
27
|
-
label() {
|
|
28
|
-
return this.node.label || this.node.value;
|
|
29
|
-
},
|
|
30
|
-
rootClass() {
|
|
31
|
-
return this.isNested ? 'gl-ml-6' : null;
|
|
32
|
-
},
|
|
33
|
-
checkboxClass() {
|
|
34
|
-
const { isChecked, isIndeterminate } = this.node;
|
|
35
|
-
return [isChecked && 'js-is-checked', isIndeterminate && 'js-is-indeterminate'];
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
</script>
|
|
40
|
-
|
|
41
|
-
<template>
|
|
42
|
-
<div :class="rootClass" :data-testid="`${$options.qaPrefix}${option.value}`">
|
|
43
|
-
<gl-form-checkbox
|
|
44
|
-
:checked="node.isChecked"
|
|
45
|
-
:indeterminate="node.isIndeterminate"
|
|
46
|
-
:class="checkboxClass"
|
|
47
|
-
@change="tree.toggleOption(option, $event)"
|
|
48
|
-
>
|
|
49
|
-
{{ label }}
|
|
50
|
-
</gl-form-checkbox>
|
|
51
|
-
<gl-form-checkbox-tree-node
|
|
52
|
-
v-for="child in option.children"
|
|
53
|
-
:key="child.value"
|
|
54
|
-
:option="child"
|
|
55
|
-
is-nested
|
|
56
|
-
/>
|
|
57
|
-
</div>
|
|
58
|
-
</template>
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
`GlFormCheckboxTree` lets you display an options structure where any option can have n-level of
|
|
2
|
-
children. It can be useful for creating a search filter that has nested facets.
|
|
3
|
-
|
|
4
|
-
## Usage
|
|
5
|
-
|
|
6
|
-
`GlFormCheckboxTree` accepts an `options` prop representing the available options in the form of
|
|
7
|
-
an n-level deep tree. Each option should have a `value` and can have optional
|
|
8
|
-
`label` and `children`. If `label` is omitted, `value` is used as the checkbox's label.
|
|
9
|
-
Here's a simple `options` tree for example:
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
[
|
|
13
|
-
{
|
|
14
|
-
label: 'Option #1',
|
|
15
|
-
value: 1,
|
|
16
|
-
children: [
|
|
17
|
-
{
|
|
18
|
-
label: 'Option #2',
|
|
19
|
-
value: 2,
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
label: 'Option #3',
|
|
25
|
-
value: 3,
|
|
26
|
-
},
|
|
27
|
-
]
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
`GlFormCheckboxTree` exposes the selected options via a `v-model` which is being kept in sync with
|
|
31
|
-
the `change` event.
|
|
32
|
-
|
|
33
|
-
## Dos and don'ts
|
|
34
|
-
|
|
35
|
-
### Don't
|
|
36
|
-
|
|
37
|
-
When rendering a `GlFormCheckboxTree` with pre-selected options, all the selected values should be
|
|
38
|
-
passed to the component via the `v-model`/`value` property. For example, with the options tree
|
|
39
|
-
above, if you wanted options `1` and `2` to be pre-selected, make sure that they are both included
|
|
40
|
-
in the initial value, don't rely on the component to infer initially checked boxes by only passing
|
|
41
|
-
`1` or `2`.
|
|
42
|
-
|
|
43
|
-
```html
|
|
44
|
-
<!-- Good -->
|
|
45
|
-
<gl-form-checkbox-tree
|
|
46
|
-
:value="[1, 2]"
|
|
47
|
-
:options="[
|
|
48
|
-
{
|
|
49
|
-
value: 1,
|
|
50
|
-
children: [
|
|
51
|
-
{
|
|
52
|
-
value: 2,
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
]"
|
|
57
|
-
/>
|
|
58
|
-
|
|
59
|
-
<!-- Bad -->
|
|
60
|
-
<gl-form-checkbox-tree
|
|
61
|
-
:value="[1]"
|
|
62
|
-
:options="[
|
|
63
|
-
{
|
|
64
|
-
value: 1,
|
|
65
|
-
children: [
|
|
66
|
-
{
|
|
67
|
-
value: 2,
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
]"
|
|
72
|
-
/>
|
|
73
|
-
```
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import GlFormCheckbox from '../form_checkbox/form_checkbox.vue';
|
|
3
|
-
import GlFormGroup from '../form_group/form_group.vue';
|
|
4
|
-
import GlFormCheckboxTreeNode from './checkbox_tree_node.vue';
|
|
5
|
-
import { V_MODEL } from './models/constants';
|
|
6
|
-
import { Tree } from './models/tree';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
name: 'GlFormCheckboxTree',
|
|
10
|
-
components: {
|
|
11
|
-
GlFormGroup,
|
|
12
|
-
GlFormCheckbox,
|
|
13
|
-
GlFormCheckboxTreeNode,
|
|
14
|
-
},
|
|
15
|
-
provide() {
|
|
16
|
-
return {
|
|
17
|
-
tree: this.tree,
|
|
18
|
-
};
|
|
19
|
-
},
|
|
20
|
-
model: {
|
|
21
|
-
prop: V_MODEL.PROP,
|
|
22
|
-
event: V_MODEL.EVENT,
|
|
23
|
-
},
|
|
24
|
-
props: {
|
|
25
|
-
/**
|
|
26
|
-
* Options tree where each option is in the form:
|
|
27
|
-
* {
|
|
28
|
-
* value: String|Number,
|
|
29
|
-
* label: String,
|
|
30
|
-
* children: Array,
|
|
31
|
-
* }
|
|
32
|
-
*/
|
|
33
|
-
options: {
|
|
34
|
-
type: Array,
|
|
35
|
-
required: true,
|
|
36
|
-
},
|
|
37
|
-
/**
|
|
38
|
-
* The selected options as an array of values
|
|
39
|
-
*/
|
|
40
|
-
value: {
|
|
41
|
-
type: Array,
|
|
42
|
-
required: false,
|
|
43
|
-
default: () => [],
|
|
44
|
-
},
|
|
45
|
-
/**
|
|
46
|
-
* Set to true to hide the "Select/unselect all" checkbox
|
|
47
|
-
*/
|
|
48
|
-
hideToggleAll: {
|
|
49
|
-
type: Boolean,
|
|
50
|
-
required: false,
|
|
51
|
-
default: false,
|
|
52
|
-
},
|
|
53
|
-
/**
|
|
54
|
-
* Label for the toggle all checkbox when some or all options are unchecked
|
|
55
|
-
*/
|
|
56
|
-
selectAllLabel: {
|
|
57
|
-
type: String,
|
|
58
|
-
required: false,
|
|
59
|
-
default: 'Select all',
|
|
60
|
-
},
|
|
61
|
-
/**
|
|
62
|
-
* Label for the toggle all checkbox when all options are checked
|
|
63
|
-
*/
|
|
64
|
-
unselectAllLabel: {
|
|
65
|
-
type: String,
|
|
66
|
-
required: false,
|
|
67
|
-
default: 'Unselect all',
|
|
68
|
-
},
|
|
69
|
-
label: {
|
|
70
|
-
type: String,
|
|
71
|
-
required: false,
|
|
72
|
-
default: 'Checkbox tree',
|
|
73
|
-
},
|
|
74
|
-
labelSrOnly: {
|
|
75
|
-
type: Boolean,
|
|
76
|
-
required: false,
|
|
77
|
-
default: true,
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
data() {
|
|
81
|
-
return {
|
|
82
|
-
tree: new Tree(this.options, this.value),
|
|
83
|
-
};
|
|
84
|
-
},
|
|
85
|
-
computed: {
|
|
86
|
-
toggleAllLabel() {
|
|
87
|
-
return this.tree.allOptionsChecked ? this.unselectAllLabel : this.selectAllLabel;
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
watch: {
|
|
91
|
-
'tree.selected': {
|
|
92
|
-
handler(selected) {
|
|
93
|
-
/**
|
|
94
|
-
* Emitted when the selection changes.
|
|
95
|
-
*/
|
|
96
|
-
this.$emit(V_MODEL.EVENT, selected);
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
</script>
|
|
102
|
-
|
|
103
|
-
<template>
|
|
104
|
-
<gl-form-group :label="label" :label-sr-only="labelSrOnly">
|
|
105
|
-
<gl-form-checkbox
|
|
106
|
-
v-if="!hideToggleAll"
|
|
107
|
-
class="gl-form-checkbox-tree-toggle-all"
|
|
108
|
-
:checked="tree.allOptionsChecked"
|
|
109
|
-
:indeterminate="tree.someOptionsChecked"
|
|
110
|
-
@change="tree.toggleAllOptions($event)"
|
|
111
|
-
>
|
|
112
|
-
{{ toggleAllLabel }}
|
|
113
|
-
</gl-form-checkbox>
|
|
114
|
-
<gl-form-checkbox-tree-node v-for="option in options" :key="option.value" :option="option" />
|
|
115
|
-
</gl-form-group>
|
|
116
|
-
</template>
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { CHECKED_STATE } from './constants';
|
|
2
|
-
|
|
3
|
-
export class Node {
|
|
4
|
-
constructor({ value, label, parent = null, children = [], depth, isChecked }) {
|
|
5
|
-
this.value = value;
|
|
6
|
-
this.label = label;
|
|
7
|
-
this.parent = parent;
|
|
8
|
-
this.children = children;
|
|
9
|
-
this.depth = depth;
|
|
10
|
-
this.checkedState = isChecked ? CHECKED_STATE.CHECKED : CHECKED_STATE.UNCHECKED;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Sets the node's checked state
|
|
15
|
-
* @param {number} checkedState
|
|
16
|
-
*/
|
|
17
|
-
setCheckedState(checkedState) {
|
|
18
|
-
this.checkedState = checkedState;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
get isChild() {
|
|
22
|
-
return this.parent !== null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
get isParent() {
|
|
26
|
-
return this.children.length > 0;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
get isLeaf() {
|
|
30
|
-
return !this.isParent;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
get isUnchecked() {
|
|
34
|
-
return this.checkedState === CHECKED_STATE.UNCHECKED;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
get isIndeterminate() {
|
|
38
|
-
return this.checkedState === CHECKED_STATE.INDETERMINATE;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
get isChecked() {
|
|
42
|
-
return this.checkedState === CHECKED_STATE.CHECKED;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
get isCheckedOrIndeterminate() {
|
|
46
|
-
return this.isChecked || this.isIndeterminate;
|
|
47
|
-
}
|
|
48
|
-
}
|