@lenne.tech/ng-base 13.16.0 → 13.19.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-cms/base-cms.module.d.ts +6 -6
- package/base-cms/interfaces/base-cms-module-config.interface.d.ts +6 -6
- package/base-cms/pages/base-cms/base-cms.component.d.ts +0 -7
- package/base-components/base-components.module.d.ts +5 -3
- package/base-components/components/model-form/model-form.component.d.ts +13 -2
- package/base-components/components/model-form-sub/model-form-sub.component.d.ts +26 -0
- package/base-components/components/model-table/model-table.component.d.ts +4 -3
- package/base-components/components/upload-image/upload-image.component.d.ts +70 -0
- package/base-components/public-api.d.ts +2 -0
- package/base-prototype/base-prototype.module.d.ts +7 -6
- package/base-prototype/pages/profile/profile.component.d.ts +34 -0
- package/base-prototype/public-api.d.ts +1 -0
- package/esm2020/base-cms/base-cms.module.mjs +3 -4
- package/esm2020/base-cms/interfaces/base-cms-module-config.interface.mjs +1 -1
- package/esm2020/base-cms/pages/base-cms/base-cms.component.mjs +10 -24
- package/esm2020/base-components/base-components.module.mjs +11 -3
- package/esm2020/base-components/components/model-form/model-form.component.mjs +47 -12
- package/esm2020/base-components/components/model-form-sub/model-form-sub.component.mjs +47 -0
- package/esm2020/base-components/components/model-table/model-table.component.mjs +14 -10
- package/esm2020/base-components/components/upload-image/upload-image.component.mjs +138 -0
- package/esm2020/base-components/public-api.mjs +3 -1
- package/esm2020/base-prototype/base-prototype.module.mjs +8 -4
- package/esm2020/base-prototype/pages/profile/profile.component.mjs +45 -0
- package/esm2020/base-prototype/public-api.mjs +2 -1
- package/esm2020/shared/classes/graphql-meta.class.mjs +14 -2
- package/esm2020/shared/classes/sort.class.mjs +47 -0
- package/esm2020/shared/directives/sort.directive.mjs +54 -0
- package/esm2020/shared/public-api.mjs +4 -1
- package/esm2020/shared/services/graphql.service.mjs +6 -1
- package/esm2020/shared/services/user.service.mjs +2 -1
- package/fesm2015/lenne.tech-ng-base-base-cms.mjs +16 -30
- package/fesm2015/lenne.tech-ng-base-base-cms.mjs.map +1 -1
- package/fesm2015/lenne.tech-ng-base-base-components.mjs +246 -21
- package/fesm2015/lenne.tech-ng-base-base-components.mjs.map +1 -1
- package/fesm2015/lenne.tech-ng-base-base-prototype.mjs +49 -5
- package/fesm2015/lenne.tech-ng-base-base-prototype.mjs.map +1 -1
- package/fesm2015/lenne.tech-ng-base-shared.mjs +122 -3
- package/fesm2015/lenne.tech-ng-base-shared.mjs.map +1 -1
- package/fesm2020/lenne.tech-ng-base-base-cms.mjs +11 -26
- package/fesm2020/lenne.tech-ng-base-base-cms.mjs.map +1 -1
- package/fesm2020/lenne.tech-ng-base-base-components.mjs +240 -18
- package/fesm2020/lenne.tech-ng-base-base-components.mjs.map +1 -1
- package/fesm2020/lenne.tech-ng-base-base-prototype.mjs +49 -5
- package/fesm2020/lenne.tech-ng-base-base-prototype.mjs.map +1 -1
- package/fesm2020/lenne.tech-ng-base-shared.mjs +119 -3
- package/fesm2020/lenne.tech-ng-base-shared.mjs.map +1 -1
- package/package.json +3 -2
- package/shared/classes/sort.class.d.ts +19 -0
- package/shared/directives/sort.directive.d.ts +14 -0
- package/shared/public-api.d.ts +2 -0
|
@@ -8,6 +8,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
10
|
import { ToastType, GraphQLRequestType } from '@lenne.tech/ng-base/shared';
|
|
11
|
+
import * as i1$2 from '@angular/common/http';
|
|
11
12
|
|
|
12
13
|
class InputComponent {
|
|
13
14
|
constructor() {
|
|
@@ -370,6 +371,180 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImpor
|
|
|
370
371
|
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"] }]
|
|
371
372
|
}], ctorParameters: function () { return [{ type: i1$1.BreadcrumbService }]; } });
|
|
372
373
|
|
|
374
|
+
class UploadImageComponent {
|
|
375
|
+
constructor(httpClient) {
|
|
376
|
+
this.httpClient = httpClient;
|
|
377
|
+
this.supportText = 'Supports: JPEG, JPG, PNG';
|
|
378
|
+
this.required = false;
|
|
379
|
+
this.dragText = 'Drag & Drop';
|
|
380
|
+
this.validExtensions = ['image/jpeg', 'image/jpg', 'image/png'];
|
|
381
|
+
this.url = 'http://localhost:3000';
|
|
382
|
+
this.uploadPath = '/files/upload';
|
|
383
|
+
this.deletePath = '/files/';
|
|
384
|
+
this.path = '/files/';
|
|
385
|
+
this.dragActive = false;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* The dragOver function is called when the user drags a file over the dropzone. It prevents the default action of the
|
|
389
|
+
* event, and sets the dragText to 'Release to Upload' and the dragActive to true
|
|
390
|
+
*
|
|
391
|
+
* @param event - any - This is the event that is triggered when the user drags a file over the dropzone.
|
|
392
|
+
*/
|
|
393
|
+
dragOver(event) {
|
|
394
|
+
event.preventDefault();
|
|
395
|
+
this.dragText = 'Release to Upload';
|
|
396
|
+
this.dragActive = true;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* When the user drags a file over the drop zone, the dragActive variable is set to true, which will change the color of
|
|
400
|
+
* the drop zone to green
|
|
401
|
+
*
|
|
402
|
+
* @param event - The event object that is passed to the dragLeave event.
|
|
403
|
+
*/
|
|
404
|
+
dragLeave(event) {
|
|
405
|
+
this.dragText = 'Drag & Drop';
|
|
406
|
+
this.dragActive = false;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* The function takes an event as a parameter, prevents the default action of the event, sets the URL of the image to the
|
|
410
|
+
* file that was dragged and dropped, sets the text of the drag and drop area to the default text, and sets the
|
|
411
|
+
* dragActive variable to false
|
|
412
|
+
*
|
|
413
|
+
* @param event - any - This is the event that is triggered when the user drags and drops a file.
|
|
414
|
+
*/
|
|
415
|
+
drop(event) {
|
|
416
|
+
event.preventDefault();
|
|
417
|
+
this.setUrl(event.dataTransfer.files[0]);
|
|
418
|
+
this.dragText = 'Drag & Drop';
|
|
419
|
+
this.dragActive = false;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* It takes a file as an argument, checks if the file type is valid, and if it is, it creates a new FileReader object,
|
|
423
|
+
* sets the onload function to set the fileUrl to the result of the fileReader, sets the selectedFile to the file, and
|
|
424
|
+
* calls the upload function
|
|
425
|
+
*
|
|
426
|
+
* @param file - any - this is the file that is selected by the user.
|
|
427
|
+
*/
|
|
428
|
+
setUrl(file) {
|
|
429
|
+
if (this.validExtensions.includes(file.type)) {
|
|
430
|
+
const fileReader = new FileReader();
|
|
431
|
+
fileReader.onload = () => {
|
|
432
|
+
this.fileUrl = fileReader.result;
|
|
433
|
+
this.selectedFile = file;
|
|
434
|
+
this.upload();
|
|
435
|
+
};
|
|
436
|
+
fileReader.readAsDataURL(file);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* The function takes an event as an argument, and then sets the url of the file to the first file in the event's
|
|
441
|
+
* target's files array
|
|
442
|
+
*
|
|
443
|
+
* @param event - any - The event that is triggered when the user selects a file.
|
|
444
|
+
*/
|
|
445
|
+
selectFile(event) {
|
|
446
|
+
this.setUrl(event.target.files[0]);
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* We create a new FormData object, append the selected file to it, and then send it to the server
|
|
450
|
+
*/
|
|
451
|
+
upload() {
|
|
452
|
+
const data = new FormData();
|
|
453
|
+
data.append('file', this.selectedFile);
|
|
454
|
+
this.httpClient.post(this.url + this.uploadPath, data).subscribe((result) => {
|
|
455
|
+
if (result === null || result === void 0 ? void 0 : result.id) {
|
|
456
|
+
this.control.setValue(result.id);
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* It deletes the file from the server and sets the selectedFile and fileUrl to null
|
|
462
|
+
*
|
|
463
|
+
* @param [id] - The id of the file to delete.
|
|
464
|
+
*/
|
|
465
|
+
deleteFile(id) {
|
|
466
|
+
this.selectedFile = null;
|
|
467
|
+
this.fileUrl = null;
|
|
468
|
+
if (id) {
|
|
469
|
+
this.httpClient.delete(this.url + this.deletePath + id).subscribe((result) => {
|
|
470
|
+
this.selectedFile = null;
|
|
471
|
+
this.fileUrl = null;
|
|
472
|
+
this.control.setValue('');
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
UploadImageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: UploadImageComponent, deps: [{ token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Component });
|
|
478
|
+
UploadImageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: UploadImageComponent, selector: "base-upload-image", inputs: { id: "id", name: "name", label: "label", supportText: "supportText", required: "required", dragText: "dragText", validExtensions: "validExtensions", control: "control", url: "url", uploadPath: "uploadPath", deletePath: "deletePath", path: "path" }, ngImport: i0, template: "<div class=\"mt-3\">\n <label [for]=\"id\" class=\"form-label\" [ngClass]=\"{ required: required }\" *ngIf=\"label\">{{ label }}</label>\n <div\n class=\"drag-area\"\n (dragover)=\"dragOver($event)\"\n (dragleave)=\"dragLeave($event)\"\n (drop)=\"drop($event)\"\n [ngClass]=\"{ active: dragActive }\"\n >\n <ng-container *ngIf=\"selectedFile && !control?.value\">\n <img [src]=\"fileUrl\" *ngIf=\"selectedFile\" />\n <button class=\"btn btn-danger\" (click)=\"deleteFile()\">L\u00F6schen</button>\n </ng-container>\n\n <ng-container *ngIf=\"control?.value\">\n <img [src]=\"url + path + control?.value\" />\n <button class=\"btn btn-danger\" (click)=\"deleteFile(control?.value)\">L\u00F6schen</button>\n </ng-container>\n\n <ng-container *ngIf=\"!selectedFile && !control?.value\">\n <div class=\"icon\">\n <i class=\"bi bi-images\"></i>\n </div>\n\n <span class=\"header\">{{ dragText }}</span>\n <span class=\"header\">or <span class=\"button\" (click)=\"fileInput.click()\">browse</span></span>\n <input type=\"file\" (change)=\"selectFile($event)\" hidden #fileInput />\n <span class=\"support\">{{ supportText }}</span>\n </ng-container>\n </div>\n</div>\n", styles: [".required:after{content:\" *\"}.drag-area{height:400px;border:2px dashed #e1e1e1;display:flex;flex-direction:column;justify-content:center;align-items:center;margin:10px auto;padding:20px}.drag-area img{height:100%;max-height:300px;max-width:100%}.drag-area .btn-danger{margin-top:auto}.drag-area .icon{font-size:50px;color:var(--bs-primary)}.drag-area .header{font-size:20px;font-weight:500}.drag-area .support{font-size:12px;color:#e1e1e1;margin:10px 0 15px}.drag-area .button{font-size:20px;font-weight:500;color:var(--bs-primary);cursor:pointer}.active{border:2px solid var(--bs-primary)}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
479
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: UploadImageComponent, decorators: [{
|
|
480
|
+
type: Component,
|
|
481
|
+
args: [{ selector: 'base-upload-image', template: "<div class=\"mt-3\">\n <label [for]=\"id\" class=\"form-label\" [ngClass]=\"{ required: required }\" *ngIf=\"label\">{{ label }}</label>\n <div\n class=\"drag-area\"\n (dragover)=\"dragOver($event)\"\n (dragleave)=\"dragLeave($event)\"\n (drop)=\"drop($event)\"\n [ngClass]=\"{ active: dragActive }\"\n >\n <ng-container *ngIf=\"selectedFile && !control?.value\">\n <img [src]=\"fileUrl\" *ngIf=\"selectedFile\" />\n <button class=\"btn btn-danger\" (click)=\"deleteFile()\">L\u00F6schen</button>\n </ng-container>\n\n <ng-container *ngIf=\"control?.value\">\n <img [src]=\"url + path + control?.value\" />\n <button class=\"btn btn-danger\" (click)=\"deleteFile(control?.value)\">L\u00F6schen</button>\n </ng-container>\n\n <ng-container *ngIf=\"!selectedFile && !control?.value\">\n <div class=\"icon\">\n <i class=\"bi bi-images\"></i>\n </div>\n\n <span class=\"header\">{{ dragText }}</span>\n <span class=\"header\">or <span class=\"button\" (click)=\"fileInput.click()\">browse</span></span>\n <input type=\"file\" (change)=\"selectFile($event)\" hidden #fileInput />\n <span class=\"support\">{{ supportText }}</span>\n </ng-container>\n </div>\n</div>\n", styles: [".required:after{content:\" *\"}.drag-area{height:400px;border:2px dashed #e1e1e1;display:flex;flex-direction:column;justify-content:center;align-items:center;margin:10px auto;padding:20px}.drag-area img{height:100%;max-height:300px;max-width:100%}.drag-area .btn-danger{margin-top:auto}.drag-area .icon{font-size:50px;color:var(--bs-primary)}.drag-area .header{font-size:20px;font-weight:500}.drag-area .support{font-size:12px;color:#e1e1e1;margin:10px 0 15px}.drag-area .button{font-size:20px;font-weight:500;color:var(--bs-primary);cursor:pointer}.active{border:2px solid var(--bs-primary)}\n"] }]
|
|
482
|
+
}], ctorParameters: function () { return [{ type: i1$2.HttpClient }]; }, propDecorators: { id: [{
|
|
483
|
+
type: Input
|
|
484
|
+
}], name: [{
|
|
485
|
+
type: Input
|
|
486
|
+
}], label: [{
|
|
487
|
+
type: Input
|
|
488
|
+
}], supportText: [{
|
|
489
|
+
type: Input
|
|
490
|
+
}], required: [{
|
|
491
|
+
type: Input
|
|
492
|
+
}], dragText: [{
|
|
493
|
+
type: Input
|
|
494
|
+
}], validExtensions: [{
|
|
495
|
+
type: Input
|
|
496
|
+
}], control: [{
|
|
497
|
+
type: Input
|
|
498
|
+
}], url: [{
|
|
499
|
+
type: Input
|
|
500
|
+
}], uploadPath: [{
|
|
501
|
+
type: Input
|
|
502
|
+
}], deletePath: [{
|
|
503
|
+
type: Input
|
|
504
|
+
}], path: [{
|
|
505
|
+
type: Input
|
|
506
|
+
}] } });
|
|
507
|
+
|
|
508
|
+
class ModelFormSubComponent {
|
|
509
|
+
constructor() {
|
|
510
|
+
this.config = {};
|
|
511
|
+
this.keys = [];
|
|
512
|
+
}
|
|
513
|
+
ngOnInit() {
|
|
514
|
+
this.keys = Object.keys(this.fields);
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* It takes a string, capitalizes the first letter, and returns the new string
|
|
518
|
+
*
|
|
519
|
+
* @param value - The string that you want to capitalize the first letter of.
|
|
520
|
+
* @returns The first letter of the string is being capitalized and the rest of the string is being returned.
|
|
521
|
+
*/
|
|
522
|
+
capitalizeFirstLetter(value) {
|
|
523
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* It takes an AbstractControl and returns a FormControl
|
|
527
|
+
*
|
|
528
|
+
* @param control - AbstractControl | null | undefined
|
|
529
|
+
* @returns A FormControl
|
|
530
|
+
*/
|
|
531
|
+
transformToControl(control) {
|
|
532
|
+
return control;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
ModelFormSubComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: ModelFormSubComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
536
|
+
ModelFormSubComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: ModelFormSubComponent, selector: "base-model-form-sub", inputs: { fields: "fields", form: "form", config: "config" }, ngImport: i0, template: "<div class=\"mt-3\" *ngFor=\"let key of keys\">\n <ng-container *ngIf=\"!fields[key]?.type\">\n <fieldset class=\"border rounded-3 p-3\">\n <legend class=\"float-none w-auto px-3\">\n {{ config[key]?.label ? config[key].label : capitalizeFirstLetter(key) }}\n </legend>\n <base-model-form-sub\n [fields]=\"fields[key]\"\n [config]=\"config[key]?.fields || {}\"\n [form]=\"form.get(key)\"\n ></base-model-form-sub>\n </fieldset>\n </ng-container>\n\n <ng-container *ngIf=\"fields[key]?.type\">\n <ng-container [ngSwitch]=\"config[key]?.type ? config[key]?.type : fields[key]?.type\">\n <ng-container *ngSwitchCase=\"'String'\">\n <ng-container *ngIf=\"fields[key]?.isList && !config[key]?.exclude\">\n <base-tags\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\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 && !config[key]?.exclude\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\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=\"'Image'\">\n <base-upload-image\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [url]=\"config[key]?.url\"\n [path]=\"config[key]?.path || '/files/'\"\n [uploadPath]=\"config[key]?.uploadPath || '/files/upload'\"\n [deletePath]=\"config[key]?.deletePath || '/files/'\"\n [supportText]=\"config[key]?.supportText || 'Unterst\u00FCtzte Formate: JPEG, JPG, PNG'\"\n [dragText]=\"config[key]?.dragText || 'Drag & Drop'\"\n [validExtensions]=\"config[key]?.validExtensions || ['image/jpeg', 'image/jpg', 'image/png']\"\n [required]=\"fields[key].isRequired\"\n ></base-upload-image>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Boolean'\">\n <base-checkbox\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"fields[key].isRequired\"\n ></base-checkbox>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Float'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [type]=\"'number'\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"fields[key].isRequired\"\n ></base-input>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'DateTime'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\n [type]=\"'datetime-local'\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"fields[key].isRequired\"\n ></base-input>\n </ng-container>\n </ng-container>\n </ng-container>\n</div>\n", styles: [""], components: [{ type: ModelFormSubComponent, selector: "base-model-form-sub", inputs: ["fields", "form", "config"] }, { 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: UploadImageComponent, selector: "base-upload-image", inputs: ["id", "name", "label", "supportText", "required", "dragText", "validExtensions", "control", "url", "uploadPath", "deletePath", "path"] }, { type: CheckboxComponent, selector: "base-checkbox", inputs: ["id", "name", "label", "value", "control", "required"] }], directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }] });
|
|
537
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: ModelFormSubComponent, decorators: [{
|
|
538
|
+
type: Component,
|
|
539
|
+
args: [{ selector: 'base-model-form-sub', template: "<div class=\"mt-3\" *ngFor=\"let key of keys\">\n <ng-container *ngIf=\"!fields[key]?.type\">\n <fieldset class=\"border rounded-3 p-3\">\n <legend class=\"float-none w-auto px-3\">\n {{ config[key]?.label ? config[key].label : capitalizeFirstLetter(key) }}\n </legend>\n <base-model-form-sub\n [fields]=\"fields[key]\"\n [config]=\"config[key]?.fields || {}\"\n [form]=\"form.get(key)\"\n ></base-model-form-sub>\n </fieldset>\n </ng-container>\n\n <ng-container *ngIf=\"fields[key]?.type\">\n <ng-container [ngSwitch]=\"config[key]?.type ? config[key]?.type : fields[key]?.type\">\n <ng-container *ngSwitchCase=\"'String'\">\n <ng-container *ngIf=\"fields[key]?.isList && !config[key]?.exclude\">\n <base-tags\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\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 && !config[key]?.exclude\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\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=\"'Image'\">\n <base-upload-image\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [url]=\"config[key]?.url\"\n [path]=\"config[key]?.path || '/files/'\"\n [uploadPath]=\"config[key]?.uploadPath || '/files/upload'\"\n [deletePath]=\"config[key]?.deletePath || '/files/'\"\n [supportText]=\"config[key]?.supportText || 'Unterst\u00FCtzte Formate: JPEG, JPG, PNG'\"\n [dragText]=\"config[key]?.dragText || 'Drag & Drop'\"\n [validExtensions]=\"config[key]?.validExtensions || ['image/jpeg', 'image/jpg', 'image/png']\"\n [required]=\"fields[key].isRequired\"\n ></base-upload-image>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Boolean'\">\n <base-checkbox\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"fields[key].isRequired\"\n ></base-checkbox>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Float'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [type]=\"'number'\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"fields[key].isRequired\"\n ></base-input>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'DateTime'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\n [type]=\"'datetime-local'\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"fields[key].isRequired\"\n ></base-input>\n </ng-container>\n </ng-container>\n </ng-container>\n</div>\n", styles: [""] }]
|
|
540
|
+
}], propDecorators: { fields: [{
|
|
541
|
+
type: Input
|
|
542
|
+
}], form: [{
|
|
543
|
+
type: Input
|
|
544
|
+
}], config: [{
|
|
545
|
+
type: Input
|
|
546
|
+
}] } });
|
|
547
|
+
|
|
373
548
|
class ModelFormComponent {
|
|
374
549
|
constructor(graphQLMetaService, graphQLService, formsService) {
|
|
375
550
|
this.graphQLMetaService = graphQLMetaService;
|
|
@@ -377,6 +552,7 @@ class ModelFormComponent {
|
|
|
377
552
|
this.formsService = formsService;
|
|
378
553
|
this.delete = true;
|
|
379
554
|
this.logging = false;
|
|
555
|
+
this.config = {};
|
|
380
556
|
this.finished = new EventEmitter();
|
|
381
557
|
this.loading = false;
|
|
382
558
|
this.keys = [];
|
|
@@ -410,12 +586,15 @@ class ModelFormComponent {
|
|
|
410
586
|
console.log('ModelFormComponent::init->fields', this.fields);
|
|
411
587
|
console.log('ModelFormComponent::init->keys', this.keys);
|
|
412
588
|
}
|
|
413
|
-
this.createForm(this.fields);
|
|
589
|
+
this.form = this.createForm(this.fields);
|
|
414
590
|
if (this.id) {
|
|
415
591
|
this.getObjectById(this.id);
|
|
416
592
|
}
|
|
417
593
|
}
|
|
418
594
|
}
|
|
595
|
+
getKeysFromSubObject(key) {
|
|
596
|
+
return Object.keys(this.fields[key]);
|
|
597
|
+
}
|
|
419
598
|
/**
|
|
420
599
|
* It takes an id, and then calls the graphQLService to get the object from the database
|
|
421
600
|
*
|
|
@@ -424,11 +603,12 @@ class ModelFormComponent {
|
|
|
424
603
|
getObjectById(id) {
|
|
425
604
|
if (this.logging) {
|
|
426
605
|
console.log('ModelFormComponent::getObjectById->id', id);
|
|
606
|
+
console.log('ModelFormComponent::getObjectById->requestFields', this.createRequestObject(this.fields));
|
|
427
607
|
}
|
|
428
608
|
this.graphQLService
|
|
429
609
|
.graphQl('get' + this.capitalizeFirstLetter(this.modelName), {
|
|
430
610
|
arguments: { id },
|
|
431
|
-
fields: this.
|
|
611
|
+
fields: this.createRequestObject(this.fields),
|
|
432
612
|
type: GraphQLRequestType.QUERY,
|
|
433
613
|
})
|
|
434
614
|
.subscribe({
|
|
@@ -444,20 +624,46 @@ class ModelFormComponent {
|
|
|
444
624
|
},
|
|
445
625
|
});
|
|
446
626
|
}
|
|
627
|
+
/**
|
|
628
|
+
* It takes a GraphQL type collection and returns an array of strings and objects
|
|
629
|
+
*
|
|
630
|
+
* @param fields - IGraphQLTypeCollection - This is the object that is returned from the
|
|
631
|
+
* introspection query.
|
|
632
|
+
* @returns An array of strings and objects.
|
|
633
|
+
*/
|
|
634
|
+
createRequestObject(fields) {
|
|
635
|
+
var _a;
|
|
636
|
+
const requestFields = [];
|
|
637
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
638
|
+
if ((_a = fields[key]) === null || _a === void 0 ? void 0 : _a.type) {
|
|
639
|
+
requestFields.push(key);
|
|
640
|
+
}
|
|
641
|
+
else {
|
|
642
|
+
const subkeys = this.createRequestObject(fields[key]);
|
|
643
|
+
const resultObject = {};
|
|
644
|
+
resultObject[key] = subkeys;
|
|
645
|
+
requestFields.push(resultObject);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
return requestFields;
|
|
649
|
+
}
|
|
447
650
|
/**
|
|
448
651
|
* It takes a collection of GraphQL types and creates a form group with a form control for each type
|
|
449
652
|
*
|
|
450
653
|
* @param fields - IGraphQLTypeCollection
|
|
451
654
|
*/
|
|
452
655
|
createForm(fields) {
|
|
453
|
-
var _a;
|
|
656
|
+
var _a, _b;
|
|
454
657
|
const group = {};
|
|
455
658
|
for (const [key, value] of Object.entries(fields)) {
|
|
456
659
|
if ((_a = fields[key]) === null || _a === void 0 ? void 0 : _a.type) {
|
|
457
|
-
group[key] = new FormControl('', value.isRequired ? Validators.required : []);
|
|
660
|
+
group[key] = new FormControl(((_b = fields[key]) === null || _b === void 0 ? void 0 : _b.type) === 'Float' ? 0 : '', value.isRequired ? Validators.required : []);
|
|
661
|
+
}
|
|
662
|
+
else {
|
|
663
|
+
group[key] = this.createForm(fields[key]);
|
|
458
664
|
}
|
|
459
665
|
}
|
|
460
|
-
|
|
666
|
+
return new FormGroup(group);
|
|
461
667
|
}
|
|
462
668
|
/**
|
|
463
669
|
* It calls the graphQLService to delete the object with the id of the object that is currently being edited
|
|
@@ -515,6 +721,9 @@ class ModelFormComponent {
|
|
|
515
721
|
this.loading = false;
|
|
516
722
|
return;
|
|
517
723
|
}
|
|
724
|
+
if (this.logging) {
|
|
725
|
+
console.log('ModelFormComponent::submit->formValue', this.form.value);
|
|
726
|
+
}
|
|
518
727
|
this.graphQLService
|
|
519
728
|
.graphQl(this.operation + this.capitalizeFirstLetter(this.modelName), {
|
|
520
729
|
arguments: this.operation === 'update' ? { id: this.id, input: this.form.value } : { input: this.form.value },
|
|
@@ -534,18 +743,22 @@ class ModelFormComponent {
|
|
|
534
743
|
}
|
|
535
744
|
}
|
|
536
745
|
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 });
|
|
537
|
-
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", logging: "logging" }, outputs: { finished: "finished" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"w-100\" *ngIf=\"form\">\n <
|
|
746
|
+
ModelFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: ModelFormComponent, selector: "base-model-form", inputs: { modelName: "modelName", label: "label", id: "id", delete: "delete", logging: "logging", config: "config" }, outputs: { finished: "finished" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"w-100\" *ngIf=\"form\">\n <h2>\n {{ label ? label : capitalizeFirstLetter(modelName) }} {{ operation === 'update' ? 'bearbeiten' : 'erstellen' }}\n </h2>\n\n <form [formGroup]=\"form\">\n <base-model-form-sub [fields]=\"fields\" [config]=\"config\" [form]=\"form\"></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()\" *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: ModelFormSubComponent, selector: "base-model-form-sub", inputs: ["fields", "form", "config"] }], 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.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
538
747
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: ModelFormComponent, decorators: [{
|
|
539
748
|
type: Component,
|
|
540
|
-
args: [{ selector: 'base-model-form', template: "<div class=\"w-100\" *ngIf=\"form\">\n <
|
|
749
|
+
args: [{ selector: 'base-model-form', template: "<div class=\"w-100\" *ngIf=\"form\">\n <h2>\n {{ label ? label : capitalizeFirstLetter(modelName) }} {{ operation === 'update' ? 'bearbeiten' : 'erstellen' }}\n </h2>\n\n <form [formGroup]=\"form\">\n <base-model-form-sub [fields]=\"fields\" [config]=\"config\" [form]=\"form\"></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()\" *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: [""] }]
|
|
541
750
|
}], ctorParameters: function () { return [{ type: i1$1.GraphQLMetaService }, { type: i1$1.GraphQLService }, { type: i1$1.FormsService }]; }, propDecorators: { modelName: [{
|
|
542
751
|
type: Input
|
|
752
|
+
}], label: [{
|
|
753
|
+
type: Input
|
|
543
754
|
}], id: [{
|
|
544
755
|
type: Input
|
|
545
756
|
}], delete: [{
|
|
546
757
|
type: Input
|
|
547
758
|
}], logging: [{
|
|
548
759
|
type: Input
|
|
760
|
+
}], config: [{
|
|
761
|
+
type: Input
|
|
549
762
|
}], finished: [{
|
|
550
763
|
type: Output
|
|
551
764
|
}] } });
|
|
@@ -558,10 +771,11 @@ class ModelTableComponent {
|
|
|
558
771
|
this.create = true;
|
|
559
772
|
this.update = true;
|
|
560
773
|
this.delete = true;
|
|
561
|
-
this.
|
|
562
|
-
this.
|
|
774
|
+
this.config = {};
|
|
775
|
+
this.fieldConfig = {};
|
|
563
776
|
this.idSelected = new EventEmitter();
|
|
564
777
|
this.createModeChanged = new EventEmitter();
|
|
778
|
+
this.tableFields = ['id', 'name', 'title', 'description', 'email', 'createdAt', 'updatedAt'];
|
|
565
779
|
this.objects = [];
|
|
566
780
|
this.availableFields = [];
|
|
567
781
|
this.selectedId = '';
|
|
@@ -578,12 +792,13 @@ class ModelTableComponent {
|
|
|
578
792
|
});
|
|
579
793
|
}
|
|
580
794
|
ngOnChanges(changes) {
|
|
795
|
+
var _a;
|
|
581
796
|
if (changes['modelName'] && this.meta) {
|
|
582
797
|
this.init();
|
|
583
798
|
}
|
|
584
799
|
if (changes['objectId'] && this.meta) {
|
|
585
800
|
if (this.selectedId !== this.objectId) {
|
|
586
|
-
if (this.logging) {
|
|
801
|
+
if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.logging) {
|
|
587
802
|
console.log('ModelTableComponent::ngOnChanges->selectedId', this.selectedId);
|
|
588
803
|
}
|
|
589
804
|
this.selectedId = this.objectId;
|
|
@@ -595,16 +810,19 @@ class ModelTableComponent {
|
|
|
595
810
|
* with. We're then using that information to populate the `availableFields` array
|
|
596
811
|
*/
|
|
597
812
|
init() {
|
|
598
|
-
var _a;
|
|
813
|
+
var _a, _b, _c;
|
|
599
814
|
this.availableFields = [];
|
|
815
|
+
if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.tableFields) {
|
|
816
|
+
this.tableFields = this.config.tableFields;
|
|
817
|
+
}
|
|
600
818
|
const possibleFields = this.meta.getFields('find' + this.capitalizeFirstLetter(this.modelName) + 's');
|
|
601
819
|
const keys = Object.keys(possibleFields);
|
|
602
|
-
(
|
|
820
|
+
(_b = this.tableFields) === null || _b === void 0 ? void 0 : _b.forEach((field) => {
|
|
603
821
|
if (keys.includes(field)) {
|
|
604
822
|
this.availableFields.push(field);
|
|
605
823
|
}
|
|
606
824
|
});
|
|
607
|
-
if (this.logging) {
|
|
825
|
+
if ((_c = this.config) === null || _c === void 0 ? void 0 : _c.logging) {
|
|
608
826
|
console.log('ModelTableComponent::init->possibleFields', possibleFields);
|
|
609
827
|
console.log('ModelTableComponent::init->keys', keys);
|
|
610
828
|
console.log('ModelTableComponent::init->availableFields', this.availableFields);
|
|
@@ -633,7 +851,8 @@ class ModelTableComponent {
|
|
|
633
851
|
})
|
|
634
852
|
.subscribe({
|
|
635
853
|
next: (value) => {
|
|
636
|
-
|
|
854
|
+
var _a;
|
|
855
|
+
if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.logging) {
|
|
637
856
|
console.log('ModelTableComponent::loadObjects->value', value);
|
|
638
857
|
}
|
|
639
858
|
this.objects = value;
|
|
@@ -670,10 +889,10 @@ class ModelTableComponent {
|
|
|
670
889
|
}
|
|
671
890
|
}
|
|
672
891
|
ModelTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: ModelTableComponent, deps: [{ token: i1$1.GraphQLMetaService }, { token: i1$1.GraphQLService }], target: i0.ɵɵFactoryTarget.Component });
|
|
673
|
-
ModelTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: ModelTableComponent, selector: "base-model-table", inputs: { modelName: "modelName", objectId: "objectId", createMode: "createMode", create: "create", update: "update", delete: "delete",
|
|
892
|
+
ModelTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: ModelTableComponent, selector: "base-model-table", inputs: { modelName: "modelName", objectId: "objectId", createMode: "createMode", create: "create", update: "update", delete: "delete", 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 mb-4\">\n <h2 *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 table-responsive bg-white\">\n <thead>\n <tr>\n <th scope=\"col\" *ngFor=\"let field of availableFields\">{{ capitalizeFirstLetter(field) }}</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let object of objects\">\n <td class=\"cursor-pointer\" *ngFor=\"let field of availableFields\" (click)=\"selectId(object)\">\n {{ object[field] }}\n </td>\n </tr>\n </tbody>\n </table>\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]=\"config?.logging\"\n [id]=\"selectedId\"\n (finished)=\"selectId('')\"\n [delete]=\"delete\"\n ></base-model-form>\n</div>\n", styles: [".cursor-pointer{cursor:pointer}.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}\n"], components: [{ type: ModelFormComponent, selector: "base-model-form", inputs: ["modelName", "label", "id", "delete", "logging", "config"], outputs: ["finished"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
|
674
893
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: ModelTableComponent, decorators: [{
|
|
675
894
|
type: Component,
|
|
676
|
-
args: [{ selector: 'base-model-table', template: "<div *ngIf=\"!selectedId && !createMode\">\n <div class=\"w-100 d-flex flex-row justify-content-between mb-4\">\n <
|
|
895
|
+
args: [{ selector: 'base-model-table', template: "<div *ngIf=\"!selectedId && !createMode\">\n <div class=\"w-100 d-flex flex-row justify-content-between mb-4\">\n <h2 *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 table-responsive bg-white\">\n <thead>\n <tr>\n <th scope=\"col\" *ngFor=\"let field of availableFields\">{{ capitalizeFirstLetter(field) }}</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let object of objects\">\n <td class=\"cursor-pointer\" *ngFor=\"let field of availableFields\" (click)=\"selectId(object)\">\n {{ object[field] }}\n </td>\n </tr>\n </tbody>\n </table>\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]=\"config?.logging\"\n [id]=\"selectedId\"\n (finished)=\"selectId('')\"\n [delete]=\"delete\"\n ></base-model-form>\n</div>\n", styles: [".cursor-pointer{cursor:pointer}.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}\n"] }]
|
|
677
896
|
}], ctorParameters: function () { return [{ type: i1$1.GraphQLMetaService }, { type: i1$1.GraphQLService }]; }, propDecorators: { modelName: [{
|
|
678
897
|
type: Input
|
|
679
898
|
}], objectId: [{
|
|
@@ -686,9 +905,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImpor
|
|
|
686
905
|
type: Input
|
|
687
906
|
}], delete: [{
|
|
688
907
|
type: Input
|
|
689
|
-
}],
|
|
908
|
+
}], config: [{
|
|
690
909
|
type: Input
|
|
691
|
-
}],
|
|
910
|
+
}], fieldConfig: [{
|
|
692
911
|
type: Input
|
|
693
912
|
}], idSelected: [{
|
|
694
913
|
type: Output
|
|
@@ -712,6 +931,8 @@ const elements = [
|
|
|
712
931
|
BreadcrumbComponent,
|
|
713
932
|
ModelFormComponent,
|
|
714
933
|
ModelTableComponent,
|
|
934
|
+
ModelFormSubComponent,
|
|
935
|
+
UploadImageComponent,
|
|
715
936
|
];
|
|
716
937
|
class BaseComponentsModule {
|
|
717
938
|
}
|
|
@@ -728,7 +949,9 @@ BaseComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", ve
|
|
|
728
949
|
SkeletonLoaderComponent,
|
|
729
950
|
BreadcrumbComponent,
|
|
730
951
|
ModelFormComponent,
|
|
731
|
-
ModelTableComponent
|
|
952
|
+
ModelTableComponent,
|
|
953
|
+
ModelFormSubComponent,
|
|
954
|
+
UploadImageComponent
|
|
732
955
|
], imports: [FormsModule, ReactiveFormsModule, CommonModule], exports: [
|
|
733
956
|
// Components
|
|
734
957
|
InputComponent,
|
|
@@ -741,7 +964,9 @@ BaseComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", ve
|
|
|
741
964
|
SkeletonLoaderComponent,
|
|
742
965
|
BreadcrumbComponent,
|
|
743
966
|
ModelFormComponent,
|
|
744
|
-
ModelTableComponent
|
|
967
|
+
ModelTableComponent,
|
|
968
|
+
ModelFormSubComponent,
|
|
969
|
+
UploadImageComponent
|
|
745
970
|
] });
|
|
746
971
|
BaseComponentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BaseComponentsModule, imports: [imports] });
|
|
747
972
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: BaseComponentsModule, decorators: [{
|
|
@@ -761,5 +986,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImpor
|
|
|
761
986
|
* Generated bundle index. Do not edit.
|
|
762
987
|
*/
|
|
763
988
|
|
|
764
|
-
export { BaseComponentsModule, BreadcrumbComponent, CheckboxComponent, InputComponent, LoadingBarComponent, ModelFormComponent, ModelTableComponent, SelectComponent, SkeletonLoaderComponent, TagsComponent, TextareaComponent, ToastComponent };
|
|
989
|
+
export { BaseComponentsModule, BreadcrumbComponent, CheckboxComponent, InputComponent, LoadingBarComponent, ModelFormComponent, ModelFormSubComponent, ModelTableComponent, SelectComponent, SkeletonLoaderComponent, TagsComponent, TextareaComponent, ToastComponent, UploadImageComponent };
|
|
765
990
|
//# sourceMappingURL=lenne.tech-ng-base-base-components.mjs.map
|