UNPKG

3.24 kBTypeScriptView Raw
1import { I18nPluralPipe } from '@angular/common';
2import { A11yParams } from './calendar-a11y.interface';
3/**
4 * This class is responsible for adding accessibility to the calendar.
5 * You may override any of its methods via angulars DI to suit your requirements.
6 * For example:
7 *
8 * ```typescript
9 * import { A11yParams, CalendarA11y } from 'angular-calendar';
10 * import { formatDate, I18nPluralPipe } from '@angular/common';
11 * import { Injectable } from '@angular/core';
12 *
13 * // adding your own a11y params
14 * export interface CustomA11yParams extends A11yParams {
15 * isDrSuess?: boolean;
16 * }
17 *
18 * @Injectable()
19 * export class CustomCalendarA11y extends CalendarA11y {
20 * constructor(protected i18nPlural: I18nPluralPipe) {
21 * super(i18nPlural);
22 * }
23 *
24 * // overriding a function
25 * public openDayEventsLandmark({ date, locale, isDrSuess }: CustomA11yParams): string {
26 * if (isDrSuess) {
27 * return `
28 * ${formatDate(date, 'EEEE MMMM d', locale)}
29 * Today you are you! That is truer than true! There is no one alive
30 * who is you-er than you!
31 * `;
32 * }
33 * }
34 * }
35 *
36 * // in your component that uses the calendar
37 * providers: [{
38 * provide: CalendarA11y,
39 * useClass: CustomCalendarA11y
40 * }]
41 * ```
42 */
43export declare class CalendarA11y {
44 protected i18nPlural: I18nPluralPipe;
45 constructor(i18nPlural: I18nPluralPipe);
46 /**
47 * Aria label for the badges/date of a cell
48 * @example: `Saturday October 19 1 event click to expand`
49 */
50 monthCell({ day, locale }: A11yParams): string;
51 /**
52 * Aria label for the open day events start landmark
53 * @example: `Saturday October 19 expanded view`
54 */
55 openDayEventsLandmark({ date, locale }: A11yParams): string;
56 /**
57 * Aria label for alert that a day in the month view was expanded
58 * @example: `Saturday October 19 expanded`
59 */
60 openDayEventsAlert({ date, locale }: A11yParams): string;
61 /**
62 * Descriptive aria label for an event
63 * @example: `Saturday October 19th, Scott's Pizza Party, from 11:00am to 5:00pm`
64 */
65 eventDescription({ event, locale }: A11yParams): string;
66 /**
67 * Descriptive aria label for an all day event
68 * @example:
69 * `Scott's Party, event spans multiple days: start time October 19 5:00pm, no stop time`
70 */
71 allDayEventDescription({ event, locale }: A11yParams): string;
72 /**
73 * Aria label for the calendar event actions icons
74 * @returns 'Edit' for fa-pencil icons, and 'Delete' for fa-times icons
75 */
76 actionButtonLabel({ action }: A11yParams): string;
77 /**
78 * @returns {number} Tab index to be given to month cells
79 */
80 monthCellTabIndex(): number;
81 /**
82 * @returns true if the events inside the month cell should be aria-hidden
83 */
84 hideMonthCellEvents(): boolean;
85 /**
86 * @returns true if event titles should be aria-hidden (global)
87 */
88 hideEventTitle(): boolean;
89 /**
90 * @returns true if hour segments in the week view should be aria-hidden
91 */
92 hideWeekHourSegment(): boolean;
93 /**
94 * @returns true if hour segments in the day view should be aria-hidden
95 */
96 hideDayHourSegment(): boolean;
97}