# @epsidev/helios

> Build and manage Angular Forms with just a simple Typescript Object

Latest version **0.0.2** (published 2019-04-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @epsidev/helios
pnpm add @epsidev/helios
yarn add @epsidev/helios
bun add @epsidev/helios
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2019-04-01 |
| First published | 2019-03-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 420.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Brandon G. Neri @ EpsiDev |
| Maintainers | epsidev-mx |
| Keywords | angular, smart forms, reactive forms, generate forms |

## Links

- npm: https://www.npmjs.com/package/@epsidev/helios
- Repository: https://github.com/arcanite24/helios
- Issues: https://github.com/arcanite24/helios/issues
- npm.io page: https://npm.io/package/@epsidev/helios

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^1.9.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2019-04-01
- 0.0.1 — 2019-03-22

## README

<p align="center"><img width=100% src="https://imgur.com/sR6fQhU.png"></p>

![Contributions welcome](https://img.shields.io/badge/contributions-welcome-orange.svg)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)

## Basic Overview

Helios is a Angular library for building powerful and customizable forms with just a Typescript object. Helios provides support for generics, multiple CSS frameworks, HTTP requests and many more features

## Features

- **Typescipt Generics Support** - Don't lose control over your data types
- **Graphical customization** - Modify almost any aspect of how looks your form. From CSS framework suppor to embbed custom elements on every input field
- **Based on Angular Reactive Forms** - Never worry again to use the long syntax of Angular Reactive Forms, Helios handle it for you
- **Wide variety of Hooks** - You need to transform your data before or after a submit? No problem
- **Everything is Reactive** - From hooks to submiting
- **Integrate seamlessly with @epsidev/dionisio** - Helios is one of the base for Dionisio and Prometheus libraries
- **Bootstrap 4 support** - Integrate Helios with Bootstrap 4 out of the box

## Installation
```bash
npm i @epsidev/helios --save
```
Then add
`HeliosModule` into your app.module.ts file
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HeliosModule } from '@epsidev/helios';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    HeliosModule
  ],
  providers: [ ],
  bootstrap: [ AppComponent ]
})
export class AppModule { }
```

## Usage
In your template do:
```html
<helios-form [config]="heliosConfig" (submit)="onSubmit" (error)="onError"></helios-form>
```

And in your .ts file create the heliosConfig object
```typescript
import { Component } from '@angular/core';
import { HeliosSmartFormConfig, HeliosError, HeliosSmartFormTypes } from '@epsidev/helios'

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  
  public heliosConfig: HeliosSmartFormConfig<LoginData> = {
    id: 'helios-test-form',
    fields: [
      {
        label: 'Email',
        placeholder: 'Enter your email',
        name: 'email',
        type: HeliosSmartFormTypes.Email,
        validators: [
          Validators.required,
          Validators.email,
        ]
      },
      {
        label: 'Email',
        placeholder: 'Enter your password',
        name: 'password',
        type: HeliosSmartFormTypes.Password,
        validators: [
          Validators.required 
        ]
      },
    ]
  }

  onSubmit(loginData: LoginData) {
    console.log(loginData)
  }

  onError(error: HeliosError) {
    console.log('LOGIN ERROR', error.description)
  }

}

interface LoginData {
  email: string
  password: string
}
```

## How to Patch Form Data
Add a Template Reference Variable in your HTML
```html
<helios-smart-form #testForm [config]="config" (heliosSubmit)="onSubmit($event)"></helios-smart-form>
```

Then use the @ViewChild() decorator to get the Form reference
```typescript
@ViewChild('testForm') private form: SmartFormComponent
```

Now you have access to the SmartForm public methods like "pathData"
```typescript
this.form.patchData({someField: 'Some data'})
```

---
_Source: https://npm.io/package/@epsidev/helios · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
