Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Conversation

DerekLouie
Copy link
Contributor

@jelbourn @ErinCoughlan @gmoothart @KarenParker Please review.

Fixes #7383

mdselectheader1

------ 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:

mdselectheadernocss

@DerekLouie DerekLouie self-assigned this Mar 28, 2016
@DerekLouie DerekLouie added needs: review This PR is waiting on review from the team EOC labels Mar 28, 2016
@DerekLouie DerekLouie added this to the EOC - Q1 milestone Mar 28, 2016
@DerekLouie DerekLouie force-pushed the mdSelectHeaderTemplate branch 5 times, most recently from 5bfc92e to 8645a11 Compare March 28, 2016 23:46
@@ -1122,12 +1140,12 @@ function SelectProvider($$interimElementProvider) {
function watchAsyncLoad() {
if (opts.loadingAsync && !opts.isRemoved) {
scope.$$loadingAsyncDone = false;
scope.progressMode = 'indeterminate';
scope.$mdProgressMode = 'indeterminate';
Copy link
Member

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Member

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.

@DerekLouie DerekLouie force-pushed the mdSelectHeaderTemplate branch 2 times, most recently from 3c3e931 to f4e53f4 Compare March 31, 2016 18:16
@DerekLouie
Copy link
Contributor Author

Hello,

I have addressed the aforementioned comments and also taken the keydown logic out of the md-select directive code, as to make the header more generic.

Please Review.

@DerekLouie DerekLouie force-pushed the mdSelectHeaderTemplate branch from f4e53f4 to a7b517d Compare March 31, 2016 20:58
class="demo-header-searchbox _md-text">
</md-select-header>
<md-optgroup label="vegetables">
<md-option ng-value="vegetable" ng-repeat="vegetable in vegetables |

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.

Copy link
Contributor Author

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.

@ThomasBurleson
Copy link
Contributor

@topherfangio - can you review?

@DerekLouie DerekLouie force-pushed the mdSelectHeaderTemplate branch 2 times, most recently from 0d8fd14 to 773271b Compare April 5, 2016 17:46
display: flex;
align-items: center;
width: auto;
}
Copy link
Contributor

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.

Copy link
Contributor Author

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!

@topherfangio
Copy link
Contributor

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,
Copy link
Contributor

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.

@DerekLouie DerekLouie force-pushed the mdSelectHeaderTemplate branch from 773271b to a9f207c Compare April 6, 2016 01:25
@DerekLouie
Copy link
Contributor Author

Hello I have fixed all the aforementioned comments, please review.

Thank you @topherfangio for debugging the styling issue, it's all good now.

@@ -69,6 +70,18 @@ angular.module('material.components.select', [
* </md-input-container>
* </hljs>
*
* With a select-header
Copy link
Contributor

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?

@DerekLouie DerekLouie force-pushed the mdSelectHeaderTemplate branch from cbdbfbc to 35ed068 Compare April 7, 2016 18:52
@DerekLouie
Copy link
Contributor Author

Hello,

@topherfangio I have fixed the aforementioned comments, please take another look over at your earliest convenience.

@topherfangio topherfangio added pr: merge ready This PR is ready for a caretaker to review and removed needs: review This PR is waiting on review from the team labels Apr 7, 2016
@topherfangio
Copy link
Contributor

@DerekLouie Thanks so much for all the updates and putting up with the back-and-forth!

@ThomasBurleson LGTM 👍

@ThomasBurleson
Copy link
Contributor

@topherfangio - thx.

@DerekLouie DerekLouie force-pushed the mdSelectHeaderTemplate branch from 35ed068 to 8682802 Compare April 14, 2016 17:18
@DerekLouie
Copy link
Contributor Author

Hello @ThomasBurleson

I changed some css to align the search input's placeholder text and tightened up the height of the select menu.

newheaderstuff

Please merge at your earliest convenience!

Best,

Derek

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr: merge ready This PR is ready for a caretaker to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants