@lenne.tech/ng-base 13.25.0 → 13.26.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/esm2020/shared/classes/basic-user.class.mjs +2 -1
- package/esm2020/shared/directives/back-button.directive.mjs +23 -0
- package/esm2020/shared/public-api.mjs +3 -1
- package/esm2020/shared/services/navigation.service.mjs +36 -0
- package/esm2020/shared/services/user.service.mjs +5 -5
- package/fesm2015/lenne.tech-ng-base-shared.mjs +74 -21
- package/fesm2015/lenne.tech-ng-base-shared.mjs.map +1 -1
- package/fesm2020/lenne.tech-ng-base-shared.mjs +74 -21
- package/fesm2020/lenne.tech-ng-base-shared.mjs.map +1 -1
- package/package.json +1 -1
- package/shared/classes/basic-user.class.d.ts +1 -0
- package/shared/directives/back-button.directive.d.ts +9 -0
- package/shared/public-api.d.ts +2 -0
- package/shared/services/navigation.service.d.ts +15 -0
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { GraphQLInputObjectType, GraphQLNonNull, GraphQLList, buildClientSchema, getIntrospectionQuery } from 'graphql';
|
|
2
2
|
import { cloneDeep } from '@apollo/client/utilities';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Directive, Inject, Input, HostListener,
|
|
4
|
+
import { Directive, Inject, Input, HostListener, Injectable, InjectionToken } from '@angular/core';
|
|
5
|
+
import * as i2 from '@angular/common';
|
|
5
6
|
import { DOCUMENT } from '@angular/common';
|
|
7
|
+
import * as i1 from '@angular/router';
|
|
8
|
+
import { NavigationEnd } from '@angular/router';
|
|
6
9
|
import { BehaviorSubject, of, throwError, Observable, map as map$1, filter } from 'rxjs';
|
|
7
|
-
import * as i1 from 'apollo-angular';
|
|
10
|
+
import * as i1$1 from 'apollo-angular';
|
|
8
11
|
import { gql } from 'apollo-angular';
|
|
9
12
|
import { sha256 } from 'js-sha256';
|
|
10
13
|
import { map } from 'rxjs/operators';
|
|
11
14
|
import { FormControl, FormGroup } from '@angular/forms';
|
|
12
|
-
import * as i1$1 from '@angular/router';
|
|
13
|
-
import { NavigationEnd } from '@angular/router';
|
|
14
15
|
import { createClient } from 'graphql-ws';
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -364,6 +365,7 @@ class BasicUser extends Standard {
|
|
|
364
365
|
super(...arguments);
|
|
365
366
|
this.id = undefined;
|
|
366
367
|
this.email = undefined;
|
|
368
|
+
this.avatar = undefined;
|
|
367
369
|
this.firstName = undefined;
|
|
368
370
|
this.lastName = undefined;
|
|
369
371
|
this.roles = [];
|
|
@@ -814,6 +816,57 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImpor
|
|
|
814
816
|
args: ['click']
|
|
815
817
|
}] } });
|
|
816
818
|
|
|
819
|
+
class NavigationService {
|
|
820
|
+
constructor(router, location) {
|
|
821
|
+
this.router = router;
|
|
822
|
+
this.location = location;
|
|
823
|
+
this.history = [];
|
|
824
|
+
this.router.events.subscribe((event) => {
|
|
825
|
+
if (event instanceof NavigationEnd) {
|
|
826
|
+
this.history.push(event.urlAfterRedirects);
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* If the history stack is empty, navigate to the home page, otherwise go back to the previous page
|
|
832
|
+
*/
|
|
833
|
+
back() {
|
|
834
|
+
this.history.pop();
|
|
835
|
+
if (this.history.length > 0) {
|
|
836
|
+
this.location.back();
|
|
837
|
+
}
|
|
838
|
+
else {
|
|
839
|
+
this.router.navigateByUrl('/');
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
NavigationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NavigationService, deps: [{ token: i1.Router }, { token: i2.Location }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
844
|
+
NavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NavigationService, providedIn: 'root' });
|
|
845
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NavigationService, decorators: [{
|
|
846
|
+
type: Injectable,
|
|
847
|
+
args: [{ providedIn: 'root' }]
|
|
848
|
+
}], ctorParameters: function () { return [{ type: i1.Router }, { type: i2.Location }]; } });
|
|
849
|
+
|
|
850
|
+
class BackButtonDirective {
|
|
851
|
+
constructor(navigation) {
|
|
852
|
+
this.navigation = navigation;
|
|
853
|
+
}
|
|
854
|
+
onClick() {
|
|
855
|
+
this.navigation.back();
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
BackButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BackButtonDirective, deps: [{ token: NavigationService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
859
|
+
BackButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.3", type: BackButtonDirective, selector: "[baseBackButton]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
|
|
860
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BackButtonDirective, decorators: [{
|
|
861
|
+
type: Directive,
|
|
862
|
+
args: [{
|
|
863
|
+
selector: '[baseBackButton]',
|
|
864
|
+
}]
|
|
865
|
+
}], ctorParameters: function () { return [{ type: NavigationService }]; }, propDecorators: { onClick: [{
|
|
866
|
+
type: HostListener,
|
|
867
|
+
args: ['click']
|
|
868
|
+
}] } });
|
|
869
|
+
|
|
817
870
|
const BASE_MODULE_CONFIG = new InjectionToken('BASE_MODULE_CONFIG');
|
|
818
871
|
|
|
819
872
|
/**
|
|
@@ -1139,14 +1192,14 @@ class GraphQLMetaService {
|
|
|
1139
1192
|
return observable;
|
|
1140
1193
|
}
|
|
1141
1194
|
}
|
|
1142
|
-
GraphQLMetaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: GraphQLMetaService, deps: [{ token: i1.Apollo }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1195
|
+
GraphQLMetaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: GraphQLMetaService, deps: [{ token: i1$1.Apollo }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1143
1196
|
GraphQLMetaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: GraphQLMetaService, providedIn: 'root' });
|
|
1144
1197
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: GraphQLMetaService, decorators: [{
|
|
1145
1198
|
type: Injectable,
|
|
1146
1199
|
args: [{
|
|
1147
1200
|
providedIn: 'root',
|
|
1148
1201
|
}]
|
|
1149
|
-
}], ctorParameters: function () { return [{ type: i1.Apollo }]; } });
|
|
1202
|
+
}], ctorParameters: function () { return [{ type: i1$1.Apollo }]; } });
|
|
1150
1203
|
|
|
1151
1204
|
/**
|
|
1152
1205
|
* GraphQL service
|
|
@@ -1575,14 +1628,14 @@ class GraphQLService {
|
|
|
1575
1628
|
return { fieldsString, schemaFields, usedFields };
|
|
1576
1629
|
}
|
|
1577
1630
|
}
|
|
1578
|
-
GraphQLService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: GraphQLService, deps: [{ token: i1.Apollo }, { token: GraphQLMetaService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1631
|
+
GraphQLService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: GraphQLService, deps: [{ token: i1$1.Apollo }, { token: GraphQLMetaService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1579
1632
|
GraphQLService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: GraphQLService, providedIn: 'root' });
|
|
1580
1633
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: GraphQLService, decorators: [{
|
|
1581
1634
|
type: Injectable,
|
|
1582
1635
|
args: [{
|
|
1583
1636
|
providedIn: 'root',
|
|
1584
1637
|
}]
|
|
1585
|
-
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }]; } });
|
|
1638
|
+
}], ctorParameters: function () { return [{ type: i1$1.Apollo }, { type: GraphQLMetaService }]; } });
|
|
1586
1639
|
|
|
1587
1640
|
/**
|
|
1588
1641
|
* Loader service for loading indication
|
|
@@ -1677,14 +1730,14 @@ class GraphQLPlusService extends GraphQLService {
|
|
|
1677
1730
|
console.error(error);
|
|
1678
1731
|
}
|
|
1679
1732
|
}
|
|
1680
|
-
GraphQLPlusService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: GraphQLPlusService, deps: [{ token: i1.Apollo }, { token: GraphQLMetaService }, { token: LoaderService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1733
|
+
GraphQLPlusService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: GraphQLPlusService, deps: [{ token: i1$1.Apollo }, { token: GraphQLMetaService }, { token: LoaderService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1681
1734
|
GraphQLPlusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: GraphQLPlusService, providedIn: 'root' });
|
|
1682
1735
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: GraphQLPlusService, decorators: [{
|
|
1683
1736
|
type: Injectable,
|
|
1684
1737
|
args: [{
|
|
1685
1738
|
providedIn: 'root',
|
|
1686
1739
|
}]
|
|
1687
|
-
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }, { type: LoaderService }]; } });
|
|
1740
|
+
}], ctorParameters: function () { return [{ type: i1$1.Apollo }, { type: GraphQLMetaService }, { type: LoaderService }]; } });
|
|
1688
1741
|
|
|
1689
1742
|
class FormsService {
|
|
1690
1743
|
validateAllFormFields(formGroup) {
|
|
@@ -1724,12 +1777,12 @@ class UserService extends GraphQLPlusService {
|
|
|
1724
1777
|
login(input) {
|
|
1725
1778
|
return this.graphQl('signIn', {
|
|
1726
1779
|
arguments: { input },
|
|
1727
|
-
fields: ['token', { user: ['id', 'firstName', 'lastName', 'email', 'roles'] }],
|
|
1780
|
+
fields: ['token', { user: ['id', 'firstName', 'lastName', 'email', 'roles', 'avatar'] }],
|
|
1728
1781
|
type: GraphQLRequestType.QUERY,
|
|
1729
1782
|
loading: true,
|
|
1730
1783
|
}).pipe(map$1((response) => {
|
|
1731
1784
|
this.authService.token = response.token;
|
|
1732
|
-
this.authService.currentUser =
|
|
1785
|
+
this.authService.currentUser = response.user;
|
|
1733
1786
|
return Auth.map({
|
|
1734
1787
|
token: response.token,
|
|
1735
1788
|
user: BasicUser.map(response.user),
|
|
@@ -1744,12 +1797,12 @@ class UserService extends GraphQLPlusService {
|
|
|
1744
1797
|
register(input) {
|
|
1745
1798
|
return this.graphQl('signUp', {
|
|
1746
1799
|
arguments: { input },
|
|
1747
|
-
fields: ['token', { user: ['id', 'firstName', 'lastName', 'email', 'roles'] }],
|
|
1800
|
+
fields: ['token', { user: ['id', 'firstName', 'lastName', 'email', 'roles', 'avatar'] }],
|
|
1748
1801
|
type: GraphQLRequestType.MUTATION,
|
|
1749
1802
|
loading: true,
|
|
1750
1803
|
}).pipe(map$1((response) => {
|
|
1751
1804
|
this.authService.token = response.token;
|
|
1752
|
-
this.authService.currentUser =
|
|
1805
|
+
this.authService.currentUser = response.user;
|
|
1753
1806
|
return Auth.map({
|
|
1754
1807
|
token: response.token,
|
|
1755
1808
|
user: BasicUser.map(response.user),
|
|
@@ -1770,14 +1823,14 @@ class UserService extends GraphQLPlusService {
|
|
|
1770
1823
|
});
|
|
1771
1824
|
}
|
|
1772
1825
|
}
|
|
1773
|
-
UserService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: UserService, deps: [{ token: i1.Apollo }, { token: GraphQLMetaService }, { token: LoaderService }, { token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1826
|
+
UserService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: UserService, deps: [{ token: i1$1.Apollo }, { token: GraphQLMetaService }, { token: LoaderService }, { token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1774
1827
|
UserService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: UserService, providedIn: 'root' });
|
|
1775
1828
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: UserService, decorators: [{
|
|
1776
1829
|
type: Injectable,
|
|
1777
1830
|
args: [{
|
|
1778
1831
|
providedIn: 'root',
|
|
1779
1832
|
}]
|
|
1780
|
-
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }, { type: LoaderService }, { type: AuthService }]; } });
|
|
1833
|
+
}], ctorParameters: function () { return [{ type: i1$1.Apollo }, { type: GraphQLMetaService }, { type: LoaderService }, { type: AuthService }]; } });
|
|
1781
1834
|
|
|
1782
1835
|
/**
|
|
1783
1836
|
* Image service
|
|
@@ -2040,14 +2093,14 @@ class ScrollService {
|
|
|
2040
2093
|
return this.scrollPromise;
|
|
2041
2094
|
}
|
|
2042
2095
|
}
|
|
2043
|
-
ScrollService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: ScrollService, deps: [{ token: i1
|
|
2096
|
+
ScrollService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: ScrollService, deps: [{ token: i1.Router }, { token: BASE_MODULE_CONFIG }, { token: ImageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2044
2097
|
ScrollService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: ScrollService, providedIn: 'root' });
|
|
2045
2098
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: ScrollService, decorators: [{
|
|
2046
2099
|
type: Injectable,
|
|
2047
2100
|
args: [{
|
|
2048
2101
|
providedIn: 'root',
|
|
2049
2102
|
}]
|
|
2050
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
2103
|
+
}], ctorParameters: function () { return [{ type: i1.Router }, { type: undefined, decorators: [{
|
|
2051
2104
|
type: Inject,
|
|
2052
2105
|
args: [BASE_MODULE_CONFIG]
|
|
2053
2106
|
}] }, { type: ImageService }]; } });
|
|
@@ -2144,14 +2197,14 @@ class BreadcrumbService {
|
|
|
2144
2197
|
return typeof data.breadcrumb === 'function' ? data.breadcrumb(data) : data.breadcrumb;
|
|
2145
2198
|
}
|
|
2146
2199
|
}
|
|
2147
|
-
BreadcrumbService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BreadcrumbService, deps: [{ token: i1
|
|
2200
|
+
BreadcrumbService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BreadcrumbService, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2148
2201
|
BreadcrumbService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BreadcrumbService, providedIn: 'root' });
|
|
2149
2202
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BreadcrumbService, decorators: [{
|
|
2150
2203
|
type: Injectable,
|
|
2151
2204
|
args: [{
|
|
2152
2205
|
providedIn: 'root',
|
|
2153
2206
|
}]
|
|
2154
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
2207
|
+
}], ctorParameters: function () { return [{ type: i1.Router }]; } });
|
|
2155
2208
|
|
|
2156
2209
|
/**
|
|
2157
2210
|
* Comparison operator enum
|
|
@@ -2265,5 +2318,5 @@ function createRestartableClient(options) {
|
|
|
2265
2318
|
* Generated bundle index. Do not edit.
|
|
2266
2319
|
*/
|
|
2267
2320
|
|
|
2268
|
-
export { Auth, AuthService, BASE_MODULE_CONFIG, BasicUser, BreadcrumbService, ComparisonOperatorEnum, FormsService, GraphQLEnum, GraphQLMeta, GraphQLMetaService, GraphQLPlusService, GraphQLRequestType, GraphQLService, GraphQLType, Helper, ImageService, LoaderService, LogicalOperatorEnum, ScrollService, SkeletonType, Sort, SortDirective, SortOrderEnum, Standard, StorageService, ToastService, ToastType, UserService, Validation, WsService, createRestartableClient };
|
|
2321
|
+
export { Auth, AuthService, BASE_MODULE_CONFIG, BackButtonDirective, BasicUser, BreadcrumbService, ComparisonOperatorEnum, FormsService, GraphQLEnum, GraphQLMeta, GraphQLMetaService, GraphQLPlusService, GraphQLRequestType, GraphQLService, GraphQLType, Helper, ImageService, LoaderService, LogicalOperatorEnum, NavigationService, ScrollService, SkeletonType, Sort, SortDirective, SortOrderEnum, Standard, StorageService, ToastService, ToastType, UserService, Validation, WsService, createRestartableClient };
|
|
2269
2322
|
//# sourceMappingURL=lenne.tech-ng-base-shared.mjs.map
|