@studiohyperdrive/ngx-auth
Version:
A library of core authentication functionality used with @studiohyperdrive/types-auth.
66 lines (65 loc) • 2.71 kB
TypeScript
import { ChangeDetectorRef, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';
import { NgxAuthenticationAbstractService } from '../../abstracts';
import * as i0 from "@angular/core";
/**
* A directive that will render a part of the template based on whether the required feature(s) are provided.
*
* Based upon `*ngIf`. See https://github.com/angular/angular/blob/master/packages/common/src/directives/ng_if.ts
*/
export declare class NgxHasFeatureDirective<FeatureType extends string> implements OnDestroy {
templateRef: TemplateRef<any>;
private viewContainer;
private readonly authenticationService;
private readonly cdRef;
/**
* The destroyed state of the directive
*/
private destroyed$;
/**
* The needed templateRefs
*/
private thenTemplateRef;
private thenViewRef;
private elseTemplateRef;
private elseViewRef;
/**
* The (list of) feature(s) we need to check
*/
private feature;
/**
* Whether the feature should be enabled
*/
private shouldHaveFeature;
/**
* Whether all features should be enabled
*/
private shouldHaveAllFeatures;
/**
* A feature or list of features the item should have
*/
set ngxHasFeature(feature: FeatureType | FeatureType[]);
/**
* The else template in case the feature is not enabled
*/
set ngxHasFeatureElse(ngTemplate: TemplateRef<any>);
/**
* Whether the feature should be enabled, by default this is true
*/
set ngxHasFeatureShouldHaveFeature(shouldHaveFeatureEnabled: boolean);
/**
* Whether all features should be enabled, by default this is true
*/
set ngxHasFeatureShouldHaveAllFeatures(shouldHaveAllFeatures: boolean);
constructor(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef, authenticationService: NgxAuthenticationAbstractService, cdRef: ChangeDetectorRef);
ngOnDestroy(): void;
/**
* Updates the view and hides/renders the template as needed
*/
private updateView;
/**
* Dispose the current subscription
*/
private dispose;
static ɵfac: i0.ɵɵFactoryDeclaration<NgxHasFeatureDirective<any>, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NgxHasFeatureDirective<any>, "[ngxHasFeature]", never, { "ngxHasFeature": { "alias": "ngxHasFeature"; "required": false; }; "ngxHasFeatureElse": { "alias": "ngxHasFeatureElse"; "required": false; }; "ngxHasFeatureShouldHaveFeature": { "alias": "ngxHasFeatureShouldHaveFeature"; "required": false; }; "ngxHasFeatureShouldHaveAllFeatures": { "alias": "ngxHasFeatureShouldHaveAllFeatures"; "required": false; }; }, {}, never, never, true, never>;
}