@imihai/angular-datetime-picker 22.0.0 → 22.0.6
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.6.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,353 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* dialog.service
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
ComponentRef,
|
|
7
|
-
Inject,
|
|
8
|
-
Injectable,
|
|
9
|
-
InjectionToken,
|
|
10
|
-
Injector,
|
|
11
|
-
Optional,
|
|
12
|
-
SkipSelf,
|
|
13
|
-
TemplateRef
|
|
14
|
-
} from '@angular/core';
|
|
15
|
-
import { Location } from '@angular/common';
|
|
16
|
-
import { OwlDialogConfig, OwlDialogConfigInterface } from './dialog-config.class';
|
|
17
|
-
import { OwlDialogRef } from './dialog-ref.class';
|
|
18
|
-
import { OwlDialogContainerComponent } from './dialog-container.component';
|
|
19
|
-
import { extendObject } from '../utils';
|
|
20
|
-
import { defer, Observable, Subject } from 'rxjs';
|
|
21
|
-
import { startWith } from 'rxjs/operators';
|
|
22
|
-
import {
|
|
23
|
-
Overlay,
|
|
24
|
-
OverlayConfig,
|
|
25
|
-
OverlayContainer,
|
|
26
|
-
OverlayRef,
|
|
27
|
-
ScrollStrategy
|
|
28
|
-
} from '@angular/cdk/overlay';
|
|
29
|
-
import {
|
|
30
|
-
ComponentPortal,
|
|
31
|
-
ComponentType,
|
|
32
|
-
} from '@angular/cdk/portal';
|
|
33
|
-
|
|
34
|
-
export const OWL_DIALOG_DATA = new InjectionToken<any>('OwlDialogData');
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Injection token that determines the scroll handling while the dialog is open.
|
|
38
|
-
* */
|
|
39
|
-
export const OWL_DIALOG_SCROLL_STRATEGY = new InjectionToken<
|
|
40
|
-
() => ScrollStrategy
|
|
41
|
-
>('owl-dialog-scroll-strategy');
|
|
42
|
-
|
|
43
|
-
export function OWL_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY(
|
|
44
|
-
overlay: Overlay
|
|
45
|
-
): () => ScrollStrategy {
|
|
46
|
-
const fn = () => overlay.scrollStrategies.block();
|
|
47
|
-
return fn;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** @docs-private */
|
|
51
|
-
export const OWL_DIALOG_SCROLL_STRATEGY_PROVIDER = {
|
|
52
|
-
provide: OWL_DIALOG_SCROLL_STRATEGY,
|
|
53
|
-
deps: [Overlay],
|
|
54
|
-
useFactory: OWL_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Injection token that can be used to specify default dialog options.
|
|
59
|
-
* */
|
|
60
|
-
export const OWL_DIALOG_DEFAULT_OPTIONS = new InjectionToken<OwlDialogConfig>(
|
|
61
|
-
'owl-dialog-default-options'
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
@Injectable()
|
|
65
|
-
export class OwlDialogService {
|
|
66
|
-
private ariaHiddenElements = new Map<Element, string | null>();
|
|
67
|
-
|
|
68
|
-
private _openDialogsAtThisLevel: OwlDialogRef<any>[] = [];
|
|
69
|
-
private _beforeOpenAtThisLevel = new Subject<OwlDialogRef<any>>();
|
|
70
|
-
private _afterOpenAtThisLevel = new Subject<OwlDialogRef<any>>();
|
|
71
|
-
private _afterAllClosedAtThisLevel = new Subject<void>();
|
|
72
|
-
|
|
73
|
-
/** Keeps track of the currently-open dialogs. */
|
|
74
|
-
get openDialogs(): OwlDialogRef<any>[] {
|
|
75
|
-
return this.parentDialog
|
|
76
|
-
? this.parentDialog.openDialogs
|
|
77
|
-
: this._openDialogsAtThisLevel;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/** Stream that emits when a dialog has been opened. */
|
|
81
|
-
get beforeOpen(): Subject<OwlDialogRef<any>> {
|
|
82
|
-
return this.parentDialog
|
|
83
|
-
? this.parentDialog.beforeOpen
|
|
84
|
-
: this._beforeOpenAtThisLevel;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/** Stream that emits when a dialog has been opened. */
|
|
88
|
-
get afterOpen(): Subject<OwlDialogRef<any>> {
|
|
89
|
-
return this.parentDialog
|
|
90
|
-
? this.parentDialog.afterOpen
|
|
91
|
-
: this._afterOpenAtThisLevel;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
get _afterAllClosed(): any {
|
|
95
|
-
const parent = this.parentDialog;
|
|
96
|
-
return parent
|
|
97
|
-
? parent._afterAllClosed
|
|
98
|
-
: this._afterAllClosedAtThisLevel;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Stream that emits when all open dialog have finished closing.
|
|
103
|
-
* Will emit on subscribe if there are no open dialogs to begin with.
|
|
104
|
-
*/
|
|
105
|
-
|
|
106
|
-
afterAllClosed: Observable<{}> = defer(
|
|
107
|
-
() =>
|
|
108
|
-
this._openDialogsAtThisLevel.length
|
|
109
|
-
? this._afterAllClosed
|
|
110
|
-
: this._afterAllClosed.pipe(startWith(undefined))
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
private readonly scrollStrategy: () => ScrollStrategy;
|
|
114
|
-
|
|
115
|
-
constructor(
|
|
116
|
-
private overlay: Overlay,
|
|
117
|
-
private injector: Injector,
|
|
118
|
-
@Optional() private location: Location,
|
|
119
|
-
@Inject(OWL_DIALOG_SCROLL_STRATEGY) scrollStrategy: any,
|
|
120
|
-
@Optional()
|
|
121
|
-
@Inject(OWL_DIALOG_DEFAULT_OPTIONS)
|
|
122
|
-
private defaultOptions: OwlDialogConfigInterface,
|
|
123
|
-
@Optional()
|
|
124
|
-
@SkipSelf()
|
|
125
|
-
private parentDialog: OwlDialogService,
|
|
126
|
-
private overlayContainer: OverlayContainer
|
|
127
|
-
) {
|
|
128
|
-
this.scrollStrategy = scrollStrategy;
|
|
129
|
-
if (!parentDialog && location) {
|
|
130
|
-
location.subscribe(() => this.closeAll());
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
public open<T>(
|
|
135
|
-
componentOrTemplateRef: ComponentType<T> | TemplateRef<T>,
|
|
136
|
-
config?: OwlDialogConfigInterface
|
|
137
|
-
): OwlDialogRef<any> {
|
|
138
|
-
config = applyConfigDefaults(config, this.defaultOptions);
|
|
139
|
-
|
|
140
|
-
if (config.id && this.getDialogById(config.id)) {
|
|
141
|
-
throw Error(
|
|
142
|
-
`Dialog with id "${
|
|
143
|
-
config.id
|
|
144
|
-
}" exists already. The dialog id must be unique.`
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const overlayRef = this.createOverlay(config);
|
|
149
|
-
const dialogContainer = this.attachDialogContainer(overlayRef, config);
|
|
150
|
-
const dialogRef = this.attachDialogContent<T>(
|
|
151
|
-
componentOrTemplateRef,
|
|
152
|
-
dialogContainer,
|
|
153
|
-
overlayRef,
|
|
154
|
-
config
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
if (!this.openDialogs.length) {
|
|
158
|
-
this.hideNonDialogContentFromAssistiveTechnology();
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
this.openDialogs.push(dialogRef);
|
|
162
|
-
dialogRef
|
|
163
|
-
.afterClosed()
|
|
164
|
-
.subscribe(() => this.removeOpenDialog(dialogRef));
|
|
165
|
-
this.beforeOpen.next(dialogRef);
|
|
166
|
-
this.afterOpen.next(dialogRef);
|
|
167
|
-
return dialogRef;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Closes all of the currently-open dialogs.
|
|
172
|
-
*/
|
|
173
|
-
public closeAll(): void {
|
|
174
|
-
let i = this.openDialogs.length;
|
|
175
|
-
|
|
176
|
-
while (i--) {
|
|
177
|
-
this.openDialogs[i].close();
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Finds an open dialog by its id.
|
|
183
|
-
* @param id ID to use when looking up the dialog.
|
|
184
|
-
*/
|
|
185
|
-
public getDialogById(id: string): OwlDialogRef<any> | undefined {
|
|
186
|
-
return this.openDialogs.find(dialog => dialog.id === id);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
private attachDialogContent<T>(
|
|
190
|
-
componentOrTemplateRef: ComponentType<T> | TemplateRef<T>,
|
|
191
|
-
dialogContainer: OwlDialogContainerComponent,
|
|
192
|
-
overlayRef: OverlayRef,
|
|
193
|
-
config: OwlDialogConfigInterface
|
|
194
|
-
) {
|
|
195
|
-
const dialogRef = new OwlDialogRef<T>(
|
|
196
|
-
overlayRef,
|
|
197
|
-
dialogContainer,
|
|
198
|
-
config.id,
|
|
199
|
-
this.location
|
|
200
|
-
);
|
|
201
|
-
|
|
202
|
-
if (config.hasBackdrop) {
|
|
203
|
-
overlayRef.backdropClick().subscribe(() => {
|
|
204
|
-
if (!dialogRef.disableClose) {
|
|
205
|
-
dialogRef.close();
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if (componentOrTemplateRef instanceof TemplateRef) {
|
|
211
|
-
} else {
|
|
212
|
-
const injector = this.createInjector<T>(
|
|
213
|
-
config,
|
|
214
|
-
dialogRef,
|
|
215
|
-
dialogContainer
|
|
216
|
-
);
|
|
217
|
-
const contentRef = dialogContainer.attachComponentPortal(
|
|
218
|
-
new ComponentPortal(componentOrTemplateRef, undefined, injector)
|
|
219
|
-
);
|
|
220
|
-
dialogRef.componentInstance.set(contentRef.instance);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
dialogRef
|
|
224
|
-
.updateSize(config.width, config.height)
|
|
225
|
-
.updatePosition(config.position);
|
|
226
|
-
|
|
227
|
-
return dialogRef;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
private createInjector<T>(
|
|
231
|
-
config: OwlDialogConfigInterface,
|
|
232
|
-
dialogRef: OwlDialogRef<T>,
|
|
233
|
-
dialogContainer: OwlDialogContainerComponent
|
|
234
|
-
) {
|
|
235
|
-
const userInjector =
|
|
236
|
-
config?.viewContainerRef?.injector;
|
|
237
|
-
const providers = [
|
|
238
|
-
{ provide: OwlDialogRef, useValue: dialogRef },
|
|
239
|
-
{ provide: OwlDialogContainerComponent, useValue: dialogContainer },
|
|
240
|
-
{ provide: OWL_DIALOG_DATA, useValue: config?.data },
|
|
241
|
-
];
|
|
242
|
-
|
|
243
|
-
return Injector.create({
|
|
244
|
-
providers,
|
|
245
|
-
parent: userInjector || this.injector,
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
private createOverlay(config: OwlDialogConfigInterface): OverlayRef {
|
|
250
|
-
const overlayConfig = this.getOverlayConfig(config);
|
|
251
|
-
return this.overlay.create(overlayConfig);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
private attachDialogContainer(
|
|
255
|
-
overlayRef: OverlayRef,
|
|
256
|
-
config: OwlDialogConfigInterface
|
|
257
|
-
): OwlDialogContainerComponent {
|
|
258
|
-
const containerPortal = new ComponentPortal(
|
|
259
|
-
OwlDialogContainerComponent,
|
|
260
|
-
config.viewContainerRef
|
|
261
|
-
);
|
|
262
|
-
const containerRef: ComponentRef<
|
|
263
|
-
OwlDialogContainerComponent
|
|
264
|
-
> = overlayRef.attach(containerPortal);
|
|
265
|
-
containerRef.instance.setConfig(config);
|
|
266
|
-
|
|
267
|
-
return containerRef.instance;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
private getOverlayConfig(dialogConfig: OwlDialogConfigInterface): OverlayConfig {
|
|
271
|
-
const state = new OverlayConfig({
|
|
272
|
-
positionStrategy: this.overlay.position().global(),
|
|
273
|
-
scrollStrategy:
|
|
274
|
-
dialogConfig.scrollStrategy || this.scrollStrategy(),
|
|
275
|
-
panelClass: dialogConfig.paneClass,
|
|
276
|
-
hasBackdrop: dialogConfig.hasBackdrop,
|
|
277
|
-
minWidth: dialogConfig.minWidth,
|
|
278
|
-
minHeight: dialogConfig.minHeight,
|
|
279
|
-
maxWidth: dialogConfig.maxWidth,
|
|
280
|
-
maxHeight: dialogConfig.maxHeight
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
if (dialogConfig.backdropClass) {
|
|
284
|
-
state.backdropClass = dialogConfig.backdropClass;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
return state;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
private removeOpenDialog(dialogRef: OwlDialogRef<any>): void {
|
|
291
|
-
const index = this._openDialogsAtThisLevel.indexOf(dialogRef);
|
|
292
|
-
|
|
293
|
-
if (index > -1) {
|
|
294
|
-
this.openDialogs.splice(index, 1);
|
|
295
|
-
// If all the dialogs were closed, remove/restore the `aria-hidden`
|
|
296
|
-
// to a the siblings and emit to the `afterAllClosed` stream.
|
|
297
|
-
if (!this.openDialogs.length) {
|
|
298
|
-
this.ariaHiddenElements.forEach((previousValue, element) => {
|
|
299
|
-
if (previousValue) {
|
|
300
|
-
element.setAttribute('aria-hidden', previousValue);
|
|
301
|
-
} else {
|
|
302
|
-
element.removeAttribute('aria-hidden');
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
this.ariaHiddenElements.clear();
|
|
307
|
-
this._afterAllClosed.next();
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Hides all of the content that isn't an overlay from assistive technology.
|
|
314
|
-
*/
|
|
315
|
-
private hideNonDialogContentFromAssistiveTechnology() {
|
|
316
|
-
const overlayContainer = this.overlayContainer.getContainerElement();
|
|
317
|
-
|
|
318
|
-
// Ensure that the overlay container is attached to the DOM.
|
|
319
|
-
if (overlayContainer.parentElement) {
|
|
320
|
-
const siblings = overlayContainer.parentElement.children;
|
|
321
|
-
|
|
322
|
-
for (let i = siblings.length - 1; i > -1; i--) {
|
|
323
|
-
const sibling = siblings[i];
|
|
324
|
-
|
|
325
|
-
if (
|
|
326
|
-
sibling !== overlayContainer &&
|
|
327
|
-
sibling.nodeName !== 'SCRIPT' &&
|
|
328
|
-
sibling.nodeName !== 'STYLE' &&
|
|
329
|
-
!sibling.hasAttribute('aria-live')
|
|
330
|
-
) {
|
|
331
|
-
this.ariaHiddenElements.set(
|
|
332
|
-
sibling,
|
|
333
|
-
sibling.getAttribute('aria-hidden')
|
|
334
|
-
);
|
|
335
|
-
sibling.setAttribute('aria-hidden', 'true');
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* Applies default options to the dialog config.
|
|
344
|
-
* @param config Config to be modified.
|
|
345
|
-
* @param defaultOptions Default config setting
|
|
346
|
-
* @returns The new configuration object.
|
|
347
|
-
*/
|
|
348
|
-
function applyConfigDefaults(
|
|
349
|
-
config?: OwlDialogConfigInterface,
|
|
350
|
-
defaultOptions?: OwlDialogConfigInterface
|
|
351
|
-
): OwlDialogConfig {
|
|
352
|
-
return extendObject(new OwlDialogConfig(), config, defaultOptions);
|
|
353
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* array.utils
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/** Creates an array and fills it with values. */
|
|
6
|
-
export function range<T>(length: number, valueFunction: (index: number) => T): T[] {
|
|
7
|
-
const valuesArray = Array(length);
|
|
8
|
-
for (let i = 0; i < length; i++) {
|
|
9
|
-
valuesArray[i] = valueFunction(i);
|
|
10
|
-
}
|
|
11
|
-
return valuesArray;
|
|
12
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* constants
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {range} from './array.utils';
|
|
6
|
-
|
|
7
|
-
/** Whether the browser supports the Intl API. */
|
|
8
|
-
export const SUPPORTS_INTL_API = typeof Intl !== 'undefined';
|
|
9
|
-
|
|
10
|
-
/** The default month names to use if Intl API is not available. */
|
|
11
|
-
export const DEFAULT_MONTH_NAMES = {
|
|
12
|
-
long: [
|
|
13
|
-
'January',
|
|
14
|
-
'February',
|
|
15
|
-
'March',
|
|
16
|
-
'April',
|
|
17
|
-
'May',
|
|
18
|
-
'June',
|
|
19
|
-
'July',
|
|
20
|
-
'August',
|
|
21
|
-
'September',
|
|
22
|
-
'October',
|
|
23
|
-
'November',
|
|
24
|
-
'December'
|
|
25
|
-
],
|
|
26
|
-
short: [
|
|
27
|
-
'Jan',
|
|
28
|
-
'Feb',
|
|
29
|
-
'Mar',
|
|
30
|
-
'Apr',
|
|
31
|
-
'May',
|
|
32
|
-
'Jun',
|
|
33
|
-
'Jul',
|
|
34
|
-
'Aug',
|
|
35
|
-
'Sep',
|
|
36
|
-
'Oct',
|
|
37
|
-
'Nov',
|
|
38
|
-
'Dec'
|
|
39
|
-
],
|
|
40
|
-
narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D']
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/** The default day of the week names to use if Intl API is not available. */
|
|
44
|
-
export const DEFAULT_DAY_OF_WEEK_NAMES = {
|
|
45
|
-
long: [
|
|
46
|
-
'Sunday',
|
|
47
|
-
'Monday',
|
|
48
|
-
'Tuesday',
|
|
49
|
-
'Wednesday',
|
|
50
|
-
'Thursday',
|
|
51
|
-
'Friday',
|
|
52
|
-
'Saturday'
|
|
53
|
-
],
|
|
54
|
-
short: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
55
|
-
narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S']
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/** The default date names to use if Intl API is not available. */
|
|
59
|
-
export const DEFAULT_DATE_NAMES = range(31, i => String(i + 1));
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* date.utils
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Creates a date with the given year, month, date, hour, minute and second. Does not allow over/under-flow of the
|
|
7
|
-
* month and date.
|
|
8
|
-
*/
|
|
9
|
-
export function createDate(
|
|
10
|
-
year: number,
|
|
11
|
-
month: number,
|
|
12
|
-
date: number,
|
|
13
|
-
hours: number = 0,
|
|
14
|
-
minutes: number = 0,
|
|
15
|
-
seconds: number = 0
|
|
16
|
-
): Date {
|
|
17
|
-
if (month < 0 || month > 11) {
|
|
18
|
-
throw Error(
|
|
19
|
-
`Invalid month index "${month}". Month index has to be between 0 and 11.`
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (date < 1) {
|
|
24
|
-
throw Error(
|
|
25
|
-
`Invalid date "${date}". Date has to be greater than 0.`
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (hours < 0 || hours > 23) {
|
|
30
|
-
throw Error(
|
|
31
|
-
`Invalid hours "${hours}". Hours has to be between 0 and 23.`
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (minutes < 0 || minutes > 59) {
|
|
36
|
-
throw Error(
|
|
37
|
-
`Invalid minutes "${minutes}". Minutes has to between 0 and 59.`
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (seconds < 0 || seconds > 59) {
|
|
42
|
-
throw Error(
|
|
43
|
-
`Invalid seconds "${seconds}". Seconds has to be between 0 and 59.`
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const result = createDateWithOverflow(
|
|
48
|
-
year,
|
|
49
|
-
month,
|
|
50
|
-
date,
|
|
51
|
-
hours,
|
|
52
|
-
minutes,
|
|
53
|
-
seconds
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
// Check that the date wasn't above the upper bound for the month, causing the month to overflow
|
|
57
|
-
// For example, createDate(2017, 1, 31) would try to create a date 2017/02/31 which is invalid
|
|
58
|
-
if (result.getMonth() !== month) {
|
|
59
|
-
throw Error(
|
|
60
|
-
`Invalid date "${date}" for month with index "${month}".`
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return result;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Gets the number of days in the month of the given date.
|
|
69
|
-
*/
|
|
70
|
-
export function getNumDaysInMonth(date: Date): number {
|
|
71
|
-
const lastDateOfMonth = createDateWithOverflow(
|
|
72
|
-
date.getFullYear(),
|
|
73
|
-
date.getMonth() + 1,
|
|
74
|
-
0
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
return lastDateOfMonth.getDate();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Creates a date but allows the month and date to overflow.
|
|
82
|
-
*/
|
|
83
|
-
function createDateWithOverflow(
|
|
84
|
-
year: number,
|
|
85
|
-
month: number,
|
|
86
|
-
date: number,
|
|
87
|
-
hours: number = 0,
|
|
88
|
-
minutes: number = 0,
|
|
89
|
-
seconds: number = 0
|
|
90
|
-
): Date {
|
|
91
|
-
const result = new Date(year, month, date, hours, minutes, seconds);
|
|
92
|
-
|
|
93
|
-
if (year >= 0 && year < 100) {
|
|
94
|
-
result.setFullYear(result.getFullYear() - 1900);
|
|
95
|
-
}
|
|
96
|
-
return result;
|
|
97
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* object.utils
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Extends an object with the *enumerable* and *own* properties of one or more source objects,
|
|
8
|
-
* similar to Object.assign.
|
|
9
|
-
*
|
|
10
|
-
* @param dest The object which will have properties copied to it.
|
|
11
|
-
* @param sources The source objects from which properties will be copied.
|
|
12
|
-
*/
|
|
13
|
-
export function extendObject(dest: any, ...sources: any[]): any {
|
|
14
|
-
if (dest == null) {
|
|
15
|
-
throw TypeError('Cannot convert undefined or null to object');
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
for (const source of sources) {
|
|
19
|
-
if (source != null) {
|
|
20
|
-
for (const key in source) {
|
|
21
|
-
if (source.hasOwnProperty(key)) {
|
|
22
|
-
dest[key] = source[key];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return dest;
|
|
29
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* picker
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export { OwlDateTimeModule } from './lib/date-time/date-time.module';
|
|
6
|
-
|
|
7
|
-
export { OwlDateTimeIntl } from './lib/date-time/date-time-picker-intl.service';
|
|
8
|
-
|
|
9
|
-
export { OwlLuxonDateTimeModule } from './lib/date-time/adapter/luxon-date-time.module';
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
OWL_DATE_TIME_LOCALE_PROVIDER,
|
|
13
|
-
OWL_DATE_TIME_LOCALE,
|
|
14
|
-
DateTimeAdapter,
|
|
15
|
-
|
|
16
|
-
} from './lib/date-time/adapter/date-time-adapter.class';
|
|
17
|
-
|
|
18
|
-
export { OWL_DATE_TIME_FORMATS, OwlDateTimeFormats } from './lib/date-time/adapter/date-time-format.class';
|
|
19
|
-
|
|
20
|
-
export {
|
|
21
|
-
UnixTimestampDateTimeAdapter
|
|
22
|
-
} from './lib/date-time/adapter/unix-timestamp-adapter/unix-timestamp-date-time-adapter.class';
|
|
23
|
-
|
|
24
|
-
export { OWL_UNIX_TIMESTAMP_DATE_TIME_FORMATS } from './lib/date-time/adapter/unix-timestamp-adapter/unix-timestamp-date-time-format.class';
|
|
25
|
-
|
|
26
|
-
export { OwlDateTimeInlineComponent } from './lib/date-time/date-time-inline.component';
|
|
27
|
-
|
|
28
|
-
export { OwlDateTimeComponent } from './lib/date-time/date-time-picker.component';
|
|
29
|
-
|
|
30
|
-
export * from './lib/date-time/calendar-body.component';
|
|
31
|
-
|
|
32
|
-
export * from './lib/date-time/timer.component';
|
|
33
|
-
|
|
34
|
-
export * from './lib/date-time/date-time-picker-trigger.directive';
|
|
35
|
-
|
|
36
|
-
export * from './lib/date-time/date-time-picker-input.directive';
|
|
37
|
-
|
|
38
|
-
export * from './lib/date-time/calendar-multi-year-view.component';
|
|
39
|
-
|
|
40
|
-
export * from './lib/date-time/adapter/luxon-date-time-adapter.class';
|
|
41
|
-
|
|
42
|
-
export * from './lib/date-time/adapter/luxon-date-time-format.class';
|
|
43
|
-
|
|
44
|
-
export * from './lib/date-time/adapter/luxon-date-time.module';
|
|
45
|
-
|
|
46
|
-
export * from './lib/date-time/calendar-year-view.component';
|
|
47
|
-
|
|
48
|
-
export * from './lib/date-time/calendar-month-view.component';
|
|
49
|
-
|
|
50
|
-
export * from './lib/date-time/calendar.component';
|
|
51
|
-
|
|
52
|
-
export * from './lib/date-time/timer.component';
|
|
53
|
-
|
|
54
|
-
export * from './lib/date-time/options-provider';
|
|
55
|
-
|
|
56
|
-
export { PickerType, PickerMode, SelectMode, DateView, DateViewType } from './lib/date-time/date-time.class'
|