# @lucasbiguet/vue-editable-cell

> Vue.js component to emulate spreadsheet-like table cells edition

Latest version **0.4.0** (published 2020-01-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @lucasbiguet/vue-editable-cell
pnpm add @lucasbiguet/vue-editable-cell
yarn add @lucasbiguet/vue-editable-cell
bun add @lucasbiguet/vue-editable-cell
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2020-01-28 |
| First published | 2019-12-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 85.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Lucas BIGUET-MERMET |
| Maintainers | lucasbiguet |

## Links

- npm: https://www.npmjs.com/package/@lucasbiguet/vue-editable-cell
- Homepage: https://github.com/lucasbiguet/vue-editable-cell
- npm.io page: https://npm.io/package/@lucasbiguet/vue-editable-cell

## Dependencies (1)

- [v-dragged](https://npm.io/package/v-dragged.md) ^0.0.5

## Recent versions

- 0.4.0 (latest) — 2020-01-28
- 0.3.0 — 2019-12-18
- 0.2.0 — 2019-12-13
- 0.1.2 — 2019-12-12
- 0.1.1 — 2019-12-12

## README

# vue-editable-cell

## [Demo](https://vue-editable-cell.netlify.com/)

To run it locally clone this repo and:

``` bash
cd demo
yarn
yarn serve
```

## Install

``` bash
yarn add @lucasbiguet/vue-editable-cell
```

Then import the component as a plugin:

``` js
import EditableCell from 'vue-editable-cell'

Vue.use(EditableCell)
```

## Usage

The components works on any regular table and requires a TD element as target

Call the component just below the table and wrap both the table and the component **in a div positioned relatively**

**The table rows must be of equal heights** for the drag n drop box size to be calculated as expected

``` html
<div style="position: relative;">
  <table>
    <tr>
      <td></td>
      <!-- ... -->
    </tr>
  </table>

  <EditableCell
    :target="focusedTd"
    v-model="editableValue"
    :options="selectOptions"
    @drag="applyValueToAdjacentRows"
  />
</div>
```

## API

### Props

| Name    | Type                 | Required | Description                                                                                            |
|---------|----------------------|----------|--------------------------------------------------------------------------------------------------------|
| target  | `HTMLTableCellElement` | true     | The `<td>` element to target                                                                             |
| value   | `[Number, String]`     | false    | The value to bind to the input or select while in edit mode                                            |
| options | `Array`                | false    | Options for the select; when set, the component will display a select instead of an input in edit mode. Must be an array of objects with label/value keys ie `[{ label: 'January', value: '01' }, {...}]` |

### Events

| Name   |  Payload arguments   | Description                                       |
|--------|----------------------|---------------------------------------------------|
| drag   | value, dragOffset | Triggers when drag n' drop ends                   |
| update | value              | Triggers when value is updated in input or select |

### Methods

| Name                   | Description                       |
|------------------------|-----------------------------------|
| toggleEdition(editing) | Programatically trigger edit mode |

## Improvements

This package is in very early stage of development, features are missing, things will break unexpectedly, be prepared for an adventure!

- Drag n drop horizontally
- Write tests
- Improve documentation
- Handle rows / col sizes dynamically

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