@lenne.tech/ng-base 13.14.0 → 13.15.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.
Files changed (30) hide show
  1. package/base-cms/base-cms-routing.module.d.ts +7 -0
  2. package/base-cms/base-cms.module.d.ts +23 -0
  3. package/base-cms/interfaces/base-cms-module-config.interface.d.ts +12 -0
  4. package/base-cms/lenne.tech-ng-base-base-cms.d.ts +5 -0
  5. package/base-cms/package.json +10 -0
  6. package/base-cms/pages/base-cms/base-cms.component.d.ts +70 -0
  7. package/base-cms/public-api.d.ts +6 -0
  8. package/esm2020/base-cms/base-cms-routing.module.mjs +32 -0
  9. package/esm2020/base-cms/base-cms.module.mjs +60 -0
  10. package/esm2020/base-cms/interfaces/base-cms-module-config.interface.mjs +3 -0
  11. package/esm2020/base-cms/lenne.tech-ng-base-base-cms.mjs +5 -0
  12. package/esm2020/base-cms/pages/base-cms/base-cms.component.mjs +162 -0
  13. package/esm2020/base-cms/public-api.mjs +10 -0
  14. package/esm2020/base-components/components/model-form/model-form.component.mjs +4 -5
  15. package/esm2020/base-components/components/model-table/model-table.component.mjs +1 -1
  16. package/esm2020/base-components/components/tags/tags.component.mjs +2 -2
  17. package/esm2020/shared/classes/graphql-meta.class.mjs +3 -2
  18. package/fesm2015/lenne.tech-ng-base-base-cms.mjs +259 -0
  19. package/fesm2015/lenne.tech-ng-base-base-cms.mjs.map +1 -0
  20. package/fesm2015/lenne.tech-ng-base-base-components.mjs +4 -5
  21. package/fesm2015/lenne.tech-ng-base-base-components.mjs.map +1 -1
  22. package/fesm2015/lenne.tech-ng-base-shared.mjs +2 -1
  23. package/fesm2015/lenne.tech-ng-base-shared.mjs.map +1 -1
  24. package/fesm2020/lenne.tech-ng-base-base-cms.mjs +257 -0
  25. package/fesm2020/lenne.tech-ng-base-base-cms.mjs.map +1 -0
  26. package/fesm2020/lenne.tech-ng-base-base-components.mjs +4 -5
  27. package/fesm2020/lenne.tech-ng-base-base-components.mjs.map +1 -1
  28. package/fesm2020/lenne.tech-ng-base-shared.mjs +2 -1
  29. package/fesm2020/lenne.tech-ng-base-shared.mjs.map +1 -1
  30. package/package.json +9 -1
