| Index: third_party/polymer/v1_0/components-chromium/paper-menu-button/paper-menu-button-extracted.js
|
| diff --git a/third_party/polymer/v1_0/components-chromium/paper-menu-button/paper-menu-button-extracted.js b/third_party/polymer/v1_0/components-chromium/paper-menu-button/paper-menu-button-extracted.js
|
| index bcdcc62bd02b680dde64215edd49c0146939f1d4..33017087565143e7bada9c6ba0aaef41263ccfeb 100644
|
| --- a/third_party/polymer/v1_0/components-chromium/paper-menu-button/paper-menu-button-extracted.js
|
| +++ b/third_party/polymer/v1_0/components-chromium/paper-menu-button/paper-menu-button-extracted.js
|
| @@ -1,11 +1,21 @@
|
| -
|
| - (function() {
|
| +(function() {
|
| 'use strict';
|
|
|
| var PaperMenuButton = Polymer({
|
| -
|
| is: 'paper-menu-button',
|
|
|
| + /**
|
| + * Fired when the dropdown opens.
|
| + *
|
| + * @event paper-dropdown-open
|
| + */
|
| +
|
| + /**
|
| + * Fired when the dropdown closes.
|
| + *
|
| + * @event paper-dropdown-close
|
| + */
|
| +
|
| behaviors: [
|
| Polymer.IronA11yKeysBehavior,
|
| Polymer.IronControlState
|
| @@ -43,6 +53,28 @@
|
| },
|
|
|
| /**
|
| + * A pixel value that will be added to the position calculated for the
|
| + * given `horizontalAlign`. Use a negative value to offset to the
|
| + * left, or a positive value to offset to the right.
|
| + */
|
| + horizontalOffset: {
|
| + type: Number,
|
| + value: 0,
|
| + notify: true
|
| + },
|
| +
|
| + /**
|
| + * A pixel value that will be added to the position calculated for the
|
| + * given `verticalAlign`. Use a negative value to offset towards the
|
| + * top, or a positive value to offset towards the bottom.
|
| + */
|
| + verticalOffset: {
|
| + type: Number,
|
| + value: 0,
|
| + notify: true
|
| + },
|
| +
|
| + /**
|
| * Set to true to disable animations when opening and closing the
|
| * dropdown.
|
| */
|
| @@ -52,6 +84,15 @@
|
| },
|
|
|
| /**
|
| + * Set to true to disable automatically closing the dropdown after
|
| + * a selection has been made.
|
| + */
|
| + ignoreActivate: {
|
| + type: Boolean,
|
| + value: false
|
| + },
|
| +
|
| + /**
|
| * An animation config. If provided, this will be used to animate the
|
| * opening of the dropdown.
|
| */
|
| @@ -126,7 +167,10 @@
|
| * to the dropdown trigger.
|
| */
|
| open: function() {
|
| - this.fire('paper-open');
|
| + if (this.disabled) {
|
| + return;
|
| + }
|
| +
|
| this.$.dropdown.open();
|
| },
|
|
|
| @@ -134,12 +178,48 @@
|
| * Hide the dropdown content.
|
| */
|
| close: function() {
|
| - this.fire('paper-close');
|
| this.$.dropdown.close();
|
| },
|
|
|
| + /**
|
| + * When an `iron-activate` event is received, the dropdown should
|
| + * automatically close on the assumption that a value has been chosen.
|
| + *
|
| + * @param {CustomEvent} event A CustomEvent instance with type
|
| + * set to `"iron-activate"`.
|
| + */
|
| _onIronActivate: function(event) {
|
| - this.close();
|
| + if (!this.ignoreActivate) {
|
| + this.close();
|
| + }
|
| + },
|
| +
|
| + /**
|
| + * When the dropdown opens, the `paper-menu-button` fires `paper-open`.
|
| + * When the dropdown closes, the `paper-menu-button` fires `paper-close`.
|
| + *
|
| + * @param {boolean} opened True if the dropdown is opened, otherwise false.
|
| + * @param {boolean} oldOpened The previous value of `opened`.
|
| + */
|
| + _openedChanged: function(opened, oldOpened) {
|
| + if (opened) {
|
| + this.fire('paper-dropdown-open');
|
| + } else if (oldOpened != null) {
|
| + this.fire('paper-dropdown-close');
|
| + }
|
| + },
|
| +
|
| + /**
|
| + * If the dropdown is open when disabled becomes true, close the
|
| + * dropdown.
|
| + *
|
| + * @param {boolean} disabled True if disabled, otherwise false.
|
| + */
|
| + _disabledChanged: function(disabled) {
|
| + Polymer.IronControlState._disabledChanged.apply(this, arguments);
|
| + if (disabled && this.opened) {
|
| + this.close();
|
| + }
|
| }
|
| });
|
|
|
| @@ -147,4 +227,4 @@
|
| PaperMenuButton.MAX_ANIMATION_TIME_MS = 400;
|
|
|
| Polymer.PaperMenuButton = PaperMenuButton;
|
| - })();
|
| + })();
|
|
|