@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,16 +1,15 @@
|
|
|
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';
|
|
10
|
+
import * as i1$1 from '@angular/router';
|
|
11
|
+
import { NavigationEnd } from '@angular/router';
|
|
12
|
+
import * as i2 from '@angular/common';
|
|
14
13
|
import { createClient } from 'graphql-ws';
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -758,10 +757,6 @@ class Sort {
|
|
|
758
757
|
}
|
|
759
758
|
/**
|
|
760
759
|
* Sorts clicked column
|
|
761
|
-
*
|
|
762
|
-
* @param property
|
|
763
|
-
* @param order
|
|
764
|
-
* @param type
|
|
765
760
|
*/
|
|
766
761
|
startSort(property, order, type = '') {
|
|
767
762
|
if (order === 'desc') {
|
|
@@ -781,9 +776,6 @@ class Sort {
|
|
|
781
776
|
}
|
|
782
777
|
/**
|
|
783
778
|
* Sorts dates
|
|
784
|
-
*
|
|
785
|
-
* @param a
|
|
786
|
-
* @param b
|
|
787
779
|
*/
|
|
788
780
|
sortDate(a, b) {
|
|
789
781
|
if (a < b) {
|
|
@@ -798,107 +790,6 @@ class Sort {
|
|
|
798
790
|
}
|
|
799
791
|
}
|
|
800
792
|
|
|
801
|
-
class SortDirective {
|
|
802
|
-
constructor(renderer, targetElem, document) {
|
|
803
|
-
this.renderer = renderer;
|
|
804
|
-
this.targetElem = targetElem;
|
|
805
|
-
}
|
|
806
|
-
/**
|
|
807
|
-
* Sorts columns on click
|
|
808
|
-
*/
|
|
809
|
-
sortColumn() {
|
|
810
|
-
const items = document.getElementsByTagName('th');
|
|
811
|
-
for (let i = 0; i < items.length; i++) {
|
|
812
|
-
items[i].classList.remove('asc');
|
|
813
|
-
items[i].classList.remove('desc');
|
|
814
|
-
}
|
|
815
|
-
const sort = new Sort();
|
|
816
|
-
const elem = this.targetElem.nativeElement;
|
|
817
|
-
const order = elem.getAttribute('data-order');
|
|
818
|
-
const type = elem.getAttribute('data-type');
|
|
819
|
-
const property = elem.getAttribute('data-name');
|
|
820
|
-
if (order === 'desc') {
|
|
821
|
-
this.lcSort.sort(sort.startSort(property, order, type));
|
|
822
|
-
elem.setAttribute('data-order', 'asc');
|
|
823
|
-
elem.classList.remove('desc');
|
|
824
|
-
elem.classList.add('asc');
|
|
825
|
-
}
|
|
826
|
-
else {
|
|
827
|
-
this.lcSort.sort(sort.startSort(property, order, type));
|
|
828
|
-
elem.setAttribute('data-order', 'desc');
|
|
829
|
-
elem.classList.remove('asc');
|
|
830
|
-
elem.classList.add('desc');
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
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 });
|
|
835
|
-
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 });
|
|
836
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: SortDirective, decorators: [{
|
|
837
|
-
type: Directive,
|
|
838
|
-
args: [{
|
|
839
|
-
selector: '[baseSort]',
|
|
840
|
-
}]
|
|
841
|
-
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: Document, decorators: [{
|
|
842
|
-
type: Inject,
|
|
843
|
-
args: [DOCUMENT]
|
|
844
|
-
}] }]; }, propDecorators: { lcSort: [{
|
|
845
|
-
type: Input
|
|
846
|
-
}], sortColumn: [{
|
|
847
|
-
type: HostListener,
|
|
848
|
-
args: ['click']
|
|
849
|
-
}] } });
|
|
850
|
-
|
|
851
|
-
class NavigationService {
|
|
852
|
-
constructor(router, location) {
|
|
853
|
-
this.router = router;
|
|
854
|
-
this.location = location;
|
|
855
|
-
this.history = [];
|
|
856
|
-
this.router.events.subscribe((event) => {
|
|
857
|
-
if (event instanceof NavigationEnd) {
|
|
858
|
-
this.history.push(event.urlAfterRedirects);
|
|
859
|
-
}
|
|
860
|
-
});
|
|
861
|
-
}
|
|
862
|
-
/**
|
|
863
|
-
* If the history stack is empty, navigate to the home page, otherwise go back to the previous page
|
|
864
|
-
*/
|
|
865
|
-
back() {
|
|
866
|
-
this.history.pop();
|
|
867
|
-
if (this.history.length > 0) {
|
|
868
|
-
this.location.back();
|
|
869
|
-
}
|
|
870
|
-
else {
|
|
871
|
-
this.router.navigateByUrl('/');
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
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 });
|
|
876
|
-
NavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NavigationService, providedIn: 'root' });
|
|
877
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NavigationService, decorators: [{
|
|
878
|
-
type: Injectable,
|
|
879
|
-
args: [{ providedIn: 'root' }]
|
|
880
|
-
}], ctorParameters: function () { return [{ type: i1.Router }, { type: i2.Location }]; } });
|
|
881
|
-
|
|
882
|
-
class BackButtonDirective {
|
|
883
|
-
constructor(navigation) {
|
|
884
|
-
this.navigation = navigation;
|
|
885
|
-
}
|
|
886
|
-
onClick() {
|
|
887
|
-
this.navigation.back();
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
BackButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BackButtonDirective, deps: [{ token: NavigationService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
891
|
-
BackButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: BackButtonDirective, selector: "[baseBackButton]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
|
|
892
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BackButtonDirective, decorators: [{
|
|
893
|
-
type: Directive,
|
|
894
|
-
args: [{
|
|
895
|
-
selector: '[baseBackButton]',
|
|
896
|
-
}]
|
|
897
|
-
}], ctorParameters: function () { return [{ type: NavigationService }]; }, propDecorators: { onClick: [{
|
|
898
|
-
type: HostListener,
|
|
899
|
-
args: ['click']
|
|
900
|
-
}] } });
|
|
901
|
-
|
|
902
793
|
function debounce(delay = 300) {
|
|
903
794
|
return function (target, propertyKey, descriptor) {
|
|
904
795
|
let timeout = null;
|
|
@@ -1085,6 +976,9 @@ class AuthService {
|
|
|
1085
976
|
// Current User
|
|
1086
977
|
// #################################################################
|
|
1087
978
|
get currentUser() {
|
|
979
|
+
if (!localStorage) {
|
|
980
|
+
return undefined;
|
|
981
|
+
}
|
|
1088
982
|
return this._currentUser.value;
|
|
1089
983
|
}
|
|
1090
984
|
set currentUser(user) {
|
|
@@ -1098,6 +992,9 @@ class AuthService {
|
|
|
1098
992
|
// Token
|
|
1099
993
|
// #################################################################
|
|
1100
994
|
get token() {
|
|
995
|
+
if (!localStorage) {
|
|
996
|
+
return undefined;
|
|
997
|
+
}
|
|
1101
998
|
return this._token.value;
|
|
1102
999
|
}
|
|
1103
1000
|
set token(token) {
|
|
@@ -1236,14 +1133,14 @@ class GraphQLMetaService {
|
|
|
1236
1133
|
return observable;
|
|
1237
1134
|
}
|
|
1238
1135
|
}
|
|
1239
|
-
GraphQLMetaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLMetaService, deps: [{ token: i1
|
|
1136
|
+
GraphQLMetaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLMetaService, deps: [{ token: i1.Apollo }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1240
1137
|
GraphQLMetaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLMetaService, providedIn: 'root' });
|
|
1241
1138
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLMetaService, decorators: [{
|
|
1242
1139
|
type: Injectable,
|
|
1243
1140
|
args: [{
|
|
1244
1141
|
providedIn: 'root',
|
|
1245
1142
|
}]
|
|
1246
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1143
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }]; } });
|
|
1247
1144
|
|
|
1248
1145
|
/**
|
|
1249
1146
|
* GraphQL service
|
|
@@ -1667,14 +1564,14 @@ class GraphQLService {
|
|
|
1667
1564
|
return { fieldsString, schemaFields, usedFields };
|
|
1668
1565
|
}
|
|
1669
1566
|
}
|
|
1670
|
-
GraphQLService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLService, deps: [{ token: i1
|
|
1567
|
+
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 });
|
|
1671
1568
|
GraphQLService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLService, providedIn: 'root' });
|
|
1672
1569
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLService, decorators: [{
|
|
1673
1570
|
type: Injectable,
|
|
1674
1571
|
args: [{
|
|
1675
1572
|
providedIn: 'root',
|
|
1676
1573
|
}]
|
|
1677
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1574
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }]; } });
|
|
1678
1575
|
|
|
1679
1576
|
/**
|
|
1680
1577
|
* Loader service for loading indication
|
|
@@ -1769,14 +1666,14 @@ class GraphQLPlusService extends GraphQLService {
|
|
|
1769
1666
|
console.error(error);
|
|
1770
1667
|
}
|
|
1771
1668
|
}
|
|
1772
|
-
GraphQLPlusService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLPlusService, deps: [{ token: i1
|
|
1669
|
+
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 });
|
|
1773
1670
|
GraphQLPlusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLPlusService, providedIn: 'root' });
|
|
1774
1671
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLPlusService, decorators: [{
|
|
1775
1672
|
type: Injectable,
|
|
1776
1673
|
args: [{
|
|
1777
1674
|
providedIn: 'root',
|
|
1778
1675
|
}]
|
|
1779
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1676
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }, { type: LoaderService }]; } });
|
|
1780
1677
|
|
|
1781
1678
|
class FormsService {
|
|
1782
1679
|
validateAllFormFields(formGroup) {
|
|
@@ -1876,14 +1773,14 @@ class UserService extends GraphQLPlusService {
|
|
|
1876
1773
|
});
|
|
1877
1774
|
}
|
|
1878
1775
|
}
|
|
1879
|
-
UserService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: UserService, deps: [{ token: i1
|
|
1776
|
+
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 });
|
|
1880
1777
|
UserService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: UserService, providedIn: 'root' });
|
|
1881
1778
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: UserService, decorators: [{
|
|
1882
1779
|
type: Injectable,
|
|
1883
1780
|
args: [{
|
|
1884
1781
|
providedIn: 'root',
|
|
1885
1782
|
}]
|
|
1886
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1783
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }, { type: LoaderService }, { type: AuthService }]; } });
|
|
1887
1784
|
|
|
1888
1785
|
/**
|
|
1889
1786
|
* Image service
|
|
@@ -2146,14 +2043,14 @@ class ScrollService {
|
|
|
2146
2043
|
return this.scrollPromise;
|
|
2147
2044
|
}
|
|
2148
2045
|
}
|
|
2149
|
-
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 });
|
|
2046
|
+
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 });
|
|
2150
2047
|
ScrollService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ScrollService, providedIn: 'root' });
|
|
2151
2048
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ScrollService, decorators: [{
|
|
2152
2049
|
type: Injectable,
|
|
2153
2050
|
args: [{
|
|
2154
2051
|
providedIn: 'root',
|
|
2155
2052
|
}]
|
|
2156
|
-
}], ctorParameters: function () { return [{ type: i1.Router }, { type: undefined, decorators: [{
|
|
2053
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }, { type: undefined, decorators: [{
|
|
2157
2054
|
type: Inject,
|
|
2158
2055
|
args: [BASE_MODULE_CONFIG]
|
|
2159
2056
|
}] }, { type: ImageService }]; } });
|
|
@@ -2250,14 +2147,116 @@ class BreadcrumbService {
|
|
|
2250
2147
|
return typeof data.breadcrumb === 'function' ? data.breadcrumb(data) : data.breadcrumb;
|
|
2251
2148
|
}
|
|
2252
2149
|
}
|
|
2253
|
-
BreadcrumbService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BreadcrumbService, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2150
|
+
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 });
|
|
2254
2151
|
BreadcrumbService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BreadcrumbService, providedIn: 'root' });
|
|
2255
2152
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BreadcrumbService, decorators: [{
|
|
2256
2153
|
type: Injectable,
|
|
2257
2154
|
args: [{
|
|
2258
2155
|
providedIn: 'root',
|
|
2259
2156
|
}]
|
|
2260
|
-
}], ctorParameters: function () { return [{ type: i1.Router }]; } });
|
|
2157
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }]; } });
|
|
2158
|
+
|
|
2159
|
+
class NavigationService {
|
|
2160
|
+
constructor(router, location) {
|
|
2161
|
+
this.router = router;
|
|
2162
|
+
this.location = location;
|
|
2163
|
+
this.history = [];
|
|
2164
|
+
this.router.events.subscribe((event) => {
|
|
2165
|
+
if (event instanceof NavigationEnd) {
|
|
2166
|
+
this.history.push(event.urlAfterRedirects);
|
|
2167
|
+
}
|
|
2168
|
+
});
|
|
2169
|
+
}
|
|
2170
|
+
/**
|
|
2171
|
+
* If the history stack is empty, navigate to the home page, otherwise go back to the previous page
|
|
2172
|
+
*/
|
|
2173
|
+
back() {
|
|
2174
|
+
this.history.pop();
|
|
2175
|
+
if (this.history.length > 0) {
|
|
2176
|
+
this.location.back();
|
|
2177
|
+
}
|
|
2178
|
+
else {
|
|
2179
|
+
this.router.navigateByUrl('/');
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
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 });
|
|
2184
|
+
NavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NavigationService, providedIn: 'root' });
|
|
2185
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NavigationService, decorators: [{
|
|
2186
|
+
type: Injectable,
|
|
2187
|
+
args: [{ providedIn: 'root' }]
|
|
2188
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i2.Location }]; } });
|
|
2189
|
+
|
|
2190
|
+
class CmsService {
|
|
2191
|
+
constructor(graphQLService) {
|
|
2192
|
+
this.graphQLService = graphQLService;
|
|
2193
|
+
}
|
|
2194
|
+
/**
|
|
2195
|
+
* It calls the graphQLService to delete the object with the id of the object that is currently being edited
|
|
2196
|
+
*/
|
|
2197
|
+
deleteObject(id, modelName) {
|
|
2198
|
+
return new Promise((resolve, reject) => {
|
|
2199
|
+
if (confirm('Möchtest du das Objekt wirklich löschen?')) {
|
|
2200
|
+
this.graphQLService
|
|
2201
|
+
.graphQl('delete' + this.capitalizeFirstLetter(modelName), {
|
|
2202
|
+
arguments: { id },
|
|
2203
|
+
fields: ['id'],
|
|
2204
|
+
type: GraphQLRequestType.MUTATION,
|
|
2205
|
+
})
|
|
2206
|
+
.subscribe({
|
|
2207
|
+
next: (value) => {
|
|
2208
|
+
resolve(value);
|
|
2209
|
+
},
|
|
2210
|
+
error: (err) => {
|
|
2211
|
+
reject(err);
|
|
2212
|
+
console.error('Error on delete object', err);
|
|
2213
|
+
},
|
|
2214
|
+
});
|
|
2215
|
+
}
|
|
2216
|
+
});
|
|
2217
|
+
}
|
|
2218
|
+
/**
|
|
2219
|
+
* It sends a GraphQL mutation to the server to duplicate the object
|
|
2220
|
+
*/
|
|
2221
|
+
async duplicateObject(id, modelName) {
|
|
2222
|
+
return new Promise((resolve, reject) => {
|
|
2223
|
+
if (confirm('Möchtest du das Objekt wirklich duplizieren?')) {
|
|
2224
|
+
this.graphQLService
|
|
2225
|
+
.graphQl('duplicate' + this.capitalizeFirstLetter(modelName), {
|
|
2226
|
+
arguments: { id },
|
|
2227
|
+
fields: ['id'],
|
|
2228
|
+
type: GraphQLRequestType.MUTATION,
|
|
2229
|
+
})
|
|
2230
|
+
.subscribe({
|
|
2231
|
+
next: (value) => {
|
|
2232
|
+
resolve(value);
|
|
2233
|
+
},
|
|
2234
|
+
error: (err) => {
|
|
2235
|
+
reject(err);
|
|
2236
|
+
console.error('Error on duplicate object', err);
|
|
2237
|
+
},
|
|
2238
|
+
});
|
|
2239
|
+
}
|
|
2240
|
+
});
|
|
2241
|
+
}
|
|
2242
|
+
/**
|
|
2243
|
+
* It takes a string, capitalizes the first letter, and returns the modified string
|
|
2244
|
+
*
|
|
2245
|
+
* @param value - The string to capitalize.
|
|
2246
|
+
* @returns The first letter of the string is being capitalized and the rest of the string is being returned.
|
|
2247
|
+
*/
|
|
2248
|
+
capitalizeFirstLetter(value) {
|
|
2249
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
CmsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CmsService, deps: [{ token: GraphQLService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2253
|
+
CmsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CmsService, providedIn: 'root' });
|
|
2254
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CmsService, decorators: [{
|
|
2255
|
+
type: Injectable,
|
|
2256
|
+
args: [{
|
|
2257
|
+
providedIn: 'root',
|
|
2258
|
+
}]
|
|
2259
|
+
}], ctorParameters: function () { return [{ type: GraphQLService }]; } });
|
|
2261
2260
|
|
|
2262
2261
|
/**
|
|
2263
2262
|
* Comparison operator enum
|
|
@@ -2371,5 +2370,5 @@ function createRestartableClient(options) {
|
|
|
2371
2370
|
* Generated bundle index. Do not edit.
|
|
2372
2371
|
*/
|
|
2373
2372
|
|
|
2374
|
-
export { Auth, AuthService, BASE_MODULE_CONFIG,
|
|
2373
|
+
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 };
|
|
2375
2374
|
//# sourceMappingURL=lenne.tech-ng-base-shared.mjs.map
|