Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Frontend
Commits
ade8b9e7
Verified
Commit
ade8b9e7
authored
2 years ago
by
Erwan Rouchet
Browse files
Options
Downloads
Patches
Plain Diff
Allow submitting from the filter bar with only one filter remaining
parent
bb497964
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1327
Allow submitting from the filter bar with only one filter remaining
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/Navigation/FilterBar/Bar.vue
+1
-0
1 addition, 0 deletions
src/components/Navigation/FilterBar/Bar.vue
src/components/Navigation/FilterBar/Input.vue
+10
-2
10 additions, 2 deletions
src/components/Navigation/FilterBar/Input.vue
with
11 additions
and
2 deletions
src/components/Navigation/FilterBar/Bar.vue
+
1
−
0
View file @
ade8b9e7
...
...
@@ -21,6 +21,7 @@
ref=
"filterinput"
:placeholder=
"computedPlaceholder"
:suggestions=
"inputSuggestions || []"
:select-single-suggestion=
"selectedFilterName !== null"
:is-loading=
"isLoading"
:disabled=
"disabled"
v-model:is-active=
"isActive"
...
...
This diff is collapsed.
Click to expand it.
src/components/Navigation/FilterBar/Input.vue
+
10
−
2
View file @
ade8b9e7
...
...
@@ -72,7 +72,7 @@ export default {
},
/**
* Enables the suggestions. This property is synchronous; it should be bound
* with
:
is-active
.sync
and allows this component to let the parent know that
* with
v-model.
is-active and allows this component to let the parent know that
* the user is focusing on it or has performed a keyboard action that toggles
* the suggestions.
*/
...
...
@@ -80,6 +80,14 @@ export default {
type
:
Boolean
,
default
:
false
},
/**
* Whether or not to automatically select a suggestion when the user presser Enter
* and there is only one suggestion in the list.
*/
selectSingleSuggestion
:
{
type
:
Boolean
,
default
:
false
},
// Allows the input to behave just like a normal text input for a parent
modelValue
:
{
type
:
String
,
...
...
@@ -112,7 +120,7 @@ export default {
navigate
(
event
)
{
this
.
$emit
(
'
update:isActive
'
,
true
)
// If there is only one filtered suggestion, it gets selected when hitting enter
if
(
this
.
filteredSuggestions
.
length
===
1
)
this
.
current
=
this
.
filteredSuggestions
[
0
][
0
]
if
(
this
.
filteredSuggestions
.
length
===
1
&&
this
.
selectSingleSuggestion
)
this
.
current
=
this
.
filteredSuggestions
[
0
][
0
]
const
currentIndex
=
this
.
filteredSuggestions
.
findIndex
(([
key
])
=>
key
===
this
.
current
)
if
([
'
ArrowUp
'
,
'
ArrowDown
'
].
includes
(
event
.
key
)
&&
this
.
filteredSuggestions
.
length
)
{
let
newIndex
=
currentIndex
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment