@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,371 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* timer.component
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
ChangeDetectionStrategy,
|
|
7
|
-
ChangeDetectorRef,
|
|
8
|
-
Component,
|
|
9
|
-
ElementRef,
|
|
10
|
-
EventEmitter,
|
|
11
|
-
Input,
|
|
12
|
-
NgZone,
|
|
13
|
-
OnInit,
|
|
14
|
-
Optional,
|
|
15
|
-
Output
|
|
16
|
-
} from '@angular/core';
|
|
17
|
-
import { OwlDateTimeIntl } from './date-time-picker-intl.service';
|
|
18
|
-
import { DateTimeAdapter } from './adapter/date-time-adapter.class';
|
|
19
|
-
import { take } from 'rxjs/operators';
|
|
20
|
-
|
|
21
|
-
@Component({
|
|
22
|
-
exportAs: 'owlDateTimeTimer',
|
|
23
|
-
selector: 'owl-date-time-timer',
|
|
24
|
-
templateUrl: './timer.component.html',
|
|
25
|
-
styleUrls: ['./timer.component.scss'],
|
|
26
|
-
preserveWhitespaces: false,
|
|
27
|
-
standalone: false,
|
|
28
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
29
|
-
host: {
|
|
30
|
-
'[class.owl-dt-timer]': 'owlDTTimerClass',
|
|
31
|
-
'[attr.tabindex]': 'owlDTTimeTabIndex'
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
export class OwlTimerComponent<T> implements OnInit {
|
|
35
|
-
/** The current picker moment */
|
|
36
|
-
private _pickerMoment: T;
|
|
37
|
-
@Input()
|
|
38
|
-
get pickerMoment() {
|
|
39
|
-
return this._pickerMoment;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
set pickerMoment(value: T) {
|
|
43
|
-
value = this.dateTimeAdapter.deserialize(value);
|
|
44
|
-
this._pickerMoment =
|
|
45
|
-
this.getValidDate(value) || this.dateTimeAdapter.now();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/** The minimum selectable date time. */
|
|
49
|
-
private _minDateTime: T | null;
|
|
50
|
-
@Input()
|
|
51
|
-
get minDateTime(): T | null {
|
|
52
|
-
return this._minDateTime;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
set minDateTime(value: T | null) {
|
|
56
|
-
value = this.dateTimeAdapter.deserialize(value);
|
|
57
|
-
this._minDateTime = this.getValidDate(value);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** The maximum selectable date time. */
|
|
61
|
-
private _maxDateTime: T | null;
|
|
62
|
-
@Input()
|
|
63
|
-
get maxDateTime(): T | null {
|
|
64
|
-
return this._maxDateTime;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
set maxDateTime(value: T | null) {
|
|
68
|
-
value = this.dateTimeAdapter.deserialize(value);
|
|
69
|
-
this._maxDateTime = this.getValidDate(value);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
private isPM = false; // a flag indicates the current timer moment is in PM or AM
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Whether to show the second's timer
|
|
76
|
-
*/
|
|
77
|
-
@Input()
|
|
78
|
-
showSecondsTimer: boolean;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Whether the timer is in hour12 format
|
|
82
|
-
*/
|
|
83
|
-
@Input()
|
|
84
|
-
hour12Timer: boolean;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Hours to change per step
|
|
88
|
-
*/
|
|
89
|
-
@Input()
|
|
90
|
-
stepHour = 1;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Minutes to change per step
|
|
94
|
-
*/
|
|
95
|
-
@Input()
|
|
96
|
-
stepMinute = 1;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Seconds to change per step
|
|
100
|
-
*/
|
|
101
|
-
@Input()
|
|
102
|
-
stepSecond = 1;
|
|
103
|
-
|
|
104
|
-
get hourValue(): number {
|
|
105
|
-
return this.dateTimeAdapter.getHours(this.pickerMoment);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* The value would be displayed in hourBox.
|
|
110
|
-
* We need this because the value displayed in hourBox it not
|
|
111
|
-
* the same as the hourValue when the timer is in hour12Timer mode.
|
|
112
|
-
* */
|
|
113
|
-
get hourBoxValue(): number {
|
|
114
|
-
let hours = this.hourValue;
|
|
115
|
-
|
|
116
|
-
if (!this.hour12Timer) {
|
|
117
|
-
return hours;
|
|
118
|
-
} else {
|
|
119
|
-
if (hours === 0) {
|
|
120
|
-
hours = 12;
|
|
121
|
-
this.isPM = false;
|
|
122
|
-
} else if (hours > 0 && hours < 12) {
|
|
123
|
-
this.isPM = false;
|
|
124
|
-
} else if (hours === 12) {
|
|
125
|
-
this.isPM = true;
|
|
126
|
-
} else if (hours > 12 && hours < 24) {
|
|
127
|
-
hours = hours - 12;
|
|
128
|
-
this.isPM = true;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return hours;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
get minuteValue(): number {
|
|
136
|
-
return this.dateTimeAdapter.getMinutes(this.pickerMoment);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
get secondValue(): number {
|
|
140
|
-
return this.dateTimeAdapter.getSeconds(this.pickerMoment);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
get upHourButtonLabel(): string {
|
|
144
|
-
return this.pickerIntl.upHourLabel;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
get downHourButtonLabel(): string {
|
|
148
|
-
return this.pickerIntl.downHourLabel;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
get upMinuteButtonLabel(): string {
|
|
152
|
-
return this.pickerIntl.upMinuteLabel;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
get downMinuteButtonLabel(): string {
|
|
156
|
-
return this.pickerIntl.downMinuteLabel;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
get upSecondButtonLabel(): string {
|
|
160
|
-
return this.pickerIntl.upSecondLabel;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
get downSecondButtonLabel(): string {
|
|
164
|
-
return this.pickerIntl.downSecondLabel;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
get hour12ButtonLabel(): string {
|
|
168
|
-
return this.isPM
|
|
169
|
-
? this.pickerIntl.hour12PMLabel
|
|
170
|
-
: this.pickerIntl.hour12AMLabel;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
@Output()
|
|
174
|
-
selectedChange = new EventEmitter<T>();
|
|
175
|
-
|
|
176
|
-
get owlDTTimerClass(): boolean {
|
|
177
|
-
return true;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
get owlDTTimeTabIndex(): number {
|
|
181
|
-
return -1;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
constructor(
|
|
185
|
-
private ngZone: NgZone,
|
|
186
|
-
private elmRef: ElementRef,
|
|
187
|
-
private pickerIntl: OwlDateTimeIntl,
|
|
188
|
-
private cdRef: ChangeDetectorRef,
|
|
189
|
-
@Optional() private dateTimeAdapter: DateTimeAdapter<T>
|
|
190
|
-
) {}
|
|
191
|
-
|
|
192
|
-
public ngOnInit() {}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Focus to the host element
|
|
196
|
-
* */
|
|
197
|
-
public focus() {
|
|
198
|
-
this.ngZone.runOutsideAngular(() => {
|
|
199
|
-
this.ngZone.onStable
|
|
200
|
-
.asObservable()
|
|
201
|
-
.pipe(take(1))
|
|
202
|
-
.subscribe(() => {
|
|
203
|
-
this.elmRef.nativeElement.focus();
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Set the hour value via typing into timer box input
|
|
210
|
-
* We need this to handle the hour value when the timer is in hour12 mode
|
|
211
|
-
* */
|
|
212
|
-
public setHourValueViaInput(hours: number): void {
|
|
213
|
-
if (this.hour12Timer && this.isPM && hours >= 1 && hours <= 11) {
|
|
214
|
-
hours = hours + 12;
|
|
215
|
-
} else if (this.hour12Timer && !this.isPM && hours === 12) {
|
|
216
|
-
hours = 0;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
this.setHourValue(hours);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
public setHourValue(hours: number): void {
|
|
223
|
-
const m = this.dateTimeAdapter.setHours(this.pickerMoment, hours);
|
|
224
|
-
this.selectedChange.emit(m);
|
|
225
|
-
this.cdRef.markForCheck();
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
public setMinuteValue(minutes: number): void {
|
|
229
|
-
const m = this.dateTimeAdapter.setMinutes(this.pickerMoment, minutes);
|
|
230
|
-
this.selectedChange.emit(m);
|
|
231
|
-
this.cdRef.markForCheck();
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
public setSecondValue(seconds: number): void {
|
|
235
|
-
const m = this.dateTimeAdapter.setSeconds(this.pickerMoment, seconds);
|
|
236
|
-
this.selectedChange.emit(m);
|
|
237
|
-
this.cdRef.markForCheck();
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
public setMeridiem(event: any): void {
|
|
241
|
-
this.isPM = !this.isPM;
|
|
242
|
-
|
|
243
|
-
let hours = this.hourValue;
|
|
244
|
-
if (this.isPM) {
|
|
245
|
-
hours = hours + 12;
|
|
246
|
-
} else {
|
|
247
|
-
hours = hours - 12;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
if (hours >= 0 && hours <= 23) {
|
|
251
|
-
this.setHourValue(hours);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
this.cdRef.markForCheck();
|
|
255
|
-
event.preventDefault();
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Check if the up hour button is enabled
|
|
260
|
-
*/
|
|
261
|
-
public upHourEnabled(): boolean {
|
|
262
|
-
return (
|
|
263
|
-
!this.maxDateTime ||
|
|
264
|
-
this.compareHours(this.stepHour, this.maxDateTime) < 1
|
|
265
|
-
);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Check if the down hour button is enabled
|
|
270
|
-
*/
|
|
271
|
-
public downHourEnabled(): boolean {
|
|
272
|
-
return (
|
|
273
|
-
!this.minDateTime ||
|
|
274
|
-
this.compareHours(-this.stepHour, this.minDateTime) > -1
|
|
275
|
-
);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Check if the up minute button is enabled
|
|
280
|
-
*/
|
|
281
|
-
public upMinuteEnabled(): boolean {
|
|
282
|
-
return (
|
|
283
|
-
!this.maxDateTime ||
|
|
284
|
-
this.compareMinutes(this.stepMinute, this.maxDateTime) < 1
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Check if the down minute button is enabled
|
|
290
|
-
*/
|
|
291
|
-
public downMinuteEnabled(): boolean {
|
|
292
|
-
return (
|
|
293
|
-
!this.minDateTime ||
|
|
294
|
-
this.compareMinutes(-this.stepMinute, this.minDateTime) > -1
|
|
295
|
-
);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Check if the up second button is enabled
|
|
300
|
-
*/
|
|
301
|
-
public upSecondEnabled(): boolean {
|
|
302
|
-
return (
|
|
303
|
-
!this.maxDateTime ||
|
|
304
|
-
this.compareSeconds(this.stepSecond, this.maxDateTime) < 1
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Check if the down second button is enabled
|
|
310
|
-
*/
|
|
311
|
-
public downSecondEnabled(): boolean {
|
|
312
|
-
return (
|
|
313
|
-
!this.minDateTime ||
|
|
314
|
-
this.compareSeconds(-this.stepSecond, this.minDateTime) > -1
|
|
315
|
-
);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* PickerMoment's hour value +/- certain amount and compare it to the give date
|
|
320
|
-
* 1 is after the comparedDate
|
|
321
|
-
* -1 is before the comparedDate
|
|
322
|
-
* 0 is equal the comparedDate
|
|
323
|
-
* */
|
|
324
|
-
private compareHours(amount: number, comparedDate: T): number {
|
|
325
|
-
const hours = this.dateTimeAdapter.getHours(this.pickerMoment) + amount;
|
|
326
|
-
const result = this.dateTimeAdapter.setHours(this.pickerMoment, hours);
|
|
327
|
-
return this.dateTimeAdapter.compare(result, comparedDate);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* PickerMoment's minute value +/- certain amount and compare it to the give date
|
|
332
|
-
* 1 is after the comparedDate
|
|
333
|
-
* -1 is before the comparedDate
|
|
334
|
-
* 0 is equal the comparedDate
|
|
335
|
-
* */
|
|
336
|
-
private compareMinutes(amount: number, comparedDate: T): number {
|
|
337
|
-
const minutes =
|
|
338
|
-
this.dateTimeAdapter.getMinutes(this.pickerMoment) + amount;
|
|
339
|
-
const result = this.dateTimeAdapter.setMinutes(
|
|
340
|
-
this.pickerMoment,
|
|
341
|
-
minutes
|
|
342
|
-
);
|
|
343
|
-
return this.dateTimeAdapter.compare(result, comparedDate);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* PickerMoment's second value +/- certain amount and compare it to the give date
|
|
348
|
-
* 1 is after the comparedDate
|
|
349
|
-
* -1 is before the comparedDate
|
|
350
|
-
* 0 is equal the comparedDate
|
|
351
|
-
* */
|
|
352
|
-
private compareSeconds(amount: number, comparedDate: T): number {
|
|
353
|
-
const seconds =
|
|
354
|
-
this.dateTimeAdapter.getSeconds(this.pickerMoment) + amount;
|
|
355
|
-
const result = this.dateTimeAdapter.setSeconds(
|
|
356
|
-
this.pickerMoment,
|
|
357
|
-
seconds
|
|
358
|
-
);
|
|
359
|
-
return this.dateTimeAdapter.compare(result, comparedDate);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Get a valid date object
|
|
364
|
-
*/
|
|
365
|
-
private getValidDate(obj: any): T | null {
|
|
366
|
-
return this.dateTimeAdapter.isDateInstance(obj) &&
|
|
367
|
-
this.dateTimeAdapter.isValid(obj)
|
|
368
|
-
? obj
|
|
369
|
-
: null;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* dialog-config.class
|
|
3
|
-
*/
|
|
4
|
-
import { ViewContainerRef } from '@angular/core';
|
|
5
|
-
import { NoopScrollStrategy, ScrollStrategy } from '@angular/cdk/overlay';
|
|
6
|
-
|
|
7
|
-
let uniqueId = 0;
|
|
8
|
-
|
|
9
|
-
/** Possible overrides for a dialog's position. */
|
|
10
|
-
export interface DialogPosition {
|
|
11
|
-
/** Override for the dialog's top position. */
|
|
12
|
-
top?: string;
|
|
13
|
-
|
|
14
|
-
/** Override for the dialog's bottom position. */
|
|
15
|
-
bottom?: string;
|
|
16
|
-
|
|
17
|
-
/** Override for the dialog's left position. */
|
|
18
|
-
left?: string;
|
|
19
|
-
|
|
20
|
-
/** Override for the dialog's right position. */
|
|
21
|
-
right?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface OwlDialogConfigInterface {
|
|
25
|
-
/**
|
|
26
|
-
* ID of the element that describes the dialog.
|
|
27
|
-
*/
|
|
28
|
-
ariaDescribedBy?: string | null;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Whether to focus the dialog when the dialog is opened
|
|
32
|
-
*/
|
|
33
|
-
autoFocus?: boolean;
|
|
34
|
-
|
|
35
|
-
/** Whether the dialog has a backdrop. */
|
|
36
|
-
hasBackdrop?: boolean;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Custom style for the backdrop
|
|
40
|
-
* */
|
|
41
|
-
backdropStyle?: any;
|
|
42
|
-
|
|
43
|
-
/** Data being injected into the child component. */
|
|
44
|
-
data?: any ;
|
|
45
|
-
|
|
46
|
-
/** Whether the user can use escape or clicking outside to close a modal. */
|
|
47
|
-
disableClose?: boolean;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* ID for the modal. If omitted, a unique one will be generated.
|
|
51
|
-
*/
|
|
52
|
-
id?: string;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* The ARIA role of the dialog element.
|
|
56
|
-
*/
|
|
57
|
-
role?: 'dialog' | 'alertdialog';
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Custom class for the pane
|
|
61
|
-
* */
|
|
62
|
-
paneClass?: string | string[];
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Mouse Event
|
|
66
|
-
* */
|
|
67
|
-
event?: MouseEvent;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Custom class for the backdrop
|
|
71
|
-
* */
|
|
72
|
-
backdropClass?: string | string[];
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Whether the dialog should close when the user goes backwards/forwards in history.
|
|
76
|
-
* */
|
|
77
|
-
closeOnNavigation?: boolean;
|
|
78
|
-
|
|
79
|
-
/** Width of the dialog. */
|
|
80
|
-
width?: string ;
|
|
81
|
-
|
|
82
|
-
/** Height of the dialog. */
|
|
83
|
-
height?: string;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* The min-width of the overlay panel.
|
|
87
|
-
* If a number is provided, pixel units are assumed.
|
|
88
|
-
* */
|
|
89
|
-
minWidth?: number | string;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* The min-height of the overlay panel.
|
|
93
|
-
* If a number is provided, pixel units are assumed.
|
|
94
|
-
* */
|
|
95
|
-
minHeight?: number | string;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* The max-width of the overlay panel.
|
|
99
|
-
* If a number is provided, pixel units are assumed.
|
|
100
|
-
* */
|
|
101
|
-
maxWidth?: number | string;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* The max-height of the overlay panel.
|
|
105
|
-
* If a number is provided, pixel units are assumed.
|
|
106
|
-
* */
|
|
107
|
-
maxHeight?: number | string;
|
|
108
|
-
|
|
109
|
-
/** Position overrides. */
|
|
110
|
-
position?: DialogPosition;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* The scroll strategy when the dialog is open
|
|
114
|
-
* Learn more this from https://material.angular.io/cdk/overlay/overview#scroll-strategies
|
|
115
|
-
* */
|
|
116
|
-
scrollStrategy?: ScrollStrategy;
|
|
117
|
-
|
|
118
|
-
viewContainerRef?: ViewContainerRef;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export class OwlDialogConfig implements OwlDialogConfigInterface {
|
|
122
|
-
/**
|
|
123
|
-
* ID of the element that describes the dialog.
|
|
124
|
-
*/
|
|
125
|
-
public ariaDescribedBy: string | null = null;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Whether to focus the dialog when the dialog is opened
|
|
129
|
-
*/
|
|
130
|
-
public autoFocus = true;
|
|
131
|
-
|
|
132
|
-
/** Whether the dialog has a backdrop. */
|
|
133
|
-
public hasBackdrop = true;
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Custom style for the backdrop
|
|
137
|
-
* */
|
|
138
|
-
public backdropStyle: any;
|
|
139
|
-
|
|
140
|
-
/** Data being injected into the child component. */
|
|
141
|
-
public data: any = null;
|
|
142
|
-
|
|
143
|
-
/** Whether the user can use escape or clicking outside to close a modal. */
|
|
144
|
-
public disableClose = false;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* ID for the modal. If omitted, a unique one will be generated.
|
|
148
|
-
*/
|
|
149
|
-
public id: string;
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* The ARIA role of the dialog element.
|
|
153
|
-
*/
|
|
154
|
-
public role: 'dialog' | 'alertdialog' = 'dialog';
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Custom class for the pane
|
|
158
|
-
* */
|
|
159
|
-
public paneClass: string | string[] = '';
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Mouse Event
|
|
163
|
-
* */
|
|
164
|
-
public event: MouseEvent = null;
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Custom class for the backdrop
|
|
168
|
-
* */
|
|
169
|
-
public backdropClass: string | string[] = '';
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Whether the dialog should close when the user goes backwards/forwards in history.
|
|
173
|
-
* */
|
|
174
|
-
public closeOnNavigation = true;
|
|
175
|
-
|
|
176
|
-
/** Width of the dialog. */
|
|
177
|
-
public width = '';
|
|
178
|
-
|
|
179
|
-
/** Height of the dialog. */
|
|
180
|
-
public height = '';
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* The min-width of the overlay panel.
|
|
184
|
-
* If a number is provided, pixel units are assumed.
|
|
185
|
-
* */
|
|
186
|
-
public minWidth: number | string;
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* The min-height of the overlay panel.
|
|
190
|
-
* If a number is provided, pixel units are assumed.
|
|
191
|
-
* */
|
|
192
|
-
public minHeight: number | string;
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* The max-width of the overlay panel.
|
|
196
|
-
* If a number is provided, pixel units are assumed.
|
|
197
|
-
* */
|
|
198
|
-
public maxWidth: number | string = '85vw';
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* The max-height of the overlay panel.
|
|
202
|
-
* If a number is provided, pixel units are assumed.
|
|
203
|
-
* */
|
|
204
|
-
public maxHeight: number | string;
|
|
205
|
-
|
|
206
|
-
/** Position overrides. */
|
|
207
|
-
public position: DialogPosition;
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* The scroll strategy when the dialog is open
|
|
211
|
-
* Learn more this from https://material.angular.io/cdk/overlay/overview#scroll-strategies
|
|
212
|
-
* */
|
|
213
|
-
public scrollStrategy: ScrollStrategy = new NoopScrollStrategy();
|
|
214
|
-
|
|
215
|
-
public viewContainerRef: ViewContainerRef;
|
|
216
|
-
|
|
217
|
-
constructor() {
|
|
218
|
-
this.id = `owl-dialog-${uniqueId++}`;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<ng-template [cdkPortalOutlet]></ng-template>
|
|
File without changes
|