<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

-   [Actions/Form](#actionsform)
    -   [setValues](#setvalues)
    -   [unsetValues](#unsetvalues)
    -   [fetchValues](#fetchvalues)
    -   [setScheme](#setscheme)
    -   [setErrors](#seterrors)
    -   [flush](#flush)
-   [proptype](#proptype)
    -   [checkPropTypes](#checkproptypes)
-   [formatTaxcode](#formattaxcode)
-   [formatPhone](#formatphone)
-   [setData](#setdata)
-   [fetchData](#fetchdata)
-   [addRecord](#addrecord)
-   [modifyRecord](#modifyrecord)
-   [removeRecord](#removerecord)
-   [flush](#flush-1)
-   [setSettings](#setsettings)
-   [setHook](#sethook)
-   [setHelper](#sethelper)
-   [changeOrder](#changeorder)
-   [goToPage](#gotopage)
-   [modifyLimit](#modifylimit)
-   [applyFilter](#applyfilter)
-   [detachFilter](#detachfilter)
-   [Actions/Layer](#actionslayer)
    -   [dialog](#dialog)
    -   [fullscreen](#fullscreen)
    -   [sidebar](#sidebar)
    -   [popover](#popover)
    -   [show](#show)
    -   [hide](#hide)
    -   [toggle](#toggle)
    -   [flush](#flush-2)
    -   [modal](#modal)
-   [Modal](#modal-1)
-   [Preload](#preload)
-   [propTypes](#proptypes)
-   [defaultProps](#defaultprops)
-   [Menu](#menu)
    -   [propTypes](#proptypes-1)
        -   [items](#items)

## Actions/Form

### setValues

Create form (or sub form) key/value store.
SET_VALUES reducer payload.

**Parameters**

-   `items` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** state items { status: 1, name: 'foo', ... }
-   `form` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** state form group (alias sub form)

**Examples**

```javascript
setValue({ id: 'status', value: 1 })
or
setValue({ status: 1, options: [1, 2] }, 'sample');
// => {
form: {
   sample: {
     status: 1,
     options: [1, 2],
}}}
```

Returns **ActionType** 

**Meta**

-   **since**: 1.0.0

### unsetValues

Remove form (or sub form) key/value store.
UNSET_VALUES reducer payload.

**Parameters**

-   `items` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** state items { status: 1 } or [{ status: 1 }, ...]
-   `form` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** state group

**Examples**

```javascript
unsetValue({ id: 'status' })
or
unsetValue({ status: 1, options: [2,1] }, 'sampleForm');
// before:
{
form: {
   sampleForm: {
     status: 1,
     options: [1, 2, 3],
}}}
// after:
{
form: {
   sampleForm: {
     options: [3],
}}}
```

Returns **ActionType** 

**Meta**

-   **since**: 1.0.0

### fetchValues

Set values asynchronous.
Use Promise.then method, when then invoke
the results will be set to Store.

**Parameters**

-   `fetchApi` **[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Promise method
-   `form` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** 

**Meta**

-   **since**: 1.0.0

### setScheme

Set scheme object to store.
SET_SCHEME reducer payload

**Parameters**

-   `scheme` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
-   `form` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** 

**Examples**

```javascript
setScheme({...});
or
setScheme({...}, 'form_id');
```

Returns **ActionType** 

**Meta**

-   **since**: 1.0.0

### setErrors

Set error object to store.
SET_ERRORS reducer payload

**Parameters**

-   `errors` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
-   `form` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** 

**Examples**

```javascript
setErrors({ status: 1, ... })
or
setErrors({ status: 1, ... }, 'form_id')
```

Returns **ActionType** 

**Meta**

-   **since**: 1.0.0

### flush

Flush complete form or sub-form.
FLUSH reducer payload

**Parameters**

-   `form` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 

**Examples**

```javascript
flush()
or
flush('form_id')
```

**Meta**

-   **since**: 1.0.0

## proptype

[src/propType.js:11-11](https://github.com/roberto404/utils/blob/b2c75607a74d936bf4a15f72730affd40b484d08/src/propType.js#L11-L11 "Source code on GitHub")

### checkPropTypes

[src/propType/checkPropTypes.js:32-58](https://github.com/roberto404/utils/blob/b2c75607a74d936bf4a15f72730affd40b484d08/src/propType/checkPropTypes.js#L32-L58 "Source code on GitHub")

Validate Object like as React component props

**Parameters**

-   `subject` **any** observed value or observe Object
-   `propType` **([function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function) \| [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** one PropType or PropTypes object
-   `object` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**  (optional, default `'object'`)

**Examples**

```javascript
import PropTypes, { checkPropTypes } from '@1studio/utils/propType';

checkPropTypes(
 { id: 'something' status: true },
 {
   id: PropTypes.string.isRequired,
   status: PropTypes.bool.isRequired,
 }
);
// -> null

or

checkPropTypes('string', PropTypes.number);
// -> [errors]
```

Returns **(null | [array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array))** errors array

**Meta**

-   **since**: 3.5.0

## formatTaxcode

Automatically add dashes {8}-{1}-{2}.
And handling the reduce (backspace)

**Parameters**

-   `value` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** taxcode
-   `reduce`  

Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** taxcode extended with dash.

## formatPhone

Automatically add gap {2} {3} {4}.
And handling the reduce (backspace)

**Parameters**

-   `value` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** phone
-   `reduce`  

Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** phone extended with gap.

## setData

Load database to grid

**Parameters**

-   `data` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** 
-   `settings` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**  (optional, default `{}`)
-   `grid` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** redux grid id

## fetchData

Load database via API, set data asynchronous.
Use Promise.then method, when then invoke
the results will be set to Store.

**Parameters**

-   `fetchApi` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Promise method
-   `optionsApi` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** 
-   `settings` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
-   `grid` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** redux grid id

## addRecord

Expand database a new record

**Parameters**

-   `record` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
-   `grid` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 
-   `index` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** 

**Meta**

-   **since**: 1.0.0

## modifyRecord

Change record props is database

**Parameters**

-   `record` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
-   `grid` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 

**Meta**

-   **since**: 1.0.0

## removeRecord

Change record props is database

**Parameters**

-   `record` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
-   `grid` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 

**Meta**

-   **since**: 1.0.0

## flush

FLUSH

**Parameters**

-   `grid` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 

**Examples**

```javascript
flush()
```

**Meta**

-   **since**: 1.0.0

## setSettings

Update database settings (hook, helper etc.)

**Parameters**

-   `settings` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
-   `grid` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 

## setHook

Alias action for setSettings only hook change

**Parameters**

-   `hook` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
-   `grid` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 

## setHelper

Alias action for setSettings only helper change

**Parameters**

-   `helper`  
-   `grid` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 
-   `hook` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 

## changeOrder

Change database order

**Parameters**

-   `order` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 
-   `grid` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 

## goToPage

Update grid data current page

**Parameters**

-   `page` **int** 
-   `grid` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 

## modifyLimit

Show more results (facebook like paginate)

**Parameters**

-   `limit` **int** 
-   `grid` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 

## applyFilter

Apply filter

**Parameters**

-   `filterId` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 
-   `filterValue` **any** 
-   `grid` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 

**Examples**

```javascript
applyFilter('status', 1);
applyFilter('user', [1,2]);
applyFilter([{ id: 'status', arguments: [1] }, ...])
```

## detachFilter

Apply filter

**Parameters**

-   `filterId` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 
-   `filterValue` **any** 
-   `grid` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 

**Examples**

```javascript
detachFilter('status');
detachFilter('user', [2]);
detachFilter('user', 2);
```

## Actions/Layer

### dialog

Create and show dialog layer.

**Parameters**

-   `element` **ReactElement** Layer (dialog) content
-   `options`   (optional, default `{}`)

**Examples**

```javascript
dialog(<div>This is a dialog content</div>);
```

**Meta**

-   **since**: 1.0.0

### fullscreen

Create and show fullscreen layer.

**Parameters**

-   `element` **ReactElement** Layer (fullscreen) content
-   `options`   (optional, default `{}`)

**Examples**

```javascript
fullscreen(<div>This is a fullscreen content</div>);
```

**Meta**

-   **since**: 1.0.0

### sidebar

Create and show sidebar layer.

**Parameters**

-   `element` **ReactElement** Layer (sidebar) content

**Examples**

```javascript
sidebar(<div>This is a sidebar content</div>);
```

**Meta**

-   **since**: 1.0.0

### popover

Create and show popover layer.

**Parameters**

-   `element` **ReactElement** Layer (popover) content
-   `event` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**  (optional, default `{}`)

**Examples**

```javascript
popover(<div>This is a popover content</div>, event);
```

**Meta**

-   **since**: 1.0.0

### show

Set the layer visible.

**Examples**

```javascript
show();
open();
```

**Meta**

-   **since**: 1.0.0

### hide

Set the layer invisible.

**Examples**

```javascript
hide();
```

**Meta**

-   **since**: 1.0.0

### toggle

Toggle visibility of layer.

**Examples**

```javascript
toggle();
```

**Meta**

-   **since**: 1.0.0

### flush

Truncate layer state.

**Examples**

```javascript
flush();
```

**Meta**

-   **since**: 1.0.0

### modal

Modal is a predefined dialog layer. Do not use element, just Modal element props.

**Parameters**

-   `props` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** icon, title, content, button, buttonSecondary, classes, (optional, default `{}`)
-   `options`   (optional, default `{}`)

**Examples**

```javascript
modal();
```

**Meta**

-   **since**: 1.0.0

## Modal

Layer Redux Stateless Component

Connected to layer state via Redux.

**Parameters**

-   `$0` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `$0.icon`  
    -   `$0.title`  
    -   `$0.content`  
    -   `$0.button`  
    -   `$0.buttonSecondary`  
    -   `$0.classes`  

## Preload

Layer Redux Stateless Component

Connected to layer state via Redux.

**Parameters**

-   `$0` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `$0.element`  

## propTypes

propTypes

## defaultProps

defaultProps

## Menu

Menu

**Parameters**

-   `$0` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `$0.label`  
    -   `$0.items`  

**Examples**

```javascript
<Menu
 label='menu header'
 items=[{
   id: 1,
   title: 'one',
   handler: ({ id, title }, event) => id,
   icon: 'i-className',
   classes: 'first',
   childs: {}
 }]
/>
```

### propTypes

propTypes

#### items

Menu items

**Examples**

```javascript
[
 { id: 1, title: 'one', handler: () => 1 },
 {
   id: 2,
   title: 'two',
   handler: () => 1,
   icon: 'i-className'
   classes: 'i',
   childs: {},
  },
]
```
