@quadrel-enterprise-ui/page-leave-handler 1.0.0 → 18.1.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/README.md +62 -0
- package/esm2022/lib/qd-page-leave-handler.component.mjs +28 -0
- package/esm2022/lib/qd-page-leave-handler.module.mjs +17 -0
- package/esm2022/lib/qd-page-leave-handler.service.mjs +13 -0
- package/esm2022/public-api.mjs +7 -0
- package/esm2022/quadrel-enterprise-ui-page-leave-handler.mjs +5 -0
- package/fesm2022/quadrel-enterprise-ui-page-leave-handler.mjs +64 -0
- package/fesm2022/quadrel-enterprise-ui-page-leave-handler.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/qd-page-leave-handler.component.d.ts +9 -0
- package/lib/qd-page-leave-handler.module.d.ts +7 -0
- package/lib/qd-page-leave-handler.service.d.ts +5 -0
- package/package.json +30 -9
- package/public-api.d.ts +6 -0
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<img src="https://confluence.bit.admin.ch/download/attachments/268095262/image2020-9-11_14-33-29.png" width="500">
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Quadrel Services - Package for handling the page leave event
|
|
6
|
+
|
|
7
|
+
## Build
|
|
8
|
+
|
|
9
|
+
Run `nx build qd-page-leave-handler` to build the project. The build artifacts will be stored in the `dist/libs/qd-page-leave-handler` directory. Use `--configuration production` for a production build.
|
|
10
|
+
|
|
11
|
+
## Developement
|
|
12
|
+
|
|
13
|
+
Run `npm run start` or `nx serve` to start the test app for development. The test app integrates all libraries of the monorepo.
|
|
14
|
+
|
|
15
|
+
## Running unit tests
|
|
16
|
+
|
|
17
|
+
Run `nx test qd-page-leave-handler` to execute the unit tests.
|
|
18
|
+
|
|
19
|
+
## Release
|
|
20
|
+
|
|
21
|
+
Releases can be made on a release branch with the following commands:
|
|
22
|
+
|
|
23
|
+
Run `nx release-patch qd-page-leave-handler` to create a patch release.
|
|
24
|
+
|
|
25
|
+
Run `nx release-minor qd-page-leave-handler` to create a minor release.
|
|
26
|
+
|
|
27
|
+
Run `nx release-major qd-page-leave-handler` to create a major release.
|
|
28
|
+
|
|
29
|
+
Run `nx prerelease qd-page-leave-handler` to create a beta release.
|
|
30
|
+
|
|
31
|
+
Run `nx premajor qd-page-leave-handler` to create a beta major release.
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
### Install the package
|
|
36
|
+
|
|
37
|
+
Run `npm i -D @quadrel-services/qd-page-leave-handler` to add the package in the dependencies.
|
|
38
|
+
|
|
39
|
+
### In your app.module
|
|
40
|
+
|
|
41
|
+
```javascript
|
|
42
|
+
import { QdPageLeaveHandlerModule } from '@quadrel-services/qd-page-leave-handler';
|
|
43
|
+
|
|
44
|
+
...
|
|
45
|
+
|
|
46
|
+
@NgModule({
|
|
47
|
+
...
|
|
48
|
+
imports: [
|
|
49
|
+
...
|
|
50
|
+
QdPageLeaveHandlerModule
|
|
51
|
+
],
|
|
52
|
+
...
|
|
53
|
+
})
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### In your template
|
|
57
|
+
|
|
58
|
+
```html
|
|
59
|
+
<qd-page-leave-handler [callBeforeLeaving]="myCallback">
|
|
60
|
+
<p>some optional markup</p>
|
|
61
|
+
</qd-page-leave-handler>
|
|
62
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Component, HostListener, Input } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export class QdPageLeaveHandlerComponent {
|
|
4
|
+
callBeforeLeaving;
|
|
5
|
+
unloadHandler(event) {
|
|
6
|
+
if (this.callBeforeLeaving !== undefined) {
|
|
7
|
+
this.callBeforeLeaving();
|
|
8
|
+
}
|
|
9
|
+
event.returnValue = false;
|
|
10
|
+
}
|
|
11
|
+
ngOnDestroy() {
|
|
12
|
+
this.unloadHandler = () => {
|
|
13
|
+
/* interrupt event handler */
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
17
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.9", type: QdPageLeaveHandlerComponent, selector: "qd-page-leave-handler", inputs: { callBeforeLeaving: "callBeforeLeaving" }, host: { listeners: { "window:beforeunload": "unloadHandler($event)" } }, ngImport: i0, template: "<ng-content></ng-content>\n" });
|
|
18
|
+
}
|
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerComponent, decorators: [{
|
|
20
|
+
type: Component,
|
|
21
|
+
args: [{ selector: 'qd-page-leave-handler', template: "<ng-content></ng-content>\n" }]
|
|
22
|
+
}], propDecorators: { callBeforeLeaving: [{
|
|
23
|
+
type: Input
|
|
24
|
+
}], unloadHandler: [{
|
|
25
|
+
type: HostListener,
|
|
26
|
+
args: ['window:beforeunload', ['$event']]
|
|
27
|
+
}] } });
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicWQtcGFnZS1sZWF2ZS1oYW5kbGVyLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2xpYnMvcWQtcGFnZS1sZWF2ZS1oYW5kbGVyL3NyYy9saWIvcWQtcGFnZS1sZWF2ZS1oYW5kbGVyLmNvbXBvbmVudC50cyIsIi4uLy4uLy4uLy4uLy4uL2xpYnMvcWQtcGFnZS1sZWF2ZS1oYW5kbGVyL3NyYy9saWIvcWQtcGFnZS1sZWF2ZS1oYW5kbGVyLmNvbXBvbmVudC5odG1sIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSx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BJbnB1dCgpIGNhbGxCZWZvcmVMZWF2aW5nOiAoKSA9PiB1bmtub3duO1xuICBASG9zdExpc3RlbmVyKCd3aW5kb3c6YmVmb3JldW5sb2FkJywgWyckZXZlbnQnXSkgdW5sb2FkSGFuZGxlcihldmVudDogRXZlbnQpIHtcbiAgICBpZiAodGhpcy5jYWxsQmVmb3JlTGVhdmluZyAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICB0aGlzLmNhbGxCZWZvcmVMZWF2aW5nKCk7XG4gICAgfVxuXG4gICAgZXZlbnQucmV0dXJuVmFsdWUgPSBmYWxzZTtcbiAgfVxuXG4gIG5nT25EZXN0cm95KCkge1xuICAgIHRoaXMudW5sb2FkSGFuZGxlciA9ICgpOiB2b2lkID0+IHtcbiAgICAgIC8qIGludGVycnVwdCBldmVudCBoYW5kbGVyICovXG4gICAgfTtcbiAgfVxufVxuIiwiPG5nLWNvbnRlbnQ+PC9uZy1jb250ZW50PlxuIl19
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { QdPageLeaveHandlerComponent } from './qd-page-leave-handler.component';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export class QdPageLeaveHandlerModule {
|
|
5
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
6
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerModule, declarations: [QdPageLeaveHandlerComponent], exports: [QdPageLeaveHandlerComponent] });
|
|
7
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerModule });
|
|
8
|
+
}
|
|
9
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerModule, decorators: [{
|
|
10
|
+
type: NgModule,
|
|
11
|
+
args: [{
|
|
12
|
+
declarations: [QdPageLeaveHandlerComponent],
|
|
13
|
+
imports: [],
|
|
14
|
+
exports: [QdPageLeaveHandlerComponent]
|
|
15
|
+
}]
|
|
16
|
+
}] });
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicWQtcGFnZS1sZWF2ZS1oYW5kbGVyLm1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2xpYnMvcWQtcGFnZS1sZWF2ZS1oYW5kbGVyL3NyYy9saWIvcWQtcGFnZS1sZWF2ZS1oYW5kbGVyLm1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3pDLE9BQU8sRUFBRSwyQkFBMkIsRUFBRSxNQUFNLG1DQUFtQyxDQUFDOztBQU9oRixNQUFNLE9BQU8sd0JBQXdCO3VHQUF4Qix3QkFBd0I7d0dBQXhCLHdCQUF3QixpQkFKcEIsMkJBQTJCLGFBRWhDLDJCQUEyQjt3R0FFMUIsd0JBQXdCOzsyRkFBeEIsd0JBQXdCO2tCQUxwQyxRQUFRO21CQUFDO29CQUNSLFlBQVksRUFBRSxDQUFDLDJCQUEyQixDQUFDO29CQUMzQyxPQUFPLEVBQUUsRUFBRTtvQkFDWCxPQUFPLEVBQUUsQ0FBQywyQkFBMkIsQ0FBQztpQkFDdkMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBOZ01vZHVsZSB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuaW1wb3J0IHsgUWRQYWdlTGVhdmVIYW5kbGVyQ29tcG9uZW50IH0gZnJvbSAnLi9xZC1wYWdlLWxlYXZlLWhhbmRsZXIuY29tcG9uZW50JztcblxuQE5nTW9kdWxlKHtcbiAgZGVjbGFyYXRpb25zOiBbUWRQYWdlTGVhdmVIYW5kbGVyQ29tcG9uZW50XSxcbiAgaW1wb3J0czogW10sXG4gIGV4cG9ydHM6IFtRZFBhZ2VMZWF2ZUhhbmRsZXJDb21wb25lbnRdXG59KVxuZXhwb3J0IGNsYXNzIFFkUGFnZUxlYXZlSGFuZGxlck1vZHVsZSB7fVxuIl19
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export class QdPageLeaveHandlerService {
|
|
4
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerService, providedIn: 'root' });
|
|
6
|
+
}
|
|
7
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerService, decorators: [{
|
|
8
|
+
type: Injectable,
|
|
9
|
+
args: [{
|
|
10
|
+
providedIn: 'root'
|
|
11
|
+
}]
|
|
12
|
+
}] });
|
|
13
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicWQtcGFnZS1sZWF2ZS1oYW5kbGVyLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzL3FkLXBhZ2UtbGVhdmUtaGFuZGxlci9zcmMvbGliL3FkLXBhZ2UtbGVhdmUtaGFuZGxlci5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7O0FBSzNDLE1BQU0sT0FBTyx5QkFBeUI7dUdBQXpCLHlCQUF5QjsyR0FBekIseUJBQXlCLGNBRnhCLE1BQU07OzJGQUVQLHlCQUF5QjtrQkFIckMsVUFBVTttQkFBQztvQkFDVixVQUFVLEVBQUUsTUFBTTtpQkFDbkIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBJbmplY3RhYmxlIH0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5cbkBJbmplY3RhYmxlKHtcbiAgcHJvdmlkZWRJbjogJ3Jvb3QnXG59KVxuZXhwb3J0IGNsYXNzIFFkUGFnZUxlYXZlSGFuZGxlclNlcnZpY2Uge31cbiJdfQ==
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API Surface of qd-page-leave-handler
|
|
3
|
+
*/
|
|
4
|
+
export * from './lib/qd-page-leave-handler.service';
|
|
5
|
+
export * from './lib/qd-page-leave-handler.component';
|
|
6
|
+
export * from './lib/qd-page-leave-handler.module';
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYnMvcWQtcGFnZS1sZWF2ZS1oYW5kbGVyL3NyYy9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsY0FBYyxxQ0FBcUMsQ0FBQztBQUNwRCxjQUFjLHVDQUF1QyxDQUFDO0FBQ3RELGNBQWMsb0NBQW9DLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqICBQdWJsaWMgQVBJIFN1cmZhY2Ugb2YgcWQtcGFnZS1sZWF2ZS1oYW5kbGVyXG4gKi9cbmV4cG9ydCAqIGZyb20gJy4vbGliL3FkLXBhZ2UtbGVhdmUtaGFuZGxlci5zZXJ2aWNlJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3FkLXBhZ2UtbGVhdmUtaGFuZGxlci5jb21wb25lbnQnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvcWQtcGFnZS1sZWF2ZS1oYW5kbGVyLm1vZHVsZSc7XG4iXX0=
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
export * from './public-api';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicXVhZHJlbC1lbnRlcnByaXNlLXVpLXBhZ2UtbGVhdmUtaGFuZGxlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYnMvcWQtcGFnZS1sZWF2ZS1oYW5kbGVyL3NyYy9xdWFkcmVsLWVudGVycHJpc2UtdWktcGFnZS1sZWF2ZS1oYW5kbGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vcHVibGljLWFwaSc7XG4iXX0=
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, HostListener, Input, Component, NgModule } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
class QdPageLeaveHandlerService {
|
|
5
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerService, providedIn: 'root' });
|
|
7
|
+
}
|
|
8
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerService, decorators: [{
|
|
9
|
+
type: Injectable,
|
|
10
|
+
args: [{
|
|
11
|
+
providedIn: 'root'
|
|
12
|
+
}]
|
|
13
|
+
}] });
|
|
14
|
+
|
|
15
|
+
class QdPageLeaveHandlerComponent {
|
|
16
|
+
callBeforeLeaving;
|
|
17
|
+
unloadHandler(event) {
|
|
18
|
+
if (this.callBeforeLeaving !== undefined) {
|
|
19
|
+
this.callBeforeLeaving();
|
|
20
|
+
}
|
|
21
|
+
event.returnValue = false;
|
|
22
|
+
}
|
|
23
|
+
ngOnDestroy() {
|
|
24
|
+
this.unloadHandler = () => {
|
|
25
|
+
/* interrupt event handler */
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
29
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.9", type: QdPageLeaveHandlerComponent, selector: "qd-page-leave-handler", inputs: { callBeforeLeaving: "callBeforeLeaving" }, host: { listeners: { "window:beforeunload": "unloadHandler($event)" } }, ngImport: i0, template: "<ng-content></ng-content>\n" });
|
|
30
|
+
}
|
|
31
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerComponent, decorators: [{
|
|
32
|
+
type: Component,
|
|
33
|
+
args: [{ selector: 'qd-page-leave-handler', template: "<ng-content></ng-content>\n" }]
|
|
34
|
+
}], propDecorators: { callBeforeLeaving: [{
|
|
35
|
+
type: Input
|
|
36
|
+
}], unloadHandler: [{
|
|
37
|
+
type: HostListener,
|
|
38
|
+
args: ['window:beforeunload', ['$event']]
|
|
39
|
+
}] } });
|
|
40
|
+
|
|
41
|
+
class QdPageLeaveHandlerModule {
|
|
42
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
43
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerModule, declarations: [QdPageLeaveHandlerComponent], exports: [QdPageLeaveHandlerComponent] });
|
|
44
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerModule });
|
|
45
|
+
}
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: QdPageLeaveHandlerModule, decorators: [{
|
|
47
|
+
type: NgModule,
|
|
48
|
+
args: [{
|
|
49
|
+
declarations: [QdPageLeaveHandlerComponent],
|
|
50
|
+
imports: [],
|
|
51
|
+
exports: [QdPageLeaveHandlerComponent]
|
|
52
|
+
}]
|
|
53
|
+
}] });
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Public API Surface of qd-page-leave-handler
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Generated bundle index. Do not edit.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
export { QdPageLeaveHandlerComponent, QdPageLeaveHandlerModule, QdPageLeaveHandlerService };
|
|
64
|
+
//# sourceMappingURL=quadrel-enterprise-ui-page-leave-handler.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quadrel-enterprise-ui-page-leave-handler.mjs","sources":["../../../../libs/qd-page-leave-handler/src/lib/qd-page-leave-handler.service.ts","../../../../libs/qd-page-leave-handler/src/lib/qd-page-leave-handler.component.ts","../../../../libs/qd-page-leave-handler/src/lib/qd-page-leave-handler.component.html","../../../../libs/qd-page-leave-handler/src/lib/qd-page-leave-handler.module.ts","../../../../libs/qd-page-leave-handler/src/public-api.ts","../../../../libs/qd-page-leave-handler/src/quadrel-enterprise-ui-page-leave-handler.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class QdPageLeaveHandlerService {}\n","import { Component, HostListener, Input, OnDestroy } from '@angular/core';\n\n@Component({\n selector: 'qd-page-leave-handler',\n templateUrl: './qd-page-leave-handler.component.html',\n styles: []\n})\nexport class QdPageLeaveHandlerComponent implements OnDestroy {\n @Input() callBeforeLeaving: () => unknown;\n @HostListener('window:beforeunload', ['$event']) unloadHandler(event: Event) {\n if (this.callBeforeLeaving !== undefined) {\n this.callBeforeLeaving();\n }\n\n event.returnValue = false;\n }\n\n ngOnDestroy() {\n this.unloadHandler = (): void => {\n /* interrupt event handler */\n };\n }\n}\n","<ng-content></ng-content>\n","import { NgModule } from '@angular/core';\nimport { QdPageLeaveHandlerComponent } from './qd-page-leave-handler.component';\n\n@NgModule({\n declarations: [QdPageLeaveHandlerComponent],\n imports: [],\n exports: [QdPageLeaveHandlerComponent]\n})\nexport class QdPageLeaveHandlerModule {}\n","/**\n * Public API Surface of qd-page-leave-handler\n */\nexport * from './lib/qd-page-leave-handler.service';\nexport * from './lib/qd-page-leave-handler.component';\nexport * from './lib/qd-page-leave-handler.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAKa,yBAAyB,CAAA;uGAAzB,yBAAyB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAzB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,yBAAy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Q;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,2BAA2B,CAAC;AAC3C,oBAAA,OAAO,EAAE,EAAE;oBACX,OAAO,EAAE,CAAC,2BAA2B;AACtC,iBAAA;;;ACPD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OnDestroy } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class QdPageLeaveHandlerComponent implements OnDestroy {
|
|
4
|
+
callBeforeLeaving: () => unknown;
|
|
5
|
+
unloadHandler(event: Event): void;
|
|
6
|
+
ngOnDestroy(): void;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<QdPageLeaveHandlerComponent, never>;
|
|
8
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<QdPageLeaveHandlerComponent, "qd-page-leave-handler", never, { "callBeforeLeaving": { "alias": "callBeforeLeaving"; "required": false; }; }, {}, never, ["*"], false, never>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./qd-page-leave-handler.component";
|
|
3
|
+
export declare class QdPageLeaveHandlerModule {
|
|
4
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<QdPageLeaveHandlerModule, never>;
|
|
5
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<QdPageLeaveHandlerModule, [typeof i1.QdPageLeaveHandlerComponent], never, [typeof i1.QdPageLeaveHandlerComponent]>;
|
|
6
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<QdPageLeaveHandlerModule>;
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quadrel-enterprise-ui/page-leave-handler",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
},
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
}
|
|
3
|
+
"version": "18.1.2",
|
|
4
|
+
"description": "Small library for handling the page leave event",
|
|
5
|
+
"peerDependencies": {
|
|
6
|
+
"@angular/common": "~18.2.9",
|
|
7
|
+
"@angular/core": "~18.2.9"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"tslib": "^2.6.3"
|
|
11
|
+
},
|
|
12
|
+
"jestSonar": {
|
|
13
|
+
"reportPath": "../../coverage/libs/qd-page-leave-handler/",
|
|
14
|
+
"reportFile": "sqr.xml",
|
|
15
|
+
"indent": 4,
|
|
16
|
+
"sonar56x": true
|
|
17
|
+
},
|
|
18
|
+
"module": "fesm2022/quadrel-enterprise-ui-page-leave-handler.mjs",
|
|
19
|
+
"typings": "index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
"./package.json": {
|
|
22
|
+
"default": "./package.json"
|
|
23
|
+
},
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./index.d.ts",
|
|
26
|
+
"esm2022": "./esm2022/quadrel-enterprise-ui-page-leave-handler.mjs",
|
|
27
|
+
"esm": "./esm2022/quadrel-enterprise-ui-page-leave-handler.mjs",
|
|
28
|
+
"default": "./fesm2022/quadrel-enterprise-ui-page-leave-handler.mjs"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"sideEffects": false
|
|
32
|
+
}
|