1 | /**
|
2 | * @license
|
3 | * Copyright Akveo. All Rights Reserved.
|
4 | * Licensed under the MIT License. See License.txt in the project root for license information.
|
5 | */
|
6 | import { EventEmitter, Type } from '@angular/core';
|
7 | import { NbCalendarCell, NbCalendarSize, NbCalendarViewMode, NbCalendarSizeValues, NbCalendarViewModeValues } from '../calendar-kit/model';
|
8 | import { NbBooleanInput } from '../helpers';
|
9 | import * as i0 from "@angular/core";
|
10 | /**
|
11 | * Calendar component provides a capability to choose a date.
|
12 | *
|
13 | * ```html
|
14 | * <nb-calendar [(date)]="date"></nb-calendar>
|
15 | * <nb-calendar [date]="date" (dateChange)="handleDateChange($event)"></nb-calendar>
|
16 | * ```
|
17 | *
|
18 | * Basic usage example
|
19 | * @stacked-example(Showcase, calendar/calendar-showcase.component)
|
20 | *
|
21 | * ### Installation
|
22 | *
|
23 | * Import `NbCalendarModule` to your feature module.
|
24 | * ```ts
|
25 | * @NgModule({
|
26 | * imports: [
|
27 | * // ...
|
28 | * NbCalendarModule,
|
29 | * ],
|
30 | * })
|
31 | * export class PageModule { }
|
32 | * ```
|
33 | * ### Usage
|
34 | *
|
35 | * If you want to select ranges you can use `NbCalendarRangeComponent`.
|
36 | *
|
37 | * ```html
|
38 | * <nb-calendar-range [(range)]="range"></nb-calendar-range>
|
39 | * <nb-calendar-range [range]="range" (rangeChange)="handleRangeChange($event)"></nb-calendar-range>
|
40 | * ```
|
41 | *
|
42 | * In order to use it, you have to import `NbCalendarRangeModule`.
|
43 | * @stacked-example(Range, calendar/calendar-range-showcase.component)
|
44 | *
|
45 | * The calendar component is supplied with a calendar navigation that contains navigate buttons.
|
46 | * If you do not want to use it you can hide calendar navigation using `showNavigation` property.
|
47 | * @stacked-example(Without navigation, calendar/calendar-without-navigation.component)
|
48 | *
|
49 | * As you can see in the basic usage example calendar contains previous and next month days
|
50 | * which can be disabled using `boundingMonth` property.
|
51 | * @stacked-example(Bounding months, calendar/calendar-bounding-month.component)
|
52 | *
|
53 | * You can define starting view of the calendar by setting `startView` property.
|
54 | * Available values: year, month and date.
|
55 | * @stacked-example(Start view, calendar/calendar-start-view.component)
|
56 | *
|
57 | * You can use a larger version of the calendar by defining size property.
|
58 | * Available values: medium(which is default) and large.
|
59 | * @stacked-example(Size, calendar/calendar-size.component)
|
60 | *
|
61 | * Calendar supports min and max dates which disables values out of min-max range.
|
62 | * @stacked-example(Borders, calendar/calendar-min-max.component)
|
63 | *
|
64 | * Also, you can define custom filter property that should be predicate which receives
|
65 | * date and returns false if this date has to be disabled. In this example, we provide the filter
|
66 | * which disables weekdays.
|
67 | * @stacked-example(Filter, calendar/calendar-filter.component)
|
68 | *
|
69 | * Week numbers column could be enabled via `showWeekNumber` binding:
|
70 | * @stacked-example(Week number, calendar/calendar-week-number.component)
|
71 | *
|
72 | * If you need create custom cells you can easily provide custom components for
|
73 | * calendar. For examples if you want to show any average price under each date you can
|
74 | * just provide custom `dayCellComponent`. Custom cells for month and year can be provided
|
75 | * the same way, check API reference.
|
76 | * @stacked-example(Custom day cell, calendar/calendar-custom-day-cell-showcase.component)
|
77 | *
|
78 | * @styles
|
79 | *
|
80 | * calendar-width:
|
81 | * calendar-background-color:
|
82 | * calendar-border-color:
|
83 | * calendar-border-style:
|
84 | * calendar-border-width:
|
85 | * calendar-border-radius:
|
86 | * calendar-text-color:
|
87 | * calendar-text-font-family:
|
88 | * calendar-text-font-size:
|
89 | * calendar-text-font-weight:
|
90 | * calendar-text-line-height:
|
91 | * calendar-picker-padding-top:
|
92 | * calendar-picker-padding-bottom:
|
93 | * calendar-picker-padding-start:
|
94 | * calendar-picker-padding-end:
|
95 | * calendar-navigation-text-color:
|
96 | * calendar-navigation-text-font-family:
|
97 | * calendar-navigation-title-text-font-size:
|
98 | * calendar-navigation-title-text-font-weight:
|
99 | * calendar-navigation-title-text-line-height:
|
100 | * calendar-navigation-padding:
|
101 | * calendar-cell-inactive-text-color:
|
102 | * calendar-cell-disabled-text-color:
|
103 | * calendar-cell-hover-background-color:
|
104 | * calendar-cell-hover-border-color:
|
105 | * calendar-cell-hover-text-color:
|
106 | * calendar-cell-hover-text-font-size:
|
107 | * calendar-cell-hover-text-font-weight:
|
108 | * calendar-cell-hover-text-line-height:
|
109 | * calendar-cell-active-background-color:
|
110 | * calendar-cell-active-border-color:
|
111 | * calendar-cell-active-text-color:
|
112 | * calendar-cell-active-text-font-size:
|
113 | * calendar-cell-active-text-font-weight:
|
114 | * calendar-cell-active-text-line-height:
|
115 | * calendar-cell-today-background-color:
|
116 | * calendar-cell-today-border-color:
|
117 | * calendar-cell-today-text-color:
|
118 | * calendar-cell-today-text-font-size:
|
119 | * calendar-cell-today-text-font-weight:
|
120 | * calendar-cell-today-text-line-height:
|
121 | * calendar-cell-today-hover-background-color:
|
122 | * calendar-cell-today-hover-border-color:
|
123 | * calendar-cell-today-active-background-color:
|
124 | * calendar-cell-today-active-border-color:
|
125 | * calendar-cell-today-disabled-border-color:
|
126 | * calendar-cell-today-selected-background-color:
|
127 | * calendar-cell-today-selected-border-color:
|
128 | * calendar-cell-today-selected-text-color:
|
129 | * calendar-cell-today-selected-hover-background-color:
|
130 | * calendar-cell-today-selected-hover-border-color:
|
131 | * calendar-cell-today-selected-active-background-color:
|
132 | * calendar-cell-today-selected-active-border-color:
|
133 | * calendar-cell-today-in-range-background-color:
|
134 | * calendar-cell-today-in-range-border-color:
|
135 | * calendar-cell-today-in-range-text-color:
|
136 | * calendar-cell-today-in-range-hover-background-color:
|
137 | * calendar-cell-today-in-range-hover-border-color:
|
138 | * calendar-cell-today-in-range-active-background-color:
|
139 | * calendar-cell-today-in-range-active-border-color:
|
140 | * calendar-cell-selected-background-color:
|
141 | * calendar-cell-selected-border-color:
|
142 | * calendar-cell-selected-text-color:
|
143 | * calendar-cell-selected-text-font-size:
|
144 | * calendar-cell-selected-text-font-weight:
|
145 | * calendar-cell-selected-text-line-height:
|
146 | * calendar-cell-selected-hover-background-color:
|
147 | * calendar-cell-selected-hover-border-color:
|
148 | * calendar-cell-selected-active-background-color:
|
149 | * calendar-cell-selected-active-border-color:
|
150 | * calendar-day-cell-width:
|
151 | * calendar-day-cell-height:
|
152 | * calendar-month-cell-width:
|
153 | * calendar-month-cell-height:
|
154 | * calendar-year-cell-width:
|
155 | * calendar-year-cell-height:
|
156 | * calendar-weekday-background:
|
157 | * calendar-weekday-divider-color:
|
158 | * calendar-weekday-divider-width:
|
159 | * calendar-weekday-text-color:
|
160 | * calendar-weekday-text-font-size:
|
161 | * calendar-weekday-text-font-weight:
|
162 | * calendar-weekday-text-line-height:
|
163 | * calendar-weekday-holiday-text-color:
|
164 | * calendar-weekday-height:
|
165 | * calendar-weekday-width:
|
166 | * calendar-weeknumber-background:
|
167 | * calendar-weeknumber-divider-color:
|
168 | * calendar-weeknumber-divider-width:
|
169 | * calendar-weeknumber-text-color:
|
170 | * calendar-weeknumber-text-font-size:
|
171 | * calendar-weeknumber-text-font-weight:
|
172 | * calendar-weeknumber-text-line-height:
|
173 | * calendar-weeknumber-height:
|
174 | * calendar-weeknumber-width:
|
175 | * calendar-large-width:
|
176 | * calendar-day-cell-large-width:
|
177 | * calendar-day-cell-large-height:
|
178 | * calendar-weekday-large-height:
|
179 | * calendar-weekday-large-width:
|
180 | * calendar-weeknumber-large-height:
|
181 | * calendar-weeknumber-large-width:
|
182 | * calendar-month-cell-large-width:
|
183 | * calendar-month-cell-large-height:
|
184 | * calendar-year-cell-large-width:
|
185 | * calendar-year-cell-large-height:
|
186 | * */
|
187 | export declare class NbCalendarComponent<D> {
|
188 | /**
|
189 | * Defines if we should render previous and next months
|
190 | * in the current month view.
|
191 | * */
|
192 | boundingMonth: boolean;
|
193 | /**
|
194 | * Defines starting view for calendar.
|
195 | * */
|
196 | startView: NbCalendarViewMode;
|
197 | static ngAcceptInputType_startView: NbCalendarViewModeValues;
|
198 | /**
|
199 | * Minimum available date for selection.
|
200 | * */
|
201 | min: D;
|
202 | /**
|
203 | * Maximum available date for selection.
|
204 | * */
|
205 | max: D;
|
206 | /**
|
207 | * Predicate that decides which cells will be disabled.
|
208 | * */
|
209 | filter: (D: any) => boolean;
|
210 | /**
|
211 | * Custom day cell component. Have to implement `NbCalendarCell` interface.
|
212 | * */
|
213 | dayCellComponent: Type<NbCalendarCell<D, D>>;
|
214 | /**
|
215 | * Custom month cell component. Have to implement `NbCalendarCell` interface.
|
216 | * */
|
217 | monthCellComponent: Type<NbCalendarCell<D, D>>;
|
218 | /**
|
219 | * Custom year cell component. Have to implement `NbCalendarCell` interface.
|
220 | * */
|
221 | yearCellComponent: Type<NbCalendarCell<D, D>>;
|
222 | /**
|
223 | * Size of the calendar and entire components.
|
224 | * Can be 'medium' which is default or 'large'.
|
225 | * */
|
226 | size: NbCalendarSize;
|
227 | static ngAcceptInputType_size: NbCalendarSizeValues;
|
228 | visibleDate: D;
|
229 | /**
|
230 | * Determines should we show calendars navigation or not.
|
231 | * */
|
232 | showNavigation: boolean;
|
233 | /**
|
234 | * Date which will be rendered as selected.
|
235 | * */
|
236 | date: D;
|
237 | /**
|
238 | * Determines should we show week numbers column.
|
239 | * False by default.
|
240 | * */
|
241 | get showWeekNumber(): boolean;
|
242 | set showWeekNumber(value: boolean);
|
243 | protected _showWeekNumber: boolean;
|
244 | static ngAcceptInputType_showWeekNumber: NbBooleanInput;
|
245 | /**
|
246 | * Sets symbol used as a header for week numbers column
|
247 | * */
|
248 | weekNumberSymbol: string;
|
249 | /**
|
250 | * Sets first day of the week, it can be 1 if week starts from monday and 0 if from sunday and so on.
|
251 | * `undefined` means that default locale setting will be used.
|
252 | * */
|
253 | firstDayOfWeek: number | undefined;
|
254 | /**
|
255 | * Emits date when selected.
|
256 | * */
|
257 | dateChange: EventEmitter<D>;
|
258 | static ɵfac: i0.ɵɵFactoryDeclaration<NbCalendarComponent<any>, never>;
|
259 | static ɵcmp: i0.ɵɵComponentDeclaration<NbCalendarComponent<any>, "nb-calendar", never, { "boundingMonth": { "alias": "boundingMonth"; "required": false; }; "startView": { "alias": "startView"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "filter": { "alias": "filter"; "required": false; }; "dayCellComponent": { "alias": "dayCellComponent"; "required": false; }; "monthCellComponent": { "alias": "monthCellComponent"; "required": false; }; "yearCellComponent": { "alias": "yearCellComponent"; "required": false; }; "size": { "alias": "size"; "required": false; }; "visibleDate": { "alias": "visibleDate"; "required": false; }; "showNavigation": { "alias": "showNavigation"; "required": false; }; "date": { "alias": "date"; "required": false; }; "showWeekNumber": { "alias": "showWeekNumber"; "required": false; }; "weekNumberSymbol": { "alias": "weekNumberSymbol"; "required": false; }; "firstDayOfWeek": { "alias": "firstDayOfWeek"; "required": false; }; }, { "dateChange": "dateChange"; }, never, never, false, never>;
|
260 | }
|