Skip to content

feat(select): basic selection and animations #1647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 1, 2016
Merged

Conversation

kara
Copy link
Contributor

@kara kara commented Oct 29, 2016

This is the first PR of several to get the select component up and running. It only adds basic selection and animations. More coming.

r: @jelbourn

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 29, 2016
@kara kara force-pushed the select-pr branch 5 times, most recently from e145dc3 to e3c0af6 Compare October 29, 2016 03:34
'role': 'option',
'[class.md-selected]': 'selected',
'[attr.aria-selected]': 'selected.toString()',
'[attr.tabindex]': '0',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you set tabIndex without it being a binding?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I'll need to bind it again as soon as I add disabled support (in the next PR probably)

}

/**
* The displayed value of the option.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd expand this comment to mention something like
"Used to show the selected value in the select's trigger.

}

/** Unselects the option. */
unselect() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deselect

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I knew it sounded wrong!

'[attr.aria-selected]': 'selected.toString()',
'[attr.tabindex]': '0',
'(click)': 'select()',
'(keydown)': '_selectOnActivate($event)'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just _handleKeydown? (ince this is specially handling keyboard input)

trigger,
} from '@angular/core';

export class SelectAnimations {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add class/method descriptions. Include a high-level explanation of what the animations do. Also mention where the values come from (lots of magic values in here).

* TODO: internal
*/
_getPanelState(): string {
return this._isRtl() ? 'in-rtl' : 'in';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in-rtl and in?

Copy link
Contributor Author

@kara kara Oct 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe in-rtl and in-ltr? or showing-rtl and showing-ltr?


/**
* Ensures the option is selected when activated from the keyboard.
* TODO: internal
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's stop adding new instances of TODO: internal. At this point we're mostly settled into the convention of underscore without private as meaning internal.
(we can remove the old ones in a cleanup pass)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, that's fair. Will do.

Renderer,
ViewEncapsulation
} from '@angular/core';
import {ENTER, SPACE} from '../core/keyboard/keycodes';

@Component({
moduleId: module.id,
selector: 'md-option',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add md-option to style-compatibility.ts

template: `
<ng-content></ng-content>
<div class="md-option-ripple" md-ripple md-ripple-background-color="rgba(0,0,0,0)"
[md-ripple-trigger]="_getHostElement()"></div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is long enough for its own file.

return this.trigger.nativeElement.getBoundingClientRect().width;
}

/** The animation state of the placeholder.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit tests for animation states?

@kara kara added the in progress This issue is currently in progress label Oct 30, 2016
@kara kara removed the in progress This issue is currently in progress label Oct 30, 2016
@kara
Copy link
Contributor Author

kara commented Oct 30, 2016

@jelbourn Comments should be addressed

@kara kara added the action: merge The PR is ready for merge by the caretaker label Oct 31, 2016
@hansl hansl removed pr: lgtm action: merge The PR is ready for merge by the caretaker labels Nov 1, 2016
@hansl
Copy link
Contributor

hansl commented Nov 1, 2016

@kara: This broke a bunch of targets in Google with the following error:

Error: Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol MdSelect in third_party/javascript/angular2_material/src/lib/select/select.ts, resolving symbol MdSelect in third_party/javascript/angular2_material/src/lib/select/select.ts
    at simplifyInContext (@angular/compiler-cli/src/static_reflector.es5.js:465:23)
    at StaticReflector.simplify (@angular/compiler-cli/src/static_reflector.es5.js:468:22)
    at StaticReflector.annotations (@angular/compiler-cli/src/static_reflector.es5.js:55:36)
    at NgModuleResolver.resolve (@angular/compiler/src/ng_module_resolver.es5.js:25:44)
    at CompileMetadataResolver.getNgModuleMetadata (@angular/compiler/src/metadata_resolver.es5.js:193:47)
    at @angular/compiler/src/offline_compiler.es5.js:274:41
    at Array.forEach (native)
    at _extractModulesAndPipesOrDirectives (@angular/compiler/src/offline_compiler.es5.js:273:26)
    at analyzeNgModules (@angular/compiler/src/offline_compiler.es5.js:27:14)
    at OfflineCompiler.compileModules (@angular/compiler/src/offline_compiler.es5.js:104:18)

@kara
Copy link
Contributor Author

kara commented Nov 1, 2016

@hansl Should be fixed

@kara kara added the pr: lgtm label Nov 1, 2016
@hansl hansl added the action: merge The PR is ready for merge by the caretaker label Nov 1, 2016
@hansl hansl merged commit b14bb72 into angular:master Nov 1, 2016
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants