-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
feat(placeholder): add global placeholder options #4681
feat(placeholder): add global placeholder options #4681
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
CLAs look good, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool idea, I like it :)
import { OpaqueToken } from '@angular/core'; | ||
|
||
/** OpaqueToken that can be used to specify the global placeholder options. */ | ||
export const MD_PLACEHOLDER_GLOBAL_OPTIONS = new OpaqueToken('md-placeholder-global-options'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpaqueToken
is deprecated now, you can use InjectionToken
instead
/** Type for the available floatPlaceholder values. */ | ||
export type FloatPlaceholderType = 'always' | 'never' | 'auto'; | ||
|
||
export interface PlaceholderGlobalOptions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just PlaceholderOptions
is fine
src/lib/select/select.ts
Outdated
import { | ||
FloatPlaceholderType, | ||
PlaceholderGlobalOptions, | ||
MD_PLACEHOLDER_GLOBAL_OPTIONS } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: formatting
@mmalerba Thanks, the idea was inspired by the global ripple options. Revisions made based on your suggestions. |
@@ -0,0 +1,11 @@ | |||
import { InjectionToken } from '@angular/core'; | |||
|
|||
/** OpaqueToken that can be used to specify the global placeholder options. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment still says OpaqueToken
import { InjectionToken } from '@angular/core'; | ||
|
||
/** OpaqueToken that can be used to specify the global placeholder options. */ | ||
export const MD_PLACEHOLDER_GLOBAL_OPTIONS = new InjectionToken('md-placeholder-global-options'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InjectionToken<PlaceholderOptions>
src/lib/input/input-container.ts
Outdated
@Optional() private _parentFormGroup: FormGroupDirective) { } | ||
@Optional() private _parentFormGroup: FormGroupDirective, | ||
@Optional() @Inject(MD_PLACEHOLDER_GLOBAL_OPTIONS) | ||
placeholderGlobalOptions: PlaceholderOptions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make the variable placeholderOptions
then this can all fit on one line
src/lib/select/select.ts
Outdated
@Attribute('tabindex') tabIndex: string) { | ||
@Attribute('tabindex') tabIndex: string, | ||
@Optional() @Inject(MD_PLACEHOLDER_GLOBAL_OPTIONS) | ||
placeholderGlobalOptions: PlaceholderOptions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, change the var name and format like input constructor so it can fit on one line
@mmalerba Revisions made, thanks. |
Needs rebase |
* Implement global placeholder options so the default float option can be set to something other than 'auto' Fixes #4311
@andrewseguin Rebased, thanks... |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
default float option can be set to something
other than 'auto'
Fixes #4311