@lenne.tech/ng-base 15.0.0-beta-3 → 16.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 +1 -2
- package/base-components/components/checkbox/checkbox.component.d.ts +1 -1
- package/base-components/components/delete-account/delete-account.component.d.ts +1 -1
- package/base-components/components/fab-button/fab-button.component.d.ts +1 -1
- package/base-components/components/input/input.component.d.ts +1 -1
- package/base-components/components/loading-bar/loading-bar.component.d.ts +1 -1
- package/base-components/components/model-form/model-form-base.component.d.ts +1 -1
- package/base-components/components/model-form/model-form.component.d.ts +1 -1
- package/base-components/components/model-form-sub/model-form-sub.component.d.ts +1 -1
- package/base-components/components/model-table/model-table.component.d.ts +1 -1
- package/base-components/components/refence-input/refence-input.component.d.ts +1 -1
- package/base-components/components/select/select.component.d.ts +1 -1
- package/base-components/components/skeleton-loader/skeleton-loader.component.d.ts +1 -1
- package/base-components/components/tags/tags.component.d.ts +1 -1
- package/base-components/components/textarea/textarea.component.d.ts +1 -1
- package/base-components/components/toast/toast.component.d.ts +1 -1
- package/base-components/components/upload-image/upload-image.component.d.ts +1 -1
- package/base-components/directives/context-menu.directive.d.ts +1 -1
- package/base-components/directives/sort.directive.d.ts +1 -1
- package/base-prototype/pages/login/login.component.d.ts +1 -1
- package/base-prototype/pages/profile/profile.component.d.ts +1 -1
- package/base-prototype/pages/set-password/set-password.component.d.ts +1 -1
- package/esm2022/base-cms/base-cms-routing.module.mjs +33 -0
- package/esm2022/base-cms/base-cms.module.mjs +61 -0
- package/esm2022/base-cms/pages/base-cms/base-cms.component.mjs +233 -0
- package/esm2022/base-components/base-components.module.mjs +123 -0
- package/esm2022/base-components/components/breadcrumb/breadcrumb.component.mjs +21 -0
- package/esm2022/base-components/components/change-password/change-password.component.mjs +96 -0
- package/esm2022/base-components/components/checkbox/checkbox.component.mjs +35 -0
- package/esm2022/base-components/components/delete-account/delete-account.component.mjs +61 -0
- package/esm2022/base-components/components/fab-button/fab-button.component.mjs +21 -0
- package/esm2022/base-components/components/input/input.component.mjs +72 -0
- package/esm2022/base-components/components/loading-bar/loading-bar.component.mjs +39 -0
- package/esm2022/base-components/components/model-form/model-form-base.component.mjs +145 -0
- package/esm2022/base-components/components/model-form/model-form.component.mjs +585 -0
- package/esm2022/base-components/components/model-form-sub/model-form-sub.component.mjs +111 -0
- package/esm2022/base-components/components/model-table/model-table.component.mjs +470 -0
- package/esm2022/base-components/components/refence-input/refence-input.component.mjs +273 -0
- package/esm2022/base-components/components/select/select.component.mjs +59 -0
- package/esm2022/base-components/components/skeleton-loader/skeleton-loader.component.mjs +32 -0
- package/esm2022/base-components/components/tags/tags.component.mjs +224 -0
- package/esm2022/base-components/components/textarea/textarea.component.mjs +76 -0
- package/esm2022/base-components/components/toast/toast.component.mjs +70 -0
- package/esm2022/base-components/components/upload-image/upload-image.component.mjs +343 -0
- package/esm2022/base-components/directives/back-button.directive.mjs +25 -0
- package/esm2022/base-components/directives/context-menu.directive.mjs +112 -0
- package/esm2022/base-components/directives/sort.directive.mjs +61 -0
- package/esm2022/base-components/directives/stop-propagation.directive.mjs +24 -0
- package/esm2022/base-components/pipes/ellipses.pipe.mjs +23 -0
- package/esm2022/base-prototype/base-prototype.module.mjs +54 -0
- package/esm2022/base-prototype/pages/email-verification/email-verification.component.mjs +62 -0
- package/esm2022/base-prototype/pages/forgot-password/forgot-password.component.mjs +75 -0
- package/esm2022/base-prototype/pages/login/login.component.mjs +111 -0
- package/esm2022/base-prototype/pages/profile/profile.component.mjs +86 -0
- package/esm2022/base-prototype/pages/register/register.component.mjs +94 -0
- package/esm2022/base-prototype/pages/set-password/set-password.component.mjs +90 -0
- package/esm2022/shared/classes/auth.class.mjs +14 -0
- package/esm2022/shared/classes/basic-user.class.mjs +49 -0
- package/esm2022/shared/classes/graphql-enum.class.mjs +10 -0
- package/esm2022/shared/classes/graphql-meta.class.mjs +345 -0
- package/esm2022/shared/classes/graphql-type.class.mjs +14 -0
- package/esm2022/shared/classes/sort.class.mjs +38 -0
- package/esm2022/shared/services/auth.service.mjs +153 -0
- package/esm2022/shared/services/breadcrumb.service.mjs +70 -0
- package/{esm2020 → esm2022}/shared/services/cms.service.mjs +7 -5
- package/esm2022/shared/services/file.service.mjs +87 -0
- package/esm2022/shared/services/forms.service.mjs +62 -0
- package/esm2022/shared/services/graphql-meta.service.mjs +133 -0
- package/esm2022/shared/services/graphql-plus.service.mjs +94 -0
- package/esm2022/shared/services/graphql.service.mjs +511 -0
- package/esm2022/shared/services/image.service.mjs +103 -0
- package/esm2022/shared/services/loader.service.mjs +79 -0
- package/esm2022/shared/services/navigation.service.mjs +39 -0
- package/esm2022/shared/services/scroll.service.mjs +208 -0
- package/esm2022/shared/services/storage.service.mjs +142 -0
- package/esm2022/shared/services/toast.service.mjs +40 -0
- package/esm2022/shared/services/user.service.mjs +161 -0
- package/esm2022/shared/services/ws.service.mjs +18 -0
- package/esm2022/src/base.module.mjs +98 -0
- package/esm2022/src/directives/lazy-load.directive.mjs +48 -0
- package/esm2022/src/directives/match-height.directive.mjs +92 -0
- package/esm2022/src/directives/resizable.directive.mjs +92 -0
- package/esm2022/src/functions/extract-files.function.mjs +87 -0
- package/esm2022/src/guards/auth.guard.mjs +92 -0
- package/esm2022/src/guards/can-deactivate.guard.mjs +17 -0
- package/esm2022/src/guards/logout.guard.mjs +35 -0
- package/esm2022/src/pipes/date-ago.pipe.mjs +64 -0
- package/esm2022/src/pipes/safe-html.pipe.mjs +23 -0
- package/esm2022/src/services/fullscreen.service.mjs +52 -0
- package/esm2022/src/services/seo.service.mjs +100 -0
- package/esm2022/src/services/theme.service.mjs +45 -0
- package/{fesm2020 → fesm2022}/lenne.tech-ng-base-base-cms.mjs +41 -30
- package/{fesm2020 → fesm2022}/lenne.tech-ng-base-base-cms.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/lenne.tech-ng-base-base-components.mjs +421 -300
- package/fesm2022/lenne.tech-ng-base-base-components.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/lenne.tech-ng-base-base-prototype.mjs +127 -88
- package/fesm2022/lenne.tech-ng-base-base-prototype.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/lenne.tech-ng-base-shared.mjs +164 -113
- package/{fesm2020 → fesm2022}/lenne.tech-ng-base-shared.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/lenne.tech-ng-base.mjs +153 -126
- package/fesm2022/lenne.tech-ng-base.mjs.map +1 -0
- package/package.json +23 -38
- package/src/directives/lazy-load.directive.d.ts +1 -1
- package/src/directives/match-height.directive.d.ts +1 -1
- package/src/directives/resizable.directive.d.ts +1 -1
- package/src/guards/auth.guard.d.ts +4 -3
- package/src/guards/can-deactivate.guard.d.ts +1 -2
- package/src/guards/logout.guard.d.ts +2 -2
- package/esm2020/base-cms/base-cms-routing.module.mjs +0 -32
- package/esm2020/base-cms/base-cms.module.mjs +0 -59
- package/esm2020/base-cms/pages/base-cms/base-cms.component.mjs +0 -222
- package/esm2020/base-components/base-components.module.mjs +0 -123
- package/esm2020/base-components/components/breadcrumb/breadcrumb.component.mjs +0 -18
- package/esm2020/base-components/components/change-password/change-password.component.mjs +0 -90
- package/esm2020/base-components/components/checkbox/checkbox.component.mjs +0 -31
- package/esm2020/base-components/components/delete-account/delete-account.component.mjs +0 -56
- package/esm2020/base-components/components/fab-button/fab-button.component.mjs +0 -21
- package/esm2020/base-components/components/input/input.component.mjs +0 -67
- package/esm2020/base-components/components/loading-bar/loading-bar.component.mjs +0 -35
- package/esm2020/base-components/components/model-form/model-form-base.component.mjs +0 -136
- package/esm2020/base-components/components/model-form/model-form.component.mjs +0 -564
- package/esm2020/base-components/components/model-form-sub/model-form-sub.component.mjs +0 -102
- package/esm2020/base-components/components/model-table/model-table.component.mjs +0 -456
- package/esm2020/base-components/components/refence-input/refence-input.component.mjs +0 -261
- package/esm2020/base-components/components/select/select.component.mjs +0 -54
- package/esm2020/base-components/components/skeleton-loader/skeleton-loader.component.mjs +0 -32
- package/esm2020/base-components/components/tags/tags.component.mjs +0 -218
- package/esm2020/base-components/components/textarea/textarea.component.mjs +0 -72
- package/esm2020/base-components/components/toast/toast.component.mjs +0 -68
- package/esm2020/base-components/components/upload-image/upload-image.component.mjs +0 -324
- package/esm2020/base-components/directives/back-button.directive.mjs +0 -23
- package/esm2020/base-components/directives/context-menu.directive.mjs +0 -108
- package/esm2020/base-components/directives/sort.directive.mjs +0 -57
- package/esm2020/base-components/directives/stop-propagation.directive.mjs +0 -23
- package/esm2020/base-components/pipes/ellipses.pipe.mjs +0 -22
- package/esm2020/base-prototype/base-prototype.module.mjs +0 -53
- package/esm2020/base-prototype/pages/email-verification/email-verification.component.mjs +0 -55
- package/esm2020/base-prototype/pages/forgot-password/forgot-password.component.mjs +0 -67
- package/esm2020/base-prototype/pages/login/login.component.mjs +0 -102
- package/esm2020/base-prototype/pages/profile/profile.component.mjs +0 -81
- package/esm2020/base-prototype/pages/register/register.component.mjs +0 -86
- package/esm2020/base-prototype/pages/set-password/set-password.component.mjs +0 -82
- package/esm2020/shared/classes/auth.class.mjs +0 -17
- package/esm2020/shared/classes/basic-user.class.mjs +0 -52
- package/esm2020/shared/classes/graphql-enum.class.mjs +0 -9
- package/esm2020/shared/classes/graphql-meta.class.mjs +0 -344
- package/esm2020/shared/classes/graphql-type.class.mjs +0 -17
- package/esm2020/shared/classes/sort.class.mjs +0 -40
- package/esm2020/shared/services/auth.service.mjs +0 -148
- package/esm2020/shared/services/breadcrumb.service.mjs +0 -68
- package/esm2020/shared/services/file.service.mjs +0 -84
- package/esm2020/shared/services/forms.service.mjs +0 -59
- package/esm2020/shared/services/graphql-meta.service.mjs +0 -123
- package/esm2020/shared/services/graphql-plus.service.mjs +0 -89
- package/esm2020/shared/services/graphql.service.mjs +0 -507
- package/esm2020/shared/services/image.service.mjs +0 -102
- package/esm2020/shared/services/loader.service.mjs +0 -79
- package/esm2020/shared/services/navigation.service.mjs +0 -36
- package/esm2020/shared/services/scroll.service.mjs +0 -179
- package/esm2020/shared/services/storage.service.mjs +0 -140
- package/esm2020/shared/services/toast.service.mjs +0 -41
- package/esm2020/shared/services/user.service.mjs +0 -155
- package/esm2020/shared/services/ws.service.mjs +0 -16
- package/esm2020/src/base.module.mjs +0 -97
- package/esm2020/src/directives/lazy-load.directive.mjs +0 -45
- package/esm2020/src/directives/match-height.directive.mjs +0 -84
- package/esm2020/src/directives/resizable.directive.mjs +0 -90
- package/esm2020/src/functions/extract-files.function.mjs +0 -84
- package/esm2020/src/guards/auth.guard.mjs +0 -80
- package/esm2020/src/guards/can-deactivate.guard.mjs +0 -16
- package/esm2020/src/guards/logout.guard.mjs +0 -32
- package/esm2020/src/pipes/date-ago.pipe.mjs +0 -65
- package/esm2020/src/pipes/safe-html.pipe.mjs +0 -21
- package/esm2020/src/services/fullscreen.service.mjs +0 -51
- package/esm2020/src/services/seo.service.mjs +0 -97
- package/esm2020/src/services/theme.service.mjs +0 -43
- package/fesm2015/lenne.tech-ng-base-base-cms.mjs +0 -323
- package/fesm2015/lenne.tech-ng-base-base-cms.mjs.map +0 -1
- package/fesm2015/lenne.tech-ng-base-base-components.mjs +0 -2866
- package/fesm2015/lenne.tech-ng-base-base-components.mjs.map +0 -1
- package/fesm2015/lenne.tech-ng-base-base-prototype.mjs +0 -496
- package/fesm2015/lenne.tech-ng-base-base-prototype.mjs.map +0 -1
- package/fesm2015/lenne.tech-ng-base-shared.mjs +0 -2750
- package/fesm2015/lenne.tech-ng-base-shared.mjs.map +0 -1
- package/fesm2015/lenne.tech-ng-base.mjs +0 -905
- package/fesm2015/lenne.tech-ng-base.mjs.map +0 -1
- package/fesm2020/lenne.tech-ng-base-base-components.mjs.map +0 -1
- package/fesm2020/lenne.tech-ng-base-base-prototype.mjs.map +0 -1
- package/fesm2020/lenne.tech-ng-base.mjs.map +0 -1
- /package/{esm2020 → esm2022}/base-cms/interfaces/base-cms-module-config.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/base-cms/lenne.tech-ng-base-base-cms.mjs +0 -0
- /package/{esm2020 → esm2022}/base-cms/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/base-components/lenne.tech-ng-base-base-components.mjs +0 -0
- /package/{esm2020 → esm2022}/base-components/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/base-prototype/lenne.tech-ng-base-base-prototype.mjs +0 -0
- /package/{esm2020 → esm2022}/base-prototype/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/lenne.tech-ng-base.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/classes/helper.class.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/classes/standard.class.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/decorators/debounce.decorator.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/enums/comparison-operator.enum.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/enums/graphql-request-type.enum.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/enums/logical-operator.enum.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/enums/skeleton-type.enum.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/enums/sort-order.enum.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/enums/toast-type.enum.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/functions/ws-client.function.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/base-module-config.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/breadcrumb.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/can-component-deactivate.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/cms-enum-values.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/cms-field-config.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/cms-model-config.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/cms-table-field.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/combined-filter-input.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/compress-options.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/cropping-options.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/field-object.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/field.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/filter-input.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/find-args.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/graphql-crud-type.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/graphql-fields-object.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/graphql-options.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/graphql-plus-options.interfacen.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/graphql-type-collection.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/login-config.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/single-filter-input.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/sort-input.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/time-components.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/interfaces/toast.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/lenne.tech-ng-base-shared.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/types/graphql-fields.type.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/types/storage.type.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/validators/email.validator.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/validators/match.validator.mjs +0 -0
- /package/{esm2020 → esm2022}/shared/validators/secure-password.validator.mjs +0 -0
- /package/{esm2020 → esm2022}/src/decorators/auto-unsubscribe.decorator.mjs +0 -0
- /package/{esm2020 → esm2022}/src/factories/apollo-options.factory.mjs +0 -0
|
@@ -1,2866 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, Component, Input, Output, ViewChild, Directive, Inject, HostListener, Pipe, ViewContainerRef, NgModule } from '@angular/core';
|
|
3
|
-
import * as i1 from '@angular/forms';
|
|
4
|
-
import { FormControl, UntypedFormControl, UntypedFormGroup, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
|
-
import * as i2 from '@angular/common';
|
|
6
|
-
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
7
|
-
import * as i3 from '@ng-bootstrap/ng-bootstrap';
|
|
8
|
-
import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
|
|
9
|
-
import { trigger, transition, query, style, animate } from '@angular/animations';
|
|
10
|
-
import { Subscription } from 'rxjs';
|
|
11
|
-
import * as i1$1 from '@lenne.tech/ng-base/shared';
|
|
12
|
-
import { ToastType, Sort, SortOrderEnum, GraphQLRequestType, BasicUser, fullEmail, securePasswordValidator, Validation } from '@lenne.tech/ng-base/shared';
|
|
13
|
-
import * as i2$1 from '@angular/router';
|
|
14
|
-
import { RouterModule } from '@angular/router';
|
|
15
|
-
import { __awaiter } from 'tslib';
|
|
16
|
-
import * as i1$2 from '@angular/common/http';
|
|
17
|
-
import * as i4 from 'ngx-image-cropper';
|
|
18
|
-
import { ImageCropperModule } from 'ngx-image-cropper';
|
|
19
|
-
|
|
20
|
-
class InputComponent {
|
|
21
|
-
constructor() {
|
|
22
|
-
this.placeholder = '';
|
|
23
|
-
this.type = 'text';
|
|
24
|
-
this.required = false;
|
|
25
|
-
this.eyeButton = false;
|
|
26
|
-
this.objectPath = '';
|
|
27
|
-
this.enter = new EventEmitter();
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* If the control has a value, emit the enter event
|
|
31
|
-
*/
|
|
32
|
-
enterEvent() {
|
|
33
|
-
var _a;
|
|
34
|
-
if ((_a = this.control) === null || _a === void 0 ? void 0 : _a.value) {
|
|
35
|
-
this.enter.emit();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Switch input type
|
|
40
|
-
*/
|
|
41
|
-
togglePasswordType() {
|
|
42
|
-
if (this.type === 'password') {
|
|
43
|
-
this.type = 'text';
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
this.type = 'password';
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
InputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: InputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
51
|
-
InputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: InputComponent, selector: "base-input", inputs: { id: "id", name: "name", infoText: "infoText", label: "label", placeholder: "placeholder", autocomplete: "autocomplete", tabIndex: "tabIndex", control: "control", type: "type", required: "required", eyeButton: "eyeButton", objectPath: "objectPath" }, outputs: { enter: "enter" }, ngImport: i0, template: "<div class=\"form-group mb-3\">\n <div class=\"d-flex justify-content-between align-items-center\">\n <label [for]=\"id\" class=\"form-label\" [ngClass]=\"{ required: required }\" *ngIf=\"label\">{{ label }}</label>\n <i class=\"bi bi-info-circle\" [ngbTooltip]=\"infoText\" placement=\"start\" *ngIf=\"infoText\"></i>\n </div>\n <div class=\"input-group\">\n <input\n [id]=\"objectPath ? objectPath + '.' + id : id\"\n [name]=\"name\"\n class=\"form-control\"\n [type]=\"type\"\n [formControl]=\"control\"\n [required]=\"required\"\n [placeholder]=\"placeholder\"\n [autocomplete]=\"autocomplete ?? null\"\n [tabIndex]=\"tabIndex ?? null\"\n [ngClass]=\"{ 'is-invalid': control?.invalid && control?.touched }\"\n (keyup.enter)=\"enterEvent()\"\n [attr.aria-describedby]=\"id + 'eye-button'\"\n />\n <button\n class=\"btn btn-outline-primary\"\n type=\"button\"\n [id]=\"id + 'eye-button'\"\n (click)=\"togglePasswordType()\"\n *ngIf=\"eyeButton\"\n >\n <i class=\"bi bi-eye\" *ngIf=\"type === 'password'\"></i>\n <i class=\"bi bi-eye-slash\" *ngIf=\"type === 'text'\"></i>\n </button>\n\n <div class=\"invalid-feedback m-2\" *ngIf=\"control?.invalid && (control?.dirty || control?.touched)\">\n <div *ngIf=\"control?.errors?.['required']\">Dieses Feld ist ein Pflichtfeld.</div>\n <div *ngIf=\"control?.errors?.['minlength']\">\n Die Mindestl\u00E4nge f\u00FCr dieses Feld betr\u00E4gt\n {{control.errors?.['minlength']?.requiredLength}} Zeichen.\n </div>\n <div *ngIf=\"control?.errors?.['maxlength']\">\n Die maximale L\u00E4nge f\u00FCr dieses Feld betr\u00E4gt\n {{control.errors?.['maxlength']?.requiredLength}} Zeichen.\n </div>\n <div *ngIf=\"control?.errors?.['email']\">Bitte eine g\u00FCltige E-Mail Adresse angeben.</div>\n <div *ngIf=\"control?.errors?.['pattern'] && type === 'tel'\">Bitte eine g\u00FCltige Telefonnummer angeben.</div>\n <div *ngIf=\"control?.errors?.['invalidEmail']\">Bitte eine g\u00FCltige E-Mail Adresse angeben.</div>\n <div *ngIf=\"control?.errors?.['matching']\">Die Passw\u00F6rter m\u00FCssen \u00FCberein stimmen.</div>\n <div *ngIf=\"control?.errors?.['invalidSecurePassword']\">\n Das Passwort ist zu unsicher. Es muss mind. 8 Zeichen lang sein, ein Gro\u00DFbustabe, ein Kleinbuchstabe, eine Zahl\n und ein Sonderzeichen enthalten.\n </div>\n </div>\n </div>\n</div>\n", styles: [".required:after{content:\" *\"}.input-group>.btn{min-width:100px}button{height:100%}\n"], dependencies: [{ kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgbTooltip, selector: "[ngbTooltip]", inputs: ["animation", "autoClose", "placement", "popperOptions", "triggers", "positionTarget", "container", "disableTooltip", "tooltipClass", "openDelay", "closeDelay", "ngbTooltip"], outputs: ["shown", "hidden"], exportAs: ["ngbTooltip"] }] });
|
|
52
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: InputComponent, decorators: [{
|
|
53
|
-
type: Component,
|
|
54
|
-
args: [{ selector: 'base-input', template: "<div class=\"form-group mb-3\">\n <div class=\"d-flex justify-content-between align-items-center\">\n <label [for]=\"id\" class=\"form-label\" [ngClass]=\"{ required: required }\" *ngIf=\"label\">{{ label }}</label>\n <i class=\"bi bi-info-circle\" [ngbTooltip]=\"infoText\" placement=\"start\" *ngIf=\"infoText\"></i>\n </div>\n <div class=\"input-group\">\n <input\n [id]=\"objectPath ? objectPath + '.' + id : id\"\n [name]=\"name\"\n class=\"form-control\"\n [type]=\"type\"\n [formControl]=\"control\"\n [required]=\"required\"\n [placeholder]=\"placeholder\"\n [autocomplete]=\"autocomplete ?? null\"\n [tabIndex]=\"tabIndex ?? null\"\n [ngClass]=\"{ 'is-invalid': control?.invalid && control?.touched }\"\n (keyup.enter)=\"enterEvent()\"\n [attr.aria-describedby]=\"id + 'eye-button'\"\n />\n <button\n class=\"btn btn-outline-primary\"\n type=\"button\"\n [id]=\"id + 'eye-button'\"\n (click)=\"togglePasswordType()\"\n *ngIf=\"eyeButton\"\n >\n <i class=\"bi bi-eye\" *ngIf=\"type === 'password'\"></i>\n <i class=\"bi bi-eye-slash\" *ngIf=\"type === 'text'\"></i>\n </button>\n\n <div class=\"invalid-feedback m-2\" *ngIf=\"control?.invalid && (control?.dirty || control?.touched)\">\n <div *ngIf=\"control?.errors?.['required']\">Dieses Feld ist ein Pflichtfeld.</div>\n <div *ngIf=\"control?.errors?.['minlength']\">\n Die Mindestl\u00E4nge f\u00FCr dieses Feld betr\u00E4gt\n {{control.errors?.['minlength']?.requiredLength}} Zeichen.\n </div>\n <div *ngIf=\"control?.errors?.['maxlength']\">\n Die maximale L\u00E4nge f\u00FCr dieses Feld betr\u00E4gt\n {{control.errors?.['maxlength']?.requiredLength}} Zeichen.\n </div>\n <div *ngIf=\"control?.errors?.['email']\">Bitte eine g\u00FCltige E-Mail Adresse angeben.</div>\n <div *ngIf=\"control?.errors?.['pattern'] && type === 'tel'\">Bitte eine g\u00FCltige Telefonnummer angeben.</div>\n <div *ngIf=\"control?.errors?.['invalidEmail']\">Bitte eine g\u00FCltige E-Mail Adresse angeben.</div>\n <div *ngIf=\"control?.errors?.['matching']\">Die Passw\u00F6rter m\u00FCssen \u00FCberein stimmen.</div>\n <div *ngIf=\"control?.errors?.['invalidSecurePassword']\">\n Das Passwort ist zu unsicher. Es muss mind. 8 Zeichen lang sein, ein Gro\u00DFbustabe, ein Kleinbuchstabe, eine Zahl\n und ein Sonderzeichen enthalten.\n </div>\n </div>\n </div>\n</div>\n", styles: [".required:after{content:\" *\"}.input-group>.btn{min-width:100px}button{height:100%}\n"] }]
|
|
55
|
-
}], propDecorators: { id: [{
|
|
56
|
-
type: Input
|
|
57
|
-
}], name: [{
|
|
58
|
-
type: Input
|
|
59
|
-
}], infoText: [{
|
|
60
|
-
type: Input
|
|
61
|
-
}], label: [{
|
|
62
|
-
type: Input
|
|
63
|
-
}], placeholder: [{
|
|
64
|
-
type: Input
|
|
65
|
-
}], autocomplete: [{
|
|
66
|
-
type: Input
|
|
67
|
-
}], tabIndex: [{
|
|
68
|
-
type: Input
|
|
69
|
-
}], control: [{
|
|
70
|
-
type: Input
|
|
71
|
-
}], type: [{
|
|
72
|
-
type: Input
|
|
73
|
-
}], required: [{
|
|
74
|
-
type: Input
|
|
75
|
-
}], eyeButton: [{
|
|
76
|
-
type: Input
|
|
77
|
-
}], objectPath: [{
|
|
78
|
-
type: Input
|
|
79
|
-
}], enter: [{
|
|
80
|
-
type: Output
|
|
81
|
-
}] } });
|
|
82
|
-
|
|
83
|
-
class SelectComponent {
|
|
84
|
-
constructor() {
|
|
85
|
-
this.placeholder = '';
|
|
86
|
-
this.objectPath = '';
|
|
87
|
-
this.required = false;
|
|
88
|
-
this.multiple = false;
|
|
89
|
-
this.search = false;
|
|
90
|
-
this.options = [];
|
|
91
|
-
}
|
|
92
|
-
ngOnInit() {
|
|
93
|
-
if (this.multiple) {
|
|
94
|
-
this.select.nativeElement.setAttribute('multiple', true);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
SelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
99
|
-
SelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: SelectComponent, selector: "base-select", inputs: { id: "id", name: "name", infoText: "infoText", label: "label", placeholder: "placeholder", objectPath: "objectPath", control: "control", tabIndex: "tabIndex", required: "required", multiple: "multiple", search: "search", options: "options" }, viewQueries: [{ propertyName: "select", first: true, predicate: ["select"], descendants: true }], ngImport: i0, template: "<div class=\"form-group mb-3\">\n <div class=\"d-flex justify-content-between align-items-center\">\n <label [for]=\"id\" class=\"form-label\" [ngClass]=\"{ required: required }\" *ngIf=\"label\">{{ label }}</label>\n <i class=\"bi bi-info-circle\" [ngbTooltip]=\"infoText\" placement=\"start\" *ngIf=\"infoText\"></i>\n </div>\n <select\n #select\n [id]=\"objectPath ? objectPath + '.' + id : id\"\n [name]=\"name\"\n class=\"form-select\"\n [attr.aria-label]=\"placeholder\"\n [attr.data-live-search]=\"search\"\n [formControl]=\"control\"\n [required]=\"required\"\n [tabIndex]=\"tabIndex ?? null\"\n [ngClass]=\"{ 'is-invalid': control?.invalid && control?.touched }\"\n >\n <option [ngValue]=\"null\" disabled selected>{{ placeholder }}</option>\n <option *ngFor=\"let option of options\" [ngValue]=\"option.value\">\n {{ option.text }}\n </option>\n </select>\n\n <div class=\"invalid-feedback m-2\" *ngIf=\"control?.invalid && (control?.dirty || control?.touched)\">\n <div *ngIf=\"control?.errors?.['required']\">Dieses Feld ist ein Pflichtfeld.</div>\n <div *ngIf=\"control?.errors?.['minlength']\">\n Die Mindestl\u00E4nge f\u00FCr dieses Feld betr\u00E4gt\n {{control?.errors?.['minlength']?.requiredLength}} Zeichen.\n </div>\n <div *ngIf=\"control?.errors?.['maxlength']\">\n Die maximale L\u00E4nge f\u00FCr dieses Feld betr\u00E4gt\n {{control?.errors?.['maxlength']?.requiredLength}} Zeichen.\n </div>\n <div *ngIf=\"control?.errors?.['email']\">Bitte eine g\u00FCltige E-Mail Adresse angeben.</div>\n </div>\n</div>\n", styles: [".required:after{content:\" *\"}\n"], dependencies: [{ kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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: i3.NgbTooltip, selector: "[ngbTooltip]", inputs: ["animation", "autoClose", "placement", "popperOptions", "triggers", "positionTarget", "container", "disableTooltip", "tooltipClass", "openDelay", "closeDelay", "ngbTooltip"], outputs: ["shown", "hidden"], exportAs: ["ngbTooltip"] }] });
|
|
100
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SelectComponent, decorators: [{
|
|
101
|
-
type: Component,
|
|
102
|
-
args: [{ selector: 'base-select', template: "<div class=\"form-group mb-3\">\n <div class=\"d-flex justify-content-between align-items-center\">\n <label [for]=\"id\" class=\"form-label\" [ngClass]=\"{ required: required }\" *ngIf=\"label\">{{ label }}</label>\n <i class=\"bi bi-info-circle\" [ngbTooltip]=\"infoText\" placement=\"start\" *ngIf=\"infoText\"></i>\n </div>\n <select\n #select\n [id]=\"objectPath ? objectPath + '.' + id : id\"\n [name]=\"name\"\n class=\"form-select\"\n [attr.aria-label]=\"placeholder\"\n [attr.data-live-search]=\"search\"\n [formControl]=\"control\"\n [required]=\"required\"\n [tabIndex]=\"tabIndex ?? null\"\n [ngClass]=\"{ 'is-invalid': control?.invalid && control?.touched }\"\n >\n <option [ngValue]=\"null\" disabled selected>{{ placeholder }}</option>\n <option *ngFor=\"let option of options\" [ngValue]=\"option.value\">\n {{ option.text }}\n </option>\n </select>\n\n <div class=\"invalid-feedback m-2\" *ngIf=\"control?.invalid && (control?.dirty || control?.touched)\">\n <div *ngIf=\"control?.errors?.['required']\">Dieses Feld ist ein Pflichtfeld.</div>\n <div *ngIf=\"control?.errors?.['minlength']\">\n Die Mindestl\u00E4nge f\u00FCr dieses Feld betr\u00E4gt\n {{control?.errors?.['minlength']?.requiredLength}} Zeichen.\n </div>\n <div *ngIf=\"control?.errors?.['maxlength']\">\n Die maximale L\u00E4nge f\u00FCr dieses Feld betr\u00E4gt\n {{control?.errors?.['maxlength']?.requiredLength}} Zeichen.\n </div>\n <div *ngIf=\"control?.errors?.['email']\">Bitte eine g\u00FCltige E-Mail Adresse angeben.</div>\n </div>\n</div>\n", styles: [".required:after{content:\" *\"}\n"] }]
|
|
103
|
-
}], propDecorators: { select: [{
|
|
104
|
-
type: ViewChild,
|
|
105
|
-
args: ['select']
|
|
106
|
-
}], id: [{
|
|
107
|
-
type: Input
|
|
108
|
-
}], name: [{
|
|
109
|
-
type: Input
|
|
110
|
-
}], infoText: [{
|
|
111
|
-
type: Input
|
|
112
|
-
}], label: [{
|
|
113
|
-
type: Input
|
|
114
|
-
}], placeholder: [{
|
|
115
|
-
type: Input
|
|
116
|
-
}], objectPath: [{
|
|
117
|
-
type: Input
|
|
118
|
-
}], control: [{
|
|
119
|
-
type: Input
|
|
120
|
-
}], tabIndex: [{
|
|
121
|
-
type: Input
|
|
122
|
-
}], required: [{
|
|
123
|
-
type: Input
|
|
124
|
-
}], multiple: [{
|
|
125
|
-
type: Input
|
|
126
|
-
}], search: [{
|
|
127
|
-
type: Input
|
|
128
|
-
}], options: [{
|
|
129
|
-
type: Input
|
|
130
|
-
}] } });
|
|
131
|
-
|
|
132
|
-
class CheckboxComponent {
|
|
133
|
-
constructor() {
|
|
134
|
-
this.required = false;
|
|
135
|
-
this.objectPath = '';
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
CheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
139
|
-
CheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CheckboxComponent, selector: "base-checkbox", inputs: { id: "id", name: "name", label: "label", value: "value", control: "control", required: "required", objectPath: "objectPath" }, ngImport: i0, template: "<div class=\"form-check\">\n <input\n class=\"form-check-input\"\n type=\"checkbox\"\n [formControl]=\"control\"\n [required]=\"required\"\n [value]=\"value\"\n [id]=\"objectPath ? objectPath + '.' + id : id\"\n [name]=\"name\"\n [ngClass]=\"{ 'is-invalid': control?.invalid && control?.touched }\"\n />\n <label [for]=\"id\" class=\"form-label\" [ngClass]=\"{ required: required }\">\n <ng-container *ngIf=\"label\">\n {{ label }}\n </ng-container>\n <ng-content></ng-content>\n </label>\n\n <div class=\"invalid-feedback ms-0 m-2\" *ngIf=\"control?.invalid && (control?.dirty || control?.touched)\">\n <div *ngIf=\"control?.errors?.['required']\">Dieses Feld ist ein Pflichtfeld.</div>\n </div>\n</div>\n", styles: [".required:after{content:\" *\"}\n"], dependencies: [{ kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.CheckboxRequiredValidator, selector: "input[type=checkbox][required][formControlName],input[type=checkbox][required][formControl],input[type=checkbox][required][ngModel]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
140
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
141
|
-
type: Component,
|
|
142
|
-
args: [{ selector: 'base-checkbox', template: "<div class=\"form-check\">\n <input\n class=\"form-check-input\"\n type=\"checkbox\"\n [formControl]=\"control\"\n [required]=\"required\"\n [value]=\"value\"\n [id]=\"objectPath ? objectPath + '.' + id : id\"\n [name]=\"name\"\n [ngClass]=\"{ 'is-invalid': control?.invalid && control?.touched }\"\n />\n <label [for]=\"id\" class=\"form-label\" [ngClass]=\"{ required: required }\">\n <ng-container *ngIf=\"label\">\n {{ label }}\n </ng-container>\n <ng-content></ng-content>\n </label>\n\n <div class=\"invalid-feedback ms-0 m-2\" *ngIf=\"control?.invalid && (control?.dirty || control?.touched)\">\n <div *ngIf=\"control?.errors?.['required']\">Dieses Feld ist ein Pflichtfeld.</div>\n </div>\n</div>\n", styles: [".required:after{content:\" *\"}\n"] }]
|
|
143
|
-
}], propDecorators: { id: [{
|
|
144
|
-
type: Input
|
|
145
|
-
}], name: [{
|
|
146
|
-
type: Input
|
|
147
|
-
}], label: [{
|
|
148
|
-
type: Input
|
|
149
|
-
}], value: [{
|
|
150
|
-
type: Input
|
|
151
|
-
}], control: [{
|
|
152
|
-
type: Input
|
|
153
|
-
}], required: [{
|
|
154
|
-
type: Input
|
|
155
|
-
}], objectPath: [{
|
|
156
|
-
type: Input
|
|
157
|
-
}] } });
|
|
158
|
-
|
|
159
|
-
class TextareaComponent {
|
|
160
|
-
constructor() {
|
|
161
|
-
this.label = '';
|
|
162
|
-
this.placeholder = '';
|
|
163
|
-
this.rows = 5;
|
|
164
|
-
this.required = false;
|
|
165
|
-
this.autoHeight = true;
|
|
166
|
-
this.objectPath = '';
|
|
167
|
-
}
|
|
168
|
-
ngOnChanges(changes) {
|
|
169
|
-
if (changes['control'] && this.autoHeight) {
|
|
170
|
-
setTimeout(() => {
|
|
171
|
-
this.adjustInitHeight();
|
|
172
|
-
}, 350);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
adjustInitHeight() {
|
|
176
|
-
if (!this.textarea || !this.autoHeight) {
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
this.textarea.nativeElement.style.cssText = 'height:auto;';
|
|
180
|
-
this.textarea.nativeElement.style.cssText = 'height:' + (this.textarea.nativeElement.scrollHeight + 5) + 'px';
|
|
181
|
-
}
|
|
182
|
-
adjustHeight(event) {
|
|
183
|
-
if (!this.autoHeight) {
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
setTimeout(() => {
|
|
187
|
-
event.target.style.cssText = 'height:auto;';
|
|
188
|
-
// for box-sizing other than "content-box" use:
|
|
189
|
-
// el.style.cssText = '-moz-box-sizing:content-box';
|
|
190
|
-
event.target.style.cssText = 'height:' + (event.target.scrollHeight + 5) + 'px';
|
|
191
|
-
}, 0);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
TextareaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TextareaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
195
|
-
TextareaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: TextareaComponent, selector: "base-textarea", inputs: { id: "id", name: "name", infoText: "infoText", label: "label", placeholder: "placeholder", control: "control", rows: "rows", required: "required", autoHeight: "autoHeight", tabIndex: "tabIndex", objectPath: "objectPath" }, viewQueries: [{ propertyName: "textarea", first: true, predicate: ["textarea"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"form-group mb-3\">\n <div class=\"d-flex justify-content-between align-items-center\">\n <label [for]=\"id\" class=\"form-label\" [ngClass]=\"{ required: required }\" *ngIf=\"label\">{{ label }}</label>\n <i class=\"bi bi-info-circle\" [ngbTooltip]=\"infoText\" placement=\"start\" *ngIf=\"infoText\"></i>\n </div>\n\n <textarea\n #textarea\n class=\"form-control\"\n [id]=\"objectPath ? objectPath + '.' + id : id\"\n [name]=\"name\"\n [rows]=\"rows\"\n (input)=\"adjustHeight($event)\"\n [placeholder]=\"placeholder\"\n [formControl]=\"control\"\n [tabIndex]=\"tabIndex ?? null\"\n [ngClass]=\"{ 'is-invalid': control?.invalid && control?.touched }\"\n ></textarea>\n\n <div class=\"invalid-feedback m-2\" *ngIf=\"control?.invalid && (control?.dirty || control?.touched)\">\n <div *ngIf=\"control?.errors?.['required']\">Dieses Feld ist ein Pflichtfeld.</div>\n <div *ngIf=\"control?.errors?.['minlength']\">\n Die Mindestl\u00E4nge f\u00FCr dieses Feld betr\u00E4gt\n {{control?.errors?.['minlength']?.requiredLength}} Zeichen.\n </div>\n <div *ngIf=\"control?.errors?.['maxlength']\">\n Die maximale L\u00E4nge f\u00FCr dieses Feld betr\u00E4gt\n {{control?.errors?.['maxlength']?.requiredLength}} Zeichen.\n </div>\n </div>\n</div>\n", styles: [".required:after{content:\" *\"}\n"], dependencies: [{ kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgbTooltip, selector: "[ngbTooltip]", inputs: ["animation", "autoClose", "placement", "popperOptions", "triggers", "positionTarget", "container", "disableTooltip", "tooltipClass", "openDelay", "closeDelay", "ngbTooltip"], outputs: ["shown", "hidden"], exportAs: ["ngbTooltip"] }] });
|
|
196
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TextareaComponent, decorators: [{
|
|
197
|
-
type: Component,
|
|
198
|
-
args: [{ selector: 'base-textarea', template: "<div class=\"form-group mb-3\">\n <div class=\"d-flex justify-content-between align-items-center\">\n <label [for]=\"id\" class=\"form-label\" [ngClass]=\"{ required: required }\" *ngIf=\"label\">{{ label }}</label>\n <i class=\"bi bi-info-circle\" [ngbTooltip]=\"infoText\" placement=\"start\" *ngIf=\"infoText\"></i>\n </div>\n\n <textarea\n #textarea\n class=\"form-control\"\n [id]=\"objectPath ? objectPath + '.' + id : id\"\n [name]=\"name\"\n [rows]=\"rows\"\n (input)=\"adjustHeight($event)\"\n [placeholder]=\"placeholder\"\n [formControl]=\"control\"\n [tabIndex]=\"tabIndex ?? null\"\n [ngClass]=\"{ 'is-invalid': control?.invalid && control?.touched }\"\n ></textarea>\n\n <div class=\"invalid-feedback m-2\" *ngIf=\"control?.invalid && (control?.dirty || control?.touched)\">\n <div *ngIf=\"control?.errors?.['required']\">Dieses Feld ist ein Pflichtfeld.</div>\n <div *ngIf=\"control?.errors?.['minlength']\">\n Die Mindestl\u00E4nge f\u00FCr dieses Feld betr\u00E4gt\n {{control?.errors?.['minlength']?.requiredLength}} Zeichen.\n </div>\n <div *ngIf=\"control?.errors?.['maxlength']\">\n Die maximale L\u00E4nge f\u00FCr dieses Feld betr\u00E4gt\n {{control?.errors?.['maxlength']?.requiredLength}} Zeichen.\n </div>\n </div>\n</div>\n", styles: [".required:after{content:\" *\"}\n"] }]
|
|
199
|
-
}], propDecorators: { textarea: [{
|
|
200
|
-
type: ViewChild,
|
|
201
|
-
args: ['textarea']
|
|
202
|
-
}], id: [{
|
|
203
|
-
type: Input
|
|
204
|
-
}], name: [{
|
|
205
|
-
type: Input
|
|
206
|
-
}], infoText: [{
|
|
207
|
-
type: Input
|
|
208
|
-
}], label: [{
|
|
209
|
-
type: Input
|
|
210
|
-
}], placeholder: [{
|
|
211
|
-
type: Input
|
|
212
|
-
}], control: [{
|
|
213
|
-
type: Input
|
|
214
|
-
}], rows: [{
|
|
215
|
-
type: Input
|
|
216
|
-
}], required: [{
|
|
217
|
-
type: Input
|
|
218
|
-
}], autoHeight: [{
|
|
219
|
-
type: Input
|
|
220
|
-
}], tabIndex: [{
|
|
221
|
-
type: Input
|
|
222
|
-
}], objectPath: [{
|
|
223
|
-
type: Input
|
|
224
|
-
}] } });
|
|
225
|
-
|
|
226
|
-
const toastAnimation = trigger('toastAnimation', [
|
|
227
|
-
transition('* <=> *', [
|
|
228
|
-
query(':enter', [style({ transform: 'translateX({{ x }})' }), animate('200ms ease-in', style({ transform: 'translateX(0%)' }))], { optional: true }),
|
|
229
|
-
query(':leave', animate('200ms ease-in', style({ transform: 'translateX({{ x }})' })), { optional: true }),
|
|
230
|
-
]),
|
|
231
|
-
]);
|
|
232
|
-
class ToastComponent {
|
|
233
|
-
constructor(toastService) {
|
|
234
|
-
this.toastService = toastService;
|
|
235
|
-
this.toasts = [];
|
|
236
|
-
this.ToastType = ToastType;
|
|
237
|
-
this.subscriptions = new Subscription();
|
|
238
|
-
this.position = 'bottom-right';
|
|
239
|
-
}
|
|
240
|
-
ngOnInit() {
|
|
241
|
-
this.subscriptions.add(this.toastService.toastsAsObservable.subscribe({
|
|
242
|
-
next: (value) => {
|
|
243
|
-
this.toasts = value;
|
|
244
|
-
},
|
|
245
|
-
}));
|
|
246
|
-
}
|
|
247
|
-
ngOnDestroy() {
|
|
248
|
-
this.subscriptions.unsubscribe();
|
|
249
|
-
}
|
|
250
|
-
getDefaultTitle(toast) {
|
|
251
|
-
switch (toast.type) {
|
|
252
|
-
case ToastType.ERROR:
|
|
253
|
-
return 'Irgendetwas ist schiefgelaufen';
|
|
254
|
-
case ToastType.INFO:
|
|
255
|
-
return 'Info';
|
|
256
|
-
case ToastType.WARNING:
|
|
257
|
-
return 'Achtung';
|
|
258
|
-
case ToastType.SUCCESS:
|
|
259
|
-
return 'Erfolgreich';
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
getDefaultDescription(toast) {
|
|
263
|
-
switch (toast.type) {
|
|
264
|
-
case ToastType.ERROR:
|
|
265
|
-
return 'Sollte das Problem länger bestehen bleiben, dann wenden Sie sich bitte\n' + ' an den Support.';
|
|
266
|
-
case ToastType.INFO:
|
|
267
|
-
return 'Info';
|
|
268
|
-
case ToastType.WARNING:
|
|
269
|
-
return 'Warning';
|
|
270
|
-
case ToastType.SUCCESS:
|
|
271
|
-
return 'Die Änderungen wurden erfolgreich gespeichert.';
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
reload() {
|
|
275
|
-
location.reload();
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
ToastComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ToastComponent, deps: [{ token: i1$1.ToastService }], target: i0.ɵɵFactoryTarget.Component });
|
|
279
|
-
ToastComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ToastComponent, selector: "base-toast", inputs: { position: "position" }, ngImport: i0, template: "<div\n class=\"toast-container position-fixed\"\n [ngClass]=\"position\"\n [@toastAnimation]=\"{ value: toasts.length, params: { x: position.includes('left') ? '-100%' : '100%' } }\"\n>\n <div\n class=\"toast show\"\n role=\"alert\"\n aria-live=\"assertive\"\n aria-atomic=\"true\"\n *ngFor=\"let toast of toasts\"\n [ngClass]=\"toast.type\"\n >\n <div class=\"toast-header\">\n <strong class=\"me-auto\">{{ toast?.title ?? getDefaultTitle(toast) }}</strong>\n <button type=\"button\" class=\"btn-close btn-close-white\" data-bs-dismiss=\"toast\" aria-label=\"Close\"></button>\n </div>\n <div class=\"toast-body\">\n {{ toast?.description ?? getDefaultDescription(toast) }}\n\n <div class=\"mt-2\" *ngIf=\"toast?.errorCode\">\n <code>ERROR: {{ toast.errorCode }}</code>\n </div>\n\n <div class=\"mt-2\" *ngIf=\"toast.type === ToastType.ERROR\">\n <a class=\"color-secondary\" href=\"#\" (click)=\"reload()\">Seite neu laden</a>\n </div>\n </div>\n </div>\n</div>\n", styles: [":host{--base-toast-z-index: 999}.toast-container{padding:10px;z-index:var(--base-toast-z-index)}.bottom-right{bottom:0;right:0}.top-right{top:0;right:0}.bottom-left{bottom:0;left:0}.top-left{top:0;left:0}.toast{border-radius:0;border:0}.toast a{text-decoration:none;font-weight:600}.toast .toast-header{border-radius:0}.error .toast-header{background-color:var(--bs-danger);color:var(--bs-white)}.warning .toast-header{background-color:var(--bs-warning);color:var(--bs-white)}.info .toast-header{background-color:var(--bs-info);color:var(--bs-white)}.success .toast-header{background-color:var(--bs-success);color:var(--bs-white)}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], animations: [toastAnimation] });
|
|
280
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ToastComponent, decorators: [{
|
|
281
|
-
type: Component,
|
|
282
|
-
args: [{ selector: 'base-toast', animations: [toastAnimation], template: "<div\n class=\"toast-container position-fixed\"\n [ngClass]=\"position\"\n [@toastAnimation]=\"{ value: toasts.length, params: { x: position.includes('left') ? '-100%' : '100%' } }\"\n>\n <div\n class=\"toast show\"\n role=\"alert\"\n aria-live=\"assertive\"\n aria-atomic=\"true\"\n *ngFor=\"let toast of toasts\"\n [ngClass]=\"toast.type\"\n >\n <div class=\"toast-header\">\n <strong class=\"me-auto\">{{ toast?.title ?? getDefaultTitle(toast) }}</strong>\n <button type=\"button\" class=\"btn-close btn-close-white\" data-bs-dismiss=\"toast\" aria-label=\"Close\"></button>\n </div>\n <div class=\"toast-body\">\n {{ toast?.description ?? getDefaultDescription(toast) }}\n\n <div class=\"mt-2\" *ngIf=\"toast?.errorCode\">\n <code>ERROR: {{ toast.errorCode }}</code>\n </div>\n\n <div class=\"mt-2\" *ngIf=\"toast.type === ToastType.ERROR\">\n <a class=\"color-secondary\" href=\"#\" (click)=\"reload()\">Seite neu laden</a>\n </div>\n </div>\n </div>\n</div>\n", styles: [":host{--base-toast-z-index: 999}.toast-container{padding:10px;z-index:var(--base-toast-z-index)}.bottom-right{bottom:0;right:0}.top-right{top:0;right:0}.bottom-left{bottom:0;left:0}.top-left{top:0;left:0}.toast{border-radius:0;border:0}.toast a{text-decoration:none;font-weight:600}.toast .toast-header{border-radius:0}.error .toast-header{background-color:var(--bs-danger);color:var(--bs-white)}.warning .toast-header{background-color:var(--bs-warning);color:var(--bs-white)}.info .toast-header{background-color:var(--bs-info);color:var(--bs-white)}.success .toast-header{background-color:var(--bs-success);color:var(--bs-white)}\n"] }]
|
|
283
|
-
}], ctorParameters: function () { return [{ type: i1$1.ToastService }]; }, propDecorators: { position: [{
|
|
284
|
-
type: Input
|
|
285
|
-
}] } });
|
|
286
|
-
|
|
287
|
-
class TagsComponent {
|
|
288
|
-
constructor() {
|
|
289
|
-
this.label = '';
|
|
290
|
-
this.placeholder = '';
|
|
291
|
-
this.custom = true;
|
|
292
|
-
this.removeByKey = true;
|
|
293
|
-
this.required = false;
|
|
294
|
-
this.objectPath = '';
|
|
295
|
-
this.validators = [];
|
|
296
|
-
this.inputValue = '';
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Convert id into text field
|
|
300
|
-
*/
|
|
301
|
-
getReadableTag(tag) {
|
|
302
|
-
var _a;
|
|
303
|
-
if (((_a = this.control) === null || _a === void 0 ? void 0 : _a.value) && this.options) {
|
|
304
|
-
const foundElement = this.options.find((e) => e.value === tag);
|
|
305
|
-
if (foundElement) {
|
|
306
|
-
return foundElement.text;
|
|
307
|
-
}
|
|
308
|
-
else {
|
|
309
|
-
return tag;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
else {
|
|
313
|
-
return tag;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Listen to enter keys
|
|
318
|
-
*
|
|
319
|
-
* @param event
|
|
320
|
-
*/
|
|
321
|
-
enterKey(event) {
|
|
322
|
-
this.selectedElement = event.target;
|
|
323
|
-
if (this.removeByKey && event.code === 'Backspace' && !this.inputValue) {
|
|
324
|
-
this.removeTag();
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
else {
|
|
328
|
-
if (event.code === 'Comma' || event.code === 'Space' || event.code === 'Enter') {
|
|
329
|
-
this.addTag(this.inputValue);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* Add new tag
|
|
335
|
-
*
|
|
336
|
-
* @param tag
|
|
337
|
-
* @param reset
|
|
338
|
-
* @param isOption
|
|
339
|
-
*/
|
|
340
|
-
addTag(tag, reset = true, isOption = false) {
|
|
341
|
-
var _a;
|
|
342
|
-
if (tag.endsWith(',') || tag.endsWith(' ')) {
|
|
343
|
-
tag = tag.slice(0, -1);
|
|
344
|
-
}
|
|
345
|
-
const temp = new FormControl(tag, this.validators);
|
|
346
|
-
this.control.setErrors(Object.assign(Object.assign({}, this.control.errors), temp.errors));
|
|
347
|
-
if (temp.invalid) {
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
// Check if user copy string into input
|
|
351
|
-
if (tag.split(' ').length > 1 && !isOption) {
|
|
352
|
-
const tags = tag.split(' ');
|
|
353
|
-
for (let i = 0; i < tags.length; i++) {
|
|
354
|
-
this.addTag(tags[i], i + 1 === tags.length);
|
|
355
|
-
}
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
// Check if user copy string into input
|
|
359
|
-
if (tag.split(',').length > 1 && !isOption) {
|
|
360
|
-
const tags = tag.split(',');
|
|
361
|
-
for (let i = 0; i < tags.length; i++) {
|
|
362
|
-
this.addTag(tags[i], i + 1 === tags.length);
|
|
363
|
-
}
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
let foundOption;
|
|
367
|
-
if (!this.options) {
|
|
368
|
-
foundOption = { value: tag, text: tag };
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
foundOption = this.options.find((e) => e.text === tag);
|
|
372
|
-
}
|
|
373
|
-
if (!this.custom && !foundOption) {
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
this.selectedElement = null;
|
|
377
|
-
if (!this.control.value) {
|
|
378
|
-
this.control.setValue([]);
|
|
379
|
-
}
|
|
380
|
-
if (((_a = this.control.value) === null || _a === void 0 ? void 0 : _a.length) === 0) {
|
|
381
|
-
this.control.setValue([foundOption.value]);
|
|
382
|
-
if (reset) {
|
|
383
|
-
this.inputValue = '';
|
|
384
|
-
}
|
|
385
|
-
this.control.setErrors(null);
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
if (tag.length > 0 &&
|
|
389
|
-
this.control.value &&
|
|
390
|
-
!this.control.value.some((item) => item === foundOption.value)) {
|
|
391
|
-
this.control.setValue([...this.control.value, foundOption.value]);
|
|
392
|
-
if (reset) {
|
|
393
|
-
this.inputValue = '';
|
|
394
|
-
}
|
|
395
|
-
this.control.setErrors(null);
|
|
396
|
-
}
|
|
397
|
-
if (this.control.value.some((item) => item === foundOption.value)) {
|
|
398
|
-
if (reset) {
|
|
399
|
-
this.inputValue = '';
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Remove tag
|
|
405
|
-
*
|
|
406
|
-
* @param tag
|
|
407
|
-
*/
|
|
408
|
-
removeTag(tag) {
|
|
409
|
-
var _a, _b;
|
|
410
|
-
let foundOption;
|
|
411
|
-
if (!this.options) {
|
|
412
|
-
foundOption = { value: tag, text: tag };
|
|
413
|
-
}
|
|
414
|
-
else {
|
|
415
|
-
foundOption = this.options.find((e) => e.value === tag);
|
|
416
|
-
}
|
|
417
|
-
this.control.markAsTouched();
|
|
418
|
-
if (foundOption) {
|
|
419
|
-
this.control.setValue((_a = this.control.value) === null || _a === void 0 ? void 0 : _a.filter((item) => item !== foundOption.value));
|
|
420
|
-
}
|
|
421
|
-
else if (this.control.value) {
|
|
422
|
-
this.control.value.splice(-1);
|
|
423
|
-
}
|
|
424
|
-
if (((_b = this.control.value) === null || _b === void 0 ? void 0 : _b.length) === 0) {
|
|
425
|
-
this.control.setErrors(Object.assign(Object.assign({}, this.control.errors), { required: true }));
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Filter options for drop down
|
|
430
|
-
*/
|
|
431
|
-
filterOptions() {
|
|
432
|
-
return this.options
|
|
433
|
-
? this.options.filter((e) => { var _a, _b; return (!this.inputValue || ((_a = e === null || e === void 0 ? void 0 : e.text) === null || _a === void 0 ? void 0 : _a.includes(this.inputValue))) && !((_b = this.control.value) === null || _b === void 0 ? void 0 : _b.includes(e.value)); })
|
|
434
|
-
: [];
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* Show dropdown focus
|
|
438
|
-
*/
|
|
439
|
-
onFocus(event) {
|
|
440
|
-
if (event) {
|
|
441
|
-
this.control.setErrors(null);
|
|
442
|
-
this.selectedElement = event.target;
|
|
443
|
-
}
|
|
444
|
-
else {
|
|
445
|
-
if (this.inputValue) {
|
|
446
|
-
this.addTag(this.inputValue);
|
|
447
|
-
}
|
|
448
|
-
this.control.markAsTouched();
|
|
449
|
-
setTimeout(() => {
|
|
450
|
-
var _a;
|
|
451
|
-
if (this.options && this.inputValue) {
|
|
452
|
-
if (this.options.find((e) => e.text === this.inputValue)) {
|
|
453
|
-
this.addTag(this.inputValue);
|
|
454
|
-
this.control.setErrors(null);
|
|
455
|
-
}
|
|
456
|
-
else {
|
|
457
|
-
this.inputValue = '';
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
if (!this.control.value || ((_a = this.control.value) === null || _a === void 0 ? void 0 : _a.length) === 0) {
|
|
461
|
-
this.control.setErrors(Object.assign(Object.assign({}, this.control.errors), { required: true }));
|
|
462
|
-
}
|
|
463
|
-
this.selectedElement = null;
|
|
464
|
-
}, 250);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
TagsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TagsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
469
|
-
TagsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: TagsComponent, selector: "base-tags", inputs: { id: "id", name: "name", infoText: "infoText", label: "label", placeholder: "placeholder", autocomplete: "autocomplete", tabIndex: "tabIndex", control: "control", options: "options", custom: "custom", removeByKey: "removeByKey", required: "required", objectPath: "objectPath", validators: "validators" }, ngImport: i0, template: "<div class=\"form-group position-relative\" *ngIf=\"control\">\n <div class=\"d-flex justify-content-between align-items-center\">\n <label [for]=\"id\" class=\"form-label\" [ngClass]=\"{ required: required }\" *ngIf=\"label\">{{ label }}</label>\n <i class=\"bi bi-info-circle\" [ngbTooltip]=\"infoText\" placement=\"start\" *ngIf=\"infoText\"></i>\n </div>\n\n <div class=\"tag-wrapper\" *ngIf=\"control?.value\">\n <div class=\"tag\" *ngFor=\"let tag of control?.value\">\n {{ getReadableTag(tag) }}\n <span (click)=\"removeTag(tag)\"><i class=\"bi bi-x-circle\"></i></span>\n </div>\n </div>\n <input [formControl]=\"control\" hidden />\n <input\n [id]=\"objectPath ? objectPath + '.' + id : id\"\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [ngClass]=\"{ 'is-invalid': control?.invalid && control?.touched }\"\n [(ngModel)]=\"inputValue\"\n [autocomplete]=\"autocomplete ?? null\"\n [tabIndex]=\"tabIndex ?? null\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onFocus()\"\n type=\"text\"\n class=\"form-control\"\n (keyup)=\"enterKey($event)\"\n />\n\n <div class=\"tag-options\" *ngIf=\"options && selectedElement\">\n <div class=\"tag-option-item\" *ngFor=\"let option of filterOptions()\" (click)=\"addTag(option?.text, true, true)\">\n {{ option?.text }}\n </div>\n </div>\n\n <div class=\"invalid-feedback m-2\" *ngIf=\"control?.invalid && (control?.dirty || control?.touched)\">\n <div *ngIf=\"control?.errors?.['required']\">Dieses Feld ist ein Pflichtfeld.</div>\n <div *ngIf=\"control?.errors?.['invalidReference'] && inputValue\">\n {{ inputValue }} ist kein g\u00FCltiger Wert f\u00FCr {{ label }}.\n </div>\n <div *ngIf=\"control?.errors?.['email']\">Bitte gib eine g\u00FCltige E-Mail Adresse ein.</div>\n </div>\n</div>\n", styles: [".required:after{content:\" *\"}.tag-options{position:absolute;display:block;top:100%;left:0;right:0;border-top:0;background-color:#fff;box-shadow:0 2px 5px #00000029,0 2px 10px #0000001f;transition:all .5s;z-index:999;max-height:200px;overflow-y:scroll}.tag-options .tag-option-item{padding:10px;cursor:pointer}.tag-options .tag-option-item:hover{color:var(--bs-primary)}.tag-wrapper{display:flex;flex-direction:row;justify-content:flex-start;column-gap:10px;row-gap:10px;flex-wrap:wrap;margin-bottom:10px;position:relative}.tag-wrapper .tag{background-color:var(--bs-light);color:var(--bs-dark);padding:10px 15px;font-style:normal;font-weight:300;font-size:14px;line-height:140%}.tag-wrapper .tag span{margin-left:20px;cursor:pointer}.tag-wrapper .tag span .bi{color:var(--bs-black)}.tag-wrapper .tag span .bi:before{vertical-align:-.175em}\n"], dependencies: [{ kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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: i3.NgbTooltip, selector: "[ngbTooltip]", inputs: ["animation", "autoClose", "placement", "popperOptions", "triggers", "positionTarget", "container", "disableTooltip", "tooltipClass", "openDelay", "closeDelay", "ngbTooltip"], outputs: ["shown", "hidden"], exportAs: ["ngbTooltip"] }] });
|
|
470
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TagsComponent, decorators: [{
|
|
471
|
-
type: Component,
|
|
472
|
-
args: [{ selector: 'base-tags', template: "<div class=\"form-group position-relative\" *ngIf=\"control\">\n <div class=\"d-flex justify-content-between align-items-center\">\n <label [for]=\"id\" class=\"form-label\" [ngClass]=\"{ required: required }\" *ngIf=\"label\">{{ label }}</label>\n <i class=\"bi bi-info-circle\" [ngbTooltip]=\"infoText\" placement=\"start\" *ngIf=\"infoText\"></i>\n </div>\n\n <div class=\"tag-wrapper\" *ngIf=\"control?.value\">\n <div class=\"tag\" *ngFor=\"let tag of control?.value\">\n {{ getReadableTag(tag) }}\n <span (click)=\"removeTag(tag)\"><i class=\"bi bi-x-circle\"></i></span>\n </div>\n </div>\n <input [formControl]=\"control\" hidden />\n <input\n [id]=\"objectPath ? objectPath + '.' + id : id\"\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [ngClass]=\"{ 'is-invalid': control?.invalid && control?.touched }\"\n [(ngModel)]=\"inputValue\"\n [autocomplete]=\"autocomplete ?? null\"\n [tabIndex]=\"tabIndex ?? null\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onFocus()\"\n type=\"text\"\n class=\"form-control\"\n (keyup)=\"enterKey($event)\"\n />\n\n <div class=\"tag-options\" *ngIf=\"options && selectedElement\">\n <div class=\"tag-option-item\" *ngFor=\"let option of filterOptions()\" (click)=\"addTag(option?.text, true, true)\">\n {{ option?.text }}\n </div>\n </div>\n\n <div class=\"invalid-feedback m-2\" *ngIf=\"control?.invalid && (control?.dirty || control?.touched)\">\n <div *ngIf=\"control?.errors?.['required']\">Dieses Feld ist ein Pflichtfeld.</div>\n <div *ngIf=\"control?.errors?.['invalidReference'] && inputValue\">\n {{ inputValue }} ist kein g\u00FCltiger Wert f\u00FCr {{ label }}.\n </div>\n <div *ngIf=\"control?.errors?.['email']\">Bitte gib eine g\u00FCltige E-Mail Adresse ein.</div>\n </div>\n</div>\n", styles: [".required:after{content:\" *\"}.tag-options{position:absolute;display:block;top:100%;left:0;right:0;border-top:0;background-color:#fff;box-shadow:0 2px 5px #00000029,0 2px 10px #0000001f;transition:all .5s;z-index:999;max-height:200px;overflow-y:scroll}.tag-options .tag-option-item{padding:10px;cursor:pointer}.tag-options .tag-option-item:hover{color:var(--bs-primary)}.tag-wrapper{display:flex;flex-direction:row;justify-content:flex-start;column-gap:10px;row-gap:10px;flex-wrap:wrap;margin-bottom:10px;position:relative}.tag-wrapper .tag{background-color:var(--bs-light);color:var(--bs-dark);padding:10px 15px;font-style:normal;font-weight:300;font-size:14px;line-height:140%}.tag-wrapper .tag span{margin-left:20px;cursor:pointer}.tag-wrapper .tag span .bi{color:var(--bs-black)}.tag-wrapper .tag span .bi:before{vertical-align:-.175em}\n"] }]
|
|
473
|
-
}], propDecorators: { id: [{
|
|
474
|
-
type: Input
|
|
475
|
-
}], name: [{
|
|
476
|
-
type: Input
|
|
477
|
-
}], infoText: [{
|
|
478
|
-
type: Input
|
|
479
|
-
}], label: [{
|
|
480
|
-
type: Input
|
|
481
|
-
}], placeholder: [{
|
|
482
|
-
type: Input
|
|
483
|
-
}], autocomplete: [{
|
|
484
|
-
type: Input
|
|
485
|
-
}], tabIndex: [{
|
|
486
|
-
type: Input
|
|
487
|
-
}], control: [{
|
|
488
|
-
type: Input
|
|
489
|
-
}], options: [{
|
|
490
|
-
type: Input
|
|
491
|
-
}], custom: [{
|
|
492
|
-
type: Input
|
|
493
|
-
}], removeByKey: [{
|
|
494
|
-
type: Input
|
|
495
|
-
}], required: [{
|
|
496
|
-
type: Input
|
|
497
|
-
}], objectPath: [{
|
|
498
|
-
type: Input
|
|
499
|
-
}], validators: [{
|
|
500
|
-
type: Input
|
|
501
|
-
}] } });
|
|
502
|
-
|
|
503
|
-
class LoadingBarComponent {
|
|
504
|
-
constructor(ngZone, changeDetectorRef, loaderService) {
|
|
505
|
-
this.ngZone = ngZone;
|
|
506
|
-
this.changeDetectorRef = changeDetectorRef;
|
|
507
|
-
this.loaderService = loaderService;
|
|
508
|
-
this.manuallyLoading = false;
|
|
509
|
-
this.loading = false;
|
|
510
|
-
this.subscription = new Subscription();
|
|
511
|
-
}
|
|
512
|
-
ngOnInit() {
|
|
513
|
-
this.ngZone.runOutsideAngular(() => {
|
|
514
|
-
this.subscription.add(this.loaderService.isLoading.subscribe((value) => {
|
|
515
|
-
this.loading = value;
|
|
516
|
-
this.changeDetectorRef.detectChanges();
|
|
517
|
-
}));
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
ngOnDestroy() {
|
|
521
|
-
this.subscription.unsubscribe();
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
LoadingBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LoadingBarComponent, deps: [{ token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: i1$1.LoaderService }], target: i0.ɵɵFactoryTarget.Component });
|
|
525
|
-
LoadingBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: LoadingBarComponent, selector: "base-loading-bar", inputs: { manuallyLoading: "manuallyLoading" }, ngImport: i0, template: "<div class=\"slider\" *ngIf=\"loading || manuallyLoading\">\n <div class=\"line\"></div>\n <div class=\"subline inc\"></div>\n <div class=\"subline dec\"></div>\n</div>\n", styles: [":host{--base-loading-bar-color: #f28c18;--base-loading-bar-height: 5px;--base-loading-bar-z-index: 999999999}.slider{position:fixed;left:0;right:0;height:var(--base-loading-bar-height);overflow-x:hidden;z-index:var(--base-loading-bar-z-index);background-color:#fff}.line{position:absolute;opacity:.6;background:var(--base-loading-bar-color);width:150%;height:var(--base-loading-bar-height)}.subline{position:absolute;background:var(--base-loading-bar-color);height:var(--base-loading-bar-height)}.inc{animation:increase 2s infinite}.dec{animation:decrease 2s .5s infinite}@keyframes increase{0%{left:-5%;width:5%}to{left:130%;width:100%}}@keyframes decrease{0%{left:-80%;width:80%}to{left:110%;width:10%}}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
526
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LoadingBarComponent, decorators: [{
|
|
527
|
-
type: Component,
|
|
528
|
-
args: [{ selector: 'base-loading-bar', template: "<div class=\"slider\" *ngIf=\"loading || manuallyLoading\">\n <div class=\"line\"></div>\n <div class=\"subline inc\"></div>\n <div class=\"subline dec\"></div>\n</div>\n", styles: [":host{--base-loading-bar-color: #f28c18;--base-loading-bar-height: 5px;--base-loading-bar-z-index: 999999999}.slider{position:fixed;left:0;right:0;height:var(--base-loading-bar-height);overflow-x:hidden;z-index:var(--base-loading-bar-z-index);background-color:#fff}.line{position:absolute;opacity:.6;background:var(--base-loading-bar-color);width:150%;height:var(--base-loading-bar-height)}.subline{position:absolute;background:var(--base-loading-bar-color);height:var(--base-loading-bar-height)}.inc{animation:increase 2s infinite}.dec{animation:decrease 2s .5s infinite}@keyframes increase{0%{left:-5%;width:5%}to{left:130%;width:100%}}@keyframes decrease{0%{left:-80%;width:80%}to{left:110%;width:10%}}\n"] }]
|
|
529
|
-
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: i1$1.LoaderService }]; }, propDecorators: { manuallyLoading: [{
|
|
530
|
-
type: Input
|
|
531
|
-
}] } });
|
|
532
|
-
|
|
533
|
-
class SkeletonLoaderComponent {
|
|
534
|
-
constructor() {
|
|
535
|
-
this.count = 1;
|
|
536
|
-
this.size = 18;
|
|
537
|
-
}
|
|
538
|
-
convertToArray(value) {
|
|
539
|
-
if (!value) {
|
|
540
|
-
return [];
|
|
541
|
-
}
|
|
542
|
-
const res = [];
|
|
543
|
-
for (let i = 0; i < value; i++) {
|
|
544
|
-
res.push(i);
|
|
545
|
-
}
|
|
546
|
-
return res;
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
SkeletonLoaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkeletonLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
550
|
-
SkeletonLoaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: SkeletonLoaderComponent, selector: "base-skeleton-loader", inputs: { type: "type", count: "count", size: "size" }, ngImport: i0, template: "<ng-container *ngIf=\"type\" [ngSwitch]=\"type\">\n <div *ngSwitchCase=\"'LINE'\">\n <div class=\"line-loader-wrapper\">\n <div class=\"line-loader\" *ngFor=\"let key of convertToArray(count)\"></div>\n </div>\n </div>\n\n <div *ngSwitchCase=\"'RECTANGLE'\">\n <div class=\"line-rectangle\" [ngStyle]=\"{ height: size + 'px' }\"></div>\n </div>\n\n <div *ngSwitchCase=\"'AVATAR'\">\n <div class=\"line-avatar\" [ngStyle]=\"{ height: size + 'px', width: size + 'px' }\"></div>\n </div>\n</ng-container>\n", styles: ["@keyframes shine{to{background-position-x:-200%}}.line-loader-wrapper>:not(:first-of-type){margin-top:10px}.line-loader-wrapper .line-loader{background:linear-gradient(110deg,#ececec 8%,#f5f5f5 18%,#ececec 33%);background-size:200% 100%;animation:1.5s shine linear infinite;height:18px;border-radius:5px}.line-rectangle{background:linear-gradient(110deg,#ececec 8%,#f5f5f5 18%,#ececec 33%);background-size:200% 100%;animation:1.5s shine linear infinite;border-radius:5px}.line-avatar{background:linear-gradient(110deg,#ececec 8%,#f5f5f5 18%,#ececec 33%);background-size:200% 100%;animation:1.5s shine linear infinite;border-radius:50%}\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: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }] });
|
|
551
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkeletonLoaderComponent, decorators: [{
|
|
552
|
-
type: Component,
|
|
553
|
-
args: [{ selector: 'base-skeleton-loader', template: "<ng-container *ngIf=\"type\" [ngSwitch]=\"type\">\n <div *ngSwitchCase=\"'LINE'\">\n <div class=\"line-loader-wrapper\">\n <div class=\"line-loader\" *ngFor=\"let key of convertToArray(count)\"></div>\n </div>\n </div>\n\n <div *ngSwitchCase=\"'RECTANGLE'\">\n <div class=\"line-rectangle\" [ngStyle]=\"{ height: size + 'px' }\"></div>\n </div>\n\n <div *ngSwitchCase=\"'AVATAR'\">\n <div class=\"line-avatar\" [ngStyle]=\"{ height: size + 'px', width: size + 'px' }\"></div>\n </div>\n</ng-container>\n", styles: ["@keyframes shine{to{background-position-x:-200%}}.line-loader-wrapper>:not(:first-of-type){margin-top:10px}.line-loader-wrapper .line-loader{background:linear-gradient(110deg,#ececec 8%,#f5f5f5 18%,#ececec 33%);background-size:200% 100%;animation:1.5s shine linear infinite;height:18px;border-radius:5px}.line-rectangle{background:linear-gradient(110deg,#ececec 8%,#f5f5f5 18%,#ececec 33%);background-size:200% 100%;animation:1.5s shine linear infinite;border-radius:5px}.line-avatar{background:linear-gradient(110deg,#ececec 8%,#f5f5f5 18%,#ececec 33%);background-size:200% 100%;animation:1.5s shine linear infinite;border-radius:50%}\n"] }]
|
|
554
|
-
}], propDecorators: { type: [{
|
|
555
|
-
type: Input
|
|
556
|
-
}], count: [{
|
|
557
|
-
type: Input
|
|
558
|
-
}], size: [{
|
|
559
|
-
type: Input
|
|
560
|
-
}] } });
|
|
561
|
-
|
|
562
|
-
class BreadcrumbComponent {
|
|
563
|
-
constructor(breadcrumbService) {
|
|
564
|
-
this.breadcrumbService = breadcrumbService;
|
|
565
|
-
this.breadcrumbs$ = breadcrumbService.breadcrumbsObservable;
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
BreadcrumbComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BreadcrumbComponent, deps: [{ token: i1$1.BreadcrumbService }], target: i0.ɵɵFactoryTarget.Component });
|
|
569
|
-
BreadcrumbComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: BreadcrumbComponent, selector: "base-breadcrumb", ngImport: i0, 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"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] });
|
|
570
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BreadcrumbComponent, decorators: [{
|
|
571
|
-
type: Component,
|
|
572
|
-
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"] }]
|
|
573
|
-
}], ctorParameters: function () { return [{ type: i1$1.BreadcrumbService }]; } });
|
|
574
|
-
|
|
575
|
-
class SortDirective {
|
|
576
|
-
constructor(renderer, targetElem, document) {
|
|
577
|
-
this.renderer = renderer;
|
|
578
|
-
this.targetElem = targetElem;
|
|
579
|
-
this.baseSorted = new EventEmitter();
|
|
580
|
-
}
|
|
581
|
-
/**
|
|
582
|
-
* Sorts columns on click
|
|
583
|
-
*/
|
|
584
|
-
sortColumn() {
|
|
585
|
-
const items = document.getElementsByTagName('th');
|
|
586
|
-
for (let i = 0; i < items.length; i++) {
|
|
587
|
-
items[i].classList.remove('asc');
|
|
588
|
-
items[i].classList.remove('desc');
|
|
589
|
-
}
|
|
590
|
-
const sort = new Sort();
|
|
591
|
-
const elem = this.targetElem.nativeElement;
|
|
592
|
-
const order = elem.getAttribute('data-order');
|
|
593
|
-
const type = elem.getAttribute('data-type');
|
|
594
|
-
const property = elem.getAttribute('data-name');
|
|
595
|
-
if (order === 'desc') {
|
|
596
|
-
this.baseSorted.emit([...this.baseSort].sort(sort.startSort(property, order, type)));
|
|
597
|
-
elem.setAttribute('data-order', 'asc');
|
|
598
|
-
elem.classList.remove('desc');
|
|
599
|
-
elem.classList.add('asc');
|
|
600
|
-
}
|
|
601
|
-
else {
|
|
602
|
-
this.baseSorted.emit([...this.baseSort].sort(sort.startSort(property, order, type)));
|
|
603
|
-
elem.setAttribute('data-order', 'desc');
|
|
604
|
-
elem.classList.remove('asc');
|
|
605
|
-
elem.classList.add('desc');
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
SortDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SortDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive });
|
|
610
|
-
SortDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: SortDirective, selector: "[baseSort]", inputs: { baseSort: "baseSort" }, outputs: { baseSorted: "baseSorted" }, host: { listeners: { "click": "sortColumn()" } }, ngImport: i0 });
|
|
611
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SortDirective, decorators: [{
|
|
612
|
-
type: Directive,
|
|
613
|
-
args: [{
|
|
614
|
-
selector: '[baseSort]',
|
|
615
|
-
}]
|
|
616
|
-
}], ctorParameters: function () {
|
|
617
|
-
return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: Document, decorators: [{
|
|
618
|
-
type: Inject,
|
|
619
|
-
args: [DOCUMENT]
|
|
620
|
-
}] }];
|
|
621
|
-
}, propDecorators: { baseSort: [{
|
|
622
|
-
type: Input
|
|
623
|
-
}], baseSorted: [{
|
|
624
|
-
type: Output
|
|
625
|
-
}], sortColumn: [{
|
|
626
|
-
type: HostListener,
|
|
627
|
-
args: ['click']
|
|
628
|
-
}] } });
|
|
629
|
-
|
|
630
|
-
/**
|
|
631
|
-
* Directive vor context menu
|
|
632
|
-
* See https://stackblitz.com/edit/angular-custom-context-menu
|
|
633
|
-
*/
|
|
634
|
-
class ContextMenuDirective {
|
|
635
|
-
constructor(el) {
|
|
636
|
-
this.el = el;
|
|
637
|
-
this.xGap = 0;
|
|
638
|
-
this.yGap = 0;
|
|
639
|
-
this.overflowSpace = 10;
|
|
640
|
-
this.selectors = '*';
|
|
641
|
-
this.clickedElement = null;
|
|
642
|
-
this.previousDisplayStatus = null;
|
|
643
|
-
}
|
|
644
|
-
ngOnInit() {
|
|
645
|
-
if (this.ltContextMenu) {
|
|
646
|
-
this.previousDisplayStatus = this.ltContextMenu.style.display;
|
|
647
|
-
}
|
|
648
|
-
// Add a click listener to the window,
|
|
649
|
-
// so that we can close the context menu on left click
|
|
650
|
-
window.addEventListener('click', () => {
|
|
651
|
-
this.showContextMenu(null, false);
|
|
652
|
-
});
|
|
653
|
-
// Close context menu when escape is pressed
|
|
654
|
-
window.addEventListener('keydown', (e) => {
|
|
655
|
-
if (e.code === 'Escape') {
|
|
656
|
-
this.showContextMenu(null, false);
|
|
657
|
-
}
|
|
658
|
-
});
|
|
659
|
-
// Add an event listener to listen to the 'contextmenu' event
|
|
660
|
-
this.el.nativeElement.addEventListener('contextmenu', (e) => {
|
|
661
|
-
// Prevent the default context menu to popup
|
|
662
|
-
if (e.preventDefault) {
|
|
663
|
-
e.preventDefault();
|
|
664
|
-
}
|
|
665
|
-
// Shows our own context menu
|
|
666
|
-
this.showContextMenu(e, true);
|
|
667
|
-
});
|
|
668
|
-
}
|
|
669
|
-
// Shows or hides our custom context menu, which is specified as a input
|
|
670
|
-
showContextMenu(event, show) {
|
|
671
|
-
var _a;
|
|
672
|
-
const cm = this.ltContextMenu;
|
|
673
|
-
if (cm) {
|
|
674
|
-
// Try to open context menu
|
|
675
|
-
if (show && event && event instanceof MouseEvent) {
|
|
676
|
-
// Get valid clicked structureElement
|
|
677
|
-
const clickedElement = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.closest(this.selectors);
|
|
678
|
-
if (clickedElement) {
|
|
679
|
-
this.clickedElement = clickedElement;
|
|
680
|
-
setTimeout(() => {
|
|
681
|
-
// Set display status
|
|
682
|
-
cm.style.display = 'block';
|
|
683
|
-
// Calculate top position
|
|
684
|
-
let top = event.y + this.yGap;
|
|
685
|
-
if (top + cm.offsetHeight + 10 > document.documentElement.clientHeight) {
|
|
686
|
-
top = document.documentElement.clientHeight - cm.offsetHeight - this.overflowSpace;
|
|
687
|
-
}
|
|
688
|
-
// Calculate left position
|
|
689
|
-
let left = event.x + this.xGap;
|
|
690
|
-
if (left + cm.offsetWidth + 10 > document.documentElement.clientWidth) {
|
|
691
|
-
left = document.documentElement.clientWidth - cm.offsetWidth - this.overflowSpace;
|
|
692
|
-
}
|
|
693
|
-
// Set position
|
|
694
|
-
cm.style.top = top + 'px';
|
|
695
|
-
cm.style.left = left + 'px';
|
|
696
|
-
// Show
|
|
697
|
-
cm.style.opacity = '1.0';
|
|
698
|
-
cm.style['pointer-events'] = 'auto';
|
|
699
|
-
}, 1);
|
|
700
|
-
return;
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
// Close context menu
|
|
704
|
-
this.clickedElement = null;
|
|
705
|
-
if (this.previousDisplayStatus) {
|
|
706
|
-
cm.style.display = this.previousDisplayStatus;
|
|
707
|
-
}
|
|
708
|
-
cm.style.opacity = '0.01';
|
|
709
|
-
cm.style['pointer-events'] = 'none';
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
ContextMenuDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextMenuDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
714
|
-
ContextMenuDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: ContextMenuDirective, selector: "[ltContextMenu]", inputs: { contextMenuData: "contextMenuData", ltContextMenu: "ltContextMenu", xGap: "xGap", yGap: "yGap", overflowSpace: "overflowSpace", selectors: "selectors" }, outputs: { clickedElement: "clickedElement" }, exportAs: ["contextMenuData"], ngImport: i0 });
|
|
715
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextMenuDirective, decorators: [{
|
|
716
|
-
type: Directive,
|
|
717
|
-
args: [{
|
|
718
|
-
selector: '[ltContextMenu]',
|
|
719
|
-
exportAs: 'contextMenuData',
|
|
720
|
-
}]
|
|
721
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { contextMenuData: [{
|
|
722
|
-
type: Input
|
|
723
|
-
}], ltContextMenu: [{
|
|
724
|
-
type: Input
|
|
725
|
-
}], xGap: [{
|
|
726
|
-
type: Input
|
|
727
|
-
}], yGap: [{
|
|
728
|
-
type: Input
|
|
729
|
-
}], overflowSpace: [{
|
|
730
|
-
type: Input
|
|
731
|
-
}], selectors: [{
|
|
732
|
-
type: Input
|
|
733
|
-
}], clickedElement: [{
|
|
734
|
-
type: Output
|
|
735
|
-
}] } });
|
|
736
|
-
|
|
737
|
-
/**
|
|
738
|
-
* Stops propagation of click events
|
|
739
|
-
* Inspired by https://stackoverflow.com/a/41001184
|
|
740
|
-
*/
|
|
741
|
-
class StopPropagationDirective {
|
|
742
|
-
onClick(event) {
|
|
743
|
-
event.stopPropagation();
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
StopPropagationDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: StopPropagationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
747
|
-
StopPropagationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: StopPropagationDirective, selector: "[baseStopPropagation]", host: { listeners: { "click": "onClick($event)" } }, ngImport: i0 });
|
|
748
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: StopPropagationDirective, decorators: [{
|
|
749
|
-
type: Directive,
|
|
750
|
-
args: [{
|
|
751
|
-
selector: '[baseStopPropagation]',
|
|
752
|
-
}]
|
|
753
|
-
}], propDecorators: { onClick: [{
|
|
754
|
-
type: HostListener,
|
|
755
|
-
args: ['click', ['$event']]
|
|
756
|
-
}] } });
|
|
757
|
-
|
|
758
|
-
class UploadImageComponent {
|
|
759
|
-
constructor(httpClient, authService, fileService, toastService) {
|
|
760
|
-
this.httpClient = httpClient;
|
|
761
|
-
this.authService = authService;
|
|
762
|
-
this.fileService = fileService;
|
|
763
|
-
this.toastService = toastService;
|
|
764
|
-
this.supportText = 'Supports: JPEG, JPG, PNG';
|
|
765
|
-
this.required = false;
|
|
766
|
-
this.defaultDragText = 'Drag & Drop';
|
|
767
|
-
this.defaultReleaseText = 'Release to Upload';
|
|
768
|
-
this.preButtonText = 'or';
|
|
769
|
-
this.buttonText = 'browse';
|
|
770
|
-
this.validExtensions = ['image/jpeg', 'image/jpg', 'image/png', 'image/webp'];
|
|
771
|
-
this.url = 'http://localhost:3000';
|
|
772
|
-
this.uploadPath = '/files/upload';
|
|
773
|
-
this.deletePath = '/files/';
|
|
774
|
-
this.path = '/files/';
|
|
775
|
-
this.uploadDirectly = false;
|
|
776
|
-
this.croppingImage = false;
|
|
777
|
-
this.mode = 'file';
|
|
778
|
-
this.imageUploaded = new EventEmitter();
|
|
779
|
-
this.imageDeleted = new EventEmitter();
|
|
780
|
-
this.fileChanged = new EventEmitter();
|
|
781
|
-
this.dragActive = false;
|
|
782
|
-
this.dragText = 'Drag & Drop';
|
|
783
|
-
this.loading = false;
|
|
784
|
-
this.croppedInProgress = false;
|
|
785
|
-
}
|
|
786
|
-
ngOnInit() {
|
|
787
|
-
// Set default options for cropping
|
|
788
|
-
this.cOptions = Object.assign({ maintainAspectRatio: true, aspectRatio: 4 / 3, onlyScaleDown: false, imageQuality: 92, autoCrop: true, alignImage: 'center', format: 'jpeg' }, this.croppingOptions);
|
|
789
|
-
}
|
|
790
|
-
/**
|
|
791
|
-
* The dragOver function is called when the user drags a file over the dropzone. It prevents the default action of the
|
|
792
|
-
* event, and sets the dragText to 'Release to Upload' and the dragActive to true
|
|
793
|
-
*
|
|
794
|
-
* @param event - any - This is the event that is triggered when the user drags a file over the dropzone.
|
|
795
|
-
*/
|
|
796
|
-
dragOver(event) {
|
|
797
|
-
event.preventDefault();
|
|
798
|
-
this.dragText = this.defaultReleaseText;
|
|
799
|
-
this.dragActive = true;
|
|
800
|
-
}
|
|
801
|
-
/**
|
|
802
|
-
* When the user drags a file over the drop zone, the dragActive variable is set to true, which will change the color of
|
|
803
|
-
* the drop zone to green
|
|
804
|
-
*
|
|
805
|
-
* @param event - The event object that is passed to the dragLeave event.
|
|
806
|
-
*/
|
|
807
|
-
dragLeave(event) {
|
|
808
|
-
this.dragText = this.defaultDragText;
|
|
809
|
-
this.dragActive = false;
|
|
810
|
-
}
|
|
811
|
-
/**
|
|
812
|
-
* The function takes an event as a parameter, prevents the default action of the event, sets the URL of the image to the
|
|
813
|
-
* file that was dragged and dropped, sets the text of the drag and drop area to the default text, and sets the
|
|
814
|
-
* dragActive variable to false
|
|
815
|
-
*
|
|
816
|
-
* @param event - any - This is the event that is triggered when the user drags and drops a file.
|
|
817
|
-
*/
|
|
818
|
-
drop(event) {
|
|
819
|
-
event.preventDefault();
|
|
820
|
-
this.fileInput.nativeElement.files = event.dataTransfer.files;
|
|
821
|
-
const e = new Event('change');
|
|
822
|
-
this.fileInput.nativeElement.dispatchEvent(e);
|
|
823
|
-
this.dragText = 'Drag & Drop';
|
|
824
|
-
this.dragActive = false;
|
|
825
|
-
}
|
|
826
|
-
/**
|
|
827
|
-
* It takes a file as an argument, checks if the file type is valid, and if it is, it creates a new FileReader object,
|
|
828
|
-
* sets the onload function to set the fileUrl to the result of the fileReader, sets the selectedFile to the file, and
|
|
829
|
-
* calls the upload function
|
|
830
|
-
*
|
|
831
|
-
* @param file - any - this is the file that is selected by the user.
|
|
832
|
-
*/
|
|
833
|
-
setUrl(file) {
|
|
834
|
-
const fileReader = new FileReader();
|
|
835
|
-
fileReader.onload = (result) => {
|
|
836
|
-
this.loading = true;
|
|
837
|
-
this.fileUrl = fileReader.result;
|
|
838
|
-
this.selectedFile = file;
|
|
839
|
-
this.upload();
|
|
840
|
-
};
|
|
841
|
-
fileReader.readAsDataURL(file);
|
|
842
|
-
}
|
|
843
|
-
checkFile(file) {
|
|
844
|
-
if (this.maxSize && file.size > this.maxSize) {
|
|
845
|
-
this.toastService.show({
|
|
846
|
-
id: 'image-invalid-size',
|
|
847
|
-
type: ToastType.ERROR,
|
|
848
|
-
title: 'Fehlgeschlagen',
|
|
849
|
-
description: 'Die Datei ist zu groß. Die Datei darf nicht größer als ' +
|
|
850
|
-
(this.maxSize / (1024 * 1024)).toFixed(2) +
|
|
851
|
-
'MB sein.',
|
|
852
|
-
}, 3500);
|
|
853
|
-
return false;
|
|
854
|
-
}
|
|
855
|
-
else {
|
|
856
|
-
if (this.validExtensions.includes(file === null || file === void 0 ? void 0 : file.type)) {
|
|
857
|
-
return true;
|
|
858
|
-
}
|
|
859
|
-
else {
|
|
860
|
-
this.toastService.show({
|
|
861
|
-
id: 'image-invalid-format',
|
|
862
|
-
type: ToastType.ERROR,
|
|
863
|
-
title: 'Fehlgeschlagen',
|
|
864
|
-
description: 'Das Format der Datei wird nicht unterstützt.',
|
|
865
|
-
}, 3500);
|
|
866
|
-
return false;
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
/**
|
|
871
|
-
* The function takes an event as an argument, and then sets the url of the file to the first file in the event's
|
|
872
|
-
* target's files array
|
|
873
|
-
*
|
|
874
|
-
* @param event - any - The event that is triggered when the user selects a file.
|
|
875
|
-
*/
|
|
876
|
-
selectFile(event) {
|
|
877
|
-
if (!this.checkFile(event.target.files[0])) {
|
|
878
|
-
return;
|
|
879
|
-
}
|
|
880
|
-
if (this.croppingImage) {
|
|
881
|
-
this.croppedInProgress = true;
|
|
882
|
-
this.fileEvent = event;
|
|
883
|
-
}
|
|
884
|
-
else {
|
|
885
|
-
this.setUrl(event.target.files[0]);
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
/**
|
|
889
|
-
* We create a new FormData object, append the selected file to it, and then send it to the server
|
|
890
|
-
*/
|
|
891
|
-
upload() {
|
|
892
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
893
|
-
// Prepare file data
|
|
894
|
-
let file = this.selectedFile;
|
|
895
|
-
if (this.compressOptions) {
|
|
896
|
-
file = yield this.fileService.compress(file, this.compressOptions);
|
|
897
|
-
}
|
|
898
|
-
const fileData = {
|
|
899
|
-
field: this.objectPath ? this.objectPath + '.' + this.id : this.id,
|
|
900
|
-
file,
|
|
901
|
-
base64: yield this.getBase64(file),
|
|
902
|
-
};
|
|
903
|
-
// Emit file data
|
|
904
|
-
this.fileChanged.emit(fileData);
|
|
905
|
-
// Set control value and upload directly if required
|
|
906
|
-
if (this.uploadDirectly) {
|
|
907
|
-
const result = yield this.fileService.upload(this.url, this.uploadPath, this.selectedFile);
|
|
908
|
-
if (result === null || result === void 0 ? void 0 : result.id) {
|
|
909
|
-
this.control.setValue(result.id);
|
|
910
|
-
this.imageUploaded.emit(result.id);
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
else {
|
|
914
|
-
this.control.setValue(this.mode === 'base64' ? fileData.base64 : this.selectedFile);
|
|
915
|
-
}
|
|
916
|
-
// Final processes
|
|
917
|
-
this.control.markAsTouched();
|
|
918
|
-
this.loading = false;
|
|
919
|
-
});
|
|
920
|
-
}
|
|
921
|
-
/**
|
|
922
|
-
* It deletes the file from the server and sets the selectedFile and fileUrl to null
|
|
923
|
-
*
|
|
924
|
-
* @param [id] - The id of the file to delete.
|
|
925
|
-
*/
|
|
926
|
-
deleteFile(id) {
|
|
927
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
928
|
-
if (!this.uploadDirectly) {
|
|
929
|
-
this.selectedFile = null;
|
|
930
|
-
this.fileUrl = null;
|
|
931
|
-
this.control.setValue('');
|
|
932
|
-
this.control.markAsTouched();
|
|
933
|
-
this.fileChanged.emit({
|
|
934
|
-
field: this.objectPath ? this.objectPath + '.' + this.id : this.id,
|
|
935
|
-
file: null,
|
|
936
|
-
base64: null,
|
|
937
|
-
});
|
|
938
|
-
return;
|
|
939
|
-
}
|
|
940
|
-
this.loading = true;
|
|
941
|
-
this.selectedFile = null;
|
|
942
|
-
this.fileUrl = null;
|
|
943
|
-
if (id) {
|
|
944
|
-
const result = yield this.fileService.delete(this.url, this.deletePath, id);
|
|
945
|
-
if (result) {
|
|
946
|
-
this.selectedFile = null;
|
|
947
|
-
this.fileUrl = null;
|
|
948
|
-
this.control.setValue('');
|
|
949
|
-
this.imageDeleted.emit();
|
|
950
|
-
this.loading = false;
|
|
951
|
-
}
|
|
952
|
-
}
|
|
953
|
-
});
|
|
954
|
-
}
|
|
955
|
-
/**
|
|
956
|
-
* Convert a file into a BASE64 encoded string
|
|
957
|
-
*/
|
|
958
|
-
getBase64(file) {
|
|
959
|
-
return new Promise((resolve, reject) => {
|
|
960
|
-
if (!file) {
|
|
961
|
-
return resolve(null);
|
|
962
|
-
}
|
|
963
|
-
const reader = new FileReader();
|
|
964
|
-
reader.readAsDataURL(file);
|
|
965
|
-
reader.onload = () => {
|
|
966
|
-
if (!reader.result) {
|
|
967
|
-
return reject(new Error('Conversion failed'));
|
|
968
|
-
}
|
|
969
|
-
resolve(reader.result.toString());
|
|
970
|
-
};
|
|
971
|
-
reader.onerror = (error) => {
|
|
972
|
-
reject(error);
|
|
973
|
-
};
|
|
974
|
-
});
|
|
975
|
-
}
|
|
976
|
-
base64ToFile(base64, fileName, fileType) {
|
|
977
|
-
return new Promise((resolve, reject) => {
|
|
978
|
-
fetch(base64)
|
|
979
|
-
.then((res) => res.blob())
|
|
980
|
-
.then((blob) => {
|
|
981
|
-
resolve(new File([blob], fileName, { type: fileType }));
|
|
982
|
-
}, (err) => {
|
|
983
|
-
reject(err);
|
|
984
|
-
});
|
|
985
|
-
});
|
|
986
|
-
}
|
|
987
|
-
imageCropped($event, fileEvent) {
|
|
988
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
989
|
-
const file = fileEvent.target.files[0];
|
|
990
|
-
this.croppedFile = yield this.base64ToFile($event.base64, file.name, file.type);
|
|
991
|
-
});
|
|
992
|
-
}
|
|
993
|
-
finishedCropping() {
|
|
994
|
-
this.fileEvent = null;
|
|
995
|
-
this.setUrl(this.croppedFile);
|
|
996
|
-
this.croppedInProgress = false;
|
|
997
|
-
this.croppedFile = null;
|
|
998
|
-
}
|
|
999
|
-
loadImageFailed() {
|
|
1000
|
-
this.toastService.show({
|
|
1001
|
-
id: 'image-invalid-cropped',
|
|
1002
|
-
type: ToastType.ERROR,
|
|
1003
|
-
title: 'Fehlgeschlagen',
|
|
1004
|
-
description: 'Es ist ein Fehler aufgetreten. Bitte probieren Sie es später erneut oder wenden Sie sich an den Support.',
|
|
1005
|
-
}, 3500);
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
UploadImageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UploadImageComponent, deps: [{ token: i1$2.HttpClient }, { token: i1$1.AuthService }, { token: i1$1.FileService }, { token: i1$1.ToastService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1009
|
-
UploadImageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: UploadImageComponent, selector: "base-upload-image", inputs: { id: "id", name: "name", infoText: "infoText", label: "label", supportText: "supportText", required: "required", defaultDragText: "defaultDragText", defaultReleaseText: "defaultReleaseText", preButtonText: "preButtonText", buttonText: "buttonText", validExtensions: "validExtensions", control: "control", url: "url", uploadPath: "uploadPath", deletePath: "deletePath", path: "path", compressOptions: "compressOptions", maxSize: "maxSize", uploadDirectly: "uploadDirectly", croppingImage: "croppingImage", croppingOptions: "croppingOptions", objectPath: "objectPath", mode: "mode" }, outputs: { imageUploaded: "imageUploaded", imageDeleted: "imageDeleted", fileChanged: "fileChanged" }, viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }], ngImport: i0, template: "<div class=\"form-group mt-3\" [ngClass]=\"{ 'is-invalid': control?.invalid && control?.touched }\">\n <div class=\"d-flex justify-content-between align-items-center\">\n <label [for]=\"id\" class=\"form-label\" [ngClass]=\"{ required: required }\" *ngIf=\"label\">{{ label }}</label>\n <i class=\"bi bi-info-circle\" [ngbTooltip]=\"infoText\" placement=\"start\" *ngIf=\"infoText\"></i>\n </div>\n\n <div\n [id]=\"objectPath ? objectPath + '.' + id : id\"\n class=\"drag-area\"\n (dragover)=\"dragOver($event)\"\n (dragleave)=\"dragLeave($event)\"\n (drop)=\"drop($event)\"\n [ngClass]=\"{ active: dragActive, pointer: !loading, 'is-invalid': control?.invalid && control?.touched }\"\n (click)=\"!croppedInProgress && !loading && fileInput.click()\"\n >\n <div class=\"d-flex justify-content-center\" *ngIf=\"loading\">\n <div class=\"spinner-border text-primary\" role=\"status\">\n <span class=\"visually-hidden\">Loading...</span>\n </div>\n </div>\n\n <ng-container *ngIf=\"selectedFile && !fileEvent && !croppedInProgress && !loading\">\n <img [src]=\"fileUrl\" *ngIf=\"selectedFile\" />\n <button class=\"btn btn-danger\" type=\"button\" (click)=\"deleteFile()\" baseStopPropagation>L\u00F6schen</button>\n </ng-container>\n\n <ng-container *ngIf=\"control?.value && !fileEvent && !selectedFile && !loading && !croppedInProgress\">\n <img [src]=\"control?.value.startsWith('data:') ? control?.value : url + path + control?.value\" />\n <button class=\"btn btn-danger\" type=\"button\" (click)=\"deleteFile(control?.value)\" baseStopPropagation>\n L\u00F6schen\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"!selectedFile && !control?.value && !loading && !fileEvent\">\n <div class=\"icon\">\n <i class=\"bi bi-images\"></i>\n </div>\n\n <span class=\"header\">{{ dragText }}</span>\n <span class=\"header\"\n >{{ preButtonText }}\n <span class=\"button\" (click)=\"fileInput.click()\" baseStopPropagation>{{ buttonText }}</span></span\n >\n <span class=\"support\" [innerText]=\"supportText\"></span>\n </ng-container>\n\n <input type=\"file\" (change)=\"selectFile($event)\" [attr.accept]=\"validExtensions?.join(',')\" hidden #fileInput />\n\n <ng-container *ngIf=\"croppedInProgress && fileEvent\">\n <image-cropper\n [imageChangedEvent]=\"fileEvent\"\n [maintainAspectRatio]=\"cOptions.maintainAspectRatio\"\n [aspectRatio]=\"cOptions.aspectRatio\"\n [alignImage]=\"cOptions.alignImage\"\n [resizeToWidth]=\"cOptions.resizeToWidth\"\n [resizeToHeight]=\"cOptions.resizeToHeight\"\n [autoCrop]=\"cOptions.autoCrop\"\n [imageQuality]=\"cOptions.imageQuality\"\n [onlyScaleDown]=\"cOptions.onlyScaleDown\"\n [format]=\"cOptions.format\"\n (imageCropped)=\"imageCropped($event, fileEvent)\"\n (loadImageFailed)=\"loadImageFailed()\"\n ></image-cropper>\n <button class=\"btn btn-primary mt-2\" type=\"button\" (click)=\"finishedCropping()\" baseStopPropagation>\n Zuschneiden\n </button>\n </ng-container>\n </div>\n\n <div class=\"invalid-feedback m-2\" *ngIf=\"control?.invalid && (control?.dirty || control?.touched)\">\n <div *ngIf=\"control?.errors?.['required']\">Dieses Feld ist ein Pflichtfeld.</div>\n </div>\n</div>\n", styles: [":host{--base-upload-image-area-bg: #ffffff;--base-upload-image-area-border-color: #e1e1e1;--base-upload-image-area-height: 400px}.is-invalid .drag-area{border-color:var(--bs-danger)}.is-invalid .invalid-feedback{display:block}.required:after{content:\" *\"}.drag-area{height:var(--base-upload-image-area-height);border:2px dashed var(--base-upload-image-area-border-color);background-color:var(--base-upload-image-area-bg);display:flex;flex-direction:column;justify-content:center;align-items:center;margin:10px auto;padding:20px}.drag-area img{height:100%;max-height:280px;max-width:100%;object-fit:scale-down}.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)}.pointer{cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4.ImageCropperComponent, selector: "image-cropper", inputs: ["imageChangedEvent", "imageURL", "imageBase64", "imageFile", "imageAltText", "format", "transform", "maintainAspectRatio", "aspectRatio", "resetCropOnAspectRatioChange", "resizeToWidth", "resizeToHeight", "cropperMinWidth", "cropperMinHeight", "cropperMaxHeight", "cropperMaxWidth", "cropperStaticWidth", "cropperStaticHeight", "canvasRotation", "initialStepSize", "roundCropper", "onlyScaleDown", "imageQuality", "autoCrop", "backgroundColor", "containWithinAspectRatio", "hideResizeSquares", "allowMoveImage", "cropper", "alignImage", "disabled", "hidden"], outputs: ["imageCropped", "startCropImage", "imageLoaded", "cropperReady", "loadImageFailed", "transformChange"] }, { kind: "directive", type: i3.NgbTooltip, selector: "[ngbTooltip]", inputs: ["animation", "autoClose", "placement", "popperOptions", "triggers", "positionTarget", "container", "disableTooltip", "tooltipClass", "openDelay", "closeDelay", "ngbTooltip"], outputs: ["shown", "hidden"], exportAs: ["ngbTooltip"] }, { kind: "directive", type: StopPropagationDirective, selector: "[baseStopPropagation]" }] });
|
|
1010
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UploadImageComponent, decorators: [{
|
|
1011
|
-
type: Component,
|
|
1012
|
-
args: [{ selector: 'base-upload-image', template: "<div class=\"form-group mt-3\" [ngClass]=\"{ 'is-invalid': control?.invalid && control?.touched }\">\n <div class=\"d-flex justify-content-between align-items-center\">\n <label [for]=\"id\" class=\"form-label\" [ngClass]=\"{ required: required }\" *ngIf=\"label\">{{ label }}</label>\n <i class=\"bi bi-info-circle\" [ngbTooltip]=\"infoText\" placement=\"start\" *ngIf=\"infoText\"></i>\n </div>\n\n <div\n [id]=\"objectPath ? objectPath + '.' + id : id\"\n class=\"drag-area\"\n (dragover)=\"dragOver($event)\"\n (dragleave)=\"dragLeave($event)\"\n (drop)=\"drop($event)\"\n [ngClass]=\"{ active: dragActive, pointer: !loading, 'is-invalid': control?.invalid && control?.touched }\"\n (click)=\"!croppedInProgress && !loading && fileInput.click()\"\n >\n <div class=\"d-flex justify-content-center\" *ngIf=\"loading\">\n <div class=\"spinner-border text-primary\" role=\"status\">\n <span class=\"visually-hidden\">Loading...</span>\n </div>\n </div>\n\n <ng-container *ngIf=\"selectedFile && !fileEvent && !croppedInProgress && !loading\">\n <img [src]=\"fileUrl\" *ngIf=\"selectedFile\" />\n <button class=\"btn btn-danger\" type=\"button\" (click)=\"deleteFile()\" baseStopPropagation>L\u00F6schen</button>\n </ng-container>\n\n <ng-container *ngIf=\"control?.value && !fileEvent && !selectedFile && !loading && !croppedInProgress\">\n <img [src]=\"control?.value.startsWith('data:') ? control?.value : url + path + control?.value\" />\n <button class=\"btn btn-danger\" type=\"button\" (click)=\"deleteFile(control?.value)\" baseStopPropagation>\n L\u00F6schen\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"!selectedFile && !control?.value && !loading && !fileEvent\">\n <div class=\"icon\">\n <i class=\"bi bi-images\"></i>\n </div>\n\n <span class=\"header\">{{ dragText }}</span>\n <span class=\"header\"\n >{{ preButtonText }}\n <span class=\"button\" (click)=\"fileInput.click()\" baseStopPropagation>{{ buttonText }}</span></span\n >\n <span class=\"support\" [innerText]=\"supportText\"></span>\n </ng-container>\n\n <input type=\"file\" (change)=\"selectFile($event)\" [attr.accept]=\"validExtensions?.join(',')\" hidden #fileInput />\n\n <ng-container *ngIf=\"croppedInProgress && fileEvent\">\n <image-cropper\n [imageChangedEvent]=\"fileEvent\"\n [maintainAspectRatio]=\"cOptions.maintainAspectRatio\"\n [aspectRatio]=\"cOptions.aspectRatio\"\n [alignImage]=\"cOptions.alignImage\"\n [resizeToWidth]=\"cOptions.resizeToWidth\"\n [resizeToHeight]=\"cOptions.resizeToHeight\"\n [autoCrop]=\"cOptions.autoCrop\"\n [imageQuality]=\"cOptions.imageQuality\"\n [onlyScaleDown]=\"cOptions.onlyScaleDown\"\n [format]=\"cOptions.format\"\n (imageCropped)=\"imageCropped($event, fileEvent)\"\n (loadImageFailed)=\"loadImageFailed()\"\n ></image-cropper>\n <button class=\"btn btn-primary mt-2\" type=\"button\" (click)=\"finishedCropping()\" baseStopPropagation>\n Zuschneiden\n </button>\n </ng-container>\n </div>\n\n <div class=\"invalid-feedback m-2\" *ngIf=\"control?.invalid && (control?.dirty || control?.touched)\">\n <div *ngIf=\"control?.errors?.['required']\">Dieses Feld ist ein Pflichtfeld.</div>\n </div>\n</div>\n", styles: [":host{--base-upload-image-area-bg: #ffffff;--base-upload-image-area-border-color: #e1e1e1;--base-upload-image-area-height: 400px}.is-invalid .drag-area{border-color:var(--bs-danger)}.is-invalid .invalid-feedback{display:block}.required:after{content:\" *\"}.drag-area{height:var(--base-upload-image-area-height);border:2px dashed var(--base-upload-image-area-border-color);background-color:var(--base-upload-image-area-bg);display:flex;flex-direction:column;justify-content:center;align-items:center;margin:10px auto;padding:20px}.drag-area img{height:100%;max-height:280px;max-width:100%;object-fit:scale-down}.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)}.pointer{cursor:pointer}\n"] }]
|
|
1013
|
-
}], ctorParameters: function () { return [{ type: i1$2.HttpClient }, { type: i1$1.AuthService }, { type: i1$1.FileService }, { type: i1$1.ToastService }]; }, propDecorators: { fileInput: [{
|
|
1014
|
-
type: ViewChild,
|
|
1015
|
-
args: ['fileInput']
|
|
1016
|
-
}], id: [{
|
|
1017
|
-
type: Input
|
|
1018
|
-
}], name: [{
|
|
1019
|
-
type: Input
|
|
1020
|
-
}], infoText: [{
|
|
1021
|
-
type: Input
|
|
1022
|
-
}], label: [{
|
|
1023
|
-
type: Input
|
|
1024
|
-
}], supportText: [{
|
|
1025
|
-
type: Input
|
|
1026
|
-
}], required: [{
|
|
1027
|
-
type: Input
|
|
1028
|
-
}], defaultDragText: [{
|
|
1029
|
-
type: Input
|
|
1030
|
-
}], defaultReleaseText: [{
|
|
1031
|
-
type: Input
|
|
1032
|
-
}], preButtonText: [{
|
|
1033
|
-
type: Input
|
|
1034
|
-
}], buttonText: [{
|
|
1035
|
-
type: Input
|
|
1036
|
-
}], validExtensions: [{
|
|
1037
|
-
type: Input
|
|
1038
|
-
}], control: [{
|
|
1039
|
-
type: Input
|
|
1040
|
-
}], url: [{
|
|
1041
|
-
type: Input
|
|
1042
|
-
}], uploadPath: [{
|
|
1043
|
-
type: Input
|
|
1044
|
-
}], deletePath: [{
|
|
1045
|
-
type: Input
|
|
1046
|
-
}], path: [{
|
|
1047
|
-
type: Input
|
|
1048
|
-
}], compressOptions: [{
|
|
1049
|
-
type: Input
|
|
1050
|
-
}], maxSize: [{
|
|
1051
|
-
type: Input
|
|
1052
|
-
}], uploadDirectly: [{
|
|
1053
|
-
type: Input
|
|
1054
|
-
}], croppingImage: [{
|
|
1055
|
-
type: Input
|
|
1056
|
-
}], croppingOptions: [{
|
|
1057
|
-
type: Input
|
|
1058
|
-
}], objectPath: [{
|
|
1059
|
-
type: Input
|
|
1060
|
-
}], mode: [{
|
|
1061
|
-
type: Input
|
|
1062
|
-
}], imageUploaded: [{
|
|
1063
|
-
type: Output
|
|
1064
|
-
}], imageDeleted: [{
|
|
1065
|
-
type: Output
|
|
1066
|
-
}], fileChanged: [{
|
|
1067
|
-
type: Output
|
|
1068
|
-
}] } });
|
|
1069
|
-
|
|
1070
|
-
class RefenceInputComponent {
|
|
1071
|
-
constructor(graphQLService, router) {
|
|
1072
|
-
this.graphQLService = graphQLService;
|
|
1073
|
-
this.router = router;
|
|
1074
|
-
this.isList = false;
|
|
1075
|
-
this.search = true;
|
|
1076
|
-
this.useParamAsArg = false;
|
|
1077
|
-
this.placeholder = '';
|
|
1078
|
-
this.required = false;
|
|
1079
|
-
this.method = 'find';
|
|
1080
|
-
this.fields = ['id', 'name'];
|
|
1081
|
-
this.valueField = 'id';
|
|
1082
|
-
this.objectPath = '';
|
|
1083
|
-
this.nameField = 'name';
|
|
1084
|
-
this.creationLink = '';
|
|
1085
|
-
this.objects = [];
|
|
1086
|
-
this.optionsForTagInput = [];
|
|
1087
|
-
this.subscription = new Subscription();
|
|
1088
|
-
}
|
|
1089
|
-
ngOnInit() {
|
|
1090
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1091
|
-
this.getReferences();
|
|
1092
|
-
this.subscription.add(this.control.valueChanges.subscribe(() => {
|
|
1093
|
-
if (!this.currentValue) {
|
|
1094
|
-
this.setValue();
|
|
1095
|
-
}
|
|
1096
|
-
}));
|
|
1097
|
-
});
|
|
1098
|
-
}
|
|
1099
|
-
ngOnDestroy() {
|
|
1100
|
-
this.subscription.unsubscribe();
|
|
1101
|
-
}
|
|
1102
|
-
/**
|
|
1103
|
-
* Open creation link for new reference if enabled
|
|
1104
|
-
*/
|
|
1105
|
-
openLink() {
|
|
1106
|
-
this.router.navigate([this.creationLink]);
|
|
1107
|
-
}
|
|
1108
|
-
/**
|
|
1109
|
-
* It gets the references from the GraphQL server and sets the value of the select
|
|
1110
|
-
*/
|
|
1111
|
-
getReferences() {
|
|
1112
|
-
const fields = [...this.fields];
|
|
1113
|
-
if (Array.isArray(this.nameField)) {
|
|
1114
|
-
for (const field of this.nameField) {
|
|
1115
|
-
if (!fields.includes(field)) {
|
|
1116
|
-
fields.push(field);
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
else {
|
|
1121
|
-
if (!fields.includes(this.nameField)) {
|
|
1122
|
-
fields.push(this.nameField);
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
let args;
|
|
1126
|
-
if (!this.useParamAsArg) {
|
|
1127
|
-
args = { sort: [{ field: fields.includes('name') ? 'name' : fields[0], order: SortOrderEnum.ASC }] };
|
|
1128
|
-
}
|
|
1129
|
-
else {
|
|
1130
|
-
args = {
|
|
1131
|
-
id: this.param,
|
|
1132
|
-
sort: [{ field: fields.includes('name') ? 'name' : fields[0], order: SortOrderEnum.ASC }],
|
|
1133
|
-
};
|
|
1134
|
-
}
|
|
1135
|
-
this.graphQLService
|
|
1136
|
-
.graphQl(this.method, {
|
|
1137
|
-
fields,
|
|
1138
|
-
arguments: args,
|
|
1139
|
-
type: GraphQLRequestType.QUERY,
|
|
1140
|
-
})
|
|
1141
|
-
.subscribe((result) => __awaiter(this, void 0, void 0, function* () {
|
|
1142
|
-
if (result) {
|
|
1143
|
-
this.objects = result;
|
|
1144
|
-
this.setObjectsAsOptions();
|
|
1145
|
-
if (!this.currentValue) {
|
|
1146
|
-
this.setValue();
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
}));
|
|
1150
|
-
}
|
|
1151
|
-
/**
|
|
1152
|
-
* If the current value is not valid, set the control to an invalid state
|
|
1153
|
-
*/
|
|
1154
|
-
checkValidReference() {
|
|
1155
|
-
if (!this.currentValue) {
|
|
1156
|
-
this.control.markAsTouched();
|
|
1157
|
-
this.control.markAsDirty();
|
|
1158
|
-
this.control.setValue('');
|
|
1159
|
-
this.control.setErrors(null);
|
|
1160
|
-
return;
|
|
1161
|
-
}
|
|
1162
|
-
const foundElement = this.objects.find((e) => this.checkForNameFields(e));
|
|
1163
|
-
if (!foundElement) {
|
|
1164
|
-
this.control.setValue(null);
|
|
1165
|
-
this.control.markAsTouched();
|
|
1166
|
-
this.control.markAsDirty();
|
|
1167
|
-
this.control.setErrors({ invalidReference: true });
|
|
1168
|
-
}
|
|
1169
|
-
else {
|
|
1170
|
-
this.control.setErrors(null);
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
/**
|
|
1174
|
-
* If the user presses the enter key, mark the control as touched
|
|
1175
|
-
*/
|
|
1176
|
-
enterKey(event) {
|
|
1177
|
-
this.selectedElement = event.target;
|
|
1178
|
-
this.control.markAsTouched();
|
|
1179
|
-
}
|
|
1180
|
-
/**
|
|
1181
|
-
* If the control has a value and the objects array is not empty, then find the object in the array that has the same
|
|
1182
|
-
* value as the control's value and set the currentValue to the textField of that object. If the control has a value but
|
|
1183
|
-
* the objects array is empty, then set the currentValue to the control's value
|
|
1184
|
-
*/
|
|
1185
|
-
setValue() {
|
|
1186
|
-
var _a, _b, _c, _d;
|
|
1187
|
-
if (((_a = this.control) === null || _a === void 0 ? void 0 : _a.value) && ((_b = this.objects) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
1188
|
-
if ((_d = (_c = this.control) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.id) {
|
|
1189
|
-
this.control.setValue(this.control.value.id);
|
|
1190
|
-
}
|
|
1191
|
-
const foundElement = this.objects.find((e) => e[this.valueField] === this.control.value);
|
|
1192
|
-
if (foundElement) {
|
|
1193
|
-
this.currentValue = this.prepareNameField(foundElement);
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
/**
|
|
1198
|
-
* It sets the value of the control to the id of the selected option
|
|
1199
|
-
*/
|
|
1200
|
-
set(id) {
|
|
1201
|
-
this.control.markAsTouched();
|
|
1202
|
-
this.control.markAsDirty();
|
|
1203
|
-
this.control.setValue(id);
|
|
1204
|
-
this.setValue();
|
|
1205
|
-
this.selectedElement = null;
|
|
1206
|
-
}
|
|
1207
|
-
/**
|
|
1208
|
-
* Filter options for drop down
|
|
1209
|
-
*/
|
|
1210
|
-
filterOptions() {
|
|
1211
|
-
return this.objects
|
|
1212
|
-
? this.objects.filter((e) => { var _a, _b; return (!this.currentValue || this.checkForNameFields(e)) && !((_b = (_a = this.control) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.includes(e === null || e === void 0 ? void 0 : e.value)); })
|
|
1213
|
-
: [];
|
|
1214
|
-
}
|
|
1215
|
-
/**
|
|
1216
|
-
* It takes an array of objects and returns an array of objects with the text and value fields specified
|
|
1217
|
-
*/
|
|
1218
|
-
setObjectsAsOptions() {
|
|
1219
|
-
this.optionsForTagInput = this.objects.map((e) => {
|
|
1220
|
-
return {
|
|
1221
|
-
text: this.prepareNameField(e),
|
|
1222
|
-
value: e[this.valueField],
|
|
1223
|
-
};
|
|
1224
|
-
});
|
|
1225
|
-
}
|
|
1226
|
-
/**
|
|
1227
|
-
* Show dropdown focus
|
|
1228
|
-
*/
|
|
1229
|
-
onFocus(event) {
|
|
1230
|
-
if (event) {
|
|
1231
|
-
this.selectedElement = event.target;
|
|
1232
|
-
}
|
|
1233
|
-
else {
|
|
1234
|
-
this.checkValidReference();
|
|
1235
|
-
setTimeout(() => {
|
|
1236
|
-
this.selectedElement = null;
|
|
1237
|
-
}, 250);
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
|
-
/**
|
|
1241
|
-
* Prepare string function if name fields is an array
|
|
1242
|
-
*/
|
|
1243
|
-
prepareNameField(object) {
|
|
1244
|
-
let result;
|
|
1245
|
-
if (Array.isArray(this.nameField)) {
|
|
1246
|
-
for (const field of this.nameField) {
|
|
1247
|
-
if (!result) {
|
|
1248
|
-
result = object[field];
|
|
1249
|
-
}
|
|
1250
|
-
else if (object[field]) {
|
|
1251
|
-
result = result + ' ' + object[field];
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
else {
|
|
1256
|
-
result = object[this.nameField];
|
|
1257
|
-
}
|
|
1258
|
-
return result;
|
|
1259
|
-
}
|
|
1260
|
-
/**
|
|
1261
|
-
* Check function if name fields is an array
|
|
1262
|
-
*/
|
|
1263
|
-
checkForNameFields(object) {
|
|
1264
|
-
var _a;
|
|
1265
|
-
if (Array.isArray(this.nameField)) {
|
|
1266
|
-
let result = false;
|
|
1267
|
-
for (const field of this.nameField) {
|
|
1268
|
-
const check = object[field].includes(this.currentValue);
|
|
1269
|
-
if (check) {
|
|
1270
|
-
result = check;
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
return result;
|
|
1274
|
-
}
|
|
1275
|
-
else {
|
|
1276
|
-
return (_a = object[this.nameField]) === null || _a === void 0 ? void 0 : _a.includes(this.currentValue);
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
|
-
RefenceInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RefenceInputComponent, deps: [{ token: i1$1.GraphQLService }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Component });
|
|
1281
|
-
RefenceInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: RefenceInputComponent, selector: "base-refence-input", inputs: { id: "id", name: "name", infoText: "infoText", label: "label", isList: "isList", search: "search", useParamAsArg: "useParamAsArg", param: "param", placeholder: "placeholder", autocomplete: "autocomplete", tabIndex: "tabIndex", control: "control", required: "required", method: "method", fields: "fields", valueField: "valueField", objectPath: "objectPath", nameField: "nameField", creationLink: "creationLink" }, ngImport: i0, template: "<ng-container *ngIf=\"!isList\">\n <div class=\"form-group mb-3\">\n <div class=\"d-flex justify-content-between align-items-center\">\n <label [for]=\"id\" class=\"form-label\" [ngClass]=\"{ required: required }\" *ngIf=\"label\">{{ label }}</label>\n <i class=\"bi bi-info-circle\" [ngbTooltip]=\"infoText\" placement=\"start\" *ngIf=\"infoText\"></i>\n </div>\n\n <div class=\"position-relative\" *ngIf=\"search\">\n <div class=\"d-flex flex-row\">\n <input [formControl]=\"control\" hidden />\n <input\n [id]=\"objectPath ? objectPath + '.' + id : id\"\n [name]=\"name\"\n class=\"form-control\"\n [(ngModel)]=\"currentValue\"\n [ngClass]=\"{ 'is-invalid': control?.invalid && control?.touched }\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onFocus()\"\n [required]=\"required\"\n [placeholder]=\"placeholder\"\n [autocomplete]=\"autocomplete ?? null\"\n [tabIndex]=\"tabIndex ?? null\"\n (keyup)=\"enterKey($event)\"\n />\n <button class=\"btn btn-primary\" (click)=\"openLink()\" *ngIf=\"creationLink\">Erstellen</button>\n </div>\n <div class=\"options\" *ngIf=\"objects && selectedElement\">\n <div class=\"option-item\" *ngFor=\"let object of filterOptions()\" (click)=\"set(object[valueField])\">\n {{ prepareNameField(object) }}\n </div>\n </div>\n </div>\n\n <div *ngIf=\"!search\">\n <div class=\"d-flex flex-row\">\n <select\n [id]=\"objectPath ? objectPath + '.' + id : id\"\n [name]=\"name\"\n class=\"form-select\"\n [attr.aria-label]=\"placeholder\"\n [formControl]=\"control\"\n [required]=\"required\"\n [tabIndex]=\"tabIndex ?? null\"\n [ngClass]=\"{ 'is-invalid': control?.invalid && control?.touched }\"\n >\n <option [ngValue]=\"null\" selected>{{ placeholder }}</option>\n <option *ngFor=\"let object of objects\" [ngValue]=\"object[valueField]\">\n {{ prepareNameField(object) }}\n </option>\n </select>\n <button class=\"btn btn-primary\" (click)=\"openLink()\" *ngIf=\"creationLink\">Erstellen</button>\n </div>\n </div>\n\n <div\n class=\"d-block invalid-feedback m-2\"\n *ngIf=\"control?.invalid && (control?.dirty || control?.touched) && !selectedElement\"\n >\n <div *ngIf=\"control?.errors?.['required']\">Dieses Feld ist ein Pflichtfeld.</div>\n <div *ngIf=\"control?.errors?.['invalidReference'] && currentValue\">\n {{ currentValue }} ist kein g\u00FCltiger Wert f\u00FCr {{ label }}.\n </div>\n <div *ngIf=\"control?.errors?.['minlength']\">\n Die Mindestl\u00E4nge f\u00FCr dieses Feld betr\u00E4gt\n {{control.errors?.['minlength']?.requiredLength}} Zeichen.\n </div>\n <div *ngIf=\"control?.errors?.['maxlength']\">\n Die maximale L\u00E4nge f\u00FCr dieses Feld betr\u00E4gt\n {{control.errors?.['maxlength']?.requiredLength}} Zeichen.\n </div>\n <div *ngIf=\"control?.errors?.['email']\">Bitte eine g\u00FCltige E-Mail Adresse angeben.</div>\n <div *ngIf=\"control?.errors?.['matching']\">Die Passw\u00F6rter m\u00FCssen \u00FCberein stimmen.</div>\n </div>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"isList\">\n <base-tags\n [id]=\"id\"\n [label]=\"label\"\n [name]=\"name\"\n [control]=\"control\"\n [required]=\"required\"\n [placeholder]=\"placeholder\"\n [custom]=\"false\"\n [options]=\"optionsForTagInput\"\n ></base-tags>\n</ng-container>\n", styles: [".options{position:absolute;display:block;top:100%;left:0;right:0;border-top:0;background-color:#fff;box-shadow:0 2px 5px #00000029,0 2px 10px #0000001f;transition:all .5s;z-index:999;max-height:200px;overflow-y:scroll}.options .option-item{padding:10px;cursor:pointer}.options .option-item:hover{color:var(--bs-primary)}\n"], dependencies: [{ kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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: i3.NgbTooltip, selector: "[ngbTooltip]", inputs: ["animation", "autoClose", "placement", "popperOptions", "triggers", "positionTarget", "container", "disableTooltip", "tooltipClass", "openDelay", "closeDelay", "ngbTooltip"], outputs: ["shown", "hidden"], exportAs: ["ngbTooltip"] }, { kind: "component", type: TagsComponent, selector: "base-tags", inputs: ["id", "name", "infoText", "label", "placeholder", "autocomplete", "tabIndex", "control", "options", "custom", "removeByKey", "required", "objectPath", "validators"] }] });
|
|
1282
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RefenceInputComponent, decorators: [{
|
|
1283
|
-
type: Component,
|
|
1284
|
-
args: [{ selector: 'base-refence-input', template: "<ng-container *ngIf=\"!isList\">\n <div class=\"form-group mb-3\">\n <div class=\"d-flex justify-content-between align-items-center\">\n <label [for]=\"id\" class=\"form-label\" [ngClass]=\"{ required: required }\" *ngIf=\"label\">{{ label }}</label>\n <i class=\"bi bi-info-circle\" [ngbTooltip]=\"infoText\" placement=\"start\" *ngIf=\"infoText\"></i>\n </div>\n\n <div class=\"position-relative\" *ngIf=\"search\">\n <div class=\"d-flex flex-row\">\n <input [formControl]=\"control\" hidden />\n <input\n [id]=\"objectPath ? objectPath + '.' + id : id\"\n [name]=\"name\"\n class=\"form-control\"\n [(ngModel)]=\"currentValue\"\n [ngClass]=\"{ 'is-invalid': control?.invalid && control?.touched }\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onFocus()\"\n [required]=\"required\"\n [placeholder]=\"placeholder\"\n [autocomplete]=\"autocomplete ?? null\"\n [tabIndex]=\"tabIndex ?? null\"\n (keyup)=\"enterKey($event)\"\n />\n <button class=\"btn btn-primary\" (click)=\"openLink()\" *ngIf=\"creationLink\">Erstellen</button>\n </div>\n <div class=\"options\" *ngIf=\"objects && selectedElement\">\n <div class=\"option-item\" *ngFor=\"let object of filterOptions()\" (click)=\"set(object[valueField])\">\n {{ prepareNameField(object) }}\n </div>\n </div>\n </div>\n\n <div *ngIf=\"!search\">\n <div class=\"d-flex flex-row\">\n <select\n [id]=\"objectPath ? objectPath + '.' + id : id\"\n [name]=\"name\"\n class=\"form-select\"\n [attr.aria-label]=\"placeholder\"\n [formControl]=\"control\"\n [required]=\"required\"\n [tabIndex]=\"tabIndex ?? null\"\n [ngClass]=\"{ 'is-invalid': control?.invalid && control?.touched }\"\n >\n <option [ngValue]=\"null\" selected>{{ placeholder }}</option>\n <option *ngFor=\"let object of objects\" [ngValue]=\"object[valueField]\">\n {{ prepareNameField(object) }}\n </option>\n </select>\n <button class=\"btn btn-primary\" (click)=\"openLink()\" *ngIf=\"creationLink\">Erstellen</button>\n </div>\n </div>\n\n <div\n class=\"d-block invalid-feedback m-2\"\n *ngIf=\"control?.invalid && (control?.dirty || control?.touched) && !selectedElement\"\n >\n <div *ngIf=\"control?.errors?.['required']\">Dieses Feld ist ein Pflichtfeld.</div>\n <div *ngIf=\"control?.errors?.['invalidReference'] && currentValue\">\n {{ currentValue }} ist kein g\u00FCltiger Wert f\u00FCr {{ label }}.\n </div>\n <div *ngIf=\"control?.errors?.['minlength']\">\n Die Mindestl\u00E4nge f\u00FCr dieses Feld betr\u00E4gt\n {{control.errors?.['minlength']?.requiredLength}} Zeichen.\n </div>\n <div *ngIf=\"control?.errors?.['maxlength']\">\n Die maximale L\u00E4nge f\u00FCr dieses Feld betr\u00E4gt\n {{control.errors?.['maxlength']?.requiredLength}} Zeichen.\n </div>\n <div *ngIf=\"control?.errors?.['email']\">Bitte eine g\u00FCltige E-Mail Adresse angeben.</div>\n <div *ngIf=\"control?.errors?.['matching']\">Die Passw\u00F6rter m\u00FCssen \u00FCberein stimmen.</div>\n </div>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"isList\">\n <base-tags\n [id]=\"id\"\n [label]=\"label\"\n [name]=\"name\"\n [control]=\"control\"\n [required]=\"required\"\n [placeholder]=\"placeholder\"\n [custom]=\"false\"\n [options]=\"optionsForTagInput\"\n ></base-tags>\n</ng-container>\n", styles: [".options{position:absolute;display:block;top:100%;left:0;right:0;border-top:0;background-color:#fff;box-shadow:0 2px 5px #00000029,0 2px 10px #0000001f;transition:all .5s;z-index:999;max-height:200px;overflow-y:scroll}.options .option-item{padding:10px;cursor:pointer}.options .option-item:hover{color:var(--bs-primary)}\n"] }]
|
|
1285
|
-
}], ctorParameters: function () { return [{ type: i1$1.GraphQLService }, { type: i2$1.Router }]; }, propDecorators: { id: [{
|
|
1286
|
-
type: Input
|
|
1287
|
-
}], name: [{
|
|
1288
|
-
type: Input
|
|
1289
|
-
}], infoText: [{
|
|
1290
|
-
type: Input
|
|
1291
|
-
}], label: [{
|
|
1292
|
-
type: Input
|
|
1293
|
-
}], isList: [{
|
|
1294
|
-
type: Input
|
|
1295
|
-
}], search: [{
|
|
1296
|
-
type: Input
|
|
1297
|
-
}], useParamAsArg: [{
|
|
1298
|
-
type: Input
|
|
1299
|
-
}], param: [{
|
|
1300
|
-
type: Input
|
|
1301
|
-
}], placeholder: [{
|
|
1302
|
-
type: Input
|
|
1303
|
-
}], autocomplete: [{
|
|
1304
|
-
type: Input
|
|
1305
|
-
}], tabIndex: [{
|
|
1306
|
-
type: Input
|
|
1307
|
-
}], control: [{
|
|
1308
|
-
type: Input
|
|
1309
|
-
}], required: [{
|
|
1310
|
-
type: Input
|
|
1311
|
-
}], method: [{
|
|
1312
|
-
type: Input
|
|
1313
|
-
}], fields: [{
|
|
1314
|
-
type: Input
|
|
1315
|
-
}], valueField: [{
|
|
1316
|
-
type: Input
|
|
1317
|
-
}], objectPath: [{
|
|
1318
|
-
type: Input
|
|
1319
|
-
}], nameField: [{
|
|
1320
|
-
type: Input
|
|
1321
|
-
}], creationLink: [{
|
|
1322
|
-
type: Input
|
|
1323
|
-
}] } });
|
|
1324
|
-
|
|
1325
|
-
class ModelFormSubComponent {
|
|
1326
|
-
constructor(authService) {
|
|
1327
|
-
this.authService = authService;
|
|
1328
|
-
this.imageChanged = new EventEmitter();
|
|
1329
|
-
this.fileChanged = new EventEmitter();
|
|
1330
|
-
this.keys = [];
|
|
1331
|
-
}
|
|
1332
|
-
ngOnInit() {
|
|
1333
|
-
// Get keys
|
|
1334
|
-
const unsortedKeys = Object.keys(this.fields);
|
|
1335
|
-
// Sort keys by config order
|
|
1336
|
-
this.keys = unsortedKeys.sort((a, b) => {
|
|
1337
|
-
var _a, _b, _c, _d;
|
|
1338
|
-
return ((((_a = this.config[a]) === null || _a === void 0 ? void 0 : _a.order) ? (_b = this.config[a]) === null || _b === void 0 ? void 0 : _b.order : 99) - (((_c = this.config[b]) === null || _c === void 0 ? void 0 : _c.order) ? (_d = this.config[b]) === null || _d === void 0 ? void 0 : _d.order : 99));
|
|
1339
|
-
});
|
|
1340
|
-
// Set user for roles check
|
|
1341
|
-
this.user = BasicUser.map(this.authService.currentUser);
|
|
1342
|
-
if (this.parentKey) {
|
|
1343
|
-
if (!this.objectPath) {
|
|
1344
|
-
this.objectPath = this.parentKey;
|
|
1345
|
-
}
|
|
1346
|
-
else {
|
|
1347
|
-
this.objectPath = this.objectPath + '.' + this.parentKey;
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1350
|
-
}
|
|
1351
|
-
/**
|
|
1352
|
-
* If the field has fields, return true, otherwise return false.
|
|
1353
|
-
*/
|
|
1354
|
-
checkFieldHasFields(field) {
|
|
1355
|
-
var _a;
|
|
1356
|
-
return ((_a = Object.keys(field.fields)) === null || _a === void 0 ? void 0 : _a.length) !== 0;
|
|
1357
|
-
}
|
|
1358
|
-
/**
|
|
1359
|
-
* It takes a string, capitalizes the first letter, and returns the new string
|
|
1360
|
-
*
|
|
1361
|
-
* @param value - The string that you want to capitalize the first letter of.
|
|
1362
|
-
* @returns The first letter of the string is being capitalized and the rest of the string is being returned.
|
|
1363
|
-
*/
|
|
1364
|
-
capitalizeFirstLetter(value) {
|
|
1365
|
-
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
1366
|
-
}
|
|
1367
|
-
/**
|
|
1368
|
-
* It takes an array of values and returns an array of objects with a value and text property
|
|
1369
|
-
*
|
|
1370
|
-
* @param values - any[] - the array of values that you want to convert to a selectable list
|
|
1371
|
-
* @param config
|
|
1372
|
-
* @returns An array of objects with a value and text property.
|
|
1373
|
-
*/
|
|
1374
|
-
prepareEnumForSelect(values, config = {}) {
|
|
1375
|
-
return values
|
|
1376
|
-
.filter((i) => {
|
|
1377
|
-
var _a, _b;
|
|
1378
|
-
return !(config && ((_a = config[i]) === null || _a === void 0 ? void 0 : _a.roles) && !this.user.hasAllRoles((_b = config[i]) === null || _b === void 0 ? void 0 : _b.roles));
|
|
1379
|
-
})
|
|
1380
|
-
.map((e) => {
|
|
1381
|
-
var _a;
|
|
1382
|
-
return {
|
|
1383
|
-
value: e,
|
|
1384
|
-
text: config && ((_a = config[e]) === null || _a === void 0 ? void 0 : _a.text) ? config[e].text : e,
|
|
1385
|
-
};
|
|
1386
|
-
});
|
|
1387
|
-
}
|
|
1388
|
-
/**
|
|
1389
|
-
* It takes an AbstractControl and returns a FormControl
|
|
1390
|
-
*
|
|
1391
|
-
* @param control - AbstractControl | null | undefined
|
|
1392
|
-
* @returns A FormControl
|
|
1393
|
-
*/
|
|
1394
|
-
transformToControl(control) {
|
|
1395
|
-
return control;
|
|
1396
|
-
}
|
|
1397
|
-
}
|
|
1398
|
-
ModelFormSubComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ModelFormSubComponent, deps: [{ token: i1$1.AuthService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1399
|
-
ModelFormSubComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ModelFormSubComponent, selector: "base-model-form-sub", inputs: { id: "id", parentKey: "parentKey", fields: "fields", form: "form", config: "config" }, outputs: { imageChanged: "imageChanged", fileChanged: "fileChanged" }, ngImport: i0, template: "<div class=\"mt-3\" *ngFor=\"let key of keys\">\n <ng-container\n *ngIf=\"checkFieldHasFields(fields[key]) && (config[key]?.roles ? user?.hasAllRoles(config[key]?.roles) : true)\"\n >\n <fieldset class=\"border rounded-3 p-3 mt-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 [parentKey]=\"key\"\n [fields]=\"fields[key].fields\"\n [config]=\"config[key]?.fields || {}\"\n [form]=\"form.get(key)\"\n (imageChanged)=\"imageChanged.emit($event)\"\n (fileChanged)=\"fileChanged.emit($event)\"\n ></base-model-form-sub>\n </fieldset>\n </ng-container>\n\n <ng-container\n *ngIf=\"!checkFieldHasFields(fields[key]) && (config[key]?.roles ? user?.hasAllRoles(config[key]?.roles) : true)\"\n >\n <ng-container *ngIf=\"fields[key]?.isEnum && !config[key]?.exclude\">\n <base-select\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || 'Bitte einen Wert ausw\u00E4hlen'\"\n [options]=\"prepareEnumForSelect(fields[key]?.validEnums, config[key]?.enumValues)\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\"\n [objectPath]=\"objectPath\"\n ></base-select>\n </ng-container>\n\n <ng-container *ngIf=\"!fields[key]?.isEnum && !config[key]?.exclude\">\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 [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [validators]=\"config[key]?.validators\"\n [objectPath]=\"objectPath\"\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 [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\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]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\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 [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\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 [defaultDragText]=\"config[key]?.dragText || 'Drag & Drop'\"\n [defaultReleaseText]=\"config[key]?.releaseText || 'Loslassen zum hochladen'\"\n [preButtonText]=\"config[key]?.preButtonText || 'or'\"\n [buttonText]=\"config[key]?.buttonText || 'browse'\"\n [validExtensions]=\"config[key]?.validExtensions || ['image/jpeg', 'image/jpg', 'image/png', 'image/webp']\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [compressOptions]=\"config[key]?.compressOptions\"\n [croppingOptions]=\"config[key]?.croppingOptions\"\n [croppingImage]=\"config[key]?.croppingImage\"\n [maxSize]=\"config[key]?.maxSize\"\n [uploadDirectly]=\"false\"\n [objectPath]=\"objectPath\"\n [mode]=\"config[key]?.imageMode || 'base64'\"\n (fileChanged)=\"fileChanged.emit($event)\"\n (imageDeleted)=\"imageChanged.emit(key)\"\n (imageUploaded)=\"imageChanged.emit(key)\"\n ></base-upload-image>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Upload'\">\n <base-upload-image\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [supportText]=\"config[key]?.supportText || 'Unterst\u00FCtzte Formate: JPEG, JPG, PNG'\"\n [defaultDragText]=\"config[key]?.dragText || 'Drag & Drop'\"\n [defaultReleaseText]=\"config[key]?.releaseText || 'Loslassen zum hochladen'\"\n [preButtonText]=\"config[key]?.preButtonText || 'or'\"\n [buttonText]=\"config[key]?.buttonText || 'browse'\"\n [validExtensions]=\"config[key]?.validExtensions || ['image/jpeg', 'image/jpg', 'image/png', 'image/webp']\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [compressOptions]=\"config[key]?.compressOptions\"\n [maxSize]=\"config[key]?.maxSize\"\n [objectPath]=\"objectPath\"\n [mode]=\"'file'\"\n ></base-upload-image>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Reference'\">\n <base-refence-input\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [isList]=\"fields[key]?.isList\"\n [useParamAsArg]=\"config[key]?.useParamAsArg ?? false\"\n [param]=\"id\"\n [search]=\"config[key]?.searchable ?? true\"\n [placeholder]=\"config[key]?.placeholder || 'Bitte einen Wert ausw\u00E4hlen'\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [method]=\"config[key]?.method || 'find'\"\n [fields]=\"config[key]?.requestFields || ['id', 'name']\"\n [valueField]=\"config[key]?.valueField || 'id'\"\n [nameField]=\"config[key]?.nameField || 'name'\"\n [creationLink]=\"config[key]?.creationLink || ''\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-refence-input>\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]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-checkbox>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'LongText'\">\n <base-textarea\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-textarea>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Float'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\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]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-input>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Password'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [type]=\"'password'\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-input>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Color'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [type]=\"'color'\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-input>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'URL'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\n [type]=\"'url'\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-input>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Email'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\n [type]=\"'email'\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-input>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'DateTime'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\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]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-input>\n </ng-container>\n </ng-container>\n </ng-container>\n </ng-container>\n</div>\n", styles: [""], 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: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: InputComponent, selector: "base-input", inputs: ["id", "name", "infoText", "label", "placeholder", "autocomplete", "tabIndex", "control", "type", "required", "eyeButton", "objectPath"], outputs: ["enter"] }, { kind: "component", type: SelectComponent, selector: "base-select", inputs: ["id", "name", "infoText", "label", "placeholder", "objectPath", "control", "tabIndex", "required", "multiple", "search", "options"] }, { kind: "component", type: CheckboxComponent, selector: "base-checkbox", inputs: ["id", "name", "label", "value", "control", "required", "objectPath"] }, { kind: "component", type: TextareaComponent, selector: "base-textarea", inputs: ["id", "name", "infoText", "label", "placeholder", "control", "rows", "required", "autoHeight", "tabIndex", "objectPath"] }, { kind: "component", type: TagsComponent, selector: "base-tags", inputs: ["id", "name", "infoText", "label", "placeholder", "autocomplete", "tabIndex", "control", "options", "custom", "removeByKey", "required", "objectPath", "validators"] }, { kind: "component", type: ModelFormSubComponent, selector: "base-model-form-sub", inputs: ["id", "parentKey", "fields", "form", "config"], outputs: ["imageChanged", "fileChanged"] }, { kind: "component", type: UploadImageComponent, selector: "base-upload-image", inputs: ["id", "name", "infoText", "label", "supportText", "required", "defaultDragText", "defaultReleaseText", "preButtonText", "buttonText", "validExtensions", "control", "url", "uploadPath", "deletePath", "path", "compressOptions", "maxSize", "uploadDirectly", "croppingImage", "croppingOptions", "objectPath", "mode"], outputs: ["imageUploaded", "imageDeleted", "fileChanged"] }, { kind: "component", type: RefenceInputComponent, selector: "base-refence-input", inputs: ["id", "name", "infoText", "label", "isList", "search", "useParamAsArg", "param", "placeholder", "autocomplete", "tabIndex", "control", "required", "method", "fields", "valueField", "objectPath", "nameField", "creationLink"] }] });
|
|
1400
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ModelFormSubComponent, decorators: [{
|
|
1401
|
-
type: Component,
|
|
1402
|
-
args: [{ selector: 'base-model-form-sub', template: "<div class=\"mt-3\" *ngFor=\"let key of keys\">\n <ng-container\n *ngIf=\"checkFieldHasFields(fields[key]) && (config[key]?.roles ? user?.hasAllRoles(config[key]?.roles) : true)\"\n >\n <fieldset class=\"border rounded-3 p-3 mt-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 [parentKey]=\"key\"\n [fields]=\"fields[key].fields\"\n [config]=\"config[key]?.fields || {}\"\n [form]=\"form.get(key)\"\n (imageChanged)=\"imageChanged.emit($event)\"\n (fileChanged)=\"fileChanged.emit($event)\"\n ></base-model-form-sub>\n </fieldset>\n </ng-container>\n\n <ng-container\n *ngIf=\"!checkFieldHasFields(fields[key]) && (config[key]?.roles ? user?.hasAllRoles(config[key]?.roles) : true)\"\n >\n <ng-container *ngIf=\"fields[key]?.isEnum && !config[key]?.exclude\">\n <base-select\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || 'Bitte einen Wert ausw\u00E4hlen'\"\n [options]=\"prepareEnumForSelect(fields[key]?.validEnums, config[key]?.enumValues)\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\"\n [objectPath]=\"objectPath\"\n ></base-select>\n </ng-container>\n\n <ng-container *ngIf=\"!fields[key]?.isEnum && !config[key]?.exclude\">\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 [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [validators]=\"config[key]?.validators\"\n [objectPath]=\"objectPath\"\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 [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\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]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\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 [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\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 [defaultDragText]=\"config[key]?.dragText || 'Drag & Drop'\"\n [defaultReleaseText]=\"config[key]?.releaseText || 'Loslassen zum hochladen'\"\n [preButtonText]=\"config[key]?.preButtonText || 'or'\"\n [buttonText]=\"config[key]?.buttonText || 'browse'\"\n [validExtensions]=\"config[key]?.validExtensions || ['image/jpeg', 'image/jpg', 'image/png', 'image/webp']\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [compressOptions]=\"config[key]?.compressOptions\"\n [croppingOptions]=\"config[key]?.croppingOptions\"\n [croppingImage]=\"config[key]?.croppingImage\"\n [maxSize]=\"config[key]?.maxSize\"\n [uploadDirectly]=\"false\"\n [objectPath]=\"objectPath\"\n [mode]=\"config[key]?.imageMode || 'base64'\"\n (fileChanged)=\"fileChanged.emit($event)\"\n (imageDeleted)=\"imageChanged.emit(key)\"\n (imageUploaded)=\"imageChanged.emit(key)\"\n ></base-upload-image>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Upload'\">\n <base-upload-image\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [supportText]=\"config[key]?.supportText || 'Unterst\u00FCtzte Formate: JPEG, JPG, PNG'\"\n [defaultDragText]=\"config[key]?.dragText || 'Drag & Drop'\"\n [defaultReleaseText]=\"config[key]?.releaseText || 'Loslassen zum hochladen'\"\n [preButtonText]=\"config[key]?.preButtonText || 'or'\"\n [buttonText]=\"config[key]?.buttonText || 'browse'\"\n [validExtensions]=\"config[key]?.validExtensions || ['image/jpeg', 'image/jpg', 'image/png', 'image/webp']\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [compressOptions]=\"config[key]?.compressOptions\"\n [maxSize]=\"config[key]?.maxSize\"\n [objectPath]=\"objectPath\"\n [mode]=\"'file'\"\n ></base-upload-image>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Reference'\">\n <base-refence-input\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [isList]=\"fields[key]?.isList\"\n [useParamAsArg]=\"config[key]?.useParamAsArg ?? false\"\n [param]=\"id\"\n [search]=\"config[key]?.searchable ?? true\"\n [placeholder]=\"config[key]?.placeholder || 'Bitte einen Wert ausw\u00E4hlen'\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [method]=\"config[key]?.method || 'find'\"\n [fields]=\"config[key]?.requestFields || ['id', 'name']\"\n [valueField]=\"config[key]?.valueField || 'id'\"\n [nameField]=\"config[key]?.nameField || 'name'\"\n [creationLink]=\"config[key]?.creationLink || ''\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-refence-input>\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]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-checkbox>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'LongText'\">\n <base-textarea\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-textarea>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Float'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\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]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-input>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Password'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [type]=\"'password'\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-input>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Color'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [type]=\"'color'\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-input>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'URL'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\n [type]=\"'url'\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-input>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'Email'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\n [label]=\"config[key]?.label ? config[key].label : capitalizeFirstLetter(key)\"\n [placeholder]=\"config[key]?.placeholder || ''\"\n [type]=\"'email'\"\n [control]=\"transformToControl(form?.get(key))\"\n [required]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-input>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'DateTime'\">\n <base-input\n [id]=\"key\"\n [name]=\"key\"\n [infoText]=\"config[key]?.infoText ? config[key].infoText : null\"\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]=\"\n config[key] && config[key]?.required !== undefined ? config[key]?.required : fields[key].isRequired\n \"\n [objectPath]=\"objectPath\"\n ></base-input>\n </ng-container>\n </ng-container>\n </ng-container>\n </ng-container>\n</div>\n" }]
|
|
1403
|
-
}], ctorParameters: function () { return [{ type: i1$1.AuthService }]; }, propDecorators: { id: [{
|
|
1404
|
-
type: Input
|
|
1405
|
-
}], parentKey: [{
|
|
1406
|
-
type: Input
|
|
1407
|
-
}], fields: [{
|
|
1408
|
-
type: Input
|
|
1409
|
-
}], form: [{
|
|
1410
|
-
type: Input
|
|
1411
|
-
}], config: [{
|
|
1412
|
-
type: Input
|
|
1413
|
-
}], imageChanged: [{
|
|
1414
|
-
type: Output
|
|
1415
|
-
}], fileChanged: [{
|
|
1416
|
-
type: Output
|
|
1417
|
-
}] } });
|
|
1418
|
-
|
|
1419
|
-
class FabButtonComponent {
|
|
1420
|
-
constructor() {
|
|
1421
|
-
this.fabIcon = 'bi-list';
|
|
1422
|
-
this.toggle = false;
|
|
1423
|
-
}
|
|
1424
|
-
}
|
|
1425
|
-
FabButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FabButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1426
|
-
FabButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: FabButtonComponent, selector: "base-fab-button", inputs: { fabIcon: "fabIcon", buttons: "buttons" }, ngImport: i0, template: "<div class=\"fab-container\" [ngClass]=\"{ 'fab-container-active': toggle }\">\n <div class=\"fab shadow\">\n <div class=\"fab-content\" (click)=\"toggle = !toggle\">\n <i class=\"bi bi-x-lg\" *ngIf=\"toggle\"></i>\n <i class=\"bi\" *ngIf=\"!toggle\" [ngClass]=\"fabIcon\"></i>\n </div>\n </div>\n <div\n class=\"sub-button shadow\"\n *ngFor=\"let button of buttons\"\n (click)=\"button.event.emit(true); toggle = !toggle\"\n [ngStyle]=\"{ backgroundColor: button.color }\"\n >\n <a [routerLink]=\"button.routerLink\">\n <i class=\"bi\" [ngClass]=\"button.icon\"></i>\n </a>\n </div>\n</div>\n", styles: [".fab-container{display:flex;flex-direction:column;justify-content:flex-end;align-items:center;-webkit-user-select:none;user-select:none;position:absolute;bottom:10px;right:10px}.fab-container-active{height:100%}.fab-container-active .sub-button:nth-child(2){transform:translateY(-80px)}.fab-container-active .sub-button:nth-child(3){transform:translateY(-140px)}.fab-container-active .sub-button:nth-child(4){transform:translateY(-200px)}.fab-container-active .sub-button:nth-child(5){transform:translateY(-260px)}.fab-container-active .sub-button:nth-child(6){transform:translateY(-320px)}.fab-container .fab{position:relative;height:60px;width:60px;background-color:var(--bs-primary);border-radius:50%;z-index:2}.fab-container .fab:before{content:\" \";position:absolute;bottom:0;right:0;height:30px;width:30px;background-color:inherit;border-radius:0 0 10px;z-index:-1}.fab-container .fab .fab-content{display:flex;align-items:center;justify-content:center;height:inherit;width:inherit;border-radius:50%}.fab-container .fab .fab-content .bi{color:#fff;font-size:32px}.fab-container .sub-button{position:absolute;display:flex;align-items:center;justify-content:center;bottom:10px;right:10px;height:40px;width:40px;background-color:var(--bs-primary);border-radius:50%;transition:all .3s ease}.fab-container .sub-button:hover{cursor:pointer}.fab-container .sub-button .bi{color:#fff;padding-top:6px}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }] });
|
|
1427
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FabButtonComponent, decorators: [{
|
|
1428
|
-
type: Component,
|
|
1429
|
-
args: [{ selector: 'base-fab-button', template: "<div class=\"fab-container\" [ngClass]=\"{ 'fab-container-active': toggle }\">\n <div class=\"fab shadow\">\n <div class=\"fab-content\" (click)=\"toggle = !toggle\">\n <i class=\"bi bi-x-lg\" *ngIf=\"toggle\"></i>\n <i class=\"bi\" *ngIf=\"!toggle\" [ngClass]=\"fabIcon\"></i>\n </div>\n </div>\n <div\n class=\"sub-button shadow\"\n *ngFor=\"let button of buttons\"\n (click)=\"button.event.emit(true); toggle = !toggle\"\n [ngStyle]=\"{ backgroundColor: button.color }\"\n >\n <a [routerLink]=\"button.routerLink\">\n <i class=\"bi\" [ngClass]=\"button.icon\"></i>\n </a>\n </div>\n</div>\n", styles: [".fab-container{display:flex;flex-direction:column;justify-content:flex-end;align-items:center;-webkit-user-select:none;user-select:none;position:absolute;bottom:10px;right:10px}.fab-container-active{height:100%}.fab-container-active .sub-button:nth-child(2){transform:translateY(-80px)}.fab-container-active .sub-button:nth-child(3){transform:translateY(-140px)}.fab-container-active .sub-button:nth-child(4){transform:translateY(-200px)}.fab-container-active .sub-button:nth-child(5){transform:translateY(-260px)}.fab-container-active .sub-button:nth-child(6){transform:translateY(-320px)}.fab-container .fab{position:relative;height:60px;width:60px;background-color:var(--bs-primary);border-radius:50%;z-index:2}.fab-container .fab:before{content:\" \";position:absolute;bottom:0;right:0;height:30px;width:30px;background-color:inherit;border-radius:0 0 10px;z-index:-1}.fab-container .fab .fab-content{display:flex;align-items:center;justify-content:center;height:inherit;width:inherit;border-radius:50%}.fab-container .fab .fab-content .bi{color:#fff;font-size:32px}.fab-container .sub-button{position:absolute;display:flex;align-items:center;justify-content:center;bottom:10px;right:10px;height:40px;width:40px;background-color:var(--bs-primary);border-radius:50%;transition:all .3s ease}.fab-container .sub-button:hover{cursor:pointer}.fab-container .sub-button .bi{color:#fff;padding-top:6px}\n"] }]
|
|
1430
|
-
}], propDecorators: { fabIcon: [{
|
|
1431
|
-
type: Input
|
|
1432
|
-
}], buttons: [{
|
|
1433
|
-
type: Input
|
|
1434
|
-
}] } });
|
|
1435
|
-
|
|
1436
|
-
/**
|
|
1437
|
-
* ModelFormComponent
|
|
1438
|
-
*
|
|
1439
|
-
* Hint for handling extensions of this component in project:
|
|
1440
|
-
* If you want to use complete custom services and methods, extend ModelFormBaseComponent instead of ModelFormComponent
|
|
1441
|
-
*/
|
|
1442
|
-
class ModelFormComponent {
|
|
1443
|
-
set loading(value) {
|
|
1444
|
-
if (!value) {
|
|
1445
|
-
setTimeout(() => {
|
|
1446
|
-
this._loading = value;
|
|
1447
|
-
}, 400);
|
|
1448
|
-
}
|
|
1449
|
-
else {
|
|
1450
|
-
this._loading = value;
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
constructor(graphQLMetaService, graphQLService, formsService, authService, router, route, cmsService, toastService, fileService) {
|
|
1454
|
-
this.graphQLMetaService = graphQLMetaService;
|
|
1455
|
-
this.graphQLService = graphQLService;
|
|
1456
|
-
this.formsService = formsService;
|
|
1457
|
-
this.authService = authService;
|
|
1458
|
-
this.router = router;
|
|
1459
|
-
this.route = route;
|
|
1460
|
-
this.cmsService = cmsService;
|
|
1461
|
-
this.toastService = toastService;
|
|
1462
|
-
this.fileService = fileService;
|
|
1463
|
-
this.delete = true;
|
|
1464
|
-
this.onlyUpdateMode = false;
|
|
1465
|
-
this.duplicate = false;
|
|
1466
|
-
this.logging = false;
|
|
1467
|
-
this.showFavButton = true;
|
|
1468
|
-
this.finished = new EventEmitter();
|
|
1469
|
-
this._loading = false;
|
|
1470
|
-
this.keys = [];
|
|
1471
|
-
this.fabButtons = [];
|
|
1472
|
-
}
|
|
1473
|
-
ngOnInit() {
|
|
1474
|
-
// Set user for roles check
|
|
1475
|
-
this.user = BasicUser.map(this.authService.currentUser);
|
|
1476
|
-
this.graphQLMetaService.getMeta().subscribe((meta) => {
|
|
1477
|
-
this.meta = meta;
|
|
1478
|
-
if (this.modelName) {
|
|
1479
|
-
this.init();
|
|
1480
|
-
}
|
|
1481
|
-
});
|
|
1482
|
-
this.initFabActions();
|
|
1483
|
-
}
|
|
1484
|
-
ngOnChanges(changes) {
|
|
1485
|
-
// Reinit form for new model or load and patch form with new id
|
|
1486
|
-
if (changes['modelName'] || changes['id']) {
|
|
1487
|
-
this.init();
|
|
1488
|
-
}
|
|
1489
|
-
}
|
|
1490
|
-
/**
|
|
1491
|
-
* > If the model name and metadata are present, set the operation to update or create, get the fields from the
|
|
1492
|
-
* metadata, create the form, and if the value is present, patch the form with the value
|
|
1493
|
-
*/
|
|
1494
|
-
init(id) {
|
|
1495
|
-
if (id) {
|
|
1496
|
-
this.id = id;
|
|
1497
|
-
}
|
|
1498
|
-
if (!this.id && this.onlyUpdateMode) {
|
|
1499
|
-
return;
|
|
1500
|
-
}
|
|
1501
|
-
if (this.modelName && this.meta) {
|
|
1502
|
-
this.operation = this.id ? 'update' : 'create';
|
|
1503
|
-
if (this.logging) {
|
|
1504
|
-
console.log('ModelFormComponent::init->operation', this.operation);
|
|
1505
|
-
console.log('ModelFormComponent::init->meta.getArgs', this.operation + this.capitalizeFirstLetter(this.modelName));
|
|
1506
|
-
}
|
|
1507
|
-
this.fields = this.meta.getArgs(this.operation + this.capitalizeFirstLetter(this.modelName), {
|
|
1508
|
-
type: GraphQLRequestType.MUTATION,
|
|
1509
|
-
}).fields;
|
|
1510
|
-
this.fields = this.fields['input'].fields;
|
|
1511
|
-
this.keys = Object.keys(this.fields);
|
|
1512
|
-
if (this.logging) {
|
|
1513
|
-
console.log('ModelFormComponent::init->id', this.id);
|
|
1514
|
-
console.log('ModelFormComponent::init->fields', this.fields);
|
|
1515
|
-
console.log('ModelFormComponent::init->keys', this.keys);
|
|
1516
|
-
}
|
|
1517
|
-
this.form = this.createForm(this.fields);
|
|
1518
|
-
if (this.id) {
|
|
1519
|
-
this.getObjectById(this.id);
|
|
1520
|
-
}
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
/**
|
|
1524
|
-
* It takes a key as an argument, and returns an array of keys from the sub-object
|
|
1525
|
-
*/
|
|
1526
|
-
getKeysFromSubObject(key) {
|
|
1527
|
-
return Object.keys(this.fields[key]);
|
|
1528
|
-
}
|
|
1529
|
-
/**
|
|
1530
|
-
* It takes an id, and then calls the graphQLService to get the object from the database
|
|
1531
|
-
*
|
|
1532
|
-
* @param id - The id of the object to be loaded
|
|
1533
|
-
*/
|
|
1534
|
-
getObjectById(id) {
|
|
1535
|
-
if (!id) {
|
|
1536
|
-
return;
|
|
1537
|
-
}
|
|
1538
|
-
if (this.logging) {
|
|
1539
|
-
console.log('ModelFormComponent::getObjectById->id', id);
|
|
1540
|
-
console.log('ModelFormComponent::getObjectById->requestFields', this.createRequestObject(this.fields));
|
|
1541
|
-
}
|
|
1542
|
-
this.graphQLService
|
|
1543
|
-
.graphQl('get' + this.capitalizeFirstLetter(this.modelName), {
|
|
1544
|
-
arguments: { id },
|
|
1545
|
-
fields: this.createRequestObject(this.fields),
|
|
1546
|
-
type: GraphQLRequestType.QUERY,
|
|
1547
|
-
})
|
|
1548
|
-
.subscribe({
|
|
1549
|
-
next: (response) => {
|
|
1550
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1551
|
-
if (this.logging) {
|
|
1552
|
-
console.log('ModelFormComponent::get->value', response);
|
|
1553
|
-
}
|
|
1554
|
-
this.object = response;
|
|
1555
|
-
this.form.patchValue(Object.assign({}, response));
|
|
1556
|
-
// Process patchFields for reference input
|
|
1557
|
-
for (const [key, value] of Object.entries(this.fields)) {
|
|
1558
|
-
if (((_a = this.nestedObject(key, this.fields)) === null || _a === void 0 ? void 0 : _a.type) === 'DateTime' ||
|
|
1559
|
-
((_b = this.nestedObject(key, this.config)) === null || _b === void 0 ? void 0 : _b.type) === 'DateTime') {
|
|
1560
|
-
this.form.get(key).patchValue(this.formatDate(this.nestedObject(key, response)));
|
|
1561
|
-
}
|
|
1562
|
-
// If it not an array
|
|
1563
|
-
if (((_c = this.nestedObject(key, this.config)) === null || _c === void 0 ? void 0 : _c.type) === 'Reference' &&
|
|
1564
|
-
!((_d = this.nestedObject(key, this.fields)) === null || _d === void 0 ? void 0 : _d.isList)) {
|
|
1565
|
-
if (this.form.get(key)) {
|
|
1566
|
-
this.form
|
|
1567
|
-
.get(key)
|
|
1568
|
-
.patchValue((_g = response[((_e = this.nestedObject(key, this.config)) === null || _e === void 0 ? void 0 : _e.patchField)
|
|
1569
|
-
? (_f = this.nestedObject(key, this.config)) === null || _f === void 0 ? void 0 : _f.patchField
|
|
1570
|
-
: key]) === null || _g === void 0 ? void 0 : _g.id);
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
// If value is an array
|
|
1574
|
-
if (((_h = this.nestedObject(key, this.config)) === null || _h === void 0 ? void 0 : _h.type) === 'Reference' &&
|
|
1575
|
-
((_j = this.nestedObject(key, this.fields)) === null || _j === void 0 ? void 0 : _j.isList)) {
|
|
1576
|
-
if (this.form.get(key)) {
|
|
1577
|
-
this.form
|
|
1578
|
-
.get(key)
|
|
1579
|
-
.patchValue((_m = response[((_k = this.nestedObject(key, this.config)) === null || _k === void 0 ? void 0 : _k.patchField)
|
|
1580
|
-
? (_l = this.nestedObject(key, this.config)) === null || _l === void 0 ? void 0 : _l.patchField
|
|
1581
|
-
: key]) === null || _m === void 0 ? void 0 : _m.map((e) => e === null || e === void 0 ? void 0 : e.id));
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
if (this.logging) {
|
|
1586
|
-
console.log('ModelFormComponent::getObjectById->patchedForm', this.form);
|
|
1587
|
-
}
|
|
1588
|
-
},
|
|
1589
|
-
error: (err) => {
|
|
1590
|
-
console.error('Error on load object', err);
|
|
1591
|
-
this.finished.emit(null);
|
|
1592
|
-
},
|
|
1593
|
-
});
|
|
1594
|
-
}
|
|
1595
|
-
/**
|
|
1596
|
-
* It takes a GraphQL type collection and returns an array of strings and objects
|
|
1597
|
-
*
|
|
1598
|
-
* @param fields - IGraphQLTypeCollection - This is the object that is returned from the
|
|
1599
|
-
* introspection query.
|
|
1600
|
-
* @returns An array of strings and objects.
|
|
1601
|
-
*/
|
|
1602
|
-
createRequestObject(fields) {
|
|
1603
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1604
|
-
const requestFields = [];
|
|
1605
|
-
for (const [key, value] of Object.entries(fields)) {
|
|
1606
|
-
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)) {
|
|
1607
|
-
continue;
|
|
1608
|
-
}
|
|
1609
|
-
if (((_d = Object.keys((_c = fields[key]) === null || _c === void 0 ? void 0 : _c.fields)) === null || _d === void 0 ? void 0 : _d.length) === 0) {
|
|
1610
|
-
if (((_e = this.config[key]) === null || _e === void 0 ? void 0 : _e.type) !== 'Reference') {
|
|
1611
|
-
requestFields.push(key);
|
|
1612
|
-
}
|
|
1613
|
-
else {
|
|
1614
|
-
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'] });
|
|
1615
|
-
}
|
|
1616
|
-
}
|
|
1617
|
-
else {
|
|
1618
|
-
const subkeys = this.createRequestObject(fields[key].fields);
|
|
1619
|
-
const resultObject = {};
|
|
1620
|
-
resultObject[key] = subkeys;
|
|
1621
|
-
requestFields.push(resultObject);
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1624
|
-
if (this.logging) {
|
|
1625
|
-
console.log('ModelFormComponent::createRequestObject->requestFields', requestFields);
|
|
1626
|
-
}
|
|
1627
|
-
return requestFields;
|
|
1628
|
-
}
|
|
1629
|
-
/**
|
|
1630
|
-
* It takes a collection of GraphQL types and creates a form group with a form control for each type
|
|
1631
|
-
*
|
|
1632
|
-
* @param fields - IGraphQLTypeCollection
|
|
1633
|
-
* @param parents
|
|
1634
|
-
*/
|
|
1635
|
-
createForm(fields, parents = []) {
|
|
1636
|
-
var _a;
|
|
1637
|
-
const group = {};
|
|
1638
|
-
let internParents = [...[], ...parents];
|
|
1639
|
-
for (const [key, value] of Object.entries(fields)) {
|
|
1640
|
-
if (((_a = Object.keys(value === null || value === void 0 ? void 0 : value.fields)) === null || _a === void 0 ? void 0 : _a.length) === 0) {
|
|
1641
|
-
group[key] = new UntypedFormControl(null, this.processValidators(this.nestedObject(internParents.length ? internParents.join('.') + '.' + key : key, this.config), value));
|
|
1642
|
-
}
|
|
1643
|
-
else {
|
|
1644
|
-
internParents.push(key);
|
|
1645
|
-
group[key] = this.createForm(fields[key].fields, internParents);
|
|
1646
|
-
internParents = [];
|
|
1647
|
-
}
|
|
1648
|
-
}
|
|
1649
|
-
if (this.logging) {
|
|
1650
|
-
console.log('ModelFormComponent::createForm->group', group);
|
|
1651
|
-
}
|
|
1652
|
-
return new UntypedFormGroup(group);
|
|
1653
|
-
}
|
|
1654
|
-
/**
|
|
1655
|
-
* Process form validators for control
|
|
1656
|
-
*/
|
|
1657
|
-
processValidators(config, value) {
|
|
1658
|
-
const validators = [];
|
|
1659
|
-
if (config) {
|
|
1660
|
-
if ((config === null || config === void 0 ? void 0 : config.required) !== undefined ? config === null || config === void 0 ? void 0 : config.required : value.isRequired) {
|
|
1661
|
-
validators.push(Validators.required);
|
|
1662
|
-
}
|
|
1663
|
-
if ((config === null || config === void 0 ? void 0 : config.type) === 'Email') {
|
|
1664
|
-
validators.push(fullEmail());
|
|
1665
|
-
}
|
|
1666
|
-
if ((config === null || config === void 0 ? void 0 : config.type) === 'Password') {
|
|
1667
|
-
validators.push(Validators.minLength(6));
|
|
1668
|
-
}
|
|
1669
|
-
if (typeof (config === null || config === void 0 ? void 0 : config.min) === 'number') {
|
|
1670
|
-
validators.push(Validators.min(config.min));
|
|
1671
|
-
}
|
|
1672
|
-
if (typeof (config === null || config === void 0 ? void 0 : config.max) === 'number') {
|
|
1673
|
-
validators.push(Validators.max(config.max));
|
|
1674
|
-
}
|
|
1675
|
-
if (Array.isArray(config === null || config === void 0 ? void 0 : config.validators)) {
|
|
1676
|
-
validators.push(...config === null || config === void 0 ? void 0 : config.validators);
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
return validators;
|
|
1680
|
-
}
|
|
1681
|
-
/**
|
|
1682
|
-
* It calls the graphQLService to delete the object with the id of the object that is currently being edited
|
|
1683
|
-
*/
|
|
1684
|
-
deleteObject() {
|
|
1685
|
-
this.cmsService.deleteObject(this.id, this.modelName).then(() => {
|
|
1686
|
-
this.toastService.show({
|
|
1687
|
-
id: this.modelName + '-success',
|
|
1688
|
-
type: ToastType.SUCCESS,
|
|
1689
|
-
title: 'Erfolgreich',
|
|
1690
|
-
description: this.label + ' wurde erfolgreich gelöscht.',
|
|
1691
|
-
});
|
|
1692
|
-
this.finished.emit(null);
|
|
1693
|
-
});
|
|
1694
|
-
}
|
|
1695
|
-
/**
|
|
1696
|
-
* It sends a GraphQL mutation to the server to duplicate the object
|
|
1697
|
-
*/
|
|
1698
|
-
duplicateObject() {
|
|
1699
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1700
|
-
this.cmsService.duplicateObject(this.id, this.modelName).then((value) => __awaiter(this, void 0, void 0, function* () {
|
|
1701
|
-
if (value === null || value === void 0 ? void 0 : value.id) {
|
|
1702
|
-
yield this.router.navigate(['../'], { relativeTo: this.route });
|
|
1703
|
-
this.toastService.show({
|
|
1704
|
-
id: this.modelName + '-success',
|
|
1705
|
-
type: ToastType.SUCCESS,
|
|
1706
|
-
title: 'Erfolgreich',
|
|
1707
|
-
description: this.label + ' wurde erfolgreich dupliziert.',
|
|
1708
|
-
});
|
|
1709
|
-
}
|
|
1710
|
-
else {
|
|
1711
|
-
this.finished.emit(null);
|
|
1712
|
-
}
|
|
1713
|
-
}));
|
|
1714
|
-
});
|
|
1715
|
-
}
|
|
1716
|
-
/**
|
|
1717
|
-
* It takes a string, capitalizes the first letter, and returns the modified string
|
|
1718
|
-
*
|
|
1719
|
-
* @param value - The string to capitalize.
|
|
1720
|
-
* @returns The first letter of the string is being capitalized and the rest of the string is being returned.
|
|
1721
|
-
*/
|
|
1722
|
-
capitalizeFirstLetter(value) {
|
|
1723
|
-
return this.cmsService.capitalizeFirstLetter(value);
|
|
1724
|
-
}
|
|
1725
|
-
/**
|
|
1726
|
-
* It takes an AbstractControl and returns a FormControl
|
|
1727
|
-
*
|
|
1728
|
-
* @param control - AbstractControl | null | undefined
|
|
1729
|
-
* @returns A FormControl
|
|
1730
|
-
*/
|
|
1731
|
-
transformToControl(control) {
|
|
1732
|
-
return control;
|
|
1733
|
-
}
|
|
1734
|
-
/**
|
|
1735
|
-
* It takes the key of the form control that has changed, gets the value of that form control, creates an object with the
|
|
1736
|
-
* key and value, and then sends that object to the GraphQL server to update the database
|
|
1737
|
-
*/
|
|
1738
|
-
imageChanged(key) {
|
|
1739
|
-
const data = {};
|
|
1740
|
-
data[key] = this.form.get(key).value;
|
|
1741
|
-
if (this.logging) {
|
|
1742
|
-
console.log('ModelFormComponent::imageChanged->body', data);
|
|
1743
|
-
}
|
|
1744
|
-
if (this.id) {
|
|
1745
|
-
try {
|
|
1746
|
-
this.graphQLService
|
|
1747
|
-
.graphQl('update' + this.capitalizeFirstLetter(this.modelName), {
|
|
1748
|
-
arguments: { id: this.id, input: data },
|
|
1749
|
-
fields: ['id'],
|
|
1750
|
-
type: GraphQLRequestType.MUTATION,
|
|
1751
|
-
})
|
|
1752
|
-
.subscribe({
|
|
1753
|
-
next: (value) => {
|
|
1754
|
-
if (this.logging) {
|
|
1755
|
-
console.log('ModelFormComponent::imageChanged->success', value);
|
|
1756
|
-
}
|
|
1757
|
-
},
|
|
1758
|
-
});
|
|
1759
|
-
}
|
|
1760
|
-
catch (e) {
|
|
1761
|
-
if (this.logging) {
|
|
1762
|
-
console.log('ModelFormComponent::imageChanged->error', e);
|
|
1763
|
-
}
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
/**
|
|
1768
|
-
* It takes the form, validates it, and then sends it to the GraphQL server
|
|
1769
|
-
*
|
|
1770
|
-
* @returns The id of the newly created or updated object.
|
|
1771
|
-
*/
|
|
1772
|
-
submit(secret = false) {
|
|
1773
|
-
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
1774
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1775
|
-
if (!secret) {
|
|
1776
|
-
this.loading = true;
|
|
1777
|
-
}
|
|
1778
|
-
if (this.form.invalid && !secret) {
|
|
1779
|
-
this.formsService.validateAllFormFields(this.form);
|
|
1780
|
-
this.formsService.scrollToInvalidControl(this.form);
|
|
1781
|
-
this.loading = false;
|
|
1782
|
-
resolve(null);
|
|
1783
|
-
return;
|
|
1784
|
-
}
|
|
1785
|
-
if (this.operation === 'update' && !this.id) {
|
|
1786
|
-
console.error('ID is missing for update!');
|
|
1787
|
-
this.loading = false;
|
|
1788
|
-
resolve(null);
|
|
1789
|
-
return;
|
|
1790
|
-
}
|
|
1791
|
-
if (this.logging) {
|
|
1792
|
-
console.log('ModelFormComponent::submit->formValue', this.form.value);
|
|
1793
|
-
}
|
|
1794
|
-
// Prepare data for server request
|
|
1795
|
-
let data = Object.assign({}, this.form.value);
|
|
1796
|
-
data = this.prepareDataForRequest(this.config, this.fields, data);
|
|
1797
|
-
if (this.logging) {
|
|
1798
|
-
console.log('ModelFormComponent::submit->valueToGraphql', data);
|
|
1799
|
-
console.log('ModelFormComponent::submit->fileChanges', this.fileChanges);
|
|
1800
|
-
}
|
|
1801
|
-
if ((_a = this.fileChanges) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1802
|
-
for (const fileChange of this.fileChanges) {
|
|
1803
|
-
const key = fileChange.field;
|
|
1804
|
-
const config = this.nestedObject(key, this.config);
|
|
1805
|
-
if (fileChange.file) {
|
|
1806
|
-
// Upload
|
|
1807
|
-
const value = this.form.get(key).value;
|
|
1808
|
-
// Check if file is an ID or a base64 string
|
|
1809
|
-
if (typeof value === 'string') {
|
|
1810
|
-
// Delete if ID
|
|
1811
|
-
if (!((_b = this.form.get(key).value) === null || _b === void 0 ? void 0 : _b.startsWith('data:'))) {
|
|
1812
|
-
const deleteResult = yield this.fileService.delete((_c = this.nestedObject(key, this.config)) === null || _c === void 0 ? void 0 : _c.url, ((_d = this.nestedObject(key, this.config)) === null || _d === void 0 ? void 0 : _d.deletePath) || '/files/', this.nestedObject(key, this.object));
|
|
1813
|
-
if (deleteResult) {
|
|
1814
|
-
this.nestedObject(key, data, '');
|
|
1815
|
-
}
|
|
1816
|
-
}
|
|
1817
|
-
const uploadResult = yield this.fileService.upload((_e = this.nestedObject(key, this.config)) === null || _e === void 0 ? void 0 : _e.url, ((_f = this.nestedObject(key, this.config)) === null || _f === void 0 ? void 0 : _f.uploadPath) || '/files/upload', fileChange.file);
|
|
1818
|
-
if (uploadResult === null || uploadResult === void 0 ? void 0 : uploadResult.id) {
|
|
1819
|
-
this.nestedObject(key, data, uploadResult.id);
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
else if ((config === null || config === void 0 ? void 0 : config.imageMode) && (config === null || config === void 0 ? void 0 : config.imageMode) !== 'file') {
|
|
1823
|
-
// Delete
|
|
1824
|
-
const result = yield this.fileService.delete(config === null || config === void 0 ? void 0 : config.url, ((_g = this.nestedObject(key, this.config)) === null || _g === void 0 ? void 0 : _g.deletePath) || '/files/', this.nestedObject(key, this.object));
|
|
1825
|
-
if (result) {
|
|
1826
|
-
this.nestedObject(key, data, '');
|
|
1827
|
-
}
|
|
1828
|
-
}
|
|
1829
|
-
}
|
|
1830
|
-
}
|
|
1831
|
-
}
|
|
1832
|
-
this.graphQLService
|
|
1833
|
-
.graphQl(this.operation + this.capitalizeFirstLetter(this.modelName), {
|
|
1834
|
-
arguments: this.operation === 'update' ? { id: this.id, input: data } : { input: data },
|
|
1835
|
-
fields: ['id'],
|
|
1836
|
-
type: GraphQLRequestType.MUTATION,
|
|
1837
|
-
})
|
|
1838
|
-
.subscribe({
|
|
1839
|
-
next: (value) => {
|
|
1840
|
-
if (!secret) {
|
|
1841
|
-
this.loading = false;
|
|
1842
|
-
this.finished.emit(null);
|
|
1843
|
-
this.toastService.show({
|
|
1844
|
-
id: this.modelName + '-success',
|
|
1845
|
-
type: ToastType.SUCCESS,
|
|
1846
|
-
title: 'Erfolgreich',
|
|
1847
|
-
description: this.label + ' wurde erfolgreich ' + (this.operation === 'create' ? 'erstellt.' : 'aktualisiert.'),
|
|
1848
|
-
});
|
|
1849
|
-
}
|
|
1850
|
-
resolve(value);
|
|
1851
|
-
},
|
|
1852
|
-
error: (err) => {
|
|
1853
|
-
if (!secret) {
|
|
1854
|
-
console.error('Failed on ' + this.operation, err);
|
|
1855
|
-
this.loading = false;
|
|
1856
|
-
this.toastService.show({
|
|
1857
|
-
id: this.modelName + '-success',
|
|
1858
|
-
type: ToastType.ERROR,
|
|
1859
|
-
description: 'Beim ' +
|
|
1860
|
-
(this.operation === 'create' ? 'erstellen' : 'aktualisieren') +
|
|
1861
|
-
' von ' +
|
|
1862
|
-
this.label +
|
|
1863
|
-
' ist etwas schiefgelaufen.',
|
|
1864
|
-
});
|
|
1865
|
-
}
|
|
1866
|
-
reject();
|
|
1867
|
-
},
|
|
1868
|
-
});
|
|
1869
|
-
}));
|
|
1870
|
-
}
|
|
1871
|
-
/**
|
|
1872
|
-
* Prepare data for server
|
|
1873
|
-
*/
|
|
1874
|
-
prepareDataForRequest(config, fieldsConfig, data) {
|
|
1875
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1876
|
-
if (!data) {
|
|
1877
|
-
return data;
|
|
1878
|
-
}
|
|
1879
|
-
for (const [key, value] of Object.entries(data)) {
|
|
1880
|
-
if ((((_a = this.fields[key]) === null || _a === void 0 ? void 0 : _a.type) === 'DateTime' || ((_b = this.config[key]) === null || _b === void 0 ? void 0 : _b.type) === 'DateTime') && value === '') {
|
|
1881
|
-
data[key] = null;
|
|
1882
|
-
continue;
|
|
1883
|
-
}
|
|
1884
|
-
if ((((_c = config[key]) === null || _c === void 0 ? void 0 : _c.roles) ? !this.user.hasAllRoles((_d = config[key]) === null || _d === void 0 ? void 0 : _d.roles) : false) || ((_e = config[key]) === null || _e === void 0 ? void 0 : _e.exclude)) {
|
|
1885
|
-
delete data[key];
|
|
1886
|
-
continue;
|
|
1887
|
-
}
|
|
1888
|
-
if (value && typeof value === 'object' && !Array.isArray(value) && ((_f = this.fields[key]) === null || _f === void 0 ? void 0 : _f.type) !== 'Upload') {
|
|
1889
|
-
data[key] = Object.keys(data[key])
|
|
1890
|
-
.filter((k) => data[key][k] != null)
|
|
1891
|
-
.reduce((a, k) => (Object.assign(Object.assign({}, a), { [k]: data[key][k] })), {});
|
|
1892
|
-
if (((_g = Object.keys(data[key])) === null || _g === void 0 ? void 0 : _g.length) === 0) {
|
|
1893
|
-
if (this.logging) {
|
|
1894
|
-
console.log('Object is empty from result');
|
|
1895
|
-
}
|
|
1896
|
-
data[key] = null;
|
|
1897
|
-
}
|
|
1898
|
-
}
|
|
1899
|
-
// Set type for graphql method
|
|
1900
|
-
if (((_h = fieldsConfig[key]) === null || _h === void 0 ? void 0 : _h.type) === 'Float') {
|
|
1901
|
-
if (value) {
|
|
1902
|
-
data[key] = Number(value);
|
|
1903
|
-
}
|
|
1904
|
-
else {
|
|
1905
|
-
data[key] = null;
|
|
1906
|
-
}
|
|
1907
|
-
}
|
|
1908
|
-
if (((_j = fieldsConfig[key]) === null || _j === void 0 ? void 0 : _j.fields) && Object.keys((_k = fieldsConfig[key]) === null || _k === void 0 ? void 0 : _k.fields).length > 0) {
|
|
1909
|
-
data[key] = this.prepareDataForRequest((_l = config[key]) === null || _l === void 0 ? void 0 : _l.fields, (_m = fieldsConfig[key]) === null || _m === void 0 ? void 0 : _m.fields, data[key]);
|
|
1910
|
-
}
|
|
1911
|
-
}
|
|
1912
|
-
return data;
|
|
1913
|
-
}
|
|
1914
|
-
/**
|
|
1915
|
-
* Init fab buttons for mobile devices
|
|
1916
|
-
*/
|
|
1917
|
-
initFabActions() {
|
|
1918
|
-
const saveEvent = new EventEmitter();
|
|
1919
|
-
this.fabButtons.push({ icon: 'bi-check-lg', color: 'var(--bs-success)', event: saveEvent });
|
|
1920
|
-
saveEvent.subscribe(() => this.submit(false));
|
|
1921
|
-
if (this.duplicate && this.operation === 'update') {
|
|
1922
|
-
const event = new EventEmitter();
|
|
1923
|
-
this.fabButtons.push({ icon: 'bi-back', color: 'var(--bs-info)', event });
|
|
1924
|
-
event.subscribe(() => this.duplicateObject());
|
|
1925
|
-
}
|
|
1926
|
-
if (this.operation === 'update' && this.delete) {
|
|
1927
|
-
const event = new EventEmitter();
|
|
1928
|
-
this.fabButtons.push({ icon: 'bi-trash3', color: 'var(--bs-danger)', event });
|
|
1929
|
-
event.subscribe(() => this.deleteObject());
|
|
1930
|
-
}
|
|
1931
|
-
}
|
|
1932
|
-
/**
|
|
1933
|
-
* Set file changes for process
|
|
1934
|
-
*/
|
|
1935
|
-
processFileChanges(event) {
|
|
1936
|
-
var _a;
|
|
1937
|
-
const index = (_a = this.fileChanges) === null || _a === void 0 ? void 0 : _a.findIndex((e) => e.field === event.field);
|
|
1938
|
-
if (index !== undefined && index !== -1) {
|
|
1939
|
-
this.fileChanges[index] = event;
|
|
1940
|
-
}
|
|
1941
|
-
else if (this.fileChanges) {
|
|
1942
|
-
this.fileChanges.push(event);
|
|
1943
|
-
}
|
|
1944
|
-
else {
|
|
1945
|
-
this.fileChanges = [event];
|
|
1946
|
-
}
|
|
1947
|
-
}
|
|
1948
|
-
formatDate(date) {
|
|
1949
|
-
if (!date) {
|
|
1950
|
-
return null;
|
|
1951
|
-
}
|
|
1952
|
-
const newDate = new Date(date);
|
|
1953
|
-
return newDate.toISOString().substring(0, 16);
|
|
1954
|
-
}
|
|
1955
|
-
nestedObject(key, nestedObject, value) {
|
|
1956
|
-
var _a, _b, _c, _d;
|
|
1957
|
-
const props = key.split('.');
|
|
1958
|
-
let result = nestedObject;
|
|
1959
|
-
for (let i = 0; i < props.length; i++) {
|
|
1960
|
-
if (value && i === props.length - 1) {
|
|
1961
|
-
result[props[i]] = value;
|
|
1962
|
-
return result[props[i]];
|
|
1963
|
-
}
|
|
1964
|
-
result =
|
|
1965
|
-
((_a = result[props[i]]) === null || _a === void 0 ? void 0 : _a.fields) && ((_c = Object.keys((_b = result[props[i]]) === null || _b === void 0 ? void 0 : _b.fields)) === null || _c === void 0 ? void 0 : _c.length) > 0
|
|
1966
|
-
? (_d = result[props[i]]) === null || _d === void 0 ? void 0 : _d.fields
|
|
1967
|
-
: result[props[i]];
|
|
1968
|
-
}
|
|
1969
|
-
return result;
|
|
1970
|
-
}
|
|
1971
|
-
}
|
|
1972
|
-
ModelFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", 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 }, { token: i1$1.ToastService }, { token: i1$1.FileService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1973
|
-
ModelFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ModelFormComponent, selector: "base-model-form", inputs: { modelName: "modelName", label: "label", id: "id", delete: "delete", onlyUpdateMode: "onlyUpdateMode", duplicate: "duplicate", logging: "logging", config: "config", showFavButton: "showFavButton" }, 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 <div class=\"responsive-back d-flex d-lg-none\">\n <i class=\"bi bi-arrow-left\" routerLink=\"../\"></i>\n </div>\n <h2 class=\"mb-0\">\n {{ label ? label : capitalizeFirstLetter(modelName) }} {{ operation === 'update' ? 'bearbeiten' : 'erstellen' }}\n </h2>\n\n <div class=\"d-none d-lg-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\n class=\"btn btn-primary\"\n type=\"button\"\n [disabled]=\"!form.touched && !form.dirty\"\n (click)=\"submit(false)\"\n *ngIf=\"!_loading\"\n >\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 [id]=\"id\"\n [fields]=\"fields\"\n [config]=\"config\"\n [form]=\"form\"\n (imageChanged)=\"imageChanged($event)\"\n (fileChanged)=\"processFileChanges($event)\"\n ></base-model-form-sub>\n\n <div class=\"d-none d-lg-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\n class=\"btn btn-primary\"\n type=\"button\"\n [disabled]=\"!form.touched && !form.dirty\"\n (click)=\"submit(false)\"\n *ngIf=\"!_loading\"\n >\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\n<div class=\"d-block d-lg-none responsive-action-button\" *ngIf=\"showFavButton\">\n <base-fab-button [buttons]=\"fabButtons\"></base-fab-button>\n</div>\n", styles: [".responsive-back{display:flex;align-items:center;margin-right:6px}.responsive-back .bi-arrow-left{font-size:28px}h2{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.responsive-action-button{position:fixed;bottom:15px;right:15px;z-index:100}\n"], 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: "directive", type: i2$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: ModelFormSubComponent, selector: "base-model-form-sub", inputs: ["id", "parentKey", "fields", "form", "config"], outputs: ["imageChanged", "fileChanged"] }, { kind: "component", type: FabButtonComponent, selector: "base-fab-button", inputs: ["fabIcon", "buttons"] }] });
|
|
1974
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ModelFormComponent, decorators: [{
|
|
1975
|
-
type: Component,
|
|
1976
|
-
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 <div class=\"responsive-back d-flex d-lg-none\">\n <i class=\"bi bi-arrow-left\" routerLink=\"../\"></i>\n </div>\n <h2 class=\"mb-0\">\n {{ label ? label : capitalizeFirstLetter(modelName) }} {{ operation === 'update' ? 'bearbeiten' : 'erstellen' }}\n </h2>\n\n <div class=\"d-none d-lg-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\n class=\"btn btn-primary\"\n type=\"button\"\n [disabled]=\"!form.touched && !form.dirty\"\n (click)=\"submit(false)\"\n *ngIf=\"!_loading\"\n >\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 [id]=\"id\"\n [fields]=\"fields\"\n [config]=\"config\"\n [form]=\"form\"\n (imageChanged)=\"imageChanged($event)\"\n (fileChanged)=\"processFileChanges($event)\"\n ></base-model-form-sub>\n\n <div class=\"d-none d-lg-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\n class=\"btn btn-primary\"\n type=\"button\"\n [disabled]=\"!form.touched && !form.dirty\"\n (click)=\"submit(false)\"\n *ngIf=\"!_loading\"\n >\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\n<div class=\"d-block d-lg-none responsive-action-button\" *ngIf=\"showFavButton\">\n <base-fab-button [buttons]=\"fabButtons\"></base-fab-button>\n</div>\n", styles: [".responsive-back{display:flex;align-items:center;margin-right:6px}.responsive-back .bi-arrow-left{font-size:28px}h2{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.responsive-action-button{position:fixed;bottom:15px;right:15px;z-index:100}\n"] }]
|
|
1977
|
-
}], 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 }, { type: i1$1.ToastService }, { type: i1$1.FileService }]; }, propDecorators: { modelName: [{
|
|
1978
|
-
type: Input
|
|
1979
|
-
}], label: [{
|
|
1980
|
-
type: Input
|
|
1981
|
-
}], id: [{
|
|
1982
|
-
type: Input
|
|
1983
|
-
}], delete: [{
|
|
1984
|
-
type: Input
|
|
1985
|
-
}], onlyUpdateMode: [{
|
|
1986
|
-
type: Input
|
|
1987
|
-
}], duplicate: [{
|
|
1988
|
-
type: Input
|
|
1989
|
-
}], logging: [{
|
|
1990
|
-
type: Input
|
|
1991
|
-
}], config: [{
|
|
1992
|
-
type: Input
|
|
1993
|
-
}], showFavButton: [{
|
|
1994
|
-
type: Input
|
|
1995
|
-
}], finished: [{
|
|
1996
|
-
type: Output
|
|
1997
|
-
}] } });
|
|
1998
|
-
|
|
1999
|
-
/**
|
|
2000
|
-
* Truncate string with ellipses
|
|
2001
|
-
*/
|
|
2002
|
-
class EllipsesPipe {
|
|
2003
|
-
transform(value, limit) {
|
|
2004
|
-
if (!value) {
|
|
2005
|
-
return null;
|
|
2006
|
-
}
|
|
2007
|
-
return value.length > limit ? value.substring(0, limit) + '...' : value;
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
EllipsesPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EllipsesPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2011
|
-
EllipsesPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: EllipsesPipe, name: "baseEllipses" });
|
|
2012
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EllipsesPipe, decorators: [{
|
|
2013
|
-
type: Pipe,
|
|
2014
|
-
args: [{
|
|
2015
|
-
name: 'baseEllipses',
|
|
2016
|
-
}]
|
|
2017
|
-
}] });
|
|
2018
|
-
|
|
2019
|
-
class ModelTableComponent {
|
|
2020
|
-
constructor(graphQLMetaService, graphQLService, cmsService, toastService, scrollService, storageService) {
|
|
2021
|
-
this.graphQLMetaService = graphQLMetaService;
|
|
2022
|
-
this.graphQLService = graphQLService;
|
|
2023
|
-
this.cmsService = cmsService;
|
|
2024
|
-
this.toastService = toastService;
|
|
2025
|
-
this.scrollService = scrollService;
|
|
2026
|
-
this.storageService = storageService;
|
|
2027
|
-
this.createMode = false;
|
|
2028
|
-
this.logging = false;
|
|
2029
|
-
this.create = true;
|
|
2030
|
-
this.update = true;
|
|
2031
|
-
this.delete = true;
|
|
2032
|
-
this.import = true;
|
|
2033
|
-
this.export = true;
|
|
2034
|
-
this.duplicate = true;
|
|
2035
|
-
this.modelConfig = null;
|
|
2036
|
-
this.showFavButton = false;
|
|
2037
|
-
this.idSelected = new EventEmitter();
|
|
2038
|
-
this.createModeChanged = new EventEmitter();
|
|
2039
|
-
this.uniqueField = 'id';
|
|
2040
|
-
this.tableFields = {
|
|
2041
|
-
id: { label: 'ID' },
|
|
2042
|
-
name: { label: 'Name' },
|
|
2043
|
-
title: { label: 'Titel' },
|
|
2044
|
-
description: { label: 'Beschreibung' },
|
|
2045
|
-
email: { label: 'E-Mail' },
|
|
2046
|
-
createdAt: { label: 'Erstellt am', dateFormat: 'dd.MM.YYYY HH:mm' },
|
|
2047
|
-
updatedAt: { label: 'Bearbeitet am', dateFormat: 'dd.MM.YYYY HH:mm' },
|
|
2048
|
-
};
|
|
2049
|
-
this.objects = [];
|
|
2050
|
-
this.availableFields = [];
|
|
2051
|
-
this.id = '';
|
|
2052
|
-
this.queryName = null;
|
|
2053
|
-
this.possibleFields = {};
|
|
2054
|
-
this.componentRef = undefined;
|
|
2055
|
-
this.selectedPageIndex = 0;
|
|
2056
|
-
this.pages = [];
|
|
2057
|
-
this.pageItemsLimitControl = new FormControl(25);
|
|
2058
|
-
this.pageOptions = [
|
|
2059
|
-
{
|
|
2060
|
-
text: '25',
|
|
2061
|
-
value: 25,
|
|
2062
|
-
},
|
|
2063
|
-
{
|
|
2064
|
-
text: '50',
|
|
2065
|
-
value: 50,
|
|
2066
|
-
},
|
|
2067
|
-
{
|
|
2068
|
-
text: '75',
|
|
2069
|
-
value: 75,
|
|
2070
|
-
},
|
|
2071
|
-
{
|
|
2072
|
-
text: '100',
|
|
2073
|
-
value: 100,
|
|
2074
|
-
},
|
|
2075
|
-
{
|
|
2076
|
-
text: '200',
|
|
2077
|
-
value: 200,
|
|
2078
|
-
},
|
|
2079
|
-
];
|
|
2080
|
-
this.subscription = new Subscription();
|
|
2081
|
-
}
|
|
2082
|
-
ngAfterViewInit() {
|
|
2083
|
-
// Needed time out to prevent ExpressionChangedAfterItHasBeenCheckedError
|
|
2084
|
-
setTimeout(() => {
|
|
2085
|
-
this.integrateCustomFormComponent();
|
|
2086
|
-
}, 10);
|
|
2087
|
-
}
|
|
2088
|
-
ngOnInit() {
|
|
2089
|
-
const pageItemsLimit = this.storageService.load('pageItemsLimit');
|
|
2090
|
-
this.pageItemsLimitControl.setValue(pageItemsLimit ? pageItemsLimit : 25, { onlySelf: true, emitEvent: false });
|
|
2091
|
-
this.graphQLMetaService.getMeta().subscribe((meta) => {
|
|
2092
|
-
this.meta = meta;
|
|
2093
|
-
if (this.modelName) {
|
|
2094
|
-
this.init();
|
|
2095
|
-
}
|
|
2096
|
-
if (this.objectId) {
|
|
2097
|
-
this.id = this.objectId;
|
|
2098
|
-
// Needed time out for rerender
|
|
2099
|
-
setTimeout(() => {
|
|
2100
|
-
this.integrateCustomFormComponent();
|
|
2101
|
-
}, 10);
|
|
2102
|
-
}
|
|
2103
|
-
});
|
|
2104
|
-
}
|
|
2105
|
-
ngOnChanges(changes) {
|
|
2106
|
-
if (changes['modelName'] && this.meta) {
|
|
2107
|
-
this.init();
|
|
2108
|
-
}
|
|
2109
|
-
if (changes['objectId'] && this.meta) {
|
|
2110
|
-
if (this.id !== this.objectId) {
|
|
2111
|
-
if (this.logging) {
|
|
2112
|
-
console.log('ModelTableComponent::ngOnChanges->selectedId', this.id);
|
|
2113
|
-
}
|
|
2114
|
-
this.id = this.objectId;
|
|
2115
|
-
}
|
|
2116
|
-
}
|
|
2117
|
-
this.setChangesInComponentRef();
|
|
2118
|
-
}
|
|
2119
|
-
ngOnDestroy() {
|
|
2120
|
-
this.subscription.unsubscribe();
|
|
2121
|
-
}
|
|
2122
|
-
/**
|
|
2123
|
-
* We're using the `meta` service to get the fields that are available for the `find` query for the model we're working
|
|
2124
|
-
* with. We're then using that information to populate the `availableFields` array
|
|
2125
|
-
*/
|
|
2126
|
-
init() {
|
|
2127
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2128
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2129
|
-
this.availableFields = [];
|
|
2130
|
-
this.pages = [];
|
|
2131
|
-
this.totalCount = null;
|
|
2132
|
-
this.camelModelName = this.kebabToCamelCase(this.modelName);
|
|
2133
|
-
// Set query name
|
|
2134
|
-
if (!((_a = this.modelConfig) === null || _a === void 0 ? void 0 : _a.queryName)) {
|
|
2135
|
-
this.queryName = 'findAndCount' + this.capitalizeFirstLetter(this.camelModelName) + 's';
|
|
2136
|
-
}
|
|
2137
|
-
else {
|
|
2138
|
-
this.queryName = (_b = this.modelConfig) === null || _b === void 0 ? void 0 : _b.queryName;
|
|
2139
|
-
}
|
|
2140
|
-
if ((_c = this.modelConfig) === null || _c === void 0 ? void 0 : _c.tableFields) {
|
|
2141
|
-
this.tableFields = this.modelConfig.tableFields;
|
|
2142
|
-
}
|
|
2143
|
-
if (this.logging) {
|
|
2144
|
-
console.log('ModelTableComponent::init->modelName', this.modelName);
|
|
2145
|
-
console.log('ModelTableComponent::init->camelModelName', this.camelModelName);
|
|
2146
|
-
console.log('ModelTableComponent::init->queryName', this.queryName);
|
|
2147
|
-
console.log('ModelTableComponent::init->tableFields', this.tableFields);
|
|
2148
|
-
}
|
|
2149
|
-
this.possibleFields = this.meta.getFields(this.queryName).fields;
|
|
2150
|
-
let keys;
|
|
2151
|
-
if (((_d = this.possibleFields) === null || _d === void 0 ? void 0 : _d.items) && Object.keys((_f = (_e = this.possibleFields) === null || _e === void 0 ? void 0 : _e.items) === null || _f === void 0 ? void 0 : _f.fields).length > 0) {
|
|
2152
|
-
keys = Object.keys(this.possibleFields.items.fields);
|
|
2153
|
-
}
|
|
2154
|
-
else {
|
|
2155
|
-
keys = Object.keys(this.possibleFields);
|
|
2156
|
-
}
|
|
2157
|
-
const tableFieldKeys = Object.keys(this.tableFields);
|
|
2158
|
-
tableFieldKeys === null || tableFieldKeys === void 0 ? void 0 : tableFieldKeys.forEach((field) => {
|
|
2159
|
-
if (keys.includes(field)) {
|
|
2160
|
-
this.availableFields.push(field);
|
|
2161
|
-
}
|
|
2162
|
-
});
|
|
2163
|
-
if (this.logging) {
|
|
2164
|
-
console.log('ModelTableComponent::init->possibleFields', this.possibleFields);
|
|
2165
|
-
console.log('ModelTableComponent::init->keys', keys);
|
|
2166
|
-
console.log('ModelTableComponent::init->availableFields', this.availableFields);
|
|
2167
|
-
}
|
|
2168
|
-
this.selectedPageIndex = this.storageService.load('pageIndex') ? this.storageService.load('pageIndex') : 0;
|
|
2169
|
-
this.objects = yield this.loadObjects(this.availableFields, 0, this.pageItemsLimitControl.value);
|
|
2170
|
-
this.subscribeToPageItems();
|
|
2171
|
-
});
|
|
2172
|
-
}
|
|
2173
|
-
subscribeToPageItems() {
|
|
2174
|
-
this.subscription.add(this.pageItemsLimitControl.valueChanges.subscribe({
|
|
2175
|
-
next: (value) => __awaiter(this, void 0, void 0, function* () {
|
|
2176
|
-
this.selectedPageIndex = 0;
|
|
2177
|
-
this.storageService.save('pageIndex', this.selectedPageIndex);
|
|
2178
|
-
this.objects = yield this.loadObjects(this.availableFields, 0, value);
|
|
2179
|
-
this.storageService.save('pageItemsLimit', value);
|
|
2180
|
-
}),
|
|
2181
|
-
}));
|
|
2182
|
-
}
|
|
2183
|
-
integrateCustomFormComponent() {
|
|
2184
|
-
var _a, _b;
|
|
2185
|
-
if (!this.customFormTemplate || this.componentRef) {
|
|
2186
|
-
return;
|
|
2187
|
-
}
|
|
2188
|
-
const customComponent = (_a = this.modelConfig) === null || _a === void 0 ? void 0 : _a.customTemplateComponent;
|
|
2189
|
-
if (customComponent) {
|
|
2190
|
-
this.componentRef = (_b = this.customFormTemplate) === null || _b === void 0 ? void 0 : _b.createComponent(customComponent);
|
|
2191
|
-
this.setChangesInComponentRef();
|
|
2192
|
-
this.componentRef.instance.finished.subscribe(() => {
|
|
2193
|
-
this.selectId('');
|
|
2194
|
-
});
|
|
2195
|
-
}
|
|
2196
|
-
}
|
|
2197
|
-
setChangesInComponentRef() {
|
|
2198
|
-
var _a;
|
|
2199
|
-
if (this.componentRef) {
|
|
2200
|
-
const data = {
|
|
2201
|
-
config: this.config,
|
|
2202
|
-
delete: this.delete,
|
|
2203
|
-
duplicate: this.duplicate,
|
|
2204
|
-
id: this.id,
|
|
2205
|
-
label: (_a = this.modelConfig) === null || _a === void 0 ? void 0 : _a.label,
|
|
2206
|
-
logging: this.logging,
|
|
2207
|
-
modelName: this.camelModelName,
|
|
2208
|
-
showFavButton: this.showFavButton,
|
|
2209
|
-
};
|
|
2210
|
-
for (const [key, value] of Object.entries(data)) {
|
|
2211
|
-
this.componentRef.setInput(key, value);
|
|
2212
|
-
}
|
|
2213
|
-
}
|
|
2214
|
-
}
|
|
2215
|
-
/**
|
|
2216
|
-
* When the user clicks the "Create New" button, the createModeChanged event is emitted, which is then handled by the
|
|
2217
|
-
* parent component
|
|
2218
|
-
*/
|
|
2219
|
-
createNewObject() {
|
|
2220
|
-
this.createMode = true;
|
|
2221
|
-
this.createModeChanged.emit(true);
|
|
2222
|
-
}
|
|
2223
|
-
/**
|
|
2224
|
-
* It loads the objects from the database and stores them in the objects variable
|
|
2225
|
-
*
|
|
2226
|
-
* @param fields - string[] - The fields you want to load from the database.
|
|
2227
|
-
* @param skip
|
|
2228
|
-
* @param limit
|
|
2229
|
-
*/
|
|
2230
|
-
loadObjects(fields, skip = 0, limit = 25) {
|
|
2231
|
-
return new Promise((resolve, reject) => {
|
|
2232
|
-
const requestFields = [...fields];
|
|
2233
|
-
const idInFields = requestFields.find((e) => e === 'id');
|
|
2234
|
-
if (!idInFields) {
|
|
2235
|
-
requestFields.push('id');
|
|
2236
|
-
}
|
|
2237
|
-
const isFindAndCount = this.queryName.includes('findAndCount');
|
|
2238
|
-
this.graphQLService
|
|
2239
|
-
.graphQl(this.queryName, {
|
|
2240
|
-
arguments: {
|
|
2241
|
-
limit: isFindAndCount ? limit : null,
|
|
2242
|
-
skip: isFindAndCount ? skip : null,
|
|
2243
|
-
},
|
|
2244
|
-
fields: isFindAndCount ? ['totalCount', { items: requestFields }] : requestFields,
|
|
2245
|
-
type: GraphQLRequestType.QUERY,
|
|
2246
|
-
})
|
|
2247
|
-
.subscribe({
|
|
2248
|
-
next: (value) => {
|
|
2249
|
-
let items;
|
|
2250
|
-
if (this.logging) {
|
|
2251
|
-
console.log('ModelTableComponent::loadObjects->value', value);
|
|
2252
|
-
}
|
|
2253
|
-
if ((value === null || value === void 0 ? void 0 : value.totalCount) >= 0) {
|
|
2254
|
-
items = value.items;
|
|
2255
|
-
this.totalCount = value.totalCount;
|
|
2256
|
-
this.pages = [];
|
|
2257
|
-
let numbers = 0;
|
|
2258
|
-
while (numbers < this.totalCount) {
|
|
2259
|
-
this.pages.push({
|
|
2260
|
-
skip: numbers,
|
|
2261
|
-
limit: this.pageItemsLimitControl.value,
|
|
2262
|
-
});
|
|
2263
|
-
numbers = numbers + this.pageItemsLimitControl.value;
|
|
2264
|
-
}
|
|
2265
|
-
const loadedIndex = this.storageService.load('pageIndex');
|
|
2266
|
-
if (loadedIndex) {
|
|
2267
|
-
if (loadedIndex > this.pages.length) {
|
|
2268
|
-
this.selectedPageIndex = 0;
|
|
2269
|
-
this.storageService.save('pageIndex');
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
else {
|
|
2274
|
-
items = value;
|
|
2275
|
-
}
|
|
2276
|
-
resolve(items);
|
|
2277
|
-
},
|
|
2278
|
-
error: (err) => {
|
|
2279
|
-
console.log('Error on loading objects', err);
|
|
2280
|
-
reject(err);
|
|
2281
|
-
},
|
|
2282
|
-
});
|
|
2283
|
-
});
|
|
2284
|
-
}
|
|
2285
|
-
/**
|
|
2286
|
-
* If the update property is true, then set the selectedId property to the id of the object passed in, and emit the
|
|
2287
|
-
* selectedId property
|
|
2288
|
-
*/
|
|
2289
|
-
selectId(object) {
|
|
2290
|
-
if (!object) {
|
|
2291
|
-
this.createMode = false;
|
|
2292
|
-
this.createModeChanged.emit(false);
|
|
2293
|
-
}
|
|
2294
|
-
if (this.update) {
|
|
2295
|
-
this.id = object['id'];
|
|
2296
|
-
this.idSelected.emit(this.id);
|
|
2297
|
-
}
|
|
2298
|
-
}
|
|
2299
|
-
openNewTab(object) {
|
|
2300
|
-
window.open(location.href + '/' + object['id'], '_blank');
|
|
2301
|
-
}
|
|
2302
|
-
/**
|
|
2303
|
-
* It calls the duplicateObject function in the cmsService, passing in the id of the object to be duplicated and the
|
|
2304
|
-
* modelName of the object
|
|
2305
|
-
*/
|
|
2306
|
-
duplicateObject(id) {
|
|
2307
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2308
|
-
yield this.cmsService.duplicateObject(id, this.camelModelName);
|
|
2309
|
-
this.selectedPageIndex = this.storageService.load('pageIndex') ? this.storageService.load('pageIndex') : 0;
|
|
2310
|
-
this.objects = yield this.loadObjects(this.availableFields, this.pages[this.selectedPageIndex].skip, this.pages[this.selectedPageIndex].limit);
|
|
2311
|
-
});
|
|
2312
|
-
}
|
|
2313
|
-
/**
|
|
2314
|
-
* It calls the deleteObject function in the cmsService, passing in the id of the object to delete and the name of the
|
|
2315
|
-
* model
|
|
2316
|
-
*/
|
|
2317
|
-
deleteObject(id) {
|
|
2318
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2319
|
-
yield this.cmsService.deleteObject(id, this.camelModelName);
|
|
2320
|
-
this.selectedPageIndex = this.storageService.load('pageIndex') ? this.storageService.load('pageIndex') : 0;
|
|
2321
|
-
this.objects = yield this.loadObjects(this.availableFields, this.pages[this.selectedPageIndex].skip, this.pages[this.selectedPageIndex].limit);
|
|
2322
|
-
});
|
|
2323
|
-
}
|
|
2324
|
-
/**
|
|
2325
|
-
* It takes a string, capitalizes the first letter, and returns the modified string
|
|
2326
|
-
*/
|
|
2327
|
-
capitalizeFirstLetter(value) {
|
|
2328
|
-
return this.cmsService.capitalizeFirstLetter(value);
|
|
2329
|
-
}
|
|
2330
|
-
/**
|
|
2331
|
-
* Kebab to camel case string
|
|
2332
|
-
*/
|
|
2333
|
-
kebabToCamelCase(str) {
|
|
2334
|
-
return str.replace(/-./g, (match) => match[1].toUpperCase());
|
|
2335
|
-
}
|
|
2336
|
-
/**
|
|
2337
|
-
* Import objects from json file
|
|
2338
|
-
*/
|
|
2339
|
-
processImport(event) {
|
|
2340
|
-
// Create a new FileReader() object
|
|
2341
|
-
const reader = new FileReader();
|
|
2342
|
-
// Setup the callback event to run when the file is read
|
|
2343
|
-
reader.onload = (readerEvent) => __awaiter(this, void 0, void 0, function* () {
|
|
2344
|
-
let jsonResult = JSON.parse(readerEvent.target.result);
|
|
2345
|
-
if (!Array.isArray(jsonResult)) {
|
|
2346
|
-
jsonResult = [jsonResult];
|
|
2347
|
-
}
|
|
2348
|
-
for (let i = 0; i < jsonResult.length; i++) {
|
|
2349
|
-
try {
|
|
2350
|
-
this.graphQLService
|
|
2351
|
-
.graphQl('create' + this.capitalizeFirstLetter(this.modelName), {
|
|
2352
|
-
arguments: { input: jsonResult[i] },
|
|
2353
|
-
fields: ['id'],
|
|
2354
|
-
type: GraphQLRequestType.MUTATION,
|
|
2355
|
-
})
|
|
2356
|
-
.subscribe({
|
|
2357
|
-
next: () => __awaiter(this, void 0, void 0, function* () {
|
|
2358
|
-
this.toastService.show({
|
|
2359
|
-
id: this.modelName + '-' + i + '-success',
|
|
2360
|
-
type: ToastType.SUCCESS,
|
|
2361
|
-
title: 'Erfolgreich',
|
|
2362
|
-
description: 'Element ' + (i + 1) + ' von ' + jsonResult.length + ' erfolgreich importiert.',
|
|
2363
|
-
});
|
|
2364
|
-
if (i === jsonResult.length - 1) {
|
|
2365
|
-
this.selectedPageIndex = this.storageService.load('pageIndex')
|
|
2366
|
-
? this.storageService.load('pageIndex')
|
|
2367
|
-
: 0;
|
|
2368
|
-
this.objects = yield this.loadObjects(this.availableFields, this.pages[this.selectedPageIndex].skip, this.pages[this.selectedPageIndex].limit);
|
|
2369
|
-
}
|
|
2370
|
-
}),
|
|
2371
|
-
error: () => {
|
|
2372
|
-
this.toastService.show({
|
|
2373
|
-
id: this.modelName + '-' + i + '-error',
|
|
2374
|
-
type: ToastType.ERROR,
|
|
2375
|
-
title: 'Error',
|
|
2376
|
-
description: 'Element ' + (i + 1) + ' von ' + jsonResult.length + ' konnte nicht importiert werden.',
|
|
2377
|
-
});
|
|
2378
|
-
},
|
|
2379
|
-
});
|
|
2380
|
-
}
|
|
2381
|
-
catch (e) {
|
|
2382
|
-
this.toastService.show({
|
|
2383
|
-
id: this.modelName + '-' + i + '-error',
|
|
2384
|
-
type: ToastType.ERROR,
|
|
2385
|
-
title: 'Error',
|
|
2386
|
-
description: 'Element ' + (i + 1) + ' von ' + jsonResult.length + ' konnte nicht importiert werden.',
|
|
2387
|
-
});
|
|
2388
|
-
}
|
|
2389
|
-
}
|
|
2390
|
-
});
|
|
2391
|
-
// Read the file
|
|
2392
|
-
reader.readAsText(event.target.files[0]);
|
|
2393
|
-
}
|
|
2394
|
-
/**
|
|
2395
|
-
* Export objects as json
|
|
2396
|
-
*/
|
|
2397
|
-
processExport() {
|
|
2398
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2399
|
-
const keys = this.getAllKeys();
|
|
2400
|
-
const items = yield this.loadObjects(keys, this.pages[this.selectedPageIndex].skip, this.pages[this.selectedPageIndex].limit);
|
|
2401
|
-
const data = JSON.stringify(items);
|
|
2402
|
-
const blob = new Blob([data], { type: 'text/json;charset=utf-8;' });
|
|
2403
|
-
const url = URL.createObjectURL(blob);
|
|
2404
|
-
const link = document.createElement('a');
|
|
2405
|
-
link.setAttribute('href', url);
|
|
2406
|
-
link.setAttribute('download', this.modelName + 's.json');
|
|
2407
|
-
document.body.appendChild(link);
|
|
2408
|
-
link.click();
|
|
2409
|
-
});
|
|
2410
|
-
}
|
|
2411
|
-
/**
|
|
2412
|
-
* Get all keys for request to export objects as json
|
|
2413
|
-
*/
|
|
2414
|
-
getAllKeys() {
|
|
2415
|
-
const items = [];
|
|
2416
|
-
for (const [key, value] of Object.entries(this.possibleFields)) {
|
|
2417
|
-
if (!this.possibleFields[key].fields || Object.keys(this.possibleFields[key].fields).length === 0) {
|
|
2418
|
-
items.push(key);
|
|
2419
|
-
}
|
|
2420
|
-
}
|
|
2421
|
-
return items;
|
|
2422
|
-
}
|
|
2423
|
-
selectPage(i) {
|
|
2424
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2425
|
-
if (!this.pages[i]) {
|
|
2426
|
-
return;
|
|
2427
|
-
}
|
|
2428
|
-
this.selectedPageIndex = i;
|
|
2429
|
-
yield this.scrollService.scrollTo('model-table-top');
|
|
2430
|
-
this.storageService.save('pageIndex', this.selectedPageIndex);
|
|
2431
|
-
this.objects = yield this.loadObjects(this.availableFields, this.pages[this.selectedPageIndex].skip, this.pages[this.selectedPageIndex].limit);
|
|
2432
|
-
});
|
|
2433
|
-
}
|
|
2434
|
-
}
|
|
2435
|
-
ModelTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ModelTableComponent, deps: [{ token: i1$1.GraphQLMetaService }, { token: i1$1.GraphQLService }, { token: i1$1.CmsService }, { token: i1$1.ToastService }, { token: i1$1.ScrollService }, { token: i1$1.StorageService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2436
|
-
ModelTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ModelTableComponent, selector: "base-model-table", inputs: { modelName: "modelName", objectId: "objectId", createMode: "createMode", logging: "logging", create: "create", update: "update", delete: "delete", import: "import", export: "export", duplicate: "duplicate", modelConfig: "modelConfig", config: "config", showFavButton: "showFavButton" }, outputs: { idSelected: "idSelected", createModeChanged: "createModeChanged" }, viewQueries: [{ propertyName: "customFormTemplate", first: true, predicate: ["customFormTemplate"], descendants: true, read: ViewContainerRef }], usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"!id && !createMode\">\n <div class=\"w-100 d-flex flex-row justify-content-between align-items-center mb-2 mb-lg-4\">\n <h2 id=\"model-table-top\" class=\"mb-0\" *ngIf=\"modelName\">\n {{\n modelConfig?.plural\n ? modelConfig?.plural\n : modelConfig?.label\n ? modelConfig?.label\n : capitalizeFirstLetter(camelModelName) + 's'\n }}\n </h2>\n <div class=\"d-flex align-items-center d-none d-lg-block\">\n <input #importFile type=\"file\" accept=\".json\" class=\"d-none\" (change)=\"processImport($event)\" />\n <div class=\"btn-group me-4\" *ngIf=\"import || export\">\n <i\n class=\"bi bi-three-dots-vertical\"\n id=\"settingsDropdown\"\n type=\"button\"\n data-bs-toggle=\"dropdown\"\n data-bs-auto-close=\"true\"\n aria-expanded=\"false\"\n ></i>\n <ul class=\"dropdown-menu dropdown-menu-end\" aria-labelledby=\"settingsDropdown\">\n <li><a class=\"dropdown-item cursor-pointer\" *ngIf=\"export\" (click)=\"processExport()\">Export</a></li>\n <li><a class=\"dropdown-item cursor-pointer\" *ngIf=\"import\" (click)=\"importFile.click()\"> Import </a></li>\n </ul>\n </div>\n <button class=\"btn btn-primary\" (click)=\"createNewObject()\" *ngIf=\"create\">Erstellen</button>\n </div>\n </div>\n\n <div class=\"container-fluid\" *ngIf=\"totalCount >= 0\">\n <nav class=\"d-flex row\">\n <div class=\"col-12 col-md-2\"></div>\n <ul class=\"pagination justify-content-center col-12 col-md-8\">\n <li class=\"page-item\">\n <a\n class=\"page-link\"\n (click)=\"selectPage(selectedPageIndex - 1)\"\n aria-label=\"Previous\"\n [ngClass]=\"{ disabled: selectedPageIndex - 1 > 0 }\"\n >\n <span aria-hidden=\"true\">«</span>\n </a>\n </li>\n <li class=\"page-item\" *ngFor=\"let page of pages; let i = index\">\n <a class=\"page-link\" [ngClass]=\"{ active: selectedPageIndex === i }\" (click)=\"selectPage(i)\">{{ i + 1 }}</a>\n </li>\n <li class=\"page-item\">\n <a\n class=\"page-link\"\n (click)=\"selectPage(selectedPageIndex + 1)\"\n aria-label=\"Next\"\n [ngClass]=\"{ disabled: pages[selectedPageIndex + 1] }\"\n >\n <span aria-hidden=\"true\">»</span>\n </a>\n </li>\n </ul>\n\n <div class=\"col-12 col-md-2\">\n <base-select [options]=\"pageOptions\" [control]=\"pageItemsLimitControl\"></base-select>\n </div>\n </nav>\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 d-none d-lg-table\">\n <thead>\n <tr>\n <th\n scope=\"col\"\n *ngFor=\"let field of availableFields\"\n [baseSort]=\"objects\"\n (baseSorted)=\"objects = $event\"\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]?.enumValues\">\n {{ tableFields[field]?.enumValues[object[field]]?.text }}\n </ng-container>\n\n <ng-container *ngIf=\"!tableFields[field]?.dateFormat && !tableFields[field]?.enumValues\">\n {{ object[field] | baseEllipses : 60 }}\n </ng-container>\n </td>\n </tr>\n </tbody>\n </table>\n\n <div class=\"d-flex d-lg-none flex-column flex-grow-1\">\n <div class=\"table-card\" *ngFor=\"let object of objects\" [id]=\"object[uniqueField]\">\n <div class=\"table-card-entry\" *ngFor=\"let field of availableFields; let i = index\" (click)=\"selectId(object)\">\n <b *ngIf=\"i > 0\"\n >{{ tableFields[field]?.label ? tableFields[field]?.label : capitalizeFirstLetter(field) }}:</b\n >\n <p [ngClass]=\"{ 'table-card-entry-first': i === 0 }\">\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]?.enumValues\">\n {{ tableFields[field]?.enumValues[object[field]]?.text }}\n </ng-container>\n\n <ng-container *ngIf=\"!tableFields[field]?.dateFormat && !tableFields[field]?.enumValues\">\n {{ object[field] | baseEllipses : 60 }}\n </ng-container>\n </p>\n </div>\n </div>\n </div>\n\n <div class=\"container-fluid\" *ngIf=\"totalCount >= 0\">\n <nav class=\"d-flex row\">\n <div class=\"col-12 col-md-2\"></div>\n <ul class=\"pagination justify-content-center col-12 col-md-8\">\n <li class=\"page-item\">\n <a\n class=\"page-link\"\n (click)=\"selectPage(selectedPageIndex - 1)\"\n aria-label=\"Previous\"\n [ngClass]=\"{ disabled: selectedPageIndex - 1 > 0 }\"\n >\n <span aria-hidden=\"true\">«</span>\n </a>\n </li>\n <li class=\"page-item\" *ngFor=\"let page of pages; let i = index\">\n <a class=\"page-link\" [ngClass]=\"{ active: selectedPageIndex === i }\" (click)=\"selectPage(i)\">{{ i + 1 }}</a>\n </li>\n <li class=\"page-item\">\n <a\n class=\"page-link\"\n (click)=\"selectPage(selectedPageIndex + 1)\"\n aria-label=\"Next\"\n [ngClass]=\"{ disabled: pages[selectedPageIndex + 1] }\"\n >\n <span aria-hidden=\"true\">»</span>\n </a>\n </li>\n </ul>\n\n <div class=\"col-12 col-md-2\">\n <base-select [options]=\"pageOptions\" [control]=\"pageItemsLimitControl\"></base-select>\n </div>\n </nav>\n </div>\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\" (click)=\"openNewTab({ id: contextMenuData.clickedElement?.id })\">\n In neuen Tab \u00F6ffnen\n </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=\"id || createMode\">\n <button class=\"d-none d-lg-block btn btn-outline-primary mb-3\" (click)=\"selectId('')\">Zur\u00FCck</button>\n <base-model-form\n *ngIf=\"!modelConfig?.customTemplateComponent\"\n [modelName]=\"camelModelName\"\n [label]=\"modelConfig?.label\"\n [config]=\"config\"\n [logging]=\"logging\"\n [id]=\"id\"\n (finished)=\"selectId('')\"\n [delete]=\"delete\"\n [duplicate]=\"duplicate\"\n [showFavButton]=\"showFavButton\"\n ></base-model-form>\n <ng-template *ngIf=\"modelConfig?.customTemplateComponent\" #customFormTemplate></ng-template>\n</div>\n\n<div class=\"responsive-action-button d-block d-lg-none\">\n <base-fab-button\n [fabIcon]=\"'bi-plus'\"\n (click)=\"createNewObject()\"\n *ngIf=\"!(id || createMode) && showFavButton\"\n ></base-fab-button>\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;z-index:999}.context-menu-item{cursor:pointer;padding:8px 15px}.context-menu-item:hover{color:var(--bs-primary)}.table-card{background:var(--bs-white);padding:10px;margin-bottom:10px}.table-card-entry{margin-top:4px}.table-card-entry-first{font-size:18px;font-weight:800;color:var(--bs-primary)}.responsive-action-button{position:fixed;bottom:15px;right:15px}.bi-three-dots-vertical{font-size:18px;line-height:18px}.page-item{cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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"], outputs: ["baseSorted"] }, { kind: "directive", type: ContextMenuDirective, selector: "[ltContextMenu]", inputs: ["contextMenuData", "ltContextMenu", "xGap", "yGap", "overflowSpace", "selectors"], outputs: ["clickedElement"], exportAs: ["contextMenuData"] }, { kind: "component", type: SelectComponent, selector: "base-select", inputs: ["id", "name", "infoText", "label", "placeholder", "objectPath", "control", "tabIndex", "required", "multiple", "search", "options"] }, { kind: "component", type: ModelFormComponent, selector: "base-model-form", inputs: ["modelName", "label", "id", "delete", "onlyUpdateMode", "duplicate", "logging", "config", "showFavButton"], outputs: ["finished"] }, { kind: "component", type: FabButtonComponent, selector: "base-fab-button", inputs: ["fabIcon", "buttons"] }, { kind: "pipe", type: i2.DatePipe, name: "date" }, { kind: "pipe", type: EllipsesPipe, name: "baseEllipses" }] });
|
|
2437
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ModelTableComponent, decorators: [{
|
|
2438
|
-
type: Component,
|
|
2439
|
-
args: [{ selector: 'base-model-table', template: "<div *ngIf=\"!id && !createMode\">\n <div class=\"w-100 d-flex flex-row justify-content-between align-items-center mb-2 mb-lg-4\">\n <h2 id=\"model-table-top\" class=\"mb-0\" *ngIf=\"modelName\">\n {{\n modelConfig?.plural\n ? modelConfig?.plural\n : modelConfig?.label\n ? modelConfig?.label\n : capitalizeFirstLetter(camelModelName) + 's'\n }}\n </h2>\n <div class=\"d-flex align-items-center d-none d-lg-block\">\n <input #importFile type=\"file\" accept=\".json\" class=\"d-none\" (change)=\"processImport($event)\" />\n <div class=\"btn-group me-4\" *ngIf=\"import || export\">\n <i\n class=\"bi bi-three-dots-vertical\"\n id=\"settingsDropdown\"\n type=\"button\"\n data-bs-toggle=\"dropdown\"\n data-bs-auto-close=\"true\"\n aria-expanded=\"false\"\n ></i>\n <ul class=\"dropdown-menu dropdown-menu-end\" aria-labelledby=\"settingsDropdown\">\n <li><a class=\"dropdown-item cursor-pointer\" *ngIf=\"export\" (click)=\"processExport()\">Export</a></li>\n <li><a class=\"dropdown-item cursor-pointer\" *ngIf=\"import\" (click)=\"importFile.click()\"> Import </a></li>\n </ul>\n </div>\n <button class=\"btn btn-primary\" (click)=\"createNewObject()\" *ngIf=\"create\">Erstellen</button>\n </div>\n </div>\n\n <div class=\"container-fluid\" *ngIf=\"totalCount >= 0\">\n <nav class=\"d-flex row\">\n <div class=\"col-12 col-md-2\"></div>\n <ul class=\"pagination justify-content-center col-12 col-md-8\">\n <li class=\"page-item\">\n <a\n class=\"page-link\"\n (click)=\"selectPage(selectedPageIndex - 1)\"\n aria-label=\"Previous\"\n [ngClass]=\"{ disabled: selectedPageIndex - 1 > 0 }\"\n >\n <span aria-hidden=\"true\">«</span>\n </a>\n </li>\n <li class=\"page-item\" *ngFor=\"let page of pages; let i = index\">\n <a class=\"page-link\" [ngClass]=\"{ active: selectedPageIndex === i }\" (click)=\"selectPage(i)\">{{ i + 1 }}</a>\n </li>\n <li class=\"page-item\">\n <a\n class=\"page-link\"\n (click)=\"selectPage(selectedPageIndex + 1)\"\n aria-label=\"Next\"\n [ngClass]=\"{ disabled: pages[selectedPageIndex + 1] }\"\n >\n <span aria-hidden=\"true\">»</span>\n </a>\n </li>\n </ul>\n\n <div class=\"col-12 col-md-2\">\n <base-select [options]=\"pageOptions\" [control]=\"pageItemsLimitControl\"></base-select>\n </div>\n </nav>\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 d-none d-lg-table\">\n <thead>\n <tr>\n <th\n scope=\"col\"\n *ngFor=\"let field of availableFields\"\n [baseSort]=\"objects\"\n (baseSorted)=\"objects = $event\"\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]?.enumValues\">\n {{ tableFields[field]?.enumValues[object[field]]?.text }}\n </ng-container>\n\n <ng-container *ngIf=\"!tableFields[field]?.dateFormat && !tableFields[field]?.enumValues\">\n {{ object[field] | baseEllipses : 60 }}\n </ng-container>\n </td>\n </tr>\n </tbody>\n </table>\n\n <div class=\"d-flex d-lg-none flex-column flex-grow-1\">\n <div class=\"table-card\" *ngFor=\"let object of objects\" [id]=\"object[uniqueField]\">\n <div class=\"table-card-entry\" *ngFor=\"let field of availableFields; let i = index\" (click)=\"selectId(object)\">\n <b *ngIf=\"i > 0\"\n >{{ tableFields[field]?.label ? tableFields[field]?.label : capitalizeFirstLetter(field) }}:</b\n >\n <p [ngClass]=\"{ 'table-card-entry-first': i === 0 }\">\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]?.enumValues\">\n {{ tableFields[field]?.enumValues[object[field]]?.text }}\n </ng-container>\n\n <ng-container *ngIf=\"!tableFields[field]?.dateFormat && !tableFields[field]?.enumValues\">\n {{ object[field] | baseEllipses : 60 }}\n </ng-container>\n </p>\n </div>\n </div>\n </div>\n\n <div class=\"container-fluid\" *ngIf=\"totalCount >= 0\">\n <nav class=\"d-flex row\">\n <div class=\"col-12 col-md-2\"></div>\n <ul class=\"pagination justify-content-center col-12 col-md-8\">\n <li class=\"page-item\">\n <a\n class=\"page-link\"\n (click)=\"selectPage(selectedPageIndex - 1)\"\n aria-label=\"Previous\"\n [ngClass]=\"{ disabled: selectedPageIndex - 1 > 0 }\"\n >\n <span aria-hidden=\"true\">«</span>\n </a>\n </li>\n <li class=\"page-item\" *ngFor=\"let page of pages; let i = index\">\n <a class=\"page-link\" [ngClass]=\"{ active: selectedPageIndex === i }\" (click)=\"selectPage(i)\">{{ i + 1 }}</a>\n </li>\n <li class=\"page-item\">\n <a\n class=\"page-link\"\n (click)=\"selectPage(selectedPageIndex + 1)\"\n aria-label=\"Next\"\n [ngClass]=\"{ disabled: pages[selectedPageIndex + 1] }\"\n >\n <span aria-hidden=\"true\">»</span>\n </a>\n </li>\n </ul>\n\n <div class=\"col-12 col-md-2\">\n <base-select [options]=\"pageOptions\" [control]=\"pageItemsLimitControl\"></base-select>\n </div>\n </nav>\n </div>\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\" (click)=\"openNewTab({ id: contextMenuData.clickedElement?.id })\">\n In neuen Tab \u00F6ffnen\n </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=\"id || createMode\">\n <button class=\"d-none d-lg-block btn btn-outline-primary mb-3\" (click)=\"selectId('')\">Zur\u00FCck</button>\n <base-model-form\n *ngIf=\"!modelConfig?.customTemplateComponent\"\n [modelName]=\"camelModelName\"\n [label]=\"modelConfig?.label\"\n [config]=\"config\"\n [logging]=\"logging\"\n [id]=\"id\"\n (finished)=\"selectId('')\"\n [delete]=\"delete\"\n [duplicate]=\"duplicate\"\n [showFavButton]=\"showFavButton\"\n ></base-model-form>\n <ng-template *ngIf=\"modelConfig?.customTemplateComponent\" #customFormTemplate></ng-template>\n</div>\n\n<div class=\"responsive-action-button d-block d-lg-none\">\n <base-fab-button\n [fabIcon]=\"'bi-plus'\"\n (click)=\"createNewObject()\"\n *ngIf=\"!(id || createMode) && showFavButton\"\n ></base-fab-button>\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;z-index:999}.context-menu-item{cursor:pointer;padding:8px 15px}.context-menu-item:hover{color:var(--bs-primary)}.table-card{background:var(--bs-white);padding:10px;margin-bottom:10px}.table-card-entry{margin-top:4px}.table-card-entry-first{font-size:18px;font-weight:800;color:var(--bs-primary)}.responsive-action-button{position:fixed;bottom:15px;right:15px}.bi-three-dots-vertical{font-size:18px;line-height:18px}.page-item{cursor:pointer}\n"] }]
|
|
2440
|
-
}], ctorParameters: function () { return [{ type: i1$1.GraphQLMetaService }, { type: i1$1.GraphQLService }, { type: i1$1.CmsService }, { type: i1$1.ToastService }, { type: i1$1.ScrollService }, { type: i1$1.StorageService }]; }, propDecorators: { modelName: [{
|
|
2441
|
-
type: Input
|
|
2442
|
-
}], objectId: [{
|
|
2443
|
-
type: Input
|
|
2444
|
-
}], createMode: [{
|
|
2445
|
-
type: Input
|
|
2446
|
-
}], logging: [{
|
|
2447
|
-
type: Input
|
|
2448
|
-
}], create: [{
|
|
2449
|
-
type: Input
|
|
2450
|
-
}], update: [{
|
|
2451
|
-
type: Input
|
|
2452
|
-
}], delete: [{
|
|
2453
|
-
type: Input
|
|
2454
|
-
}], import: [{
|
|
2455
|
-
type: Input
|
|
2456
|
-
}], export: [{
|
|
2457
|
-
type: Input
|
|
2458
|
-
}], duplicate: [{
|
|
2459
|
-
type: Input
|
|
2460
|
-
}], modelConfig: [{
|
|
2461
|
-
type: Input
|
|
2462
|
-
}], config: [{
|
|
2463
|
-
type: Input
|
|
2464
|
-
}], showFavButton: [{
|
|
2465
|
-
type: Input
|
|
2466
|
-
}], idSelected: [{
|
|
2467
|
-
type: Output
|
|
2468
|
-
}], createModeChanged: [{
|
|
2469
|
-
type: Output
|
|
2470
|
-
}], customFormTemplate: [{
|
|
2471
|
-
type: ViewChild,
|
|
2472
|
-
args: ['customFormTemplate', { read: ViewContainerRef }]
|
|
2473
|
-
}] } });
|
|
2474
|
-
|
|
2475
|
-
class ChangePasswordComponent {
|
|
2476
|
-
constructor(formsService, userService, authService, toastService) {
|
|
2477
|
-
this.formsService = formsService;
|
|
2478
|
-
this.userService = userService;
|
|
2479
|
-
this.authService = authService;
|
|
2480
|
-
this.toastService = toastService;
|
|
2481
|
-
this.loading = false;
|
|
2482
|
-
}
|
|
2483
|
-
ngOnInit() {
|
|
2484
|
-
this.createForm();
|
|
2485
|
-
}
|
|
2486
|
-
/**
|
|
2487
|
-
* Create password change form
|
|
2488
|
-
*/
|
|
2489
|
-
createForm() {
|
|
2490
|
-
this.form = new UntypedFormGroup({
|
|
2491
|
-
current: new FormControl('', [Validators.required]),
|
|
2492
|
-
password: new FormControl('', [Validators.required, securePasswordValidator()]),
|
|
2493
|
-
passwordConfirm: new FormControl('', [Validators.required, securePasswordValidator()]),
|
|
2494
|
-
}, { validators: Validation.match('password', 'passwordConfirm') });
|
|
2495
|
-
}
|
|
2496
|
-
/**
|
|
2497
|
-
* Submit form and change password of user
|
|
2498
|
-
*/
|
|
2499
|
-
submit() {
|
|
2500
|
-
this.loading = true;
|
|
2501
|
-
this.userService
|
|
2502
|
-
.login({
|
|
2503
|
-
email: this.authService.currentUser.email,
|
|
2504
|
-
password: this.form.get('current').value,
|
|
2505
|
-
})
|
|
2506
|
-
.subscribe({
|
|
2507
|
-
next: () => {
|
|
2508
|
-
if (this.form.invalid) {
|
|
2509
|
-
this.formsService.validateAllFormFields(this.form);
|
|
2510
|
-
this.loading = false;
|
|
2511
|
-
return;
|
|
2512
|
-
}
|
|
2513
|
-
this.userService.changePassword(this.authService.currentUser.id, this.form.get('password').value).subscribe({
|
|
2514
|
-
next: (response) => {
|
|
2515
|
-
if (response) {
|
|
2516
|
-
this.form.reset();
|
|
2517
|
-
this.toastService.show({
|
|
2518
|
-
id: 'password-change-success',
|
|
2519
|
-
title: 'Erfolgreich',
|
|
2520
|
-
description: 'Passwort wurde erfolgreich geändert.',
|
|
2521
|
-
type: ToastType.SUCCESS,
|
|
2522
|
-
});
|
|
2523
|
-
}
|
|
2524
|
-
this.loading = false;
|
|
2525
|
-
},
|
|
2526
|
-
error: () => {
|
|
2527
|
-
this.loading = false;
|
|
2528
|
-
this.toastService.show({
|
|
2529
|
-
id: 'password-change-error',
|
|
2530
|
-
title: 'Fehlgeschlagen',
|
|
2531
|
-
description: 'Passwort ändern ist fehlgeschlagen, bitte versuche es später erneut.',
|
|
2532
|
-
type: ToastType.ERROR,
|
|
2533
|
-
});
|
|
2534
|
-
},
|
|
2535
|
-
});
|
|
2536
|
-
},
|
|
2537
|
-
error: () => {
|
|
2538
|
-
this.loading = false;
|
|
2539
|
-
this.toastService.show({
|
|
2540
|
-
id: 'password-change-error',
|
|
2541
|
-
title: 'Fehlgeschlagen',
|
|
2542
|
-
description: 'Passwort ändern ist fehlgeschlagen. Falsches Passwort.',
|
|
2543
|
-
type: ToastType.ERROR,
|
|
2544
|
-
errorCode: '401',
|
|
2545
|
-
});
|
|
2546
|
-
},
|
|
2547
|
-
});
|
|
2548
|
-
}
|
|
2549
|
-
}
|
|
2550
|
-
ChangePasswordComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChangePasswordComponent, deps: [{ token: i1$1.FormsService }, { token: i1$1.UserService }, { token: i1$1.AuthService }, { token: i1$1.ToastService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2551
|
-
ChangePasswordComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ChangePasswordComponent, selector: "base-change-password", ngImport: i0, template: "<h3>Passwort \u00E4ndern</h3>\n\n<form [formGroup]=\"form\">\n <base-input\n [id]=\"'Aktuelles Passwort'\"\n [label]=\"'Passwort'\"\n [required]=\"true\"\n [type]=\"'password'\"\n [control]=\"form.get('current')\"\n [tabIndex]=\"1\"\n [eyeButton]=\"true\"\n ></base-input>\n <base-input\n [id]=\"'password'\"\n [label]=\"'Neues Passwort'\"\n [required]=\"true\"\n [type]=\"'password'\"\n [control]=\"form.get('password')\"\n [tabIndex]=\"2\"\n [eyeButton]=\"true\"\n ></base-input>\n <base-input\n [id]=\"'password-confirm'\"\n [label]=\"'Neues Passwort best\u00E4tigen'\"\n [required]=\"true\"\n [type]=\"'password'\"\n [control]=\"form.get('passwordConfirm')\"\n [tabIndex]=\"3\"\n [eyeButton]=\"true\"\n ></base-input>\n\n <div class=\"d-flex justify-content-end\">\n <div>\n <button class=\"btn btn-primary\" (click)=\"submit()\" *ngIf=\"!loading\">Passwort \u00E4ndern</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 Loading...\n </button>\n </div>\n </div>\n</form>\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.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: InputComponent, selector: "base-input", inputs: ["id", "name", "infoText", "label", "placeholder", "autocomplete", "tabIndex", "control", "type", "required", "eyeButton", "objectPath"], outputs: ["enter"] }] });
|
|
2552
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChangePasswordComponent, decorators: [{
|
|
2553
|
-
type: Component,
|
|
2554
|
-
args: [{ selector: 'base-change-password', template: "<h3>Passwort \u00E4ndern</h3>\n\n<form [formGroup]=\"form\">\n <base-input\n [id]=\"'Aktuelles Passwort'\"\n [label]=\"'Passwort'\"\n [required]=\"true\"\n [type]=\"'password'\"\n [control]=\"form.get('current')\"\n [tabIndex]=\"1\"\n [eyeButton]=\"true\"\n ></base-input>\n <base-input\n [id]=\"'password'\"\n [label]=\"'Neues Passwort'\"\n [required]=\"true\"\n [type]=\"'password'\"\n [control]=\"form.get('password')\"\n [tabIndex]=\"2\"\n [eyeButton]=\"true\"\n ></base-input>\n <base-input\n [id]=\"'password-confirm'\"\n [label]=\"'Neues Passwort best\u00E4tigen'\"\n [required]=\"true\"\n [type]=\"'password'\"\n [control]=\"form.get('passwordConfirm')\"\n [tabIndex]=\"3\"\n [eyeButton]=\"true\"\n ></base-input>\n\n <div class=\"d-flex justify-content-end\">\n <div>\n <button class=\"btn btn-primary\" (click)=\"submit()\" *ngIf=\"!loading\">Passwort \u00E4ndern</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 Loading...\n </button>\n </div>\n </div>\n</form>\n" }]
|
|
2555
|
-
}], ctorParameters: function () { return [{ type: i1$1.FormsService }, { type: i1$1.UserService }, { type: i1$1.AuthService }, { type: i1$1.ToastService }]; } });
|
|
2556
|
-
|
|
2557
|
-
class DeleteAccountComponent {
|
|
2558
|
-
constructor(userService, authService, toastService, router) {
|
|
2559
|
-
this.userService = userService;
|
|
2560
|
-
this.authService = authService;
|
|
2561
|
-
this.toastService = toastService;
|
|
2562
|
-
this.router = router;
|
|
2563
|
-
this.description = 'Mit dem Löschen Deines Kontos werden alle persönlichen Daten sofort gelöscht und sind nicht wiederherstellbar.';
|
|
2564
|
-
this.loading = false;
|
|
2565
|
-
}
|
|
2566
|
-
deleteAccount() {
|
|
2567
|
-
this.loading = true;
|
|
2568
|
-
if (!confirm('Willst Du wirklich ein Konto unwiderruflich löschen?')) {
|
|
2569
|
-
this.loading = false;
|
|
2570
|
-
return;
|
|
2571
|
-
}
|
|
2572
|
-
this.userService.delete(this.authService.currentUser.id).subscribe({
|
|
2573
|
-
next: (response) => {
|
|
2574
|
-
if (response) {
|
|
2575
|
-
this.toastService.show({
|
|
2576
|
-
id: 'delete-user-success',
|
|
2577
|
-
title: 'Erfolgreich',
|
|
2578
|
-
description: 'Dein Konto wurde erfolgreich gelöscht.',
|
|
2579
|
-
type: ToastType.SUCCESS,
|
|
2580
|
-
});
|
|
2581
|
-
}
|
|
2582
|
-
this.authService.logout();
|
|
2583
|
-
this.router.navigate(['/']);
|
|
2584
|
-
this.loading = false;
|
|
2585
|
-
},
|
|
2586
|
-
error: (error) => {
|
|
2587
|
-
this.loading = false;
|
|
2588
|
-
this.toastService.show({
|
|
2589
|
-
id: 'delete-user-error',
|
|
2590
|
-
title: 'Fehlgeschlagen',
|
|
2591
|
-
description: 'Konto löschen ist fehlgeschlagen, bitte versuche es später erneut.',
|
|
2592
|
-
type: ToastType.ERROR,
|
|
2593
|
-
});
|
|
2594
|
-
},
|
|
2595
|
-
});
|
|
2596
|
-
}
|
|
2597
|
-
}
|
|
2598
|
-
DeleteAccountComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeleteAccountComponent, deps: [{ token: i1$1.UserService }, { token: i1$1.AuthService }, { token: i1$1.ToastService }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Component });
|
|
2599
|
-
DeleteAccountComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: DeleteAccountComponent, selector: "base-delete-account", inputs: { description: "description" }, ngImport: i0, template: "<div>\n <h3>Konto l\u00F6schen</h3>\n\n <p>{{ description }}</p>\n\n <div class=\"d-flex justify-content-end mt-3\">\n <div>\n <button class=\"btn btn-primary\" (click)=\"deleteAccount()\" *ngIf=\"!loading\">Konto l\u00F6schen</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 Loading...\n </button>\n </div>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
2600
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeleteAccountComponent, decorators: [{
|
|
2601
|
-
type: Component,
|
|
2602
|
-
args: [{ selector: 'base-delete-account', template: "<div>\n <h3>Konto l\u00F6schen</h3>\n\n <p>{{ description }}</p>\n\n <div class=\"d-flex justify-content-end mt-3\">\n <div>\n <button class=\"btn btn-primary\" (click)=\"deleteAccount()\" *ngIf=\"!loading\">Konto l\u00F6schen</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 Loading...\n </button>\n </div>\n </div>\n</div>\n" }]
|
|
2603
|
-
}], ctorParameters: function () { return [{ type: i1$1.UserService }, { type: i1$1.AuthService }, { type: i1$1.ToastService }, { type: i2$1.Router }]; }, propDecorators: { description: [{
|
|
2604
|
-
type: Input
|
|
2605
|
-
}] } });
|
|
2606
|
-
|
|
2607
|
-
class BackButtonDirective {
|
|
2608
|
-
constructor(navigation) {
|
|
2609
|
-
this.navigation = navigation;
|
|
2610
|
-
}
|
|
2611
|
-
onClick() {
|
|
2612
|
-
this.navigation.back();
|
|
2613
|
-
}
|
|
2614
|
-
}
|
|
2615
|
-
BackButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BackButtonDirective, deps: [{ token: i1$1.NavigationService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2616
|
-
BackButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: BackButtonDirective, selector: "[baseBackButton]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
|
|
2617
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BackButtonDirective, decorators: [{
|
|
2618
|
-
type: Directive,
|
|
2619
|
-
args: [{
|
|
2620
|
-
selector: '[baseBackButton]',
|
|
2621
|
-
}]
|
|
2622
|
-
}], ctorParameters: function () { return [{ type: i1$1.NavigationService }]; }, propDecorators: { onClick: [{
|
|
2623
|
-
type: HostListener,
|
|
2624
|
-
args: ['click']
|
|
2625
|
-
}] } });
|
|
2626
|
-
|
|
2627
|
-
// Modules
|
|
2628
|
-
const imports = [FormsModule, ReactiveFormsModule, CommonModule, RouterModule, ImageCropperModule, NgbTooltipModule];
|
|
2629
|
-
// Imported and exported elements
|
|
2630
|
-
const elements = [
|
|
2631
|
-
// Directives
|
|
2632
|
-
SortDirective,
|
|
2633
|
-
BackButtonDirective,
|
|
2634
|
-
ContextMenuDirective,
|
|
2635
|
-
StopPropagationDirective,
|
|
2636
|
-
// Components
|
|
2637
|
-
InputComponent,
|
|
2638
|
-
SelectComponent,
|
|
2639
|
-
CheckboxComponent,
|
|
2640
|
-
TextareaComponent,
|
|
2641
|
-
ToastComponent,
|
|
2642
|
-
TagsComponent,
|
|
2643
|
-
LoadingBarComponent,
|
|
2644
|
-
SkeletonLoaderComponent,
|
|
2645
|
-
BreadcrumbComponent,
|
|
2646
|
-
ModelFormComponent,
|
|
2647
|
-
ModelTableComponent,
|
|
2648
|
-
ModelFormSubComponent,
|
|
2649
|
-
UploadImageComponent,
|
|
2650
|
-
RefenceInputComponent,
|
|
2651
|
-
ChangePasswordComponent,
|
|
2652
|
-
DeleteAccountComponent,
|
|
2653
|
-
FabButtonComponent,
|
|
2654
|
-
// Pipes
|
|
2655
|
-
EllipsesPipe,
|
|
2656
|
-
];
|
|
2657
|
-
class BaseComponentsModule {
|
|
2658
|
-
}
|
|
2659
|
-
BaseComponentsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2660
|
-
BaseComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: BaseComponentsModule, declarations: [
|
|
2661
|
-
// Directives
|
|
2662
|
-
SortDirective,
|
|
2663
|
-
BackButtonDirective,
|
|
2664
|
-
ContextMenuDirective,
|
|
2665
|
-
StopPropagationDirective,
|
|
2666
|
-
// Components
|
|
2667
|
-
InputComponent,
|
|
2668
|
-
SelectComponent,
|
|
2669
|
-
CheckboxComponent,
|
|
2670
|
-
TextareaComponent,
|
|
2671
|
-
ToastComponent,
|
|
2672
|
-
TagsComponent,
|
|
2673
|
-
LoadingBarComponent,
|
|
2674
|
-
SkeletonLoaderComponent,
|
|
2675
|
-
BreadcrumbComponent,
|
|
2676
|
-
ModelFormComponent,
|
|
2677
|
-
ModelTableComponent,
|
|
2678
|
-
ModelFormSubComponent,
|
|
2679
|
-
UploadImageComponent,
|
|
2680
|
-
RefenceInputComponent,
|
|
2681
|
-
ChangePasswordComponent,
|
|
2682
|
-
DeleteAccountComponent,
|
|
2683
|
-
FabButtonComponent,
|
|
2684
|
-
// Pipes
|
|
2685
|
-
EllipsesPipe
|
|
2686
|
-
], imports: [FormsModule, ReactiveFormsModule, CommonModule, RouterModule, ImageCropperModule, NgbTooltipModule], exports: [
|
|
2687
|
-
// Directives
|
|
2688
|
-
SortDirective,
|
|
2689
|
-
BackButtonDirective,
|
|
2690
|
-
ContextMenuDirective,
|
|
2691
|
-
StopPropagationDirective,
|
|
2692
|
-
// Components
|
|
2693
|
-
InputComponent,
|
|
2694
|
-
SelectComponent,
|
|
2695
|
-
CheckboxComponent,
|
|
2696
|
-
TextareaComponent,
|
|
2697
|
-
ToastComponent,
|
|
2698
|
-
TagsComponent,
|
|
2699
|
-
LoadingBarComponent,
|
|
2700
|
-
SkeletonLoaderComponent,
|
|
2701
|
-
BreadcrumbComponent,
|
|
2702
|
-
ModelFormComponent,
|
|
2703
|
-
ModelTableComponent,
|
|
2704
|
-
ModelFormSubComponent,
|
|
2705
|
-
UploadImageComponent,
|
|
2706
|
-
RefenceInputComponent,
|
|
2707
|
-
ChangePasswordComponent,
|
|
2708
|
-
DeleteAccountComponent,
|
|
2709
|
-
FabButtonComponent,
|
|
2710
|
-
// Pipes
|
|
2711
|
-
EllipsesPipe
|
|
2712
|
-
] });
|
|
2713
|
-
BaseComponentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseComponentsModule, imports: [imports] });
|
|
2714
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseComponentsModule, decorators: [{
|
|
2715
|
-
type: NgModule,
|
|
2716
|
-
args: [{
|
|
2717
|
-
declarations: elements,
|
|
2718
|
-
imports,
|
|
2719
|
-
exports: elements,
|
|
2720
|
-
}]
|
|
2721
|
-
}] });
|
|
2722
|
-
|
|
2723
|
-
/**
|
|
2724
|
-
* Abstract Component for inputs and outputs only
|
|
2725
|
-
*
|
|
2726
|
-
* Hint for handling extensions of this component in project:
|
|
2727
|
-
* If you want to use complete custom services and methods, extend ModelFormComponent instead of ModelFormBaseComponent
|
|
2728
|
-
*/
|
|
2729
|
-
class ModelFormBaseComponent {
|
|
2730
|
-
constructor(cmsService, toastService, router, route) {
|
|
2731
|
-
this.cmsService = cmsService;
|
|
2732
|
-
this.toastService = toastService;
|
|
2733
|
-
this.router = router;
|
|
2734
|
-
this.route = route;
|
|
2735
|
-
this.delete = true;
|
|
2736
|
-
this.onlyUpdateMode = false;
|
|
2737
|
-
this.duplicate = false;
|
|
2738
|
-
this.logging = false;
|
|
2739
|
-
this.config = null;
|
|
2740
|
-
this.showFavButton = true;
|
|
2741
|
-
this.finished = new EventEmitter();
|
|
2742
|
-
this.fabButtons = [];
|
|
2743
|
-
}
|
|
2744
|
-
ngOnInit() {
|
|
2745
|
-
this.initFabActions();
|
|
2746
|
-
}
|
|
2747
|
-
/**
|
|
2748
|
-
* Init fab buttons for mobile devices
|
|
2749
|
-
*/
|
|
2750
|
-
initFabActions() {
|
|
2751
|
-
const saveEvent = new EventEmitter();
|
|
2752
|
-
this.fabButtons.push({ icon: 'bi-check-lg', color: 'var(--bs-success)', event: saveEvent });
|
|
2753
|
-
saveEvent.subscribe(() => this.submit());
|
|
2754
|
-
if (this.duplicate && this.operation === 'update') {
|
|
2755
|
-
const event = new EventEmitter();
|
|
2756
|
-
this.fabButtons.push({ icon: 'bi-back', color: 'var(--bs-info)', event });
|
|
2757
|
-
event.subscribe(() => this.duplicateObject());
|
|
2758
|
-
}
|
|
2759
|
-
if (this.operation === 'update' && this.delete) {
|
|
2760
|
-
const event = new EventEmitter();
|
|
2761
|
-
this.fabButtons.push({ icon: 'bi-trash3', color: 'var(--bs-danger)', event });
|
|
2762
|
-
event.subscribe(() => this.deleteObject());
|
|
2763
|
-
}
|
|
2764
|
-
}
|
|
2765
|
-
submit() { }
|
|
2766
|
-
/**
|
|
2767
|
-
* It calls the graphQLService to delete the object with the id of the object that is currently being edited
|
|
2768
|
-
*/
|
|
2769
|
-
deleteObject() {
|
|
2770
|
-
this.cmsService.deleteObject(this.id, this.modelName).then(() => {
|
|
2771
|
-
this.toastService.show({
|
|
2772
|
-
id: this.modelName + '-success',
|
|
2773
|
-
type: ToastType.SUCCESS,
|
|
2774
|
-
title: 'Erfolgreich',
|
|
2775
|
-
description: this.label + ' wurde erfolgreich gelöscht.',
|
|
2776
|
-
});
|
|
2777
|
-
this.finished.emit(null);
|
|
2778
|
-
});
|
|
2779
|
-
}
|
|
2780
|
-
/**
|
|
2781
|
-
* It sends a GraphQL mutation to the server to duplicate the object
|
|
2782
|
-
*/
|
|
2783
|
-
duplicateObject() {
|
|
2784
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2785
|
-
this.cmsService.duplicateObject(this.id, this.modelName).then((value) => __awaiter(this, void 0, void 0, function* () {
|
|
2786
|
-
if (value === null || value === void 0 ? void 0 : value.id) {
|
|
2787
|
-
yield this.router.navigate(['../'], { relativeTo: this.route });
|
|
2788
|
-
this.toastService.show({
|
|
2789
|
-
id: this.modelName + '-success',
|
|
2790
|
-
type: ToastType.SUCCESS,
|
|
2791
|
-
title: 'Erfolgreich',
|
|
2792
|
-
description: this.label + ' wurde erfolgreich dupliziert.',
|
|
2793
|
-
});
|
|
2794
|
-
}
|
|
2795
|
-
else {
|
|
2796
|
-
this.finished.emit(null);
|
|
2797
|
-
}
|
|
2798
|
-
}));
|
|
2799
|
-
});
|
|
2800
|
-
}
|
|
2801
|
-
/**
|
|
2802
|
-
* It takes a string, capitalizes the first letter, and returns the modified string
|
|
2803
|
-
*
|
|
2804
|
-
* @param value - The string to capitalize.
|
|
2805
|
-
* @returns The first letter of the string is being capitalized and the rest of the string is being returned.
|
|
2806
|
-
*/
|
|
2807
|
-
capitalizeFirstLetter(value) {
|
|
2808
|
-
return this.cmsService.capitalizeFirstLetter(value);
|
|
2809
|
-
}
|
|
2810
|
-
/**
|
|
2811
|
-
* It takes an AbstractControl and returns a FormControl
|
|
2812
|
-
*
|
|
2813
|
-
* @param control - AbstractControl | null | undefined
|
|
2814
|
-
* @returns A FormControl
|
|
2815
|
-
*/
|
|
2816
|
-
transformToControl(control) {
|
|
2817
|
-
return control;
|
|
2818
|
-
}
|
|
2819
|
-
formatDate(date) {
|
|
2820
|
-
if (!date) {
|
|
2821
|
-
return null;
|
|
2822
|
-
}
|
|
2823
|
-
const newDate = new Date(date);
|
|
2824
|
-
return newDate.toISOString().substring(0, 16);
|
|
2825
|
-
}
|
|
2826
|
-
}
|
|
2827
|
-
ModelFormBaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ModelFormBaseComponent, deps: [{ token: i1$1.CmsService }, { token: i1$1.ToastService }, { token: i2$1.Router }, { token: i2$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
|
|
2828
|
-
ModelFormBaseComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ModelFormBaseComponent, selector: "ng-component", inputs: { modelName: "modelName", label: "label", id: "id", delete: "delete", onlyUpdateMode: "onlyUpdateMode", duplicate: "duplicate", logging: "logging", config: "config", showFavButton: "showFavButton" }, outputs: { finished: "finished" }, ngImport: i0, template: '', isInline: true });
|
|
2829
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ModelFormBaseComponent, decorators: [{
|
|
2830
|
-
type: Component,
|
|
2831
|
-
args: [{
|
|
2832
|
-
template: '',
|
|
2833
|
-
}]
|
|
2834
|
-
}], ctorParameters: function () { return [{ type: i1$1.CmsService }, { type: i1$1.ToastService }, { type: i2$1.Router }, { type: i2$1.ActivatedRoute }]; }, propDecorators: { modelName: [{
|
|
2835
|
-
type: Input
|
|
2836
|
-
}], label: [{
|
|
2837
|
-
type: Input
|
|
2838
|
-
}], id: [{
|
|
2839
|
-
type: Input
|
|
2840
|
-
}], delete: [{
|
|
2841
|
-
type: Input
|
|
2842
|
-
}], onlyUpdateMode: [{
|
|
2843
|
-
type: Input
|
|
2844
|
-
}], duplicate: [{
|
|
2845
|
-
type: Input
|
|
2846
|
-
}], logging: [{
|
|
2847
|
-
type: Input
|
|
2848
|
-
}], config: [{
|
|
2849
|
-
type: Input
|
|
2850
|
-
}], showFavButton: [{
|
|
2851
|
-
type: Input
|
|
2852
|
-
}], finished: [{
|
|
2853
|
-
type: Output
|
|
2854
|
-
}] } });
|
|
2855
|
-
|
|
2856
|
-
/**
|
|
2857
|
-
* Exports for public API
|
|
2858
|
-
*/
|
|
2859
|
-
// Module
|
|
2860
|
-
|
|
2861
|
-
/**
|
|
2862
|
-
* Generated bundle index. Do not edit.
|
|
2863
|
-
*/
|
|
2864
|
-
|
|
2865
|
-
export { BackButtonDirective, BaseComponentsModule, BreadcrumbComponent, ChangePasswordComponent, CheckboxComponent, ContextMenuDirective, DeleteAccountComponent, EllipsesPipe, FabButtonComponent, InputComponent, LoadingBarComponent, ModelFormBaseComponent, ModelFormComponent, ModelFormSubComponent, ModelTableComponent, RefenceInputComponent, SelectComponent, SkeletonLoaderComponent, SortDirective, StopPropagationDirective, TagsComponent, TextareaComponent, ToastComponent, UploadImageComponent };
|
|
2866
|
-
//# sourceMappingURL=lenne.tech-ng-base-base-components.mjs.map
|