| OLD | NEW |
| (Empty) | |
| 1 <!-- |
| 2 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 6 Code distributed by Google as part of the polymer project is also |
| 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 8 --> |
| 9 <link rel="import" href="../../../polymer/polymer.html"> |
| 10 <link rel="import" href="../../../paper-styles/paper-styles.html"> |
| 11 <link rel="import" href="../../neon-animation-runner-behavior.html"> |
| 12 <link rel="import" href="../../animations/scale-up-animation.html"> |
| 13 <link rel="import" href="../../animations/fade-out-animation.html"> |
| 14 |
| 15 |
| 16 <dom-module id="my-dialog"> |
| 17 |
| 18 <style> |
| 19 |
| 20 :host { |
| 21 display: none; |
| 22 padding: 16px; |
| 23 background: white; |
| 24 color: black; |
| 25 margin: 0 auto; |
| 26 |
| 27 @apply(--shadow-elevation-2dp); |
| 28 } |
| 29 |
| 30 </style> |
| 31 |
| 32 <template> |
| 33 |
| 34 <content></content> |
| 35 |
| 36 </template> |
| 37 |
| 38 </dom-module> |
| 39 |
| 40 <script> |
| 41 |
| 42 Polymer({ |
| 43 |
| 44 is: 'my-dialog', |
| 45 |
| 46 behaviors: [ |
| 47 Polymer.NeonAnimationRunnerBehavior |
| 48 ], |
| 49 |
| 50 properties: { |
| 51 |
| 52 opened: { |
| 53 type: Boolean |
| 54 }, |
| 55 |
| 56 animationConfig: { |
| 57 type: Object, |
| 58 value: function() { |
| 59 return { |
| 60 'entry': [{ |
| 61 name: 'scale-up-animation', |
| 62 node: this |
| 63 }], |
| 64 'exit': [{ |
| 65 name: 'fade-out-animation', |
| 66 node: this |
| 67 }] |
| 68 } |
| 69 } |
| 70 } |
| 71 |
| 72 }, |
| 73 |
| 74 listeners: { |
| 75 'neon-animation-finish': '_onAnimationFinish' |
| 76 }, |
| 77 |
| 78 _onAnimationFinish: function() { |
| 79 if (!this.opened) { |
| 80 this.style.display = ''; |
| 81 } |
| 82 }, |
| 83 |
| 84 show: function() { |
| 85 this.opened = true; |
| 86 this.style.display = 'inline-block'; |
| 87 this.playAnimation('entry'); |
| 88 }, |
| 89 |
| 90 hide: function() { |
| 91 this.opened = false; |
| 92 this.playAnimation('exit'); |
| 93 } |
| 94 |
| 95 }); |
| 96 |
| 97 </script> |
| OLD | NEW |