@geosdi/ngx-utility-service 1.0.0
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 +24 -0
- package/esm2020/geosdi-ngx-utility-service.mjs +5 -0
- package/esm2020/lib/ngx-utility-service.component.mjs +19 -0
- package/esm2020/lib/ngx-utility-service.module.mjs +21 -0
- package/esm2020/lib/ngx-utility-service.service.mjs +71 -0
- package/esm2020/public-api.mjs +7 -0
- package/fesm2015/geosdi-ngx-utility-service.mjs +115 -0
- package/fesm2015/geosdi-ngx-utility-service.mjs.map +1 -0
- package/fesm2020/geosdi-ngx-utility-service.mjs +115 -0
- package/fesm2020/geosdi-ngx-utility-service.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/ngx-utility-service.component.d.ts +5 -0
- package/lib/ngx-utility-service.module.d.ts +7 -0
- package/lib/ngx-utility-service.service.d.ts +34 -0
- package/package.json +45 -0
- package/public-api.d.ts +3 -0
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# NgxUtilityService
|
|
2
|
+
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.2.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Run `ng generate component component-name --project ngx-utility-service` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-utility-service`.
|
|
8
|
+
> Note: Don't forget to add `--project ngx-utility-service` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
+
|
|
10
|
+
## Build
|
|
11
|
+
|
|
12
|
+
Run `ng build ngx-utility-service` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
+
|
|
14
|
+
## Publishing
|
|
15
|
+
|
|
16
|
+
After building your library with `ng build ngx-utility-service`, go to the dist folder `cd dist/ngx-utility-service` and run `npm publish`.
|
|
17
|
+
|
|
18
|
+
## Running unit tests
|
|
19
|
+
|
|
20
|
+
Run `ng test ngx-utility-service` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
+
|
|
22
|
+
## Further help
|
|
23
|
+
|
|
24
|
+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
export * from './public-api';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2Vvc2RpLW5neC11dGlsaXR5LXNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9nZW9zZGkvbmd4LXV0aWxpdHktc2VydmljZS9zcmMvZ2Vvc2RpLW5neC11dGlsaXR5LXNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export class NgxUtilityServiceComponent {
|
|
4
|
+
}
|
|
5
|
+
/** @nocollapse */ NgxUtilityServiceComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6
|
+
/** @nocollapse */ NgxUtilityServiceComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: NgxUtilityServiceComponent, selector: "lib-ngx-utility-service", ngImport: i0, template: `
|
|
7
|
+
<p>
|
|
8
|
+
ngx-utility-service works!
|
|
9
|
+
</p>
|
|
10
|
+
`, isInline: true });
|
|
11
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceComponent, decorators: [{
|
|
12
|
+
type: Component,
|
|
13
|
+
args: [{ selector: 'lib-ngx-utility-service', template: `
|
|
14
|
+
<p>
|
|
15
|
+
ngx-utility-service works!
|
|
16
|
+
</p>
|
|
17
|
+
` }]
|
|
18
|
+
}] });
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LXV0aWxpdHktc2VydmljZS5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9nZW9zZGkvbmd4LXV0aWxpdHktc2VydmljZS9zcmMvbGliL25neC11dGlsaXR5LXNlcnZpY2UuY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxlQUFlLENBQUM7O0FBWTFDLE1BQU0sT0FBTywwQkFBMEI7OzBJQUExQiwwQkFBMEI7OEhBQTFCLDBCQUEwQiwrREFSM0I7Ozs7R0FJVDsyRkFJVSwwQkFBMEI7a0JBVnRDLFNBQVM7K0JBQ0UseUJBQXlCLFlBQ3pCOzs7O0dBSVQiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBDb21wb25lbnQgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcblxuQENvbXBvbmVudCh7XG4gIHNlbGVjdG9yOiAnbGliLW5neC11dGlsaXR5LXNlcnZpY2UnLFxuICB0ZW1wbGF0ZTogYFxuICAgIDxwPlxuICAgICAgbmd4LXV0aWxpdHktc2VydmljZSB3b3JrcyFcbiAgICA8L3A+XG4gIGAsXG4gIHN0eWxlczogW1xuICBdXG59KVxuZXhwb3J0IGNsYXNzIE5neFV0aWxpdHlTZXJ2aWNlQ29tcG9uZW50IHtcblxufVxuIl19
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { NgxUtilityServiceComponent } from './ngx-utility-service.component';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export class NgxUtilityServiceModule {
|
|
5
|
+
}
|
|
6
|
+
/** @nocollapse */ NgxUtilityServiceModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
7
|
+
/** @nocollapse */ NgxUtilityServiceModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceModule, declarations: [NgxUtilityServiceComponent], exports: [NgxUtilityServiceComponent] });
|
|
8
|
+
/** @nocollapse */ NgxUtilityServiceModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceModule });
|
|
9
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceModule, decorators: [{
|
|
10
|
+
type: NgModule,
|
|
11
|
+
args: [{
|
|
12
|
+
declarations: [
|
|
13
|
+
NgxUtilityServiceComponent
|
|
14
|
+
],
|
|
15
|
+
imports: [],
|
|
16
|
+
exports: [
|
|
17
|
+
NgxUtilityServiceComponent
|
|
18
|
+
]
|
|
19
|
+
}]
|
|
20
|
+
}] });
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LXV0aWxpdHktc2VydmljZS5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9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slateService } from "@ngx-translate/core";
|
|
3
|
+
import { ConfirmationService, MessageService } from "primeng/api";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import * as i1 from "@ngx-translate/core";
|
|
6
|
+
import * as i2 from "primeng/api";
|
|
7
|
+
export class NgxUtilityServiceService {
|
|
8
|
+
constructor(translateService, messageService, confirmationService) {
|
|
9
|
+
this.translateService = translateService;
|
|
10
|
+
this.messageService = messageService;
|
|
11
|
+
this.confirmationService = confirmationService;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
settingLangs() {
|
|
17
|
+
this.translateService.addLangs(["en", "it"]);
|
|
18
|
+
this.translateService.setDefaultLang("it");
|
|
19
|
+
this.translateService.use(this.translateService.getBrowserLang().match(/en|it/) ? this.translateService.getBrowserLang() : "it");
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
getLang() {
|
|
25
|
+
return this.browserLang.match(/en|it/) ? this.browserLang : "it";
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param summary
|
|
30
|
+
* @param key
|
|
31
|
+
* @param severity
|
|
32
|
+
* @param interpolateParams
|
|
33
|
+
*/
|
|
34
|
+
printTranslateMessage(summary, key, severity = "success", interpolateParams, sticky) {
|
|
35
|
+
this.translateService
|
|
36
|
+
.get(key, interpolateParams)
|
|
37
|
+
.subscribe((res) => {
|
|
38
|
+
return this.messageService.add({
|
|
39
|
+
severity: severity,
|
|
40
|
+
summary: summary,
|
|
41
|
+
detail: res,
|
|
42
|
+
sticky: sticky,
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @param f
|
|
49
|
+
* @param key
|
|
50
|
+
*/
|
|
51
|
+
printConfirmationMessage(f, key = "action.are_you_sure") {
|
|
52
|
+
this.translateService.get(key).subscribe((res) => {
|
|
53
|
+
this.confirmationService.confirm({
|
|
54
|
+
rejectVisible: true,
|
|
55
|
+
message: res,
|
|
56
|
+
accept: () => {
|
|
57
|
+
f();
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** @nocollapse */ NgxUtilityServiceService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceService, deps: [{ token: i1.TranslateService }, { token: i2.MessageService }, { token: i2.ConfirmationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
64
|
+
/** @nocollapse */ NgxUtilityServiceService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceService, providedIn: 'root' });
|
|
65
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceService, decorators: [{
|
|
66
|
+
type: Injectable,
|
|
67
|
+
args: [{
|
|
68
|
+
providedIn: 'root'
|
|
69
|
+
}]
|
|
70
|
+
}], ctorParameters: function () { return [{ type: i1.TranslateService }, { type: i2.MessageService }, { type: i2.ConfirmationService }]; } });
|
|
71
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LXV0aWxpdHktc2VydmljZS5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvZ2Vvc2RpL25neC11dGlsaXR5LXNlcnZpY2Uvc3JjL2xpYi9uZ3gtdXRpbGl0eS1zZXJ2aWNlLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUMzQyxPQUFPLEVBQUMsZ0JBQWdCLEVBQUMsTUFBTSxx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y5jb25maXJtYXRpb25TZXJ2aWNlLmNvbmZpcm0oe1xuICAgICAgICByZWplY3RWaXNpYmxlOiB0cnVlLFxuICAgICAgICBtZXNzYWdlOiByZXMsXG4gICAgICAgIGFjY2VwdDogKCkgPT4ge1xuICAgICAgICAgIGYoKTtcbiAgICAgICAgfSxcbiAgICAgIH0pO1xuICAgIH0pO1xuICB9XG59XG4iXX0=
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Public API Surface of ngx-utility-service
|
|
3
|
+
*/
|
|
4
|
+
export * from './lib/ngx-utility-service.service';
|
|
5
|
+
export * from './lib/ngx-utility-service.component';
|
|
6
|
+
export * from './lib/ngx-utility-service.module';
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL2dlb3NkaS9uZ3gtdXRpbGl0eS1zZXJ2aWNlL3NyYy9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxtQ0FBbUMsQ0FBQztBQUNsRCxjQUFjLHFDQUFxQyxDQUFDO0FBQ3BELGNBQWMsa0NBQWtDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKlxuICogUHVibGljIEFQSSBTdXJmYWNlIG9mIG5neC11dGlsaXR5LXNlcnZpY2VcbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2xpYi9uZ3gtdXRpbGl0eS1zZXJ2aWNlLnNlcnZpY2UnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LXV0aWxpdHktc2VydmljZS5jb21wb25lbnQnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LXV0aWxpdHktc2VydmljZS5tb2R1bGUnO1xuIl19
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Component, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@ngx-translate/core';
|
|
4
|
+
import * as i2 from 'primeng/api';
|
|
5
|
+
|
|
6
|
+
class NgxUtilityServiceService {
|
|
7
|
+
constructor(translateService, messageService, confirmationService) {
|
|
8
|
+
this.translateService = translateService;
|
|
9
|
+
this.messageService = messageService;
|
|
10
|
+
this.confirmationService = confirmationService;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
settingLangs() {
|
|
16
|
+
this.translateService.addLangs(["en", "it"]);
|
|
17
|
+
this.translateService.setDefaultLang("it");
|
|
18
|
+
this.translateService.use(this.translateService.getBrowserLang().match(/en|it/) ? this.translateService.getBrowserLang() : "it");
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
getLang() {
|
|
24
|
+
return this.browserLang.match(/en|it/) ? this.browserLang : "it";
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param summary
|
|
29
|
+
* @param key
|
|
30
|
+
* @param severity
|
|
31
|
+
* @param interpolateParams
|
|
32
|
+
*/
|
|
33
|
+
printTranslateMessage(summary, key, severity = "success", interpolateParams, sticky) {
|
|
34
|
+
this.translateService
|
|
35
|
+
.get(key, interpolateParams)
|
|
36
|
+
.subscribe((res) => {
|
|
37
|
+
return this.messageService.add({
|
|
38
|
+
severity: severity,
|
|
39
|
+
summary: summary,
|
|
40
|
+
detail: res,
|
|
41
|
+
sticky: sticky,
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @param f
|
|
48
|
+
* @param key
|
|
49
|
+
*/
|
|
50
|
+
printConfirmationMessage(f, key = "action.are_you_sure") {
|
|
51
|
+
this.translateService.get(key).subscribe((res) => {
|
|
52
|
+
this.confirmationService.confirm({
|
|
53
|
+
rejectVisible: true,
|
|
54
|
+
message: res,
|
|
55
|
+
accept: () => {
|
|
56
|
+
f();
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/** @nocollapse */ NgxUtilityServiceService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceService, deps: [{ token: i1.TranslateService }, { token: i2.MessageService }, { token: i2.ConfirmationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
63
|
+
/** @nocollapse */ NgxUtilityServiceService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceService, providedIn: 'root' });
|
|
64
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceService, decorators: [{
|
|
65
|
+
type: Injectable,
|
|
66
|
+
args: [{
|
|
67
|
+
providedIn: 'root'
|
|
68
|
+
}]
|
|
69
|
+
}], ctorParameters: function () { return [{ type: i1.TranslateService }, { type: i2.MessageService }, { type: i2.ConfirmationService }]; } });
|
|
70
|
+
|
|
71
|
+
class NgxUtilityServiceComponent {
|
|
72
|
+
}
|
|
73
|
+
/** @nocollapse */ NgxUtilityServiceComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
74
|
+
/** @nocollapse */ NgxUtilityServiceComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: NgxUtilityServiceComponent, selector: "lib-ngx-utility-service", ngImport: i0, template: `
|
|
75
|
+
<p>
|
|
76
|
+
ngx-utility-service works!
|
|
77
|
+
</p>
|
|
78
|
+
`, isInline: true });
|
|
79
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceComponent, decorators: [{
|
|
80
|
+
type: Component,
|
|
81
|
+
args: [{ selector: 'lib-ngx-utility-service', template: `
|
|
82
|
+
<p>
|
|
83
|
+
ngx-utility-service works!
|
|
84
|
+
</p>
|
|
85
|
+
` }]
|
|
86
|
+
}] });
|
|
87
|
+
|
|
88
|
+
class NgxUtilityServiceModule {
|
|
89
|
+
}
|
|
90
|
+
/** @nocollapse */ NgxUtilityServiceModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
91
|
+
/** @nocollapse */ NgxUtilityServiceModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceModule, declarations: [NgxUtilityServiceComponent], exports: [NgxUtilityServiceComponent] });
|
|
92
|
+
/** @nocollapse */ NgxUtilityServiceModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceModule });
|
|
93
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceModule, decorators: [{
|
|
94
|
+
type: NgModule,
|
|
95
|
+
args: [{
|
|
96
|
+
declarations: [
|
|
97
|
+
NgxUtilityServiceComponent
|
|
98
|
+
],
|
|
99
|
+
imports: [],
|
|
100
|
+
exports: [
|
|
101
|
+
NgxUtilityServiceComponent
|
|
102
|
+
]
|
|
103
|
+
}]
|
|
104
|
+
}] });
|
|
105
|
+
|
|
106
|
+
/*
|
|
107
|
+
* Public API Surface of ngx-utility-service
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Generated bundle index. Do not edit.
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
export { NgxUtilityServiceComponent, NgxUtilityServiceModule, NgxUtilityServiceService };
|
|
115
|
+
//# sourceMappingURL=geosdi-ngx-utility-service.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geosdi-ngx-utility-service.mjs","sources":["../../../../projects/geosdi/ngx-utility-service/src/lib/ngx-utility-service.service.ts","../../../../projects/geosdi/ngx-utility-service/src/lib/ngx-utility-service.component.ts","../../../../projects/geosdi/ngx-utility-service/src/lib/ngx-utility-service.module.ts","../../../../projects/geosdi/ngx-utility-service/src/public-api.ts","../../../../projects/geosdi/ngx-utility-service/src/geosdi-ngx-utility-service.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport {TranslateService} from \"@ngx-translate/core\";\nimport {ConfirmationService, MessageService} from \"primeng/api\";\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NgxUtilityServiceService {\n\n private browserLang;\n\n constructor(private translateService: TranslateService,\n private messageService: MessageService,\n private confirmationService: ConfirmationService) {}\n\n /**\n *\n */\n settingLangs() {\n this.translateService.addLangs([\"en\", \"it\"]);\n this.translateService.setDefaultLang(\"it\");\n this.translateService.use(this.translateService.getBrowserLang().match(/en|it/) ? this.translateService.getBrowserLang() : \"it\");\n }\n\n /**\n *\n */\n getLang(): string {\n return this.browserLang.match(/en|it/) ? this.browserLang : \"it\";\n }\n\n /**\n *\n * @param summary\n * @param key\n * @param severity\n * @param interpolateParams\n */\n printTranslateMessage(\n summary: string,\n key: string | Array<string>,\n severity = \"success\",\n interpolateParams?: Object,\n sticky?: boolean,\n ) {\n this.translateService\n .get(key, interpolateParams)\n .subscribe((res: string) => {\n return this.messageService.add({\n severity: severity,\n summary: summary,\n detail: res,\n sticky: sticky,\n });\n });\n }\n\n /**\n *\n * @param f\n * @param key\n */\n printConfirmationMessage(f: Function, key = \"action.are_you_sure\") {\n this.translateService.get(key).subscribe((res: string) => {\n this.confirmationService.confirm({\n rejectVisible: true,\n message: res,\n accept: () => {\n f();\n },\n });\n });\n }\n}\n","import { Component } from '@angular/core';\n\n@Component({\n selector: 'lib-ngx-utility-service',\n template: `\n <p>\n ngx-utility-service works!\n </p>\n `,\n styles: [\n ]\n})\nexport class NgxUtilityServiceComponent {\n\n}\n","import { NgModule } from '@angular/core';\nimport { NgxUtilityServiceComponent } from './ngx-utility-service.component';\n\n\n\n@NgModule({\n declarations: [\n NgxUtilityServiceComponent\n ],\n imports: [\n ],\n exports: [\n NgxUtilityServiceComponent\n ]\n})\nexport class NgxUtilityServiceModule { }\n","/*\n * Public API Surface of ngx-utility-service\n */\n\nexport * from './lib/ngx-utility-service.service';\nexport * from './lib/ngx-utility-service.component';\nexport * from './lib/ngx-utility-service.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAOa,wBAAwB,CAAA;AAInC,IAAA,WAAA,CAAoB,gBAAkC,EAC1B,cAA8B,EAC9B,mBAAwC,EAAA;AAFhD,QAAA,IAAgB,CAAA,gBAAA,GAAhB,gBAAgB,CAAkB;AAC1B,QAAA,IAAc,CAAA,cAAA,GAAd,cAAc,CAAgB;AAC9B,QAAA,IAAmB,CAAA,mBAAA,GAAnB,mBAAmB,CAAqB;KAAI;AAExE;;AAEG;IACH,YAAY,GAAA;QACN,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAC7C,QAAA,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AAC3C,QAAA,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC,CAAC;KAClI;AAEL;;AAEG;IACH,OAAO,GAAA;AACL,QAAA,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,I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,0BAA0B;AAC3B,qBAAA;AACD,oBAAA,OAAO,EAAE,EACR;AACD,oBAAA,OAAO,EAAE;wBACP,0BAA0B;AAC3B,qBAAA;iBACF,CAAA;;;ACdD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Component, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@ngx-translate/core';
|
|
4
|
+
import * as i2 from 'primeng/api';
|
|
5
|
+
|
|
6
|
+
class NgxUtilityServiceService {
|
|
7
|
+
constructor(translateService, messageService, confirmationService) {
|
|
8
|
+
this.translateService = translateService;
|
|
9
|
+
this.messageService = messageService;
|
|
10
|
+
this.confirmationService = confirmationService;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
settingLangs() {
|
|
16
|
+
this.translateService.addLangs(["en", "it"]);
|
|
17
|
+
this.translateService.setDefaultLang("it");
|
|
18
|
+
this.translateService.use(this.translateService.getBrowserLang().match(/en|it/) ? this.translateService.getBrowserLang() : "it");
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
getLang() {
|
|
24
|
+
return this.browserLang.match(/en|it/) ? this.browserLang : "it";
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param summary
|
|
29
|
+
* @param key
|
|
30
|
+
* @param severity
|
|
31
|
+
* @param interpolateParams
|
|
32
|
+
*/
|
|
33
|
+
printTranslateMessage(summary, key, severity = "success", interpolateParams, sticky) {
|
|
34
|
+
this.translateService
|
|
35
|
+
.get(key, interpolateParams)
|
|
36
|
+
.subscribe((res) => {
|
|
37
|
+
return this.messageService.add({
|
|
38
|
+
severity: severity,
|
|
39
|
+
summary: summary,
|
|
40
|
+
detail: res,
|
|
41
|
+
sticky: sticky,
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @param f
|
|
48
|
+
* @param key
|
|
49
|
+
*/
|
|
50
|
+
printConfirmationMessage(f, key = "action.are_you_sure") {
|
|
51
|
+
this.translateService.get(key).subscribe((res) => {
|
|
52
|
+
this.confirmationService.confirm({
|
|
53
|
+
rejectVisible: true,
|
|
54
|
+
message: res,
|
|
55
|
+
accept: () => {
|
|
56
|
+
f();
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/** @nocollapse */ NgxUtilityServiceService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceService, deps: [{ token: i1.TranslateService }, { token: i2.MessageService }, { token: i2.ConfirmationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
63
|
+
/** @nocollapse */ NgxUtilityServiceService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceService, providedIn: 'root' });
|
|
64
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceService, decorators: [{
|
|
65
|
+
type: Injectable,
|
|
66
|
+
args: [{
|
|
67
|
+
providedIn: 'root'
|
|
68
|
+
}]
|
|
69
|
+
}], ctorParameters: function () { return [{ type: i1.TranslateService }, { type: i2.MessageService }, { type: i2.ConfirmationService }]; } });
|
|
70
|
+
|
|
71
|
+
class NgxUtilityServiceComponent {
|
|
72
|
+
}
|
|
73
|
+
/** @nocollapse */ NgxUtilityServiceComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
74
|
+
/** @nocollapse */ NgxUtilityServiceComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: NgxUtilityServiceComponent, selector: "lib-ngx-utility-service", ngImport: i0, template: `
|
|
75
|
+
<p>
|
|
76
|
+
ngx-utility-service works!
|
|
77
|
+
</p>
|
|
78
|
+
`, isInline: true });
|
|
79
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceComponent, decorators: [{
|
|
80
|
+
type: Component,
|
|
81
|
+
args: [{ selector: 'lib-ngx-utility-service', template: `
|
|
82
|
+
<p>
|
|
83
|
+
ngx-utility-service works!
|
|
84
|
+
</p>
|
|
85
|
+
` }]
|
|
86
|
+
}] });
|
|
87
|
+
|
|
88
|
+
class NgxUtilityServiceModule {
|
|
89
|
+
}
|
|
90
|
+
/** @nocollapse */ NgxUtilityServiceModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
91
|
+
/** @nocollapse */ NgxUtilityServiceModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceModule, declarations: [NgxUtilityServiceComponent], exports: [NgxUtilityServiceComponent] });
|
|
92
|
+
/** @nocollapse */ NgxUtilityServiceModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceModule });
|
|
93
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NgxUtilityServiceModule, decorators: [{
|
|
94
|
+
type: NgModule,
|
|
95
|
+
args: [{
|
|
96
|
+
declarations: [
|
|
97
|
+
NgxUtilityServiceComponent
|
|
98
|
+
],
|
|
99
|
+
imports: [],
|
|
100
|
+
exports: [
|
|
101
|
+
NgxUtilityServiceComponent
|
|
102
|
+
]
|
|
103
|
+
}]
|
|
104
|
+
}] });
|
|
105
|
+
|
|
106
|
+
/*
|
|
107
|
+
* Public API Surface of ngx-utility-service
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Generated bundle index. Do not edit.
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
export { NgxUtilityServiceComponent, NgxUtilityServiceModule, NgxUtilityServiceService };
|
|
115
|
+
//# sourceMappingURL=geosdi-ngx-utility-service.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geosdi-ngx-utility-service.mjs","sources":["../../../../projects/geosdi/ngx-utility-service/src/lib/ngx-utility-service.service.ts","../../../../projects/geosdi/ngx-utility-service/src/lib/ngx-utility-service.component.ts","../../../../projects/geosdi/ngx-utility-service/src/lib/ngx-utility-service.module.ts","../../../../projects/geosdi/ngx-utility-service/src/public-api.ts","../../../../projects/geosdi/ngx-utility-service/src/geosdi-ngx-utility-service.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport {TranslateService} from \"@ngx-translate/core\";\nimport {ConfirmationService, MessageService} from \"primeng/api\";\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NgxUtilityServiceService {\n\n private browserLang;\n\n constructor(private translateService: TranslateService,\n private messageService: MessageService,\n private confirmationService: ConfirmationService) {}\n\n /**\n *\n */\n settingLangs() {\n this.translateService.addLangs([\"en\", \"it\"]);\n this.translateService.setDefaultLang(\"it\");\n this.translateService.use(this.translateService.getBrowserLang().match(/en|it/) ? this.translateService.getBrowserLang() : \"it\");\n }\n\n /**\n *\n */\n getLang(): string {\n return this.browserLang.match(/en|it/) ? this.browserLang : \"it\";\n }\n\n /**\n *\n * @param summary\n * @param key\n * @param severity\n * @param interpolateParams\n */\n printTranslateMessage(\n summary: string,\n key: string | Array<string>,\n severity = \"success\",\n interpolateParams?: Object,\n sticky?: boolean,\n ) {\n this.translateService\n .get(key, interpolateParams)\n .subscribe((res: string) => {\n return this.messageService.add({\n severity: severity,\n summary: summary,\n detail: res,\n sticky: sticky,\n });\n });\n }\n\n /**\n *\n * @param f\n * @param key\n */\n printConfirmationMessage(f: Function, key = \"action.are_you_sure\") {\n this.translateService.get(key).subscribe((res: string) => {\n this.confirmationService.confirm({\n rejectVisible: true,\n message: res,\n accept: () => {\n f();\n },\n });\n });\n }\n}\n","import { Component } from '@angular/core';\n\n@Component({\n selector: 'lib-ngx-utility-service',\n template: `\n <p>\n ngx-utility-service works!\n </p>\n `,\n styles: [\n ]\n})\nexport class NgxUtilityServiceComponent {\n\n}\n","import { NgModule } from '@angular/core';\nimport { NgxUtilityServiceComponent } from './ngx-utility-service.component';\n\n\n\n@NgModule({\n declarations: [\n NgxUtilityServiceComponent\n ],\n imports: [\n ],\n exports: [\n NgxUtilityServiceComponent\n ]\n})\nexport class NgxUtilityServiceModule { }\n","/*\n * Public API Surface of ngx-utility-service\n */\n\nexport * from './lib/ngx-utility-service.service';\nexport * from './lib/ngx-utility-service.component';\nexport * from './lib/ngx-utility-service.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAOa,wBAAwB,CAAA;AAInC,IAAA,WAAA,CAAoB,gBAAkC,EAC1B,cAA8B,EAC9B,mBAAwC,EAAA;QAFhD,IAAgB,CAAA,gBAAA,GAAhB,gBAAgB,CAAkB;QAC1B,IAAc,CAAA,cAAA,GAAd,cAAc,CAAgB;QAC9B,IAAmB,CAAA,mBAAA,GAAnB,mBAAmB,CAAqB;KAAI;AAExE;;AAEG;IACH,YAAY,GAAA;QACN,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAC7C,QAAA,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AAC3C,QAAA,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,IAAI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0B,CAAA,EAAA,CAAA,CAAA;wIAGjB,uBAAuB,EAAA,CAAA,CAAA;2FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAVnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,0BAA0B;AAC3B,qBAAA;AACD,oBAAA,OAAO,EAAE,EACR;AACD,oBAAA,OAAO,EAAE;wBACP,0BAA0B;AAC3B,qBAAA;AACF,iBAAA,CAAA;;;ACdD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class NgxUtilityServiceComponent {
|
|
3
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxUtilityServiceComponent, never>;
|
|
4
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NgxUtilityServiceComponent, "lib-ngx-utility-service", never, {}, {}, never, never, false, never>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./ngx-utility-service.component";
|
|
3
|
+
export declare class NgxUtilityServiceModule {
|
|
4
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxUtilityServiceModule, never>;
|
|
5
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxUtilityServiceModule, [typeof i1.NgxUtilityServiceComponent], never, [typeof i1.NgxUtilityServiceComponent]>;
|
|
6
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<NgxUtilityServiceModule>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TranslateService } from "@ngx-translate/core";
|
|
2
|
+
import { ConfirmationService, MessageService } from "primeng/api";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class NgxUtilityServiceService {
|
|
5
|
+
private translateService;
|
|
6
|
+
private messageService;
|
|
7
|
+
private confirmationService;
|
|
8
|
+
private browserLang;
|
|
9
|
+
constructor(translateService: TranslateService, messageService: MessageService, confirmationService: ConfirmationService);
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
settingLangs(): void;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
getLang(): string;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param summary
|
|
21
|
+
* @param key
|
|
22
|
+
* @param severity
|
|
23
|
+
* @param interpolateParams
|
|
24
|
+
*/
|
|
25
|
+
printTranslateMessage(summary: string, key: string | Array<string>, severity?: string, interpolateParams?: Object, sticky?: boolean): void;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param f
|
|
29
|
+
* @param key
|
|
30
|
+
*/
|
|
31
|
+
printConfirmationMessage(f: Function, key?: string): void;
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxUtilityServiceService, never>;
|
|
33
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NgxUtilityServiceService>;
|
|
34
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@geosdi/ngx-utility-service",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Utility sercvice",
|
|
5
|
+
"author": "Salvia Vito (vito.salvia@gmail.com)",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"angular",
|
|
8
|
+
"javascript",
|
|
9
|
+
"typescript",
|
|
10
|
+
"component",
|
|
11
|
+
"utility"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"@angular/common": ">=15.0.0",
|
|
16
|
+
"@angular/core": ">=15.0.0",
|
|
17
|
+
"typescript": ">=4.8.4",
|
|
18
|
+
"primeng": ">=15.3.0",
|
|
19
|
+
"@ngx-translate/core": ">= 14.0.0",
|
|
20
|
+
"@ngx-translate/http-loader": ">= 7.0.0"
|
|
21
|
+
},
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"module": "fesm2015/geosdi-ngx-utility-service.mjs",
|
|
24
|
+
"es2020": "fesm2020/geosdi-ngx-utility-service.mjs",
|
|
25
|
+
"esm2020": "esm2020/geosdi-ngx-utility-service.mjs",
|
|
26
|
+
"fesm2020": "fesm2020/geosdi-ngx-utility-service.mjs",
|
|
27
|
+
"fesm2015": "fesm2015/geosdi-ngx-utility-service.mjs",
|
|
28
|
+
"typings": "index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
"./package.json": {
|
|
31
|
+
"default": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./index.d.ts",
|
|
35
|
+
"esm2020": "./esm2020/geosdi-ngx-utility-service.mjs",
|
|
36
|
+
"es2020": "./fesm2020/geosdi-ngx-utility-service.mjs",
|
|
37
|
+
"es2015": "./fesm2015/geosdi-ngx-utility-service.mjs",
|
|
38
|
+
"node": "./fesm2015/geosdi-ngx-utility-service.mjs",
|
|
39
|
+
"default": "./fesm2020/geosdi-ngx-utility-service.mjs"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"tslib": "^2.3.0"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/public-api.d.ts
ADDED