File tree Expand file tree Collapse file tree 4 files changed +33
-16
lines changed Expand file tree Collapse file tree 4 files changed +33
-16
lines changed Original file line number Diff line number Diff line change 7
7
"main" : " dist/vue-select.js" ,
8
8
"license" : " MIT" ,
9
9
"scripts" : {
10
- "start" : " npm run dev " ,
10
+ "start" : " npm run serve " ,
11
11
"serve" : " webpack-dev-server --config build/webpack.dev.conf.js --hot --progress -d" ,
12
12
"serve:docs" : " vuepress dev docs" ,
13
13
"build" : " cross-env NODE_ENV=production webpack --config build/webpack.prod.conf.js --progress" ,
Original file line number Diff line number Diff line change 34
34
:disabled =" disabled"
35
35
@click =" clearSelection"
36
36
type =" button"
37
- class =" vs__clear"
37
+ class =" vs__clear vs__btn-reset "
38
38
title =" Clear selection"
39
39
>
40
40
<deselect />
41
41
</button >
42
42
43
- <open-indicator v-if =" !noDrop" ref =" openIndicator" role =" presentation" class =" vs__open-indicator" />
43
+ <button v-if =" !noDrop" ref =" openIndicator" role =" presentation" class =" vs__open-indicator vs__btn-reset" >
44
+ <open-indicator />
45
+ </button >
44
46
45
47
<slot name =" spinner" v-bind =" scope.spinner" >
46
48
<div class =" vs__spinner" v-show =" mutableLoading" >Loading...</div >
591
593
592
594
/**
593
595
* Toggle the visibility of the dropdown menu.
594
- * @param {Event } e
596
+ * @param {MouseEvent } e
595
597
* @return {void}
596
598
*/
597
- toggleDropdown (e ) {
598
- if (e .target === this .$refs .openIndicator || e .target === this .searchEl || e .target === this .$refs .toggle ||
599
- e .target .classList .contains (' vs__selected' ) || e .target === this .$el ) {
599
+ toggleDropdown (e ) {
600
+ if (this .disabled ) {
601
+ return ;
602
+ }
603
+
604
+ const target = e .target ;
605
+
606
+ const toggleableElements = [
607
+ this .$refs .openIndicator ,
608
+ this .$refs .toggle ,
609
+ this .searchEl ,
610
+ this .$el ,
611
+ ];
612
+
613
+ if (toggleableElements .includes (target) || target .classList .contains (' vs__selected' ) ) {
600
614
if (this .open ) {
601
- this .searchEl .blur () // dropdown will close on blur
615
+ // dropdown will close on blur
616
+ this .searchEl .blur ();
602
617
} else {
603
- if (! this .disabled ) {
604
- this .open = true
605
- this .searchEl .focus ()
606
- }
618
+ this .open = true ;
619
+ this .searchEl .focus ();
607
620
}
608
621
}
609
622
},
Original file line number Diff line number Diff line change
1
+ .vs__btn-reset {
2
+ appearance : none ;
3
+ border : none ;
4
+ padding : 0 ;
5
+ border : 0 ;
6
+ cursor : pointer ;
7
+ background-color : transparent ;
8
+ }
Original file line number Diff line number Diff line change 2
2
3
3
.vs__clear {
4
4
fill : $vs-controls-color ;
5
- padding : 0 ;
6
- border : 0 ;
7
- background-color : transparent ;
8
- cursor : pointer ;
9
5
margin-right : 8px ;
10
6
}
You can’t perform that action at this time.
0 commit comments