mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
113 lines
2.6 KiB
Markdown
113 lines
2.6 KiB
Markdown
# Alfresco Angular2 Components core
|
|
|
|
<p>
|
|
<a href='https://raw.githubusercontent.com/Alfresco/dev-platform-webcomponents/master/ng2-components/ng2-alfresco-upload/LICENSE'>
|
|
<img src='https://img.shields.io/hexpm/l/plug.svg' alt='license' />
|
|
</a>
|
|
<a href='https://www.alfresco.com/'>
|
|
<img src='https://img.shields.io/badge/style-component-green.svg?label=alfresco' alt='alfresco component' />
|
|
</a>
|
|
<a href='https://www.alfresco.com/'>
|
|
<img src='https://img.shields.io/badge/style-%3E5.0.0-blue.svg?label=node%20version' alt='node version' />
|
|
</a>
|
|
<a title='Build Status' href="https://travis-ci.com/Alfresco/dev-platform-webcomponents">
|
|
<img src='https://travis-ci.com/Alfresco/dev-platform-webcomponents.svg?token=FPzV2wyyCU8imY6wHR2B&branch=master' alt='travis Status' />
|
|
</a>
|
|
</p>
|
|
|
|
Core library for other ng2-alfresco components.
|
|
This should be added as a dependency for any project using the components.
|
|
|
|
### Node
|
|
To correctly use this component check that on your machine is running Node version 5.0.0 or higher.
|
|
|
|
## Install
|
|
|
|
```sh
|
|
npm set registry http://devproducts.alfresco.me:4873
|
|
npm install --save ng2-alfresco-core
|
|
```
|
|
|
|
## Main components and services
|
|
|
|
### Components
|
|
|
|
- Context Menu directive
|
|
|
|
#### Context Menu directive
|
|
|
|
_See **Demo Shell** or **DocumentList** implementation for more details and use cases._
|
|
|
|
```html
|
|
<my-component [context-menu]="menuItems"></my-component>
|
|
<context-menu-holder></context-menu-holder>
|
|
```
|
|
|
|
```ts
|
|
@Component({
|
|
selector: 'my-component
|
|
})
|
|
export class MyComponent implements OnInit {
|
|
|
|
menuItems: any[];
|
|
|
|
constructor() {
|
|
this.menuItems = [
|
|
{ title: 'Item 1', subject: new Subject() },
|
|
{ title: 'Item 2', subject: new Subject() },
|
|
{ title: 'Item 3', subject: new Subject() }
|
|
];
|
|
}
|
|
|
|
ngOnInit() {
|
|
this.menuItems.forEach(l => l.subject.subscribe(item => this.commandCallback(item)));
|
|
}
|
|
|
|
commandCallback(item) {
|
|
alert(`Executing ${item.title} command.`);
|
|
}
|
|
|
|
}
|
|
```
|
|
|
|
### Services
|
|
|
|
- Authentication Service
|
|
- Translation Service
|
|
- Context Menu Service
|
|
|
|
## Build from sources
|
|
|
|
Alternatively you can build component from sources with the following commands:
|
|
|
|
```sh
|
|
npm install
|
|
npm run build
|
|
```
|
|
|
|
### Build the files and keep watching for changes
|
|
|
|
```sh
|
|
$ npm run build:w
|
|
```
|
|
|
|
### Running unit tests
|
|
|
|
```sh
|
|
npm test
|
|
```
|
|
|
|
### Running unit tests in browser
|
|
|
|
```sh
|
|
npm test-browser
|
|
```
|
|
|
|
This task rebuilds all the code, runs tslint, license checks and other quality check tools
|
|
before performing unit testing.
|
|
|
|
### Code coverage
|
|
|
|
```sh
|
|
npm run coverage
|
|
``` |