# vue-layout-grid

> layout gridster with vue

Latest version **0.3.4** (published 2020-04-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-layout-grid
pnpm add vue-layout-grid
yarn add vue-layout-grid
bun add vue-layout-grid
```

## 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.3.4 |
| Published | 2020-04-21 |
| First published | 2018-05-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 410.9 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 6 |
| Author | GopherJ |
| Maintainers | gopherj |
| Keywords | vue, buefy |

## Links

- npm: https://www.npmjs.com/package/vue-layout-grid
- Repository: https://github.com/GopherJ/LayoutGrid
- Homepage: https://github.com/GopherJ/LayoutGrid#readme
- Issues: https://github.com/GopherJ/LayoutGrid/issues
- npm.io page: https://npm.io/package/vue-layout-grid

## Dependencies (7)

- [vue](https://npm.io/package/vue.md) ^2.5.13
- [vuex](https://npm.io/package/vuex.md) ^3.0.1
- [buefy](https://npm.io/package/buefy.md) ^0.7.4
- [lodash](https://npm.io/package/lodash.md) ^4.17.5
- [interactjs](https://npm.io/package/interactjs.md) ^1.3.3
- [vue-loading-overlay](https://npm.io/package/vue-loading-overlay.md) ^3.3.2
- [element-resize-detector](https://npm.io/package/element-resize-detector.md) ^1.1.10

## Recent versions

- 0.3.4 (latest) — 2020-04-21
- 0.3.3 — 2020-04-21
- 0.3.1 — 2019-06-30
- 0.3.0 — 2019-06-30
- 0.2.9 — 2019-06-22
- 0.2.5 — 2018-09-19
- 0.2.4 — 2018-09-19
- 0.2.3 — 2018-09-19
- 0.2.2 — 2018-09-16
- 0.2.1 — 2018-08-12
- 0.2.0 — 2018-08-12
- 0.1.9 — 2018-07-23
- 0.1.7 — 2018-07-12
- 0.1.6 — 2018-07-06
- 0.1.5 — 2018-07-06
- … 14 more at https://npm.io/package/vue-layout-grid/versions

## README

# LayoutGrid

Layout grid system in VueJs, see also:

- [vue-grid-layout](https://github.com/jbaysolutions/vue-grid-layout)
- [Vs](https://github.com/GopherJ/Vs)


## Introduction

This component is for creating a dashboard more simply. All config of the dashboard will be saved in the vuex module `LayoutGrid`. In any component of
your SPA, you can add a new item or delete one. I've also added some new features:

- `table mode`
- `json/csv download`
- `UI design`

This component use `jbaysolutions/vue-grid-layout` internally and makes it simpler to use, that means the layout is controlled in vuex and every time
when we need to add a new item. We just need to specify the `title`, `is`, `w`, `h` and `data`. It will calculate automatically the next position and
also the identifier `i` .


## Installation

```
npm i -S vue-layout-grid
```

## Usage

`main.js`
```
import Vue from 'vue';
import Vuex from 'vuex';
import LayoutGrid from 'vue-layout-grid';
import Buefy from 'buefy';
import 'buefy/lib/buefy.min.css';

const store = new Vuex.Store();

Vue.use(Vuex);
Vue.use(LayoutGrid, { store });

new Vue({
    store,
    ...
});
```

`index.html`

```html
<link rel="stylesheet" href="//cdn.materialdesignicons.com/2.0.46/css/materialdesignicons.min.css">
```

`template`

```vue
<layout-grid
    :editable="editable"
    :margin="margin"
    :row-height="rowHeight"
    :min-w="minW">
</layout-grid>
```


## Props

|prop|description|type|default|
|:---|:---|:---|:---|
|`editable`|`show border or not`|`boolean`|`true`|
|`margin`|`margin between layout grid item`|`[number, number]`|`[0, 0]`|
|`row-height`|`layout grid item height unit`|`number`|`100`|
|`min-w`|`min w`|`number`|`1`|



## Vuex Module

This component has a vuex module which is registered as `LayoutGrid`.

`store`

```javascript
this.$store.state.LayoutGrid.layout
```

`mutations`

```javascript
// For example, here I need to add a new item to the layout
// This item is the `d3-timeline` component of [Vs](https://github.com/GopherJ/Vs)
// I just need to do:
this.$store.commit('LayoutGrid/ADD_LAYOUT_ITEM', {
    title: 'Alerts',
    is: 'd3-timeline',
    w: 12,
    h: 3,
    data: {
        // props of d3-timeline
        data: [...],
        options: {...},
        width: '100%',
        height: '100%'
    }
});


// EDIT
// This is used to replace/update an item
// For example we change the d3-timeline to d3-timelion
this.$store.commit('LayoutGrid/EDIT_LAYOUT_ITEM', {
    i: '0', // indentifier of d3-timeline, it's generated automatically
    title: 'Entries Over Time',
    is: 'd3-timelion',
    w: 12,
    h: 3,
    data: {
        // props of d3-timelion
        data: [...],
        options: {...},
        width: '100%',
        height: '100%'
    }
});
```


## Special Thanks

[jbaysolutions](https://github.com/jbaysolutions)



## Screen Shots

*###UI*
![Alerts](./images/Alerts.PNG)
![Table](./images/Table.PNG)


*###Dashboard*
![Dashboard](./images/Dashboard.PNG)

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