@indigina/ui-kit 1.1.363 → 1.1.364
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.
|
@@ -9632,13 +9632,17 @@ class KitMenuBuilderService {
|
|
|
9632
9632
|
constructor() {
|
|
9633
9633
|
this.translateService = inject(TranslateService);
|
|
9634
9634
|
}
|
|
9635
|
-
build(items, permissions) {
|
|
9636
|
-
return this.filter(items, permissions);
|
|
9635
|
+
build(items, permissions, hasSelectedClient = true) {
|
|
9636
|
+
return this.filter(items, permissions, hasSelectedClient);
|
|
9637
9637
|
}
|
|
9638
|
-
filter(items, permissions) {
|
|
9638
|
+
filter(items, permissions, hasSelectedClient) {
|
|
9639
9639
|
return items.reduce((menuItems, item) => {
|
|
9640
9640
|
const hasPermission = item.permission ? kitHasPermission(item.permission, permissions) : false;
|
|
9641
|
-
const childItems = item.items ? this.filter(item.items, permissions) : [];
|
|
9641
|
+
const childItems = item.items ? this.filter(item.items, permissions, hasSelectedClient) : [];
|
|
9642
|
+
const shouldSkip = (item.requiresClient ?? false) && !hasSelectedClient;
|
|
9643
|
+
if (shouldSkip) {
|
|
9644
|
+
return menuItems;
|
|
9645
|
+
}
|
|
9642
9646
|
if (hasPermission || childItems.length || !item.permission && !item.items) {
|
|
9643
9647
|
menuItems.push({
|
|
9644
9648
|
...item,
|
|
@@ -9716,7 +9720,12 @@ class KitSidebarComponent {
|
|
|
9716
9720
|
this.store = inject(Store);
|
|
9717
9721
|
this.kitMenuBuilderService = inject(KitMenuBuilderService);
|
|
9718
9722
|
this.menuItems = input.required(...(ngDevMode ? [{ debugName: "menuItems" }] : []));
|
|
9719
|
-
this.
|
|
9723
|
+
this.hasSelectedClient = input(true, ...(ngDevMode ? [{ debugName: "hasSelectedClient" }] : []));
|
|
9724
|
+
this.menuItems$ = combineLatest([
|
|
9725
|
+
this.store.select(KIT_USER_PERMISSIONS_STATE_TOKEN),
|
|
9726
|
+
toObservable(this.menuItems),
|
|
9727
|
+
toObservable(this.hasSelectedClient),
|
|
9728
|
+
]).pipe(map(([permissions, menuItems, hasSelectedClient,]) => this.kitMenuBuilderService.build(menuItems, permissions, hasSelectedClient)));
|
|
9720
9729
|
this.appsMenuItems$ = this.store.select(KIT_USER_APPLICATIONS_STATE_TOKEN).pipe(map(userApplications => userApplications?.applications?.map(({ name, url }) => ({
|
|
9721
9730
|
name,
|
|
9722
9731
|
url,
|
|
@@ -9729,7 +9738,7 @@ class KitSidebarComponent {
|
|
|
9729
9738
|
this.store.dispatch(new FetchUserApplications());
|
|
9730
9739
|
}
|
|
9731
9740
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: KitSidebarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
9732
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: KitSidebarComponent, isStandalone: true, selector: "kit-sidebar", inputs: { menuItems: { classPropertyName: "menuItems", publicName: "menuItems", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div class=\"kit-sidebar\">\n @if (menuItems$ | async; as menuItems) {\n <kit-navigation-menu class=\"navigation-menu\"\n logoPath=\"assets/config/logo.svg\"\n [menuItems]=\"menuItems\"\n [appsMenuItems]=\"(appsMenuItems$ | async) ?? []\"\n ></kit-navigation-menu>\n }\n</div>\n\n", styles: [".kit-sidebar{height:100%}.kit-sidebar .navigation-menu{display:block;height:100%}.kit-sidebar .navigation-menu ::ng-deep .logo-wrapper{display:flex;justify-content:center;align-items:center}\n"], dependencies: [{ kind: "component", type: KitNavigationMenuComponent, selector: "kit-navigation-menu", inputs: ["menuItems", "appsMenuItems", "logoPath"], outputs: ["menuItemsChange"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
9741
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: KitSidebarComponent, isStandalone: true, selector: "kit-sidebar", inputs: { menuItems: { classPropertyName: "menuItems", publicName: "menuItems", isSignal: true, isRequired: true, transformFunction: null }, hasSelectedClient: { classPropertyName: "hasSelectedClient", publicName: "hasSelectedClient", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"kit-sidebar\">\n @if (menuItems$ | async; as menuItems) {\n <kit-navigation-menu class=\"navigation-menu\"\n logoPath=\"assets/config/logo.svg\"\n [menuItems]=\"menuItems\"\n [appsMenuItems]=\"(appsMenuItems$ | async) ?? []\"\n ></kit-navigation-menu>\n }\n</div>\n\n", styles: [".kit-sidebar{height:100%}.kit-sidebar .navigation-menu{display:block;height:100%}.kit-sidebar .navigation-menu ::ng-deep .logo-wrapper{display:flex;justify-content:center;align-items:center}\n"], dependencies: [{ kind: "component", type: KitNavigationMenuComponent, selector: "kit-navigation-menu", inputs: ["menuItems", "appsMenuItems", "logoPath"], outputs: ["menuItemsChange"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
9733
9742
|
}
|
|
9734
9743
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: KitSidebarComponent, decorators: [{
|
|
9735
9744
|
type: Component,
|
|
@@ -9737,7 +9746,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
9737
9746
|
KitNavigationMenuComponent,
|
|
9738
9747
|
AsyncPipe,
|
|
9739
9748
|
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"kit-sidebar\">\n @if (menuItems$ | async; as menuItems) {\n <kit-navigation-menu class=\"navigation-menu\"\n logoPath=\"assets/config/logo.svg\"\n [menuItems]=\"menuItems\"\n [appsMenuItems]=\"(appsMenuItems$ | async) ?? []\"\n ></kit-navigation-menu>\n }\n</div>\n\n", styles: [".kit-sidebar{height:100%}.kit-sidebar .navigation-menu{display:block;height:100%}.kit-sidebar .navigation-menu ::ng-deep .logo-wrapper{display:flex;justify-content:center;align-items:center}\n"] }]
|
|
9740
|
-
}], propDecorators: { menuItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuItems", required: true }] }] } });
|
|
9749
|
+
}], propDecorators: { menuItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuItems", required: true }] }], hasSelectedClient: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasSelectedClient", required: false }] }] } });
|
|
9741
9750
|
|
|
9742
9751
|
class FetchUser {
|
|
9743
9752
|
static { this.type = '[User] Fetch'; }
|