-
Notifications
You must be signed in to change notification settings - Fork 3.4k
feat(select): Adding md-select-header directive to md-select. #7782
Conversation
5bfc92e
to
8645a11
Compare
@@ -1122,12 +1140,12 @@ function SelectProvider($$interimElementProvider) { | |||
function watchAsyncLoad() { | |||
if (opts.loadingAsync && !opts.isRemoved) { | |||
scope.$$loadingAsyncDone = false; | |||
scope.progressMode = 'indeterminate'; | |||
scope.$mdProgressMode = 'indeterminate'; |
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.
Why are you prefixing that with $md
?
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.
In the SelectMenuDirective
I changed the scope from true
to false
. Adding the $md
insures the variable does not get clobbered by angular I believe? @jelbourn for clarification?
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.
It's to make sure that we don't overwrite anything within the user scope (because we are now using the same one). $md-
variables should not be used in anyone apps.
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.
👍 Yes, I agree. Good point.
3c3e931
to
f4e53f4
Compare
Hello, I have addressed the aforementioned comments and also taken the keydown logic out of the Please Review. |
f4e53f4
to
a7b517d
Compare
class="demo-header-searchbox _md-text"> | ||
</md-select-header> | ||
<md-optgroup label="vegetables"> | ||
<md-option ng-value="vegetable" ng-repeat="vegetable in vegetables | |
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.
If I want to perform the search on the server side rather than in memory, then I just do:
ng-repeat="item in getMatches(searchTerm)"
similar to https://material.angularjs.org/latest/demo/autocomplete ?
An example with an xhr, or fake xhr might be nice in the docs.
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.
Hello Eric,
Solid point, I am actually working on #7385 which will mimic the autocomplete
directive more closely and will also replace this code.
My intention for this demo was really just to give an example of how the md-select-header
could be used. I hope it, in no way, serves as an example of what a dedicated search bar component would look like (but that is coming soon 👍 ).
This demo will change after the search component PR is finished.
@topherfangio - can you review? |
0d8fd14
to
773271b
Compare
display: flex; | ||
align-items: center; | ||
width: auto; | ||
} |
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.
@DerekLouie The reason this CSS is not applied is because we prepend the .selectdemoBasicUsage
class to the front of every selector so that it is "scoped" to only this demo.
The problem with this approach is that the menu container which houses the header is actually appended to the body, which is outside of our scoped demo. As far as I know, there is not currently a way to achieve what you want without moving your CSS somewhere more global like the site's app.css
which I would recommend against.
If you want to do this, perhaps we can update the build system to recognize a global-styles.css
file in the demos and append that to the generated styles.css
without the demo scoping. We would just have to be very careful to always add some manual CSS classes (like you've done above) to ensure we don't affect other parts of the app.
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.
Hmmm, the build system change sounds great, but a lot of work for the material team so for the sake of everyone, let's table that.
I discovered that I can use a data-
attribute to add a class to the menu-container
element. So I think I'll just go that route. Good call adding that hook!
If you're adding a new directive, I think we should document it's use. Since it is so simple, it probably does not warrant it's own directive docs, but if you could add something to the Select's docs, I think it would help. Other than that and my two comments, it looks good to me 👍 |
return { | ||
restrict: 'E', | ||
require: ['mdSelectMenu'], | ||
scope: true, | ||
scope: false, |
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 lied...one more thought 😳
Can you add a quick comment about why this is being changed? If I recall from the Slack conversation, we don't expect it to affect anyone, but it would be good to have a comment in case another dev comes back later and wants to swap it back to true
to fix something else.
773271b
to
a9f207c
Compare
Hello I have fixed all the aforementioned comments, please review. Thank you @topherfangio for debugging the styling issue, it's all good now. |
a9f207c
to
cbdbfbc
Compare
@@ -69,6 +70,18 @@ angular.module('material.components.select', [ | |||
* </md-input-container> | |||
* </hljs> | |||
* | |||
* With a select-header |
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.
Can you add a small paragraph here describing potential use-cases and what happens to the original label?
cbdbfbc
to
35ed068
Compare
Hello, @topherfangio I have fixed the aforementioned comments, please take another look over at your earliest convenience. |
@DerekLouie Thanks so much for all the updates and putting up with the back-and-forth! @ThomasBurleson LGTM 👍 |
@topherfangio - thx. |
35ed068
to
8682802
Compare
Hello @ThomasBurleson I changed some css to align the search input's placeholder text and tightened up the height of the select menu. Please merge at your earliest convenience! Best, Derek |
@jelbourn @ErinCoughlan @gmoothart @KarenParker Please review.
Fixes #7383
------ NO LONGER AN ISSUE: KEPT FOR POSTERITY ------
Currently facing an issue where the style.css in the demoSelectHeader folder is not getting compiled into the demo site and subsequently not being applied. Screenshot above only work because I put the css in select.scss to get it to look correct..
This is what it looks like currently without any of the demo css: