@imihai/angular-datetime-picker 22.0.0 → 22.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/style/picker.min.css +1 -0
- package/fesm2022/imihai-angular-datetime-picker.mjs +5843 -0
- package/fesm2022/imihai-angular-datetime-picker.mjs.map +1 -0
- package/imihai-angular-datetime-picker-22.0.8.tgz +0 -0
- package/package.json +34 -77
- package/types/imihai-angular-datetime-picker.d.ts +2193 -0
- package/.browserslistrc +0 -9
- package/.editorconfig +0 -13
- package/.eslintrc.js +0 -208
- package/.github/workflows/ci_test.yml +0 -35
- package/.prettierrc +0 -2
- package/.travis.yml +0 -16
- package/angular.json +0 -221
- package/e2e/protractor.conf.js +0 -28
- package/e2e/src/app.e2e-spec.ts +0 -14
- package/e2e/src/app.po.ts +0 -11
- package/e2e/tsconfig.e2e.json +0 -13
- package/projects/picker/karma.conf.js +0 -62
- package/projects/picker/ng-package.json +0 -7
- package/projects/picker/package.json +0 -23
- package/projects/picker/src/lib/date-time/adapter/date-time-adapter.class.ts +0 -313
- package/projects/picker/src/lib/date-time/adapter/date-time-format.class.ts +0 -18
- package/projects/picker/src/lib/date-time/adapter/luxon-date-time-adapter.class.ts +0 -307
- package/projects/picker/src/lib/date-time/adapter/luxon-date-time-format.class.ts +0 -11
- package/projects/picker/src/lib/date-time/adapter/luxon-date-time.module.ts +0 -31
- package/projects/picker/src/lib/date-time/adapter/unix-timestamp-adapter/unix-timestamp-date-time-adapter.class.ts +0 -356
- package/projects/picker/src/lib/date-time/adapter/unix-timestamp-adapter/unix-timestamp-date-time-format.class.ts +0 -14
- package/projects/picker/src/lib/date-time/adapter/unix-timestamp-adapter/unix-timestamp-date-time.module.ts +0 -26
- package/projects/picker/src/lib/date-time/calendar-body.component.html +0 -38
- package/projects/picker/src/lib/date-time/calendar-body.component.scss +0 -0
- package/projects/picker/src/lib/date-time/calendar-body.component.spec.ts +0 -120
- package/projects/picker/src/lib/date-time/calendar-body.component.ts +0 -190
- package/projects/picker/src/lib/date-time/calendar-month-view.component.html +0 -47
- package/projects/picker/src/lib/date-time/calendar-month-view.component.scss +0 -16
- package/projects/picker/src/lib/date-time/calendar-month-view.component.spec.ts +0 -394
- package/projects/picker/src/lib/date-time/calendar-month-view.component.ts +0 -705
- package/projects/picker/src/lib/date-time/calendar-multi-year-view.component.html +0 -44
- package/projects/picker/src/lib/date-time/calendar-multi-year-view.component.scss +0 -0
- package/projects/picker/src/lib/date-time/calendar-multi-year-view.component.spec.ts +0 -343
- package/projects/picker/src/lib/date-time/calendar-multi-year-view.component.ts +0 -465
- package/projects/picker/src/lib/date-time/calendar-year-view.component.html +0 -16
- package/projects/picker/src/lib/date-time/calendar-year-view.component.scss +0 -0
- package/projects/picker/src/lib/date-time/calendar-year-view.component.spec.ts +0 -381
- package/projects/picker/src/lib/date-time/calendar-year-view.component.ts +0 -549
- package/projects/picker/src/lib/date-time/calendar.component.html +0 -169
- package/projects/picker/src/lib/date-time/calendar.component.scss +0 -0
- package/projects/picker/src/lib/date-time/calendar.component.spec.ts +0 -592
- package/projects/picker/src/lib/date-time/calendar.component.ts +0 -496
- package/projects/picker/src/lib/date-time/date-time-inline.component.html +0 -1
- package/projects/picker/src/lib/date-time/date-time-inline.component.scss +0 -4
- package/projects/picker/src/lib/date-time/date-time-inline.component.ts +0 -365
- package/projects/picker/src/lib/date-time/date-time-picker-animation-event.ts +0 -4
- package/projects/picker/src/lib/date-time/date-time-picker-container.component.html +0 -126
- package/projects/picker/src/lib/date-time/date-time-picker-container.component.scss +0 -0
- package/projects/picker/src/lib/date-time/date-time-picker-container.component.ts +0 -631
- package/projects/picker/src/lib/date-time/date-time-picker-input.directive.ts +0 -851
- package/projects/picker/src/lib/date-time/date-time-picker-intl.service.ts +0 -76
- package/projects/picker/src/lib/date-time/date-time-picker-trigger.directive.ts +0 -88
- package/projects/picker/src/lib/date-time/date-time-picker.component.html +0 -0
- package/projects/picker/src/lib/date-time/date-time-picker.component.scss +0 -0
- package/projects/picker/src/lib/date-time/date-time-picker.component.spec.ts +0 -2648
- package/projects/picker/src/lib/date-time/date-time-picker.component.ts +0 -731
- package/projects/picker/src/lib/date-time/date-time.class.ts +0 -256
- package/projects/picker/src/lib/date-time/date-time.module.ts +0 -61
- package/projects/picker/src/lib/date-time/numberedFixLen.pipe.ts +0 -28
- package/projects/picker/src/lib/date-time/options-provider.ts +0 -44
- package/projects/picker/src/lib/date-time/timer-box.component.html +0 -79
- package/projects/picker/src/lib/date-time/timer-box.component.scss +0 -0
- package/projects/picker/src/lib/date-time/timer-box.component.ts +0 -175
- package/projects/picker/src/lib/date-time/timer.component.html +0 -58
- package/projects/picker/src/lib/date-time/timer.component.scss +0 -0
- package/projects/picker/src/lib/date-time/timer.component.spec.ts +0 -399
- package/projects/picker/src/lib/date-time/timer.component.ts +0 -371
- package/projects/picker/src/lib/dialog/dialog-config.class.ts +0 -220
- package/projects/picker/src/lib/dialog/dialog-container.component.html +0 -1
- package/projects/picker/src/lib/dialog/dialog-container.component.scss +0 -0
- package/projects/picker/src/lib/dialog/dialog-container.component.ts +0 -231
- package/projects/picker/src/lib/dialog/dialog-ref.class.ts +0 -178
- package/projects/picker/src/lib/dialog/dialog.module.ts +0 -25
- package/projects/picker/src/lib/dialog/dialog.service.ts +0 -353
- package/projects/picker/src/lib/utils/array.utils.ts +0 -12
- package/projects/picker/src/lib/utils/constants.ts +0 -59
- package/projects/picker/src/lib/utils/date.utils.ts +0 -97
- package/projects/picker/src/lib/utils/index.ts +0 -5
- package/projects/picker/src/lib/utils/object.utils.ts +0 -29
- package/projects/picker/src/public_api.ts +0 -56
- package/projects/picker/src/sass/picker.scss +0 -743
- package/projects/picker/src/test-helpers.ts +0 -125
- package/projects/picker/src/test.ts +0 -52
- package/projects/picker/tsconfig.lib.json +0 -19
- package/projects/picker/tsconfig.lib.prod.json +0 -7
- package/projects/picker/tsconfig.spec.json +0 -17
- package/projects/picker/tslint.json +0 -8
- package/src/app/app.component.html +0 -77
- package/src/app/app.component.scss +0 -32
- package/src/app/app.component.spec.ts +0 -16
- package/src/app/app.component.ts +0 -35
- package/src/assets/.gitkeep +0 -0
- package/src/environments/environment.prod.ts +0 -3
- package/src/environments/environment.ts +0 -16
- package/src/favicon.ico +0 -0
- package/src/index.html +0 -14
- package/src/karma.conf.js +0 -31
- package/src/main.ts +0 -16
- package/src/polyfills.ts +0 -53
- package/src/styles.scss +0 -7
- package/src/test.ts +0 -50
- package/src/tsconfig.app.json +0 -16
- package/src/tsconfig.spec.json +0 -18
- package/src/tslint.json +0 -17
- package/tsconfig.base.json +0 -31
- package/tsconfig.json +0 -30
- package/tslint.json +0 -130
|
@@ -1,496 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* calendar.component
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
AfterContentInit,
|
|
7
|
-
AfterViewChecked,
|
|
8
|
-
ChangeDetectionStrategy,
|
|
9
|
-
ChangeDetectorRef,
|
|
10
|
-
Component,
|
|
11
|
-
ElementRef,
|
|
12
|
-
EventEmitter,
|
|
13
|
-
Inject,
|
|
14
|
-
Input,
|
|
15
|
-
NgZone,
|
|
16
|
-
OnDestroy,
|
|
17
|
-
OnInit,
|
|
18
|
-
Optional,
|
|
19
|
-
Output
|
|
20
|
-
} from '@angular/core';
|
|
21
|
-
import {OwlDateTimeIntl} from './date-time-picker-intl.service';
|
|
22
|
-
import {DateTimeAdapter} from './adapter/date-time-adapter.class';
|
|
23
|
-
import {OWL_DATE_TIME_FORMATS, OwlDateTimeFormats} from './adapter/date-time-format.class';
|
|
24
|
-
import {DateView, DateViewType, SelectMode} from './date-time.class';
|
|
25
|
-
import {take} from 'rxjs/operators';
|
|
26
|
-
import {Subscription} from 'rxjs';
|
|
27
|
-
|
|
28
|
-
@Component({
|
|
29
|
-
selector: 'owl-date-time-calendar',
|
|
30
|
-
exportAs: 'owlDateTimeCalendar',
|
|
31
|
-
templateUrl: './calendar.component.html',
|
|
32
|
-
styleUrls: ['./calendar.component.scss'],
|
|
33
|
-
standalone: false,
|
|
34
|
-
host: {
|
|
35
|
-
'[class.owl-dt-calendar]': 'owlDTCalendarClass'
|
|
36
|
-
},
|
|
37
|
-
preserveWhitespaces: false,
|
|
38
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
39
|
-
})
|
|
40
|
-
export class OwlCalendarComponent<T>
|
|
41
|
-
implements OnInit, AfterContentInit, AfterViewChecked, OnDestroy {
|
|
42
|
-
|
|
43
|
-
DateView = DateView;
|
|
44
|
-
|
|
45
|
-
@Input()
|
|
46
|
-
get minDate(): T | null {
|
|
47
|
-
return this._minDate;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
set minDate(value: T | null) {
|
|
51
|
-
value = this.dateTimeAdapter.deserialize(value);
|
|
52
|
-
value = this.getValidDate(value);
|
|
53
|
-
|
|
54
|
-
this._minDate = value
|
|
55
|
-
? this.dateTimeAdapter.createDate(
|
|
56
|
-
this.dateTimeAdapter.getYear(value),
|
|
57
|
-
this.dateTimeAdapter.getMonth(value),
|
|
58
|
-
this.dateTimeAdapter.getDate(value)
|
|
59
|
-
)
|
|
60
|
-
: null;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
@Input()
|
|
64
|
-
get maxDate(): T | null {
|
|
65
|
-
return this._maxDate;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
set maxDate(value: T | null) {
|
|
69
|
-
value = this.dateTimeAdapter.deserialize(value);
|
|
70
|
-
value = this.getValidDate(value);
|
|
71
|
-
|
|
72
|
-
this._maxDate = value
|
|
73
|
-
? this.dateTimeAdapter.createDate(
|
|
74
|
-
this.dateTimeAdapter.getYear(value),
|
|
75
|
-
this.dateTimeAdapter.getMonth(value),
|
|
76
|
-
this.dateTimeAdapter.getDate(value)
|
|
77
|
-
)
|
|
78
|
-
: null;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
@Input()
|
|
82
|
-
get pickerMoment() {
|
|
83
|
-
return this._pickerMoment;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
set pickerMoment(value: T) {
|
|
87
|
-
value = this.dateTimeAdapter.deserialize(value);
|
|
88
|
-
this._pickerMoment =
|
|
89
|
-
this.getValidDate(value) || this.dateTimeAdapter.now();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
@Input()
|
|
93
|
-
get selected(): T | null {
|
|
94
|
-
return this._selected;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
set selected(value: T | null) {
|
|
98
|
-
value = this.dateTimeAdapter.deserialize(value);
|
|
99
|
-
this._selected = this.getValidDate(value);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
@Input()
|
|
103
|
-
get selecteds(): T[] {
|
|
104
|
-
return this._selecteds;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
set selecteds(values: T[]) {
|
|
108
|
-
this._selecteds = values.map(v => {
|
|
109
|
-
v = this.dateTimeAdapter.deserialize(v);
|
|
110
|
-
return this.getValidDate(v);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
get periodButtonText(): string {
|
|
115
|
-
return this.isMonthView
|
|
116
|
-
? this.dateTimeAdapter.format(
|
|
117
|
-
this.pickerMoment,
|
|
118
|
-
this.dateTimeFormats.monthYearLabel
|
|
119
|
-
)
|
|
120
|
-
: this.dateTimeAdapter.getYearName(this.pickerMoment);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
get periodButtonLabel(): string {
|
|
124
|
-
return this.isMonthView
|
|
125
|
-
? this.pickerIntl.switchToMultiYearViewLabel
|
|
126
|
-
: this.pickerIntl.switchToMonthViewLabel;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
get prevButtonLabel(): string {
|
|
130
|
-
if (this._currentView === DateView.MONTH) {
|
|
131
|
-
return this.pickerIntl.prevMonthLabel;
|
|
132
|
-
} else if (this._currentView === DateView.YEAR) {
|
|
133
|
-
return this.pickerIntl.prevYearLabel;
|
|
134
|
-
} else {
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
get nextButtonLabel(): string {
|
|
140
|
-
if (this._currentView === DateView.MONTH) {
|
|
141
|
-
return this.pickerIntl.nextMonthLabel;
|
|
142
|
-
} else if (this._currentView === DateView.YEAR) {
|
|
143
|
-
return this.pickerIntl.nextYearLabel;
|
|
144
|
-
} else {
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
get currentView(): DateViewType {
|
|
150
|
-
return this._currentView;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
set currentView(view: DateViewType) {
|
|
154
|
-
this._currentView = view;
|
|
155
|
-
this.moveFocusOnNextTick = true;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
get isInSingleMode(): boolean {
|
|
159
|
-
return this.selectMode === 'single';
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
get isInRangeMode(): boolean {
|
|
163
|
-
return (
|
|
164
|
-
this.selectMode === 'range' ||
|
|
165
|
-
this.selectMode === 'rangeFrom' ||
|
|
166
|
-
this.selectMode === 'rangeTo'
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
get showControlArrows(): boolean {
|
|
171
|
-
return this._currentView !== DateView.MULTI_YEARS;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
get isMonthView() {
|
|
175
|
-
return this._currentView === DateView.MONTH;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Bind class 'owl-dt-calendar' to host
|
|
180
|
-
* */
|
|
181
|
-
get owlDTCalendarClass(): boolean {
|
|
182
|
-
return true;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
constructor(
|
|
186
|
-
private elmRef: ElementRef,
|
|
187
|
-
private pickerIntl: OwlDateTimeIntl,
|
|
188
|
-
private ngZone: NgZone,
|
|
189
|
-
private cdRef: ChangeDetectorRef,
|
|
190
|
-
@Optional() private dateTimeAdapter: DateTimeAdapter<T>,
|
|
191
|
-
@Optional()
|
|
192
|
-
@Inject(OWL_DATE_TIME_FORMATS)
|
|
193
|
-
private dateTimeFormats: OwlDateTimeFormats
|
|
194
|
-
) {
|
|
195
|
-
this.intlChangesSub = this.pickerIntl.changes.subscribe(() => {
|
|
196
|
-
this.cdRef.markForCheck();
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Date filter for the month and year view
|
|
202
|
-
* */
|
|
203
|
-
@Input()
|
|
204
|
-
dateFilter: (date: T) => boolean;
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Set the first day of week
|
|
208
|
-
*/
|
|
209
|
-
@Input()
|
|
210
|
-
firstDayOfWeek: number;
|
|
211
|
-
|
|
212
|
-
/** The minimum selectable date. */
|
|
213
|
-
private _minDate: T | null;
|
|
214
|
-
|
|
215
|
-
/** The maximum selectable date. */
|
|
216
|
-
private _maxDate: T | null;
|
|
217
|
-
|
|
218
|
-
/** The current picker moment */
|
|
219
|
-
private _pickerMoment: T;
|
|
220
|
-
|
|
221
|
-
@Input()
|
|
222
|
-
selectMode: SelectMode;
|
|
223
|
-
|
|
224
|
-
/** The currently selected moment. */
|
|
225
|
-
private _selected: T | null;
|
|
226
|
-
|
|
227
|
-
private _selecteds: T[] = [];
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* The view that the calendar should start in.
|
|
231
|
-
*/
|
|
232
|
-
@Input()
|
|
233
|
-
startView: DateViewType = DateView.MONTH;
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Whether to should only the year and multi-year views.
|
|
237
|
-
*/
|
|
238
|
-
@Input()
|
|
239
|
-
yearOnly = false;
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Whether to show calendar weeks in the calendar
|
|
243
|
-
* */
|
|
244
|
-
@Input()
|
|
245
|
-
showCalendarWeeks = false;
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Whether to should only the multi-year view.
|
|
249
|
-
*/
|
|
250
|
-
@Input()
|
|
251
|
-
multiyearOnly = false;
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Whether to hide dates in other months at the start or end of the current month.
|
|
255
|
-
* */
|
|
256
|
-
@Input()
|
|
257
|
-
hideOtherMonths: boolean;
|
|
258
|
-
|
|
259
|
-
/** Emits when the currently picker moment changes. */
|
|
260
|
-
@Output()
|
|
261
|
-
pickerMomentChange = new EventEmitter<T>();
|
|
262
|
-
|
|
263
|
-
/** Emits when the selected date changes. */
|
|
264
|
-
@Output()
|
|
265
|
-
readonly dateClicked = new EventEmitter<T>();
|
|
266
|
-
|
|
267
|
-
/** Emits when the currently selected date changes. */
|
|
268
|
-
@Output()
|
|
269
|
-
readonly selectedChange = new EventEmitter<T>();
|
|
270
|
-
|
|
271
|
-
/** Emits when any date is selected. */
|
|
272
|
-
@Output()
|
|
273
|
-
readonly userSelection = new EventEmitter<void>();
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Emits the selected year. This doesn't imply a change on the selected date
|
|
277
|
-
* */
|
|
278
|
-
@Output()
|
|
279
|
-
readonly yearSelected = new EventEmitter<T>();
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Emits the selected month. This doesn't imply a change on the selected date
|
|
283
|
-
* */
|
|
284
|
-
@Output()
|
|
285
|
-
readonly monthSelected = new EventEmitter<T>();
|
|
286
|
-
|
|
287
|
-
private _currentView: DateViewType;
|
|
288
|
-
|
|
289
|
-
private intlChangesSub = Subscription.EMPTY;
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Used for scheduling that focus should be moved to the active cell on the next tick.
|
|
293
|
-
* We need to schedule it, rather than do it immediately, because we have to wait
|
|
294
|
-
* for Angular to re-evaluate the view children.
|
|
295
|
-
*/
|
|
296
|
-
private moveFocusOnNextTick = false;
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Date filter for the month and year view
|
|
300
|
-
*/
|
|
301
|
-
public dateFilterForViews = (date: T) => {
|
|
302
|
-
return (
|
|
303
|
-
!!date &&
|
|
304
|
-
(!this.dateFilter || this.dateFilter(date)) &&
|
|
305
|
-
(!this.minDate ||
|
|
306
|
-
this.dateTimeAdapter.compare(date, this.minDate) >= 0) &&
|
|
307
|
-
(!this.maxDate ||
|
|
308
|
-
this.dateTimeAdapter.compare(date, this.maxDate) <= 0)
|
|
309
|
-
);
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
public ngOnInit() {
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
public ngAfterContentInit(): void {
|
|
316
|
-
this._currentView = this.startView;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
public ngAfterViewChecked() {
|
|
320
|
-
if (this.moveFocusOnNextTick) {
|
|
321
|
-
this.moveFocusOnNextTick = false;
|
|
322
|
-
this.focusActiveCell();
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
public ngOnDestroy(): void {
|
|
327
|
-
this.intlChangesSub.unsubscribe();
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Toggle between month view and year view
|
|
332
|
-
*/
|
|
333
|
-
public toggleViews(): void {
|
|
334
|
-
let nextView = null;
|
|
335
|
-
if (this._currentView === DateView.MONTH) {
|
|
336
|
-
nextView = DateView.MULTI_YEARS;
|
|
337
|
-
} else {
|
|
338
|
-
if (this.multiyearOnly) {
|
|
339
|
-
nextView = DateView.MULTI_YEARS;
|
|
340
|
-
} else if (this.yearOnly) {
|
|
341
|
-
nextView = this._currentView === DateView.YEAR ? DateView.MULTI_YEARS : DateView.YEAR;
|
|
342
|
-
} else {
|
|
343
|
-
nextView = DateView.MONTH;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
this.currentView = nextView;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Handles user clicks on the previous button.
|
|
351
|
-
* */
|
|
352
|
-
public previousClicked(): void {
|
|
353
|
-
this.pickerMoment = this.isMonthView
|
|
354
|
-
? this.dateTimeAdapter.addCalendarMonths(this.pickerMoment, -1)
|
|
355
|
-
: this.dateTimeAdapter.addCalendarYears(this.pickerMoment, -1);
|
|
356
|
-
|
|
357
|
-
this.pickerMomentChange.emit(this.pickerMoment);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* Handles user clicks on the next button.
|
|
362
|
-
* */
|
|
363
|
-
public nextClicked(): void {
|
|
364
|
-
this.pickerMoment = this.isMonthView
|
|
365
|
-
? this.dateTimeAdapter.addCalendarMonths(this.pickerMoment, 1)
|
|
366
|
-
: this.dateTimeAdapter.addCalendarYears(this.pickerMoment, 1);
|
|
367
|
-
|
|
368
|
-
this.pickerMomentChange.emit(this.pickerMoment);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
public dateSelected(date: T): void {
|
|
372
|
-
if (!this.dateFilterForViews(date)) {
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
this.dateClicked.emit(date);
|
|
377
|
-
this.selectedChange.emit(date);
|
|
378
|
-
|
|
379
|
-
/*if ((this.isInSingleMode && !this.dateTimeAdapter.isSameDay(date, this.selected)) ||
|
|
380
|
-
this.isInRangeMode) {
|
|
381
|
-
this.selectedChange.emit(date);
|
|
382
|
-
}*/
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* Change the pickerMoment value and switch to a specific view
|
|
387
|
-
*/
|
|
388
|
-
public goToDateInView(
|
|
389
|
-
date: T,
|
|
390
|
-
view: DateViewType
|
|
391
|
-
): void {
|
|
392
|
-
this.handlePickerMomentChange(date);
|
|
393
|
-
if ((!this.yearOnly && !this.multiyearOnly) ||
|
|
394
|
-
(this.multiyearOnly && (view !== DateView.MONTH && view !== DateView.YEAR)) ||
|
|
395
|
-
(this.yearOnly && view !== DateView.MONTH)) {
|
|
396
|
-
this.currentView = view;
|
|
397
|
-
} else {
|
|
398
|
-
this.dateSelected(date);
|
|
399
|
-
}
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Change the pickerMoment value
|
|
405
|
-
*/
|
|
406
|
-
public handlePickerMomentChange(date: T): void {
|
|
407
|
-
this.pickerMoment = this.dateTimeAdapter.clampDate(
|
|
408
|
-
date,
|
|
409
|
-
this.minDate,
|
|
410
|
-
this.maxDate
|
|
411
|
-
);
|
|
412
|
-
this.pickerMomentChange.emit(this.pickerMoment);
|
|
413
|
-
return;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
public userSelected(): void {
|
|
417
|
-
this.userSelection.emit();
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Whether the previous period button is enabled.
|
|
422
|
-
*/
|
|
423
|
-
public prevButtonEnabled(): boolean {
|
|
424
|
-
return (
|
|
425
|
-
!this.minDate || !this.isSameView(this.pickerMoment, this.minDate)
|
|
426
|
-
);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* Whether the next period button is enabled.
|
|
431
|
-
*/
|
|
432
|
-
public nextButtonEnabled(): boolean {
|
|
433
|
-
return (
|
|
434
|
-
!this.maxDate || !this.isSameView(this.pickerMoment, this.maxDate)
|
|
435
|
-
);
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
/**
|
|
439
|
-
* Focus to the host element
|
|
440
|
-
* */
|
|
441
|
-
public focusActiveCell() {
|
|
442
|
-
this.ngZone.runOutsideAngular(() => {
|
|
443
|
-
this.ngZone.onStable
|
|
444
|
-
.asObservable()
|
|
445
|
-
.pipe(take(1))
|
|
446
|
-
.subscribe(() => {
|
|
447
|
-
this.elmRef.nativeElement
|
|
448
|
-
.querySelector('.owl-dt-calendar-cell-active')
|
|
449
|
-
.focus();
|
|
450
|
-
});
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
public selectYearInMultiYearView(normalizedYear: T): void {
|
|
455
|
-
this.yearSelected.emit(normalizedYear);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
public selectMonthInYearView(normalizedMonth: T): void {
|
|
459
|
-
this.monthSelected.emit(normalizedMonth);
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
/**
|
|
463
|
-
* Whether the two dates represent the same view in the current view mode (month or year).
|
|
464
|
-
*/
|
|
465
|
-
private isSameView(date1: T, date2: T): boolean {
|
|
466
|
-
if (this._currentView === DateView.MONTH) {
|
|
467
|
-
return !!(
|
|
468
|
-
date1 &&
|
|
469
|
-
date2 &&
|
|
470
|
-
this.dateTimeAdapter.getYear(date1) ===
|
|
471
|
-
this.dateTimeAdapter.getYear(date2) &&
|
|
472
|
-
this.dateTimeAdapter.getMonth(date1) ===
|
|
473
|
-
this.dateTimeAdapter.getMonth(date2)
|
|
474
|
-
);
|
|
475
|
-
} else if (this._currentView === DateView.YEAR) {
|
|
476
|
-
return !!(
|
|
477
|
-
date1 &&
|
|
478
|
-
date2 &&
|
|
479
|
-
this.dateTimeAdapter.getYear(date1) ===
|
|
480
|
-
this.dateTimeAdapter.getYear(date2)
|
|
481
|
-
);
|
|
482
|
-
} else {
|
|
483
|
-
return false;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
/**
|
|
488
|
-
* Get a valid date object
|
|
489
|
-
*/
|
|
490
|
-
private getValidDate(obj: any): T | null {
|
|
491
|
-
return this.dateTimeAdapter.isDateInstance(obj) &&
|
|
492
|
-
this.dateTimeAdapter.isValid(obj)
|
|
493
|
-
? obj
|
|
494
|
-
: null;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<owl-date-time-container></owl-date-time-container>
|