@@ -0,0 +1,259 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, Component, Inject, NgModule } from '@angular/core';
3
+ import * as i4 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import { ReactiveFormsModule } from '@angular/forms';
6
+ import { __awaiter } from 'tslib';
7
+ import * as i1 from '@lenne.tech/ng-base/shared';
8
+ import * as i2 from '@angular/router';
9
+ import { RouterModule } from '@angular/router';
10
+ import * as i3 from '@lenne.tech/ng-base/base-components';
11
+ import { BaseComponentsModule } from '@lenne.tech/ng-base/base-components';
12
+
13
+ const BASE_CMS_MODULE_CONFIG = new InjectionToken('BASE_CMS_MODULE_CONFIG');
14
+
15
+ class BaseCmsComponent {
16
+ constructor(moduleConfig, graphQLMetaService, route, router, authService) {
17
+ this.moduleConfig = moduleConfig;
18
+ this.graphQLMetaService = graphQLMetaService;
19
+ this.route = route;
20
+ this.router = router;
21
+ this.authService = authService;
22
+ this.types = [];
23
+ this.route.params.subscribe((value) => {
24
+ if (value['modelName']) {
25
+ if (!this.checkModelIsExcludedOrRestrcited(value['modelName'])) {
26
+ this.modelName = value['modelName'];
27
+ }
28
+ else {
29
+ this.init().then((types) => {
30
+ this.router.navigate(['../' + types[0].name.toLowerCase()], { relativeTo: this.route });
31
+ });
32
+ }
33
+ }
34
+ if (value['id']) {
35
+ this.id = value['id'];
36
+ }
37
+ });
38
+ }
39
+ ngOnInit() {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ yield this.init();
42
+ });
43
+ }
44
+ /**
45
+ * It returns a promise that resolves to an array of GraphqlCrudType objects
46
+ *
47
+ * @returns The types that are available to the user.
48
+ */
49
+ init() {
50
+ return new Promise((resolve, reject) => {
51
+ this.graphQLMetaService.getMeta().subscribe((meta) => {
52
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
53
+ this.meta = meta;
54
+ if ((_b = (_a = this.route.snapshot) === null || _a === void 0 ? void 0 : _a.params) === null || _b === void 0 ? void 0 : _b['modelName']) {
55
+ this.modelName = (_d = (_c = this.route.snapshot) === null || _c === void 0 ? void 0 : _c.params) === null || _d === void 0 ? void 0 : _d['modelName'];
56
+ }
57
+ if ((_f = (_e = this.route.snapshot) === null || _e === void 0 ? void 0 : _e.params) === null || _f === void 0 ? void 0 : _f['id']) {
58
+ this.id = (_h = (_g = this.route.snapshot) === null || _g === void 0 ? void 0 : _g.params) === null || _h === void 0 ? void 0 : _h['id'];
59
+ }
60
+ const excludedModels = (_j = this.moduleConfig.excludedModels) === null || _j === void 0 ? void 0 : _j.map((e) => e.toLowerCase());
61
+ const types = meta.getTypes();
62
+ // Check for excluded types
63
+ const filteredTypes = types.filter((e) => !(excludedModels === null || excludedModels === void 0 ? void 0 : excludedModels.includes(e.name.toLowerCase())));
64
+ // Check for restricted types
65
+ this.types = filteredTypes.filter((e) => {
66
+ var _a;
67
+ const foundRestrict = (_a = this.moduleConfig.restrictedModels) === null || _a === void 0 ? void 0 : _a.find((v) => v.model.toLowerCase() === e.name.toLowerCase());
68
+ if (foundRestrict) {
69
+ if (!this.authService.currentUser) {
70
+ return false;
71
+ }
72
+ return this.authService.currentUser.hasAllRoles(foundRestrict.roles);
73
+ }
74
+ else {
75
+ return true;
76
+ }
77
+ });
78
+ resolve(this.types);
79
+ if (!this.modelName && this.types) {
80
+ this.router.navigate(['./' + this.types[0].name.toLowerCase()], { relativeTo: this.route });
81
+ }
82
+ });
83
+ });
84
+ }
85
+ /**
86
+ * It checks if the model is excluded or restricted
87
+ *
88
+ * @param model - The name of the model you want to check.
89
+ * @returns A boolean value.
90
+ */
91
+ checkModelIsExcludedOrRestrcited(model) {
92
+ var _a, _b;
93
+ if (!model) {
94
+ return false;
95
+ }
96
+ const excludedModels = (_a = this.moduleConfig.excludedModels) === null || _a === void 0 ? void 0 : _a.map((e) => e.toLowerCase());
97
+ return !!((excludedModels === null || excludedModels === void 0 ? void 0 : excludedModels.includes(model === null || model === void 0 ? void 0 : model.toLowerCase())) ||
98
+ ((_b = this.moduleConfig.restrictedModels) === null || _b === void 0 ? void 0 : _b.find((e) => e.model.toLowerCase() === model.toLowerCase())));
99
+ }
100
+ /**
101
+ * If the model name is set and the types are set, then return the type that matches the model name
102
+ *
103
+ * @returns The type object that matches the model name.
104
+ */
105
+ getTypeByModelName() {
106
+ if (this.modelName && this.types) {
107
+ return this.types.find((e) => e.name.toLowerCase() === this.modelName.toLowerCase());
108
+ }
109
+ else {
110
+ return null;
111
+ }
112
+ }
113
+ /**
114
+ * When the createModeChanged event is emitted, if the createMode is true, navigate to the new route
115
+ *
116
+ * @param createMode - boolean - This is a boolean value that indicates whether the user is in create mode or
117
+ * not.
118
+ */
119
+ onCreateModeChanged(createMode) {
120
+ if (createMode) {
121
+ this.router.navigate(['./' + 'new'], { relativeTo: this.route });
122
+ }
123
+ }
124
+ /**
125
+ * If the type exists, return the create property of the type, otherwise return false.
126
+ *
127
+ * @returns A boolean value.
128
+ */
129
+ isCreatePossible() {
130
+ const type = this.getTypeByModelName();
131
+ return type ? type.create : false;
132
+ }
133
+ /**
134
+ * If the model name is found in the type map, return the update property of the type object
135
+ *
136
+ * @returns A boolean value.
137
+ */
138
+ isUpdatePossible() {
139
+ const type = this.getTypeByModelName();
140
+ return type ? type.update : false;
141
+ }
142
+ /**
143
+ * If the type is defined, return the delete property of the type, otherwise return false
144
+ *
145
+ * @returns A boolean value.
146
+ */
147
+ isDeletePossible() {
148
+ const type = this.getTypeByModelName();
149
+ return type ? type.delete : false;
150
+ }
151
+ /**
152
+ * If the id is truthy, navigate to the id, otherwise navigate to the parent route
153
+ *
154
+ * @param id - The id of the selected item.
155
+ */
156
+ idSelected(id) {
157
+ if (id) {
158
+ this.router.navigate(['./' + id], { relativeTo: this.route });
159
+ }
160
+ else {
161
+ this.router.navigate(['..'], { relativeTo: this.route });
162
+ }
163
+ }
164
+ }
165
+ BaseCmsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BaseCmsComponent, deps: [{ token: BASE_CMS_MODULE_CONFIG }, { token: i1.GraphQLMetaService }, { token: i2.ActivatedRoute }, { token: i2.Router }, { token: i1.AuthService }], target: i0.ɵɵFactoryTarget.Component });
166
+ BaseCmsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: BaseCmsComponent, selector: "app-base-cms", ngImport: i0, template: "<div class=\"main\">\n <div class=\"sidebar\">\n <div class=\"d-flex flex-column flex-shrink-0 p-3 h-100\">\n <ng-container *ngIf=\"moduleConfig.branding\">\n <a href=\"/\" class=\"d-flex flex-column align-items-start mb-3 mt-3 me-md-auto link-dark text-decoration-none\">\n <span class=\"d-block fs-4\"><b class=\"text-primary\">Base</b>CMS</span>\n <small class=\"fw-lighter\">The auto generated GraphQL CMS</small>\n </a>\n <hr />\n </ng-container>\n <ul class=\"nav nav-pills flex-column mb-auto\" *ngIf=\"types\">\n <li class=\"nav-item\" *ngFor=\"let type of types\">\n <a\n class=\"nav-link\"\n aria-current=\"page\"\n [routerLink]=\"(id ? '../../' : '../') + type?.name?.toLowerCase()\"\n [ngClass]=\"{ active: type?.name?.toLowerCase() === this.modelName?.toLowerCase() }\"\n >\n {{ type.name + 's' }}\n </a>\n </li>\n </ul>\n </div>\n </div>\n\n <div class=\"sidebar-content\">\n <div class=\"p-5\">\n <base-model-table\n [tableFields]=\"moduleConfig?.tableFields ?? ['name']\"\n [modelName]=\"modelName\"\n [objectId]=\"id !== 'new' ? id : ''\"\n [createMode]=\"id === 'new'\"\n (createModeChanged)=\"onCreateModeChanged($event)\"\n (idSelected)=\"idSelected($event)\"\n [create]=\"isCreatePossible()\"\n [update]=\"isUpdatePossible()\"\n [delete]=\"isDeletePossible()\"\n ></base-model-table>\n </div>\n </div>\n</div>\n", styles: [".active{color:var(--bs-primary)!important;background-color:rgba(var(--bs-primary-rgb),.2)!important;font-weight:700}.nav-link{color:var(--bs-body-color)}.sidebar{box-shadow:#7090b014 14px 17px 40px 4px;transition:all .2s linear 0s;z-index:99}.main{display:flex;flex-direction:row;overflow:hidden;height:100%}.main .sidebar{flex:1 0 22%;max-width:300px}.main .sidebar-content{flex-grow:999;overflow-y:auto;background-color:#f5f7fe}.nav-flush .nav-link{border-radius:0}\n"], components: [{ type: i3.ModelTableComponent, selector: "base-model-table", inputs: ["modelName", "objectId", "createMode", "create", "update", "delete", "tableFields"], outputs: ["idSelected", "createModeChanged"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
167
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BaseCmsComponent, decorators: [{
168
+ type: Component,
169
+ args: [{ selector: 'app-base-cms', template: "<div class=\"main\">\n <div class=\"sidebar\">\n <div class=\"d-flex flex-column flex-shrink-0 p-3 h-100\">\n <ng-container *ngIf=\"moduleConfig.branding\">\n <a href=\"/\" class=\"d-flex flex-column align-items-start mb-3 mt-3 me-md-auto link-dark text-decoration-none\">\n <span class=\"d-block fs-4\"><b class=\"text-primary\">Base</b>CMS</span>\n <small class=\"fw-lighter\">The auto generated GraphQL CMS</small>\n </a>\n <hr />\n </ng-container>\n <ul class=\"nav nav-pills flex-column mb-auto\" *ngIf=\"types\">\n <li class=\"nav-item\" *ngFor=\"let type of types\">\n <a\n class=\"nav-link\"\n aria-current=\"page\"\n [routerLink]=\"(id ? '../../' : '../') + type?.name?.toLowerCase()\"\n [ngClass]=\"{ active: type?.name?.toLowerCase() === this.modelName?.toLowerCase() }\"\n >\n {{ type.name + 's' }}\n </a>\n </li>\n </ul>\n </div>\n </div>\n\n <div class=\"sidebar-content\">\n <div class=\"p-5\">\n <base-model-table\n [tableFields]=\"moduleConfig?.tableFields ?? ['name']\"\n [modelName]=\"modelName\"\n [objectId]=\"id !== 'new' ? id : ''\"\n [createMode]=\"id === 'new'\"\n (createModeChanged)=\"onCreateModeChanged($event)\"\n (idSelected)=\"idSelected($event)\"\n [create]=\"isCreatePossible()\"\n [update]=\"isUpdatePossible()\"\n [delete]=\"isDeletePossible()\"\n ></base-model-table>\n </div>\n </div>\n</div>\n", styles: [".active{color:var(--bs-primary)!important;background-color:rgba(var(--bs-primary-rgb),.2)!important;font-weight:700}.nav-link{color:var(--bs-body-color)}.sidebar{box-shadow:#7090b014 14px 17px 40px 4px;transition:all .2s linear 0s;z-index:99}.main{display:flex;flex-direction:row;overflow:hidden;height:100%}.main .sidebar{flex:1 0 22%;max-width:300px}.main .sidebar-content{flex-grow:999;overflow-y:auto;background-color:#f5f7fe}.nav-flush .nav-link{border-radius:0}\n"] }]
170
+ }], ctorParameters: function () {
171
+ return [{ type: undefined, decorators: [{
172
+ type: Inject,
173
+ args: [BASE_CMS_MODULE_CONFIG]
174
+ }] }, { type: i1.GraphQLMetaService }, { type: i2.ActivatedRoute }, { type: i2.Router }, { type: i1.AuthService }];
175
+ } });
176
+
177
+ const routes = [
178
+ {
179
+ path: '',
180
+ component: BaseCmsComponent,
181
+ },
182
+ {
183
+ path: ':modelName',
184
+ component: BaseCmsComponent,
185
+ },
186
+ {
187
+ path: ':modelName/:id',
188
+ component: BaseCmsComponent,
189
+ },
190
+ ];
191
+ class BaseCMSRoutingModule {
192
+ }
193
+ BaseCMSRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BaseCMSRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
194
+ BaseCMSRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BaseCMSRoutingModule, imports: [i2.RouterModule], exports: [RouterModule] });
195
+ BaseCMSRoutingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BaseCMSRoutingModule, imports: [[RouterModule.forChild(routes)], RouterModule] });
196
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BaseCMSRoutingModule, decorators: [{
197
+ type: NgModule,
198
+ args: [{
199
+ imports: [RouterModule.forChild(routes)],
200
+ exports: [RouterModule],
201
+ }]
202
+ }] });
203
+
204
+ function CMSConfigFactory() {
205
+ return Object.assign({ tableFields: ['id', 'name', 'title', 'description', 'email', 'createdAt', 'updatedAt'], excludedModels: [], restrictedModels: [], branding: true, logging: false }, BaseCMSModule.config);
206
+ }
207
+ class BaseCMSModule {
208
+ }
209
+ BaseCMSModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BaseCMSModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
210
+ BaseCMSModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BaseCMSModule, declarations: [BaseCmsComponent], imports: [
211
+ // Modules
212
+ CommonModule,
213
+ ReactiveFormsModule,
214
+ BaseCMSRoutingModule,
215
+ BaseComponentsModule
216
+ ] });
217
+ BaseCMSModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BaseCMSModule, providers: [
218
+ {
219
+ provide: BASE_CMS_MODULE_CONFIG,
220
+ useFactory: CMSConfigFactory,
221
+ },
222
+ ], imports: [[
223
+ // Modules
224
+ CommonModule,
225
+ ReactiveFormsModule,
226
+ BaseCMSRoutingModule,
227
+ BaseComponentsModule,
228
+ ]] });
229
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BaseCMSModule, decorators: [{
230
+ type: NgModule,
231
+ args: [{
232
+ imports: [
233
+ // Modules
234
+ CommonModule,
235
+ ReactiveFormsModule,
236
+ BaseCMSRoutingModule,
237
+ BaseComponentsModule,
238
+ ],
239
+ declarations: [BaseCmsComponent],
240
+ exports: [],
241
+ providers: [
242
+ {
243
+ provide: BASE_CMS_MODULE_CONFIG,
244
+ useFactory: CMSConfigFactory,
245
+ },
246
+ ],
247
+ }]
248
+ }] });
249
+
250
+ /**
251
+ * Exports for public API
252
+ */
253
+
254
+ /**
255
+ * Generated bundle index. Do not edit.
256
+ */
257
+
258
+ export { BASE_CMS_MODULE_CONFIG, BaseCMSModule, BaseCmsComponent, CMSConfigFactory };
259
+ //# sourceMappingURL=lenne.tech-ng-base-base-cms.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lenne.tech-ng-base-base-cms.mjs","sources":["../../../projects/ng-base/base-cms/interfaces/base-cms-module-config.interface.ts","../../../projects/ng-base/base-cms/pages/base-cms/base-cms.component.ts","../../../projects/ng-base/base-cms/pages/base-cms/base-cms.component.html","../../../projects/ng-base/base-cms/base-cms-routing.module.ts","../../../projects/ng-base/base-cms/base-cms.module.ts","../../../projects/ng-base/base-cms/public-api.ts","../../../projects/ng-base/base-cms/lenne.tech-ng-base-base-cms.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport interface BaseCMSModuleConfig {\n tableFields?: string[];\n excludedModels?: string[];\n restrictedModels?: [{ model: string; roles: string[] }];\n logging?: boolean;\n branding?: boolean;\n}\n\nexport const BASE_CMS_MODULE_CONFIG = new InjectionToken('BASE_CMS_MODULE_CONFIG');\n","import { Component, Inject, OnInit } from '@angular/core';\nimport { AuthService, GraphqlCrudType, GraphQLMeta, GraphQLMetaService } from '@lenne.tech/ng-base/shared';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { BASE_CMS_MODULE_CONFIG, BaseCMSModuleConfig } from '../../interfaces/base-cms-module-config.interface';\n\n@Component({\n selector: 'app-base-cms',\n templateUrl: './base-cms.component.html',\n styleUrls: ['./base-cms.component.scss'],\n})\nexport class BaseCmsComponent implements OnInit {\n meta: GraphQLMeta;\n modelName: string;\n id: string;\n types: GraphqlCrudType[] = [];\n\n constructor(\n @Inject(BASE_CMS_MODULE_CONFIG) public moduleConfig: BaseCMSModuleConfig,\n private graphQLMetaService: GraphQLMetaService,\n private route: ActivatedRoute,\n private router: Router,\n private authService: AuthService\n ) {\n this.route.params.subscribe((value) => {\n if (value['modelName']) {\n if (!this.checkModelIsExcludedOrRestrcited(value['modelName'])) {\n this.modelName = value['modelName'];\n } else {\n this.init().then((types: GraphqlCrudType[]) => {\n this.router.navigate(['../' + types[0].name.toLowerCase()], { relativeTo: this.route });\n });\n }\n }\n\n if (value['id']) {\n this.id = value['id'];\n }\n });\n }\n\n async ngOnInit() {\n await this.init();\n }\n\n /**\n * It returns a promise that resolves to an array of GraphqlCrudType objects\n *\n * @returns The types that are available to the user.\n */\n init(): Promise<GraphqlCrudType[]> {\n return new Promise((resolve, reject) => {\n this.graphQLMetaService.getMeta().subscribe((meta) => {\n this.meta = meta;\n\n if (this.route.snapshot?.params?.['modelName']) {\n this.modelName = this.route.snapshot?.params?.['modelName'];\n }\n\n if (this.route.snapshot?.params?.['id']) {\n this.id = this.route.snapshot?.params?.['id'];\n }\n\n const excludedModels = this.moduleConfig.excludedModels?.map((e) => e.toLowerCase());\n const types = meta.getTypes();\n\n // Check for excluded types\n const filteredTypes = types.filter((e) => !excludedModels?.includes(e.name.toLowerCase()));\n\n // Check for restricted types\n this.types = filteredTypes.filter((e) => {\n const foundRestrict = this.moduleConfig.restrictedModels?.find(\n (v) => v.model.toLowerCase() === e.name.toLowerCase()\n );\n\n if (foundRestrict) {\n if (!this.authService.currentUser) {\n return false;\n }\n\n return this.authService.currentUser.hasAllRoles(foundRestrict.roles);\n } else {\n return true;\n }\n });\n\n resolve(this.types);\n\n if (!this.modelName && this.types) {\n this.router.navigate(['./' + this.types[0].name.toLowerCase()], { relativeTo: this.route });\n }\n });\n });\n }\n\n /**\n * It checks if the model is excluded or restricted\n *\n * @param model - The name of the model you want to check.\n * @returns A boolean value.\n */\n checkModelIsExcludedOrRestrcited(model: string): boolean {\n if (!model) {\n return false;\n }\n const excludedModels = this.moduleConfig.excludedModels?.map((e) => e.toLowerCase());\n return !!(\n excludedModels?.includes(model?.toLowerCase()) ||\n this.moduleConfig.restrictedModels?.find((e) => e.model.toLowerCase() === model.toLowerCase())\n );\n }\n\n /**\n * If the model name is set and the types are set, then return the type that matches the model name\n *\n * @returns The type object that matches the model name.\n */\n getTypeByModelName() {\n if (this.modelName && this.types) {\n return this.types.find((e) => e.name.toLowerCase() === this.modelName.toLowerCase());\n } else {\n return null;\n }\n }\n\n /**\n * When the createModeChanged event is emitted, if the createMode is true, navigate to the new route\n *\n * @param createMode - boolean - This is a boolean value that indicates whether the user is in create mode or\n * not.\n */\n onCreateModeChanged(createMode: boolean) {\n if (createMode) {\n this.router.navigate(['./' + 'new'], { relativeTo: this.route });\n }\n }\n\n /**\n * If the type exists, return the create property of the type, otherwise return false.\n *\n * @returns A boolean value.\n */\n isCreatePossible(): boolean {\n const type = this.getTypeByModelName();\n return type ? type.create : false;\n }\n\n /**\n * If the model name is found in the type map, return the update property of the type object\n *\n * @returns A boolean value.\n */\n isUpdatePossible(): boolean {\n const type = this.getTypeByModelName();\n return type ? type.update : false;\n }\n\n /**\n * If the type is defined, return the delete property of the type, otherwise return false\n *\n * @returns A boolean value.\n */\n isDeletePossible(): boolean {\n const type = this.getTypeByModelName();\n return type ? type.delete : false;\n }\n\n /**\n * If the id is truthy, navigate to the id, otherwise navigate to the parent route\n *\n * @param id - The id of the selected item.\n */\n idSelected(id: string) {\n if (id) {\n this.router.navigate(['./' + id], { relativeTo: this.route });\n } else {\n this.router.navigate(['..'], { relativeTo: this.route });\n }\n }\n}\n","<div class=\"main\">\n <div class=\"sidebar\">\n <div class=\"d-flex flex-column flex-shrink-0 p-3 h-100\">\n <ng-container *ngIf=\"moduleConfig.branding\">\n <a href=\"/\" class=\"d-flex flex-column align-items-start mb-3 mt-3 me-md-auto link-dark text-decoration-none\">\n <span class=\"d-block fs-4\"><b class=\"text-primary\">Base</b>CMS</span>\n <small class=\"fw-lighter\">The auto generated GraphQL CMS</small>\n </a>\n <hr />\n </ng-container>\n <ul class=\"nav nav-pills flex-column mb-auto\" *ngIf=\"types\">\n <li class=\"nav-item\" *ngFor=\"let type of types\">\n <a\n class=\"nav-link\"\n aria-current=\"page\"\n [routerLink]=\"(id ? '../../' : '../') + type?.name?.toLowerCase()\"\n [ngClass]=\"{ active: type?.name?.toLowerCase() === this.modelName?.toLowerCase() }\"\n >\n {{ type.name + 's' }}\n </a>\n </li>\n </ul>\n </div>\n </div>\n\n <div class=\"sidebar-content\">\n <div class=\"p-5\">\n <base-model-table\n [tableFields]=\"moduleConfig?.tableFields ?? ['name']\"\n [modelName]=\"modelName\"\n [objectId]=\"id !== 'new' ? id : ''\"\n [createMode]=\"id === 'new'\"\n (createModeChanged)=\"onCreateModeChanged($event)\"\n (idSelected)=\"idSelected($event)\"\n [create]=\"isCreatePossible()\"\n [update]=\"isUpdatePossible()\"\n [delete]=\"isDeletePossible()\"\n ></base-model-table>\n </div>\n </div>\n</div>\n","import { RouterModule, Routes } from '@angular/router';\nimport { NgModule } from '@angular/core';\nimport { BaseCmsComponent } from './pages/base-cms/base-cms.component';\n\nconst routes: Routes = [\n {\n path: '',\n component: BaseCmsComponent,\n },\n {\n path: ':modelName',\n component: BaseCmsComponent,\n },\n {\n path: ':modelName/:id',\n component: BaseCmsComponent,\n },\n];\n\n@NgModule({\n imports: [RouterModule.forChild(routes)],\n exports: [RouterModule],\n})\nexport class BaseCMSRoutingModule {}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { BaseCmsComponent } from './pages/base-cms/base-cms.component';\nimport { BaseCMSRoutingModule } from './base-cms-routing.module';\nimport { BaseComponentsModule } from '@lenne.tech/ng-base/base-components';\nimport { BASE_CMS_MODULE_CONFIG, BaseCMSModuleConfig } from './interfaces/base-cms-module-config.interface';\n\nexport function CMSConfigFactory() {\n return {\n tableFields: ['id', 'name', 'title', 'description', 'email', 'createdAt', 'updatedAt'],\n excludedModels: [],\n restrictedModels: [],\n branding: true,\n logging: false,\n ...BaseCMSModule.config,\n };\n}\n\n@NgModule({\n imports: [\n // Modules\n CommonModule,\n ReactiveFormsModule,\n BaseCMSRoutingModule,\n BaseComponentsModule,\n ],\n declarations: [BaseCmsComponent],\n exports: [],\n providers: [\n {\n provide: BASE_CMS_MODULE_CONFIG,\n useFactory: CMSConfigFactory,\n },\n ],\n})\nexport class BaseCMSModule {\n static config: BaseCMSModuleConfig;\n}\n","/**\n * Exports for public API\n */\n\n// Module\nexport * from './base-cms.module';\n\n// Pages\nexport * from './pages/base-cms/base-cms.component';\n\n// Interface\nexport * from './interfaces/base-cms-module-config.interface';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;MAUa,sBAAsB,GAAG,IAAI,cAAc,CAAC,wBAAwB;;MCApE,gBAAgB,CAAA;IAM3B,WACyC,CAAA,YAAiC,EAChE,kBAAsC,EACtC,KAAqB,EACrB,MAAc,EACd,WAAwB,EAAA;AAJO,QAAA,IAAY,CAAA,YAAA,GAAZ,YAAY,CAAqB;AAChE,QAAA,IAAkB,CAAA,kBAAA,GAAlB,kBAAkB,CAAoB;AACtC,QAAA,IAAK,CAAA,KAAA,GAAL,KAAK,CAAgB;AACrB,QAAA,IAAM,CAAA,MAAA,GAAN,MAAM,CAAQ;AACd,QAAA,IAAW,CAAA,WAAA,GAAX,WAAW,CAAa;AAPlC,QAAA,IAAK,CAAA,KAAA,GAAsB,EAAE,CAAC;QAS5B,IAA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AAE;;wBAEP,YAAY;wBACZ,mBAAmB;wBACnB,oBAAoB;wBACpB,oBAAoB;AACrB,qBAAA;oBACD,YAAY,EAAE,CAAC,gBAAgB,CAAC;AAChC,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,sBAAsB;AAC/B,4BAAA,UAAU,EAAE,gBAAgB;AAC7B,yBAAA;AACF,qBAAA;iBACF,CAAA;;;ACnCD;;AAEG;;ACFH;;AAEG;;;;"}
@@ -243,7 +243,7 @@ class TagsComponent {
243
243
  return;
244
244
  }
245
245
  if (tag.length > 0 && this.control.value && !this.control.value.some((item) => item === tag)) {
246
- this.control.value.push(tag);
246
+ this.control.setValue([...this.control.value, tag]);
247
247
  this.inputValue = '';
248
248
  this.control.setErrors(null);
249
249
  }
@@ -401,7 +401,6 @@ class ModelFormComponent {
401
401
  if (this.modelName && this.meta) {
402
402
  this.operation = this.id ? 'update' : 'create';
403
403
  this.fields = this.meta.getArgs(this.operation + this.capitalizeFirstLetter(this.modelName), {
404
- cache: false,
405
404
  type: GraphQLRequestType.MUTATION,
406
405
  });
407
406
  this.fields = this.fields['input'];
@@ -444,7 +443,7 @@ class ModelFormComponent {
444
443
  const group = {};
445
444
  for (const [key, value] of Object.entries(fields)) {
446
445
  if ((_a = fields[key]) === null || _a === void 0 ? void 0 : _a.type) {
447
- group[key] = new FormControl('', Validators.required);
446
+ group[key] = new FormControl('', value.isRequired ? Validators.required : []);
448
447
  }
449
448
  }
450
449
  this.form = new FormGroup(group);
@@ -524,10 +523,10 @@ class ModelFormComponent {
524
523
  }
525
524
  }
526
525
  ModelFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: ModelFormComponent, deps: [{ token: i1$1.GraphQLMetaService }, { token: i1$1.GraphQLService }, { token: i1$1.FormsService }], target: i0.ɵɵFactoryTarget.Component });
