spiderly 19.0.1 → 19.0.2
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/fesm2022/spiderly.mjs +4612 -0
- package/fesm2022/spiderly.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/auth/login/login.component.d.ts +35 -0
- package/lib/components/auth/partials/auth.component.d.ts +21 -0
- package/lib/components/auth/partials/login-verification.component.d.ts +18 -0
- package/lib/components/auth/partials/registration-verification.component.d.ts +17 -0
- package/lib/components/auth/partials/verification-wrapper.component.d.ts +31 -0
- package/lib/components/auth/registration/registration.component.d.ts +34 -0
- package/lib/components/base-details/role-base-details.component.d.ts +50 -0
- package/lib/components/base-form/base-form copy.d.ts +54 -0
- package/lib/components/card-skeleton/card-skeleton.component.d.ts +12 -0
- package/lib/components/footer/footer.component.d.ts +9 -0
- package/lib/components/index-card/index-card.component.d.ts +22 -0
- package/lib/components/info-card/info-card.component.d.ts +11 -0
- package/lib/components/layout/layout-base.component.d.ts +37 -0
- package/lib/components/layout/sidebar/menuitem.component.d.ts +43 -0
- package/lib/components/layout/sidebar/sidebar-menu.component.d.ts +23 -0
- package/lib/components/layout/sidebar/sidebar-menu.service.d.ts +12 -0
- package/lib/components/layout/sidebar/sidebar.component.d.ts +11 -0
- package/lib/components/layout/topbar/topbar.component.d.ts +45 -0
- package/lib/components/not-found/not-found.component.d.ts +9 -0
- package/lib/components/required/required.component.d.ts +6 -0
- package/lib/components/spiderly-buttons/google-button/google-button.component.d.ts +17 -0
- package/lib/components/spiderly-buttons/return-button/return-button.component.d.ts +10 -0
- package/lib/components/spiderly-buttons/spiderly-button/spiderly-button.component.d.ts +6 -0
- package/lib/components/spiderly-buttons/spiderly-button-base/spiderly-button-base.d.ts +27 -0
- package/lib/components/spiderly-buttons/spiderly-split-button/spiderly-split-button.component.d.ts +8 -0
- package/lib/components/spiderly-data-table/spiderly-data-table.component.d.ts +157 -0
- package/lib/components/spiderly-delete-dialog/spiderly-delete-confirmation.component.d.ts +11 -0
- package/lib/components/spiderly-form-control/spiderly-form-control.d.ts +37 -0
- package/lib/components/spiderly-panels/panel-body/panel-body.component.d.ts +9 -0
- package/lib/components/spiderly-panels/panel-footer/panel-footer.component.d.ts +8 -0
- package/lib/components/spiderly-panels/panel-header/panel-header.component.d.ts +29 -0
- package/lib/components/spiderly-panels/spiderly-card/spiderly-card.component.d.ts +10 -0
- package/lib/components/spiderly-panels/spiderly-panel/spiderly-panel.component.d.ts +25 -0
- package/lib/components/spiderly-panels/spiderly-panels.module.d.ts +13 -0
- package/lib/controls/base-autocomplete-control.d.ts +9 -0
- package/lib/controls/base-control.d.ts +23 -0
- package/lib/controls/base-dropdown-control.d.ts +18 -0
- package/lib/controls/spiderly-autocomplete/spiderly-autocomplete.component.d.ts +18 -0
- package/lib/controls/spiderly-calendar/spiderly-calendar.component.d.ts +13 -0
- package/lib/controls/spiderly-checkbox/spiderly-checkbox.component.d.ts +14 -0
- package/lib/controls/spiderly-colorpick/spiderly-colorpick.component.d.ts +11 -0
- package/lib/controls/spiderly-controls.module.d.ts +22 -0
- package/lib/controls/spiderly-dropdown/spiderly-dropdown.component.d.ts +14 -0
- package/lib/controls/spiderly-editor/spiderly-editor.component.d.ts +16 -0
- package/lib/controls/spiderly-file/spiderly-file.component.d.ts +36 -0
- package/lib/controls/spiderly-multiautocomplete/spiderly-multiautocomplete.component.d.ts +13 -0
- package/lib/controls/spiderly-multiselect/spiderly-multiselect.component.d.ts +11 -0
- package/lib/controls/spiderly-number/spiderly-number.component.d.ts +15 -0
- package/lib/controls/spiderly-password/spiderly-password.component.d.ts +12 -0
- package/lib/controls/spiderly-textarea/spiderly-textarea.component.d.ts +11 -0
- package/lib/controls/spiderly-textbox/spiderly-textbox.component.d.ts +15 -0
- package/lib/entities/base-entity.d.ts +14 -0
- package/lib/entities/codebook.d.ts +9 -0
- package/lib/entities/init-company-auth-dialog-details.d.ts +9 -0
- package/lib/entities/init-top-bar-data.d.ts +16 -0
- package/lib/entities/is-authorized-for-save-event.d.ts +9 -0
- package/lib/entities/last-menu-icon-index-clicked.d.ts +7 -0
- package/lib/entities/lazy-load-selected-ids-result.d.ts +9 -0
- package/{src/lib/entities/menuchangeevent.ts → lib/entities/menuchangeevent.d.ts} +4 -4
- package/lib/entities/mime-type.d.ts +11 -0
- package/lib/entities/namebook.d.ts +9 -0
- package/lib/entities/primeng-option.d.ts +9 -0
- package/lib/entities/security-entities.d.ts +211 -0
- package/lib/entities/simple-save-result.d.ts +7 -0
- package/lib/entities/spiderly-button.d.ts +13 -0
- package/{src/lib/entities/table-filter-context.ts → lib/entities/table-filter-context.d.ts} +5 -6
- package/lib/entities/table-filter-sort-meta.d.ts +4 -0
- package/{src/lib/entities/table-filter.ts → lib/entities/table-filter.d.ts} +23 -48
- package/lib/entities/table-response.d.ts +4 -0
- package/lib/enums/security-enums.d.ts +22 -0
- package/lib/enums/verification-type-codes.d.ts +4 -0
- package/lib/guards/auth.guard.d.ts +15 -0
- package/lib/guards/not-auth.guard.d.ts +12 -0
- package/lib/handlers/spiderly-error-handler.d.ts +14 -0
- package/lib/handlers/spiderly-transloco-fallback-strategy.d.ts +13 -0
- package/lib/interceptors/http-loading.interceptor.d.ts +2 -0
- package/lib/interceptors/json-parser.interceptor.d.ts +2 -0
- package/lib/interceptors/jwt.interceptor.d.ts +2 -0
- package/lib/interceptors/unauthorized.interceptor.d.ts +2 -0
- package/lib/modules/core.module.d.ts +2 -0
- package/lib/modules/primeng.module.d.ts +42 -0
- package/lib/modules/spiderly-transloco.module.d.ts +15 -0
- package/lib/services/api.service.security.d.ts +35 -0
- package/lib/services/app-initializer.d.ts +4 -0
- package/lib/services/app-layout-base.service.d.ts +60 -0
- package/lib/services/auth-base.service.d.ts +55 -0
- package/lib/services/base-form.service.d.ts +27 -0
- package/lib/services/config-base.service.d.ts +24 -0
- package/lib/services/helper-functions.d.ts +37 -0
- package/lib/services/spiderly-message.service.d.ts +17 -0
- package/lib/services/spiderly-transloco-loader.d.ts +10 -0
- package/lib/services/translate-labels-abstract.service.d.ts +7 -0
- package/lib/services/validator-abstract.service.d.ts +13 -0
- package/package.json +66 -55
- package/{src/public-api.ts → public-api.d.ts} +91 -103
- package/eslint.config.js +0 -32
- package/ng-package.json +0 -10
- package/src/lib/components/auth/login/login.component.html +0 -25
- package/src/lib/components/auth/login/login.component.ts +0 -77
- package/src/lib/components/auth/partials/auth.component.html +0 -29
- package/src/lib/components/auth/partials/auth.component.ts +0 -60
- package/src/lib/components/auth/partials/login-verification.component.html +0 -2
- package/src/lib/components/auth/partials/login-verification.component.ts +0 -41
- package/src/lib/components/auth/partials/registration-verification.component.html +0 -1
- package/src/lib/components/auth/partials/registration-verification.component.ts +0 -41
- package/src/lib/components/auth/partials/verification-wrapper.component.html +0 -39
- package/src/lib/components/auth/partials/verification-wrapper.component.ts +0 -68
- package/src/lib/components/auth/registration/registration.component.html +0 -31
- package/src/lib/components/auth/registration/registration.component.ts +0 -77
- package/src/lib/components/base-details/role-base-details.component.html +0 -33
- package/src/lib/components/base-details/role-base-details.component.ts +0 -194
- package/src/lib/components/base-form/base-form copy.ts +0 -356
- package/src/lib/components/card-skeleton/card-skeleton.component.html +0 -8
- package/src/lib/components/card-skeleton/card-skeleton.component.ts +0 -21
- package/src/lib/components/footer/app.footer.component.ts +0 -17
- package/src/lib/components/footer/footer.component.html +0 -3
- package/src/lib/components/footer/footer.component.ts +0 -17
- package/src/lib/components/index-card/index-card.component.html +0 -15
- package/src/lib/components/index-card/index-card.component.ts +0 -48
- package/src/lib/components/info-card/info-card.component.html +0 -18
- package/src/lib/components/info-card/info-card.component.ts +0 -29
- package/src/lib/components/layout/layout-base.component.ts +0 -140
- package/src/lib/components/layout/sidebar/menuitem.component.html +0 -40
- package/src/lib/components/layout/sidebar/menuitem.component.ts +0 -179
- package/src/lib/components/layout/sidebar/sidebar-menu.component.html +0 -6
- package/src/lib/components/layout/sidebar/sidebar-menu.component.ts +0 -44
- package/src/lib/components/layout/sidebar/sidebar-menu.service.ts +0 -22
- package/src/lib/components/layout/sidebar/sidebar.component.html +0 -1
- package/src/lib/components/layout/sidebar/sidebar.component.ts +0 -20
- package/src/lib/components/layout/topbar/topbar.component.html +0 -64
- package/src/lib/components/layout/topbar/topbar.component.ts +0 -137
- package/src/lib/components/not-found/not-found.component.html +0 -27
- package/src/lib/components/not-found/not-found.component.ts +0 -22
- package/src/lib/components/required/required.component.html +0 -1
- package/src/lib/components/required/required.component.ts +0 -13
- package/src/lib/components/spiderly-buttons/google-button/google-button.component.html +0 -5
- package/src/lib/components/spiderly-buttons/google-button/google-button.component.ts +0 -53
- package/src/lib/components/spiderly-buttons/return-button/return-button.component.html +0 -3
- package/src/lib/components/spiderly-buttons/return-button/return-button.component.ts +0 -35
- package/src/lib/components/spiderly-buttons/spiderly-button/spiderly-button.component.html +0 -14
- package/src/lib/components/spiderly-buttons/spiderly-button/spiderly-button.component.ts +0 -27
- package/src/lib/components/spiderly-buttons/spiderly-button-base/spiderly-button-base.ts +0 -61
- package/src/lib/components/spiderly-buttons/spiderly-split-button/spiderly-split-button.component.html +0 -15
- package/src/lib/components/spiderly-buttons/spiderly-split-button/spiderly-split-button.component.ts +0 -24
- package/src/lib/components/spiderly-data-table/spiderly-data-table.component.html +0 -93
- package/src/lib/components/spiderly-data-table/spiderly-data-table.component.ts +0 -614
- package/src/lib/components/spiderly-delete-dialog/spiderly-delete-confirmation.component.html +0 -17
- package/src/lib/components/spiderly-delete-dialog/spiderly-delete-confirmation.component.ts +0 -39
- package/src/lib/components/spiderly-form-control/spiderly-form-control.ts +0 -60
- package/src/lib/components/spiderly-panels/panel-body/panel-body.component.html +0 -8
- package/src/lib/components/spiderly-panels/panel-body/panel-body.component.ts +0 -16
- package/src/lib/components/spiderly-panels/panel-footer/panel-footer.component.html +0 -8
- package/src/lib/components/spiderly-panels/panel-footer/panel-footer.component.ts +0 -15
- package/src/lib/components/spiderly-panels/panel-header/panel-header.component.html +0 -25
- package/src/lib/components/spiderly-panels/panel-header/panel-header.component.ts +0 -69
- package/src/lib/components/spiderly-panels/spiderly-card/spiderly-card.component.html +0 -7
- package/src/lib/components/spiderly-panels/spiderly-card/spiderly-card.component.ts +0 -17
- package/src/lib/components/spiderly-panels/spiderly-panel/spiderly-panel.component.html +0 -40
- package/src/lib/components/spiderly-panels/spiderly-panel/spiderly-panel.component.ts +0 -42
- package/src/lib/components/spiderly-panels/spiderly-panels.module.ts +0 -32
- package/src/lib/controls/base-autocomplete-control.ts +0 -17
- package/src/lib/controls/base-control.ts +0 -60
- package/src/lib/controls/base-dropdown-control.ts +0 -37
- package/src/lib/controls/spiderly-autocomplete/spiderly-autocomplete.component.html +0 -36
- package/src/lib/controls/spiderly-autocomplete/spiderly-autocomplete.component.ts +0 -56
- package/src/lib/controls/spiderly-calendar/spiderly-calendar.component.html +0 -21
- package/src/lib/controls/spiderly-calendar/spiderly-calendar.component.ts +0 -37
- package/src/lib/controls/spiderly-checkbox/spiderly-checkbox.component.html +0 -16
- package/src/lib/controls/spiderly-checkbox/spiderly-checkbox.component.ts +0 -38
- package/src/lib/controls/spiderly-colorpick/spiderly-colorpick.component.html +0 -33
- package/src/lib/controls/spiderly-colorpick/spiderly-colorpick.component.ts +0 -40
- package/src/lib/controls/spiderly-controls.module.ts +0 -61
- package/src/lib/controls/spiderly-dropdown/spiderly-dropdown.component.html +0 -27
- package/src/lib/controls/spiderly-dropdown/spiderly-dropdown.component.ts +0 -39
- package/src/lib/controls/spiderly-editor/spiderly-editor.component.html +0 -22
- package/src/lib/controls/spiderly-editor/spiderly-editor.component.ts +0 -58
- package/src/lib/controls/spiderly-file/spiderly-file.component.html +0 -54
- package/src/lib/controls/spiderly-file/spiderly-file.component.ts +0 -123
- package/src/lib/controls/spiderly-multiautocomplete/spiderly-multiautocomplete.component.html +0 -30
- package/src/lib/controls/spiderly-multiautocomplete/spiderly-multiautocomplete.component.ts +0 -38
- package/src/lib/controls/spiderly-multiselect/spiderly-multiselect.component.html +0 -23
- package/src/lib/controls/spiderly-multiselect/spiderly-multiselect.component.ts +0 -32
- package/src/lib/controls/spiderly-number/spiderly-number.component.html +0 -19
- package/src/lib/controls/spiderly-number/spiderly-number.component.ts +0 -37
- package/src/lib/controls/spiderly-password/spiderly-password.component.html +0 -17
- package/src/lib/controls/spiderly-password/spiderly-password.component.ts +0 -34
- package/src/lib/controls/spiderly-textarea/spiderly-textarea.component.html +0 -18
- package/src/lib/controls/spiderly-textarea/spiderly-textarea.component.ts +0 -32
- package/src/lib/controls/spiderly-textbox/spiderly-textbox.component.html +0 -23
- package/src/lib/controls/spiderly-textbox/spiderly-textbox.component.ts +0 -41
- package/src/lib/entities/base-entity.ts +0 -25
- package/src/lib/entities/codebook.ts +0 -23
- package/src/lib/entities/init-company-auth-dialog-details.ts +0 -22
- package/src/lib/entities/init-top-bar-data.ts +0 -35
- package/src/lib/entities/is-authorized-for-save-event.ts +0 -22
- package/src/lib/entities/last-menu-icon-index-clicked.ts +0 -18
- package/src/lib/entities/lazy-load-selected-ids-result.ts +0 -22
- package/src/lib/entities/mime-type.ts +0 -15
- package/src/lib/entities/namebook.ts +0 -22
- package/src/lib/entities/primeng-option.ts +0 -23
- package/src/lib/entities/readonly-object.ts +0 -1
- package/src/lib/entities/security-entities.ts +0 -548
- package/src/lib/entities/simple-save-result.ts +0 -19
- package/src/lib/entities/spiderly-button.ts +0 -30
- package/src/lib/entities/table-filter-sort-meta.ts +0 -5
- package/src/lib/entities/table-response.ts +0 -5
- package/src/lib/enums/security-enums.ts +0 -28
- package/src/lib/enums/verification-type-codes.ts +0 -5
- package/src/lib/guards/auth.guard.ts +0 -39
- package/src/lib/guards/not-auth.guard.ts +0 -32
- package/src/lib/handlers/spiderly-error-handler.ts +0 -32
- package/src/lib/handlers/spiderly-transloco-fallback-strategy.ts +0 -25
- package/src/lib/interceptors/http-loading.interceptor.ts +0 -21
- package/src/lib/interceptors/json-parser.interceptor.ts +0 -44
- package/src/lib/interceptors/jwt.interceptor.ts +0 -18
- package/src/lib/interceptors/unauthorized.interceptor.ts +0 -77
- package/src/lib/modules/core.module.ts +0 -22
- package/src/lib/modules/primeng.module.ts +0 -122
- package/src/lib/modules/spiderly-transloco.module.ts +0 -50
- package/src/lib/services/api.service.security.ts +0 -120
- package/src/lib/services/app-initializer.ts +0 -9
- package/src/lib/services/app-layout-base.service.ts +0 -184
- package/src/lib/services/auth-base.service.ts +0 -271
- package/src/lib/services/base-form.service.ts +0 -178
- package/src/lib/services/config-base.service.ts +0 -36
- package/src/lib/services/helper-functions.ts +0 -288
- package/src/lib/services/spiderly-message.service.ts +0 -66
- package/src/lib/services/spiderly-transloco-loader.ts +0 -15
- package/src/lib/services/translate-labels-abstract.service.ts +0 -13
- package/src/lib/services/validator-abstract.service.ts +0 -63
- package/tsconfig.lib.json +0 -17
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -14
- /package/{src/lib → styles}/components/spiderly-data-table/spiderly-data-table.component.scss +0 -0
- /package/{src/lib → styles}/components/spiderly-panels/panel-footer/panel-footer.component.scss +0 -0
- /package/{src/lib → styles}/components/spiderly-panels/spiderly-panel/spiderly-panel.component.scss +0 -0
- /package/{src/lib → styles}/styles/layout/_config.scss +0 -0
- /package/{src/lib → styles}/styles/layout/_content.scss +0 -0
- /package/{src/lib → styles}/styles/layout/_footer.scss +0 -0
- /package/{src/lib → styles}/styles/layout/_main.scss +0 -0
- /package/{src/lib → styles}/styles/layout/_menu.scss +0 -0
- /package/{src/lib → styles}/styles/layout/_mixins.scss +0 -0
- /package/{src/lib → styles}/styles/layout/_preloading.scss +0 -0
- /package/{src/lib → styles}/styles/layout/_responsive.scss +0 -0
- /package/{src/lib → styles}/styles/layout/_spiderly-controls.scss +0 -0
- /package/{src/lib → styles}/styles/layout/_topbar.scss +0 -0
- /package/{src/lib → styles}/styles/layout/_typography.scss +0 -0
- /package/{src/lib → styles}/styles/layout/_utils.scss +0 -0
- /package/{src/lib → styles}/styles/layout/_variables.scss +0 -0
- /package/{src/lib → styles}/styles/layout/layout.scss +0 -0
- /package/{src/lib → styles}/styles/shared.scss +0 -0
- /package/{src/lib → styles}/styles/styles.scss +0 -0
|
@@ -1,356 +0,0 @@
|
|
|
1
|
-
import { BaseFormService } from './../../services/base-form.service';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectorRef,
|
|
4
|
-
Component,
|
|
5
|
-
KeyValueDiffer,
|
|
6
|
-
KeyValueDiffers,
|
|
7
|
-
OnInit,
|
|
8
|
-
} from '@angular/core';
|
|
9
|
-
import { SpiderlyFormArray, SpiderlyFormControl, SpiderlyFormGroup } from '../spiderly-form-control/spiderly-form-control';
|
|
10
|
-
import { HttpClient } from '@angular/common/http';
|
|
11
|
-
import { SpiderlyMessageService } from '../../services/spiderly-message.service';
|
|
12
|
-
import { ActivatedRoute, Router } from '@angular/router';
|
|
13
|
-
import { MenuItem } from 'primeng/api';
|
|
14
|
-
import { getControl, getParentUrl } from '../../services/helper-functions';
|
|
15
|
-
import { TranslocoService } from '@jsverse/transloco';
|
|
16
|
-
import { BaseEntity } from '../../entities/base-entity';
|
|
17
|
-
import { LastMenuIconIndexClicked } from '../../entities/last-menu-icon-index-clicked';
|
|
18
|
-
|
|
19
|
-
@Component({
|
|
20
|
-
selector: 'base-form',
|
|
21
|
-
template: '',
|
|
22
|
-
styles: [],
|
|
23
|
-
standalone: false
|
|
24
|
-
})
|
|
25
|
-
export class BaseFormCopy implements OnInit {
|
|
26
|
-
formGroup: SpiderlyFormGroup = new SpiderlyFormGroup({});
|
|
27
|
-
saveBody: any;
|
|
28
|
-
successfulSaveToastDescription: string = this.translocoService.translate('SuccessfulSaveToastDescription');
|
|
29
|
-
loading: boolean = true;
|
|
30
|
-
|
|
31
|
-
private modelDiffer: KeyValueDiffer<string, any>;
|
|
32
|
-
|
|
33
|
-
constructor(
|
|
34
|
-
protected differs: KeyValueDiffers,
|
|
35
|
-
protected http: HttpClient,
|
|
36
|
-
protected messageService: SpiderlyMessageService,
|
|
37
|
-
protected changeDetectorRef: ChangeDetectorRef,
|
|
38
|
-
protected router: Router,
|
|
39
|
-
protected route: ActivatedRoute,
|
|
40
|
-
protected translocoService: TranslocoService,
|
|
41
|
-
protected baseFormService: BaseFormService,
|
|
42
|
-
) {
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
ngOnInit(){
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
//#region Model
|
|
49
|
-
|
|
50
|
-
initFormGroup = <T>(
|
|
51
|
-
formGroup: SpiderlyFormGroup<T>,
|
|
52
|
-
parentFormGroup: SpiderlyFormGroup,
|
|
53
|
-
modelConstructor: any,
|
|
54
|
-
propertyNameInSaveBody: string,
|
|
55
|
-
updateOnChangeControls?: (keyof T)[]
|
|
56
|
-
) => {
|
|
57
|
-
return this.baseFormService.addFormGroup(
|
|
58
|
-
formGroup, parentFormGroup, modelConstructor, propertyNameInSaveBody, updateOnChangeControls
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
createFormGroup = <T>(
|
|
63
|
-
formGroup: SpiderlyFormGroup<T>,
|
|
64
|
-
modelConstructor: T & BaseEntity,
|
|
65
|
-
updateOnChangeControls?: (keyof T)[]
|
|
66
|
-
) => {
|
|
67
|
-
return this.baseFormService.initFormGroup(
|
|
68
|
-
formGroup, modelConstructor, updateOnChangeControls
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
control = <T extends BaseEntity>(formControlName: string & keyof T, formGroup: SpiderlyFormGroup<T>) => {
|
|
73
|
-
return getControl(formControlName, formGroup);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
onSave = (reroute: boolean = true) => {
|
|
77
|
-
this.saveBody = this.formGroup.initSaveBody();
|
|
78
|
-
this.onBeforeSave(this.saveBody);
|
|
79
|
-
|
|
80
|
-
this.saveBody = this.saveBody ?? this.formGroup.getRawValue();
|
|
81
|
-
|
|
82
|
-
let isValid: boolean = this.areFormGroupsFromParentFormGroupValid();
|
|
83
|
-
let isFormArrayValid: boolean = this.areFormArraysValid();
|
|
84
|
-
|
|
85
|
-
if(isValid && isFormArrayValid){
|
|
86
|
-
this.formGroup.saveObservableMethod(this.saveBody).subscribe(res => {
|
|
87
|
-
this.messageService.successMessage(this.successfulSaveToastDescription);
|
|
88
|
-
|
|
89
|
-
Object.keys(res).forEach((key) => {
|
|
90
|
-
const formControl = this.formGroup.get(key);
|
|
91
|
-
|
|
92
|
-
if (formControl) {
|
|
93
|
-
if (formControl instanceof SpiderlyFormArray) {
|
|
94
|
-
const formArray = formControl as SpiderlyFormArray;
|
|
95
|
-
if (res[key].length !== 0) {
|
|
96
|
-
formArray.clear();
|
|
97
|
-
}
|
|
98
|
-
else{
|
|
99
|
-
// FT: This is okay because when we have M2M association with additional fields, we will not give back the list because we are not checking version on the server.
|
|
100
|
-
// console.error(`You returned empty array for control: ${formArray.translationKey}.`);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
res[key].forEach((model: any) => {
|
|
104
|
-
if (typeof model === 'object' && model !== null) {
|
|
105
|
-
Object.assign(formArray.modelConstructor, model);
|
|
106
|
-
let helperFormGroup = new SpiderlyFormGroup({});
|
|
107
|
-
this.baseFormService.initFormGroup(helperFormGroup, formArray.modelConstructor)
|
|
108
|
-
formArray.push(helperFormGroup);
|
|
109
|
-
} else {
|
|
110
|
-
console.error('Can not add primitive form control inside form array.');
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
} else {
|
|
115
|
-
formControl.patchValue(res[key]);
|
|
116
|
-
}
|
|
117
|
-
}else{
|
|
118
|
-
// FT: It's okay to do this.
|
|
119
|
-
// console.error('You returned something that is not in the save DTO.');
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
if (reroute) {
|
|
124
|
-
const savedObjectId = (res as any)[this.formGroup.mainDTOName]?.id;
|
|
125
|
-
this.rerouteToSavedObject(savedObjectId); // You always need to have id, because of id == 0 and version change
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
this.onAfterSave();
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
this.onAfterSaveRequest();
|
|
132
|
-
}else{
|
|
133
|
-
this.baseFormService.showInvalidFieldsMessage();
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
rerouteToSavedObject = (rerouteId: number | string): void => {
|
|
138
|
-
if(rerouteId == null){
|
|
139
|
-
// console.error('You do not have rerouteId in your DTO.')
|
|
140
|
-
const currentUrl = this.router.url;
|
|
141
|
-
const parentUrl: string = getParentUrl(currentUrl);
|
|
142
|
-
this.router.navigateByUrl(parentUrl);
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const segments = this.router.url.split('/');
|
|
147
|
-
segments[segments.length - 1] = rerouteId.toString();
|
|
148
|
-
|
|
149
|
-
const newUrl = segments.join('/');
|
|
150
|
-
this.router.navigateByUrl(newUrl);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
onBeforeSave = (saveBody?: any) => {}
|
|
154
|
-
onAfterSave = () => {}
|
|
155
|
-
onAfterSaveRequest = () => {}
|
|
156
|
-
|
|
157
|
-
areFormGroupsFromParentFormGroupValid(): boolean {
|
|
158
|
-
if(this.formGroup.controls == null)
|
|
159
|
-
return true;
|
|
160
|
-
|
|
161
|
-
let invalid: boolean = false;
|
|
162
|
-
|
|
163
|
-
Object.keys(this.formGroup.controls).forEach(key => {
|
|
164
|
-
const formGroupOrControl = this.formGroup.controls[key];
|
|
165
|
-
|
|
166
|
-
if (formGroupOrControl instanceof SpiderlyFormGroup){
|
|
167
|
-
Object.keys(formGroupOrControl.controls).forEach(key => {
|
|
168
|
-
const formControl = formGroupOrControl.controls[key] as SpiderlyFormControl; // this.formArray.markAsDirty(); // FT: For some reason this doesnt work
|
|
169
|
-
|
|
170
|
-
if (formGroupOrControl.controlNamesFromHtml.includes(formControl.label) && formControl.invalid) {
|
|
171
|
-
formControl.markAsDirty();
|
|
172
|
-
invalid = true;
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
else if (formGroupOrControl instanceof SpiderlyFormControl){
|
|
177
|
-
if (formGroupOrControl.invalid) {
|
|
178
|
-
formGroupOrControl.markAsDirty();
|
|
179
|
-
invalid = true;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
if (invalid) {
|
|
186
|
-
return false;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return true;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
//#endregion
|
|
193
|
-
|
|
194
|
-
//#region Model List
|
|
195
|
-
|
|
196
|
-
getFormArrayControlByIndex<T>(formControlName: keyof T & string, formArray: SpiderlyFormArray<T>, index: number, filter?: (formGroups: SpiderlyFormGroup<T>[]) => SpiderlyFormGroup<T>[]): SpiderlyFormControl {
|
|
197
|
-
if(formArray.controlNamesFromHtml.findIndex(x => x === formControlName) === -1)
|
|
198
|
-
formArray.controlNamesFromHtml.push(formControlName);
|
|
199
|
-
|
|
200
|
-
let filteredFormGroups: SpiderlyFormGroup<T>[];
|
|
201
|
-
|
|
202
|
-
if (filter) {
|
|
203
|
-
filteredFormGroups = filter(formArray.controls as SpiderlyFormGroup<T>[]);
|
|
204
|
-
}
|
|
205
|
-
else{
|
|
206
|
-
return (formArray.controls[index] as SpiderlyFormGroup<T>).controls[formControlName] as SpiderlyFormControl;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
return filteredFormGroups[index]?.controls[formControlName] as SpiderlyFormControl; // FT: Don't change this. It's always possible that change detection occurs before something.
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
getFormArrayControls<T>(formControlName: keyof T & string, formArray: SpiderlyFormArray<T>, filter?: (formGroups: SpiderlyFormGroup<T>[]) => SpiderlyFormGroup<T>[]): SpiderlyFormControl[] {
|
|
213
|
-
if(formArray.controlNamesFromHtml.findIndex(x => x === formControlName) === -1)
|
|
214
|
-
formArray.controlNamesFromHtml.push(formControlName);
|
|
215
|
-
|
|
216
|
-
let filteredFormGroups: SpiderlyFormGroup<T>[];
|
|
217
|
-
|
|
218
|
-
if (filter) {
|
|
219
|
-
filteredFormGroups = filter(formArray.controls as SpiderlyFormGroup<T>[]);
|
|
220
|
-
}
|
|
221
|
-
else{
|
|
222
|
-
return (formArray.controls as SpiderlyFormGroup<T>[]).map(x => x.controls[formControlName] as SpiderlyFormControl);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return filteredFormGroups.map(x => x.controls[formControlName] as SpiderlyFormControl);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
getFormArrayGroups<T>(formArray: SpiderlyFormArray<T>): SpiderlyFormGroup<T>[]{
|
|
229
|
-
return this.baseFormService.getFormArrayGroups(formArray);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
addNewFormGroupToFormArray<T>(
|
|
233
|
-
formArray: SpiderlyFormArray<T>,
|
|
234
|
-
modelConstructor: T & BaseEntity,
|
|
235
|
-
index: number,
|
|
236
|
-
) : SpiderlyFormGroup {
|
|
237
|
-
return this.baseFormService.addNewFormGroupToFormArray(formArray, modelConstructor, index)
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
initFormArray<T>(
|
|
241
|
-
parentFormGroup: SpiderlyFormGroup,
|
|
242
|
-
modelList: (T & BaseEntity)[],
|
|
243
|
-
modelConstructor: T & BaseEntity,
|
|
244
|
-
formArraySaveBodyName: string,
|
|
245
|
-
formArrayTranslationKey: string,
|
|
246
|
-
required: boolean = false)
|
|
247
|
-
{
|
|
248
|
-
return this.baseFormService.initFormArray<T>(
|
|
249
|
-
parentFormGroup, modelList, modelConstructor, formArraySaveBodyName, formArrayTranslationKey, required
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
removeFormControlFromTheFormArray(formArray: SpiderlyFormArray, index: number) {
|
|
254
|
-
if(index == null)
|
|
255
|
-
throw new Error('Can not pass null index.');
|
|
256
|
-
|
|
257
|
-
formArray.removeAt(index);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
removeFormControlsFromTheFormArray(formArray: SpiderlyFormArray, indexes: number[]) {
|
|
261
|
-
// Sort indexes in descending order to avoid index shifts when removing controls
|
|
262
|
-
const sortedIndexes = indexes.sort((a, b) => b - a);
|
|
263
|
-
|
|
264
|
-
sortedIndexes.forEach(index => {
|
|
265
|
-
if (index >= 0 && index < formArray.length) {
|
|
266
|
-
formArray.removeAt(index);
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
areFormArraysValid(): boolean {
|
|
272
|
-
if(this.formGroup.controls == null)
|
|
273
|
-
return true;
|
|
274
|
-
|
|
275
|
-
let invalid: boolean = false;
|
|
276
|
-
|
|
277
|
-
Object.keys(this.formGroup.controls).forEach(key => {
|
|
278
|
-
const formArray = this.formGroup.controls[key] as unknown as SpiderlyFormArray;
|
|
279
|
-
|
|
280
|
-
if (formArray instanceof SpiderlyFormArray){
|
|
281
|
-
(formArray.controls as SpiderlyFormGroup[]).forEach(formGroup => {
|
|
282
|
-
Object.keys(formGroup.controls).forEach(key => {
|
|
283
|
-
const formControl = formGroup.controls[key] as SpiderlyFormControl; // this.formArray.markAsDirty(); // FT: For some reason this doesn't work
|
|
284
|
-
|
|
285
|
-
if (
|
|
286
|
-
(formGroup.controlNamesFromHtml.includes(formControl.label) || formArray.controlNamesFromHtml.includes(formControl.label)) &&
|
|
287
|
-
formControl.invalid
|
|
288
|
-
) {
|
|
289
|
-
formControl.markAsDirty();
|
|
290
|
-
invalid = true;
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
if (formArray.required == true && formArray.length == 0) {
|
|
296
|
-
invalid = true;
|
|
297
|
-
this.messageService.warningMessage(this.translocoService.translate('ListCanNotBeEmpty'));
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
if (invalid) {
|
|
303
|
-
return false;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
return true;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
onBeforeSaveList(){}
|
|
310
|
-
onAfterSaveList(){}
|
|
311
|
-
onAfterSaveListRequest(){}
|
|
312
|
-
|
|
313
|
-
// FT: Sending LastMenuIconIndexClicked class because of reference type
|
|
314
|
-
getCrudMenuForOrderedData = (
|
|
315
|
-
formArray: SpiderlyFormArray,
|
|
316
|
-
modelConstructor: BaseEntity,
|
|
317
|
-
lastMenuIconIndexClicked: LastMenuIconIndexClicked,
|
|
318
|
-
adjustFormArrayManually: boolean = false
|
|
319
|
-
): MenuItem[] => {
|
|
320
|
-
let crudMenuForOrderedData: MenuItem[] = [
|
|
321
|
-
{label: this.translocoService.translate('Remove'), icon: 'pi pi-minus', command: () => {
|
|
322
|
-
this.onBeforeRemove(formArray, modelConstructor, lastMenuIconIndexClicked.index);
|
|
323
|
-
if (adjustFormArrayManually === false) {
|
|
324
|
-
this.removeFormControlFromTheFormArray(formArray, lastMenuIconIndexClicked.index);
|
|
325
|
-
}
|
|
326
|
-
}},
|
|
327
|
-
{label: this.translocoService.translate('AddAbove'), icon: 'pi pi-arrow-up', command: () => {
|
|
328
|
-
this.onBeforeAddAbove(formArray, modelConstructor, lastMenuIconIndexClicked.index);
|
|
329
|
-
if (adjustFormArrayManually === false) {
|
|
330
|
-
this.baseFormService.addNewFormGroupToFormArray(
|
|
331
|
-
formArray, modelConstructor, lastMenuIconIndexClicked.index
|
|
332
|
-
);
|
|
333
|
-
}
|
|
334
|
-
}},
|
|
335
|
-
{label: this.translocoService.translate('AddBelow'), icon: 'pi pi-arrow-down', command: () => {
|
|
336
|
-
this.onBeforeAddBelow(formArray, modelConstructor, lastMenuIconIndexClicked.index);
|
|
337
|
-
if (adjustFormArrayManually === false) {
|
|
338
|
-
this.baseFormService.addNewFormGroupToFormArray(
|
|
339
|
-
formArray, modelConstructor, lastMenuIconIndexClicked.index + 1
|
|
340
|
-
);
|
|
341
|
-
}
|
|
342
|
-
}},
|
|
343
|
-
];
|
|
344
|
-
|
|
345
|
-
return crudMenuForOrderedData;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
onBeforeRemove = (formArray: SpiderlyFormArray, modelConstructor: any, lastMenuIconIndexClicked: number) => {}
|
|
349
|
-
|
|
350
|
-
onBeforeAddAbove = (formArray: SpiderlyFormArray, modelConstructor: any, lastMenuIconIndexClicked: number) => {}
|
|
351
|
-
|
|
352
|
-
onBeforeAddBelow = (formArray: SpiderlyFormArray, modelConstructor: any, lastMenuIconIndexClicked: number) => {}
|
|
353
|
-
|
|
354
|
-
//#endregion
|
|
355
|
-
|
|
356
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<div class="border-round border-1 surface-border p-4 surface-card" [style]="'height: ' + height + 'px;'">
|
|
2
|
-
<div [style]="'margin-bottom:' + titleMarginBottom + 'px; margin-top:' + titleMarginTop + 'px;'">
|
|
3
|
-
<p-skeleton width="160px" [height]="titleHeight + 'px'"></p-skeleton>
|
|
4
|
-
</div>
|
|
5
|
-
<div [style]="'height: ' + dataHeight + 'px;'">
|
|
6
|
-
<p-skeleton width="100%" height="100%"/>
|
|
7
|
-
</div>
|
|
8
|
-
</div>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Component, Input } from "@angular/core";
|
|
2
|
-
import { SkeletonModule } from 'primeng/skeleton';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'card-skeleton',
|
|
6
|
-
templateUrl: './card-skeleton.component.html',
|
|
7
|
-
styles: [],
|
|
8
|
-
imports: [SkeletonModule]
|
|
9
|
-
})
|
|
10
|
-
export class CardSkeletonComponent {
|
|
11
|
-
@Input() height: number = 400;
|
|
12
|
-
titleHeight: number = 23;
|
|
13
|
-
dataHeight: number;
|
|
14
|
-
padding: number = 21;
|
|
15
|
-
titleMarginBottom: number = 14;
|
|
16
|
-
titleMarginTop: number = 4;
|
|
17
|
-
|
|
18
|
-
ngOnInit(){
|
|
19
|
-
this.dataHeight = this.height - (this.titleHeight + this.padding * 2 + this.titleMarginBottom + this.titleMarginTop)
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Component } from '@angular/core';
|
|
2
|
-
import { ConfigBaseService } from '../../services/config-base.service'
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'footer',
|
|
6
|
-
templateUrl: './app.footer.component.html',
|
|
7
|
-
standalone: true
|
|
8
|
-
})
|
|
9
|
-
export class FooterComponent {
|
|
10
|
-
companyName: string = this.config.companyName;
|
|
11
|
-
|
|
12
|
-
constructor(
|
|
13
|
-
private config: ConfigBaseService
|
|
14
|
-
) {
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Component } from '@angular/core';
|
|
2
|
-
import { ConfigBaseService } from '../../services/config-base.service'
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'footer',
|
|
6
|
-
templateUrl: './footer.component.html',
|
|
7
|
-
standalone: true
|
|
8
|
-
})
|
|
9
|
-
export class FooterComponent {
|
|
10
|
-
companyName: string = this.config.companyName;
|
|
11
|
-
|
|
12
|
-
constructor(
|
|
13
|
-
private config: ConfigBaseService
|
|
14
|
-
) {
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<div [ngClass]="{
|
|
2
|
-
'last-child-zero-margin': last,
|
|
3
|
-
'card-margin-bottom': true,
|
|
4
|
-
}">
|
|
5
|
-
<spiderly-panel [crudMenu]="crudMenu" [showCrudMenu]="showCrudMenu" (onMenuIconClick)="menuIconClick($event)" [showRemoveIcon]="showRemoveIcon" (onRemoveIconClick)="removeIconClick()" [index]="index">
|
|
6
|
-
<panel-header [title]="header" [index]="index" [showIcon]="false"></panel-header>
|
|
7
|
-
|
|
8
|
-
<panel-body>
|
|
9
|
-
<ng-content>
|
|
10
|
-
<!-- Custom things below description -->
|
|
11
|
-
</ng-content>
|
|
12
|
-
</panel-body>
|
|
13
|
-
|
|
14
|
-
</spiderly-panel>
|
|
15
|
-
</div>
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
3
|
-
import { FormBuilder } from '@angular/forms';
|
|
4
|
-
import { MenuItem } from 'primeng/api';
|
|
5
|
-
import { SpiderlyPanelsModule } from "../spiderly-panels/spiderly-panels.module";
|
|
6
|
-
import { PrimengModule } from '../../modules/primeng.module';
|
|
7
|
-
|
|
8
|
-
@Component({
|
|
9
|
-
selector: 'index-card',
|
|
10
|
-
templateUrl: './index-card.component.html',
|
|
11
|
-
imports: [
|
|
12
|
-
CommonModule,
|
|
13
|
-
PrimengModule,
|
|
14
|
-
SpiderlyPanelsModule
|
|
15
|
-
]
|
|
16
|
-
})
|
|
17
|
-
export class IndexCardComponent {
|
|
18
|
-
@Input() last: boolean;
|
|
19
|
-
@Input() index: number;
|
|
20
|
-
@Input() header: string = '';
|
|
21
|
-
@Input() description: string;
|
|
22
|
-
@Input() showRemoveIcon: boolean;
|
|
23
|
-
@Input() showCrudMenu: boolean = true;
|
|
24
|
-
|
|
25
|
-
@Input() crudMenu: MenuItem[];
|
|
26
|
-
|
|
27
|
-
@Output() onMenuIconClick = new EventEmitter<number>();
|
|
28
|
-
@Output() onRemoveIconClick = new EventEmitter<null>();
|
|
29
|
-
|
|
30
|
-
constructor(
|
|
31
|
-
protected formBuilder: FormBuilder,
|
|
32
|
-
) {
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
ngOnInit(){
|
|
37
|
-
// console.log(this.last);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
menuIconClick(index: number){
|
|
41
|
-
this.onMenuIconClick.next(index);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
removeIconClick(){
|
|
45
|
-
this.onRemoveIconClick.next(null);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<div class="card responsive-card-padding" style="background-color: var(--p-primary-100); position: relative; overflow: hidden;">
|
|
2
|
-
<!-- TODO FT: Translate -->
|
|
3
|
-
<div style="display: flex; align-items: center; gap: 21px; position: relative; z-index: 2;">
|
|
4
|
-
<i class="pi pi-info-circle" style="font-size: 26px; color: var(--p-primary-color);"></i>
|
|
5
|
-
<div>
|
|
6
|
-
<div class="header" style="color:var(--p-primary-color); font-weight: 600; text-align: left;">
|
|
7
|
-
{{header}}
|
|
8
|
-
</div>
|
|
9
|
-
<div style="text-align: left; margin-top: 8px;">
|
|
10
|
-
<ng-content></ng-content>
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
<div class="card-overflow-icon" style="position: absolute; overflow: hidden; right: 8px; top: -25px; z-index: 1;">
|
|
16
|
-
<i class="pi pi-info-circle" style="font-size: 270px;"></i>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { Component, Input } from '@angular/core';
|
|
3
|
-
import { FormBuilder } from '@angular/forms';
|
|
4
|
-
import { SpiderlyPanelsModule } from "../spiderly-panels/spiderly-panels.module";
|
|
5
|
-
import { PrimengModule } from '../../modules/primeng.module';
|
|
6
|
-
|
|
7
|
-
@Component({
|
|
8
|
-
selector: 'info-card',
|
|
9
|
-
templateUrl: './info-card.component.html',
|
|
10
|
-
imports: [
|
|
11
|
-
CommonModule,
|
|
12
|
-
PrimengModule,
|
|
13
|
-
SpiderlyPanelsModule
|
|
14
|
-
]
|
|
15
|
-
})
|
|
16
|
-
export class InfoCardComponent {
|
|
17
|
-
@Input() public header: string = '';
|
|
18
|
-
@Input() public description: string;
|
|
19
|
-
|
|
20
|
-
constructor(
|
|
21
|
-
protected formBuilder: FormBuilder,
|
|
22
|
-
) {
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
ngOnInit(){
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { Component, OnDestroy, Renderer2, ViewChild } from '@angular/core';
|
|
2
|
-
import { NavigationEnd, Router } from '@angular/router';
|
|
3
|
-
import { filter, Subscription } from 'rxjs';
|
|
4
|
-
import { AppSidebarComponent } from './sidebar/sidebar.component';
|
|
5
|
-
import { AppTopBarComponent } from './topbar/topbar.component';
|
|
6
|
-
import { LayoutBaseService } from '../../services/app-layout-base.service';
|
|
7
|
-
|
|
8
|
-
@Component({
|
|
9
|
-
selector: 'layout-base',
|
|
10
|
-
template: '',
|
|
11
|
-
standalone: true
|
|
12
|
-
})
|
|
13
|
-
export class LayoutBaseComponent implements OnDestroy {
|
|
14
|
-
|
|
15
|
-
overlayMenuOpenSubscription: Subscription;
|
|
16
|
-
|
|
17
|
-
menuOutsideClickListener: any;
|
|
18
|
-
|
|
19
|
-
profileMenuOutsideClickListener: any;
|
|
20
|
-
|
|
21
|
-
@ViewChild(AppSidebarComponent) appSidebar!: AppSidebarComponent;
|
|
22
|
-
|
|
23
|
-
@ViewChild(AppTopBarComponent) appTopbar!: AppTopBarComponent;
|
|
24
|
-
|
|
25
|
-
constructor(
|
|
26
|
-
protected layoutService: LayoutBaseService,
|
|
27
|
-
protected renderer: Renderer2,
|
|
28
|
-
protected router: Router,
|
|
29
|
-
) {
|
|
30
|
-
this.overlayMenuOpenSubscription = this.layoutService.overlayOpen$.subscribe(() => {
|
|
31
|
-
if (!this.menuOutsideClickListener) {
|
|
32
|
-
this.menuOutsideClickListener = this.renderer.listen('document', 'click', event => {
|
|
33
|
-
const isOutsideClicked = !(
|
|
34
|
-
this.appSidebar.el.nativeElement.isSameNode(event.target) ||
|
|
35
|
-
this.appSidebar.el.nativeElement.contains(event.target) ||
|
|
36
|
-
this.appTopbar.menuButton.nativeElement.isSameNode(event.target) ||
|
|
37
|
-
this.appTopbar.menuButton.nativeElement.contains(event.target) ||
|
|
38
|
-
(event.target.closest('.p-autocomplete-items')) ||
|
|
39
|
-
(event.target.closest('.p-autocomplete-clear-icon'))
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
if (isOutsideClicked) {
|
|
43
|
-
this.hideMenu();
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (!this.profileMenuOutsideClickListener) {
|
|
49
|
-
this.profileMenuOutsideClickListener = this.renderer.listen('document', 'click', event => {
|
|
50
|
-
const isOutsideClicked = !(
|
|
51
|
-
this.appTopbar.menu.nativeElement.isSameNode(event.target) ||
|
|
52
|
-
this.appTopbar.menu.nativeElement.contains(event.target)
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
if (isOutsideClicked) {
|
|
56
|
-
this.hideProfileMenu();
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (this.layoutService.state.staticMenuMobileActive) {
|
|
62
|
-
this.blockBodyScroll();
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
this.router.events.pipe(filter(event => event instanceof NavigationEnd))
|
|
67
|
-
.subscribe(() => {
|
|
68
|
-
this.hideMenu();
|
|
69
|
-
this.hideProfileMenu();
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
hideMenu() {
|
|
74
|
-
this.layoutService.state.overlayMenuActive = false;
|
|
75
|
-
this.layoutService.state.staticMenuMobileActive = false;
|
|
76
|
-
this.layoutService.state.menuHoverActive = false;
|
|
77
|
-
if (this.menuOutsideClickListener) {
|
|
78
|
-
this.menuOutsideClickListener();
|
|
79
|
-
this.menuOutsideClickListener = null;
|
|
80
|
-
}
|
|
81
|
-
this.unblockBodyScroll();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
hideProfileMenu() {
|
|
85
|
-
this.layoutService.state.profileSidebarVisible = false;
|
|
86
|
-
if (this.profileMenuOutsideClickListener) {
|
|
87
|
-
this.profileMenuOutsideClickListener();
|
|
88
|
-
this.profileMenuOutsideClickListener = null;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
blockBodyScroll(): void {
|
|
93
|
-
if (document.body.classList) {
|
|
94
|
-
document.body.classList.add('blocked-scroll');
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
document.body.className += ' blocked-scroll';
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
unblockBodyScroll(): void {
|
|
102
|
-
if (document.body.classList) {
|
|
103
|
-
document.body.classList.remove('blocked-scroll');
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
document.body.className = document.body.className.replace(new RegExp('(^|\\b)' +
|
|
107
|
-
'blocked-scroll'.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
get containerClass() {
|
|
112
|
-
return {
|
|
113
|
-
'layout-theme-light': this.layoutService.layoutConfig.colorScheme === 'light',
|
|
114
|
-
'layout-theme-dark': this.layoutService.layoutConfig.colorScheme === 'dark',
|
|
115
|
-
'layout-overlay': this.layoutService.layoutConfig.menuMode === 'overlay',
|
|
116
|
-
'layout-static': this.layoutService.layoutConfig.menuMode === 'static',
|
|
117
|
-
'layout-static-inactive': this.layoutService.state.staticMenuDesktopInactive && this.layoutService.layoutConfig.menuMode === 'static',
|
|
118
|
-
'layout-overlay-active': this.layoutService.state.overlayMenuActive,
|
|
119
|
-
'layout-mobile-active': this.layoutService.state.staticMenuMobileActive,
|
|
120
|
-
'p-input-filled': this.layoutService.layoutConfig.inputStyle === 'filled',
|
|
121
|
-
'p-ripple-disabled': !this.layoutService.layoutConfig.ripple
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
ngOnDestroy() {
|
|
126
|
-
if (this.overlayMenuOpenSubscription) {
|
|
127
|
-
this.overlayMenuOpenSubscription.unsubscribe();
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (this.menuOutsideClickListener) {
|
|
131
|
-
this.menuOutsideClickListener();
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
this.onAfterNgDestroy();
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
onAfterNgDestroy = () => {}
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|