|
1 | 1 | import { html, nothing } from 'lit'; |
2 | 2 | import { property, query, state } from 'lit/decorators.js'; |
3 | 3 |
|
| 4 | +import { ifDefined } from 'lit/directives/if-defined.js'; |
4 | 5 | import { themes } from '../../../theming/theming-decorator.js'; |
5 | 6 | import { addKeybindings } from '../../common/controllers/key-bindings.js'; |
6 | 7 | import { blazorIndirectRender } from '../../common/decorators/blazorIndirectRender.js'; |
@@ -398,10 +399,11 @@ export default class IgcDaysViewComponent extends EventEmitterMixin< |
398 | 399 | }; |
399 | 400 | } |
400 | 401 |
|
401 | | - protected renderDay(day: CalendarDay, props: any) { |
| 402 | + protected renderDay(day: CalendarDay, today: CalendarDay) { |
402 | 403 | const ariaLabel = this.intlFormatDay(day); |
403 | 404 | const { changePreview, clearPreview } = this.getDayHandlers(day); |
404 | 405 |
|
| 406 | + const props = this.getDayProperties(day, today); |
405 | 407 | const parts = partNameMap(props); |
406 | 408 |
|
407 | 409 | return html` |
@@ -480,17 +482,18 @@ export default class IgcDaysViewComponent extends EventEmitterMixin< |
480 | 482 | const last = weeks.length - 1; |
481 | 483 |
|
482 | 484 | for (const [idx, week] of weeks.entries()) { |
483 | | - const weekDaysProps: any[] = []; |
484 | | - for (const day of week) { |
485 | | - weekDaysProps.push(this.getDayProperties(day, today)); |
| 485 | + let hidden: boolean | undefined; |
| 486 | + if (idx === 0 || idx === last) { |
| 487 | + hidden = |
| 488 | + week.every((day) => this.getDayProperties(day, today).hidden) || |
| 489 | + undefined; |
486 | 490 | } |
487 | | - const hidden = weekDaysProps.every((p) => p.hidden); |
488 | 491 | yield html` |
489 | | - <div role="row" part="days-row" aria-hidden=${hidden}> |
| 492 | + <div role="row" part="days-row" aria-hidden=${ifDefined(hidden)}> |
490 | 493 | ${this.showWeekNumbers |
491 | 494 | ? this.renderWeekNumber(week[0], idx === last) |
492 | 495 | : nothing} |
493 | | - ${week.map((day, i) => this.renderDay(day, weekDaysProps[i]))} |
| 496 | + ${week.map((day) => this.renderDay(day, today))} |
494 | 497 | </div> |
495 | 498 | `; |
496 | 499 | } |
|
0 commit comments