527
- ModelFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: ModelFormComponent, selector: "base-model-form", inputs: { modelName: "modelName", id: "id", delete: "delete" }, outputs: { finished: "finished" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"w-100\" *ngIf=\"form\">\n <h1>{{ capitalizeFirstLetter(modelName) }} {{ operation === 'update' ? 'bearbeiten' : 'erstellen' }}</h1>\n\n <form [formGroup]=\"form\">\n <div class=\"mt-3\" *ngFor=\"let key of keys\">\n <ng-container [ngSwitch]=\"fields[key]?.type\">\n <ng-container *ngSwitchCase=\"'String'\">\n <ng-container *ngIf=\"fields[key]?.isList\">\n <base-tags\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"fields[key].isRequired\"\n ></base-tags>\n </ng-container>\n\n <ng-container *ngIf=\"!fields[key]?.isList\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"capitalizeFirstLetter(key)\"\n [type]=\"'text'\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"fields[key].isRequired\"\n ></base-input>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Boolean'\">\n <base-checkbox\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"true\"\n ></base-checkbox>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'DateTime'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"capitalizeFirstLetter(key)\"\n [type]=\"'datetime-local'\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"true\"\n ></base-input>\n </ng-container>\n </ng-container>\n </div>\n\n <div class=\"d-flex\" [ngClass]=\"id && delete ? 'justify-content-between' : 'justify-content-end'\">\n <div *ngIf=\"id && delete\">\n <button class=\"btn btn-danger\" type=\"button\" (click)=\"deleteObject()\">L\u00F6schen</button>\n </div>\n <div>\n <button class=\"btn btn-primary\" type=\"button\" (click)=\"submit()\" *ngIf=\"!loading\">\n {{ operation === 'create' ? 'Erstellen' : 'Speichern' }}\n </button>\n <button class=\"btn btn-primary\" type=\"button\" disabled *ngIf=\"loading\">\n <span class=\"spinner-border spinner-border-sm\" role=\"status\" aria-hidden=\"true\"></span>\n {{ operation === 'create' ? 'Erstellen' : 'Speichern' }}...\n </button>\n </div>\n </div>\n </form>\n</div>\n", styles: [""], components: [{ type: TagsComponent, selector: "base-tags", inputs: ["id", "name", "label", "placeholder", "autocomplete", "tabIndex", "control", "options", "custom", "removeByKey", "required"] }, { type: InputComponent, selector: "base-input", inputs: ["id", "name", "label", "placeholder", "autocomplete", "tabIndex", "control", "type", "required"] }, { type: CheckboxComponent, selector: "base-checkbox", inputs: ["id", "name", "label", "value", "control", "required"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
526
+ ModelFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: ModelFormComponent, selector: "base-model-form", inputs: { modelName: "modelName", id: "id", delete: "delete" }, outputs: { finished: "finished" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"w-100\" *ngIf=\"form\">\n <h1>{{ capitalizeFirstLetter(modelName) }} {{ operation === 'update' ? 'bearbeiten' : 'erstellen' }}</h1>\n\n <form [formGroup]=\"form\">\n <div class=\"mt-3\" *ngFor=\"let key of keys\">\n <ng-container [ngSwitch]=\"fields[key]?.type\">\n <ng-container *ngSwitchCase=\"'String'\">\n <ng-container *ngIf=\"fields[key]?.isList\">\n <base-tags\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"fields[key].isRequired\"\n ></base-tags>\n </ng-container>\n\n <ng-container *ngIf=\"!fields[key]?.isList\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"capitalizeFirstLetter(key)\"\n [type]=\"'text'\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"fields[key].isRequired\"\n ></base-input>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Boolean'\">\n <base-checkbox\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"true\"\n ></base-checkbox>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'DateTime'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"capitalizeFirstLetter(key)\"\n [type]=\"'datetime-local'\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"true\"\n ></base-input>\n </ng-container>\n </ng-container>\n </div>\n\n <div class=\"d-flex mt-4\" [ngClass]=\"id && delete ? 'justify-content-between' : 'justify-content-end'\">\n <div *ngIf=\"id && delete\">\n <button class=\"btn btn-danger\" type=\"button\" (click)=\"deleteObject()\">L\u00F6schen</button>\n </div>\n <div>\n <button class=\"btn btn-primary\" type=\"button\" (click)=\"submit()\" *ngIf=\"!loading\">\n {{ operation === 'create' ? 'Erstellen' : 'Speichern' }}\n </button>\n <button class=\"btn btn-primary\" type=\"button\" disabled *ngIf=\"loading\">\n <span class=\"spinner-border spinner-border-sm\" role=\"status\" aria-hidden=\"true\"></span>\n {{ operation === 'create' ? 'Erstellen' : 'Speichern' }}...\n </button>\n </div>\n </div>\n </form>\n</div>\n", styles: [""], components: [{ type: TagsComponent, selector: "base-tags", inputs: ["id", "name", "label", "placeholder", "autocomplete", "tabIndex", "control", "options", "custom", "removeByKey", "required"] }, { type: InputComponent, selector: "base-input", inputs: ["id", "name", "label", "placeholder", "autocomplete", "tabIndex", "control", "type", "required"] }, { type: CheckboxComponent, selector: "base-checkbox", inputs: ["id", "name", "label", "value", "control", "required"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
528
527
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: ModelFormComponent, decorators: [{
529
528
  type: Component,
530
- args: [{ selector: 'base-model-form', template: "<div class=\"w-100\" *ngIf=\"form\">\n <h1>{{ capitalizeFirstLetter(modelName) }} {{ operation === 'update' ? 'bearbeiten' : 'erstellen' }}</h1>\n\n <form [formGroup]=\"form\">\n <div class=\"mt-3\" *ngFor=\"let key of keys\">\n <ng-container [ngSwitch]=\"fields[key]?.type\">\n <ng-container *ngSwitchCase=\"'String'\">\n <ng-container *ngIf=\"fields[key]?.isList\">\n <base-tags\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"fields[key].isRequired\"\n ></base-tags>\n </ng-container>\n\n <ng-container *ngIf=\"!fields[key]?.isList\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"capitalizeFirstLetter(key)\"\n [type]=\"'text'\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"fields[key].isRequired\"\n ></base-input>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Boolean'\">\n <base-checkbox\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"true\"\n ></base-checkbox>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'DateTime'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"capitalizeFirstLetter(key)\"\n [type]=\"'datetime-local'\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"true\"\n ></base-input>\n </ng-container>\n </ng-container>\n </div>\n\n <div class=\"d-flex\" [ngClass]=\"id && delete ? 'justify-content-between' : 'justify-content-end'\">\n <div *ngIf=\"id && delete\">\n <button class=\"btn btn-danger\" type=\"button\" (click)=\"deleteObject()\">L\u00F6schen</button>\n </div>\n <div>\n <button class=\"btn btn-primary\" type=\"button\" (click)=\"submit()\" *ngIf=\"!loading\">\n {{ operation === 'create' ? 'Erstellen' : 'Speichern' }}\n </button>\n <button class=\"btn btn-primary\" type=\"button\" disabled *ngIf=\"loading\">\n <span class=\"spinner-border spinner-border-sm\" role=\"status\" aria-hidden=\"true\"></span>\n {{ operation === 'create' ? 'Erstellen' : 'Speichern' }}...\n </button>\n </div>\n </div>\n </form>\n</div>\n", styles: [""] }]
529
+ args: [{ selector: 'base-model-form', template: "<div class=\"w-100\" *ngIf=\"form\">\n <h1>{{ capitalizeFirstLetter(modelName) }} {{ operation === 'update' ? 'bearbeiten' : 'erstellen' }}</h1>\n\n <form [formGroup]=\"form\">\n <div class=\"mt-3\" *ngFor=\"let key of keys\">\n <ng-container [ngSwitch]=\"fields[key]?.type\">\n <ng-container *ngSwitchCase=\"'String'\">\n <ng-container *ngIf=\"fields[key]?.isList\">\n <base-tags\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"fields[key].isRequired\"\n ></base-tags>\n </ng-container>\n\n <ng-container *ngIf=\"!fields[key]?.isList\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"capitalizeFirstLetter(key)\"\n [type]=\"'text'\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"fields[key].isRequired\"\n ></base-input>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Boolean'\">\n <base-checkbox\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"true\"\n ></base-checkbox>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'DateTime'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"capitalizeFirstLetter(key)\"\n [type]=\"'datetime-local'\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"true\"\n ></base-input>\n </ng-container>\n </ng-container>\n </div>\n\n <div class=\"d-flex mt-4\" [ngClass]=\"id && delete ? 'justify-content-between' : 'justify-content-end'\">\n <div *ngIf=\"id && delete\">\n <button class=\"btn btn-danger\" type=\"button\" (click)=\"deleteObject()\">L\u00F6schen</button>\n </div>\n <div>\n <button class=\"btn btn-primary\" type=\"button\" (click)=\"submit()\" *ngIf=\"!loading\">\n {{ operation === 'create' ? 'Erstellen' : 'Speichern' }}\n </button>\n <button class=\"btn btn-primary\" type=\"button\" disabled *ngIf=\"loading\">\n <span class=\"spinner-border spinner-border-sm\" role=\"status\" aria-hidden=\"true\"></span>\n {{ operation === 'create' ? 'Erstellen' : 'Speichern' }}...\n </button>\n </div>\n </div>\n </form>\n</div>\n", styles: [""] }]
531
530
  }], ctorParameters: function () { return [{ type: i1$1.GraphQLMetaService }, { type: i1$1.GraphQLService }, { type: i1$1.FormsService }]; }, propDecorators: { modelName: [{
532
531
  type: Input
533
532
  }], id: [{