2015-08-12 14:39:02 -07:00
|
|
|
<!--
|
|
|
|
@license
|
|
|
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
|
|
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
|
|
|
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
|
|
|
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
|
|
|
Code distributed by Google as part of the polymer project is also
|
|
|
|
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
|
|
|
-->
|
|
|
|
|
|
|
|
<link rel="import" href="../polymer/polymer.html">
|
|
|
|
<link rel="import" href="../iron-resizable-behavior/iron-resizable-behavior.html">
|
|
|
|
<link rel="import" href="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
|
|
|
|
<link rel="import" href="../iron-behaviors/iron-control-state.html">
|
|
|
|
<link rel="import" href="../iron-overlay-behavior/iron-overlay-behavior.html">
|
|
|
|
<link rel="import" href="../neon-animation/neon-animation-runner-behavior.html">
|
|
|
|
<link rel="import" href="../neon-animation/animations/opaque-animation.html">
|
|
|
|
<link rel="import" href="iron-dropdown-scroll-manager.html">
|
|
|
|
|
|
|
|
<!--
|
|
|
|
`<iron-dropdown>` is a generalized element that is useful when you have
|
|
|
|
hidden content (`.dropdown-content`) that is revealed due to some change in
|
|
|
|
state that should cause it to do so.
|
|
|
|
|
|
|
|
Note that this is a low-level element intended to be used as part of other
|
|
|
|
composite elements that cause dropdowns to be revealed.
|
|
|
|
|
|
|
|
Examples of elements that might be implemented using an `iron-dropdown`
|
|
|
|
include comboboxes, menubuttons, selects. The list goes on.
|
|
|
|
|
|
|
|
The `<iron-dropdown>` element exposes attributes that allow the position
|
|
|
|
of the `.dropdown-content` relative to the `.dropdown-trigger` to be
|
|
|
|
configured.
|
|
|
|
|
|
|
|
<iron-dropdown horizontal-align="right" vertical-align="top">
|
|
|
|
<div class="dropdown-content">Hello!</div>
|
|
|
|
</iron-dropdown>
|
|
|
|
|
|
|
|
In the above example, the `<div>` with class `.dropdown-content` will be
|
|
|
|
hidden until the dropdown element has `opened` set to true, or when the `open`
|
|
|
|
method is called on the element.
|
|
|
|
|
|
|
|
@demo demo/index.html
|
|
|
|
-->
|
|
|
|
|
|
|
|
<dom-module id="iron-dropdown">
|
|
|
|
<style>
|
|
|
|
:host {
|
|
|
|
position: fixed;
|
|
|
|
}
|
|
|
|
|
|
|
|
#contentWrapper ::content > * {
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
#contentWrapper.animating ::content > * {
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<template>
|
|
|
|
<div id="contentWrapper">
|
|
|
|
<content id="content" select=".dropdown-content"></content>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
(function() {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
Polymer({
|
|
|
|
is: 'iron-dropdown',
|
|
|
|
|
|
|
|
behaviors: [
|
|
|
|
Polymer.IronControlState,
|
|
|
|
Polymer.IronA11yKeysBehavior,
|
|
|
|
Polymer.IronOverlayBehavior,
|
|
|
|
Polymer.NeonAnimationRunnerBehavior
|
|
|
|
],
|
|
|
|
|
|
|
|
properties: {
|
|
|
|
/**
|
|
|
|
* The orientation against which to align the dropdown content
|
|
|
|
* horizontally relative to the dropdown trigger.
|
|
|
|
*/
|
|
|
|
horizontalAlign: {
|
|
|
|
type: String,
|
|
|
|
value: 'left',
|
|
|
|
reflectToAttribute: true
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The orientation against which to align the dropdown content
|
|
|
|
* vertically relative to the dropdown trigger.
|
|
|
|
*/
|
|
|
|
verticalAlign: {
|
|
|
|
type: String,
|
|
|
|
value: 'top',
|
|
|
|
reflectToAttribute: true
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A pixel value that will be added to the position calculated for the
|
2015-12-15 11:24:41 -07:00
|
|
|
* given `horizontalAlign`, in the direction of alignment. You can think
|
|
|
|
* of it as increasing or decreasing the distance to the side of the
|
|
|
|
* screen given by `horizontalAlign`.
|
|
|
|
*
|
|
|
|
* If `horizontalAlign` is "left", this offset will increase or decrease
|
|
|
|
* the distance to the left side of the screen: a negative offset will
|
|
|
|
* move the dropdown to the left; a positive one, to the right.
|
|
|
|
*
|
|
|
|
* Conversely if `horizontalAlign` is "right", this offset will increase
|
|
|
|
* or decrease the distance to the right side of the screen: a negative
|
|
|
|
* offset will move the dropdown to the right; a positive one, to the left.
|
2015-08-12 14:39:02 -07:00
|
|
|
*/
|
|
|
|
horizontalOffset: {
|
|
|
|
type: Number,
|
|
|
|
value: 0,
|
|
|
|
notify: true
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A pixel value that will be added to the position calculated for the
|
2015-12-15 11:24:41 -07:00
|
|
|
* given `verticalAlign`, in the direction of alignment. You can think
|
|
|
|
* of it as increasing or decreasing the distance to the side of the
|
|
|
|
* screen given by `verticalAlign`.
|
|
|
|
*
|
|
|
|
* If `verticalAlign` is "top", this offset will increase or decrease
|
|
|
|
* the distance to the top side of the screen: a negative offset will
|
|
|
|
* move the dropdown upwards; a positive one, downwards.
|
|
|
|
*
|
|
|
|
* Conversely if `verticalAlign` is "bottom", this offset will increase
|
|
|
|
* or decrease the distance to the bottom side of the screen: a negative
|
|
|
|
* offset will move the dropdown downwards; a positive one, upwards.
|
2015-08-12 14:39:02 -07:00
|
|
|
*/
|
|
|
|
verticalOffset: {
|
|
|
|
type: Number,
|
|
|
|
value: 0,
|
|
|
|
notify: true
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The element that should be used to position the dropdown when
|
|
|
|
* it is opened.
|
|
|
|
*/
|
|
|
|
positionTarget: {
|
2016-03-11 20:29:37 -07:00
|
|
|
type: Object
|
2015-08-12 14:39:02 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An animation config. If provided, this will be used to animate the
|
|
|
|
* opening of the dropdown.
|
|
|
|
*/
|
|
|
|
openAnimationConfig: {
|
|
|
|
type: Object
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An animation config. If provided, this will be used to animate the
|
|
|
|
* closing of the dropdown.
|
|
|
|
*/
|
|
|
|
closeAnimationConfig: {
|
|
|
|
type: Object
|
|
|
|
},
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
/**
|
|
|
|
* If provided, this will be the element that will be focused when
|
|
|
|
* the dropdown opens.
|
|
|
|
*/
|
|
|
|
focusTarget: {
|
|
|
|
type: Object
|
|
|
|
},
|
|
|
|
|
2015-08-12 14:39:02 -07:00
|
|
|
/**
|
|
|
|
* Set to true to disable animations when opening and closing the
|
|
|
|
* dropdown.
|
|
|
|
*/
|
|
|
|
noAnimations: {
|
|
|
|
type: Boolean,
|
|
|
|
value: false
|
|
|
|
},
|
|
|
|
|
2015-09-22 21:00:30 -07:00
|
|
|
/**
|
|
|
|
* By default, the dropdown will constrain scrolling on the page
|
|
|
|
* to itself when opened.
|
|
|
|
* Set to true in order to prevent scroll from being constrained
|
|
|
|
* to the dropdown when it opens.
|
|
|
|
*/
|
|
|
|
allowOutsideScroll: {
|
|
|
|
type: Boolean,
|
|
|
|
value: false
|
2015-08-12 14:39:02 -07:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
listeners: {
|
|
|
|
'neon-animation-finish': '_onNeonAnimationFinish'
|
|
|
|
},
|
|
|
|
|
|
|
|
observers: [
|
2016-03-11 20:29:37 -07:00
|
|
|
'_updateOverlayPosition(positionTarget, verticalAlign, horizontalAlign, verticalOffset, horizontalOffset)'
|
2015-08-12 14:39:02 -07:00
|
|
|
],
|
|
|
|
|
|
|
|
attached: function() {
|
2016-03-11 20:29:37 -07:00
|
|
|
this.positionTarget = this.positionTarget || this._defaultPositionTarget;
|
|
|
|
// Memoize this to avoid expensive calculations & relayouts.
|
|
|
|
this._isRTL = window.getComputedStyle(this).direction == 'rtl';
|
2015-08-12 14:39:02 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The element that is contained by the dropdown, if any.
|
|
|
|
*/
|
|
|
|
get containedElement() {
|
|
|
|
return Polymer.dom(this.$.content).getDistributedNodes()[0];
|
|
|
|
},
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
/**
|
|
|
|
* The element that should be focused when the dropdown opens.
|
2016-02-05 23:33:34 -07:00
|
|
|
* @deprecated
|
2015-08-18 21:08:03 -07:00
|
|
|
*/
|
|
|
|
get _focusTarget() {
|
|
|
|
return this.focusTarget || this.containedElement;
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The element that should be used to position the dropdown when
|
|
|
|
* it opens, if no position target is configured.
|
|
|
|
*/
|
2015-08-12 14:39:02 -07:00
|
|
|
get _defaultPositionTarget() {
|
|
|
|
var parent = Polymer.dom(this).parentNode;
|
|
|
|
|
|
|
|
if (parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
|
|
|
parent = parent.host;
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent;
|
|
|
|
},
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
/**
|
2016-03-11 20:29:37 -07:00
|
|
|
* The horizontal align value, accounting for the RTL/LTR text direction.
|
2015-08-18 21:08:03 -07:00
|
|
|
*/
|
2016-03-11 20:29:37 -07:00
|
|
|
get _localeHorizontalAlign() {
|
|
|
|
// In RTL, "left" becomes "right".
|
|
|
|
if (this._isRTL) {
|
|
|
|
return this.horizontalAlign === 'right' ? 'left' : 'right';
|
|
|
|
} else {
|
|
|
|
return this.horizontalAlign;
|
2015-08-12 14:39:02 -07:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
/**
|
|
|
|
* The horizontal offset value used to position the dropdown.
|
2016-03-11 20:29:37 -07:00
|
|
|
* @param {ClientRect} dropdownRect
|
|
|
|
* @param {ClientRect} positionRect
|
|
|
|
* @param {boolean=false} fromRight
|
|
|
|
* @return {number} pixels
|
|
|
|
* @private
|
2015-08-18 21:08:03 -07:00
|
|
|
*/
|
2016-03-11 20:29:37 -07:00
|
|
|
_horizontalAlignTargetValue: function(dropdownRect, positionRect, fromRight) {
|
2015-08-12 14:39:02 -07:00
|
|
|
var target;
|
2016-03-11 20:29:37 -07:00
|
|
|
if (fromRight) {
|
|
|
|
target = document.documentElement.clientWidth - positionRect.right - (this._fitWidth - dropdownRect.right);
|
2015-08-12 14:39:02 -07:00
|
|
|
} else {
|
2016-03-11 20:29:37 -07:00
|
|
|
target = positionRect.left - dropdownRect.left;
|
2015-08-12 14:39:02 -07:00
|
|
|
}
|
|
|
|
target += this.horizontalOffset;
|
|
|
|
|
|
|
|
return Math.max(target, 0);
|
|
|
|
},
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
/**
|
|
|
|
* The vertical offset value used to position the dropdown.
|
2016-03-11 20:29:37 -07:00
|
|
|
* @param {ClientRect} dropdownRect
|
|
|
|
* @param {ClientRect} positionRect
|
|
|
|
* @param {boolean=false} fromBottom
|
|
|
|
* @return {number} pixels
|
|
|
|
* @private
|
2015-08-18 21:08:03 -07:00
|
|
|
*/
|
2016-03-11 20:29:37 -07:00
|
|
|
_verticalAlignTargetValue: function(dropdownRect, positionRect, fromBottom) {
|
2015-08-12 14:39:02 -07:00
|
|
|
var target;
|
2016-03-11 20:29:37 -07:00
|
|
|
if (fromBottom) {
|
|
|
|
target = document.documentElement.clientHeight - positionRect.bottom - (this._fitHeight - dropdownRect.bottom);
|
2015-08-12 14:39:02 -07:00
|
|
|
} else {
|
2016-03-11 20:29:37 -07:00
|
|
|
target = positionRect.top - dropdownRect.top;
|
2015-08-12 14:39:02 -07:00
|
|
|
}
|
|
|
|
target += this.verticalOffset;
|
|
|
|
|
|
|
|
return Math.max(target, 0);
|
|
|
|
},
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
/**
|
|
|
|
* Called when the value of `opened` changes.
|
|
|
|
*
|
|
|
|
* @param {boolean} opened True if the dropdown is opened.
|
|
|
|
*/
|
2015-08-12 14:39:02 -07:00
|
|
|
_openedChanged: function(opened) {
|
|
|
|
if (opened && this.disabled) {
|
|
|
|
this.cancel();
|
|
|
|
} else {
|
2015-08-18 21:08:03 -07:00
|
|
|
this.cancelAnimation();
|
2016-03-11 20:29:37 -07:00
|
|
|
this.sizingTarget = this.containedElement || this.sizingTarget;
|
|
|
|
this._updateAnimationConfig();
|
2015-08-12 14:39:02 -07:00
|
|
|
Polymer.IronOverlayBehaviorImpl._openedChanged.apply(this, arguments);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
/**
|
|
|
|
* Overridden from `IronOverlayBehavior`.
|
|
|
|
*/
|
2015-08-12 14:39:02 -07:00
|
|
|
_renderOpened: function() {
|
2015-09-22 21:00:30 -07:00
|
|
|
if (!this.allowOutsideScroll) {
|
|
|
|
Polymer.IronDropdownScrollManager.pushScrollLock(this);
|
|
|
|
}
|
|
|
|
|
2015-08-12 14:39:02 -07:00
|
|
|
if (!this.noAnimations && this.animationConfig && this.animationConfig.open) {
|
2016-03-11 20:29:37 -07:00
|
|
|
if (this.withBackdrop) {
|
|
|
|
this.backdropElement.open();
|
|
|
|
}
|
2015-08-12 14:39:02 -07:00
|
|
|
this.$.contentWrapper.classList.add('animating');
|
|
|
|
this.playAnimation('open');
|
|
|
|
} else {
|
|
|
|
Polymer.IronOverlayBehaviorImpl._renderOpened.apply(this, arguments);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
/**
|
|
|
|
* Overridden from `IronOverlayBehavior`.
|
|
|
|
*/
|
2015-08-12 14:39:02 -07:00
|
|
|
_renderClosed: function() {
|
|
|
|
Polymer.IronDropdownScrollManager.removeScrollLock(this);
|
|
|
|
if (!this.noAnimations && this.animationConfig && this.animationConfig.close) {
|
2016-03-11 20:29:37 -07:00
|
|
|
if (this.withBackdrop) {
|
|
|
|
this.backdropElement.close();
|
|
|
|
}
|
2015-08-12 14:39:02 -07:00
|
|
|
this.$.contentWrapper.classList.add('animating');
|
|
|
|
this.playAnimation('close');
|
|
|
|
} else {
|
|
|
|
Polymer.IronOverlayBehaviorImpl._renderClosed.apply(this, arguments);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
/**
|
|
|
|
* Called when animation finishes on the dropdown (when opening or
|
|
|
|
* closing). Responsible for "completing" the process of opening or
|
|
|
|
* closing the dropdown by positioning it or setting its display to
|
|
|
|
* none.
|
|
|
|
*/
|
2015-08-12 14:39:02 -07:00
|
|
|
_onNeonAnimationFinish: function() {
|
|
|
|
this.$.contentWrapper.classList.remove('animating');
|
|
|
|
if (this.opened) {
|
2016-03-11 20:29:37 -07:00
|
|
|
Polymer.IronOverlayBehaviorImpl._finishRenderOpened.apply(this);
|
2015-08-12 14:39:02 -07:00
|
|
|
} else {
|
2016-03-11 20:29:37 -07:00
|
|
|
Polymer.IronOverlayBehaviorImpl._finishRenderClosed.apply(this);
|
2015-08-12 14:39:02 -07:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
/**
|
|
|
|
* Constructs the final animation config from different properties used
|
|
|
|
* to configure specific parts of the opening and closing animations.
|
|
|
|
*/
|
2015-08-12 14:39:02 -07:00
|
|
|
_updateAnimationConfig: function() {
|
|
|
|
var animationConfig = {};
|
|
|
|
var animations = [];
|
|
|
|
|
|
|
|
if (this.openAnimationConfig) {
|
|
|
|
// NOTE(cdata): When making `display:none` elements visible in Safari,
|
|
|
|
// the element will paint once in a fully visible state, causing the
|
|
|
|
// dropdown to flash before it fades in. We prepend an
|
|
|
|
// `opaque-animation` to fix this problem:
|
|
|
|
animationConfig.open = [{
|
|
|
|
name: 'opaque-animation',
|
|
|
|
}].concat(this.openAnimationConfig);
|
|
|
|
animations = animations.concat(animationConfig.open);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.closeAnimationConfig) {
|
|
|
|
animationConfig.close = this.closeAnimationConfig;
|
|
|
|
animations = animations.concat(animationConfig.close);
|
|
|
|
}
|
|
|
|
|
|
|
|
animations.forEach(function(animation) {
|
|
|
|
animation.node = this.containedElement;
|
|
|
|
}, this);
|
|
|
|
|
|
|
|
this.animationConfig = animationConfig;
|
|
|
|
},
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
/**
|
2016-03-11 20:29:37 -07:00
|
|
|
* Updates the overlay position based on configured horizontal
|
|
|
|
* and vertical alignment.
|
2015-08-18 21:08:03 -07:00
|
|
|
*/
|
2016-03-11 20:29:37 -07:00
|
|
|
_updateOverlayPosition: function() {
|
|
|
|
if (this.isAttached) {
|
|
|
|
// This triggers iron-resize, and iron-overlay-behavior will call refit if needed.
|
|
|
|
this.notifyResize();
|
|
|
|
}
|
2015-08-12 14:39:02 -07:00
|
|
|
},
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
/**
|
2016-03-11 20:29:37 -07:00
|
|
|
* Useful to call this after the element, the window, or the `fitInfo`
|
|
|
|
* element has been resized. Will maintain the scroll position.
|
2015-08-18 21:08:03 -07:00
|
|
|
*/
|
2016-03-11 20:29:37 -07:00
|
|
|
refit: function () {
|
|
|
|
if (!this.opened) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var containedElement = this.containedElement;
|
|
|
|
var scrollTop;
|
|
|
|
var scrollLeft;
|
2015-08-12 14:39:02 -07:00
|
|
|
|
2016-03-11 20:29:37 -07:00
|
|
|
if (containedElement) {
|
|
|
|
scrollTop = containedElement.scrollTop;
|
|
|
|
scrollLeft = containedElement.scrollLeft;
|
2015-08-12 14:39:02 -07:00
|
|
|
}
|
2016-03-11 20:29:37 -07:00
|
|
|
Polymer.IronFitBehavior.refit.apply(this, arguments);
|
2015-08-12 14:39:02 -07:00
|
|
|
|
2016-03-11 20:29:37 -07:00
|
|
|
if (containedElement) {
|
|
|
|
containedElement.scrollTop = scrollTop;
|
|
|
|
containedElement.scrollLeft = scrollLeft;
|
|
|
|
}
|
|
|
|
},
|
2015-08-12 14:39:02 -07:00
|
|
|
|
2016-03-11 20:29:37 -07:00
|
|
|
/**
|
|
|
|
* Resets the target element's position and size constraints, and clear
|
|
|
|
* the memoized data.
|
|
|
|
*/
|
|
|
|
resetFit: function() {
|
|
|
|
Polymer.IronFitBehavior.resetFit.apply(this, arguments);
|
2015-08-12 14:39:02 -07:00
|
|
|
|
2016-03-11 20:29:37 -07:00
|
|
|
var hAlign = this._localeHorizontalAlign;
|
|
|
|
var vAlign = this.verticalAlign;
|
|
|
|
// Set to 0, 0 in order to discover any offset caused by parent stacking contexts.
|
|
|
|
this.style[hAlign] = this.style[vAlign] = '0px';
|
2015-08-12 14:39:02 -07:00
|
|
|
|
2016-03-11 20:29:37 -07:00
|
|
|
var dropdownRect = this.getBoundingClientRect();
|
|
|
|
var positionRect = this.positionTarget.getBoundingClientRect();
|
|
|
|
var horizontalValue = this._horizontalAlignTargetValue(dropdownRect, positionRect, hAlign === 'right');
|
|
|
|
var verticalValue = this._verticalAlignTargetValue(dropdownRect, positionRect, vAlign === 'bottom');
|
|
|
|
|
|
|
|
this.style[hAlign] = horizontalValue + 'px';
|
|
|
|
this.style[vAlign] = verticalValue + 'px';
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Overridden from `IronFitBehavior`.
|
|
|
|
* Ensure positionedBy has correct values for horizontally & vertically.
|
|
|
|
*/
|
|
|
|
_discoverInfo: function() {
|
|
|
|
Polymer.IronFitBehavior._discoverInfo.apply(this, arguments);
|
|
|
|
// Note(valdrin): in Firefox, an element with style `position: fixed; bottom: 90vh; height: 20vh`
|
|
|
|
// would have `getComputedStyle(element).top < 0` (instead of being `auto`) http://jsbin.com/cofired/3/edit?html,output
|
|
|
|
// This would cause IronFitBehavior's `constrain` to wrongly calculate sizes
|
|
|
|
// (it would use `top` instead of `bottom`), so we ensure we give the correct values.
|
|
|
|
this._fitInfo.positionedBy.horizontally = this._localeHorizontalAlign;
|
|
|
|
this._fitInfo.positionedBy.vertically = this.verticalAlign;
|
2015-08-12 14:39:02 -07:00
|
|
|
},
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
/**
|
2016-02-05 23:33:34 -07:00
|
|
|
* Apply focus to focusTarget or containedElement
|
2015-08-18 21:08:03 -07:00
|
|
|
*/
|
2016-02-05 23:33:34 -07:00
|
|
|
_applyFocus: function () {
|
|
|
|
var focusTarget = this.focusTarget || this.containedElement;
|
|
|
|
if (focusTarget && this.opened && !this.noAutoFocus) {
|
|
|
|
focusTarget.focus();
|
|
|
|
} else {
|
|
|
|
Polymer.IronOverlayBehaviorImpl._applyFocus.apply(this, arguments);
|
|
|
|
}
|
2015-08-12 14:39:02 -07:00
|
|
|
}
|
|
|
|
});
|
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
</dom-module>
|