@lenne.tech/ng-base 14.0.5 → 14.2.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/base-components/base-components.module.d.ts +20 -17
- package/base-components/components/model-form/model-form.component.d.ts +3 -3
- package/base-components/components/model-table/model-table.component.d.ts +14 -5
- package/{shared → base-components}/directives/back-button.directive.d.ts +1 -1
- package/{src → base-components}/directives/context-menu.directive.d.ts +0 -0
- package/{shared → base-components}/directives/sort.directive.d.ts +2 -2
- package/base-components/public-api.d.ts +3 -0
- package/esm2020/base-components/base-components.module.mjs +16 -1
- package/esm2020/base-components/components/model-form/model-form.component.mjs +34 -49
- package/esm2020/base-components/components/model-form-sub/model-form-sub.component.mjs +3 -3
- package/esm2020/base-components/components/model-table/model-table.component.mjs +29 -12
- package/esm2020/base-components/components/upload-image/upload-image.component.mjs +4 -4
- package/esm2020/{shared → base-components}/directives/back-button.directive.mjs +2 -2
- package/esm2020/base-components/directives/context-menu.directive.mjs +108 -0
- package/esm2020/base-components/directives/sort.directive.mjs +54 -0
- package/esm2020/base-components/public-api.mjs +5 -1
- package/esm2020/public-api.mjs +1 -2
- package/esm2020/shared/classes/sort.class.mjs +1 -8
- package/esm2020/shared/public-api.mjs +2 -4
- package/esm2020/shared/services/auth.service.mjs +7 -1
- package/esm2020/shared/services/cms.service.mjs +75 -0
- package/esm2020/src/base.module.mjs +1 -5
- package/fesm2015/lenne.tech-ng-base-base-components.mjs +264 -69
- package/fesm2015/lenne.tech-ng-base-base-components.mjs.map +1 -1
- package/fesm2015/lenne.tech-ng-base-shared.mjs +128 -129
- package/fesm2015/lenne.tech-ng-base-shared.mjs.map +1 -1
- package/fesm2015/lenne.tech-ng-base.mjs +2 -113
- package/fesm2015/lenne.tech-ng-base.mjs.map +1 -1
- package/fesm2020/lenne.tech-ng-base-base-components.mjs +254 -66
- package/fesm2020/lenne.tech-ng-base-base-components.mjs.map +1 -1
- package/fesm2020/lenne.tech-ng-base-shared.mjs +126 -127
- package/fesm2020/lenne.tech-ng-base-shared.mjs.map +1 -1
- package/fesm2020/lenne.tech-ng-base.mjs +2 -112
- package/fesm2020/lenne.tech-ng-base.mjs.map +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +0 -1
- package/shared/classes/sort.class.d.ts +0 -7
- package/shared/public-api.d.ts +1 -2
- package/shared/services/cms.service.d.ts +23 -0
- package/src/base.module.d.ts +9 -10
- package/esm2020/shared/directives/sort.directive.mjs +0 -54
- package/esm2020/src/directives/context-menu.directive.mjs +0 -109
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { GraphQLInputObjectType, GraphQLScalarType, GraphQLEnumType, GraphQLNonNull, GraphQLList, buildClientSchema, getIntrospectionQuery } from 'graphql';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import {
|
|
4
|
-
import * as i2 from '@angular/common';
|
|
5
|
-
import { DOCUMENT } from '@angular/common';
|
|
6
|
-
import * as i1 from '@angular/router';
|
|
7
|
-
import { NavigationEnd } from '@angular/router';
|
|
3
|
+
import { InjectionToken, Injectable, Inject } from '@angular/core';
|
|
8
4
|
import { BehaviorSubject, of, throwError, Observable, map as map$1, filter } from 'rxjs';
|
|
9
|
-
import * as i1
|
|
5
|
+
import * as i1 from 'apollo-angular';
|
|
10
6
|
import { gql } from 'apollo-angular';
|
|
11
7
|
import { sha256 } from 'js-sha256';
|
|
12
8
|
import { map } from 'rxjs/operators';
|
|
13
9
|
import { UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
|
14
10
|
import { __awaiter } from 'tslib';
|
|
11
|
+
import * as i1$1 from '@angular/router';
|
|
12
|
+
import { NavigationEnd } from '@angular/router';
|
|
13
|
+
import * as i2 from '@angular/common';
|
|
15
14
|
import { createClient } from 'graphql-ws';
|
|
16
15
|
|
|
17
16
|
/**
|
|
@@ -740,10 +739,6 @@ class Sort {
|
|
|
740
739
|
}
|
|
741
740
|
/**
|
|
742
741
|
* Sorts clicked column
|
|
743
|
-
*
|
|
744
|
-
* @param property
|
|
745
|
-
* @param order
|
|
746
|
-
* @param type
|
|
747
742
|
*/
|
|
748
743
|
startSort(property, order, type = '') {
|
|
749
744
|
if (order === 'desc') {
|
|
@@ -763,9 +758,6 @@ class Sort {
|
|
|
763
758
|
}
|
|
764
759
|
/**
|
|
765
760
|
* Sorts dates
|
|
766
|
-
*
|
|
767
|
-
* @param a
|
|
768
|
-
* @param b
|
|
769
761
|
*/
|
|
770
762
|
sortDate(a, b) {
|
|
771
763
|
if (a < b) {
|
|
@@ -780,109 +772,6 @@ class Sort {
|
|
|
780
772
|
}
|
|
781
773
|
}
|
|
782
774
|
|
|
783
|
-
class SortDirective {
|
|
784
|
-
constructor(renderer, targetElem, document) {
|
|
785
|
-
this.renderer = renderer;
|
|
786
|
-
this.targetElem = targetElem;
|
|
787
|
-
}
|
|
788
|
-
/**
|
|
789
|
-
* Sorts columns on click
|
|
790
|
-
*/
|
|
791
|
-
sortColumn() {
|
|
792
|
-
const items = document.getElementsByTagName('th');
|
|
793
|
-
for (let i = 0; i < items.length; i++) {
|
|
794
|
-
items[i].classList.remove('asc');
|
|
795
|
-
items[i].classList.remove('desc');
|
|
796
|
-
}
|
|
797
|
-
const sort = new Sort();
|
|
798
|
-
const elem = this.targetElem.nativeElement;
|
|
799
|
-
const order = elem.getAttribute('data-order');
|
|
800
|
-
const type = elem.getAttribute('data-type');
|
|
801
|
-
const property = elem.getAttribute('data-name');
|
|
802
|
-
if (order === 'desc') {
|
|
803
|
-
this.lcSort.sort(sort.startSort(property, order, type));
|
|
804
|
-
elem.setAttribute('data-order', 'asc');
|
|
805
|
-
elem.classList.remove('desc');
|
|
806
|
-
elem.classList.add('asc');
|
|
807
|
-
}
|
|
808
|
-
else {
|
|
809
|
-
this.lcSort.sort(sort.startSort(property, order, type));
|
|
810
|
-
elem.setAttribute('data-order', 'desc');
|
|
811
|
-
elem.classList.remove('asc');
|
|
812
|
-
elem.classList.add('desc');
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
SortDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: SortDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive });
|
|
817
|
-
SortDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: SortDirective, selector: "[baseSort]", inputs: { lcSort: "lcSort" }, host: { listeners: { "click": "sortColumn()" } }, ngImport: i0 });
|
|
818
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: SortDirective, decorators: [{
|
|
819
|
-
type: Directive,
|
|
820
|
-
args: [{
|
|
821
|
-
selector: '[baseSort]',
|
|
822
|
-
}]
|
|
823
|
-
}], ctorParameters: function () {
|
|
824
|
-
return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: Document, decorators: [{
|
|
825
|
-
type: Inject,
|
|
826
|
-
args: [DOCUMENT]
|
|
827
|
-
}] }];
|
|
828
|
-
}, propDecorators: { lcSort: [{
|
|
829
|
-
type: Input
|
|
830
|
-
}], sortColumn: [{
|
|
831
|
-
type: HostListener,
|
|
832
|
-
args: ['click']
|
|
833
|
-
}] } });
|
|
834
|
-
|
|
835
|
-
class NavigationService {
|
|
836
|
-
constructor(router, location) {
|
|
837
|
-
this.router = router;
|
|
838
|
-
this.location = location;
|
|
839
|
-
this.history = [];
|
|
840
|
-
this.router.events.subscribe((event) => {
|
|
841
|
-
if (event instanceof NavigationEnd) {
|
|
842
|
-
this.history.push(event.urlAfterRedirects);
|
|
843
|
-
}
|
|
844
|
-
});
|
|
845
|
-
}
|
|
846
|
-
/**
|
|
847
|
-
* If the history stack is empty, navigate to the home page, otherwise go back to the previous page
|
|
848
|
-
*/
|
|
849
|
-
back() {
|
|
850
|
-
this.history.pop();
|
|
851
|
-
if (this.history.length > 0) {
|
|
852
|
-
this.location.back();
|
|
853
|
-
}
|
|
854
|
-
else {
|
|
855
|
-
this.router.navigateByUrl('/');
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
NavigationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NavigationService, deps: [{ token: i1.Router }, { token: i2.Location }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
860
|
-
NavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NavigationService, providedIn: 'root' });
|
|
861
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NavigationService, decorators: [{
|
|
862
|
-
type: Injectable,
|
|
863
|
-
args: [{ providedIn: 'root' }]
|
|
864
|
-
}], ctorParameters: function () { return [{ type: i1.Router }, { type: i2.Location }]; } });
|
|
865
|
-
|
|
866
|
-
class BackButtonDirective {
|
|
867
|
-
constructor(navigation) {
|
|
868
|
-
this.navigation = navigation;
|
|
869
|
-
}
|
|
870
|
-
onClick() {
|
|
871
|
-
this.navigation.back();
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
BackButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BackButtonDirective, deps: [{ token: NavigationService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
875
|
-
BackButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: BackButtonDirective, selector: "[baseBackButton]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
|
|
876
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BackButtonDirective, decorators: [{
|
|
877
|
-
type: Directive,
|
|
878
|
-
args: [{
|
|
879
|
-
selector: '[baseBackButton]',
|
|
880
|
-
}]
|
|
881
|
-
}], ctorParameters: function () { return [{ type: NavigationService }]; }, propDecorators: { onClick: [{
|
|
882
|
-
type: HostListener,
|
|
883
|
-
args: ['click']
|
|
884
|
-
}] } });
|
|
885
|
-
|
|
886
775
|
function debounce(delay = 300) {
|
|
887
776
|
return function (target, propertyKey, descriptor) {
|
|
888
777
|
let timeout = null;
|
|
@@ -1072,6 +961,9 @@ class AuthService {
|
|
|
1072
961
|
// Current User
|
|
1073
962
|
// #################################################################
|
|
1074
963
|
get currentUser() {
|
|
964
|
+
if (!localStorage) {
|
|
965
|
+
return undefined;
|
|
966
|
+
}
|
|
1075
967
|
return this._currentUser.value;
|
|
1076
968
|
}
|
|
1077
969
|
set currentUser(user) {
|
|
@@ -1085,6 +977,9 @@ class AuthService {
|
|
|
1085
977
|
// Token
|
|
1086
978
|
// #################################################################
|
|
1087
979
|
get token() {
|
|
980
|
+
if (!localStorage) {
|
|
981
|
+
return undefined;
|
|
982
|
+
}
|
|
1088
983
|
return this._token.value;
|
|
1089
984
|
}
|
|
1090
985
|
set token(token) {
|
|
@@ -1217,14 +1112,14 @@ class GraphQLMetaService {
|
|
|
1217
1112
|
return observable;
|
|
1218
1113
|
}
|
|
1219
1114
|
}
|
|
1220
|
-
GraphQLMetaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLMetaService, deps: [{ token: i1
|
|
1115
|
+
GraphQLMetaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLMetaService, deps: [{ token: i1.Apollo }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1221
1116
|
GraphQLMetaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLMetaService, providedIn: 'root' });
|
|
1222
1117
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLMetaService, decorators: [{
|
|
1223
1118
|
type: Injectable,
|
|
1224
1119
|
args: [{
|
|
1225
1120
|
providedIn: 'root',
|
|
1226
1121
|
}]
|
|
1227
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1122
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }]; } });
|
|
1228
1123
|
|
|
1229
1124
|
/**
|
|
1230
1125
|
* GraphQL service
|
|
@@ -1627,14 +1522,14 @@ class GraphQLService {
|
|
|
1627
1522
|
return { fieldsString, schemaFields, usedFields };
|
|
1628
1523
|
}
|
|
1629
1524
|
}
|
|
1630
|
-
GraphQLService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLService, deps: [{ token: i1
|
|
1525
|
+
GraphQLService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLService, deps: [{ token: i1.Apollo }, { token: GraphQLMetaService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1631
1526
|
GraphQLService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLService, providedIn: 'root' });
|
|
1632
1527
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLService, decorators: [{
|
|
1633
1528
|
type: Injectable,
|
|
1634
1529
|
args: [{
|
|
1635
1530
|
providedIn: 'root',
|
|
1636
1531
|
}]
|
|
1637
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1532
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }]; } });
|
|
1638
1533
|
|
|
1639
1534
|
/**
|
|
1640
1535
|
* Loader service for loading indication
|
|
@@ -1729,14 +1624,14 @@ class GraphQLPlusService extends GraphQLService {
|
|
|
1729
1624
|
console.error(error);
|
|
1730
1625
|
}
|
|
1731
1626
|
}
|
|
1732
|
-
GraphQLPlusService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLPlusService, deps: [{ token: i1
|
|
1627
|
+
GraphQLPlusService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLPlusService, deps: [{ token: i1.Apollo }, { token: GraphQLMetaService }, { token: LoaderService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1733
1628
|
GraphQLPlusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLPlusService, providedIn: 'root' });
|
|
1734
1629
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLPlusService, decorators: [{
|
|
1735
1630
|
type: Injectable,
|
|
1736
1631
|
args: [{
|
|
1737
1632
|
providedIn: 'root',
|
|
1738
1633
|
}]
|
|
1739
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1634
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }, { type: LoaderService }]; } });
|
|
1740
1635
|
|
|
1741
1636
|
class FormsService {
|
|
1742
1637
|
validateAllFormFields(formGroup) {
|
|
@@ -1836,14 +1731,14 @@ class UserService extends GraphQLPlusService {
|
|
|
1836
1731
|
});
|
|
1837
1732
|
}
|
|
1838
1733
|
}
|
|
1839
|
-
UserService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: UserService, deps: [{ token: i1
|
|
1734
|
+
UserService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: UserService, deps: [{ token: i1.Apollo }, { token: GraphQLMetaService }, { token: LoaderService }, { token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1840
1735
|
UserService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: UserService, providedIn: 'root' });
|
|
1841
1736
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: UserService, decorators: [{
|
|
1842
1737
|
type: Injectable,
|
|
1843
1738
|
args: [{
|
|
1844
1739
|
providedIn: 'root',
|
|
1845
1740
|
}]
|
|
1846
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1741
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }, { type: LoaderService }, { type: AuthService }]; } });
|
|
1847
1742
|
|
|
1848
1743
|
/**
|
|
1849
1744
|
* Image service
|
|
@@ -2093,7 +1988,7 @@ class ScrollService {
|
|
|
2093
1988
|
return this.scrollPromise;
|
|
2094
1989
|
}
|
|
2095
1990
|
}
|
|
2096
|
-
ScrollService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ScrollService, deps: [{ token: i1.Router }, { token: BASE_MODULE_CONFIG }, { token: ImageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1991
|
+
ScrollService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ScrollService, deps: [{ token: i1$1.Router }, { token: BASE_MODULE_CONFIG }, { token: ImageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2097
1992
|
ScrollService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ScrollService, providedIn: 'root' });
|
|
2098
1993
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ScrollService, decorators: [{
|
|
2099
1994
|
type: Injectable,
|
|
@@ -2101,7 +1996,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
2101
1996
|
providedIn: 'root',
|
|
2102
1997
|
}]
|
|
2103
1998
|
}], ctorParameters: function () {
|
|
2104
|
-
return [{ type: i1.Router }, { type: undefined, decorators: [{
|
|
1999
|
+
return [{ type: i1$1.Router }, { type: undefined, decorators: [{
|
|
2105
2000
|
type: Inject,
|
|
2106
2001
|
args: [BASE_MODULE_CONFIG]
|
|
2107
2002
|
}] }, { type: ImageService }];
|
|
@@ -2200,14 +2095,118 @@ class BreadcrumbService {
|
|
|
2200
2095
|
return typeof data.breadcrumb === 'function' ? data.breadcrumb(data) : data.breadcrumb;
|
|
2201
2096
|
}
|
|
2202
2097
|
}
|
|
2203
|
-
BreadcrumbService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BreadcrumbService, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2098
|
+
BreadcrumbService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BreadcrumbService, deps: [{ token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2204
2099
|
BreadcrumbService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BreadcrumbService, providedIn: 'root' });
|
|
2205
2100
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BreadcrumbService, decorators: [{
|
|
2206
2101
|
type: Injectable,
|
|
2207
2102
|
args: [{
|
|
2208
2103
|
providedIn: 'root',
|
|
2209
2104
|
}]
|
|
2210
|
-
}], ctorParameters: function () { return [{ type: i1.Router }]; } });
|
|
2105
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }]; } });
|
|
2106
|
+
|
|
2107
|
+
class NavigationService {
|
|
2108
|
+
constructor(router, location) {
|
|
2109
|
+
this.router = router;
|
|
2110
|
+
this.location = location;
|
|
2111
|
+
this.history = [];
|
|
2112
|
+
this.router.events.subscribe((event) => {
|
|
2113
|
+
if (event instanceof NavigationEnd) {
|
|
2114
|
+
this.history.push(event.urlAfterRedirects);
|
|
2115
|
+
}
|
|
2116
|
+
});
|
|
2117
|
+
}
|
|
2118
|
+
/**
|
|
2119
|
+
* If the history stack is empty, navigate to the home page, otherwise go back to the previous page
|
|
2120
|
+
*/
|
|
2121
|
+
back() {
|
|
2122
|
+
this.history.pop();
|
|
2123
|
+
if (this.history.length > 0) {
|
|
2124
|
+
this.location.back();
|
|
2125
|
+
}
|
|
2126
|
+
else {
|
|
2127
|
+
this.router.navigateByUrl('/');
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
NavigationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NavigationService, deps: [{ token: i1$1.Router }, { token: i2.Location }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2132
|
+
NavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NavigationService, providedIn: 'root' });
|
|
2133
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NavigationService, decorators: [{
|
|
2134
|
+
type: Injectable,
|
|
2135
|
+
args: [{ providedIn: 'root' }]
|
|
2136
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i2.Location }]; } });
|
|
2137
|
+
|
|
2138
|
+
class CmsService {
|
|
2139
|
+
constructor(graphQLService) {
|
|
2140
|
+
this.graphQLService = graphQLService;
|
|
2141
|
+
}
|
|
2142
|
+
/**
|
|
2143
|
+
* It calls the graphQLService to delete the object with the id of the object that is currently being edited
|
|
2144
|
+
*/
|
|
2145
|
+
deleteObject(id, modelName) {
|
|
2146
|
+
return new Promise((resolve, reject) => {
|
|
2147
|
+
if (confirm('Möchtest du das Objekt wirklich löschen?')) {
|
|
2148
|
+
this.graphQLService
|
|
2149
|
+
.graphQl('delete' + this.capitalizeFirstLetter(modelName), {
|
|
2150
|
+
arguments: { id },
|
|
2151
|
+
fields: ['id'],
|
|
2152
|
+
type: GraphQLRequestType.MUTATION,
|
|
2153
|
+
})
|
|
2154
|
+
.subscribe({
|
|
2155
|
+
next: (value) => {
|
|
2156
|
+
resolve(value);
|
|
2157
|
+
},
|
|
2158
|
+
error: (err) => {
|
|
2159
|
+
reject(err);
|
|
2160
|
+
console.error('Error on delete object', err);
|
|
2161
|
+
},
|
|
2162
|
+
});
|
|
2163
|
+
}
|
|
2164
|
+
});
|
|
2165
|
+
}
|
|
2166
|
+
/**
|
|
2167
|
+
* It sends a GraphQL mutation to the server to duplicate the object
|
|
2168
|
+
*/
|
|
2169
|
+
duplicateObject(id, modelName) {
|
|
2170
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2171
|
+
return new Promise((resolve, reject) => {
|
|
2172
|
+
if (confirm('Möchtest du das Objekt wirklich duplizieren?')) {
|
|
2173
|
+
this.graphQLService
|
|
2174
|
+
.graphQl('duplicate' + this.capitalizeFirstLetter(modelName), {
|
|
2175
|
+
arguments: { id },
|
|
2176
|
+
fields: ['id'],
|
|
2177
|
+
type: GraphQLRequestType.MUTATION,
|
|
2178
|
+
})
|
|
2179
|
+
.subscribe({
|
|
2180
|
+
next: (value) => {
|
|
2181
|
+
resolve(value);
|
|
2182
|
+
},
|
|
2183
|
+
error: (err) => {
|
|
2184
|
+
reject(err);
|
|
2185
|
+
console.error('Error on duplicate object', err);
|
|
2186
|
+
},
|
|
2187
|
+
});
|
|
2188
|
+
}
|
|
2189
|
+
});
|
|
2190
|
+
});
|
|
2191
|
+
}
|
|
2192
|
+
/**
|
|
2193
|
+
* It takes a string, capitalizes the first letter, and returns the modified string
|
|
2194
|
+
*
|
|
2195
|
+
* @param value - The string to capitalize.
|
|
2196
|
+
* @returns The first letter of the string is being capitalized and the rest of the string is being returned.
|
|
2197
|
+
*/
|
|
2198
|
+
capitalizeFirstLetter(value) {
|
|
2199
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
CmsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CmsService, deps: [{ token: GraphQLService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2203
|
+
CmsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CmsService, providedIn: 'root' });
|
|
2204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CmsService, decorators: [{
|
|
2205
|
+
type: Injectable,
|
|
2206
|
+
args: [{
|
|
2207
|
+
providedIn: 'root',
|
|
2208
|
+
}]
|
|
2209
|
+
}], ctorParameters: function () { return [{ type: GraphQLService }]; } });
|
|
2211
2210
|
|
|
2212
2211
|
/**
|
|
2213
2212
|
* Comparison operator enum
|
|
@@ -2314,5 +2313,5 @@ function createRestartableClient(options) {
|
|
|
2314
2313
|
* Generated bundle index. Do not edit.
|
|
2315
2314
|
*/
|
|
2316
2315
|
|
|
2317
|
-
export { Auth, AuthService, BASE_MODULE_CONFIG,
|
|
2316
|
+
export { Auth, AuthService, BASE_MODULE_CONFIG, BasicUser, BreadcrumbService, CmsService, ComparisonOperatorEnum, FormsService, GraphQLEnum, GraphQLMeta, GraphQLMetaService, GraphQLPlusService, GraphQLRequestType, GraphQLService, GraphQLType, Helper, ImageService, LoaderService, LogicalOperatorEnum, NavigationService, ScrollService, SkeletonType, Sort, SortOrderEnum, Standard, StorageService, ToastService, ToastType, UserService, Validation, WsService, createRestartableClient, debounce };
|
|
2318
2317
|
//# sourceMappingURL=lenne.tech-ng-base-shared.mjs.map
|