File

libs/ngx-pfe/models/ngx-pfe-page-config.model.ts

Description

This object could define the 4 different possibilities that route object of angular support https://angular.io/guide/router#milestone-5-route-guards

Index

Properties

Properties

canActivate
canActivate: T[]
Type : T[]
Optional
canActivateChild
canActivateChild: T[]
Type : T[]
Optional
canDeactivate
canDeactivate: T[]
Type : T[]
Optional
canLoad
canLoad: T[]
Type : T[]
Optional
canMatch
canMatch: T[]
Type : T[]
Optional
import { PfeActionConfig } from '../pfe-actions/pfe-actions.model';
import { AppConfiguration } from './app-configuration.model';
import { PfeGlobalConfig } from './global-config.model';
import { PageId, PfeNavigationConfiguration, StateUpdates } from './navigation-config.model';
import { ExpressionCondition } from '../pfe-conditions/rules-evaluator';
/**
 * The NgxPfeConfig contains two generics:
 * APP_CONFIG_TYPE: Allows it to set the extended appConfiguration type.
 * PAGE_CONFIG_TYPE: Allows it to set the extended pagesConfiguration type.
 *
 * @export
 */
export interface NgxPfeConfig<
  APP_CONFIG_TYPE extends AppConfiguration = AppConfiguration,
  PAGE_CONFIG_TYPE extends PageConfig = PageConfig,
  ACTIONS_CONFIG_TYPE = PfeActionConfig,
> {
  appConfiguration?: APP_CONFIG_TYPE;
  pagesConfiguration: PAGE_CONFIG_TYPE[];
  navConfiguration: PfeNavigationConfiguration<ACTIONS_CONFIG_TYPE>;
  globalConfiguration?: PfeGlobalConfig<ACTIONS_CONFIG_TYPE>;
}

/**
 * The page config contains specific configuration attributes
 * for every available page types.
 *
 * This is done, in this way, to allow the usage of the JSON Schema. Separate types would produce separate schemas.
 *
 * This interface has to be extended by the application using the PFE with its custom pages.
 *
 * Configuration examples for each page type can be found in the fnol-config repository in the demo_app branch.
 *
 * @export
 */
export interface PageConfig<T = string> {
  /**
   * The pageID is a unique ID, that is used to reference to a
   * page instance on other locations, like the navigation configuration.
   */
  pageId: PageId;

  /**
   * Hide the next button on this page.
   * This attribute is optional. The default is false.
   */
  hideNextButton?: boolean;
  /**
   * Hide the back button on this page.
   * This attribute is optional. The default is false.
   */
  hideBackButton?: boolean;
  /**
   * Display the back button as a link instead of a button.
   */
  linkBackButton?: boolean;

  /**
   * Display the next button as a link instead of a button.
   */
  linkNextButton?: boolean;

  /**
   * Specify a label of the Next button on a specific page.
   * Can be used to change the translation key with ngx-translate or any other dynamic translation tool/library.
   * Can not be used for dynamic translation keys with the native Angular translation or any other static translation tool/library.
   */
  nxNextText?: string;

  /**
   * Specificy a label of the Back button on a specific page.
   * Can be used to change the translation key with ngx-translate or any other dynamic translation tool/library.
   * Can not be used for dynamic translation keys with the native Angular translation or any other static translation tool/library.
   */
  nxBackText?: string;

  /**
   * Can be used to change the translation key with ngx-translate or any other dynamic translation tool/library.
   * Can not be used for dynamic translation keys with the native Angular translation or any other static translation tool/library.
   */
  nextBtnOptionalLabel?: string;
  /**
   * Can be used to change the translation key with ngx-translate or any other dynamic translation tool/library.
   * Can not be used for dynamic translation keys with the native Angular translation or any other static translation tool/library.
   */
  nextBtnOptionalLabelCondition?: ExpressionCondition[];

  /**
   * Specify guards on a specific page.
   */
  guards?: GuardOptions<T>;
  /**
   * Disables the transition animation between pages
   */
  disableAnimations?: boolean;
  /**
   * List of possibles userInputState updates
   */
  updateStateValues?: StateUpdates[];
}

/**
 * This object could define the 4 different possibilities that route object of angular support
 * https://angular.io/guide/router#milestone-5-route-guards
 */
export interface GuardOptions<T = string> {
  canActivate?: T[];
  canActivateChild?: T[];
  canDeactivate?: T[];
  canLoad?: T[];
  canMatch?: T[];
}

results matching ""

    No results matching ""