@gitlab/ui 58.0.0 → 58.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 +14 -0
- package/dist/components/base/filtered_search/filtered_search.js +4 -1
- package/dist/components/base/filtered_search/filtered_search_term.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/package.json +2 -2
- package/src/components/base/filtered_search/filtered_search.md +1 -2
- package/src/components/base/filtered_search/filtered_search.vue +11 -1
- package/src/components/base/filtered_search/filtered_search_term.spec.js +19 -1
- package/src/components/base/filtered_search/filtered_search_term.vue +1 -1
- package/src/components/base/filtered_search/filtered_search_token.md +7 -8
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.scss +32 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "58.
|
|
3
|
+
"version": "58.2.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"bootstrap-vue-vue3": "npm:bootstrap-vue@2.23.1",
|
|
118
118
|
"cypress": "^11.2.0",
|
|
119
119
|
"emoji-regex": "^10.0.0",
|
|
120
|
-
"eslint": "8.
|
|
120
|
+
"eslint": "8.36.0",
|
|
121
121
|
"eslint-import-resolver-jest": "3.0.2",
|
|
122
122
|
"eslint-plugin-cypress": "2.12.1",
|
|
123
123
|
"eslint-plugin-storybook": "0.6.11",
|
|
@@ -29,7 +29,7 @@ Prepare array of available token configurations with the following fields:
|
|
|
29
29
|
Each token for filtered search is a Vue component with the following props:
|
|
30
30
|
|
|
31
31
|
- `value`: an object with a `data` property containing the current value, and optionally an
|
|
32
|
-
`operator` value containing the operator value
|
|
32
|
+
`operator` value containing the operator value
|
|
33
33
|
- `active`: indicates if the token is currently active. It's the token's responsibility
|
|
34
34
|
to render proper control for editing (for example input).
|
|
35
35
|
- `current-value`: current tokens of the filtered search.
|
|
@@ -60,6 +60,5 @@ Pass the list of tokens to the search component. Optionally, you can use `v-mode
|
|
|
60
60
|
realtime updates:
|
|
61
61
|
|
|
62
62
|
```html
|
|
63
|
-
|
|
64
63
|
<gl-filtered-search :available-tokens="tokens" v-model="value" />
|
|
65
64
|
```
|
|
@@ -346,6 +346,9 @@ export default {
|
|
|
346
346
|
*/
|
|
347
347
|
this.$emit('submit', normalizeTokens(cloneDeep(this.tokens)));
|
|
348
348
|
},
|
|
349
|
+
hasTitleSlot() {
|
|
350
|
+
return Boolean(this.$scopedSlots.title);
|
|
351
|
+
},
|
|
349
352
|
},
|
|
350
353
|
};
|
|
351
354
|
</script>
|
|
@@ -402,7 +405,14 @@ export default {
|
|
|
402
405
|
@split="createTokens(idx, $event)"
|
|
403
406
|
@previous="activatePreviousToken"
|
|
404
407
|
@next="activateNextToken"
|
|
405
|
-
|
|
408
|
+
>
|
|
409
|
+
<template
|
|
410
|
+
v-if="hasTitleSlot() && getTokenComponent(token.type).name === 'GlFilteredSearchTerm'"
|
|
411
|
+
#title="title"
|
|
412
|
+
>
|
|
413
|
+
<slot name="title" v-bind="title"></slot>
|
|
414
|
+
</template>
|
|
415
|
+
</component>
|
|
406
416
|
</div>
|
|
407
417
|
<portal-target
|
|
408
418
|
ref="menu"
|
|
@@ -26,18 +26,36 @@ describe('Filtered search term', () => {
|
|
|
26
26
|
props: ['searchInputAttributes', 'isLastToken', 'currentValue', 'viewOnly'],
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
const createComponent = (props) => {
|
|
29
|
+
const createComponent = (props, options = {}) => {
|
|
30
30
|
wrapper = shallowMount(FilteredSearchTerm, {
|
|
31
31
|
propsData: { ...defaultProps, ...props },
|
|
32
32
|
stubs: {
|
|
33
33
|
'gl-filtered-search-token-segment': segmentStub,
|
|
34
34
|
},
|
|
35
|
+
...options,
|
|
35
36
|
});
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
const findSearchInput = () => wrapper.find('input');
|
|
39
40
|
const findTokenSegmentComponent = () => wrapper.findComponent(segmentStub);
|
|
40
41
|
|
|
42
|
+
it('renders title slot', async () => {
|
|
43
|
+
createComponent(
|
|
44
|
+
{ availableTokens, active: true, value: { data: 'test1' } },
|
|
45
|
+
{
|
|
46
|
+
scopedSlots: {
|
|
47
|
+
title: '<div slot-scope="{ value }">New {{value}}</div>',
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
await nextTick();
|
|
53
|
+
|
|
54
|
+
expect(wrapper.findAllComponents(GlFilteredSearchSuggestion).at(0).text()).toBe(
|
|
55
|
+
'New test1-foo'
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
|
|
41
59
|
it('renders value in inactive mode', () => {
|
|
42
60
|
createComponent({ value: { data: 'test-value' } });
|
|
43
61
|
expect(wrapper.html()).toMatchSnapshot();
|
|
@@ -10,15 +10,14 @@ This component is not intended to be used outside of the `GlFilteredSearch` comp
|
|
|
10
10
|
Make sure to pass `$listeners` to `gl-filtered-search-token`, or route events properly:
|
|
11
11
|
|
|
12
12
|
```html
|
|
13
|
-
<gl-filtered-search-token
|
|
14
|
-
title="Confidential"
|
|
15
|
-
:active="active"
|
|
16
|
-
:value="value"
|
|
17
|
-
v-on="$listeners"
|
|
18
|
-
>
|
|
13
|
+
<gl-filtered-search-token title="Confidential" :active="active" :value="value" v-on="$listeners">
|
|
19
14
|
<template #suggestions>
|
|
20
|
-
<gl-filtered-search-suggestion value="Yes"
|
|
21
|
-
|
|
15
|
+
<gl-filtered-search-suggestion value="Yes"
|
|
16
|
+
><gl-icon name="eye-slash" :size="16" /> Yes</gl-filtered-search-suggestion
|
|
17
|
+
>
|
|
18
|
+
<gl-filtered-search-suggestion value="No"
|
|
19
|
+
><gl-icon name="eye" :size="16" /> No</gl-filtered-search-suggestion
|
|
20
|
+
>
|
|
22
21
|
</template>
|
|
23
22
|
</gl-filtered-search-token>
|
|
24
23
|
```
|
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
.btn-group {
|
|
2
|
+
.gl-disclosure-dropdown:not(:last-child) {
|
|
3
|
+
.gl-new-dropdown-toggle {
|
|
4
|
+
@include gl-rounded-top-right-none;
|
|
5
|
+
@include gl-rounded-bottom-right-none;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.gl-disclosure-dropdown:not(:first-child) {
|
|
10
|
+
.gl-new-dropdown-toggle {
|
|
11
|
+
@include gl-rounded-top-left-none;
|
|
12
|
+
@include gl-rounded-bottom-left-none;
|
|
13
|
+
|
|
14
|
+
// Prevent double borders when buttons are next to each other
|
|
15
|
+
margin-left: -1px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.gl-disclosure-dropdown:hover {
|
|
20
|
+
.gl-new-dropdown-toggle {
|
|
21
|
+
@include gl-z-index-1;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.gl-disclosure-dropdown {
|
|
26
|
+
.gl-new-dropdown-toggle:focus,
|
|
27
|
+
.gl-new-dropdown-toggle:active {
|
|
28
|
+
@include gl-z-index-1;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
1
33
|
.gl-disclosure-dropdown {
|
|
2
34
|
&.gl-new-dropdown {
|
|
3
35
|
.gl-new-dropdown-inner {
|