OLD | NEW |
(Empty) | |
| 1 |
| 2 |
| 3 (function() { |
| 4 |
| 5 'use strict'; |
| 6 |
| 7 function classNames(obj) { |
| 8 var classNames = []; |
| 9 for (var key in obj) { |
| 10 if (obj.hasOwnProperty(key) && obj[key]) { |
| 11 classNames.push(key); |
| 12 } |
| 13 } |
| 14 |
| 15 return classNames.join(' '); |
| 16 } |
| 17 |
| 18 Polymer({ |
| 19 |
| 20 is: 'paper-toolbar', |
| 21 |
| 22 enableCustomStyleProperties: true, |
| 23 |
| 24 properties: { |
| 25 |
| 26 /** |
| 27 * Controls how the items are aligned horizontally when they are placed |
| 28 * at the bottom. |
| 29 * Options are `start`, `center`, `end`, `justified` and `around`. |
| 30 * |
| 31 * @attribute bottomJustify |
| 32 * @type string |
| 33 * @default '' |
| 34 */ |
| 35 bottomJustify: { |
| 36 type: String, |
| 37 value: '' |
| 38 }, |
| 39 |
| 40 /** |
| 41 * Controls how the items are aligned horizontally. |
| 42 * Options are `start`, `center`, `end`, `justified` and `around`. |
| 43 * |
| 44 * @attribute justify |
| 45 * @type string |
| 46 * @default '' |
| 47 */ |
| 48 justify: { |
| 49 type: String, |
| 50 value: '' |
| 51 }, |
| 52 |
| 53 /** |
| 54 * Controls how the items are aligned horizontally when they are placed |
| 55 * in the middle. |
| 56 * Options are `start`, `center`, `end`, `justified` and `around`. |
| 57 * |
| 58 * @attribute middleJustify |
| 59 * @type string |
| 60 * @default '' |
| 61 */ |
| 62 middleJustify: { |
| 63 type: String, |
| 64 value: '' |
| 65 } |
| 66 |
| 67 }, |
| 68 |
| 69 _computeBarClassName: function(barJustify) { |
| 70 var classObj = { |
| 71 center: true, |
| 72 horizontal: true, |
| 73 layout: true, |
| 74 'toolbar-tools': true |
| 75 }; |
| 76 |
| 77 // If a blank string or any falsy value is given, no other class name is |
| 78 // added. |
| 79 if (barJustify) { |
| 80 var justifyClassName = (barJustify === 'justified') ? |
| 81 barJustify : |
| 82 barJustify + '-justified'; |
| 83 |
| 84 classObj[justifyClassName] = true; |
| 85 } |
| 86 |
| 87 return classNames(classObj); |
| 88 } |
| 89 |
| 90 }); |
| 91 |
| 92 }()); |
| 93 |
OLD | NEW |