# vue2-seatchart

> Based on [omahili/seatchart.js](https://github.com/omahili/seatchart.js)

Latest version **0.0.6** (published 2024-06-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue2-seatchart
pnpm add vue2-seatchart
yarn add vue2-seatchart
bun add vue2-seatchart
```

## 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.6 |
| Published | 2024-06-19 |
| First published | 2024-05-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 113.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alex Leon |
| Maintainers | fntm |
| Keywords | vue, vue2, vue 2, seatchart, seat chart |

## Links

- npm: https://www.npmjs.com/package/vue2-seatchart
- Homepage: https://github.com/AlexLeonNovak/vue2-seatchart
- npm.io page: https://npm.io/package/vue2-seatchart

## Dependencies (2)

- [seatchart](https://npm.io/package/seatchart.md) ^0.1.0
- [@panzoom/panzoom](https://npm.io/package/@panzoom/panzoom.md) ^4.5.1

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 0.0.6 (latest) — 2024-06-19
- 0.0.5 — 2024-06-19
- 0.0.4 — 2024-05-31
- 0.0.3 — 2024-05-29
- 0.0.2 — 2024-05-29
- 0.0.1 — 2024-05-29

## README

# Vue 2 SeatChart

Based on [omahili/seatchart.js](https://github.com/omahili/seatchart.js)

- [Demo](https://alexleonnovak.github.io/vue2-seatchart/)
- [Repository](https://github.com/AlexLeonNovak/vue2-seatchart)
- [NPM](https://www.npmjs.com/package/vue2-seatchart)

## Install
### Npm
```bash
npm install vue2-seatchart
```
### Yarn
```bash
yarn add vue2-seatchart
```
## Usage
Import SeatChart and add options:
```vue
<script setup lang="ts">
import { SeatChart } from 'vue2-seatchart';
import { type Options } from 'seatchart';
import 'seatchart/dist/seatchart.min.css';

const options: Options = {
  map: {
    rows: 7,
    columns: 7,
    seatTypes: {
      default: {
        label: 'Economy',
        cssClass: 'economy',
        price: 10,
      },
    },
  },
};

const onSubmit = (e: SubmitEvent) => {
  console.log(e)
}

</script>

<template>
  //...
  <SeatChart :options="options" @cart:submit="onSubmit" />
  //...
</template>

<style>
  .economy {
    color: white;
    background-color: #43aa8b;
  }
</style>

```
Or add via plugin
```typescript
// ./src/main.ts

import { createApp } from 'vue'
import App from './App.vue'
import { useSeatChart } from 'vue2-seatchart';
import 'seatchart/dist/seatchart.min.css';

const app = createApp(App)
app.use(useSeatChart);
app.mount('#app')
```

## Events
| Name                  | Description                                                                                                           | Return value                                                                |
|-----------------------|-----------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|
| **cart:submit**       | When the submit button is pressed                                                                                     | [SubmitEvent](https://seatchart.js.org/interfaces/SubmitEvent.html)         | 
| **update:cartChange** | When the cart changes. More specifically when a seat is selected, unselected, removed from the cart or on cart clear. | [CartChangeEvent](https://seatchart.js.org/interfaces/CartChangeEvent.html) | 
| **update:seatChange** | When a seat changes. More specifically when a seat is selected, unselected, removed from the cart or on cart clear.   | [SeatChangeEvent](https://seatchart.js.org/interfaces/SeatChangeEvent.html) | 
| **update:cartClear**  | When the cart is cleared from all its items.                                                                          | [CartClearEvent](https://seatchart.js.org/interfaces/CartClearEvent.html)                                                          | 

## Exposed methods
| Method | Description | Return value |
| -- | -- | -- |
| **checkoutCart** | Call submit checkout cart | [SubmitEvent](https://seatchart.js.org/interfaces/SubmitEvent.html) |

### Example
```vue
<script setup lang="ts">
import { ref } from 'vue';
import { SeatChart } from 'vue2-seatchart';
import type { Options, SubmitEvent } from 'seatchart';
import 'seatchart/dist/seatchart.min.css';

const seatChartRef = ref<typeof SeatChart>();

const options: Options = {
  // ...
  cart: {
    visible: false,
  },
  // ...
};

const onCheckout = () => {
  const checkoutData: SubmitEvent = seatChartRef.value?.checkoutCart();
  console.log(checkoutData);
}

</script>

<template>
  //...
  <SeatChart :options="options" ref="seatChartRef" />
  <button @click="onCheckout">Checkout</button>
  //...
</template>
```

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