@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,231 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* dialog-container.component
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
Component,
|
|
7
|
-
ComponentRef,
|
|
8
|
-
ElementRef,
|
|
9
|
-
EmbeddedViewRef,
|
|
10
|
-
EventEmitter,
|
|
11
|
-
Inject,
|
|
12
|
-
OnInit,
|
|
13
|
-
Optional,
|
|
14
|
-
signal,
|
|
15
|
-
ViewChild,
|
|
16
|
-
} from '@angular/core';
|
|
17
|
-
import { DOCUMENT } from '@angular/common';
|
|
18
|
-
import { FocusTrap, FocusTrapFactory } from '@angular/cdk/a11y';
|
|
19
|
-
import {
|
|
20
|
-
BasePortalOutlet,
|
|
21
|
-
CdkPortalOutlet,
|
|
22
|
-
ComponentPortal,
|
|
23
|
-
TemplatePortal,
|
|
24
|
-
} from '@angular/cdk/portal';
|
|
25
|
-
import { OwlDateTimeContainerComponent } from '../date-time/date-time-picker-container.component';
|
|
26
|
-
import { IDateTimePickerAnimationEvent } from '../date-time/date-time-picker-animation-event';
|
|
27
|
-
import { OwlDialogConfigInterface } from './dialog-config.class';
|
|
28
|
-
|
|
29
|
-
@Component({
|
|
30
|
-
selector: 'owl-dialog-container',
|
|
31
|
-
templateUrl: './dialog-container.component.html',
|
|
32
|
-
standalone: false,
|
|
33
|
-
host: {
|
|
34
|
-
'[class.owl-dialog-container]': 'owlDialogContainerClass',
|
|
35
|
-
'[attr.tabindex]': 'owlDialogContainerTabIndex',
|
|
36
|
-
'[attr.id]': 'owlDialogContainerId',
|
|
37
|
-
'[attr.role]': 'owlDialogContainerRole',
|
|
38
|
-
'[attr.aria-labelledby]': 'owlDialogContainerAriaLabelledby',
|
|
39
|
-
'[attr.aria-describedby]': 'owlDialogContainerAriaDescribedby'
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
export class OwlDialogContainerComponent extends BasePortalOutlet
|
|
43
|
-
implements OnInit {
|
|
44
|
-
@ViewChild(CdkPortalOutlet, { static: true })
|
|
45
|
-
portalOutlet: CdkPortalOutlet | null = null;
|
|
46
|
-
|
|
47
|
-
/** The class that traps and manages focus within the dialog. */
|
|
48
|
-
private focusTrap: FocusTrap;
|
|
49
|
-
|
|
50
|
-
/** ID of the element that should be considered as the dialog's label. */
|
|
51
|
-
public ariaLabelledBy: string | null = null;
|
|
52
|
-
|
|
53
|
-
/** Emits when an animation state changes. */
|
|
54
|
-
public animationStateChanged = new EventEmitter<IDateTimePickerAnimationEvent>();
|
|
55
|
-
|
|
56
|
-
public isAnimating = signal(false);
|
|
57
|
-
|
|
58
|
-
private _config: OwlDialogConfigInterface;
|
|
59
|
-
private _component: ComponentRef<unknown>;
|
|
60
|
-
get config(): OwlDialogConfigInterface {
|
|
61
|
-
return this._config;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// for animation purpose
|
|
65
|
-
private params: any = {
|
|
66
|
-
x: '0px',
|
|
67
|
-
y: '0px',
|
|
68
|
-
ox: '50%',
|
|
69
|
-
oy: '50%',
|
|
70
|
-
scale: 0
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
// A variable to hold the focused element before the dialog was open.
|
|
74
|
-
// This would help us to refocus back to element when the dialog was closed.
|
|
75
|
-
private elementFocusedBeforeDialogWasOpened: HTMLElement | null = null;
|
|
76
|
-
|
|
77
|
-
get owlDialogContainerClass(): boolean {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
get owlDialogContainerTabIndex(): number {
|
|
82
|
-
return -1;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
get owlDialogContainerId(): string {
|
|
86
|
-
return this._config.id;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
get owlDialogContainerRole(): string {
|
|
90
|
-
return this._config.role || null;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
get owlDialogContainerAriaLabelledby(): string {
|
|
94
|
-
return this.ariaLabelledBy;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
get owlDialogContainerAriaDescribedby(): string {
|
|
98
|
-
return this._config.ariaDescribedBy || null;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
constructor(
|
|
102
|
-
private elementRef: ElementRef,
|
|
103
|
-
private focusTrapFactory: FocusTrapFactory,
|
|
104
|
-
@Optional()
|
|
105
|
-
@Inject(DOCUMENT)
|
|
106
|
-
private document: any,
|
|
107
|
-
) {
|
|
108
|
-
super();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
public ngOnInit() {}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Attach a ComponentPortal as content to this dialog container.
|
|
115
|
-
*/
|
|
116
|
-
public attachComponentPortal<T>(
|
|
117
|
-
portal: ComponentPortal<T>,
|
|
118
|
-
): ComponentRef<T> {
|
|
119
|
-
if (this.portalOutlet.hasAttached()) {
|
|
120
|
-
throw Error(
|
|
121
|
-
'Attempting to attach dialog content after content is already attached',
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
this.savePreviouslyFocusedElement();
|
|
126
|
-
const component = this.portalOutlet.attachComponentPortal(portal);
|
|
127
|
-
const pickerContainer = component.instance as OwlDateTimeContainerComponent<unknown>;
|
|
128
|
-
pickerContainer.animationStateChanged.subscribe(state => this.onAnimationDone(state));
|
|
129
|
-
this._component = component;
|
|
130
|
-
return component;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
public attachTemplatePortal<C>(
|
|
134
|
-
portal: TemplatePortal<C>,
|
|
135
|
-
): EmbeddedViewRef<C> {
|
|
136
|
-
throw new Error('Method not implemented.');
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
public setConfig(config: OwlDialogConfigInterface): void {
|
|
140
|
-
this._config = config;
|
|
141
|
-
|
|
142
|
-
if (config.event) {
|
|
143
|
-
this.calculateZoomOrigin(event);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
public onAnimationStart(event: IDateTimePickerAnimationEvent): void {
|
|
148
|
-
this.isAnimating.set(true);
|
|
149
|
-
this.animationStateChanged.emit(event);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
public onAnimationDone(event: IDateTimePickerAnimationEvent): void {
|
|
153
|
-
if (event.toState === 'enter') {
|
|
154
|
-
this.trapFocus();
|
|
155
|
-
} else if (event.toState === 'leave') {
|
|
156
|
-
this.restoreFocus();
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
this.animationStateChanged.emit(event);
|
|
160
|
-
this.isAnimating.set(false);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
public startExitAnimation() {
|
|
164
|
-
this._component.destroy();
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Calculate origin used in the `zoomFadeInFrom()`
|
|
169
|
-
* for animation purpose
|
|
170
|
-
*/
|
|
171
|
-
private calculateZoomOrigin(event: any): void {
|
|
172
|
-
if (!event) {
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const clientX = event.clientX;
|
|
177
|
-
const clientY = event.clientY;
|
|
178
|
-
|
|
179
|
-
const wh = window.innerWidth / 2;
|
|
180
|
-
const hh = window.innerHeight / 2;
|
|
181
|
-
const x = clientX - wh;
|
|
182
|
-
const y = clientY - hh;
|
|
183
|
-
const ox = clientX / window.innerWidth;
|
|
184
|
-
const oy = clientY / window.innerHeight;
|
|
185
|
-
|
|
186
|
-
this.params.x = `${x}px`;
|
|
187
|
-
this.params.y = `${y}px`;
|
|
188
|
-
this.params.ox = `${ox * 100}%`;
|
|
189
|
-
this.params.oy = `${oy * 100}%`;
|
|
190
|
-
this.params.scale = 0;
|
|
191
|
-
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Save the focused element before dialog was open
|
|
197
|
-
*/
|
|
198
|
-
private savePreviouslyFocusedElement(): void {
|
|
199
|
-
if (this.document) {
|
|
200
|
-
this.elementFocusedBeforeDialogWasOpened = this.document
|
|
201
|
-
.activeElement as HTMLElement;
|
|
202
|
-
|
|
203
|
-
Promise.resolve().then(() => this.elementRef.nativeElement.focus());
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
private trapFocus(): void {
|
|
208
|
-
if (!this.focusTrap) {
|
|
209
|
-
this.focusTrap = this.focusTrapFactory.create(
|
|
210
|
-
this.elementRef.nativeElement,
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (this._config.autoFocus) {
|
|
215
|
-
this.focusTrap.focusInitialElementWhenReady();
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
private restoreFocus(): void {
|
|
220
|
-
const toFocus = this.elementFocusedBeforeDialogWasOpened;
|
|
221
|
-
|
|
222
|
-
// We need the extra check, because IE can set the `activeElement` to null in some cases.
|
|
223
|
-
if (toFocus && typeof toFocus.focus === 'function') {
|
|
224
|
-
toFocus.focus();
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (this.focusTrap) {
|
|
228
|
-
this.focusTrap.destroy();
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* dialog-ref.class
|
|
3
|
-
*/
|
|
4
|
-
import { ESCAPE } from '@angular/cdk/keycodes';
|
|
5
|
-
import { GlobalPositionStrategy, OverlayRef } from '@angular/cdk/overlay';
|
|
6
|
-
import { Location } from '@angular/common';
|
|
7
|
-
import { Signal, signal } from '@angular/core';
|
|
8
|
-
import { Observable, Subject, Subscription, SubscriptionLike, filter, take } from 'rxjs';
|
|
9
|
-
import { IDateTimePickerAnimationEvent } from '../date-time/date-time-picker-animation-event';
|
|
10
|
-
import { DialogPosition } from './dialog-config.class';
|
|
11
|
-
import { OwlDialogContainerComponent } from './dialog-container.component';
|
|
12
|
-
|
|
13
|
-
export class OwlDialogRef<T> {
|
|
14
|
-
|
|
15
|
-
private result: any;
|
|
16
|
-
|
|
17
|
-
private _beforeClose$ = new Subject<any>();
|
|
18
|
-
|
|
19
|
-
private _beforeOpen$ = new Subject<any>();
|
|
20
|
-
|
|
21
|
-
private _afterOpen$ = new Subject<any>();
|
|
22
|
-
|
|
23
|
-
private _afterClosed$ = new Subject<any>();
|
|
24
|
-
|
|
25
|
-
/** Subscription to changes in the user's location. */
|
|
26
|
-
private locationChanged: SubscriptionLike = Subscription.EMPTY;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* The instance of component opened into modal
|
|
30
|
-
* */
|
|
31
|
-
public componentInstance = signal<T | undefined>(undefined);
|
|
32
|
-
|
|
33
|
-
/** Whether the user is allowed to close the dialog. */
|
|
34
|
-
public disableClose = true;
|
|
35
|
-
|
|
36
|
-
constructor(private overlayRef: OverlayRef,
|
|
37
|
-
private container: OwlDialogContainerComponent,
|
|
38
|
-
public readonly id: string,
|
|
39
|
-
location?: Location) {
|
|
40
|
-
this.disableClose = this.container.config.disableClose;
|
|
41
|
-
|
|
42
|
-
this.container.animationStateChanged
|
|
43
|
-
.pipe(
|
|
44
|
-
filter(( event: IDateTimePickerAnimationEvent ) => event.phaseName === 'start' && event.toState === 'enter'),
|
|
45
|
-
take(1)
|
|
46
|
-
)
|
|
47
|
-
.subscribe(() => {
|
|
48
|
-
this._beforeOpen$.next(null);
|
|
49
|
-
this._beforeOpen$.complete();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
this.container.animationStateChanged
|
|
53
|
-
.pipe(
|
|
54
|
-
filter(( event: IDateTimePickerAnimationEvent ) => event.phaseName === 'done' && event.toState === 'enter'),
|
|
55
|
-
take(1)
|
|
56
|
-
)
|
|
57
|
-
.subscribe(() => {
|
|
58
|
-
this._afterOpen$.next(null);
|
|
59
|
-
this._afterOpen$.complete();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
this.container.animationStateChanged
|
|
63
|
-
.pipe(
|
|
64
|
-
filter((event: IDateTimePickerAnimationEvent) => event.phaseName === 'done' && event.toState === 'leave'),
|
|
65
|
-
take(1)
|
|
66
|
-
)
|
|
67
|
-
.subscribe(() => {
|
|
68
|
-
this.overlayRef.dispose();
|
|
69
|
-
this.locationChanged.unsubscribe();
|
|
70
|
-
this._afterClosed$.next(this.result);
|
|
71
|
-
this._afterClosed$.complete();
|
|
72
|
-
this.componentInstance.set(undefined);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
this.overlayRef.keydownEvents()
|
|
76
|
-
.pipe(filter(event => event.keyCode === ESCAPE && !this.disableClose))
|
|
77
|
-
.subscribe(() => this.close());
|
|
78
|
-
|
|
79
|
-
if (location) {
|
|
80
|
-
this.locationChanged = location.subscribe(() => {
|
|
81
|
-
if (this.container.config.closeOnNavigation) {
|
|
82
|
-
this.close();
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
public close(dialogResult?: any) {
|
|
89
|
-
this.result = dialogResult;
|
|
90
|
-
|
|
91
|
-
this.container.animationStateChanged
|
|
92
|
-
.pipe(
|
|
93
|
-
filter(event => event.phaseName === 'start'),
|
|
94
|
-
take(1)
|
|
95
|
-
)
|
|
96
|
-
.subscribe(() => {
|
|
97
|
-
this._beforeClose$.next(dialogResult);
|
|
98
|
-
this._beforeClose$.complete();
|
|
99
|
-
this.overlayRef.detachBackdrop();
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
this.container.startExitAnimation();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Gets an observable that emits when the overlay's backdrop has been clicked.
|
|
107
|
-
*/
|
|
108
|
-
public backdropClick(): Observable<any> {
|
|
109
|
-
return this.overlayRef.backdropClick();
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Gets an observable that emits when keydown events are targeted on the overlay.
|
|
114
|
-
*/
|
|
115
|
-
public keydownEvents(): Observable<KeyboardEvent> {
|
|
116
|
-
return this.overlayRef.keydownEvents();
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Updates the dialog's position.
|
|
121
|
-
* @param position New dialog position.
|
|
122
|
-
*/
|
|
123
|
-
public updatePosition(position?: DialogPosition): this {
|
|
124
|
-
const strategy = this.getPositionStrategy();
|
|
125
|
-
|
|
126
|
-
if (position && (position.left || position.right)) {
|
|
127
|
-
position.left ? strategy.left(position.left) : strategy.right(position.right);
|
|
128
|
-
} else {
|
|
129
|
-
strategy.centerHorizontally();
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (position && (position.top || position.bottom)) {
|
|
133
|
-
position.top ? strategy.top(position.top) : strategy.bottom(position.bottom);
|
|
134
|
-
} else {
|
|
135
|
-
strategy.centerVertically();
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
this.overlayRef.updatePosition();
|
|
139
|
-
|
|
140
|
-
return this;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Updates the dialog's width and height.
|
|
145
|
-
* @param width New width of the dialog.
|
|
146
|
-
* @param height New height of the dialog.
|
|
147
|
-
*/
|
|
148
|
-
updateSize(width: string = 'auto', height: string = 'auto'): this {
|
|
149
|
-
this.getPositionStrategy().width(width).height(height);
|
|
150
|
-
this.overlayRef.updatePosition();
|
|
151
|
-
return this;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
public isAnimating(): Signal<boolean> {
|
|
155
|
-
return this.container.isAnimating;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
public beforeOpen(): Observable<any> {
|
|
159
|
-
return this._beforeOpen$.asObservable();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
public afterOpen(): Observable<any> {
|
|
163
|
-
return this._afterOpen$.asObservable();
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
public beforeClose(): Observable<any> {
|
|
167
|
-
return this._beforeClose$.asObservable();
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
public afterClosed(): Observable<any> {
|
|
171
|
-
return this._afterClosed$.asObservable();
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/** Fetches the position strategy object from the overlay ref. */
|
|
175
|
-
private getPositionStrategy(): GlobalPositionStrategy {
|
|
176
|
-
return this.overlayRef.getConfig().positionStrategy as GlobalPositionStrategy;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* dialog.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 { PortalModule } from '@angular/cdk/portal';
|
|
10
|
-
import { OWL_DIALOG_SCROLL_STRATEGY_PROVIDER, OwlDialogService } from './dialog.service';
|
|
11
|
-
import { OwlDialogContainerComponent } from './dialog-container.component';
|
|
12
|
-
|
|
13
|
-
@NgModule({
|
|
14
|
-
imports: [CommonModule, A11yModule, OverlayModule, PortalModule],
|
|
15
|
-
exports: [],
|
|
16
|
-
declarations: [
|
|
17
|
-
OwlDialogContainerComponent,
|
|
18
|
-
],
|
|
19
|
-
providers: [
|
|
20
|
-
OWL_DIALOG_SCROLL_STRATEGY_PROVIDER,
|
|
21
|
-
OwlDialogService,
|
|
22
|
-
]
|
|
23
|
-
})
|
|
24
|
-
export class OwlDialogModule {
|
|
25
|
-
}
|