@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,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;
|
|
@@ -1236,14 +1127,14 @@ class GraphQLMetaService {
|
|
|
1236
1127
|
return observable;
|
|
1237
1128
|
}
|
|
1238
1129
|
}
|
|
1239
|
-
GraphQLMetaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLMetaService, deps: [{ token: i1
|
|
1130
|
+
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
1131
|
GraphQLMetaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLMetaService, providedIn: 'root' });
|
|
1241
1132
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLMetaService, decorators: [{
|
|
1242
1133
|
type: Injectable,
|
|
1243
1134
|
args: [{
|
|
1244
1135
|
providedIn: 'root',
|
|
1245
1136
|
}]
|
|
1246
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1137
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }]; } });
|
|
1247
1138
|
|
|
1248
1139
|
/**
|
|
1249
1140
|
* GraphQL service
|
|
@@ -1667,14 +1558,14 @@ class GraphQLService {
|
|
|
1667
1558
|
return { fieldsString, schemaFields, usedFields };
|
|
1668
1559
|
}
|
|
1669
1560
|
}
|
|
1670
|
-
GraphQLService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLService, deps: [{ token: i1
|
|
1561
|
+
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
1562
|
GraphQLService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLService, providedIn: 'root' });
|
|
1672
1563
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLService, decorators: [{
|
|
1673
1564
|
type: Injectable,
|
|
1674
1565
|
args: [{
|
|
1675
1566
|
providedIn: 'root',
|
|
1676
1567
|
}]
|
|
1677
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1568
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }]; } });
|
|
1678
1569
|
|
|
1679
1570
|
/**
|
|
1680
1571
|
* Loader service for loading indication
|
|
@@ -1769,14 +1660,14 @@ class GraphQLPlusService extends GraphQLService {
|
|
|
1769
1660
|
console.error(error);
|
|
1770
1661
|
}
|
|
1771
1662
|
}
|
|
1772
|
-
GraphQLPlusService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLPlusService, deps: [{ token: i1
|
|
1663
|
+
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
1664
|
GraphQLPlusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLPlusService, providedIn: 'root' });
|
|
1774
1665
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLPlusService, decorators: [{
|
|
1775
1666
|
type: Injectable,
|
|
1776
1667
|
args: [{
|
|
1777
1668
|
providedIn: 'root',
|
|
1778
1669
|
}]
|
|
1779
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1670
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }, { type: LoaderService }]; } });
|
|
1780
1671
|
|
|
1781
1672
|
class FormsService {
|
|
1782
1673
|
validateAllFormFields(formGroup) {
|
|
@@ -1876,14 +1767,14 @@ class UserService extends GraphQLPlusService {
|
|
|
1876
1767
|
});
|
|
1877
1768
|
}
|
|
1878
1769
|
}
|
|
1879
|
-
UserService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: UserService, deps: [{ token: i1
|
|
1770
|
+
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
1771
|
UserService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: UserService, providedIn: 'root' });
|
|
1881
1772
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: UserService, decorators: [{
|
|
1882
1773
|
type: Injectable,
|
|
1883
1774
|
args: [{
|
|
1884
1775
|
providedIn: 'root',
|
|
1885
1776
|
}]
|
|
1886
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1777
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }, { type: LoaderService }, { type: AuthService }]; } });
|
|
1887
1778
|
|
|
1888
1779
|
/**
|
|
1889
1780
|
* Image service
|
|
@@ -2146,14 +2037,14 @@ class ScrollService {
|
|
|
2146
2037
|
return this.scrollPromise;
|
|
2147
2038
|
}
|
|
2148
2039
|
}
|
|
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 });
|
|
2040
|
+
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
2041
|
ScrollService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ScrollService, providedIn: 'root' });
|
|
2151
2042
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ScrollService, decorators: [{
|
|
2152
2043
|
type: Injectable,
|
|
2153
2044
|
args: [{
|
|
2154
2045
|
providedIn: 'root',
|
|
2155
2046
|
}]
|
|
2156
|
-
}], ctorParameters: function () { return [{ type: i1.Router }, { type: undefined, decorators: [{
|
|
2047
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }, { type: undefined, decorators: [{
|
|
2157
2048
|
type: Inject,
|
|
2158
2049
|
args: [BASE_MODULE_CONFIG]
|
|
2159
2050
|
}] }, { type: ImageService }]; } });
|
|
@@ -2250,14 +2141,116 @@ class BreadcrumbService {
|
|
|
2250
2141
|
return typeof data.breadcrumb === 'function' ? data.breadcrumb(data) : data.breadcrumb;
|
|
2251
2142
|
}
|
|
2252
2143
|
}
|
|
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 });
|
|
2144
|
+
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
2145
|
BreadcrumbService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BreadcrumbService, providedIn: 'root' });
|
|
2255
2146
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BreadcrumbService, decorators: [{
|
|
2256
2147
|
type: Injectable,
|
|
2257
2148
|
args: [{
|
|
2258
2149
|
providedIn: 'root',
|
|
2259
2150
|
}]
|
|
2260
|
-
}], ctorParameters: function () { return [{ type: i1.Router }]; } });
|
|
2151
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }]; } });
|
|
2152
|
+
|
|
2153
|
+
class NavigationService {
|
|
2154
|
+
constructor(router, location) {
|
|
2155
|
+
this.router = router;
|
|
2156
|
+
this.location = location;
|
|
2157
|
+
this.history = [];
|
|
2158
|
+
this.router.events.subscribe((event) => {
|
|
2159
|
+
if (event instanceof NavigationEnd) {
|
|
2160
|
+
this.history.push(event.urlAfterRedirects);
|
|
2161
|
+
}
|
|
2162
|
+
});
|
|
2163
|
+
}
|
|
2164
|
+
/**
|
|
2165
|
+
* If the history stack is empty, navigate to the home page, otherwise go back to the previous page
|
|
2166
|
+
*/
|
|
2167
|
+
back() {
|
|
2168
|
+
this.history.pop();
|
|
2169
|
+
if (this.history.length > 0) {
|
|
2170
|
+
this.location.back();
|
|
2171
|
+
}
|
|
2172
|
+
else {
|
|
2173
|
+
this.router.navigateByUrl('/');
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
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 });
|
|
2178
|
+
NavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NavigationService, providedIn: 'root' });
|
|
2179
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NavigationService, decorators: [{
|
|
2180
|
+
type: Injectable,
|
|
2181
|
+
args: [{ providedIn: 'root' }]
|
|
2182
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i2.Location }]; } });
|
|
2183
|
+
|
|
2184
|
+
class CmsService {
|
|
2185
|
+
constructor(graphQLService) {
|
|
2186
|
+
this.graphQLService = graphQLService;
|
|
2187
|
+
}
|
|
2188
|
+
/**
|
|
2189
|
+
* It calls the graphQLService to delete the object with the id of the object that is currently being edited
|
|
2190
|
+
*/
|
|
2191
|
+
deleteObject(id, modelName) {
|
|
2192
|
+
return new Promise((resolve, reject) => {
|
|
2193
|
+
if (confirm('Möchtest du das Objekt wirklich löschen?')) {
|
|
2194
|
+
this.graphQLService
|
|
2195
|
+
.graphQl('delete' + this.capitalizeFirstLetter(modelName), {
|
|
2196
|
+
arguments: { id },
|
|
2197
|
+
fields: ['id'],
|
|
2198
|
+
type: GraphQLRequestType.MUTATION,
|
|
2199
|
+
})
|
|
2200
|
+
.subscribe({
|
|
2201
|
+
next: (value) => {
|
|
2202
|
+
resolve(value);
|
|
2203
|
+
},
|
|
2204
|
+
error: (err) => {
|
|
2205
|
+
reject(err);
|
|
2206
|
+
console.error('Error on delete object', err);
|
|
2207
|
+
},
|
|
2208
|
+
});
|
|
2209
|
+
}
|
|
2210
|
+
});
|
|
2211
|
+
}
|
|
2212
|
+
/**
|
|
2213
|
+
* It sends a GraphQL mutation to the server to duplicate the object
|
|
2214
|
+
*/
|
|
2215
|
+
async duplicateObject(id, modelName) {
|
|
2216
|
+
return new Promise((resolve, reject) => {
|
|
2217
|
+
if (confirm('Möchtest du das Objekt wirklich duplizieren?')) {
|
|
2218
|
+
this.graphQLService
|
|
2219
|
+
.graphQl('duplicate' + this.capitalizeFirstLetter(modelName), {
|
|
2220
|
+
arguments: { id },
|
|
2221
|
+
fields: ['id'],
|
|
2222
|
+
type: GraphQLRequestType.MUTATION,
|
|
2223
|
+
})
|
|
2224
|
+
.subscribe({
|
|
2225
|
+
next: (value) => {
|
|
2226
|
+
resolve(value);
|
|
2227
|
+
},
|
|
2228
|
+
error: (err) => {
|
|
2229
|
+
reject(err);
|
|
2230
|
+
console.error('Error on duplicate object', err);
|
|
2231
|
+
},
|
|
2232
|
+
});
|
|
2233
|
+
}
|
|
2234
|
+
});
|
|
2235
|
+
}
|
|
2236
|
+
/**
|
|
2237
|
+
* It takes a string, capitalizes the first letter, and returns the modified string
|
|
2238
|
+
*
|
|
2239
|
+
* @param value - The string to capitalize.
|
|
2240
|
+
* @returns The first letter of the string is being capitalized and the rest of the string is being returned.
|
|
2241
|
+
*/
|
|
2242
|
+
capitalizeFirstLetter(value) {
|
|
2243
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
CmsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CmsService, deps: [{ token: GraphQLService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2247
|
+
CmsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CmsService, providedIn: 'root' });
|
|
2248
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CmsService, decorators: [{
|
|
2249
|
+
type: Injectable,
|
|
2250
|
+
args: [{
|
|
2251
|
+
providedIn: 'root',
|
|
2252
|
+
}]
|
|
2253
|
+
}], ctorParameters: function () { return [{ type: GraphQLService }]; } });
|
|
2261
2254
|
|
|
2262
2255
|
/**
|
|
2263
2256
|
* Comparison operator enum
|
|
@@ -2371,5 +2364,5 @@ function createRestartableClient(options) {
|
|
|
2371
2364
|
* Generated bundle index. Do not edit.
|
|
2372
2365
|
*/
|
|
2373
2366
|
|
|
2374
|
-
export { Auth, AuthService, BASE_MODULE_CONFIG,
|
|
2367
|
+
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
2368
|
//# sourceMappingURL=lenne.tech-ng-base-shared.mjs.map
|