-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexm-token-input-dropdown.html
More file actions
executable file
·107 lines (101 loc) · 2.36 KB
/
exm-token-input-dropdown.html
File metadata and controls
executable file
·107 lines (101 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../iron-dropdown/iron-dropdown.html">
<link rel="import" href="../neon-animation/neon-animations.html">
<link rel="import" href="../paper-styles/shadow.html">
<link rel="import" href="exm-expand-animation.html">
<dom-module id="exm-token-input-dropdown">
<template>
<style>
iron-dropdown {
background: var(--exm-token-input-dropdown-background-color, #fafafa);
color: var(--exm-token-input-dropdown-text-color, --secondary-text-color);
@apply(--shadow-elevation-2dp);
min-width: 280px;
}
</style>
<iron-dropdown id="dropdown"
vertical-align="[[verticalAlign]]"
horizontal-align="[[horizontalAlign]]"
auto-fit-on-attach="[[autoFitOnAttach]]"
no-overlap="[[noOverlap]]"
open-animation-config="[[openAnimationConfig]]"
close-animation-config="[[closeAnimationConfig]]">
<content id="contentNode" select=".dropdown-content"></content>
</iron-dropdown>
</template>
<script>
Polymer({
is: 'exm-token-input-dropdown',
properties: {
verticalAlign: String,
horizontalAlign: String,
autoFitOnAttach:{
type: Boolean,
value: false
},
noOverlap: {
type: Boolean,
value: false
},
disabled: Boolean,
dropdown: {
type: Object,
value: function() {
return this.$.dropdown;
}
},
openAnimationConfig: {
type: Array,
value: function() {
return [ {
name: 'fade-in-animation',
timing: {
delay: 150,
duration: 50
}
}, {
name: 'exm-expand-animation',
timing: {
delay: 150,
duration: 200
}
} ];
}
},
closeAnimationConfig: {
type: Array,
value: function() {
return [ {
name: 'fade-out-animation',
timing: {
duration: 300
}
} ];
}
}
},
listeners: {
'tap': '_handleItemTap'
},
_handleItemTap: function(e) {
e.preventDefault();
this.async(function(){
this.fire('item-selected', e.target.name);
}.bind(this), 300);
e.stopPropagation();
},
/**
* Open can be used to open the dropdown list
*/
open: function() {
this.$.dropdown.open();
},
/**
* Close can be used to close the dropdown list
*/
close: function() {
this.$.dropdown.close();
},
});
</script>
</dom-module>