From 49d0c981804bbe0b109549142a0ba68db960fc2c Mon Sep 17 00:00:00 2001 From: Kara Date: Fri, 2 Dec 2016 13:34:33 -0800 Subject: [PATCH] feat(select): align selected option over trigger (#2026) Closes #1669 --- src/demo-app/select/select-demo.html | 2 + src/demo-app/select/select-demo.ts | 10 +- src/lib/select/select-animations.ts | 19 +- src/lib/select/select.html | 4 +- src/lib/select/select.scss | 4 +- src/lib/select/select.spec.ts | 316 ++++++++++++++++++++++----- src/lib/select/select.ts | 259 ++++++++++++++++++++-- 7 files changed, 522 insertions(+), 92 deletions(-) diff --git a/src/demo-app/select/select-demo.html b/src/demo-app/select/select-demo.html index 467c15ce3658..9e5c8dc3e122 100644 --- a/src/demo-app/select/select-demo.html +++ b/src/demo-app/select/select-demo.html @@ -1,3 +1,4 @@ +
This div is for testing scrolled selects.
@@ -28,3 +29,4 @@
+
This div is for testing scrolled selects.
diff --git a/src/demo-app/select/select-demo.ts b/src/demo-app/select/select-demo.ts index 7bd1c6cda590..29c4f5eeb863 100644 --- a/src/demo-app/select/select-demo.ts +++ b/src/demo-app/select/select-demo.ts @@ -21,8 +21,14 @@ export class SelectDemo { drinks = [ {value: 'coke-0', viewValue: 'Coke'}, - {value: 'sprite-1', viewValue: 'Sprite', disabled: true}, - {value: 'water-2', viewValue: 'Water'} + {value: 'sprite-1', viewValue: 'Sprite'}, + {value: 'water-2', viewValue: 'Water'}, + {value: 'pepper-3', viewValue: 'Dr. Pepper'}, + {value: 'coffee-4', viewValue: 'Coffee'}, + {value: 'tea-5', viewValue: 'Tea'}, + {value: 'juice-6', viewValue: 'Orange juice'}, + {value: 'wine-7', viewValue: 'Wine'}, + {value: 'milk-8', viewValue: 'Milk'}, ]; toggleDisabled() { diff --git a/src/lib/select/select-animations.ts b/src/lib/select/select-animations.ts index 238341138c39..677633853868 100644 --- a/src/lib/select/select-animations.ts +++ b/src/lib/select/select-animations.ts @@ -42,25 +42,10 @@ export const transformPlaceholder: AnimationEntryMetadata = trigger('transformPl * When the panel is removed from the DOM, it simply fades out linearly. */ export const transformPanel: AnimationEntryMetadata = trigger('transformPanel', [ - state('top-ltr', style({ + state('showing', style({ opacity: 1, width: 'calc(100% + 32px)', - transform: `translate3d(-16px, -9px, 0) scaleY(1)` - })), - state('top-rtl', style({ - opacity: 1, - width: 'calc(100% + 32px)', - transform: `translate3d(16px, -9px, 0) scaleY(1)` - })), - state('bottom-ltr', style({ - opacity: 1, - width: 'calc(100% + 32px)', - transform: `translate3d(-16px, 8px, 0) scaleY(1)` - })), - state('bottom-rtl', style({ - opacity: 1, - width: 'calc(100% + 32px)', - transform: `translate3d(16px, 8px, 0) scaleY(1)` + transform: `translate3d(0,0,0) scaleY(1)` })), transition('void => *', [ style({ diff --git a/src/lib/select/select.html b/src/lib/select/select.html index f95dc6b1c6e8..0de3f7ae2162 100644 --- a/src/lib/select/select.html +++ b/src/lib/select/select.html @@ -6,8 +6,8 @@