/
bs-datepicker.config.ts
198 lines (175 loc) · 4.42 KB
/
bs-datepicker.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
import { Injectable } from '@angular/core';
import {
DatepickerRenderOptions,
BsDatepickerViewMode,
DatepickerDateCustomClasses,
DatepickerDateTooltipText
} from './models';
import { BsCustomDates } from './themes/bs/bs-custom-dates-view.component';
/**
* For date range picker there are `BsDaterangepickerConfig` which inherits all properties,
* except `displayMonths`, for range picker it default to `2`
*/
@Injectable({
providedIn: 'root'
})
export class BsDatepickerConfig implements DatepickerRenderOptions {
/** sets use adaptive position */
adaptivePosition = false;
/** sets use UTC date time format */
useUtc = false;
/** turn on/off animation */
isAnimated = false;
value?: Date | Date[];
isDisabled?: boolean;
/**
* Default min date for all date/range pickers
*/
minDate?: Date;
/**
* Default max date for all date/range pickers
*/
maxDate?: Date;
/**
* The view that the datepicker should start in
*/
startView: BsDatepickerViewMode = 'day';
/**
* Default date custom classes for all date/range pickers
*/
dateCustomClasses?: DatepickerDateCustomClasses[];
/**
* Default tooltip text for all date/range pickers
*/
dateTooltipTexts?: DatepickerDateTooltipText[];
/**
* Disable specific days, e.g. [0,6] will disable all Saturdays and Sundays
*/
daysDisabled?: number[];
/**
* Disable specific dates
*/
datesDisabled?: Date[];
/**
* Show one months for special cases (only for dateRangePicker)
* 1. maxDate is equal to today's date
* 2. minDate's month is equal to maxDate's month
*/
displayOneMonthRange?: boolean;
/**
* Enable specific dates
*/
datesEnabled?: Date[];
/**
* Makes dates from other months active
*/
selectFromOtherMonth?: boolean;
/**
* Allows select first date of the week by click on week number
*/
selectWeek?: boolean;
/**
* Allows select daterange as first and last day of week by click on week number (dateRangePicker only)
*/
selectWeekDateRange?: boolean;
/**
* Shows previous and current month, instead of current and next (dateRangePicker only)
*/
showPreviousMonth?: boolean;
/**
* Prevents change to next month for right calendar in two calendars view (dateRangePicker only)
*/
preventChangeToNextMonth?: boolean;
/**
* Add class to current day
*/
customTodayClass?: string;
/**
* Default mode for all date pickers
*/
minMode?: BsDatepickerViewMode;
/**
* If true, returns focus to the datepicker / daterangepicker input after date selection
*/
returnFocusToInput = false;
/** CSS class which will be applied to datepicker container,
* usually used to set color theme
*/
containerClass = 'theme-green';
// DatepickerRenderOptions
displayMonths = 1;
/**
* Allows to hide week numbers in datepicker
*/
showWeekNumbers = true;
dateInputFormat = 'L';
// range picker
rangeSeparator = ' - ';
/**
* Date format for date range input field
*/
rangeInputFormat = 'L';
/**
* Predefined ranges
*/
ranges?: BsCustomDates[];
/**
* Max Date Range in days
*/
maxDateRange?: number;
// DatepickerFormatOptions
monthTitle = 'MMMM';
yearTitle = 'YYYY';
dayLabel = 'D';
monthLabel = 'MMMM';
yearLabel = 'YYYY';
weekNumbers = 'w';
/**
* Shows 'today' button
*/
showTodayButton = false;
/**
* Shows clear button
*/
showClearButton = false;
/**
* Positioning of 'today' button
*/
todayPosition = 'center';
/**
* Positioning of 'clear' button
*/
clearPosition = 'right';
/**
* Label for 'today' button
*/
todayButtonLabel = 'Today';
/**
* Label for 'clear' button
*/
clearButtonLabel = 'Clear';
/**
* Label for 'custom range' button
*/
customRangeButtonLabel = 'Custom Range';
/**
* Shows timepicker under datepicker
*/
withTimepicker = false;
/**
* Set current hours, minutes, seconds and milliseconds for bsValue
*/
initCurrentTime?: boolean;
/**
* Set allowed positions of container.
*/
allowedPositions = ['top', 'bottom'];
/**
* Set rule for datepicker closing. If value is true datepicker closes only if date is changed, if user changes only time datepicker doesn't close. It is available only if property withTimepicker is set true
* */
keepDatepickerOpened = false;
/**
* Allows keep invalid dates in range. Can be used with minDate, maxDate
* */
keepDatesOutOfRules = false;
}