Skip to content
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

Provide a better context to know which elements is which #1754

Open
jsgoupil opened this issue Oct 4, 2020 · 1 comment
Open

Provide a better context to know which elements is which #1754

jsgoupil opened this issue Oct 4, 2020 · 1 comment

Comments

@jsgoupil
Copy link

jsgoupil commented Oct 4, 2020

Is your feature request related to a problem? Please describe.
I spent 2 hours to try to find the best way to catch the last item of a filtered list with CSS when [addTag] is present.
If you see the image here:
image

The top section is a ng-option which is the group. Then followed by 4 filtered ng-option. Then followed in blue by a custom ng-tag-tmp.

I needed to set special border-radius on the last red ng-option. This is simple with a :last-child when [addTag] is false or not present, however, when the tag is present, I could not easily catch that last ng-option-child.

Describe the solution you'd like
The simplest thing would be to add a ng-option-add-tag-present on the ng-select tag. I have written my own

<ng-select #ngSelect [class.is-showing-add-tag]="ngSelect.showAddTag">
...

With this functionality, I have to have the SCSS like this. Which is still not the most elegant but better than nothing.

ng-select.is-showing-add-tag ::ng-deep {
    .ng-dropdown-panel .ng-dropdown-panel-items .ng-option {
        &:nth-last-child(2) {
             ...

Or add a better context to the ng-option-tmp. You provide the index but I don't have the filtered array. So there is no way for me to tag my HTML with a last-child class.

@jsgoupil
Copy link
Author

jsgoupil commented Oct 5, 2020

After further work on this, if I have more than 1 group showing, I can't get the last of the ng-option for that particular group only with CSS. I would need to get more context alongside the index.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants