tlimpanont-hamis-ui-library
v0.0.1
Published
HaMIS UI Library component
Downloads
1
Readme
Hamis UI components built with Angular2
This repo runs npm test
before each git push
action
To successfully install this component library on your local machine make sure you have the following configuration in your ~/.npmrc file
registry=https://nexus3.hamis.nl/repository/npm-all
npm install hamis-ui-library --save
Note on dependencies version 0.0.0-214 and higher
version 0.0.0-214 and higher will not support full dependencies anymore
You have to manage the dependencies of third party libraries yourself. Add this as dependencies to your project (as proposed by Angular project and the peerDependencies of hamis-ui-library):
{
"dependencies": {
"@angular/common": "4.0.0",
"@angular/compiler": "4.0.0",
"@angular/core": "4.0.0",
"@angular/forms": "4.0.0",
"@angular/http": "4.0.0",
"@angular/platform-browser": "4.0.0",
"@angular/platform-browser-dynamic": "4.0.0",
"@angular/router": "4.0.0",
"angular-in-memory-web-api": "0.3.0",
"systemjs": "0.19.40",
"core-js": "2.4.1",
"rxjs": "5.0.1",
"zone.js": "0.8.4"
}
}
It's also very important to have version 3 or higher of npm so that the project can use peerDependencies. npm install -g npm
importing as ngModule
app.module.ts (don't forget FormsModule!)
import {NgModule} from "@angular/core";
import {BrowserModule} from "@angular/platform-browser";
import {FormsModule} from "@angular/forms";
import {AppComponent} from "./app.component";
import {HamisComponentsModule} from "hamis-ui-library/components";
@NgModule({
imports: [BrowserModule, FormsModule, HamisComponentsModule.forRoot()],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {
}
Developing components
hamis-ui-library repo is also a place where you can develop and add new components. This repo can be built and served as a web server for demo purposes.
The app folder contains the application and NPM published components source codes. components.ts is a index file where we export all the components we want to publish.
Start to develop (see package.json)
npm start
Start to test while developing (see package.json). This is a unit-level testing.
npm test:watch
npm test #is used for CI test
E2E Testing description will come soon...
Components README.md
Remember to write a README.md file for each component you build.
Requirements:
- Write enough HTML markup examples which explains how to implement the component
- Describe the attributes and it's type and purposes.
This documentation style is heavily inspired by Angular2 Material https://github.com/angular/material2/tree/master/src/components/button
Example Component Documentation
Callout component
<callout class="glyphicon glyphicon-info-sign text-success">
<callout-content>
<!-- some angular2 component -->
</callout-content>
</callout>
<!-- OR -->
<HTMLTag data-callout>
<callout-content>
<!-- some angular2 component -->
</callout-content>
</HTMLTag>
Styling
add a class to the callout
component tag like the example above.
Accessibility
- As
callout
is added to an existingbutton
ora
tag, it enjoys all the accessibility natively built into these elements.
API Summary
Properties:
| Name | Type | Description |
| --- | --- | --- |
| title
| string | The title of the callout
| direction
| "left"|"right"|"top"|"bottom"
| How to position the popover. When "auto" is specified, it will dynamically reorient the popover. For example, if placement is "auto left", the popover will display to the left when possible, otherwise it will display right. When a function is used to determine the placement, it is called with the popover DOM node as its first argument and the triggering element DOM node as its second. The this context is set to the popover instance.