| OLD | NEW |
| (Empty) | |
| 1 |
| 2 (function() { |
| 3 'use strict'; |
| 4 |
| 5 var PaperMenuButton = Polymer({ |
| 6 |
| 7 is: 'paper-menu-button', |
| 8 |
| 9 behaviors: [ |
| 10 Polymer.IronA11yKeysBehavior, |
| 11 Polymer.IronControlState |
| 12 ], |
| 13 |
| 14 properties: { |
| 15 |
| 16 /** |
| 17 * True if the content is currently displayed. |
| 18 */ |
| 19 opened: { |
| 20 type: Boolean, |
| 21 value: false, |
| 22 notify: true |
| 23 }, |
| 24 |
| 25 /** |
| 26 * The orientation against which to align the menu dropdown |
| 27 * horizontally relative to the dropdown trigger. |
| 28 */ |
| 29 horizontalAlign: { |
| 30 type: String, |
| 31 value: 'left', |
| 32 reflectToAttribute: true |
| 33 }, |
| 34 |
| 35 /** |
| 36 * The orientation against which to align the menu dropdown |
| 37 * vertically relative to the dropdown trigger. |
| 38 */ |
| 39 verticalAlign: { |
| 40 type: String, |
| 41 value: 'top', |
| 42 reflectToAttribute: true |
| 43 }, |
| 44 |
| 45 /** |
| 46 * Set to true to disable animations when opening and closing the |
| 47 * dropdown. |
| 48 */ |
| 49 noAnimations: { |
| 50 type: Boolean, |
| 51 value: false |
| 52 }, |
| 53 |
| 54 /** |
| 55 * An animation config. If provided, this will be used to animate the |
| 56 * opening of the dropdown. |
| 57 */ |
| 58 openAnimationConfig: { |
| 59 type: Object, |
| 60 value: function() { |
| 61 return [{ |
| 62 name: 'fade-in-animation', |
| 63 timing: { |
| 64 delay: 100, |
| 65 duration: 200 |
| 66 } |
| 67 }, { |
| 68 name: 'paper-menu-grow-width-animation', |
| 69 timing: { |
| 70 delay: 100, |
| 71 duration: 150, |
| 72 easing: PaperMenuButton.ANIMATION_CUBIC_BEZIER |
| 73 } |
| 74 }, { |
| 75 name: 'paper-menu-grow-height-animation', |
| 76 timing: { |
| 77 delay: 100, |
| 78 duration: 275, |
| 79 easing: PaperMenuButton.ANIMATION_CUBIC_BEZIER |
| 80 } |
| 81 }]; |
| 82 } |
| 83 }, |
| 84 |
| 85 /** |
| 86 * An animation config. If provided, this will be used to animate the |
| 87 * closing of the dropdown. |
| 88 */ |
| 89 closeAnimationConfig: { |
| 90 type: Object, |
| 91 value: function() { |
| 92 return [{ |
| 93 name: 'fade-out-animation', |
| 94 timing: { |
| 95 duration: 150 |
| 96 } |
| 97 }, { |
| 98 name: 'paper-menu-shrink-width-animation', |
| 99 timing: { |
| 100 delay: 100, |
| 101 duration: 50, |
| 102 easing: PaperMenuButton.ANIMATION_CUBIC_BEZIER |
| 103 } |
| 104 }, { |
| 105 name: 'paper-menu-shrink-height-animation', |
| 106 timing: { |
| 107 duration: 200, |
| 108 easing: 'ease-in' |
| 109 } |
| 110 }]; |
| 111 } |
| 112 } |
| 113 }, |
| 114 |
| 115 hostAttributes: { |
| 116 role: 'group', |
| 117 'aria-haspopup': 'true' |
| 118 }, |
| 119 |
| 120 listeners: { |
| 121 'iron-activate': '_onIronActivate' |
| 122 }, |
| 123 |
| 124 /** |
| 125 * Make the dropdown content appear as an overlay positioned relative |
| 126 * to the dropdown trigger. |
| 127 */ |
| 128 open: function() { |
| 129 this.fire('paper-open'); |
| 130 this.$.dropdown.open(); |
| 131 }, |
| 132 |
| 133 /** |
| 134 * Hide the dropdown content. |
| 135 */ |
| 136 close: function() { |
| 137 this.fire('paper-close'); |
| 138 this.$.dropdown.close(); |
| 139 }, |
| 140 |
| 141 _onIronActivate: function(event) { |
| 142 this.close(); |
| 143 } |
| 144 }); |
| 145 |
| 146 PaperMenuButton.ANIMATION_CUBIC_BEZIER = 'cubic-bezier(.3,.95,.5,1)'; |
| 147 PaperMenuButton.MAX_ANIMATION_TIME_MS = 400; |
| 148 |
| 149 Polymer.PaperMenuButton = PaperMenuButton; |
| 150 })(); |
| OLD | NEW |