@lenne.tech/ng-base 14.0.3 → 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 +9 -4
- package/base-components/components/model-form-sub/model-form-sub.component.d.ts +7 -3
- package/base-components/components/model-table/model-table.component.d.ts +14 -5
- package/base-components/components/refence-input/refence-input.component.d.ts +10 -4
- 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 +87 -58
- package/esm2020/base-components/components/model-form-sub/model-form-sub.component.mjs +9 -3
- package/esm2020/base-components/components/model-table/model-table.component.mjs +30 -13
- package/esm2020/base-components/components/refence-input/refence-input.component.mjs +28 -22
- package/esm2020/base-components/components/tags/tags.component.mjs +2 -2
- package/esm2020/base-components/components/upload-image/upload-image.component.mjs +3 -5
- 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/graphql-meta.class.mjs +52 -28
- package/esm2020/shared/classes/graphql-type.class.mjs +2 -1
- 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/shared/services/graphql.service.mjs +30 -36
- package/esm2020/src/base.module.mjs +1 -5
- package/fesm2015/lenne.tech-ng-base-base-components.mjs +361 -114
- package/fesm2015/lenne.tech-ng-base-base-components.mjs.map +1 -1
- package/fesm2015/lenne.tech-ng-base-shared.mjs +203 -190
- 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 +340 -99
- package/fesm2020/lenne.tech-ng-base-base-components.mjs.map +1 -1
- package/fesm2020/lenne.tech-ng-base-shared.mjs +201 -188
- 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/graphql-meta.class.d.ts +7 -4
- package/shared/classes/graphql-type.class.d.ts +1 -0
- 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/shared/services/graphql.service.d.ts +4 -4
- 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,18 +1,16 @@
|
|
|
1
|
-
import { GraphQLInputObjectType, GraphQLNonNull, GraphQLList, buildClientSchema, getIntrospectionQuery } from 'graphql';
|
|
2
|
-
import { cloneDeep } from '@apollo/client/utilities';
|
|
1
|
+
import { GraphQLInputObjectType, GraphQLScalarType, GraphQLEnumType, GraphQLNonNull, GraphQLList, buildClientSchema, getIntrospectionQuery } from 'graphql';
|
|
3
2
|
import * as i0 from '@angular/core';
|
|
4
|
-
import {
|
|
5
|
-
import * as i2 from '@angular/common';
|
|
6
|
-
import { DOCUMENT } from '@angular/common';
|
|
7
|
-
import * as i1 from '@angular/router';
|
|
8
|
-
import { NavigationEnd } from '@angular/router';
|
|
3
|
+
import { InjectionToken, Injectable, Inject } from '@angular/core';
|
|
9
4
|
import { BehaviorSubject, of, throwError, Observable, map as map$1, filter } from 'rxjs';
|
|
10
|
-
import * as i1
|
|
5
|
+
import * as i1 from 'apollo-angular';
|
|
11
6
|
import { gql } from 'apollo-angular';
|
|
12
7
|
import { sha256 } from 'js-sha256';
|
|
13
8
|
import { map } from 'rxjs/operators';
|
|
14
9
|
import { UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
|
15
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';
|
|
16
14
|
import { createClient } from 'graphql-ws';
|
|
17
15
|
|
|
18
16
|
/**
|
|
@@ -419,6 +417,7 @@ class GraphQLType extends Standard {
|
|
|
419
417
|
constructor() {
|
|
420
418
|
super(...arguments);
|
|
421
419
|
this.type = '';
|
|
420
|
+
this.fields = {};
|
|
422
421
|
this.isRequired = false;
|
|
423
422
|
this.isItemRequired = false;
|
|
424
423
|
this.isList = false;
|
|
@@ -506,10 +505,10 @@ class GraphQLMeta {
|
|
|
506
505
|
}
|
|
507
506
|
}
|
|
508
507
|
const func = this.getFunction(functionName, { type });
|
|
509
|
-
const result =
|
|
508
|
+
const result = new GraphQLType();
|
|
510
509
|
if (func === null || func === void 0 ? void 0 : func.args) {
|
|
511
510
|
func.args.forEach((item) => {
|
|
512
|
-
result[item.name] = this.getDeepType(item.type);
|
|
511
|
+
result.fields[item.name] = this.getDeepType(item.type);
|
|
513
512
|
});
|
|
514
513
|
}
|
|
515
514
|
// Set cache
|
|
@@ -572,22 +571,48 @@ class GraphQLMeta {
|
|
|
572
571
|
getType(name) {
|
|
573
572
|
return this.schema.getType(name);
|
|
574
573
|
}
|
|
574
|
+
/**
|
|
575
|
+
* Get (deep) type name
|
|
576
|
+
*/
|
|
577
|
+
getTypeName(type) {
|
|
578
|
+
if (type instanceof GraphQLInputObjectType ||
|
|
579
|
+
type instanceof GraphQLScalarType ||
|
|
580
|
+
type instanceof GraphQLEnumType) {
|
|
581
|
+
return type.name;
|
|
582
|
+
}
|
|
583
|
+
else if (type.type) {
|
|
584
|
+
return this.getTypeName(type.type);
|
|
585
|
+
}
|
|
586
|
+
else if (type.ofType) {
|
|
587
|
+
return this.getTypeName(type.ofType);
|
|
588
|
+
}
|
|
589
|
+
else {
|
|
590
|
+
return type.name;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
575
593
|
/**
|
|
576
594
|
* Get deep type data
|
|
577
595
|
*/
|
|
578
|
-
getDeepType(type, prepared =
|
|
596
|
+
getDeepType(type, prepared = {}, setMetaData = false) {
|
|
579
597
|
var _a, _b;
|
|
580
598
|
// Check type
|
|
581
599
|
if (!type) {
|
|
582
600
|
return type;
|
|
583
601
|
}
|
|
584
602
|
// Infinite regress protection
|
|
585
|
-
const
|
|
603
|
+
const typeName = this.getTypeName(type);
|
|
604
|
+
const graphQLType = GraphQLType.map({
|
|
605
|
+
type: this.getTypeName(type),
|
|
606
|
+
});
|
|
586
607
|
// Check prepared
|
|
587
608
|
if (typeof type === 'object') {
|
|
588
|
-
const preparedType = prepared
|
|
609
|
+
const preparedType = prepared[typeName];
|
|
610
|
+
// Work with cached type
|
|
589
611
|
if (preparedType) {
|
|
590
|
-
|
|
612
|
+
// Create a new object to protect own isXXX information
|
|
613
|
+
const clone = Object.assign({}, preparedType);
|
|
614
|
+
// But use fields as reference to get future changes via prepared caching
|
|
615
|
+
clone.fields = preparedType.fields;
|
|
591
616
|
// Disable meta flags for sub objects
|
|
592
617
|
if ((type === null || type === void 0 ? void 0 : type.type) instanceof GraphQLInputObjectType ||
|
|
593
618
|
((type === null || type === void 0 ? void 0 : type.type) instanceof GraphQLNonNull && ((_a = type === null || type === void 0 ? void 0 : type.type) === null || _a === void 0 ? void 0 : _a.ofType) instanceof GraphQLInputObjectType && setMetaData)) {
|
|
@@ -621,25 +646,29 @@ class GraphQLMeta {
|
|
|
621
646
|
}
|
|
622
647
|
return clone;
|
|
623
648
|
}
|
|
624
|
-
// Set prepared
|
|
625
|
-
|
|
649
|
+
// Set prepared cache for GraphQL types
|
|
650
|
+
// (type names start with uppercase letters as opposed to property names that start with lowercase letters)
|
|
651
|
+
if (type.name && type.name[0].toUpperCase() === type.name[0] && !prepared[type.name]) {
|
|
652
|
+
prepared[type.name] = graphQLType;
|
|
653
|
+
}
|
|
626
654
|
}
|
|
627
655
|
// Search deeper
|
|
628
656
|
if (type.ofType) {
|
|
629
657
|
const ofTypeResult = this.getDeepType(type.ofType, prepared, setMetaData);
|
|
630
|
-
Object.assign(
|
|
631
|
-
return
|
|
658
|
+
Object.assign(graphQLType, ofTypeResult);
|
|
659
|
+
return graphQLType;
|
|
632
660
|
}
|
|
633
661
|
// Process fields
|
|
634
662
|
if (type._fields) {
|
|
635
|
-
const
|
|
663
|
+
const fields = {};
|
|
636
664
|
for (const [key, value] of Object.entries(type._fields)) {
|
|
637
|
-
|
|
665
|
+
fields[key] = this.getDeepType(value, prepared, true);
|
|
638
666
|
}
|
|
639
|
-
|
|
640
|
-
|
|
667
|
+
// Assign and not replace to preserve updates in the cache
|
|
668
|
+
Object.assign(graphQLType.fields, fields);
|
|
669
|
+
return graphQLType;
|
|
641
670
|
}
|
|
642
|
-
//
|
|
671
|
+
// Process type
|
|
643
672
|
if (type.type) {
|
|
644
673
|
const typeResult = this.getDeepType(type.type, prepared, setMetaData);
|
|
645
674
|
// Disable meta flags for sub objects
|
|
@@ -673,25 +702,20 @@ class GraphQLMeta {
|
|
|
673
702
|
}
|
|
674
703
|
}
|
|
675
704
|
}
|
|
676
|
-
Object.assign(
|
|
677
|
-
return
|
|
705
|
+
Object.assign(graphQLType, typeResult);
|
|
706
|
+
return graphQLType;
|
|
678
707
|
}
|
|
679
|
-
// Initialize GraphQLType
|
|
680
|
-
const graphqlType = GraphQLType.map({
|
|
681
|
-
type: type.name,
|
|
682
|
-
});
|
|
683
708
|
// Set enum values
|
|
684
709
|
if (!!type._values) {
|
|
685
|
-
|
|
710
|
+
graphQLType.isEnum = true;
|
|
686
711
|
for (const [key, value] of Object.entries(type._nameLookup)) {
|
|
687
712
|
if (!value.isDeprecated) {
|
|
688
|
-
|
|
713
|
+
graphQLType.validEnums.push(key);
|
|
689
714
|
}
|
|
690
715
|
}
|
|
691
716
|
}
|
|
692
717
|
// Finish
|
|
693
|
-
|
|
694
|
-
return graphqlType;
|
|
718
|
+
return graphQLType;
|
|
695
719
|
}
|
|
696
720
|
}
|
|
697
721
|
|
|
@@ -715,10 +739,6 @@ class Sort {
|
|
|
715
739
|
}
|
|
716
740
|
/**
|
|
717
741
|
* Sorts clicked column
|
|
718
|
-
*
|
|
719
|
-
* @param property
|
|
720
|
-
* @param order
|
|
721
|
-
* @param type
|
|
722
742
|
*/
|
|
723
743
|
startSort(property, order, type = '') {
|
|
724
744
|
if (order === 'desc') {
|
|
@@ -738,9 +758,6 @@ class Sort {
|
|
|
738
758
|
}
|
|
739
759
|
/**
|
|
740
760
|
* Sorts dates
|
|
741
|
-
*
|
|
742
|
-
* @param a
|
|
743
|
-
* @param b
|
|
744
761
|
*/
|
|
745
762
|
sortDate(a, b) {
|
|
746
763
|
if (a < b) {
|
|
@@ -755,109 +772,6 @@ class Sort {
|
|
|
755
772
|
}
|
|
756
773
|
}
|
|
757
774
|
|
|
758
|
-
class SortDirective {
|
|
759
|
-
constructor(renderer, targetElem, document) {
|
|
760
|
-
this.renderer = renderer;
|
|
761
|
-
this.targetElem = targetElem;
|
|
762
|
-
}
|
|
763
|
-
/**
|
|
764
|
-
* Sorts columns on click
|
|
765
|
-
*/
|
|
766
|
-
sortColumn() {
|
|
767
|
-
const items = document.getElementsByTagName('th');
|
|
768
|
-
for (let i = 0; i < items.length; i++) {
|
|
769
|
-
items[i].classList.remove('asc');
|
|
770
|
-
items[i].classList.remove('desc');
|
|
771
|
-
}
|
|
772
|
-
const sort = new Sort();
|
|
773
|
-
const elem = this.targetElem.nativeElement;
|
|
774
|
-
const order = elem.getAttribute('data-order');
|
|
775
|
-
const type = elem.getAttribute('data-type');
|
|
776
|
-
const property = elem.getAttribute('data-name');
|
|
777
|
-
if (order === 'desc') {
|
|
778
|
-
this.lcSort.sort(sort.startSort(property, order, type));
|
|
779
|
-
elem.setAttribute('data-order', 'asc');
|
|
780
|
-
elem.classList.remove('desc');
|
|
781
|
-
elem.classList.add('asc');
|
|
782
|
-
}
|
|
783
|
-
else {
|
|
784
|
-
this.lcSort.sort(sort.startSort(property, order, type));
|
|
785
|
-
elem.setAttribute('data-order', 'desc');
|
|
786
|
-
elem.classList.remove('asc');
|
|
787
|
-
elem.classList.add('desc');
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
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 });
|
|
792
|
-
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 });
|
|
793
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: SortDirective, decorators: [{
|
|
794
|
-
type: Directive,
|
|
795
|
-
args: [{
|
|
796
|
-
selector: '[baseSort]',
|
|
797
|
-
}]
|
|
798
|
-
}], ctorParameters: function () {
|
|
799
|
-
return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: Document, decorators: [{
|
|
800
|
-
type: Inject,
|
|
801
|
-
args: [DOCUMENT]
|
|
802
|
-
}] }];
|
|
803
|
-
}, propDecorators: { lcSort: [{
|
|
804
|
-
type: Input
|
|
805
|
-
}], sortColumn: [{
|
|
806
|
-
type: HostListener,
|
|
807
|
-
args: ['click']
|
|
808
|
-
}] } });
|
|
809
|
-
|
|
810
|
-
class NavigationService {
|
|
811
|
-
constructor(router, location) {
|
|
812
|
-
this.router = router;
|
|
813
|
-
this.location = location;
|
|
814
|
-
this.history = [];
|
|
815
|
-
this.router.events.subscribe((event) => {
|
|
816
|
-
if (event instanceof NavigationEnd) {
|
|
817
|
-
this.history.push(event.urlAfterRedirects);
|
|
818
|
-
}
|
|
819
|
-
});
|
|
820
|
-
}
|
|
821
|
-
/**
|
|
822
|
-
* If the history stack is empty, navigate to the home page, otherwise go back to the previous page
|
|
823
|
-
*/
|
|
824
|
-
back() {
|
|
825
|
-
this.history.pop();
|
|
826
|
-
if (this.history.length > 0) {
|
|
827
|
-
this.location.back();
|
|
828
|
-
}
|
|
829
|
-
else {
|
|
830
|
-
this.router.navigateByUrl('/');
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
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 });
|
|
835
|
-
NavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NavigationService, providedIn: 'root' });
|
|
836
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NavigationService, decorators: [{
|
|
837
|
-
type: Injectable,
|
|
838
|
-
args: [{ providedIn: 'root' }]
|
|
839
|
-
}], ctorParameters: function () { return [{ type: i1.Router }, { type: i2.Location }]; } });
|
|
840
|
-
|
|
841
|
-
class BackButtonDirective {
|
|
842
|
-
constructor(navigation) {
|
|
843
|
-
this.navigation = navigation;
|
|
844
|
-
}
|
|
845
|
-
onClick() {
|
|
846
|
-
this.navigation.back();
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
BackButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BackButtonDirective, deps: [{ token: NavigationService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
850
|
-
BackButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: BackButtonDirective, selector: "[baseBackButton]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
|
|
851
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BackButtonDirective, decorators: [{
|
|
852
|
-
type: Directive,
|
|
853
|
-
args: [{
|
|
854
|
-
selector: '[baseBackButton]',
|
|
855
|
-
}]
|
|
856
|
-
}], ctorParameters: function () { return [{ type: NavigationService }]; }, propDecorators: { onClick: [{
|
|
857
|
-
type: HostListener,
|
|
858
|
-
args: ['click']
|
|
859
|
-
}] } });
|
|
860
|
-
|
|
861
775
|
function debounce(delay = 300) {
|
|
862
776
|
return function (target, propertyKey, descriptor) {
|
|
863
777
|
let timeout = null;
|
|
@@ -1192,14 +1106,14 @@ class GraphQLMetaService {
|
|
|
1192
1106
|
return observable;
|
|
1193
1107
|
}
|
|
1194
1108
|
}
|
|
1195
|
-
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 });
|
|
1196
1110
|
GraphQLMetaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLMetaService, providedIn: 'root' });
|
|
1197
1111
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLMetaService, decorators: [{
|
|
1198
1112
|
type: Injectable,
|
|
1199
1113
|
args: [{
|
|
1200
1114
|
providedIn: 'root',
|
|
1201
1115
|
}]
|
|
1202
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1116
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }]; } });
|
|
1203
1117
|
|
|
1204
1118
|
/**
|
|
1205
1119
|
* GraphQL service
|
|
@@ -1259,7 +1173,7 @@ class GraphQLService {
|
|
|
1259
1173
|
fieldsData.usedFields.sort();
|
|
1260
1174
|
fieldsData.schemaFields.sort();
|
|
1261
1175
|
const filtered = fieldsData.schemaFields.filter((field) => !fieldsData.usedFields.includes(field));
|
|
1262
|
-
const unused = this.
|
|
1176
|
+
const unused = this.graphQLTypeToStringArray(allowedFields).filter((field) => !fieldsData.usedFields.includes(field));
|
|
1263
1177
|
console.log({ fieldsData, filtered, unused });
|
|
1264
1178
|
}
|
|
1265
1179
|
fields = fieldsData.fieldsString;
|
|
@@ -1285,7 +1199,7 @@ class GraphQLService {
|
|
|
1285
1199
|
argsData.usedArgs.sort();
|
|
1286
1200
|
argsData.schemaArgs.sort();
|
|
1287
1201
|
const filtered = argsData.schemaArgs.filter((field) => !argsData.usedArgs.includes(field));
|
|
1288
|
-
const unused = this.
|
|
1202
|
+
const unused = this.graphQLTypeToStringArray(allowedArgs)
|
|
1289
1203
|
.sort()
|
|
1290
1204
|
.filter((field) => !argsData.usedArgs.includes(field));
|
|
1291
1205
|
console.log({ argsData, filtered, unused });
|
|
@@ -1353,25 +1267,21 @@ class GraphQLService {
|
|
|
1353
1267
|
/**
|
|
1354
1268
|
* Get fields / args from IGraphQLTypeCollection
|
|
1355
1269
|
*/
|
|
1356
|
-
|
|
1357
|
-
if (
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
if (current === key || cacheNode.includes(key)) {
|
|
1370
|
-
continue;
|
|
1371
|
-
}
|
|
1372
|
-
this.graphQLTypeCollectionToStringArray(collection[key], current ? current + '.' + key : key, result, cacheNode);
|
|
1373
|
-
}
|
|
1270
|
+
graphQLTypeToStringArray(graphQLType, current = '', result = [], cacheNode = []) {
|
|
1271
|
+
if (!graphQLType) {
|
|
1272
|
+
return result;
|
|
1273
|
+
}
|
|
1274
|
+
if (current === null || current === void 0 ? void 0 : current.includes('.')) {
|
|
1275
|
+
cacheNode.push(current.split('.')[1]);
|
|
1276
|
+
}
|
|
1277
|
+
else if (current) {
|
|
1278
|
+
cacheNode.push(current);
|
|
1279
|
+
}
|
|
1280
|
+
for (const key of Object.keys(graphQLType.fields)) {
|
|
1281
|
+
if (current === key || cacheNode.includes(key)) {
|
|
1282
|
+
continue;
|
|
1374
1283
|
}
|
|
1284
|
+
this.graphQLTypeToStringArray(graphQLType.fields[key], current ? current + '.' + key : key, result, cacheNode);
|
|
1375
1285
|
}
|
|
1376
1286
|
return result;
|
|
1377
1287
|
}
|
|
@@ -1389,18 +1299,18 @@ class GraphQLService {
|
|
|
1389
1299
|
const result = [];
|
|
1390
1300
|
// Process array
|
|
1391
1301
|
if (Array.isArray(args)) {
|
|
1392
|
-
const allowedKeys = allowed ? Object.keys(allowed) : null;
|
|
1302
|
+
const allowedKeys = allowed ? Object.keys(allowed.fields) : null;
|
|
1393
1303
|
for (const item of args) {
|
|
1394
1304
|
let key = null;
|
|
1395
1305
|
if (allowed) {
|
|
1396
|
-
if (
|
|
1306
|
+
if (!allowedKeys || allowedKeys.length < 1) {
|
|
1397
1307
|
break;
|
|
1398
1308
|
}
|
|
1399
|
-
key = allowedKeys
|
|
1309
|
+
key = allowedKeys.shift();
|
|
1400
1310
|
}
|
|
1401
1311
|
// Process value
|
|
1402
1312
|
result.push(this.prepareArguments(item, {
|
|
1403
|
-
allowed: key ? allowed[key] : null,
|
|
1313
|
+
allowed: key ? allowed.fields[key] : null,
|
|
1404
1314
|
level: level + 1,
|
|
1405
1315
|
parent: parent + key + '.',
|
|
1406
1316
|
schemaArgs,
|
|
@@ -1432,7 +1342,7 @@ class GraphQLService {
|
|
|
1432
1342
|
schemaArgs.push(currentKey);
|
|
1433
1343
|
// If the allowed key handling is enabled and the current key is not included in the list of allowed keys,
|
|
1434
1344
|
// the current key will be skipped
|
|
1435
|
-
if (allowed && !allowed[key]) {
|
|
1345
|
+
if (allowed && !allowed.fields[key]) {
|
|
1436
1346
|
continue;
|
|
1437
1347
|
}
|
|
1438
1348
|
// Skip value if not exists
|
|
@@ -1455,7 +1365,7 @@ class GraphQLService {
|
|
|
1455
1365
|
result.push(key +
|
|
1456
1366
|
': [' +
|
|
1457
1367
|
value.map((item) => this.prepareArguments(item, {
|
|
1458
|
-
allowed: allowed[key],
|
|
1368
|
+
allowed: allowed.fields[key],
|
|
1459
1369
|
level: level + 1,
|
|
1460
1370
|
parent: currentKey + '.',
|
|
1461
1371
|
schemaArgs,
|
|
@@ -1473,7 +1383,7 @@ class GraphQLService {
|
|
|
1473
1383
|
// Value is a string
|
|
1474
1384
|
else if (typeof value === 'string') {
|
|
1475
1385
|
// Enum (doesn't need quotation marks)
|
|
1476
|
-
if (allowed[key].isEnum) {
|
|
1386
|
+
if (allowed.fields[key].isEnum) {
|
|
1477
1387
|
additionalResult += value;
|
|
1478
1388
|
}
|
|
1479
1389
|
// String
|
|
@@ -1488,7 +1398,7 @@ class GraphQLService {
|
|
|
1488
1398
|
// Others
|
|
1489
1399
|
else {
|
|
1490
1400
|
additionalResult += this.prepareArguments(value, {
|
|
1491
|
-
allowed: allowed[key],
|
|
1401
|
+
allowed: allowed.fields[key],
|
|
1492
1402
|
level: level + 1,
|
|
1493
1403
|
parent: currentKey + '.',
|
|
1494
1404
|
schemaArgs,
|
|
@@ -1529,8 +1439,7 @@ class GraphQLService {
|
|
|
1529
1439
|
}
|
|
1530
1440
|
// Process string
|
|
1531
1441
|
if (typeof fields === 'string') {
|
|
1532
|
-
if (allowed &&
|
|
1533
|
-
((typeof allowed === 'string' && allowed !== fields) || (typeof allowed === 'object' && !allowed[fields]))) {
|
|
1442
|
+
if (allowed && !allowed.fields[fields]) {
|
|
1534
1443
|
return { fieldsString, schemaFields, usedFields };
|
|
1535
1444
|
}
|
|
1536
1445
|
return { fieldsString: '\n' + ' '.repeat(spaces).repeat(tab) + fields, schemaFields, usedFields };
|
|
@@ -1553,14 +1462,14 @@ class GraphQLService {
|
|
|
1553
1462
|
}
|
|
1554
1463
|
const currentPath = parent + item;
|
|
1555
1464
|
schemaFields.push(currentPath);
|
|
1556
|
-
if (allowed && !
|
|
1465
|
+
if (allowed && !allowed.fields[item]) {
|
|
1557
1466
|
continue;
|
|
1558
1467
|
}
|
|
1559
1468
|
usedFields.push(currentPath);
|
|
1560
1469
|
fieldsString =
|
|
1561
1470
|
fieldsString +
|
|
1562
1471
|
this.prepareFields(item, {
|
|
1563
|
-
allowed:
|
|
1472
|
+
allowed: null,
|
|
1564
1473
|
parent: currentPath + '.',
|
|
1565
1474
|
spaces,
|
|
1566
1475
|
schemaFields,
|
|
@@ -1574,7 +1483,7 @@ class GraphQLService {
|
|
|
1574
1483
|
for (const [key, val] of Object.entries(fields)) {
|
|
1575
1484
|
const currentPath = parent + key;
|
|
1576
1485
|
schemaFields.push(currentPath);
|
|
1577
|
-
if (allowed && !allowed[key]) {
|
|
1486
|
+
if (allowed && !allowed.fields[key]) {
|
|
1578
1487
|
continue;
|
|
1579
1488
|
}
|
|
1580
1489
|
usedFields.push(currentPath);
|
|
@@ -1590,7 +1499,7 @@ class GraphQLService {
|
|
|
1590
1499
|
' ' +
|
|
1591
1500
|
'{' +
|
|
1592
1501
|
this.prepareFields(val, {
|
|
1593
|
-
allowed:
|
|
1502
|
+
allowed: allowed.fields[key],
|
|
1594
1503
|
parent: currentPath + '.',
|
|
1595
1504
|
spaces,
|
|
1596
1505
|
schemaFields,
|
|
@@ -1607,14 +1516,14 @@ class GraphQLService {
|
|
|
1607
1516
|
return { fieldsString, schemaFields, usedFields };
|
|
1608
1517
|
}
|
|
1609
1518
|
}
|
|
1610
|
-
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 });
|
|
1611
1520
|
GraphQLService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLService, providedIn: 'root' });
|
|
1612
1521
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLService, decorators: [{
|
|
1613
1522
|
type: Injectable,
|
|
1614
1523
|
args: [{
|
|
1615
1524
|
providedIn: 'root',
|
|
1616
1525
|
}]
|
|
1617
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1526
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }]; } });
|
|
1618
1527
|
|
|
1619
1528
|
/**
|
|
1620
1529
|
* Loader service for loading indication
|
|
@@ -1709,14 +1618,14 @@ class GraphQLPlusService extends GraphQLService {
|
|
|
1709
1618
|
console.error(error);
|
|
1710
1619
|
}
|
|
1711
1620
|
}
|
|
1712
|
-
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 });
|
|
1713
1622
|
GraphQLPlusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLPlusService, providedIn: 'root' });
|
|
1714
1623
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GraphQLPlusService, decorators: [{
|
|
1715
1624
|
type: Injectable,
|
|
1716
1625
|
args: [{
|
|
1717
1626
|
providedIn: 'root',
|
|
1718
1627
|
}]
|
|
1719
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1628
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }, { type: LoaderService }]; } });
|
|
1720
1629
|
|
|
1721
1630
|
class FormsService {
|
|
1722
1631
|
validateAllFormFields(formGroup) {
|
|
@@ -1816,14 +1725,14 @@ class UserService extends GraphQLPlusService {
|
|
|
1816
1725
|
});
|
|
1817
1726
|
}
|
|
1818
1727
|
}
|
|
1819
|
-
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 });
|
|
1820
1729
|
UserService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: UserService, providedIn: 'root' });
|
|
1821
1730
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: UserService, decorators: [{
|
|
1822
1731
|
type: Injectable,
|
|
1823
1732
|
args: [{
|
|
1824
1733
|
providedIn: 'root',
|
|
1825
1734
|
}]
|
|
1826
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
1735
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: GraphQLMetaService }, { type: LoaderService }, { type: AuthService }]; } });
|
|
1827
1736
|
|
|
1828
1737
|
/**
|
|
1829
1738
|
* Image service
|
|
@@ -2073,7 +1982,7 @@ class ScrollService {
|
|
|
2073
1982
|
return this.scrollPromise;
|
|
2074
1983
|
}
|
|
2075
1984
|
}
|
|
2076
|
-
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 });
|
|
2077
1986
|
ScrollService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ScrollService, providedIn: 'root' });
|
|
2078
1987
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ScrollService, decorators: [{
|
|
2079
1988
|
type: Injectable,
|
|
@@ -2081,7 +1990,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
2081
1990
|
providedIn: 'root',
|
|
2082
1991
|
}]
|
|
2083
1992
|
}], ctorParameters: function () {
|
|
2084
|
-
return [{ type: i1.Router }, { type: undefined, decorators: [{
|
|
1993
|
+
return [{ type: i1$1.Router }, { type: undefined, decorators: [{
|
|
2085
1994
|
type: Inject,
|
|
2086
1995
|
args: [BASE_MODULE_CONFIG]
|
|
2087
1996
|
}] }, { type: ImageService }];
|
|
@@ -2180,14 +2089,118 @@ class BreadcrumbService {
|
|
|
2180
2089
|
return typeof data.breadcrumb === 'function' ? data.breadcrumb(data) : data.breadcrumb;
|
|
2181
2090
|
}
|
|
2182
2091
|
}
|
|
2183
|
-
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 });
|
|
2184
2093
|
BreadcrumbService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BreadcrumbService, providedIn: 'root' });
|
|
2185
2094
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BreadcrumbService, decorators: [{
|
|
2186
2095
|
type: Injectable,
|
|
2187
2096
|
args: [{
|
|
2188
2097
|
providedIn: 'root',
|
|
2189
2098
|
}]
|
|
2190
|
-
}], 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 }]; } });
|
|
2191
2204
|
|
|
2192
2205
|
/**
|
|
2193
2206
|
* Comparison operator enum
|
|
@@ -2294,5 +2307,5 @@ function createRestartableClient(options) {
|
|
|
2294
2307
|
* Generated bundle index. Do not edit.
|
|
2295
2308
|
*/
|
|
2296
2309
|
|
|
2297
|
-
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 };
|
|
2298
2311
|
//# sourceMappingURL=lenne.tech-ng-base-shared.mjs.map
|