# Epom-Popup
Implements Popup functionality for ng2.

### Prerequisites

| Name | Description |
| ---- | ----------- |
| `epom-ng2-keyboard-service` | We need close popup by clicking "ESC" button |

Install `epom-ng2-keyboard-service` via npm:
```sh
$ npm install epom-ng2-keyboard-service --save
```

### Installing

First of all -- add `PopupModule` into your `app.module`
```typescript
import {PopupModule} from 'epom-ng2-popup/popup.module';
...
imports: [
    PopupModule,
    ...
];
```

## Parts
    .
    |-- epom-ng2-popup
    |   |-- popup.module
    |   |-- popup.interface
    |   |-- popup.constants
    |   |-- popup.service
    |   |-- popup.component
    |   |-- select.component
    |   |-- select-with-common-button.component
    |   |-- select-with-swap
    |   |-- geo.component
    |   |-- size.component
    |   |-- table-config.component
    |   |-- crid.component

## Service public methods
| Method Declaration                                                      | Description |
| ----------------------------------------------------------------------- | ----------- |
| .**popupCreate**(data: any): number  | creates popup from settings object (data), returns popup-hash |
| .**popupClose**(): void | close opened popup |
| .**popupFeedback** | property (!) - Subject that received data from popup and available from outside  |

## Components
|Component| Description |
|---------|-------------|
| popup.component | Implements popup with content types text or form |
| select.component | Implements select (left-right) with two buttons "include"/"exclude" |
| crid.component | Implements adding crids in textarea to right side, split multiline to separate crid |
| table-config.component | Implements popup for table configuration~~~~ |
| select-with-common-button | Implements select (left-right) with single button "add" |
| select-with-swap | Implements select (left-right) with "swap" button |

Examples:
```javascript
    const popupHash = this.popupService.popupCreate(PopupSettingsObject);
    this.popupHash.subscribe((popupResponse) => {
        if (popupResponse.hash !== popupHash) {
            return false;
        }
    })
```

## Contributors

Gennady Strelets <g.strelets@itmgmedia.net>
