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

Can I disable the badgeTotal from month cell component #1507

Open
vsd-codesode opened this issue Sep 23, 2021 · 7 comments
Open

Can I disable the badgeTotal from month cell component #1507

vsd-codesode opened this issue Sep 23, 2021 · 7 comments
Labels
demoable Possible with the current API, can be shown with a demo

Comments

@vsd-codesode
Copy link

Is your feature request related to a problem? Please describe

Is there any way to disable the badgeTotal in the view.

If you suggest the custom template; Please give some example it.

I am trying to copy this component and remove this whole section from it
<span class="cal-day-badge" *ngIf="day.badgeTotal > 0">{{ day.badgeTotal }}</span>

Is there any better approach for it?

Describe the solution you'd like

Instead of adding checking day.badgeTotal > 0; there can be a flag(Lets call it showBadgeTotal) that will control the visibility of the span in question.

Describe your use case for implementing this feature

When the calendar is shown to a small screen, this badgeTotal view feels cramped into the UI.

Additional context

@matts-bot
Copy link

matts-bot bot commented Sep 23, 2021

Thanks so much for opening an issue! If you'd like me to give priority to answering your issue or would just like to support this project, then please consider sponsoring me

@JaxonWright
Copy link
Collaborator

On your mwl-calendar-month-view, add a directive for the cell template ([cellTemplate]="customCellTemplate") and then define the template lower down in your template file.

That can be done like this:

<ng-template #customCellTemplate let-day="day">
  <!-- Fill in with whatever you want from the section you were looking at or your own custom stuff -->
</ng-template>

@vsd-codesode
Copy link
Author

Yes, I did the same. Thanks.

Will you be accepting PR for the change I have proposed?

@JaxonWright
Copy link
Collaborator

That makes sense to me, but that is up to @mattlewis92

@mattlewis92
Copy link
Owner

That makes sense to me, but that is up to @mattlewis92

I think rather than adding a new input and bloating the api, it makes more sense just to use CSS to hide things like this. All you need to do is add this to your apps global CSS to hide the badge:

.cal-day-badge {
  display: none;
}

@vsd-codesode
Copy link
Author

vsd-codesode commented Oct 4, 2021

That makes sense to me, but that is up to @mattlewis92

I think rather than adding a new input and bloating the api, it makes more sense just to use CSS to hide things like this. All you need to do is add this to your apps global CSS to hide the badge:

.cal-day-badge {
  display: none;
}

Actually, It should be like below, This CSS class is not working without !important flag.

.cal-day-badge {
  display: none !important;
}

Although, this css add will accept what is expected, but in my view it is pretty obscure way to achieve this. Adding new @input with a default value could be a better approach from usability point of view.

@mattlewis92
Copy link
Owner

Although, this css add will accept what is expected, but in my view it is pretty obscure way to achieve this. Adding new @input with a default value could be a better approach from usability point of view.

I agree that it's not the most intuitive api, but once you start adding api options for all the things that you can do with just CSS, then you end up with a bloated api with dozens of options that's both difficult from a maintainers point of view, as well as a consumer (as you have to read through the docs for a huge amount of inputs and outputs). Instead I opted for providing demos that show you how you can implement common uses cases with just CSS instead, I'd be open for adding one for showing how to hide the badge with CSS.

@mattlewis92 mattlewis92 added the demoable Possible with the current API, can be shown with a demo label Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
demoable Possible with the current API, can be shown with a demo
Projects
None yet
Development

No branches or pull requests

3 participants