|
| 1 | +# FsCalendarModule Documentation |
| 2 | + |
| 3 | +The `FsCalendarModule` provides advanced, flexible calendar components for Angular Material applications. It includes both calendar panels and table views, supporting custom data, range selection, and Material 3 theming. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- **Calendar Panels** for monthly or annual views |
| 10 | +- **Calendar Table** for tabular, multi-entry calendar data |
| 11 | +- **Range and single date selection** support |
| 12 | +- **Custom day rendering** (colors, tooltips, badges, etc.) |
| 13 | +- **Material 3 theming** and accessibility |
| 14 | +- **Highly configurable** via inputs |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## Module Import |
| 19 | + |
| 20 | +```ts |
| 21 | +import { FsCalendarModule } from '@fullstack-devops/ngx-mat-components'; |
| 22 | +``` |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Main Components & Directives |
| 27 | + |
| 28 | +- [`FsCalendarPanelsComponent`](../projects/ngx-mat-components/src/fs-calendar/calendar-panels/calendar-panels.component.ts) |
| 29 | +- [`FsCalendarTableComponent`](../projects/ngx-mat-components/src/fs-calendar/calendar-table/fs-calendar-table.component.ts) |
| 30 | +- [`FsCalendarTableNameDirective`](../projects/ngx-mat-components/src/fs-calendar/directives/fs-calendar-table-name.directive.ts) |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +## Usage Examples |
| 35 | + |
| 36 | +### Calendar Panels |
| 37 | + |
| 38 | +```html |
| 39 | +<fs-calendar-panels |
| 40 | + [dataSource]="calendarPanelsData" |
| 41 | + [year]="year" |
| 42 | + [month]="month" |
| 43 | + [monthsBefore]="monthsBefore" |
| 44 | + [monthsAfter]="monthsAfter" |
| 45 | + [placeholderDay]="placeholder" |
| 46 | + (selection)="onSelection($event)"> |
| 47 | +</fs-calendar-panels> |
| 48 | +``` |
| 49 | + |
| 50 | +### Calendar Table |
| 51 | + |
| 52 | +```html |
| 53 | +<fs-calendar-table [(month)]="month" [(year)]="year" [dataSource]="calendarTableData"> |
| 54 | + <fs-calendar-table-name>Persons</fs-calendar-table-name> |
| 55 | +</fs-calendar-table> |
| 56 | +``` |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +## Configuration |
| 61 | + |
| 62 | +### Calendar Panels Data |
| 63 | + |
| 64 | +[`CalendarPanels`](../projects/ngx-mat-components/src/fs-calendar/calendar.models.ts): |
| 65 | + |
| 66 | +```ts |
| 67 | +export interface CalendarPanels<T = void> { |
| 68 | + config: CalendarPanelsConfig; |
| 69 | + data: CalendarExtendedDay<T>[]; |
| 70 | +} |
| 71 | +``` |
| 72 | + |
| 73 | +#### Example Config |
| 74 | + |
| 75 | +[`CalendarPanelsConfig`](../projects/ngx-mat-components/src/fs-calendar/calendar.models.ts): |
| 76 | + |
| 77 | +```ts |
| 78 | +export interface CalendarPanelsConfig { |
| 79 | + renderMode: 'monthly' | 'annual'; |
| 80 | + selectMode: 'click' | 'range'; |
| 81 | + calendarWeek: boolean; |
| 82 | + displayYear?: boolean; |
| 83 | + switches?: boolean; |
| 84 | + bluredDays?: boolean; |
| 85 | + markWeekend?: boolean; |
| 86 | + firstDayOfWeekMonday?: boolean; |
| 87 | + panelWidth?: string; |
| 88 | +} |
| 89 | +``` |
| 90 | + |
| 91 | +#### Example Data |
| 92 | + |
| 93 | +[`CalendarExtendedDay`](../projects/ngx-mat-components/src/fs-calendar/calendar.models.ts): |
| 94 | + |
| 95 | +```ts |
| 96 | +export interface CalendarExtendedDay<T = void> { |
| 97 | + date: Date; |
| 98 | + char?: string; |
| 99 | + colors?: { |
| 100 | + backgroundColor: string; |
| 101 | + color?: string; |
| 102 | + }; |
| 103 | + toolTip?: string; |
| 104 | + badge?: { |
| 105 | + badgeMode: 'int' | 'icon'; |
| 106 | + badgeInt?: number; |
| 107 | + badgeIcon?: string; |
| 108 | + }; |
| 109 | + _meta?: CalendarExtendedDayMeta; |
| 110 | + customData?: T; |
| 111 | +} |
| 112 | +``` |
| 113 | + |
| 114 | +### Calendar Table Data |
| 115 | + |
| 116 | +[`CalendarTableEntry`](../projects/ngx-mat-components/src/fs-calendar/calendar.models.ts): |
| 117 | + |
| 118 | +```ts |
| 119 | +export interface CalendarTableEntry { |
| 120 | + name: string; |
| 121 | + data: CalendarExtendedDay[]; |
| 122 | +} |
| 123 | +``` |
| 124 | + |
| 125 | +--- |
| 126 | + |
| 127 | +## Selection Events |
| 128 | + |
| 129 | +- The panels emit a `(selection)` event with a [`CalendarEvent`](../projects/ngx-mat-components/src/fs-calendar/calendar.models.ts): |
| 130 | + - Range selection: `{ type: 'range', start, end, affectedDays }` |
| 131 | + - Single date: `{ type: 'click', date }` |
| 132 | + |
| 133 | +--- |
| 134 | + |
| 135 | +## Theming & Styling |
| 136 | + |
| 137 | +- The module supports Material 3 theming. |
| 138 | +- SCSS mixin: `fs-calendar-theme` ([styles/fs-calendar/_theming.scss](../projects/ngx-mat-components/styles/fs-calendar/_theming.scss)) |
| 139 | +- To use the theme in your styles: |
| 140 | + ```scss |
| 141 | + @use '@fullstack-devops/ngx-mat-components' as fsc; |
| 142 | + @include fsc.core(); |
| 143 | + ``` |
| 144 | + |
| 145 | +--- |
| 146 | + |
| 147 | +## API Reference |
| 148 | + |
| 149 | +- [`FsCalendarPanelsComponent`](../projects/ngx-mat-components/src/fs-calendar/calendar-panels/calendar-panels.component.ts) |
| 150 | +- [`FsCalendarTableComponent`](../projects/ngx-mat-components/src/fs-calendar/calendar-table/fs-calendar-table.component.ts) |
| 151 | +- [`FsCalendarTableNameDirective`](../projects/ngx-mat-components/src/fs-calendar/directives/fs-calendar-table-name.directive.ts) |
| 152 | +- [`CalendarPanels`](../projects/ngx-mat-components/src/fs-calendar/calendar.models.ts) |
| 153 | +- [`CalendarPanelsConfig`](../projects/ngx-mat-components/src/fs-calendar/calendar.models.ts) |
| 154 | +- [`CalendarExtendedDay`](../projects/ngx-mat-components/src/fs-calendar/calendar.models.ts) |
| 155 | +- [`CalendarTableEntry`](../projects/ngx-mat-components/src/fs-calendar/calendar.models.ts) |
| 156 | +- [`CalendarEvent`](../projects/ngx-mat-components/src/fs-calendar/calendar.models.ts) |
| 157 | +- [`FsCalendarService`](../projects/ngx-mat-components/src/fs-calendar/services/fs-calendar.service.ts) |
| 158 | + |
| 159 | +--- |
| 160 | + |
| 161 | +## Example Screenshots |
| 162 | + |
| 163 | + |
| 164 | + |
| 165 | + |
| 166 | +--- |
| 167 | + |
| 168 | +## See Also |
| 169 | + |
| 170 | +- [Live Demo](https://fullstack-devops.github.io/ngx-mat-components) |
| 171 | +- Workspace Examples: |
| 172 | + - [showcase-calendar-panels](https://github.com/fullstack-devops/ngx-mat-components/tree/main/projects/lib-workspace/src/app/content/showcase-calendar-panels) |
| 173 | + - [showcase-calendar-table](https://github.com/fullstack-devops/ngx-mat-components/tree/main/projects/lib-workspace/src/app/content/showcase-calendar-table) |
0 commit comments