# adplenty-components-library

## Install on other projects

#### 1. Execute

```
  npm i -s @adplenty-tech/adplenty-components-library
```

#### 2. JS file

In the main angular file where modules are imported add:<br />

```
  import "@adplenty-tech/adplenty-components-library"
```

Then:<br />

```
  const app = angular.module('admin', ["@adplenty-tech/adplenty-components-library"])
```

#### 3. Import CSS

In your main CSS file add: <br />

```
  @import "../../node_modules/@adplenty-tech/adplenty-components-library/build/index";
```

## Module organization

Directives: `app/components`<br />
Filters: `app/filters`<br />
Services: `app/services`<br />

## Adding a module

There are 2 ways to add a module into this repo:<br />

- Copy the compnent folder from the project into the component folder.<br />
- Create a directive using the `directcrea` command (needs to be installed first: `npm install -Sg git+ssh://git@bitbucket.org/albion_team/directcrea.git`)<br />
- **Optional:** Create a readme.MD in the module directory to explain more in details how this module works<br />
- **Optional:** Add examples in the `overview.html` file<br />

## Rules around adding a module

In order to keep this repository as clean as possible it is not allowed to add directives that:<br />

- Use a specific product API<br />
- Use a specific service/filter/etc. only available in a product<br />
- Have drastic functional and design differences across products<br />

## Updating a module

It is important to keep in mind that this repository might be updated over time across all our products, so before changing anything you need to make sure it doesn't:<br />

- impact the way it is being called (ex: change the tag name)<br />
- impact the way attributes are used (ex: change attribute name or remove attributes)<br />
- change the object formats of inputs and outputs (ex: changing config property names or return format from event based actions like 'onClick')<br />

**Try to always extend on the current directive code, and if it is too different create a new directive**

## Creating a new version

In order to create a new version please follow this checklist:

- run `npm run build`<br />
- edit `package.json` to reflect a new version<br />
- edit this file if needed with important information<br />

## Current list of directives

[sample](./app/components/sample)<br />
[libText](./app/components/libText)<br />
[fieldWrapper](./app/components/fieldWrapper)<br />
[inputLabel](./app/components/inputLabel)<br />
