angular-calendar
Version:
A calendar component for angular 15.0+ that can display events on a month, week or day view
101 lines (100 loc) • 3.4 kB
TypeScript
import { I18nPluralPipe } from '@angular/common';
import { A11yParams } from './calendar-a11y.interface';
import * as i0 from "@angular/core";
/**
* This class is responsible for adding accessibility to the calendar.
* You may override any of its methods via angulars DI to suit your requirements.
* For example:
*
* ```typescript
* import { A11yParams, CalendarA11y } from 'angular-calendar';
* import { formatDate, I18nPluralPipe } from '@angular/common';
* import { Injectable } from '@angular/core';
*
* // adding your own a11y params
* export interface CustomA11yParams extends A11yParams {
* isDrSuess?: boolean;
* }
*
* @Injectable()
* export class CustomCalendarA11y extends CalendarA11y {
* constructor(protected i18nPlural: I18nPluralPipe) {
* super(i18nPlural);
* }
*
* // overriding a function
* public openDayEventsLandmark({ date, locale, isDrSuess }: CustomA11yParams): string {
* if (isDrSuess) {
* return `
* ${formatDate(date, 'EEEE MMMM d', locale)}
* Today you are you! That is truer than true! There is no one alive
* who is you-er than you!
* `;
* }
* }
* }
*
* // in your component that uses the calendar
* providers: [{
* provide: CalendarA11y,
* useClass: CustomCalendarA11y
* }]
* ```
*/
export declare class CalendarA11y {
protected i18nPlural: I18nPluralPipe;
constructor(i18nPlural: I18nPluralPipe);
/**
* Aria label for the badges/date of a cell
* @example: `Saturday October 19 1 event click to expand`
*/
monthCell({ day, locale }: A11yParams): string;
/**
* Aria label for the open day events start landmark
* @example: `Saturday October 19 expanded view`
*/
openDayEventsLandmark({ date, locale }: A11yParams): string;
/**
* Aria label for alert that a day in the month view was expanded
* @example: `Saturday October 19 expanded`
*/
openDayEventsAlert({ date, locale }: A11yParams): string;
/**
* Descriptive aria label for an event
* @example: `Saturday October 19th, Scott's Pizza Party, from 11:00am to 5:00pm`
*/
eventDescription({ event, locale }: A11yParams): string;
/**
* Descriptive aria label for an all day event
* @example:
* `Scott's Party, event spans multiple days: start time October 19 5:00pm, no stop time`
*/
allDayEventDescription({ event, locale }: A11yParams): string;
/**
* Aria label for the calendar event actions icons
* @returns 'Edit' for fa-pencil icons, and 'Delete' for fa-times icons
*/
actionButtonLabel({ action }: A11yParams): string;
/**
* @returns {number} Tab index to be given to month cells
*/
monthCellTabIndex(): number;
/**
* @returns true if the events inside the month cell should be aria-hidden
*/
hideMonthCellEvents(): boolean;
/**
* @returns true if event titles should be aria-hidden (global)
*/
hideEventTitle(): boolean;
/**
* @returns true if hour segments in the week view should be aria-hidden
*/
hideWeekHourSegment(): boolean;
/**
* @returns true if hour segments in the day view should be aria-hidden
*/
hideDayHourSegment(): boolean;
static ɵfac: i0.ɵɵFactoryDeclaration<CalendarA11y, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<CalendarA11y>;
}