aril 1.1.96 → 1.2.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/boot/base/index.d.ts +1 -0
- package/boot/base/src/create-base-app-config.d.ts +12 -0
- package/boot/bridge/index.d.ts +2 -0
- package/boot/bridge/src/mfe-bridge.d.ts +33 -0
- package/boot/bridge/src/provide-mfe-bridge.d.ts +1 -0
- package/boot/config/api/index.d.ts +1 -0
- package/boot/config/api/src/api.service.d.ts +2 -2
- package/boot/config/api/src/interfaces.d.ts +1 -19
- package/boot/config/apps/src/apps.service.d.ts +7 -4
- package/boot/config/plugins/src/getNgZone.d.ts +1 -1
- package/boot/config/plugins/src/interfaces.d.ts +0 -37
- package/boot/host/src/app.component.d.ts +5 -3
- package/boot/mfe/src/app.component.d.ts +4 -2
- package/esm2022/boot/base/aril-boot-base.mjs +5 -0
- package/esm2022/boot/base/index.mjs +2 -0
- package/esm2022/boot/base/src/create-base-app-config.mjs +30 -0
- package/esm2022/boot/bridge/aril-boot-bridge.mjs +5 -0
- package/esm2022/boot/bridge/index.mjs +3 -0
- package/esm2022/boot/bridge/src/mfe-bridge.mjs +59 -0
- package/esm2022/boot/bridge/src/provide-mfe-bridge.mjs +6 -0
- package/esm2022/boot/config/api/index.mjs +1 -1
- package/esm2022/boot/config/api/src/api.service.mjs +14 -9
- package/esm2022/boot/config/api/src/interfaces.mjs +2 -21
- package/esm2022/boot/config/apps/src/apps.service.mjs +13 -16
- package/esm2022/boot/config/plugins/src/getNgZone.mjs +4 -3
- package/esm2022/boot/config/plugins/src/interfaces.mjs +1 -60
- package/esm2022/boot/config/plugins/src/plugins.service.mjs +9 -21
- package/esm2022/boot/host/src/app.component.mjs +11 -10
- package/esm2022/boot/host/src/bootstrap.mjs +9 -22
- package/esm2022/boot/mfe/src/app.component.mjs +20 -17
- package/esm2022/boot/mfe/src/bootstrap.mjs +13 -31
- package/esm2022/boot/pages/aril-boot-pages.mjs +5 -0
- package/esm2022/boot/pages/index.mjs +3 -0
- package/esm2022/{util/custom_pages → boot/pages}/src/forbidden.component.mjs +1 -1
- package/esm2022/{util/custom_pages → boot/pages}/src/notFound.component.mjs +1 -1
- package/esm2022/keycloak/src/auth.interceptor.mjs +15 -78
- package/esm2022/provider/src/prodiveHost.mjs +5 -8
- package/esm2022/provider/src/prodiveHostRouter.mjs +4 -3
- package/esm2022/provider/src/provideHostKeycloak.mjs +10 -2
- package/esm2022/theme/layout/app/breadcrumb/app.breadcrumb.component.mjs +4 -3
- package/esm2022/theme/layout/app/expandableMenu/expandable-menu.component.mjs +3 -4
- package/esm2022/theme/layout/app/general-search/general-search.component.mjs +3 -2
- package/esm2022/theme/layout/app/history/history.service.mjs +3 -2
- package/esm2022/theme/layout/app/layout/app.layout.component.mjs +1 -2
- package/esm2022/theme/layout/app/site-map/site-map-sidebar.component.mjs +5 -4
- package/esm2022/theme/layout/app/static-sidebar/static-sidebar.component.mjs +3 -4
- package/esm2022/theme/layout/app/topbar/app.topbar.component.mjs +7 -4
- package/esm2022/ui/form/src/form.component.mjs +22 -4
- package/esm2022/ui-business/assetPicker/src/asset-picker.component.mjs +14 -2
- package/esm2022/util/directives/src/detail-page-customization/detail-page-customization.directive.mjs +4 -3
- package/esm2022/util/pipes/src/translate-json/translate-json.pipe.mjs +3 -4
- package/esm2022/util/sync-active-tab-route/src/sync-active-tab-route.directive.mjs +1 -1
- package/fesm2022/{aril-app.component-hxaLgwmC.mjs → aril-app.component-wxP3y8dg.mjs} +22 -22
- package/fesm2022/aril-app.component-wxP3y8dg.mjs.map +1 -0
- package/fesm2022/aril-boot-base.mjs +37 -0
- package/fesm2022/aril-boot-base.mjs.map +1 -0
- package/fesm2022/aril-boot-bridge.mjs +70 -0
- package/fesm2022/aril-boot-bridge.mjs.map +1 -0
- package/fesm2022/aril-boot-config-api.mjs +12 -27
- package/fesm2022/aril-boot-config-api.mjs.map +1 -1
- package/fesm2022/aril-boot-config-apps.mjs +12 -15
- package/fesm2022/aril-boot-config-apps.mjs.map +1 -1
- package/fesm2022/aril-boot-config-plugins.mjs +10 -81
- package/fesm2022/aril-boot-config-plugins.mjs.map +1 -1
- package/fesm2022/aril-boot-host.mjs +17 -29
- package/fesm2022/aril-boot-host.mjs.map +1 -1
- package/fesm2022/{aril-boot-mfe-app.component-s1a-tkOD.mjs → aril-boot-mfe-app.component-7IjAmjz0.mjs} +22 -22
- package/fesm2022/aril-boot-mfe-app.component-7IjAmjz0.mjs.map +1 -0
- package/fesm2022/{aril-boot-mfe-aril-boot-mfe-wLTqwDtz.mjs → aril-boot-mfe-aril-boot-mfe-KXDpUyv7.mjs} +15 -69
- package/fesm2022/aril-boot-mfe-aril-boot-mfe-KXDpUyv7.mjs.map +1 -0
- package/fesm2022/aril-boot-mfe.mjs +3 -6
- package/fesm2022/aril-boot-mfe.mjs.map +1 -1
- package/fesm2022/{aril-util-custom_pages.mjs → aril-boot-pages.mjs} +1 -1
- package/fesm2022/aril-boot-pages.mjs.map +1 -0
- package/fesm2022/aril-keycloak.mjs +14 -77
- package/fesm2022/aril-keycloak.mjs.map +1 -1
- package/fesm2022/aril-provider.mjs +15 -10
- package/fesm2022/aril-provider.mjs.map +1 -1
- package/fesm2022/aril-theme-layout.mjs +15 -17
- package/fesm2022/aril-theme-layout.mjs.map +1 -1
- package/fesm2022/aril-ui-business-assetPicker.mjs +13 -1
- package/fesm2022/aril-ui-business-assetPicker.mjs.map +1 -1
- package/fesm2022/aril-ui-form.mjs +20 -3
- package/fesm2022/aril-ui-form.mjs.map +1 -1
- package/fesm2022/aril-util-directives.mjs +3 -2
- package/fesm2022/aril-util-directives.mjs.map +1 -1
- package/fesm2022/aril-util-pipes.mjs +2 -3
- package/fesm2022/aril-util-pipes.mjs.map +1 -1
- package/fesm2022/aril-util-sync-active-tab-route.mjs.map +1 -1
- package/fesm2022/aril.mjs +24 -87
- package/fesm2022/aril.mjs.map +1 -1
- package/package.json +111 -105
- package/provider/src/prodiveHost.d.ts +2 -2
- package/theme/layout/app/breadcrumb/app.breadcrumb.component.ts +3 -2
- package/theme/layout/app/expandableMenu/expandable-menu.component.d.ts +0 -2
- package/theme/layout/app/expandableMenu/expandable-menu.component.ts +373 -374
- package/theme/layout/app/general-search/general-search.component.ts +2 -1
- package/theme/layout/app/history/history.service.ts +2 -1
- package/theme/layout/app/layout/app.layout.component.d.ts +0 -1
- package/theme/layout/app/layout/app.layout.component.ts +0 -1
- package/theme/layout/app/site-map/site-map-sidebar.component.html +121 -121
- package/theme/layout/app/site-map/site-map-sidebar.component.ts +3 -2
- package/theme/layout/app/static-sidebar/static-sidebar.component.ts +336 -337
- package/theme/layout/app/topbar/app.topbar.component.ts +6 -3
- package/theme/styles/layout/_fonts.scss +1 -13
- package/ui/form/src/form.component.d.ts +4 -1
- package/boot/mfe/src/loadStyles.d.ts +0 -3
- package/esm2022/boot/mfe/src/loadStyles.mjs +0 -37
- package/esm2022/util/custom_pages/aril-util-custom_pages.mjs +0 -5
- package/esm2022/util/custom_pages/index.mjs +0 -3
- package/esm2022/util/loaders/aril-util-loaders.mjs +0 -5
- package/esm2022/util/loaders/index.mjs +0 -2
- package/esm2022/util/loaders/style/style.loader.service.mjs +0 -61
- package/fesm2022/aril-app.component-hxaLgwmC.mjs.map +0 -1
- package/fesm2022/aril-boot-mfe-app.component-s1a-tkOD.mjs.map +0 -1
- package/fesm2022/aril-boot-mfe-aril-boot-mfe-wLTqwDtz.mjs.map +0 -1
- package/fesm2022/aril-util-custom_pages.mjs.map +0 -1
- package/fesm2022/aril-util-loaders.mjs +0 -68
- package/fesm2022/aril-util-loaders.mjs.map +0 -1
- package/theme/fonts/Inter/Inter_18pt-Black.ttf +0 -0
- package/theme/fonts/Inter/Inter_18pt-BlackItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
- package/theme/fonts/Inter/Inter_18pt-BoldItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
- package/theme/fonts/Inter/Inter_18pt-ExtraBoldItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_18pt-ExtraLight.ttf +0 -0
- package/theme/fonts/Inter/Inter_18pt-ExtraLightItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_18pt-Italic.ttf +0 -0
- package/theme/fonts/Inter/Inter_18pt-Light.ttf +0 -0
- package/theme/fonts/Inter/Inter_18pt-LightItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
- package/theme/fonts/Inter/Inter_18pt-MediumItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
- package/theme/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
- package/theme/fonts/Inter/Inter_18pt-SemiBoldItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_18pt-Thin.ttf +0 -0
- package/theme/fonts/Inter/Inter_18pt-ThinItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-Black.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-BlackItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-Bold.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-BoldItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-ExtraBold.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-ExtraBoldItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-ExtraLight.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-ExtraLightItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-Italic.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-Light.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-LightItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-Medium.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-MediumItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-Regular.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-SemiBold.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-SemiBoldItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-Thin.ttf +0 -0
- package/theme/fonts/Inter/Inter_24pt-ThinItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-Black.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-BlackItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-Bold.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-BoldItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-ExtraBold.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-ExtraBoldItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-ExtraLight.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-ExtraLightItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-Italic.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-Light.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-LightItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-Medium.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-MediumItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-Regular.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-SemiBold.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-SemiBoldItalic.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-Thin.ttf +0 -0
- package/theme/fonts/Inter/Inter_28pt-ThinItalic.ttf +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-Black.woff +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-Black.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-BlackItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-BlackItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-BoldItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-BoldItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-ExtraBold.woff +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-ExtraBold.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-ExtraBoldItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-ExtraBoldItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-ExtraLight.woff +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-ExtraLight.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-ExtraLightItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-ExtraLightItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-Italic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-Italic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-Light.woff +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-Light.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-LightItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-LightItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-MediumItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-MediumItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-SemiBoldItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-SemiBoldItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-Thin.woff +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-Thin.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-ThinItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter18pt-ThinItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-Black.woff +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-Black.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-BlackItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-BlackItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-Bold.woff +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-Bold.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-BoldItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-BoldItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-ExtraBold.woff +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-ExtraBold.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-ExtraBoldItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-ExtraBoldItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-ExtraLight.woff +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-ExtraLight.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-ExtraLightItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-ExtraLightItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-Italic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-Italic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-LightItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-LightItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-Medium.woff +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-Medium.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-MediumItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-MediumItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-Regular.woff +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-Regular.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-SemiBold.woff +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-SemiBold.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-SemiBoldItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-SemiBoldItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-Thin.woff +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-Thin.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-ThinItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter24pt-ThinItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-Black.woff +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-Black.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-BlackItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-BlackItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-Bold.woff +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-Bold.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-BoldItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-BoldItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-ExtraBoldItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-ExtraBoldItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-ExtraLightItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-ExtraLightItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-Italic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-Italic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-Light.woff +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-Light.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-LightItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-LightItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-Medium.woff +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-Medium.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-MediumItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-MediumItalic.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-Regular.woff +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-Regular.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-SemiBold.woff +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-SemiBold.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-Thin.woff +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-Thin.woff2 +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-ThinItalic.woff +0 -0
- package/theme/fonts/Inter/woff/Inter28pt-ThinItalic.woff2 +0 -0
- package/util/loaders/index.d.ts +0 -1
- package/util/loaders/style/style.loader.service.d.ts +0 -13
- /package/{util/custom_pages → boot/pages}/index.d.ts +0 -0
- /package/{util/custom_pages → boot/pages}/src/forbidden.component.d.ts +0 -0
- /package/{util/custom_pages → boot/pages}/src/notFound.component.d.ts +0 -0
|
@@ -1,374 +1,373 @@
|
|
|
1
|
-
import { NgClass } from '@angular/common';
|
|
2
|
-
import { HttpClient } from '@angular/common/http';
|
|
3
|
-
import { Component, HostListener, OnDestroy, OnInit, Signal } from '@angular/core';
|
|
4
|
-
import { toSignal } from '@angular/core/rxjs-interop';
|
|
5
|
-
import { NavigationEnd, Router, RouterLink } from '@angular/router';
|
|
6
|
-
|
|
7
|
-
import { TooltipModule } from 'primeng/tooltip';
|
|
8
|
-
|
|
9
|
-
import { TranslocoService } from '@ngneat/transloco';
|
|
10
|
-
import { KeycloakService } from 'keycloak-angular';
|
|
11
|
-
import { Subscription, filter } from 'rxjs';
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
private
|
|
80
|
-
private
|
|
81
|
-
private
|
|
82
|
-
private
|
|
83
|
-
private
|
|
84
|
-
private
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
this.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
menuItem.routerLink
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
this.
|
|
145
|
-
this.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
this.
|
|
179
|
-
this.
|
|
180
|
-
this.
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
this.
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
this.
|
|
192
|
-
this.
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
this.layoutService.
|
|
215
|
-
this.
|
|
216
|
-
this.
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
this.
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
this.
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
event.
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
this.
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
const
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
1
|
+
import { NgClass } from '@angular/common';
|
|
2
|
+
import { HttpClient } from '@angular/common/http';
|
|
3
|
+
import { Component, HostListener, OnDestroy, OnInit, Signal } from '@angular/core';
|
|
4
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
5
|
+
import { NavigationEnd, Router, RouterLink } from '@angular/router';
|
|
6
|
+
|
|
7
|
+
import { TooltipModule } from 'primeng/tooltip';
|
|
8
|
+
|
|
9
|
+
import { TranslocoService } from '@ngneat/transloco';
|
|
10
|
+
import { KeycloakService } from 'keycloak-angular';
|
|
11
|
+
import { Subscription, filter } from 'rxjs';
|
|
12
|
+
|
|
13
|
+
import { bridge } from 'aril/boot/bridge';
|
|
14
|
+
import { PluginMenuItem } from 'aril/boot/config/apps';
|
|
15
|
+
import { TranslateJsonPipe } from 'aril/util/pipes';
|
|
16
|
+
|
|
17
|
+
import { LayoutService } from '../../service/app.layout.service';
|
|
18
|
+
import { AppMenuService } from '../../service/app.menu.service';
|
|
19
|
+
|
|
20
|
+
@Component({
|
|
21
|
+
standalone: true,
|
|
22
|
+
selector: 'app-expandable-menu',
|
|
23
|
+
imports: [RouterLink, NgClass, TooltipModule],
|
|
24
|
+
templateUrl: 'expandable-menu.component.html',
|
|
25
|
+
providers: [TranslateJsonPipe]
|
|
26
|
+
})
|
|
27
|
+
export class ExpandableMenuComponent implements OnInit, OnDestroy {
|
|
28
|
+
activeLang: Signal<string>;
|
|
29
|
+
overlayMenuOpenSubscription: Subscription | null = null;
|
|
30
|
+
routerSubscription: Subscription | null = null;
|
|
31
|
+
username: string;
|
|
32
|
+
|
|
33
|
+
cachedMenuItems: PluginMenuItem[] = [];
|
|
34
|
+
|
|
35
|
+
selectedMainMenuItem: PluginMenuItem | null = null;
|
|
36
|
+
|
|
37
|
+
get sidebarExpanded(): boolean {
|
|
38
|
+
return this.layoutService.state.secondarySidebarExpanded;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
set sidebarExpanded(value: boolean) {
|
|
42
|
+
this.layoutService.setSecondarySidebarExpanded(value);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
tooltipText = {
|
|
46
|
+
toggleButton: {
|
|
47
|
+
expanded: {
|
|
48
|
+
tr: 'Menüyü Gizle',
|
|
49
|
+
en: 'Hide Menu'
|
|
50
|
+
},
|
|
51
|
+
collapsed: {
|
|
52
|
+
tr: 'Menüyü Göster',
|
|
53
|
+
en: 'Show Menu'
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
lockButton: {
|
|
57
|
+
locked: {
|
|
58
|
+
tr: 'Otomatik Kapanmayı Aç',
|
|
59
|
+
en: 'Enable Auto-Close'
|
|
60
|
+
},
|
|
61
|
+
unlocked: {
|
|
62
|
+
tr: 'Menüyü Kilitle',
|
|
63
|
+
en: 'Lock Menu'
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
private readonly MAX_LENGTH = {
|
|
69
|
+
main: 8,
|
|
70
|
+
secondary: 20,
|
|
71
|
+
tertiary: 20
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
actionLoadingItems = new Set<string>();
|
|
75
|
+
private actionSubscription: Subscription | null = null;
|
|
76
|
+
|
|
77
|
+
constructor(
|
|
78
|
+
private translateJsonPipe: TranslateJsonPipe,
|
|
79
|
+
private menuService: AppMenuService,
|
|
80
|
+
private router: Router,
|
|
81
|
+
private keycloak: KeycloakService,
|
|
82
|
+
private translocoService: TranslocoService,
|
|
83
|
+
private layoutService: LayoutService,
|
|
84
|
+
private http: HttpClient
|
|
85
|
+
) {
|
|
86
|
+
this.activeLang = toSignal(this.translocoService.langChanges$, { initialValue: 'tr' });
|
|
87
|
+
this.username = this.keycloak.getUsername().charAt(0).toUpperCase();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Getter for layout service states
|
|
91
|
+
get selectedMainItem(): number | null {
|
|
92
|
+
return this.layoutService.state.selectedMainItem;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
get secondarySidebarExpanded(): boolean {
|
|
96
|
+
return this.layoutService.state.secondarySidebarExpanded;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Check if text is truncated and needs tooltip
|
|
100
|
+
isTextTruncated(
|
|
101
|
+
label: any,
|
|
102
|
+
lang: string | null,
|
|
103
|
+
menuType: 'main' | 'secondary' | 'tertiary' | 'nested' = 'secondary'
|
|
104
|
+
): boolean {
|
|
105
|
+
if (!label || !lang || !label[lang]) return false;
|
|
106
|
+
|
|
107
|
+
const text = label[lang];
|
|
108
|
+
const textLength = text.length;
|
|
109
|
+
const maxLength = menuType === 'nested' ? this.MAX_LENGTH.tertiary : this.MAX_LENGTH[menuType];
|
|
110
|
+
return textLength > maxLength;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Recursively check if a menu item or its children match the current route
|
|
114
|
+
isActiveRoute(menuItem: PluginMenuItem): boolean {
|
|
115
|
+
if (!menuItem || !menuItem.routerLink) return false;
|
|
116
|
+
|
|
117
|
+
// Get current URL path after the hash
|
|
118
|
+
const currentUrl = this.router.url;
|
|
119
|
+
const hashUrl = currentUrl.indexOf('#') > -1 ? currentUrl.split('#')[1] : currentUrl;
|
|
120
|
+
|
|
121
|
+
// Check for exact match first
|
|
122
|
+
if (hashUrl === menuItem.routerLink || hashUrl === '/' + menuItem.routerLink) {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Check if current URL starts with the routerLink (handles child routes)
|
|
127
|
+
if (
|
|
128
|
+
menuItem.routerLink !== '/' &&
|
|
129
|
+
(hashUrl.startsWith(menuItem.routerLink + '/') || hashUrl.startsWith('/' + menuItem.routerLink + '/'))
|
|
130
|
+
) {
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Check child items if they exist
|
|
135
|
+
if (menuItem.items && menuItem.items.length > 0) {
|
|
136
|
+
return menuItem.items.some((childItem) => this.isActiveRoute(childItem));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
ngOnInit() {
|
|
143
|
+
this.updateMenuItems();
|
|
144
|
+
this.initializeMenu();
|
|
145
|
+
this.updateActiveMenuFromCurrentRoute();
|
|
146
|
+
|
|
147
|
+
// Subscribe to route changes to handle secondary sidebar closing
|
|
148
|
+
this.routerSubscription = this.router.events
|
|
149
|
+
.pipe(filter((event) => event instanceof NavigationEnd))
|
|
150
|
+
.subscribe(() => {
|
|
151
|
+
// Update active menu based on the new route
|
|
152
|
+
this.updateActiveMenuFromCurrentRoute();
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// Subscribe to overlay menu open notifications
|
|
156
|
+
this.overlayMenuOpenSubscription = this.layoutService.overlayOpen$.subscribe(() => {
|
|
157
|
+
if (this.layoutService.state.staticMenuMobileActive) {
|
|
158
|
+
this.layoutService.setSecondarySidebarExpanded(true);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
ngOnDestroy() {
|
|
164
|
+
if (this.overlayMenuOpenSubscription) {
|
|
165
|
+
this.overlayMenuOpenSubscription.unsubscribe();
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (this.routerSubscription) {
|
|
169
|
+
this.routerSubscription.unsubscribe();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
this.actionSubscription?.unsubscribe();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Initialize the menu with proper active state
|
|
176
|
+
initializeMenu() {
|
|
177
|
+
this.layoutService.setSelectedMainItem(null);
|
|
178
|
+
this.selectedMainMenuItem = null;
|
|
179
|
+
this.layoutService.setSecondarySidebarExpanded(false);
|
|
180
|
+
this.updateMenuItems();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
updateMenuFromRootKey(index: number): void {
|
|
184
|
+
this.updateMenuItems();
|
|
185
|
+
const menuItems = this.getMenuItems();
|
|
186
|
+
|
|
187
|
+
if (index >= 0 && index < menuItems.length) {
|
|
188
|
+
const item = menuItems[index];
|
|
189
|
+
if (!item.separator) {
|
|
190
|
+
this.layoutService.setSelectedMainItem(index);
|
|
191
|
+
this.selectedMainMenuItem = item;
|
|
192
|
+
this.layoutService.setSecondarySidebarExpanded(true);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
updateMenuItems(): void {
|
|
198
|
+
this.cachedMenuItems = bridge.isHostMode() ? bridge.hostMenuItems() : this.menuService.menuItems();
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
getMenuItems(): PluginMenuItem[] {
|
|
202
|
+
return this.cachedMenuItems;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
selectMainItem(index: number, item: PluginMenuItem): void {
|
|
206
|
+
// Handle action items at top level
|
|
207
|
+
if (item.action && (!item.items || item.items.length === 0)) {
|
|
208
|
+
this.onActionItemClick(item);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (item.routerLink && (!item.items || item.items.length === 0)) {
|
|
213
|
+
this.layoutService.setSecondarySidebarExpanded(false);
|
|
214
|
+
this.layoutService.setSelectedMainItem(index);
|
|
215
|
+
this.selectedMainMenuItem = item;
|
|
216
|
+
this.router.navigate([item.routerLink]);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Handle regular menu items with submenu
|
|
221
|
+
if (this.selectedMainItem === index) {
|
|
222
|
+
this.layoutService.toggleSecondarySidebar();
|
|
223
|
+
} else {
|
|
224
|
+
this.layoutService.setSelectedMainItem(index);
|
|
225
|
+
this.selectedMainMenuItem = item;
|
|
226
|
+
|
|
227
|
+
if (item.items && item.items.length > 0) {
|
|
228
|
+
this.layoutService.setSecondarySidebarExpanded(true);
|
|
229
|
+
} else {
|
|
230
|
+
this.layoutService.setSecondarySidebarExpanded(false);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// For mobile devices, ensure the menu stays open
|
|
235
|
+
if (this.isMobile()) {
|
|
236
|
+
this.layoutService.state.staticMenuMobileActive = true;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
toggleSecondarySidebar(): void {
|
|
241
|
+
this.layoutService.toggleSecondarySidebar();
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
isMobile(): boolean {
|
|
245
|
+
return this.layoutService.isMobile();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Listen for resize events - now handled more efficiently by layout service
|
|
249
|
+
@HostListener('window:resize')
|
|
250
|
+
onResize() {
|
|
251
|
+
if (!this.isMobile() && this.layoutService.state.staticMenuMobileActive) {
|
|
252
|
+
this.layoutService.closeMobileMenu();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
updateActiveMenuFromCurrentRoute(): void {
|
|
257
|
+
const menuItems = this.getMenuItems();
|
|
258
|
+
|
|
259
|
+
for (let i = 0; i < menuItems.length; i++) {
|
|
260
|
+
const menuItem = menuItems[i];
|
|
261
|
+
if (this.isActiveRoute(menuItem)) {
|
|
262
|
+
this.layoutService.setSelectedMainItem(i);
|
|
263
|
+
this.selectedMainMenuItem = menuItem;
|
|
264
|
+
|
|
265
|
+
if (menuItem.items && menuItem.items.length > 0) {
|
|
266
|
+
if (!this.isMobile() && !this.secondarySidebarExpanded && !this.layoutService.state.staticMenuMobileActive) {
|
|
267
|
+
this.layoutService.setSecondarySidebarExpanded(true);
|
|
268
|
+
}
|
|
269
|
+
} else {
|
|
270
|
+
this.layoutService.setSecondarySidebarExpanded(false);
|
|
271
|
+
}
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
isHaveSelectedChildItem(item: PluginMenuItem): boolean {
|
|
278
|
+
if (!item || !item.items || item.items.length === 0) return false;
|
|
279
|
+
|
|
280
|
+
for (const child of item.items) {
|
|
281
|
+
if (this.isActiveRoute(child)) {
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (child.items && child.items.length > 0) {
|
|
286
|
+
if (this.isHaveSelectedChildItem(child)) {
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
getLocalText(text: any): string {
|
|
296
|
+
return this.translateJsonPipe.transform(text);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
getActionItemKey(item: PluginMenuItem): string {
|
|
300
|
+
return item.action?.url + '|' + item.action?.successRoute;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
isActionLoading(item: PluginMenuItem): boolean {
|
|
304
|
+
return this.actionLoadingItems.has(this.getActionItemKey(item));
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
onActionItemClick(item: PluginMenuItem, event?: Event): void {
|
|
308
|
+
if (event) {
|
|
309
|
+
event.preventDefault();
|
|
310
|
+
event.stopPropagation();
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
if (!item.action || this.isActionLoading(item)) return;
|
|
314
|
+
|
|
315
|
+
// Cancel any previous action request
|
|
316
|
+
this.actionSubscription?.unsubscribe();
|
|
317
|
+
|
|
318
|
+
const key = this.getActionItemKey(item);
|
|
319
|
+
this.actionLoadingItems.add(key);
|
|
320
|
+
|
|
321
|
+
const request$ =
|
|
322
|
+
item.action.method === 'GET'
|
|
323
|
+
? this.http.get(item.action.url)
|
|
324
|
+
: this.http.post(item.action.url, item.action.body ?? {});
|
|
325
|
+
|
|
326
|
+
this.actionSubscription = request$.subscribe({
|
|
327
|
+
next: (response: any) => {
|
|
328
|
+
this.actionLoadingItems.delete(key);
|
|
329
|
+
const route = this.buildSuccessRoute(item.action!, response);
|
|
330
|
+
this.router.navigate([route]);
|
|
331
|
+
},
|
|
332
|
+
error: () => {
|
|
333
|
+
this.actionLoadingItems.delete(key);
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
private buildSuccessRoute(action: PluginMenuItem['action'], response: any): string {
|
|
339
|
+
if (!action?.successRouteResponseKey) return action?.successRoute ?? '/';
|
|
340
|
+
|
|
341
|
+
const value = this.getValueByPath(response, action.successRouteResponseKey);
|
|
342
|
+
if (value === undefined || value === null) return action.successRoute;
|
|
343
|
+
|
|
344
|
+
return `${action.successRoute}/${value}`;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
private getValueByPath(obj: any, path: string): any {
|
|
348
|
+
if (!obj || !path) return undefined;
|
|
349
|
+
|
|
350
|
+
return path.split('.').reduce((current, key) => {
|
|
351
|
+
if (current === undefined || current === null) return undefined;
|
|
352
|
+
|
|
353
|
+
// Handle array access like 'result[0]'
|
|
354
|
+
const arrayMatch = key.match(/^(.+?)\[(\d+)\]$/);
|
|
355
|
+
if (arrayMatch) {
|
|
356
|
+
const arrayKey = arrayMatch[1];
|
|
357
|
+
const index = parseInt(arrayMatch[2], 10);
|
|
358
|
+
return current[arrayKey]?.[index];
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
return current[key];
|
|
362
|
+
}, obj);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
toggleSidebar() {
|
|
366
|
+
// Eğer seçili bir ana menü öğesi varsa ve alt menüleri varsa toggle yapabiliriz
|
|
367
|
+
if (this.selectedMainMenuItem && this.selectedMainMenuItem.items && this.selectedMainMenuItem.items.length > 0) {
|
|
368
|
+
this.sidebarExpanded = !this.sidebarExpanded;
|
|
369
|
+
} else if (this.sidebarExpanded) {
|
|
370
|
+
this.sidebarExpanded = false;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|