2.1.3 • Published 9 months ago

@propmix/profet-common-header v2.1.3

Weekly downloads
-
License
-
Repository
-
Last release
9 months ago

CommonHeader

This library was generated with Angular CLI version 15.2.0.

Usage

  1. Install the package using the command

    npm i @propmix/profet-common-header

  1. Import the library and required pipes in module

    import { CommonHeaderModule } from "@propmix/profet-common-header";
    imports: [
        
        // Other import statements
        CommonHeaderModule
    ],
    providers: [TitleCasePipe, LowerCasePipe]
  1. Use library in the component html

Input

  1. template - To pass custom HTML that need to render in the header library
*HTML Usage* - `<lib-header [template]="reference"></lib-header>`

#### Sample
    
    <lib-header [template]="create_ref" (menuEvent)="sideMenuToggle()"></lib-header>

    <ng-template #create_ref>
        <button>Create</button>
    </ng-template>
  1. appName - To pass the current application

    HTML Usage - <lib-header [appName]="app"></lib-header>

    The appName is a constant that can be assigned one of the following values provided by the library.

    import { PROFET_APPS } from '@propmix/profet-common-header';
    
    export class AppComponent {
        app = PROFET_APPS.profet_portal; // Assigning the constant value to the app variable
    }

    The PROFET_APPS can have the following possible values:

    ConstantDescription
    PROFET_APPS.profet_portalRepresents Profet Portal
    PROFET_APPS.appraisal_managementRepresents Profet Order Management
    PROFET_APPS.appraisal_reviewRepresents Profet Review
    PROFET_APPS.appraisal_valuationRepresents Profet Valuation

Output

  1. menuEvent - To capture the side menu click

    HTML Usage - <lib-header (menuEvent)="sideMenuToggle()"></lib-header>

    Typescript -

    sideMenuToggle(){
    
        // Mat menu toogle logic
        this.sidenav.toggle();
    }
  2. infoEvent - Getting company data from header

    HTML Usage - <lib-header (infoEvent)="getCompanyData($event)"></lib-header>

Config

Use an initializer function to configure parameters

    import { HeaderConfig } from '@propmix/profet-common-header/lib/utils/HeaderConfig';
    import { Amplify } from 'aws-amplify';
    import { environment } from 'src/environments/environment';

    export function initializeHeaderConfig(): HeaderConfig {
        const headerConfig: HeaderConfig = {
            apiUrl: environment.portalApiUrl,

            portalFrontendUrl: environment.portalFrontendUrl,
            // portalFrontendUrl is optional
            
            signOutUrl: Amplify.getConfig().Auth.Cognito.loginWith.oauth.redirectSignOut[0]
            // signOutUrl - using this option to specify the logout path. 
            //              Usually take this from the Amplify config
        };
    
        return headerConfig;
    }

Use the configuration option in the app.module.ts file

    import { CommonHeaderService } from '@propmix/profet-common-header';
    
    import { HeaderConfig } from '@propmix/profet-common-header/lib/utils/HeaderConfig';
    
    
    providers: [
        CommonHeaderService,
        { provide: 'headerConfig', useFactory: initializeHeaderConfig }
    ]

Pipes Used

This library uses two Angular pipes, so you need to ensure they are available in your module:

TitleCasePipe: Transforms strings into Title Case.

LowerCasePipe: Transforms strings to lowercase.

Make sure to provide these pipes in the AppModule of your application.

providers: [TitleCasePipe, LowerCasePipe]

Publishing to npm repository

  1. ng build common-header

  2. cd dist/common-header

  3. npm publish --access public

Local Development & testing

Do these steps from the library directory

  1. ng build common-header --watch

  2. cd dist/common-header/

  3. npm link

Do these steps from the consumer application

  1. npm ci

  2. npm link @propmix/profet-common-header

Running unit tests

Run ng test common-header to execute the unit tests via Karma.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.

2.1.3

9 months ago

2.1.2

9 months ago

2.1.1

9 months ago

2.1.0

9 months ago

2.0.10-unstable

9 months ago

2.0.11-unstable

9 months ago

2.0.9-unstable

9 months ago

2.0.8-unstable

9 months ago

2.0.7

9 months ago

2.0.6

10 months ago

2.0.5-beta-unstable

10 months ago

1.0.23

10 months ago

2.0.0-unstable

1 year ago

2.0.3-unstable

12 months ago

2.0.2-beta-unstable

12 months ago

1.0.22

12 months ago

1.0.21

12 months ago

2.0.3-beta-unstable

12 months ago

2.0.1-unstable

12 months ago

2.0.2-unstable

12 months ago

2.0.4-beta-unstable

12 months ago

1.0.21-unstable

1 year ago

1.0.19

1 year ago

1.0.20

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.13

1 year ago

1.0.11

2 years ago

1.0.12

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago