Skip to content

Commit

Permalink
fix(module:dropdown): fix dropdown expands outside the bounds of the …
Browse files Browse the repository at this point in the history
  • Loading branch information
vthinkxie authored Apr 17, 2019
1 parent 937e731 commit 031ba8f
Showing 1 changed file with 41 additions and 6 deletions.
47 changes: 41 additions & 6 deletions components/core/overlay/overlay-position.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
import { ConnectedOverlayPositionChange, ConnectionPositionPair } from '@angular/cdk/overlay';

export const POSITION_MAP: { [key: string]: ConnectionPositionPair } = {
top: new ConnectionPositionPair({ originX: 'center', originY: 'top' }, { overlayX: 'center', overlayY: 'bottom' }),
top: new ConnectionPositionPair(
{ originX: 'center', originY: 'top' },
{
overlayX: 'center',
overlayY: 'bottom'
}
),
topCenter: new ConnectionPositionPair(
{ originX: 'center', originY: 'top' },
{ overlayX: 'center', overlayY: 'bottom' }
),
topLeft: new ConnectionPositionPair({ originX: 'start', originY: 'top' }, { overlayX: 'start', overlayY: 'bottom' }),
topLeft: new ConnectionPositionPair(
{ originX: 'start', originY: 'top' },
{
overlayX: 'start',
overlayY: 'bottom'
}
),
topRight: new ConnectionPositionPair({ originX: 'end', originY: 'top' }, { overlayX: 'end', overlayY: 'bottom' }),
right: new ConnectionPositionPair({ originX: 'end', originY: 'center' }, { overlayX: 'start', overlayY: 'center' }),
right: new ConnectionPositionPair(
{ originX: 'end', originY: 'center' },
{
overlayX: 'start',
overlayY: 'center'
}
),
rightTop: new ConnectionPositionPair({ originX: 'end', originY: 'top' }, { overlayX: 'start', overlayY: 'top' }),
rightBottom: new ConnectionPositionPair(
{ originX: 'end', originY: 'bottom' },
{ overlayX: 'start', overlayY: 'bottom' }
),
bottom: new ConnectionPositionPair({ originX: 'center', originY: 'bottom' }, { overlayX: 'center', overlayY: 'top' }),
bottom: new ConnectionPositionPair(
{ originX: 'center', originY: 'bottom' },
{
overlayX: 'center',
overlayY: 'top'
}
),
bottomCenter: new ConnectionPositionPair(
{ originX: 'center', originY: 'bottom' },
{ overlayX: 'center', overlayY: 'top' }
Expand All @@ -24,7 +48,13 @@ export const POSITION_MAP: { [key: string]: ConnectionPositionPair } = {
{ overlayX: 'start', overlayY: 'top' }
),
bottomRight: new ConnectionPositionPair({ originX: 'end', originY: 'bottom' }, { overlayX: 'end', overlayY: 'top' }),
left: new ConnectionPositionPair({ originX: 'start', originY: 'center' }, { overlayX: 'end', overlayY: 'center' }),
left: new ConnectionPositionPair(
{ originX: 'start', originY: 'center' },
{
overlayX: 'end',
overlayY: 'center'
}
),
leftTop: new ConnectionPositionPair({ originX: 'start', originY: 'top' }, { overlayX: 'end', overlayY: 'top' }),
leftBottom: new ConnectionPositionPair(
{ originX: 'start', originY: 'bottom' },
Expand All @@ -33,7 +63,12 @@ export const POSITION_MAP: { [key: string]: ConnectionPositionPair } = {
};

export const DEFAULT_TOOLTIP_POSITIONS = [POSITION_MAP.top, POSITION_MAP.right, POSITION_MAP.bottom, POSITION_MAP.left];
export const DEFAULT_DROPDOWN_POSITIONS = [POSITION_MAP.bottomLeft, POSITION_MAP.topLeft];
export const DEFAULT_DROPDOWN_POSITIONS = [
POSITION_MAP.bottomLeft,
POSITION_MAP.bottomRight,
POSITION_MAP.topLeft,
POSITION_MAP.topRight
];
export const DEFAULT_SUBMENU_POSITIONS = [POSITION_MAP.rightTop, POSITION_MAP.leftTop];
export const DEFAULT_CASCADER_POSITIONS = [
POSITION_MAP.bottomLeft,
Expand Down

0 comments on commit 031ba8f

Please sign in to comment.