0.0.4 • Published 5 years ago

hms-core v0.0.4

Weekly downloads
13
License
N/A
Repository
github
Last release
5 years ago

HMS Core Library

This library provides common components which use in other Angular projects. Currently, we have 4 components implemented and publish to public NPM.

Table Of Contents

Getting Started

Dependencies

DependenciesVersion
Angular^7.2.0
Bootstrap^4.3.1
Ng-Bootstrap^4.1.2

Install

First thing, You need to an Angular project which you generate by Angular CLI. After that, You need to install Bootstrap CSS/SCSS and Ng-Bootstrap on either Dependencies or Dev Dependencies (--save-dev). You need to make sure about you imported bootstrap CSS/SCSS to your project.

// styles.scss
    @import '../../../node_modules/bootstrap/scss/bootstrap.scss';
// styles.css
    @import '../node_modules/bootstrap/dist/css/bootstrap.min.css';

About ".../.../.../" or ".../" at URL prefix, It's belong to project structure you have.

Then you can get our library from NPM as below:

npm i hms-core
npm install hms-core

Import the library to project

Now, you need to import the library to any modules that you need as the following example

// app.module.ts
...
import { HmsCoreModule } from 'hms-core'; // <-- Declare importting module from hms-core here
...

@NgModule({
    declarations: [
        AppComponent,
        ...
    ],
    imports: [
        ...,
        HmsCoreModule, // <-- Import the library here
        ...
    ],
    providers: [],
    bootstrap: [AppComponent],
    schemas: [CUSTOM_ELEMENTS_SCHEMA] // <-- Put CUSTOM_ELEMENTS_SCHEMA to schemas
})
export class AppModule { }

About HMS Core Components

Login

<hms-login [loginLanguages]="loginLanguage" [loginSignal]="loginSignal" (signIn)="onSignIn($event)" (signOut)="onSignOut()"></hms-login>
DecoratorNameTypeRequireDescription
@InputloginLanguagesLoginLanguagesOptionalSupport multiple languages (i18n) for texts, labels in Login Component
@InputloginSignalLoginSignalRequiredGet signal from external about login valid or invalid
@OutputsignInEventEmitter\<LoginUser>OptionalEmit LoginUser instance to external component
@OutputsignUpEventEmitter\<boolean>OptionalEmit signal boolean to external component

Header

<hms-header [headerData]="headerData" (searchTerm)="onSearch($event)" (updateProfile)="onUpdateProfile()" (changePassword)="onChangePassword()" (signOut)="onSignOut()"></hms-header>
DecoratorNameTypeRequireDescription
@InputheaderDataHeaderRequiredPackage other models need for header. As Logo, Title, Routes Menu, Multiple Languages for User Menu and so on
@OutputsearchTermEventEmitter\<string>OptionalEmit a string from search input
@OutputupdateProfileEventEmitter\<boolean>OptionalEmit signal about user would like to navigate to "Profile" page to update info
@OutputchangePasswordEventEmitter\<boolean>OptionalEmit signal about user would like to navigate to "Change Password" page to update info
@OutputsignOutEventEmitter\<boolean>OptionalEmit signal about user would like to sign out

Footer

<hms-footer [footerData]="footerData"></hms-footer>
DecoratorNameTypeRequireDescription
@InputfooterDataFooterRequiredPackage other models for CopyRight text and Logo

SideBar

<hms-sidebar [sideBarData]="sideBarData"></hms-sidebar>
DecoratorNameTypeRequireDescription
@InputsideBarDataSideBarRequiredPackage other models for Title, Routes Menu

Models

Login

//login-languages.model.ts

---LoginLanguages CLASS
-------title?: string;
-------emailLabel?: string;
-------passwordLabel?: string;
-------signInText?: string;
-------signUpText?: string;
-------signUpIntroText?: string;
-------invalidEmailMessageText?: string;
//login-signal.model.ts

---LoginSignal CLASS
-------isValid: string;
-------invalidMessage: string;
//login-user.model.ts

---LoginUser CLASS
-------email: string;
-------password: string;

Header

//header.model.ts

---Header CLASS
-------logo: Logo;
-------title: string;
-------menu: MenuItem[];
-------user: User;
-------userMenuLanguage: UserMenuLanguage;
//logo.model.ts

---Logo CLASS
-------imgUrl: string;
-------alt: string;
-------homePageUrl: string;
//menu-item.model.ts

---MenuItem CLASS
-------displayText: string;
-------url: string;
//user-menu-language.model.ts

---UserMenuLanguage CLASS
-------profile: Logo;
-------changePassword: string;
-------signOut: MenuItem[];
//user.model.ts

---User CLASS
-------firstName: string;
-------lastName: string;
-------email: string;
-------user: string;

Footer

//footer.model.ts

---Footer CLASS
-------copyRightText: string;
-------logo: Logo;

SideBar

//sidebar.model.ts

---SideBar CLASS
-------title: string;
-------menu: string;

Running unit tests

Run ng test hms-core to execute the unit tests via Karma.

Author

  • Shane - Sang Nguyen - Initial work - Github
0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago