# vue-form-state-manager

> Simple form state manager as directive.

Latest version **0.1.2** (published 2020-11-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-form-state-manager
pnpm add vue-form-state-manager
yarn add vue-form-state-manager
bun add vue-form-state-manager
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2020-11-28 |
| First published | 2020-11-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Bruno Dias |
| Maintainers | diasbruno |
| Keywords | vue, form |

## Links

- npm: https://www.npmjs.com/package/vue-form-state-manager
- Repository: https://github.com/diasbruno/vue-form-state-manager
- Homepage: https://github.com/diasbruno/vue-form-state-manager#readme
- Issues: https://github.com/diasbruno/vue-form-state-manager/issues
- npm.io page: https://npm.io/package/vue-form-state-manager

## 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.1.2 (latest) — 2020-11-28
- 0.1.1 — 2020-11-28
- 0.0.4 — 2020-11-27
- 0.0.3 — 2020-11-26
- 0.0.2 — 2020-11-26
- 0.0.1 — 2020-11-26

## README

# vue-form-state-manager

A simple form state manager that can be used as directive.

## usage

To register:

```vue
import FormState from "vue-form-state-manager";
Vue.directive('form-control', FormState);
```

Use:

```vue
<input ... form-control="'field_name'" />
```

Checking the form state:

```js
import { formState, formIsDirty, formIsPristine } from "vue-form-state-manager";

formState(formId) == { dirty: Boolean, pristine: Boolean };
formState(formId).dirty == formIsDirty(formId);
formState(formId).pristine == formIsPristine(formId);
```

Reseting a single input:

```js
export default {
  name: "MyComp",
  ...
  methods: {
    myMethod() {
      this.prop = NEW_VALUE;
      resetInitialValueFor("test-form", "field-name", this.prop);
    }
  },
  ...
}
```

## roadmap

- [x] API to control the state programmatically.

## licence

MIT

---
_Source: https://npm.io/package/vue-form-state-manager · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
