UNPKG

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