@lenne.tech/ng-base 14.0.5 → 14.1.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-table/model-table.component.mjs +29 -12
- 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/cms.service.mjs +75 -0
- package/esm2020/src/base.module.mjs +1 -5
- package/fesm2015/lenne.tech-ng-base-base-components.mjs +259 -64
- package/fesm2015/lenne.tech-ng-base-base-components.mjs.map +1 -1
- package/fesm2015/lenne.tech-ng-base-shared.mjs +122 -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 +249 -61
- package/fesm2020/lenne.tech-ng-base-base-components.mjs.map +1 -1
- package/fesm2020/lenne.tech-ng-base-shared.mjs +120 -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;
|
|
@@ -1217,14 +1106,14 @@ class GraphQLMetaService {
|
|
|
1217
1106
|
return observable;
|
|
1218
1107
|
}
|
|
1219
1108
|
}
|
|
1220
|
-
GraphQLMetaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLMetaService, deps: [{ token: i1
|
|
1109
|
+
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
1110
|
GraphQLMetaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLMetaService, providedIn: 'root' });
|
|
1222
1111
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLMetaService, decorators: [{
|
|
1223
1112
|
type: Injectable,
|
|
1224
1113
|
args: [{
|
|
1225
1114
|
providedIn: 'root',
|
|
1226
1115
|
}]
|
|
1227
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1116
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }]; } });
|
|
1228
1117
|
|
|
1229
1118
|
/**
|
|
1230
1119
|
* GraphQL service
|
|
@@ -1627,14 +1516,14 @@ class GraphQLService {
|
|
|
1627
1516
|
return { fieldsString, schemaFields, usedFields };
|
|
1628
1517
|
}
|
|
1629
1518
|
}
|
|
1630
|
-
GraphQLService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLService, deps: [{ token: i1
|
|
1519
|
+
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
1520
|
GraphQLService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLService, providedIn: 'root' });
|
|
1632
1521
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLService, decorators: [{
|
|
1633
1522
|
type: Injectable,
|
|
1634
1523
|
args: [{
|
|
1635
1524
|
providedIn: 'root',
|
|
1636
1525
|
}]
|
|
1637
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1526
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }]; } });
|
|
1638
1527
|
|
|
1639
1528
|
/**
|
|
1640
1529
|
* Loader service for loading indication
|
|
@@ -1729,14 +1618,14 @@ class GraphQLPlusService extends GraphQLService {
|
|
|
1729
1618
|
console.error(error);
|
|
1730
1619
|
}
|
|
1731
1620
|
}
|
|
1732
|
-
GraphQLPlusService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLPlusService, deps: [{ token: i1
|
|
1621
|
+
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
1622
|
GraphQLPlusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLPlusService, providedIn: 'root' });
|
|
1734
1623
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLPlusService, decorators: [{
|
|
1735
1624
|
type: Injectable,
|
|
1736
1625
|
args: [{
|
|
1737
1626
|
providedIn: 'root',
|
|
1738
1627
|
}]
|
|
1739
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1628
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }, { type: LoaderService }]; } });
|
|
1740
1629
|
|
|
1741
1630
|
class FormsService {
|
|
1742
1631
|
validateAllFormFields(formGroup) {
|
|
@@ -1836,14 +1725,14 @@ class UserService extends GraphQLPlusService {
|
|
|
1836
1725
|
});
|
|
1837
1726
|
}
|
|
1838
1727
|
}
|
|
1839
|
-
UserService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: UserService, deps: [{ token: i1
|
|
1728
|
+
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
1729
|
UserService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: UserService, providedIn: 'root' });
|
|
1841
1730
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: UserService, decorators: [{
|
|
1842
1731
|
type: Injectable,
|
|
1843
1732
|
args: [{
|
|
1844
1733
|
providedIn: 'root',
|
|
1845
1734
|
}]
|
|
1846
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1735
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }, { type: LoaderService }, { type: AuthService }]; } });
|
|
1847
1736
|
|
|
1848
1737
|
/**
|
|
1849
1738
|
* Image service
|
|
@@ -2093,7 +1982,7 @@ class ScrollService {
|
|
|
2093
1982
|
return this.scrollPromise;
|
|
2094
1983
|
}
|
|
2095
1984
|
}
|
|
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 });
|
|
1985
|
+
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
1986
|
ScrollService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ScrollService, providedIn: 'root' });
|
|
2098
1987
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ScrollService, decorators: [{
|
|
2099
1988
|
type: Injectable,
|
|
@@ -2101,7 +1990,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
2101
1990
|
providedIn: 'root',
|
|
2102
1991
|
}]
|
|
2103
1992
|
}], ctorParameters: function () {
|
|
2104
|
-
return [{ type: i1.Router }, { type: undefined, decorators: [{
|
|
1993
|
+
return [{ type: i1$1.Router }, { type: undefined, decorators: [{
|
|
2105
1994
|
type: Inject,
|
|
2106
1995
|
args: [BASE_MODULE_CONFIG]
|
|
2107
1996
|
}] }, { type: ImageService }];
|
|
@@ -2200,14 +2089,118 @@ class BreadcrumbService {
|
|
|
2200
2089
|
return typeof data.breadcrumb === 'function' ? data.breadcrumb(data) : data.breadcrumb;
|
|
2201
2090
|
}
|
|
2202
2091
|
}
|
|
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 });
|
|
2092
|
+
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
2093
|
BreadcrumbService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BreadcrumbService, providedIn: 'root' });
|
|
2205
2094
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BreadcrumbService, decorators: [{
|
|
2206
2095
|
type: Injectable,
|
|
2207
2096
|
args: [{
|
|
2208
2097
|
providedIn: 'root',
|
|
2209
2098
|
}]
|
|
2210
|
-
}], ctorParameters: function () { return [{ type: i1.Router }]; } });
|
|
2099
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }]; } });
|
|
2100
|
+
|
|
2101
|
+
class NavigationService {
|
|
2102
|
+
constructor(router, location) {
|
|
2103
|
+
this.router = router;
|
|
2104
|
+
this.location = location;
|
|
2105
|
+
this.history = [];
|
|
2106
|
+
this.router.events.subscribe((event) => {
|
|
2107
|
+
if (event instanceof NavigationEnd) {
|
|
2108
|
+
this.history.push(event.urlAfterRedirects);
|
|
2109
|
+
}
|
|
2110
|
+
});
|
|
2111
|
+
}
|
|
2112
|
+
/**
|
|
2113
|
+
* If the history stack is empty, navigate to the home page, otherwise go back to the previous page
|
|
2114
|
+
*/
|
|
2115
|
+
back() {
|
|
2116
|
+
this.history.pop();
|
|
2117
|
+
if (this.history.length > 0) {
|
|
2118
|
+
this.location.back();
|
|
2119
|
+
}
|
|
2120
|
+
else {
|
|
2121
|
+
this.router.navigateByUrl('/');
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
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 });
|
|
2126
|
+
NavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NavigationService, providedIn: 'root' });
|
|
2127
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NavigationService, decorators: [{
|
|
2128
|
+
type: Injectable,
|
|
2129
|
+
args: [{ providedIn: 'root' }]
|
|
2130
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i2.Location }]; } });
|
|
2131
|
+
|
|
2132
|
+
class CmsService {
|
|
2133
|
+
constructor(graphQLService) {
|
|
2134
|
+
this.graphQLService = graphQLService;
|
|
2135
|
+
}
|
|
2136
|
+
/**
|
|
2137
|
+
* It calls the graphQLService to delete the object with the id of the object that is currently being edited
|
|
2138
|
+
*/
|
|
2139
|
+
deleteObject(id, modelName) {
|
|
2140
|
+
return new Promise((resolve, reject) => {
|
|
2141
|
+
if (confirm('Möchtest du das Objekt wirklich löschen?')) {
|
|
2142
|
+
this.graphQLService
|
|
2143
|
+
.graphQl('delete' + this.capitalizeFirstLetter(modelName), {
|
|
2144
|
+
arguments: { id },
|
|
2145
|
+
fields: ['id'],
|
|
2146
|
+
type: GraphQLRequestType.MUTATION,
|
|
2147
|
+
})
|
|
2148
|
+
.subscribe({
|
|
2149
|
+
next: (value) => {
|
|
2150
|
+
resolve(value);
|
|
2151
|
+
},
|
|
2152
|
+
error: (err) => {
|
|
2153
|
+
reject(err);
|
|
2154
|
+
console.error('Error on delete object', err);
|
|
2155
|
+
},
|
|
2156
|
+
});
|
|
2157
|
+
}
|
|
2158
|
+
});
|
|
2159
|
+
}
|
|
2160
|
+
/**
|
|
2161
|
+
* It sends a GraphQL mutation to the server to duplicate the object
|
|
2162
|
+
*/
|
|
2163
|
+
duplicateObject(id, modelName) {
|
|
2164
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2165
|
+
return new Promise((resolve, reject) => {
|
|
2166
|
+
if (confirm('Möchtest du das Objekt wirklich duplizieren?')) {
|
|
2167
|
+
this.graphQLService
|
|
2168
|
+
.graphQl('duplicate' + this.capitalizeFirstLetter(modelName), {
|
|
2169
|
+
arguments: { id },
|
|
2170
|
+
fields: ['id'],
|
|
2171
|
+
type: GraphQLRequestType.MUTATION,
|
|
2172
|
+
})
|
|
2173
|
+
.subscribe({
|
|
2174
|
+
next: (value) => {
|
|
2175
|
+
resolve(value);
|
|
2176
|
+
},
|
|
2177
|
+
error: (err) => {
|
|
2178
|
+
reject(err);
|
|
2179
|
+
console.error('Error on duplicate object', err);
|
|
2180
|
+
},
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2183
|
+
});
|
|
2184
|
+
});
|
|
2185
|
+
}
|
|
2186
|
+
/**
|
|
2187
|
+
* It takes a string, capitalizes the first letter, and returns the modified string
|
|
2188
|
+
*
|
|
2189
|
+
* @param value - The string to capitalize.
|
|
2190
|
+
* @returns The first letter of the string is being capitalized and the rest of the string is being returned.
|
|
2191
|
+
*/
|
|
2192
|
+
capitalizeFirstLetter(value) {
|
|
2193
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
CmsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CmsService, deps: [{ token: GraphQLService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2197
|
+
CmsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CmsService, providedIn: 'root' });
|
|
2198
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CmsService, decorators: [{
|
|
2199
|
+
type: Injectable,
|
|
2200
|
+
args: [{
|
|
2201
|
+
providedIn: 'root',
|
|
2202
|
+
}]
|
|
2203
|
+
}], ctorParameters: function () { return [{ type: GraphQLService }]; } });
|
|
2211
2204
|
|
|
2212
2205
|
/**
|
|
2213
2206
|
* Comparison operator enum
|
|
@@ -2314,5 +2307,5 @@ function createRestartableClient(options) {
|
|
|
2314
2307
|
* Generated bundle index. Do not edit.
|
|
2315
2308
|
*/
|
|
2316
2309
|
|
|
2317
|
-
export { Auth, AuthService, BASE_MODULE_CONFIG,
|
|
2310
|
+
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
2311
|
//# sourceMappingURL=lenne.tech-ng-base-shared.mjs.map
|