@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,125 +0,0 @@
|
|
|
1
|
-
// Based on @angular/cdk/testing
|
|
2
|
-
import { EventEmitter, NgZone } from '@angular/core';
|
|
3
|
-
|
|
4
|
-
export function dispatchEvent(node: Node | Window, event: Event): Event {
|
|
5
|
-
node.dispatchEvent(event);
|
|
6
|
-
return event;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function dispatchFakeEvent(
|
|
10
|
-
node: Node | Window,
|
|
11
|
-
type: string,
|
|
12
|
-
canBubble?: boolean
|
|
13
|
-
): Event {
|
|
14
|
-
return dispatchEvent(node, createFakeEvent(type, canBubble));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function createFakeEvent(
|
|
18
|
-
type: string,
|
|
19
|
-
canBubble = false,
|
|
20
|
-
cancelable = true
|
|
21
|
-
) {
|
|
22
|
-
const event = document.createEvent('Event');
|
|
23
|
-
event.initEvent(type, canBubble, cancelable);
|
|
24
|
-
return event;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function dispatchKeyboardEvent(
|
|
28
|
-
node: Node,
|
|
29
|
-
type: string,
|
|
30
|
-
keyCode: number,
|
|
31
|
-
target?: Element
|
|
32
|
-
): KeyboardEvent {
|
|
33
|
-
return dispatchEvent(
|
|
34
|
-
node,
|
|
35
|
-
createKeyboardEvent(type, keyCode, target)
|
|
36
|
-
) as KeyboardEvent;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function createKeyboardEvent(
|
|
40
|
-
type: string,
|
|
41
|
-
keyCode: number,
|
|
42
|
-
target?: Element,
|
|
43
|
-
key?: string
|
|
44
|
-
) {
|
|
45
|
-
const event = document.createEvent('KeyboardEvent') as any;
|
|
46
|
-
const originalPreventDefault = event.preventDefault;
|
|
47
|
-
|
|
48
|
-
// Firefox does not support `initKeyboardEvent`, but supports `initKeyEvent`.
|
|
49
|
-
if (event.initKeyEvent) {
|
|
50
|
-
event.initKeyEvent(type, true, true, window, 0, 0, 0, 0, 0, keyCode);
|
|
51
|
-
} else {
|
|
52
|
-
event.initKeyboardEvent(type, true, true, window, 0, key, 0, '', false);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Webkit Browsers don't set the keyCode when calling the init function.
|
|
56
|
-
// See related bug https://bugs.webkit.org/show_bug.cgi?id=16735
|
|
57
|
-
Object.defineProperties(event, {
|
|
58
|
-
keyCode: { get: () => keyCode },
|
|
59
|
-
key: { get: () => key },
|
|
60
|
-
target: { get: () => target }
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// IE won't set `defaultPrevented` on synthetic events so we need to do it manually.
|
|
64
|
-
event.preventDefault = function() {
|
|
65
|
-
Object.defineProperty(event, 'defaultPrevented', { get: () => true });
|
|
66
|
-
return originalPreventDefault.apply(this, arguments);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
return event;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function dispatchMouseEvent(
|
|
73
|
-
node: Node,
|
|
74
|
-
type: string,
|
|
75
|
-
x = 0,
|
|
76
|
-
y = 0,
|
|
77
|
-
event = createMouseEvent(type, x, y)
|
|
78
|
-
): MouseEvent {
|
|
79
|
-
return dispatchEvent(node, event) as MouseEvent;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/** Creates a browser MouseEvent with the specified options. */
|
|
83
|
-
export function createMouseEvent(type: string, x = 0, y = 0, button = 0) {
|
|
84
|
-
const event = document.createEvent('MouseEvent');
|
|
85
|
-
|
|
86
|
-
event.initMouseEvent(
|
|
87
|
-
type,
|
|
88
|
-
true /* canBubble */,
|
|
89
|
-
false /* cancelable */,
|
|
90
|
-
window /* view */,
|
|
91
|
-
0 /* detail */,
|
|
92
|
-
x /* screenX */,
|
|
93
|
-
y /* screenY */,
|
|
94
|
-
x /* clientX */,
|
|
95
|
-
y /* clientY */,
|
|
96
|
-
false /* ctrlKey */,
|
|
97
|
-
false /* altKey */,
|
|
98
|
-
false /* shiftKey */,
|
|
99
|
-
false /* metaKey */,
|
|
100
|
-
button /* button */,
|
|
101
|
-
null /* relatedTarget */
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
// `initMouseEvent` doesn't allow us to pass the `buttons` and
|
|
105
|
-
// defaults it to 0 which looks like a fake event.
|
|
106
|
-
Object.defineProperty(event, 'buttons', { get: () => 1 });
|
|
107
|
-
|
|
108
|
-
return event;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export class MockNgZone extends NgZone {
|
|
112
|
-
onStable: EventEmitter<any> = new EventEmitter(false);
|
|
113
|
-
constructor() {
|
|
114
|
-
super({ enableLongStackTrace: false });
|
|
115
|
-
}
|
|
116
|
-
run(fn: Function): any {
|
|
117
|
-
return fn();
|
|
118
|
-
}
|
|
119
|
-
runOutsideAngular(fn: Function): any {
|
|
120
|
-
return fn();
|
|
121
|
-
}
|
|
122
|
-
simulateZoneExit(): void {
|
|
123
|
-
this.onStable.emit(null);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
2
|
-
|
|
3
|
-
import 'core-js/es/reflect';
|
|
4
|
-
import 'zone.js';
|
|
5
|
-
import 'zone.js/testing';
|
|
6
|
-
import { getTestBed } from '@angular/core/testing';
|
|
7
|
-
import { provideZoneChangeDetection } from '@angular/core';
|
|
8
|
-
import {
|
|
9
|
-
BrowserDynamicTestingModule,
|
|
10
|
-
platformBrowserDynamicTesting
|
|
11
|
-
} from '@angular/platform-browser-dynamic/testing';
|
|
12
|
-
|
|
13
|
-
// First, initialize the Angular testing environment.
|
|
14
|
-
const testBed = getTestBed();
|
|
15
|
-
testBed.initTestEnvironment(
|
|
16
|
-
BrowserDynamicTestingModule,
|
|
17
|
-
platformBrowserDynamicTesting()
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
// Workaround for Angular 21.0-21.1 where the karma builder doesn't provide zone change detection
|
|
21
|
-
// We patch TestBed.configureTestingModule to always include provideZoneChangeDetection()
|
|
22
|
-
// unless it's already there or there's already a zone provider
|
|
23
|
-
const originalConfigureTestingModule = testBed.configureTestingModule;
|
|
24
|
-
|
|
25
|
-
testBed.configureTestingModule = function(moduleDef: any): any {
|
|
26
|
-
if (!moduleDef) {
|
|
27
|
-
moduleDef = {};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (!moduleDef.providers) {
|
|
31
|
-
moduleDef.providers = [];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Check if provideZoneChangeDetection is already in the providers
|
|
35
|
-
const hasZoneChangeDetection = moduleDef.providers.some((provider: any) => {
|
|
36
|
-
if (!provider) return false;
|
|
37
|
-
// Check if it's the provideZoneChangeDetection function
|
|
38
|
-
return provider.ɵproviders || (typeof provider === 'function' && provider.toString().includes('provideZoneChangeDetection'));
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// Add it if not already present
|
|
42
|
-
if (!hasZoneChangeDetection) {
|
|
43
|
-
moduleDef.providers.push(provideZoneChangeDetection());
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return originalConfigureTestingModule.call(this, moduleDef);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../out-tsc/lib",
|
|
5
|
-
},
|
|
6
|
-
"angularCompilerOptions": {
|
|
7
|
-
"skipTemplateCodegen": true,
|
|
8
|
-
"strictMetadataEmit": true,
|
|
9
|
-
"fullTemplateTypeCheck": true,
|
|
10
|
-
"strictTemplates": false,
|
|
11
|
-
"strictInjectionParameters": true,
|
|
12
|
-
"enableResourceInlining": true,
|
|
13
|
-
"enableIvy": true
|
|
14
|
-
},
|
|
15
|
-
"exclude": [
|
|
16
|
-
"src/test.ts",
|
|
17
|
-
"**/*.spec.ts"
|
|
18
|
-
]
|
|
19
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
<div class="button-row">
|
|
2
|
-
Select demo:
|
|
3
|
-
<button
|
|
4
|
-
(click)="currentTab.set('date-range')"
|
|
5
|
-
[class.active]="currentTab() === 'date-range'">
|
|
6
|
-
Date Range
|
|
7
|
-
</button>
|
|
8
|
-
<button
|
|
9
|
-
(click)="currentTab.set('date-range-dialog')"
|
|
10
|
-
[class.active]="currentTab() === 'date-range-dialog'">
|
|
11
|
-
Date Range (Dialog)
|
|
12
|
-
</button>
|
|
13
|
-
<button
|
|
14
|
-
(click)="currentTab.set('date-time-inline')"
|
|
15
|
-
[class.active]="currentTab() === 'date-time-inline'">
|
|
16
|
-
DateTime Range (Inline)
|
|
17
|
-
</button>
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
<main>
|
|
21
|
-
@switch (currentTab()) {
|
|
22
|
-
@case ('date-range') {
|
|
23
|
-
<label for="daterange">
|
|
24
|
-
Datetime range (click, then press 'Set' to modify):
|
|
25
|
-
</label>
|
|
26
|
-
|
|
27
|
-
<input
|
|
28
|
-
[(ngModel)]="selectedDates"
|
|
29
|
-
[selectMode]="'range'"
|
|
30
|
-
[owlDateTimeTrigger]="date_range_component"
|
|
31
|
-
[owlDateTime]="date_range_component"
|
|
32
|
-
style="width: 100%; color: cornflowerblue"
|
|
33
|
-
id="daterange">
|
|
34
|
-
|
|
35
|
-
<owl-date-time
|
|
36
|
-
#date_range_component
|
|
37
|
-
[startAt]="currentValue"
|
|
38
|
-
[endAt]="endValue"
|
|
39
|
-
(afterPickerClosed)="selectedTrigger($event)"
|
|
40
|
-
(dateSelected)="selectedTrigger($event)">
|
|
41
|
-
</owl-date-time>
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@case ('date-range-dialog') {
|
|
45
|
-
<label for="daterange">
|
|
46
|
-
Datetime range (click, then press 'Set' to modify):
|
|
47
|
-
</label>
|
|
48
|
-
|
|
49
|
-
<input
|
|
50
|
-
[(ngModel)]="selectedDates"
|
|
51
|
-
[selectMode]="'range'"
|
|
52
|
-
[owlDateTimeTrigger]="date_range_component"
|
|
53
|
-
[owlDateTime]="date_range_component"
|
|
54
|
-
style="width: 100%; color: cornflowerblue"
|
|
55
|
-
id="daterange">
|
|
56
|
-
|
|
57
|
-
<owl-date-time
|
|
58
|
-
#date_range_component
|
|
59
|
-
[startAt]="currentValue"
|
|
60
|
-
pickerMode="dialog"
|
|
61
|
-
[endAt]="endValue"
|
|
62
|
-
(afterPickerClosed)="selectedTrigger($event)"
|
|
63
|
-
(dateSelected)="selectedTrigger($event)">
|
|
64
|
-
</owl-date-time>
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@case ('date-time-inline') {
|
|
68
|
-
<owl-date-time-inline
|
|
69
|
-
[(ngModel)]="selectedDates"
|
|
70
|
-
[startAt]="currentValue"
|
|
71
|
-
[endAt]="endValue"
|
|
72
|
-
selectMode="range"
|
|
73
|
-
pickerType="both">
|
|
74
|
-
</owl-date-time-inline>
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
</main>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
.button-row {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: row;
|
|
4
|
-
align-items: center;
|
|
5
|
-
gap: 5px;
|
|
6
|
-
padding: 0.5rem;
|
|
7
|
-
background-color: white;
|
|
8
|
-
|
|
9
|
-
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.5);
|
|
10
|
-
|
|
11
|
-
> button {
|
|
12
|
-
border: none;
|
|
13
|
-
padding: 0.5rem 1rem;
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
|
|
16
|
-
background: white;
|
|
17
|
-
border: 1px solid #aaa;
|
|
18
|
-
border-radius: 4px;
|
|
19
|
-
|
|
20
|
-
&:hover {
|
|
21
|
-
background: #f0f0f0;
|
|
22
|
-
}
|
|
23
|
-
&.active {
|
|
24
|
-
background: #155799;
|
|
25
|
-
color: white;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
main {
|
|
31
|
-
padding: 1rem;
|
|
32
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
import { AppComponent } from './app.component';
|
|
3
|
-
|
|
4
|
-
describe('AppComponent', () => {
|
|
5
|
-
beforeEach(() => {
|
|
6
|
-
TestBed
|
|
7
|
-
.configureTestingModule({ imports: [AppComponent] })
|
|
8
|
-
.compileComponents();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('should create the app', () => {
|
|
12
|
-
const fixture = TestBed.createComponent(AppComponent);
|
|
13
|
-
const app = fixture.debugElement.componentInstance;
|
|
14
|
-
expect(app).toBeTruthy();
|
|
15
|
-
});
|
|
16
|
-
});
|
package/src/app/app.component.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
|
|
2
|
-
import { FormsModule } from '@angular/forms';
|
|
3
|
-
import { OwlDateTimeModule, OwlLuxonDateTimeModule } from '../../projects/picker/src/public_api';
|
|
4
|
-
|
|
5
|
-
/** One day in milliseconds */
|
|
6
|
-
const ONE_DAY = 24 * 60 * 60 * 1000;
|
|
7
|
-
|
|
8
|
-
@Component({
|
|
9
|
-
standalone: true,
|
|
10
|
-
selector: 'app-root',
|
|
11
|
-
templateUrl: './app.component.html',
|
|
12
|
-
styleUrl: './app.component.scss',
|
|
13
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
14
|
-
imports: [
|
|
15
|
-
FormsModule,
|
|
16
|
-
OwlDateTimeModule,
|
|
17
|
-
OwlLuxonDateTimeModule
|
|
18
|
-
]
|
|
19
|
-
})
|
|
20
|
-
export class AppComponent {
|
|
21
|
-
protected readonly currentTab = signal<'date-range' | 'date-range-dialog' | 'date-time-inline'>('date-range');
|
|
22
|
-
|
|
23
|
-
protected selectedDates: [Date, Date] = [
|
|
24
|
-
new Date(Date.now() - ONE_DAY),
|
|
25
|
-
new Date(Date.now() + ONE_DAY)
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
protected currentValue: Date = new Date(this.selectedDates[0]);
|
|
29
|
-
|
|
30
|
-
protected endValue: Date = new Date(this.selectedDates[1]);
|
|
31
|
-
|
|
32
|
-
protected selectedTrigger(date: Date): void {
|
|
33
|
-
console.log(date);
|
|
34
|
-
}
|
|
35
|
-
}
|
package/src/assets/.gitkeep
DELETED
|
File without changes
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// This file can be replaced during build by using the `fileReplacements` array.
|
|
2
|
-
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
|
|
3
|
-
// The list of file replacements can be found in `angular.json`.
|
|
4
|
-
|
|
5
|
-
export const environment = {
|
|
6
|
-
production: false
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* For easier debugging in development mode, you can import the following file
|
|
11
|
-
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
|
12
|
-
*
|
|
13
|
-
* This import should be commented out in production mode because it will have a negative impact
|
|
14
|
-
* on performance if an error is thrown.
|
|
15
|
-
*/
|
|
16
|
-
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
package/src/favicon.ico
DELETED
|
Binary file
|
package/src/index.html
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>DateTimePickerApp</title>
|
|
6
|
-
<base href="/">
|
|
7
|
-
|
|
8
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
9
|
-
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
|
10
|
-
</head>
|
|
11
|
-
<body>
|
|
12
|
-
<app-root></app-root>
|
|
13
|
-
</body>
|
|
14
|
-
</html>
|
package/src/karma.conf.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// Karma configuration file, see link for more information
|
|
2
|
-
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
3
|
-
|
|
4
|
-
module.exports = function (config) {
|
|
5
|
-
config.set({
|
|
6
|
-
basePath: '',
|
|
7
|
-
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
|
8
|
-
plugins: [
|
|
9
|
-
require('karma-jasmine'),
|
|
10
|
-
require('karma-chrome-launcher'),
|
|
11
|
-
require('karma-jasmine-html-reporter'),
|
|
12
|
-
require('karma-coverage'),
|
|
13
|
-
require('@angular-devkit/build-angular/plugins/karma')
|
|
14
|
-
],
|
|
15
|
-
client: {
|
|
16
|
-
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
17
|
-
},
|
|
18
|
-
coverageIstanbulReporter: {
|
|
19
|
-
dir: require('path').join(__dirname, '../coverage'),
|
|
20
|
-
reports: ['html', 'lcovonly'],
|
|
21
|
-
fixWebpackSourcePaths: true
|
|
22
|
-
},
|
|
23
|
-
reporters: ['progress', 'coverage'],
|
|
24
|
-
port: 9876,
|
|
25
|
-
colors: true,
|
|
26
|
-
logLevel: config.LOG_INFO,
|
|
27
|
-
autoWatch: true,
|
|
28
|
-
browsers: ['Chrome'],
|
|
29
|
-
singleRun: false
|
|
30
|
-
});
|
|
31
|
-
};
|
package/src/main.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { bootstrapApplication } from '@angular/platform-browser';
|
|
2
|
-
import { OWL_DATE_TIME_LOCALE, OptionsTokens } from '../projects/picker/src/public_api';
|
|
3
|
-
import { AppComponent } from './app/app.component';
|
|
4
|
-
|
|
5
|
-
bootstrapApplication(AppComponent, {
|
|
6
|
-
providers: [
|
|
7
|
-
{
|
|
8
|
-
provide: OWL_DATE_TIME_LOCALE,
|
|
9
|
-
useValue: 'en-US'
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
provide: OptionsTokens.multiYear,
|
|
13
|
-
useFactory: () => ({ yearRows: 5, yearsPerRow: 3, }),
|
|
14
|
-
},
|
|
15
|
-
]
|
|
16
|
-
})
|
package/src/polyfills.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file includes polyfills needed by Angular and is loaded before the app.
|
|
3
|
-
* You can add your own extra polyfills to this file.
|
|
4
|
-
*
|
|
5
|
-
* This file is divided into 2 sections:
|
|
6
|
-
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
|
7
|
-
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
|
8
|
-
* file.
|
|
9
|
-
*
|
|
10
|
-
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
|
11
|
-
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
|
12
|
-
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
|
13
|
-
*
|
|
14
|
-
* Learn more in https://angular.io/guide/browser-support
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/***************************************************************************************************
|
|
18
|
-
* BROWSER POLYFILLS
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* By default, zone.js will patch all possible macroTask and DomEvents
|
|
23
|
-
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
|
24
|
-
* because those flags need to be set before `zone.js` being loaded, and webpack
|
|
25
|
-
* will put import in the top of bundle, so user need to create a separate file
|
|
26
|
-
* in this directory (for example: zone-flags.ts), and put the following flags
|
|
27
|
-
* into that file, and then add the following code before importing zone.js.
|
|
28
|
-
* import './zone-flags';
|
|
29
|
-
*
|
|
30
|
-
* The flags allowed in zone-flags.ts are listed here.
|
|
31
|
-
*
|
|
32
|
-
* The following flags will work for all browsers.
|
|
33
|
-
*
|
|
34
|
-
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
|
35
|
-
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
|
36
|
-
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
|
37
|
-
*
|
|
38
|
-
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
|
39
|
-
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
|
40
|
-
*
|
|
41
|
-
* (window as any).__Zone_enable_cross_context_check = true;
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
/***************************************************************************************************
|
|
46
|
-
* Zone JS is required by default for Angular itself.
|
|
47
|
-
*/
|
|
48
|
-
import 'zone.js'; // Included with Angular CLI.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
/***************************************************************************************************
|
|
52
|
-
* APPLICATION IMPORTS
|
|
53
|
-
*/
|
package/src/styles.scss
DELETED
package/src/test.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
2
|
-
import 'zone.js';
|
|
3
|
-
import 'zone.js/testing';
|
|
4
|
-
|
|
5
|
-
import { getTestBed } from '@angular/core/testing';
|
|
6
|
-
import { provideZoneChangeDetection } from '@angular/core';
|
|
7
|
-
import {
|
|
8
|
-
BrowserDynamicTestingModule,
|
|
9
|
-
platformBrowserDynamicTesting
|
|
10
|
-
} from '@angular/platform-browser-dynamic/testing';
|
|
11
|
-
|
|
12
|
-
// First, initialize the Angular testing environment.
|
|
13
|
-
const testBed = getTestBed();
|
|
14
|
-
testBed.initTestEnvironment(
|
|
15
|
-
BrowserDynamicTestingModule,
|
|
16
|
-
platformBrowserDynamicTesting()
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
// Workaround for Angular 21.0-21.1 where the karma builder doesn't provide zone change detection
|
|
20
|
-
// We patch TestBed.configureTestingModule to always include provideZoneChangeDetection()
|
|
21
|
-
// unless it's already there or there's already a zone provider
|
|
22
|
-
const originalConfigureTestingModule = testBed.configureTestingModule;
|
|
23
|
-
|
|
24
|
-
testBed.configureTestingModule = function(moduleDef: any): any {
|
|
25
|
-
if (!moduleDef) {
|
|
26
|
-
moduleDef = {};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (!moduleDef.providers) {
|
|
30
|
-
moduleDef.providers = [];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Check if provideZoneChangeDetection is already in the providers
|
|
34
|
-
const hasZoneChangeDetection = moduleDef.providers.some((provider: any) => {
|
|
35
|
-
if (!provider) return false;
|
|
36
|
-
// Check if it's the provideZoneChangeDetection function
|
|
37
|
-
return provider.ɵproviders || (typeof provider === 'function' && provider.toString().includes('provideZoneChangeDetection'));
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// Add it if not already present
|
|
41
|
-
if (!hasZoneChangeDetection) {
|
|
42
|
-
moduleDef.providers.push(provideZoneChangeDetection());
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return originalConfigureTestingModule.call(this, moduleDef);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
package/src/tsconfig.app.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../out-tsc/app",
|
|
5
|
-
},
|
|
6
|
-
"angularCompilerOptions": {
|
|
7
|
-
"fullTemplateTypeCheck": true,
|
|
8
|
-
"strictInjectionParameters": true,
|
|
9
|
-
"strictTemplates": true,
|
|
10
|
-
"enableIvy": true
|
|
11
|
-
},
|
|
12
|
-
"files": [
|
|
13
|
-
"main.ts",
|
|
14
|
-
"polyfills.ts"
|
|
15
|
-
]
|
|
16
|
-
}
|
package/src/tsconfig.spec.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../out-tsc/spec",
|
|
5
|
-
"types": [
|
|
6
|
-
"jasmine",
|
|
7
|
-
"node"
|
|
8
|
-
]
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"test.ts",
|
|
12
|
-
"polyfills.ts"
|
|
13
|
-
],
|
|
14
|
-
"include": [
|
|
15
|
-
"**/*.spec.ts",
|
|
16
|
-
"**/*.d.ts"
|
|
17
|
-
]
|
|
18
|
-
}
|