# @weibin.zheng/vue-grid-layout

> A draggable and resizable grid layout, as a Vue component.

Latest version **1.0.4** (published 2023-11-26) · 0 weekly downloads

## Install

```sh
npm install @weibin.zheng/vue-grid-layout
pnpm add @weibin.zheng/vue-grid-layout
yarn add @weibin.zheng/vue-grid-layout
bun add @weibin.zheng/vue-grid-layout
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2023-11-26 |
| First published | 2023-11-06 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 12 |
| Unpacked size | 254.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Weibin.Zheng |
| Maintainers | weibin.zheng |
| Keywords | grid, vuejs, drag, draggable, resize, resizable, fluid, responsive |

## Links

- npm: https://www.npmjs.com/package/@weibin.zheng/vue-grid-layout
- Repository: https://gitee.com/wei_bin_zheng/vue-grid-layout
- npm.io page: https://npm.io/package/@weibin.zheng/vue-grid-layout

## Dependencies (12)

- [clsx](https://npm.io/package/clsx.md) ^2.0.0
- [uuid4](https://npm.io/package/uuid4.md) ^2.0.3
- [vue-demi](https://npm.io/package/vue-demi.md) latest
- [lodash.debounce](https://npm.io/package/lodash.debounce.md) ^4.0.8
- [@interactjs/actions](https://npm.io/package/@interactjs/actions.md) ^1.10.19
- [@interactjs/interact](https://npm.io/package/@interactjs/interact.md) ^1.10.19
- [@interactjs/dev-tools](https://npm.io/package/@interactjs/dev-tools.md) ^1.10.19
- [@interactjs/modifiers](https://npm.io/package/@interactjs/modifiers.md) ^1.10.19
- [@interactjs/auto-start](https://npm.io/package/@interactjs/auto-start.md) ^1.10.19
- [@types/lodash.debounce](https://npm.io/package/@types/lodash.debounce.md) ^4.0.8
- [@interactjs/auto-scroll](https://npm.io/package/@interactjs/auto-scroll.md) ^1.10.19
- [element-resize-detector](https://npm.io/package/element-resize-detector.md) ^1.2.1

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2023-11-26
- 1.0.3 — 2023-11-09
- 1.0.2 — 2023-11-09
- 1.0.1 — 2023-11-08
- 1.0.0 — 2023-11-06

## README

<p align="center"><a href="https://wei_bin_zheng.gitee.com/vue-grid-layout/" target="_blank" rel="noopener noreferrer"><img width="100" src="https://wei_bin_zheng.gitee.com/vue-grid-layout/assets/img/logo.png" alt="Vue Grid Layout"></a></p>

<h1 align="center">vue-grid-layout</h1>

<p align="center">
<a href="https://www.npmjs.com/package/@weibin.zheng/vue-grid-layout">
    <img src="https://img.shields.io/npm/v/vue-grid-layout.svg"/> 
    <img src="https://img.shields.io/npm/dm/vue-grid-layout.svg"/>
</a>

</p>
<h2 align="center">
<a href="https://wei_bin_zheng.gitee.com/vue-grid-layout/" target="_blank">Documentation Website</a>
</h2>

## What is Vue Grid Layout?

@weibin.zheng/vue-grid-layout is a rebuilt version of[vue-grid-layout](https://github.com/jbaysolutions/vue-grid-layout/tree/master), in codes it use Composition API and Typescript to get codes cleaner and more readable, meanwhile it introduce `vue-demi` to build a universal library, which can be used in both Vue 2 and Vue 3.

## Features

- Draggable widgets
- Resizable widgets
- Static widgets
- Bounds checking for dragging and resizing
- Widgets may be added or removed without rebuilding grid
- Layout can be serialized and restored
- Automatic RTL support (resizing not working with RTL on 2.2.0)
- Responsive

## Documentation

### Installation

#### Vue 2.7+ || Vue 3.x

```shell
    # Using npm
    npm install @weibin.zheng/vue-grid-layout --save

    # Using yarn
    yarn add @weibin.zheng/vue-grid-layout
```

#### <= Vue 2.6

    `@vue/composition-api` is needed for Vue 2.6 and lower.

```shell
    # Using npm
    npm install @weibin.zheng/vue-grid-layout @vue/composition-api --save

    # Using yarn
    yarn add @weibin.zheng/vue-grid-layout @vue/composition-api
```

### Import

```javascript
// 导入组件
import { GridLayout, GridItem } from "@weibin.zheng/vue-grid-layout";

// 引入内置的CSS
import "@weibin.zheng/vue-grid-layout/style.css";
```

### Register

```javascript
export default {
  components: {
    GridLayout,
    GridItem,
  },
  // ... data, methods, mounted (), etc.
};
```

### Usage

```javascript
var testLayout = [
  { x: 0, y: 0, w: 2, h: 2, i: "0" },
  { x: 2, y: 0, w: 2, h: 4, i: "1" },
  { x: 4, y: 0, w: 2, h: 5, i: "2" },
  { x: 6, y: 0, w: 2, h: 3, i: "3" },
  { x: 8, y: 0, w: 2, h: 3, i: "4" },
  { x: 10, y: 0, w: 2, h: 3, i: "5" },
  { x: 0, y: 5, w: 2, h: 5, i: "6" },
  { x: 2, y: 5, w: 2, h: 5, i: "7" },
  { x: 4, y: 5, w: 2, h: 5, i: "8" },
  { x: 6, y: 3, w: 2, h: 4, i: "9" },
  { x: 8, y: 4, w: 2, h: 4, i: "10" },
  { x: 10, y: 4, w: 2, h: 4, i: "11" },
  { x: 0, y: 10, w: 2, h: 5, i: "12" },
  { x: 2, y: 10, w: 2, h: 5, i: "13" },
  { x: 4, y: 8, w: 2, h: 4, i: "14" },
  { x: 6, y: 8, w: 2, h: 4, i: "15" },
  { x: 8, y: 10, w: 2, h: 5, i: "16" },
  { x: 10, y: 4, w: 2, h: 2, i: "17" },
  { x: 0, y: 9, w: 2, h: 3, i: "18" },
  { x: 2, y: 6, w: 2, h: 2, i: "19" },
];

export default {
  data: {
    layout: testLayout,
  },
};
```

```html
<grid-layout
  v-model:layout="layout"
  :col-num="12"
  :row-height="30"
  :is-draggable="true"
  :is-resizable="true"
  :is-mirrored="false"
  :vertical-compact="true"
  :margin="[10, 10]"
  :use-css-transforms="true"
>
  <grid-item
    v-for="item in layout"
    :x="item.x"
    :y="item.y"
    :w="item.w"
    :h="item.h"
    :i="item.i"
    :key="item.i"
  >
    {{item.i}}
  </grid-item>
</grid-layout>
```

Check out the <a href="https://wei_bin_zheng.gitee.com/vue-grid-layout/" target="_blank">Documentation Website</a> for further details

## Contribute

If you have a feature request, please add it as an issue or make a pull request.

Developed by Weibin.Zheng (1220966771@qq.com)

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