@imihai/angular-datetime-picker 21.0.1 → 21.0.2
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 +5845 -0
- package/fesm2022/imihai-angular-datetime-picker.mjs.map +1 -0
- package/imihai-angular-datetime-picker-21.0.2.tgz +0 -0
- package/package.json +33 -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 -18
- 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 -29
- package/tsconfig.json +0 -30
- package/tslint.json +0 -130
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* date-time.class
|
|
3
|
-
*/
|
|
4
|
-
import {EventEmitter, Inject, Input, Optional, Directive} from '@angular/core';
|
|
5
|
-
import {
|
|
6
|
-
coerceBooleanProperty,
|
|
7
|
-
coerceNumberProperty
|
|
8
|
-
} from '@angular/cdk/coercion';
|
|
9
|
-
import {DateTimeAdapter} from './adapter/date-time-adapter.class';
|
|
10
|
-
import {
|
|
11
|
-
OWL_DATE_TIME_FORMATS,
|
|
12
|
-
OwlDateTimeFormats
|
|
13
|
-
} from './adapter/date-time-format.class';
|
|
14
|
-
|
|
15
|
-
let nextUniqueId = 0;
|
|
16
|
-
|
|
17
|
-
export type PickerType = 'both' | 'calendar' | 'timer';
|
|
18
|
-
|
|
19
|
-
export type PickerMode = 'popup' | 'dialog' | 'inline';
|
|
20
|
-
|
|
21
|
-
export type SelectMode = 'single' | 'range' | 'rangeFrom' | 'rangeTo';
|
|
22
|
-
|
|
23
|
-
export enum DateView {
|
|
24
|
-
MONTH = 'month',
|
|
25
|
-
YEAR = 'year',
|
|
26
|
-
MULTI_YEARS = 'multi-years'
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type DateViewType = DateView.MONTH | DateView.YEAR | DateView.MULTI_YEARS;
|
|
30
|
-
|
|
31
|
-
@Directive()
|
|
32
|
-
export abstract class OwlDateTime<T> {
|
|
33
|
-
/**
|
|
34
|
-
* Whether to show the second's timer
|
|
35
|
-
*/
|
|
36
|
-
private _showSecondsTimer = false;
|
|
37
|
-
@Input()
|
|
38
|
-
get showSecondsTimer(): boolean {
|
|
39
|
-
return this._showSecondsTimer;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
set showSecondsTimer(val: boolean) {
|
|
43
|
-
this._showSecondsTimer = coerceBooleanProperty(val);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Whether the timer is in hour12 format
|
|
48
|
-
*/
|
|
49
|
-
private _hour12Timer = false;
|
|
50
|
-
@Input()
|
|
51
|
-
get hour12Timer(): boolean {
|
|
52
|
-
return this._hour12Timer;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
set hour12Timer(val: boolean) {
|
|
56
|
-
this._hour12Timer = coerceBooleanProperty(val);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* The view that the calendar should start in.
|
|
61
|
-
*/
|
|
62
|
-
@Input()
|
|
63
|
-
startView: DateViewType = DateView.MONTH;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Whether to show calendar weeks in the calendar
|
|
67
|
-
* */
|
|
68
|
-
@Input()
|
|
69
|
-
showCalendarWeeks = false;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Whether to should only the year and multi-year views.
|
|
73
|
-
*/
|
|
74
|
-
@Input()
|
|
75
|
-
yearOnly = false;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Whether to should only the multi-year view.
|
|
79
|
-
*/
|
|
80
|
-
@Input()
|
|
81
|
-
multiyearOnly = false;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Hours to change per step
|
|
85
|
-
*/
|
|
86
|
-
private _stepHour = 1;
|
|
87
|
-
@Input()
|
|
88
|
-
get stepHour(): number {
|
|
89
|
-
return this._stepHour;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
set stepHour(val: number) {
|
|
93
|
-
this._stepHour = coerceNumberProperty(val, 1);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Minutes to change per step
|
|
98
|
-
*/
|
|
99
|
-
private _stepMinute = 1;
|
|
100
|
-
@Input()
|
|
101
|
-
get stepMinute(): number {
|
|
102
|
-
return this._stepMinute;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
set stepMinute(val: number) {
|
|
106
|
-
this._stepMinute = coerceNumberProperty(val, 1);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Seconds to change per step
|
|
111
|
-
*/
|
|
112
|
-
private _stepSecond = 1;
|
|
113
|
-
@Input()
|
|
114
|
-
get stepSecond(): number {
|
|
115
|
-
return this._stepSecond;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
set stepSecond(val: number) {
|
|
119
|
-
this._stepSecond = coerceNumberProperty(val, 1);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Set the first day of week
|
|
124
|
-
*/
|
|
125
|
-
private _firstDayOfWeek: number;
|
|
126
|
-
@Input()
|
|
127
|
-
get firstDayOfWeek() {
|
|
128
|
-
return this._firstDayOfWeek;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
set firstDayOfWeek(value: number) {
|
|
132
|
-
value = coerceNumberProperty(value);
|
|
133
|
-
if (value > 6 || value < 0) {
|
|
134
|
-
this._firstDayOfWeek = undefined;
|
|
135
|
-
} else {
|
|
136
|
-
this._firstDayOfWeek = value;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Whether to hide dates in other months at the start or end of the current month.
|
|
142
|
-
*/
|
|
143
|
-
private _hideOtherMonths = false;
|
|
144
|
-
@Input()
|
|
145
|
-
get hideOtherMonths(): boolean {
|
|
146
|
-
return this._hideOtherMonths;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
set hideOtherMonths(val: boolean) {
|
|
150
|
-
this._hideOtherMonths = coerceBooleanProperty(val);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
private readonly _id: string;
|
|
154
|
-
get id(): string {
|
|
155
|
-
return this._id;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
abstract get selected(): T | null;
|
|
159
|
-
|
|
160
|
-
abstract get selecteds(): T[] | null;
|
|
161
|
-
|
|
162
|
-
abstract get dateTimeFilter(): (date: T | null) => boolean;
|
|
163
|
-
|
|
164
|
-
abstract get maxDateTime(): T | null;
|
|
165
|
-
|
|
166
|
-
abstract get minDateTime(): T | null;
|
|
167
|
-
|
|
168
|
-
abstract get selectMode(): SelectMode;
|
|
169
|
-
|
|
170
|
-
abstract get startAt(): T | null;
|
|
171
|
-
|
|
172
|
-
abstract get endAt(): T | null;
|
|
173
|
-
|
|
174
|
-
abstract get opened(): boolean;
|
|
175
|
-
|
|
176
|
-
abstract get pickerMode(): PickerMode;
|
|
177
|
-
|
|
178
|
-
abstract get pickerType(): PickerType;
|
|
179
|
-
|
|
180
|
-
abstract get isInSingleMode(): boolean;
|
|
181
|
-
|
|
182
|
-
abstract get isInRangeMode(): boolean;
|
|
183
|
-
|
|
184
|
-
abstract select(date: T | T[]): void;
|
|
185
|
-
|
|
186
|
-
abstract yearSelected: EventEmitter<T>;
|
|
187
|
-
|
|
188
|
-
abstract monthSelected: EventEmitter<T>;
|
|
189
|
-
|
|
190
|
-
abstract dateSelected: EventEmitter<T>;
|
|
191
|
-
|
|
192
|
-
abstract selectYear(normalizedYear: T): void;
|
|
193
|
-
|
|
194
|
-
abstract selectMonth(normalizedMonth: T): void;
|
|
195
|
-
|
|
196
|
-
abstract selectDate(normalizedDate: T): void;
|
|
197
|
-
|
|
198
|
-
get formatString(): string {
|
|
199
|
-
return this.pickerType === 'both'
|
|
200
|
-
? this.dateTimeFormats.fullPickerInput
|
|
201
|
-
: this.pickerType === 'calendar'
|
|
202
|
-
? this.dateTimeFormats.datePickerInput
|
|
203
|
-
: this.dateTimeFormats.timePickerInput;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Date Time Checker to check if the give dateTime is selectable
|
|
208
|
-
*/
|
|
209
|
-
public dateTimeChecker = (dateTime: T) => {
|
|
210
|
-
return (
|
|
211
|
-
!!dateTime &&
|
|
212
|
-
(!this.dateTimeFilter || this.dateTimeFilter(dateTime)) &&
|
|
213
|
-
(!this.minDateTime ||
|
|
214
|
-
this.dateTimeAdapter.compare(dateTime, this.minDateTime) >=
|
|
215
|
-
0) &&
|
|
216
|
-
(!this.maxDateTime ||
|
|
217
|
-
this.dateTimeAdapter.compare(dateTime, this.maxDateTime) <= 0)
|
|
218
|
-
);
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
get disabled(): boolean {
|
|
222
|
-
return false;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
protected constructor(
|
|
226
|
-
@Optional() protected dateTimeAdapter: DateTimeAdapter<T>,
|
|
227
|
-
@Optional()
|
|
228
|
-
@Inject(OWL_DATE_TIME_FORMATS)
|
|
229
|
-
protected dateTimeFormats: OwlDateTimeFormats
|
|
230
|
-
) {
|
|
231
|
-
if (!this.dateTimeAdapter) {
|
|
232
|
-
throw Error(
|
|
233
|
-
`OwlDateTimePicker: No provider found for DateTimeAdapter. You must import one of the following ` +
|
|
234
|
-
`modules at your application root: OwlNativeDateTimeModule, OwlMomentDateTimeModule, or provide a ` +
|
|
235
|
-
`custom implementation.`
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
if (!this.dateTimeFormats) {
|
|
240
|
-
throw Error(
|
|
241
|
-
`OwlDateTimePicker: No provider found for OWL_DATE_TIME_FORMATS. You must import one of the following ` +
|
|
242
|
-
`modules at your application root: OwlNativeDateTimeModule, OwlMomentDateTimeModule, or provide a ` +
|
|
243
|
-
`custom implementation.`
|
|
244
|
-
);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
this._id = `owl-dt-picker-${nextUniqueId++}`;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
protected getValidDate(obj: any): T | null {
|
|
251
|
-
return this.dateTimeAdapter.isDateInstance(obj) &&
|
|
252
|
-
this.dateTimeAdapter.isValid(obj)
|
|
253
|
-
? obj
|
|
254
|
-
: null;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* date-time.module
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { NgModule } from '@angular/core';
|
|
6
|
-
import { CommonModule } from '@angular/common';
|
|
7
|
-
import { A11yModule } from '@angular/cdk/a11y';
|
|
8
|
-
import { OverlayModule } from '@angular/cdk/overlay';
|
|
9
|
-
import { OwlDateTimeTriggerDirective } from './date-time-picker-trigger.directive';
|
|
10
|
-
import { OWL_DTPICKER_SCROLL_STRATEGY_PROVIDER, OwlDateTimeComponent } from './date-time-picker.component';
|
|
11
|
-
import { OwlDateTimeContainerComponent } from './date-time-picker-container.component';
|
|
12
|
-
import { OwlDateTimeInputDirective } from './date-time-picker-input.directive';
|
|
13
|
-
import { OwlDateTimeIntl } from './date-time-picker-intl.service';
|
|
14
|
-
import { OwlMonthViewComponent } from './calendar-month-view.component';
|
|
15
|
-
import { OwlCalendarBodyComponent } from './calendar-body.component';
|
|
16
|
-
import { OwlYearViewComponent } from './calendar-year-view.component';
|
|
17
|
-
import { OwlMultiYearViewComponent } from './calendar-multi-year-view.component';
|
|
18
|
-
import { OwlTimerBoxComponent } from './timer-box.component';
|
|
19
|
-
import { OwlTimerComponent } from './timer.component';
|
|
20
|
-
import { NumberFixedLenPipe } from './numberedFixLen.pipe';
|
|
21
|
-
import { OwlCalendarComponent } from './calendar.component';
|
|
22
|
-
import { OwlDateTimeInlineComponent } from './date-time-inline.component';
|
|
23
|
-
import { OwlDialogModule } from '../dialog/dialog.module';
|
|
24
|
-
import { optionsProviders } from './options-provider';
|
|
25
|
-
|
|
26
|
-
@NgModule({
|
|
27
|
-
imports: [CommonModule, OverlayModule, OwlDialogModule, A11yModule],
|
|
28
|
-
exports: [
|
|
29
|
-
OwlCalendarComponent,
|
|
30
|
-
OwlTimerComponent,
|
|
31
|
-
OwlDateTimeTriggerDirective,
|
|
32
|
-
OwlDateTimeInputDirective,
|
|
33
|
-
OwlDateTimeComponent,
|
|
34
|
-
OwlDateTimeInlineComponent,
|
|
35
|
-
OwlMultiYearViewComponent,
|
|
36
|
-
OwlYearViewComponent,
|
|
37
|
-
OwlMonthViewComponent,
|
|
38
|
-
],
|
|
39
|
-
declarations: [
|
|
40
|
-
OwlDateTimeTriggerDirective,
|
|
41
|
-
OwlDateTimeInputDirective,
|
|
42
|
-
OwlDateTimeComponent,
|
|
43
|
-
OwlDateTimeContainerComponent,
|
|
44
|
-
OwlMultiYearViewComponent,
|
|
45
|
-
OwlYearViewComponent,
|
|
46
|
-
OwlMonthViewComponent,
|
|
47
|
-
OwlTimerComponent,
|
|
48
|
-
OwlTimerBoxComponent,
|
|
49
|
-
OwlCalendarComponent,
|
|
50
|
-
OwlCalendarBodyComponent,
|
|
51
|
-
NumberFixedLenPipe,
|
|
52
|
-
OwlDateTimeInlineComponent,
|
|
53
|
-
],
|
|
54
|
-
providers: [
|
|
55
|
-
OwlDateTimeIntl,
|
|
56
|
-
OWL_DTPICKER_SCROLL_STRATEGY_PROVIDER,
|
|
57
|
-
...optionsProviders,
|
|
58
|
-
]
|
|
59
|
-
})
|
|
60
|
-
export class OwlDateTimeModule {
|
|
61
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* numberFixedLen.pipe
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
6
|
-
|
|
7
|
-
@Pipe({
|
|
8
|
-
name: 'numberFixedLen',
|
|
9
|
-
standalone: false,
|
|
10
|
-
})
|
|
11
|
-
export class NumberFixedLenPipe implements PipeTransform {
|
|
12
|
-
transform( num: number, len: number ): any {
|
|
13
|
-
const number = Math.floor(num);
|
|
14
|
-
const length = Math.floor(len);
|
|
15
|
-
|
|
16
|
-
if (num === null || isNaN(number) || isNaN(length)) {
|
|
17
|
-
return num;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
let numString = number.toString();
|
|
21
|
-
|
|
22
|
-
while (numString.length < length) {
|
|
23
|
-
numString = '0' + numString;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return numString;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { InjectionToken, Provider } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
export function defaultOptionsFactory() {
|
|
4
|
-
return DefaultOptions.create();
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export function multiYearOptionsFactory(options: Options) {
|
|
8
|
-
return options.multiYear;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface Options {
|
|
12
|
-
multiYear: {
|
|
13
|
-
yearsPerRow: number,
|
|
14
|
-
yearRows: number
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export class DefaultOptions {
|
|
18
|
-
public static create(): Options {
|
|
19
|
-
// Always return new instance
|
|
20
|
-
return {
|
|
21
|
-
multiYear: {
|
|
22
|
-
yearRows: 7,
|
|
23
|
-
yearsPerRow: 3
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export abstract class OptionsTokens {
|
|
30
|
-
public static all = new InjectionToken<Options>('All options token');
|
|
31
|
-
public static multiYear = new InjectionToken<Options['multiYear']>('Grid view options token');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const optionsProviders: Provider[] = [
|
|
35
|
-
{
|
|
36
|
-
provide: OptionsTokens.all,
|
|
37
|
-
useFactory: defaultOptionsFactory,
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
provide: OptionsTokens.multiYear,
|
|
41
|
-
useFactory: multiYearOptionsFactory,
|
|
42
|
-
deps: [OptionsTokens.all],
|
|
43
|
-
},
|
|
44
|
-
];
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
@if (showDivider) {
|
|
2
|
-
<div class="owl-dt-timer-divider" aria-hidden="true"></div>
|
|
3
|
-
}
|
|
4
|
-
<button
|
|
5
|
-
class="owl-dt-control-button owl-dt-control-arrow-button"
|
|
6
|
-
type="button"
|
|
7
|
-
tabindex="-1"
|
|
8
|
-
[disabled]="upBtnDisabled"
|
|
9
|
-
[attr.aria-label]="upBtnAriaLabel"
|
|
10
|
-
(click)="upBtnClicked()"
|
|
11
|
-
>
|
|
12
|
-
<span class="owl-dt-control-button-content" tabindex="-1">
|
|
13
|
-
<!-- <editor-fold desc="SVG Arrow Up"> -->
|
|
14
|
-
<svg
|
|
15
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
16
|
-
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
17
|
-
version="1.1"
|
|
18
|
-
x="0px"
|
|
19
|
-
y="0px"
|
|
20
|
-
viewBox="0 0 451.847 451.846"
|
|
21
|
-
style="enable-background: new 0 0 451.847 451.846"
|
|
22
|
-
xml:space="preserve"
|
|
23
|
-
width="100%"
|
|
24
|
-
height="100%"
|
|
25
|
-
>
|
|
26
|
-
<path
|
|
27
|
-
d="M248.292,106.406l194.281,194.29c12.365,12.359,12.365,32.391,0,44.744c-12.354,12.354-32.391,12.354-44.744,0
|
|
28
|
-
L225.923,173.529L54.018,345.44c-12.36,12.354-32.395,12.354-44.748,0c-12.359-12.354-12.359-32.391,0-44.75L203.554,106.4
|
|
29
|
-
c6.18-6.174,14.271-9.259,22.369-9.259C234.018,97.141,242.115,100.232,248.292,106.406z"
|
|
30
|
-
/>
|
|
31
|
-
</svg>
|
|
32
|
-
<!-- </editor-fold> -->
|
|
33
|
-
</span>
|
|
34
|
-
</button>
|
|
35
|
-
<label class="owl-dt-timer-content">
|
|
36
|
-
<input
|
|
37
|
-
class="owl-dt-timer-input"
|
|
38
|
-
maxlength="2"
|
|
39
|
-
[value]="displayValue"
|
|
40
|
-
(keydown.arrowup)="!upBtnDisabled && upBtnClicked()"
|
|
41
|
-
(keydown.arrowdown)="!downBtnDisabled && downBtnClicked()"
|
|
42
|
-
(input)="handleInputChange(valueInput.value)"
|
|
43
|
-
(focusin)="focusIn()"
|
|
44
|
-
(focusout)="focusOut(valueInput.value)"
|
|
45
|
-
#valueInput
|
|
46
|
-
/>
|
|
47
|
-
<span class="owl-hidden-accessible">{{ inputLabel }}</span>
|
|
48
|
-
</label>
|
|
49
|
-
<button
|
|
50
|
-
class="owl-dt-control-button owl-dt-control-arrow-button"
|
|
51
|
-
type="button"
|
|
52
|
-
tabindex="-1"
|
|
53
|
-
[disabled]="downBtnDisabled"
|
|
54
|
-
[attr.aria-label]="downBtnAriaLabel"
|
|
55
|
-
(click)="downBtnClicked()"
|
|
56
|
-
>
|
|
57
|
-
<span class="owl-dt-control-button-content" tabindex="-1">
|
|
58
|
-
<!-- <editor-fold desc="SVG Arrow Down"> -->
|
|
59
|
-
<svg
|
|
60
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
61
|
-
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
62
|
-
version="1.1"
|
|
63
|
-
x="0px"
|
|
64
|
-
y="0px"
|
|
65
|
-
viewBox="0 0 451.847 451.846"
|
|
66
|
-
style="enable-background: new 0 0 451.847 451.846"
|
|
67
|
-
xml:space="preserve"
|
|
68
|
-
width="100%"
|
|
69
|
-
height="100%"
|
|
70
|
-
>
|
|
71
|
-
<path
|
|
72
|
-
d="M225.923,354.706c-8.098,0-16.195-3.092-22.369-9.263L9.27,151.157c-12.359-12.359-12.359-32.397,0-44.751
|
|
73
|
-
c12.354-12.354,32.388-12.354,44.748,0l171.905,171.915l171.906-171.909c12.359-12.354,32.391-12.354,44.744,0
|
|
74
|
-
c12.365,12.354,12.365,32.392,0,44.751L248.292,345.449C242.115,351.621,234.018,354.706,225.923,354.706z"
|
|
75
|
-
/>
|
|
76
|
-
</svg>
|
|
77
|
-
<!-- </editor-fold> -->
|
|
78
|
-
</span>
|
|
79
|
-
</button>
|
|
File without changes
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* timer-box.component
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
ChangeDetectionStrategy,
|
|
7
|
-
Component,
|
|
8
|
-
EventEmitter,
|
|
9
|
-
ElementRef,
|
|
10
|
-
ViewChild,
|
|
11
|
-
Input,
|
|
12
|
-
OnDestroy,
|
|
13
|
-
OnInit,
|
|
14
|
-
Output
|
|
15
|
-
} from '@angular/core';
|
|
16
|
-
import { coerceNumberProperty } from '@angular/cdk/coercion';
|
|
17
|
-
import { Subject, Subscription } from 'rxjs';
|
|
18
|
-
import { debounceTime } from 'rxjs/operators';
|
|
19
|
-
|
|
20
|
-
@Component({
|
|
21
|
-
exportAs: 'owlDateTimeTimerBox',
|
|
22
|
-
selector: 'owl-date-time-timer-box',
|
|
23
|
-
templateUrl: './timer-box.component.html',
|
|
24
|
-
styleUrls: ['./timer-box.component.scss'],
|
|
25
|
-
standalone: false,
|
|
26
|
-
preserveWhitespaces: false,
|
|
27
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
28
|
-
host: {
|
|
29
|
-
'[class.owl-dt-timer-box]': 'owlDTTimerBoxClass'
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
export class OwlTimerBoxComponent implements OnInit, OnDestroy {
|
|
34
|
-
|
|
35
|
-
@Input() showDivider = false;
|
|
36
|
-
|
|
37
|
-
@Input() upBtnAriaLabel: string;
|
|
38
|
-
|
|
39
|
-
@Input() upBtnDisabled: boolean;
|
|
40
|
-
|
|
41
|
-
@Input() downBtnAriaLabel: string;
|
|
42
|
-
|
|
43
|
-
@Input() downBtnDisabled: boolean;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Value would be displayed in the box
|
|
47
|
-
* If it is null, the box would display [value]
|
|
48
|
-
* */
|
|
49
|
-
@Input() boxValue: number;
|
|
50
|
-
|
|
51
|
-
@Input() value: number;
|
|
52
|
-
|
|
53
|
-
@Input() min: number;
|
|
54
|
-
|
|
55
|
-
@Input() max: number;
|
|
56
|
-
|
|
57
|
-
@Input() step = 1;
|
|
58
|
-
|
|
59
|
-
@Input() inputLabel: string;
|
|
60
|
-
|
|
61
|
-
@Output() valueChange = new EventEmitter<number>();
|
|
62
|
-
|
|
63
|
-
@Output() inputChange = new EventEmitter<number>();
|
|
64
|
-
|
|
65
|
-
private inputStream = new Subject<string>();
|
|
66
|
-
|
|
67
|
-
private inputStreamSub = Subscription.EMPTY;
|
|
68
|
-
|
|
69
|
-
private hasFocus = false;
|
|
70
|
-
|
|
71
|
-
get displayValue(): string {
|
|
72
|
-
if (this.hasFocus) {
|
|
73
|
-
// Don't try to reformat the value that user is currently editing
|
|
74
|
-
return this.valueInput.nativeElement.value;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const value = this.boxValue || this.value;
|
|
78
|
-
|
|
79
|
-
if (value === null || isNaN(value)) {
|
|
80
|
-
return '';
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return value < 10 ? '0' + value.toString() : value.toString();
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
get owlDTTimerBoxClass(): boolean {
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
@ViewChild('valueInput', { static: true })
|
|
91
|
-
private valueInput: ElementRef<HTMLInputElement>;
|
|
92
|
-
private onValueInputMouseWheelBind = this.onValueInputMouseWheel.bind(this);
|
|
93
|
-
|
|
94
|
-
constructor() {
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
public ngOnInit() {
|
|
98
|
-
this.inputStreamSub = this.inputStream.pipe(debounceTime(750)).subscribe(( val: string ) => {
|
|
99
|
-
if (val) {
|
|
100
|
-
const inputValue = coerceNumberProperty(val, 0);
|
|
101
|
-
this.updateValueViaInput(inputValue);
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
this.bindValueInputMouseWheel();
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
public ngOnDestroy(): void {
|
|
108
|
-
this.unbindValueInputMouseWheel();
|
|
109
|
-
this.inputStreamSub.unsubscribe();
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
public upBtnClicked(): void {
|
|
113
|
-
this.updateValue(this.value + this.step);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
public downBtnClicked(): void {
|
|
117
|
-
this.updateValue(this.value - this.step);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
public handleInputChange(val: string ): void {
|
|
121
|
-
this.inputStream.next(val);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
public focusIn(): void {
|
|
125
|
-
this.hasFocus = true;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
public focusOut(value: string): void {
|
|
129
|
-
this.hasFocus = false;
|
|
130
|
-
if (value) {
|
|
131
|
-
const inputValue = coerceNumberProperty(value, 0);
|
|
132
|
-
this.updateValueViaInput(inputValue);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
private updateValue( value: number ): void {
|
|
137
|
-
this.valueChange.emit(value);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
private updateValueViaInput( value: number ): void {
|
|
141
|
-
if (value > this.max || value < this.min) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
this.inputChange.emit(value);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
private onValueInputMouseWheel( event: any ): void {
|
|
148
|
-
event = event || window.event;
|
|
149
|
-
const delta = event.wheelDelta || -event.deltaY || -event.detail;
|
|
150
|
-
|
|
151
|
-
if (delta > 0) {
|
|
152
|
-
if (!this.upBtnDisabled) {
|
|
153
|
-
this.upBtnClicked();
|
|
154
|
-
}
|
|
155
|
-
} else if (delta < 0) {
|
|
156
|
-
if (!this.downBtnDisabled) {
|
|
157
|
-
this.downBtnClicked();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
event.preventDefault ? event.preventDefault() : (event.returnValue = false);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
private bindValueInputMouseWheel(): void {
|
|
165
|
-
this.valueInput.nativeElement.addEventListener(
|
|
166
|
-
'onwheel' in document ? 'wheel' : 'mousewheel',
|
|
167
|
-
this.onValueInputMouseWheelBind);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
private unbindValueInputMouseWheel(): void {
|
|
171
|
-
this.valueInput.nativeElement.removeEventListener(
|
|
172
|
-
'onwheel' in document ? 'wheel' : 'mousewheel',
|
|
173
|
-
this.onValueInputMouseWheelBind);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<owl-date-time-timer-box
|
|
2
|
-
[upBtnAriaLabel]="upHourButtonLabel"
|
|
3
|
-
[downBtnAriaLabel]="downHourButtonLabel"
|
|
4
|
-
[upBtnDisabled]="!upHourEnabled()"
|
|
5
|
-
[downBtnDisabled]="!downHourEnabled()"
|
|
6
|
-
[boxValue]="hourBoxValue"
|
|
7
|
-
[value]="hourValue"
|
|
8
|
-
[min]="0"
|
|
9
|
-
[max]="23"
|
|
10
|
-
[step]="stepHour"
|
|
11
|
-
[inputLabel]="'Hour'"
|
|
12
|
-
(inputChange)="setHourValueViaInput($event)"
|
|
13
|
-
(valueChange)="setHourValue($event)"
|
|
14
|
-
></owl-date-time-timer-box>
|
|
15
|
-
<owl-date-time-timer-box
|
|
16
|
-
[showDivider]="true"
|
|
17
|
-
[upBtnAriaLabel]="upMinuteButtonLabel"
|
|
18
|
-
[downBtnAriaLabel]="downMinuteButtonLabel"
|
|
19
|
-
[upBtnDisabled]="!upMinuteEnabled()"
|
|
20
|
-
[downBtnDisabled]="!downMinuteEnabled()"
|
|
21
|
-
[value]="minuteValue"
|
|
22
|
-
[min]="0"
|
|
23
|
-
[max]="59"
|
|
24
|
-
[step]="stepMinute"
|
|
25
|
-
[inputLabel]="'Minute'"
|
|
26
|
-
(inputChange)="setMinuteValue($event)"
|
|
27
|
-
(valueChange)="setMinuteValue($event)"
|
|
28
|
-
></owl-date-time-timer-box>
|
|
29
|
-
@if (showSecondsTimer) {
|
|
30
|
-
<owl-date-time-timer-box
|
|
31
|
-
[showDivider]="true"
|
|
32
|
-
[upBtnAriaLabel]="upSecondButtonLabel"
|
|
33
|
-
[downBtnAriaLabel]="downSecondButtonLabel"
|
|
34
|
-
[upBtnDisabled]="!upSecondEnabled()"
|
|
35
|
-
[downBtnDisabled]="!downSecondEnabled()"
|
|
36
|
-
[value]="secondValue"
|
|
37
|
-
[min]="0"
|
|
38
|
-
[max]="59"
|
|
39
|
-
[step]="stepSecond"
|
|
40
|
-
[inputLabel]="'Second'"
|
|
41
|
-
(inputChange)="setSecondValue($event)"
|
|
42
|
-
(valueChange)="setSecondValue($event)"
|
|
43
|
-
></owl-date-time-timer-box>
|
|
44
|
-
}
|
|
45
|
-
@if (hour12Timer) {
|
|
46
|
-
<div class="owl-dt-timer-hour12">
|
|
47
|
-
<button
|
|
48
|
-
class="owl-dt-control-button owl-dt-timer-hour12-box"
|
|
49
|
-
type="button"
|
|
50
|
-
tabindex="0"
|
|
51
|
-
(click)="setMeridiem($event)"
|
|
52
|
-
>
|
|
53
|
-
<span class="owl-dt-control-button-content" tabindex="-1">
|
|
54
|
-
{{ hour12ButtonLabel }}
|
|
55
|
-
</span>
|
|
56
|
-
</button>
|
|
57
|
-
</div>
|
|
58
|
-
}
|
|
File without changes
|