@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
|
@@ -2,7 +2,6 @@ import { APOLLO_OPTIONS, ApolloModule } from 'apollo-angular';
|
|
|
2
2
|
import { HttpLink } from 'apollo-angular/http';
|
|
3
3
|
import { NgModule } from '@angular/core';
|
|
4
4
|
import { apolloOptionsFactory } from './factories/apollo-options.factory';
|
|
5
|
-
import { ContextMenuDirective } from './directives/context-menu.directive';
|
|
6
5
|
import { LazyLoadDirective } from './directives/lazy-load.directive';
|
|
7
6
|
import { MatchHeightDirective } from './directives/match-height.directive';
|
|
8
7
|
import { ResizableDirective } from './directives/resizable.directive';
|
|
@@ -15,7 +14,6 @@ import * as i0 from "@angular/core";
|
|
|
15
14
|
// Imported and exported elements
|
|
16
15
|
const elements = [
|
|
17
16
|
// Directives
|
|
18
|
-
ContextMenuDirective,
|
|
19
17
|
LazyLoadDirective,
|
|
20
18
|
MatchHeightDirective,
|
|
21
19
|
ResizableDirective,
|
|
@@ -75,7 +73,6 @@ export class BaseModule {
|
|
|
75
73
|
BaseModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BaseModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
76
74
|
BaseModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: BaseModule, declarations: [
|
|
77
75
|
// Directives
|
|
78
|
-
ContextMenuDirective,
|
|
79
76
|
LazyLoadDirective,
|
|
80
77
|
MatchHeightDirective,
|
|
81
78
|
ResizableDirective,
|
|
@@ -84,7 +81,6 @@ BaseModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14
|
|
|
84
81
|
SafeHtmlPipe,
|
|
85
82
|
DateAgoPipe], imports: [ApolloModule, HttpClientModule], exports: [
|
|
86
83
|
// Directives
|
|
87
|
-
ContextMenuDirective,
|
|
88
84
|
LazyLoadDirective,
|
|
89
85
|
MatchHeightDirective,
|
|
90
86
|
ResizableDirective,
|
|
@@ -101,4 +97,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
101
97
|
exports: [...elements, ApolloModule, HttpClientModule],
|
|
102
98
|
}]
|
|
103
99
|
}] });
|
|
104
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
100
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZS5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9uZy1iYXNlL3NyYy9iYXNlLm1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsY0FBYyxFQUFFLFlBQVksRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQzlELE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUMvQyxPQUFPLEVBQXVCLFFBQVEsRUFBWSxNQUFNLGVBQWUsQ0FBQztBQUV4RSxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSxvQ0FBb0MsQ0FBQztBQUMxRSxPQUFPLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQztBQUNyRSxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSxxQ0FBcUMsQ0FBQztBQUMzRSxPQUFPLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQztBQUN0RSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDckQsT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Y2VdLFxuICAgICAgfSk7XG4gICAgfSBlbHNlIGlmIChjb25maWcubG9nZ2luZykge1xuICAgICAgY29uc29sZS5sb2coJ2FwaVVybCBpcyBtaXNzaW5nLCBBcG9sbG9MaW5rIGlzIG5vdCBpbml0aWFsaXplZCcpO1xuICAgIH1cblxuICAgIC8vIFJldHVybiByb290IG1vZHVsZVxuICAgIHJldHVybiB7XG4gICAgICBuZ01vZHVsZTogQmFzZU1vZHVsZSxcbiAgICAgIHByb3ZpZGVycyxcbiAgICB9O1xuICB9XG59XG4iXX0=
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, Component, Input, Output, ViewChild, NgModule } from '@angular/core';
|
|
2
|
+
import { EventEmitter, Component, Input, Output, ViewChild, Directive, Inject, HostListener, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { UntypedFormControl, Validators, UntypedFormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
5
|
import * as i2 from '@angular/common';
|
|
6
|
-
import { CommonModule } from '@angular/common';
|
|
6
|
+
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
7
7
|
import { trigger, transition, query, style, animate } from '@angular/animations';
|
|
8
8
|
import { Subscription } from 'rxjs';
|
|
9
9
|
import * as i1$1 from '@lenne.tech/ng-base/shared';
|
|
10
|
-
import { ToastType, GraphQLRequestType, BasicUser } from '@lenne.tech/ng-base/shared';
|
|
10
|
+
import { ToastType, Sort, GraphQLRequestType, BasicUser } from '@lenne.tech/ng-base/shared';
|
|
11
11
|
import { __awaiter } from 'tslib';
|
|
12
12
|
import * as i2$1 from '@angular/router';
|
|
13
13
|
import * as i1$2 from '@angular/common/http';
|
|
@@ -447,6 +447,165 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
447
447
|
args: [{ selector: 'base-breadcrumb', template: "<ul class=\"pt-3\">\n <li *ngFor=\"let breadcrumb of breadcrumbs$ | async\">\n <a [routerLink]=\"breadcrumb.url\">{{ breadcrumb.label }}</a>\n </li>\n</ul>\n", styles: ["ul{list-style:none;margin:0;padding:0}ul li{display:inline}ul li:before{content:\">\";margin:0 6px}ul li:first-child:before{content:\"\";margin:0}\n"] }]
|
|
448
448
|
}], ctorParameters: function () { return [{ type: i1$1.BreadcrumbService }]; } });
|
|
449
449
|
|
|
450
|
+
class SortDirective {
|
|
451
|
+
constructor(renderer, targetElem, document) {
|
|
452
|
+
this.renderer = renderer;
|
|
453
|
+
this.targetElem = targetElem;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Sorts columns on click
|
|
457
|
+
*/
|
|
458
|
+
sortColumn() {
|
|
459
|
+
const items = document.getElementsByTagName('th');
|
|
460
|
+
for (let i = 0; i < items.length; i++) {
|
|
461
|
+
items[i].classList.remove('asc');
|
|
462
|
+
items[i].classList.remove('desc');
|
|
463
|
+
}
|
|
464
|
+
const sort = new Sort();
|
|
465
|
+
const elem = this.targetElem.nativeElement;
|
|
466
|
+
const order = elem.getAttribute('data-order');
|
|
467
|
+
const type = elem.getAttribute('data-type');
|
|
468
|
+
const property = elem.getAttribute('data-name');
|
|
469
|
+
if (order === 'desc') {
|
|
470
|
+
this.baseSort.sort(sort.startSort(property, order, type));
|
|
471
|
+
elem.setAttribute('data-order', 'asc');
|
|
472
|
+
elem.classList.remove('desc');
|
|
473
|
+
elem.classList.add('asc');
|
|
474
|
+
}
|
|
475
|
+
else {
|
|
476
|
+
this.baseSort.sort(sort.startSort(property, order, type));
|
|
477
|
+
elem.setAttribute('data-order', 'desc');
|
|
478
|
+
elem.classList.remove('asc');
|
|
479
|
+
elem.classList.add('desc');
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
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 });
|
|
484
|
+
SortDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: SortDirective, selector: "[baseSort]", inputs: { baseSort: "baseSort" }, host: { listeners: { "click": "sortColumn()" } }, ngImport: i0 });
|
|
485
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: SortDirective, decorators: [{
|
|
486
|
+
type: Directive,
|
|
487
|
+
args: [{
|
|
488
|
+
selector: '[baseSort]',
|
|
489
|
+
}]
|
|
490
|
+
}], ctorParameters: function () {
|
|
491
|
+
return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: Document, decorators: [{
|
|
492
|
+
type: Inject,
|
|
493
|
+
args: [DOCUMENT]
|
|
494
|
+
}] }];
|
|
495
|
+
}, propDecorators: { baseSort: [{
|
|
496
|
+
type: Input
|
|
497
|
+
}], sortColumn: [{
|
|
498
|
+
type: HostListener,
|
|
499
|
+
args: ['click']
|
|
500
|
+
}] } });
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Directive vor context menu
|
|
504
|
+
* See https://stackblitz.com/edit/angular-custom-context-menu
|
|
505
|
+
*/
|
|
506
|
+
class ContextMenuDirective {
|
|
507
|
+
constructor(el) {
|
|
508
|
+
this.el = el;
|
|
509
|
+
this.xGap = 0;
|
|
510
|
+
this.yGap = 0;
|
|
511
|
+
this.overflowSpace = 10;
|
|
512
|
+
this.selectors = '*';
|
|
513
|
+
this.clickedElement = null;
|
|
514
|
+
this.previousDisplayStatus = null;
|
|
515
|
+
}
|
|
516
|
+
ngOnInit() {
|
|
517
|
+
if (this.ltContextMenu) {
|
|
518
|
+
this.previousDisplayStatus = this.ltContextMenu.style.display;
|
|
519
|
+
}
|
|
520
|
+
// Add a click listener to the window,
|
|
521
|
+
// so that we can close the context menu on left click
|
|
522
|
+
window.addEventListener('click', () => {
|
|
523
|
+
this.showContextMenu(null, false);
|
|
524
|
+
});
|
|
525
|
+
// Close context menu when escape is pressed
|
|
526
|
+
window.addEventListener('keydown', (e) => {
|
|
527
|
+
if (e.code === 'Escape') {
|
|
528
|
+
this.showContextMenu(null, false);
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
// Add an event listener to listen to the 'contextmenu' event
|
|
532
|
+
this.el.nativeElement.addEventListener('contextmenu', (e) => {
|
|
533
|
+
// Prevent the default context menu to popup
|
|
534
|
+
if (e.preventDefault) {
|
|
535
|
+
e.preventDefault();
|
|
536
|
+
}
|
|
537
|
+
// Shows our own context menu
|
|
538
|
+
this.showContextMenu(e, true);
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
// Shows or hides our custom context menu, which is specified as a input
|
|
542
|
+
showContextMenu(event, show) {
|
|
543
|
+
var _a;
|
|
544
|
+
const cm = this.ltContextMenu;
|
|
545
|
+
if (cm) {
|
|
546
|
+
// Try to open context menu
|
|
547
|
+
if (show && event && event instanceof MouseEvent) {
|
|
548
|
+
// Get valid clicked structureElement
|
|
549
|
+
const clickedElement = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.closest(this.selectors);
|
|
550
|
+
if (clickedElement) {
|
|
551
|
+
this.clickedElement = clickedElement;
|
|
552
|
+
setTimeout(() => {
|
|
553
|
+
// Set display status
|
|
554
|
+
cm.style.display = 'block';
|
|
555
|
+
// Calculate top position
|
|
556
|
+
let top = event.y + this.yGap;
|
|
557
|
+
if (top + cm.offsetHeight + 10 > document.documentElement.clientHeight) {
|
|
558
|
+
top = document.documentElement.clientHeight - cm.offsetHeight - this.overflowSpace;
|
|
559
|
+
}
|
|
560
|
+
// Calculate left position
|
|
561
|
+
let left = event.x + this.xGap;
|
|
562
|
+
if (left + cm.offsetWidth + 10 > document.documentElement.clientWidth) {
|
|
563
|
+
left = document.documentElement.clientWidth - cm.offsetWidth - this.overflowSpace;
|
|
564
|
+
}
|
|
565
|
+
// Set position
|
|
566
|
+
cm.style.top = top + 'px';
|
|
567
|
+
cm.style.left = left + 'px';
|
|
568
|
+
// Show
|
|
569
|
+
cm.style.opacity = '1.0';
|
|
570
|
+
cm.style['pointer-events'] = 'auto';
|
|
571
|
+
}, 1);
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
// Close context menu
|
|
576
|
+
this.clickedElement = null;
|
|
577
|
+
if (this.previousDisplayStatus) {
|
|
578
|
+
cm.style.display = this.previousDisplayStatus;
|
|
579
|
+
}
|
|
580
|
+
cm.style.opacity = '0.01';
|
|
581
|
+
cm.style['pointer-events'] = 'none';
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
ContextMenuDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ContextMenuDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
586
|
+
ContextMenuDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: ContextMenuDirective, selector: "[ltContextMenu]", inputs: { contextMenuData: "contextMenuData", ltContextMenu: "ltContextMenu", xGap: "xGap", yGap: "yGap", overflowSpace: "overflowSpace", selectors: "selectors" }, outputs: { clickedElement: "clickedElement" }, exportAs: ["contextMenuData"], ngImport: i0 });
|
|
587
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ContextMenuDirective, decorators: [{
|
|
588
|
+
type: Directive,
|
|
589
|
+
args: [{
|
|
590
|
+
selector: '[ltContextMenu]',
|
|
591
|
+
exportAs: 'contextMenuData',
|
|
592
|
+
}]
|
|
593
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { contextMenuData: [{
|
|
594
|
+
type: Input
|
|
595
|
+
}], ltContextMenu: [{
|
|
596
|
+
type: Input
|
|
597
|
+
}], xGap: [{
|
|
598
|
+
type: Input
|
|
599
|
+
}], yGap: [{
|
|
600
|
+
type: Input
|
|
601
|
+
}], overflowSpace: [{
|
|
602
|
+
type: Input
|
|
603
|
+
}], selectors: [{
|
|
604
|
+
type: Input
|
|
605
|
+
}], clickedElement: [{
|
|
606
|
+
type: Output
|
|
607
|
+
}] } });
|
|
608
|
+
|
|
450
609
|
class UploadImageComponent {
|
|
451
610
|
constructor(httpClient, authService) {
|
|
452
611
|
this.httpClient = httpClient;
|
|
@@ -858,13 +1017,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
858
1017
|
}] } });
|
|
859
1018
|
|
|
860
1019
|
class ModelFormComponent {
|
|
861
|
-
constructor(graphQLMetaService, graphQLService, formsService, authService, router, route) {
|
|
1020
|
+
constructor(graphQLMetaService, graphQLService, formsService, authService, router, route, cmsService) {
|
|
862
1021
|
this.graphQLMetaService = graphQLMetaService;
|
|
863
1022
|
this.graphQLService = graphQLService;
|
|
864
1023
|
this.formsService = formsService;
|
|
865
1024
|
this.authService = authService;
|
|
866
1025
|
this.router = router;
|
|
867
1026
|
this.route = route;
|
|
1027
|
+
this.cmsService = cmsService;
|
|
868
1028
|
this.delete = true;
|
|
869
1029
|
this.duplicate = false;
|
|
870
1030
|
this.logging = false;
|
|
@@ -934,7 +1094,7 @@ class ModelFormComponent {
|
|
|
934
1094
|
})
|
|
935
1095
|
.subscribe({
|
|
936
1096
|
next: (response) => {
|
|
937
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1097
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
938
1098
|
if (this.logging) {
|
|
939
1099
|
console.log('ModelFormComponent::get->value', response);
|
|
940
1100
|
}
|
|
@@ -942,12 +1102,20 @@ class ModelFormComponent {
|
|
|
942
1102
|
// Process patchFields for reference input
|
|
943
1103
|
for (const [key, value] of Object.entries(this.config)) {
|
|
944
1104
|
// If it not an array
|
|
945
|
-
if (((_a = this.config[key]) === null || _a === void 0 ? void 0 : _a.
|
|
946
|
-
this.form.get(key)
|
|
1105
|
+
if (((_a = this.config[key]) === null || _a === void 0 ? void 0 : _a.type) === 'Reference' && !((_b = this.fields[key]) === null || _b === void 0 ? void 0 : _b.isList)) {
|
|
1106
|
+
if (this.form.get(key)) {
|
|
1107
|
+
this.form
|
|
1108
|
+
.get(key)
|
|
1109
|
+
.patchValue((_e = response[((_c = this.config[key]) === null || _c === void 0 ? void 0 : _c.patchField) ? (_d = this.config[key]) === null || _d === void 0 ? void 0 : _d.patchField : key]) === null || _e === void 0 ? void 0 : _e.id);
|
|
1110
|
+
}
|
|
947
1111
|
}
|
|
948
1112
|
// If value is an array
|
|
949
|
-
if (((
|
|
950
|
-
this.form.get(key)
|
|
1113
|
+
if (((_f = this.config[key]) === null || _f === void 0 ? void 0 : _f.type) === 'Reference' && ((_g = this.fields[key]) === null || _g === void 0 ? void 0 : _g.isList)) {
|
|
1114
|
+
if (this.form.get(key)) {
|
|
1115
|
+
this.form
|
|
1116
|
+
.get(key)
|
|
1117
|
+
.patchValue((_k = response[((_h = this.config[key]) === null || _h === void 0 ? void 0 : _h.patchField) ? (_j = this.config[key]) === null || _j === void 0 ? void 0 : _j.patchField : key]) === null || _k === void 0 ? void 0 : _k.map((e) => e === null || e === void 0 ? void 0 : e.id));
|
|
1118
|
+
}
|
|
951
1119
|
}
|
|
952
1120
|
}
|
|
953
1121
|
if (this.logging) {
|
|
@@ -968,15 +1136,18 @@ class ModelFormComponent {
|
|
|
968
1136
|
* @returns An array of strings and objects.
|
|
969
1137
|
*/
|
|
970
1138
|
createRequestObject(fields) {
|
|
971
|
-
var _a, _b, _c, _d;
|
|
1139
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
972
1140
|
const requestFields = [];
|
|
973
1141
|
for (const [key, value] of Object.entries(fields)) {
|
|
974
|
-
if (((
|
|
975
|
-
|
|
1142
|
+
if (((_a = this.config[key]) === null || _a === void 0 ? void 0 : _a.exclude) !== undefined && ((_b = this.config[key]) === null || _b === void 0 ? void 0 : _b.exclude)) {
|
|
1143
|
+
continue;
|
|
1144
|
+
}
|
|
1145
|
+
if (((_d = Object.keys((_c = fields[key]) === null || _c === void 0 ? void 0 : _c.fields)) === null || _d === void 0 ? void 0 : _d.length) === 0) {
|
|
1146
|
+
if (((_e = this.config[key]) === null || _e === void 0 ? void 0 : _e.type) !== 'Reference') {
|
|
976
1147
|
requestFields.push(key);
|
|
977
1148
|
}
|
|
978
1149
|
else {
|
|
979
|
-
requestFields.push({ [(
|
|
1150
|
+
requestFields.push({ [((_f = this.config[key]) === null || _f === void 0 ? void 0 : _f.patchField) ? (_g = this.config[key]) === null || _g === void 0 ? void 0 : _g.patchField : key]: ['id'] });
|
|
980
1151
|
}
|
|
981
1152
|
}
|
|
982
1153
|
else {
|
|
@@ -1018,50 +1189,23 @@ class ModelFormComponent {
|
|
|
1018
1189
|
* It calls the graphQLService to delete the object with the id of the object that is currently being edited
|
|
1019
1190
|
*/
|
|
1020
1191
|
deleteObject() {
|
|
1021
|
-
|
|
1022
|
-
this.
|
|
1023
|
-
|
|
1024
|
-
arguments: { id: this.id },
|
|
1025
|
-
fields: ['id'],
|
|
1026
|
-
type: GraphQLRequestType.MUTATION,
|
|
1027
|
-
})
|
|
1028
|
-
.subscribe({
|
|
1029
|
-
next: (value) => {
|
|
1030
|
-
this.finished.emit(null);
|
|
1031
|
-
},
|
|
1032
|
-
error: (err) => {
|
|
1033
|
-
console.error('Error on delete object', err);
|
|
1034
|
-
},
|
|
1035
|
-
});
|
|
1036
|
-
}
|
|
1192
|
+
this.cmsService.deleteObject(this.id, this.modelName).then(() => {
|
|
1193
|
+
this.finished.emit(null);
|
|
1194
|
+
});
|
|
1037
1195
|
}
|
|
1038
1196
|
/**
|
|
1039
1197
|
* It sends a GraphQL mutation to the server to duplicate the object
|
|
1040
1198
|
*/
|
|
1041
1199
|
duplicateObject() {
|
|
1042
1200
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
.subscribe({
|
|
1052
|
-
next: (value) => {
|
|
1053
|
-
if (value === null || value === void 0 ? void 0 : value.id) {
|
|
1054
|
-
this.router.navigate(['../' + value.id], { relativeTo: this.route });
|
|
1055
|
-
}
|
|
1056
|
-
else {
|
|
1057
|
-
this.finished.emit(null);
|
|
1058
|
-
}
|
|
1059
|
-
},
|
|
1060
|
-
error: (err) => {
|
|
1061
|
-
console.error('Error on duplicate object', err);
|
|
1062
|
-
},
|
|
1063
|
-
});
|
|
1064
|
-
}
|
|
1201
|
+
this.cmsService.duplicateObject(this.id, this.modelName).then((value) => {
|
|
1202
|
+
if (value === null || value === void 0 ? void 0 : value.id) {
|
|
1203
|
+
this.router.navigate(['../' + value.id], { relativeTo: this.route });
|
|
1204
|
+
}
|
|
1205
|
+
else {
|
|
1206
|
+
this.finished.emit(null);
|
|
1207
|
+
}
|
|
1208
|
+
});
|
|
1065
1209
|
});
|
|
1066
1210
|
}
|
|
1067
1211
|
/**
|
|
@@ -1071,7 +1215,7 @@ class ModelFormComponent {
|
|
|
1071
1215
|
* @returns The first letter of the string is being capitalized and the rest of the string is being returned.
|
|
1072
1216
|
*/
|
|
1073
1217
|
capitalizeFirstLetter(value) {
|
|
1074
|
-
return
|
|
1218
|
+
return this.cmsService.capitalizeFirstLetter(value);
|
|
1075
1219
|
}
|
|
1076
1220
|
/**
|
|
1077
1221
|
* It takes an AbstractControl and returns a FormControl
|
|
@@ -1191,12 +1335,12 @@ class ModelFormComponent {
|
|
|
1191
1335
|
});
|
|
1192
1336
|
}
|
|
1193
1337
|
}
|
|
1194
|
-
ModelFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ModelFormComponent, deps: [{ token: i1$1.GraphQLMetaService }, { token: i1$1.GraphQLService }, { token: i1$1.FormsService }, { token: i1$1.AuthService }, { token: i2$1.Router }, { token: i2$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
|
|
1338
|
+
ModelFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ModelFormComponent, deps: [{ token: i1$1.GraphQLMetaService }, { token: i1$1.GraphQLService }, { token: i1$1.FormsService }, { token: i1$1.AuthService }, { token: i2$1.Router }, { token: i2$1.ActivatedRoute }, { token: i1$1.CmsService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1195
1339
|
ModelFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: ModelFormComponent, selector: "base-model-form", inputs: { modelName: "modelName", label: "label", id: "id", delete: "delete", duplicate: "duplicate", logging: "logging", config: "config" }, outputs: { finished: "finished" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"w-100\" *ngIf=\"form\">\n <div class=\"d-flex flex-row justify-content-between mt-3\">\n <h2 class=\"mb-0\">\n {{ label ? label : capitalizeFirstLetter(modelName) }} {{ operation === 'update' ? 'bearbeiten' : 'erstellen' }}\n </h2>\n\n <div class=\"d-flex flex-row align-items-center justify-content-end\">\n <button class=\"btn btn-outline-primary me-2\" *ngIf=\"id && duplicate && !loading\" (click)=\"duplicateObject()\">\n Duplizieren\n </button>\n <button class=\"btn btn-primary\" type=\"button\" (click)=\"submit(false)\" *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\n <form [formGroup]=\"form\">\n <base-model-form-sub\n [fields]=\"fields\"\n [config]=\"config\"\n [form]=\"form\"\n (imageChanged)=\"imageChanged($event)\"\n ></base-model-form-sub>\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(false)\" *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: [""], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ModelFormSubComponent, selector: "base-model-form-sub", inputs: ["fields", "form", "config"], outputs: ["imageChanged"] }] });
|
|
1196
1340
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ModelFormComponent, decorators: [{
|
|
1197
1341
|
type: Component,
|
|
1198
1342
|
args: [{ selector: 'base-model-form', template: "<div class=\"w-100\" *ngIf=\"form\">\n <div class=\"d-flex flex-row justify-content-between mt-3\">\n <h2 class=\"mb-0\">\n {{ label ? label : capitalizeFirstLetter(modelName) }} {{ operation === 'update' ? 'bearbeiten' : 'erstellen' }}\n </h2>\n\n <div class=\"d-flex flex-row align-items-center justify-content-end\">\n <button class=\"btn btn-outline-primary me-2\" *ngIf=\"id && duplicate && !loading\" (click)=\"duplicateObject()\">\n Duplizieren\n </button>\n <button class=\"btn btn-primary\" type=\"button\" (click)=\"submit(false)\" *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\n <form [formGroup]=\"form\">\n <base-model-form-sub\n [fields]=\"fields\"\n [config]=\"config\"\n [form]=\"form\"\n (imageChanged)=\"imageChanged($event)\"\n ></base-model-form-sub>\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(false)\" *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" }]
|
|
1199
|
-
}], ctorParameters: function () { return [{ type: i1$1.GraphQLMetaService }, { type: i1$1.GraphQLService }, { type: i1$1.FormsService }, { type: i1$1.AuthService }, { type: i2$1.Router }, { type: i2$1.ActivatedRoute }]; }, propDecorators: { modelName: [{
|
|
1343
|
+
}], ctorParameters: function () { return [{ type: i1$1.GraphQLMetaService }, { type: i1$1.GraphQLService }, { type: i1$1.FormsService }, { type: i1$1.AuthService }, { type: i2$1.Router }, { type: i2$1.ActivatedRoute }, { type: i1$1.CmsService }]; }, propDecorators: { modelName: [{
|
|
1200
1344
|
type: Input
|
|
1201
1345
|
}], label: [{
|
|
1202
1346
|
type: Input
|
|
@@ -1215,9 +1359,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
1215
1359
|
}] } });
|
|
1216
1360
|
|
|
1217
1361
|
class ModelTableComponent {
|
|
1218
|
-
constructor(graphQLMetaService, graphQLService) {
|
|
1362
|
+
constructor(graphQLMetaService, graphQLService, cmsService) {
|
|
1219
1363
|
this.graphQLMetaService = graphQLMetaService;
|
|
1220
1364
|
this.graphQLService = graphQLService;
|
|
1365
|
+
this.cmsService = cmsService;
|
|
1221
1366
|
this.createMode = false;
|
|
1222
1367
|
this.logging = false;
|
|
1223
1368
|
this.create = true;
|
|
@@ -1226,6 +1371,7 @@ class ModelTableComponent {
|
|
|
1226
1371
|
this.duplicate = true;
|
|
1227
1372
|
this.config = {};
|
|
1228
1373
|
this.fieldConfig = {};
|
|
1374
|
+
this.uniqueField = 'id';
|
|
1229
1375
|
this.idSelected = new EventEmitter();
|
|
1230
1376
|
this.createModeChanged = new EventEmitter();
|
|
1231
1377
|
this.tableFields = {
|
|
@@ -1349,22 +1495,39 @@ class ModelTableComponent {
|
|
|
1349
1495
|
this.idSelected.emit(this.selectedId);
|
|
1350
1496
|
}
|
|
1351
1497
|
}
|
|
1498
|
+
/**
|
|
1499
|
+
* It calls the duplicateObject function in the cmsService, passing in the id of the object to be duplicated and the
|
|
1500
|
+
* modelName of the object
|
|
1501
|
+
*/
|
|
1502
|
+
duplicateObject(id) {
|
|
1503
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1504
|
+
yield this.cmsService.duplicateObject(id, this.modelName);
|
|
1505
|
+
this.loadObjects(this.availableFields);
|
|
1506
|
+
});
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1509
|
+
* It calls the deleteObject function in the cmsService, passing in the id of the object to delete and the name of the
|
|
1510
|
+
* model
|
|
1511
|
+
*/
|
|
1512
|
+
deleteObject(id) {
|
|
1513
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1514
|
+
yield this.cmsService.deleteObject(id, this.modelName);
|
|
1515
|
+
this.loadObjects(this.availableFields);
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1352
1518
|
/**
|
|
1353
1519
|
* It takes a string, capitalizes the first letter, and returns the modified string
|
|
1354
|
-
*
|
|
1355
|
-
* @param value - The string to capitalize.
|
|
1356
|
-
* @returns The first letter of the string is being capitalized and the rest of the string is being returned.
|
|
1357
1520
|
*/
|
|
1358
1521
|
capitalizeFirstLetter(value) {
|
|
1359
|
-
return
|
|
1522
|
+
return this.cmsService.capitalizeFirstLetter(value);
|
|
1360
1523
|
}
|
|
1361
1524
|
}
|
|
1362
|
-
ModelTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ModelTableComponent, deps: [{ token: i1$1.GraphQLMetaService }, { token: i1$1.GraphQLService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1363
|
-
ModelTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: ModelTableComponent, selector: "base-model-table", inputs: { modelName: "modelName", objectId: "objectId", createMode: "createMode", logging: "logging", create: "create", update: "update", delete: "delete", duplicate: "duplicate", config: "config", fieldConfig: "fieldConfig" }, outputs: { idSelected: "idSelected", createModeChanged: "createModeChanged" }, usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"!selectedId && !createMode\">\n <div class=\"w-100 d-flex flex-row justify-content-between align-items-center mb-4\">\n <h2 class=\"mb-0\" *ngIf=\"modelName\">\n {{ config?.plural ? config?.plural : config?.label ? config?.label : capitalizeFirstLetter(modelName) + 's' }}\n </h2>\n <div class=\"d-flex align-items-center\">\n <button class=\"btn btn-primary\" (click)=\"createNewObject()\" *ngIf=\"create\">Erstellen</button>\n </div>\n </div>\n <table class=\"table table-hover
|
|
1525
|
+
ModelTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ModelTableComponent, deps: [{ token: i1$1.GraphQLMetaService }, { token: i1$1.GraphQLService }, { token: i1$1.CmsService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1526
|
+
ModelTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: ModelTableComponent, selector: "base-model-table", inputs: { modelName: "modelName", objectId: "objectId", createMode: "createMode", logging: "logging", create: "create", update: "update", delete: "delete", duplicate: "duplicate", config: "config", fieldConfig: "fieldConfig" }, outputs: { idSelected: "idSelected", createModeChanged: "createModeChanged" }, usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"!selectedId && !createMode\">\n <div class=\"w-100 d-flex flex-row justify-content-between align-items-center mb-4\">\n <h2 class=\"mb-0\" *ngIf=\"modelName\">\n {{ config?.plural ? config?.plural : config?.label ? config?.label : capitalizeFirstLetter(modelName) + 's' }}\n </h2>\n <div class=\"d-flex align-items-center\">\n <button class=\"btn btn-primary\" (click)=\"createNewObject()\" *ngIf=\"create\">Erstellen</button>\n </div>\n </div>\n\n <div\n class=\"table-responsive\"\n [ltContextMenu]=\"contextMenu\"\n [selectors]=\"'.object-col'\"\n #contextMenuData=\"contextMenuData\"\n >\n <table class=\"table table-hover bg-white\">\n <thead>\n <tr>\n <th\n scope=\"col\"\n *ngFor=\"let field of availableFields\"\n [baseSort]=\"objects\"\n data-order=\"desc\"\n [attr.data-name]=\"field\"\n >\n {{ tableFields[field]?.label ? tableFields[field]?.label : capitalizeFirstLetter(field) }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr class=\"object-col\" *ngFor=\"let object of objects\" [id]=\"object[uniqueField]\">\n <td class=\"cursor-pointer\" *ngFor=\"let field of availableFields\" (click)=\"selectId(object)\">\n <ng-container *ngIf=\"tableFields[field]?.dateFormat\">\n {{ object[field] | date: tableFields[field]?.dateFormat }} Uhr\n </ng-container>\n\n <ng-container *ngIf=\"!tableFields[field]?.dateFormat\">\n {{ object[field] }}\n </ng-container>\n </td>\n </tr>\n </tbody>\n </table>\n\n <div class=\"context-menu\" #contextMenu>\n <div class=\"context-menu-item\" (click)=\"selectId({ id: contextMenuData.clickedElement?.id })\">Bearbeiten</div>\n <div class=\"context-menu-item\" *ngIf=\"duplicate\" (click)=\"duplicateObject(contextMenuData.clickedElement?.id)\">\n Duplizieren\n </div>\n <div class=\"context-menu-item\" *ngIf=\"delete\" (click)=\"deleteObject(contextMenuData.clickedElement?.id)\">\n L\u00F6schen\n </div>\n </div>\n </div>\n</div>\n\n<div class=\"w-100\" *ngIf=\"selectedId || createMode\">\n <button class=\"btn btn-outline-primary mb-3\" (click)=\"selectId('')\">Zur\u00FCck</button>\n <base-model-form\n [modelName]=\"modelName\"\n [label]=\"config?.label\"\n [config]=\"fieldConfig\"\n [logging]=\"logging\"\n [id]=\"selectedId\"\n (finished)=\"selectId('')\"\n [delete]=\"delete\"\n [duplicate]=\"duplicate\"\n ></base-model-form>\n</div>\n", styles: [".cursor-pointer{cursor:pointer}.asc:after,.desc:after{border-style:solid;border-width:.2em .2em 0 0;content:\"\";display:inline-block;height:.45em;left:5px;position:relative;transform:rotate(-45deg);vertical-align:middle;width:.45em}.asc:after{transform:rotate(135deg)}td{vertical-align:middle}.bi,th{cursor:pointer;-webkit-user-select:none;user-select:none}.table>:not(:first-child){border-top:0}table{border-radius:.25rem;border-color:#e2e8f0!important}table thead{text-transform:uppercase;font-size:12px}table thead th{padding:12px 24px}table tbody tr td{font-weight:400!important;font-size:16px;padding:16px 24px}.context-menu{opacity:.01%;pointer-events:none;background-color:#fff;border:1px solid #ccc;box-shadow:1px 1px 10px #0000001a;padding:10px 0;position:fixed;top:0;left:0;width:200px}.context-menu-item{cursor:pointer;padding:8px 15px}.context-menu-item:hover{color:var(--bs-primary)}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: SortDirective, selector: "[baseSort]", inputs: ["baseSort"] }, { kind: "directive", type: ContextMenuDirective, selector: "[ltContextMenu]", inputs: ["contextMenuData", "ltContextMenu", "xGap", "yGap", "overflowSpace", "selectors"], outputs: ["clickedElement"], exportAs: ["contextMenuData"] }, { kind: "component", type: ModelFormComponent, selector: "base-model-form", inputs: ["modelName", "label", "id", "delete", "duplicate", "logging", "config"], outputs: ["finished"] }, { kind: "pipe", type: i2.DatePipe, name: "date" }] });
|
|
1364
1527
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ModelTableComponent, decorators: [{
|
|
1365
1528
|
type: Component,
|
|
1366
|
-
args: [{ selector: 'base-model-table', template: "<div *ngIf=\"!selectedId && !createMode\">\n <div class=\"w-100 d-flex flex-row justify-content-between align-items-center mb-4\">\n <h2 class=\"mb-0\" *ngIf=\"modelName\">\n {{ config?.plural ? config?.plural : config?.label ? config?.label : capitalizeFirstLetter(modelName) + 's' }}\n </h2>\n <div class=\"d-flex align-items-center\">\n <button class=\"btn btn-primary\" (click)=\"createNewObject()\" *ngIf=\"create\">Erstellen</button>\n </div>\n </div>\n <table class=\"table table-hover
|
|
1367
|
-
}], ctorParameters: function () { return [{ type: i1$1.GraphQLMetaService }, { type: i1$1.GraphQLService }]; }, propDecorators: { modelName: [{
|
|
1529
|
+
args: [{ selector: 'base-model-table', template: "<div *ngIf=\"!selectedId && !createMode\">\n <div class=\"w-100 d-flex flex-row justify-content-between align-items-center mb-4\">\n <h2 class=\"mb-0\" *ngIf=\"modelName\">\n {{ config?.plural ? config?.plural : config?.label ? config?.label : capitalizeFirstLetter(modelName) + 's' }}\n </h2>\n <div class=\"d-flex align-items-center\">\n <button class=\"btn btn-primary\" (click)=\"createNewObject()\" *ngIf=\"create\">Erstellen</button>\n </div>\n </div>\n\n <div\n class=\"table-responsive\"\n [ltContextMenu]=\"contextMenu\"\n [selectors]=\"'.object-col'\"\n #contextMenuData=\"contextMenuData\"\n >\n <table class=\"table table-hover bg-white\">\n <thead>\n <tr>\n <th\n scope=\"col\"\n *ngFor=\"let field of availableFields\"\n [baseSort]=\"objects\"\n data-order=\"desc\"\n [attr.data-name]=\"field\"\n >\n {{ tableFields[field]?.label ? tableFields[field]?.label : capitalizeFirstLetter(field) }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr class=\"object-col\" *ngFor=\"let object of objects\" [id]=\"object[uniqueField]\">\n <td class=\"cursor-pointer\" *ngFor=\"let field of availableFields\" (click)=\"selectId(object)\">\n <ng-container *ngIf=\"tableFields[field]?.dateFormat\">\n {{ object[field] | date: tableFields[field]?.dateFormat }} Uhr\n </ng-container>\n\n <ng-container *ngIf=\"!tableFields[field]?.dateFormat\">\n {{ object[field] }}\n </ng-container>\n </td>\n </tr>\n </tbody>\n </table>\n\n <div class=\"context-menu\" #contextMenu>\n <div class=\"context-menu-item\" (click)=\"selectId({ id: contextMenuData.clickedElement?.id })\">Bearbeiten</div>\n <div class=\"context-menu-item\" *ngIf=\"duplicate\" (click)=\"duplicateObject(contextMenuData.clickedElement?.id)\">\n Duplizieren\n </div>\n <div class=\"context-menu-item\" *ngIf=\"delete\" (click)=\"deleteObject(contextMenuData.clickedElement?.id)\">\n L\u00F6schen\n </div>\n </div>\n </div>\n</div>\n\n<div class=\"w-100\" *ngIf=\"selectedId || createMode\">\n <button class=\"btn btn-outline-primary mb-3\" (click)=\"selectId('')\">Zur\u00FCck</button>\n <base-model-form\n [modelName]=\"modelName\"\n [label]=\"config?.label\"\n [config]=\"fieldConfig\"\n [logging]=\"logging\"\n [id]=\"selectedId\"\n (finished)=\"selectId('')\"\n [delete]=\"delete\"\n [duplicate]=\"duplicate\"\n ></base-model-form>\n</div>\n", styles: [".cursor-pointer{cursor:pointer}.asc:after,.desc:after{border-style:solid;border-width:.2em .2em 0 0;content:\"\";display:inline-block;height:.45em;left:5px;position:relative;transform:rotate(-45deg);vertical-align:middle;width:.45em}.asc:after{transform:rotate(135deg)}td{vertical-align:middle}.bi,th{cursor:pointer;-webkit-user-select:none;user-select:none}.table>:not(:first-child){border-top:0}table{border-radius:.25rem;border-color:#e2e8f0!important}table thead{text-transform:uppercase;font-size:12px}table thead th{padding:12px 24px}table tbody tr td{font-weight:400!important;font-size:16px;padding:16px 24px}.context-menu{opacity:.01%;pointer-events:none;background-color:#fff;border:1px solid #ccc;box-shadow:1px 1px 10px #0000001a;padding:10px 0;position:fixed;top:0;left:0;width:200px}.context-menu-item{cursor:pointer;padding:8px 15px}.context-menu-item:hover{color:var(--bs-primary)}\n"] }]
|
|
1530
|
+
}], ctorParameters: function () { return [{ type: i1$1.GraphQLMetaService }, { type: i1$1.GraphQLService }, { type: i1$1.CmsService }]; }, propDecorators: { modelName: [{
|
|
1368
1531
|
type: Input
|
|
1369
1532
|
}], objectId: [{
|
|
1370
1533
|
type: Input
|
|
@@ -1390,10 +1553,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
1390
1553
|
type: Output
|
|
1391
1554
|
}] } });
|
|
1392
1555
|
|
|
1556
|
+
class BackButtonDirective {
|
|
1557
|
+
constructor(navigation) {
|
|
1558
|
+
this.navigation = navigation;
|
|
1559
|
+
}
|
|
1560
|
+
onClick() {
|
|
1561
|
+
this.navigation.back();
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
BackButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BackButtonDirective, deps: [{ token: i1$1.NavigationService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1565
|
+
BackButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: BackButtonDirective, selector: "[baseBackButton]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
|
|
1566
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BackButtonDirective, decorators: [{
|
|
1567
|
+
type: Directive,
|
|
1568
|
+
args: [{
|
|
1569
|
+
selector: '[baseBackButton]',
|
|
1570
|
+
}]
|
|
1571
|
+
}], ctorParameters: function () { return [{ type: i1$1.NavigationService }]; }, propDecorators: { onClick: [{
|
|
1572
|
+
type: HostListener,
|
|
1573
|
+
args: ['click']
|
|
1574
|
+
}] } });
|
|
1575
|
+
|
|
1393
1576
|
// Modules
|
|
1394
1577
|
const imports = [FormsModule, ReactiveFormsModule, CommonModule];
|
|
1395
1578
|
// Imported and exported elements
|
|
1396
1579
|
const elements = [
|
|
1580
|
+
// Directives
|
|
1581
|
+
SortDirective,
|
|
1582
|
+
BackButtonDirective,
|
|
1583
|
+
ContextMenuDirective,
|
|
1397
1584
|
// Components
|
|
1398
1585
|
InputComponent,
|
|
1399
1586
|
SelectComponent,
|
|
@@ -1414,6 +1601,10 @@ class BaseComponentsModule {
|
|
|
1414
1601
|
}
|
|
1415
1602
|
BaseComponentsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BaseComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1416
1603
|
BaseComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: BaseComponentsModule, declarations: [
|
|
1604
|
+
// Directives
|
|
1605
|
+
SortDirective,
|
|
1606
|
+
BackButtonDirective,
|
|
1607
|
+
ContextMenuDirective,
|
|
1417
1608
|
// Components
|
|
1418
1609
|
InputComponent,
|
|
1419
1610
|
SelectComponent,
|
|
@@ -1430,6 +1621,10 @@ BaseComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", ve
|
|
|
1430
1621
|
UploadImageComponent,
|
|
1431
1622
|
RefenceInputComponent
|
|
1432
1623
|
], imports: [FormsModule, ReactiveFormsModule, CommonModule], exports: [
|
|
1624
|
+
// Directives
|
|
1625
|
+
SortDirective,
|
|
1626
|
+
BackButtonDirective,
|
|
1627
|
+
ContextMenuDirective,
|
|
1433
1628
|
// Components
|
|
1434
1629
|
InputComponent,
|
|
1435
1630
|
SelectComponent,
|
|
@@ -1464,5 +1659,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
1464
1659
|
* Generated bundle index. Do not edit.
|
|
1465
1660
|
*/
|
|
1466
1661
|
|
|
1467
|
-
export { BaseComponentsModule, BreadcrumbComponent, CheckboxComponent, InputComponent, LoadingBarComponent, ModelFormComponent, ModelFormSubComponent, ModelTableComponent, RefenceInputComponent, SelectComponent, SkeletonLoaderComponent, TagsComponent, TextareaComponent, ToastComponent, UploadImageComponent };
|
|
1662
|
+
export { BackButtonDirective, BaseComponentsModule, BreadcrumbComponent, CheckboxComponent, ContextMenuDirective, InputComponent, LoadingBarComponent, ModelFormComponent, ModelFormSubComponent, ModelTableComponent, RefenceInputComponent, SelectComponent, SkeletonLoaderComponent, SortDirective, TagsComponent, TextareaComponent, ToastComponent, UploadImageComponent };
|
|
1468
1663
|
//# sourceMappingURL=lenne.tech-ng-base-base-components.mjs.map
|