Skip to content

Commit 9433ab4

Browse files
committed
chore: Added licence, changelog, readme & security docs and updated package.json
1 parent 13a235a commit 9433ab4

File tree

8 files changed

+801
-4
lines changed

8 files changed

+801
-4
lines changed

.markdownlint.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"MD013": {
3+
"tables": false
4+
}
5+
}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Changelog
2+
3+
## [v0.1.0] - 2022-08-21
4+
5+
Please refer to the [README](README.md) for documentation on
6+
how to install and use vue-draggable-list.

LICENCE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,76 @@
11
# vue-draggable-list
2+
3+
[npm](https://www.npmjs.com/package/vue-draggable-list)
4+
5+
vue-draggable-list is a vue drag and drop component utilising [mobile-drag-drop](https://github.com/timruffles/mobile-drag-drop).
6+
7+
Originally created for [Musare](https://github.com/Musare/Musare).
8+
9+
## Dependencies
10+
11+
- Vue 3
12+
- NodeJS v16+
13+
14+
## Installation
15+
16+
1. Install the package
17+
18+
```bash
19+
npm install vue-draggable-list
20+
```
21+
22+
2. Import styling in to your package globally
23+
24+
```javascript
25+
@import "vue-draggable-list/dist/style.css";
26+
```
27+
28+
3. Import component
29+
30+
```javascript
31+
import { DraggableList } from "vue-draggable-list";
32+
```
33+
34+
4. Use the component
35+
36+
```javascript
37+
<draggable-list
38+
item-key="_id"
39+
v-model:list="myList"
40+
:attributes="{
41+
class: element => ({
42+
'left': element.left
43+
}),
44+
title: 'Title'
45+
}"
46+
tag="div"
47+
group="myGroup"
48+
:disabled="isListDisabled()"
49+
@start="drag = true"
50+
@end="drag = false"
51+
@update="updateList"
52+
>
53+
<template #item="{ element, index }">
54+
<my-element :data="element" :index="index" />
55+
</template>
56+
</draggable-list>
57+
```
58+
59+
### Props
60+
61+
| Name | Type | Default | Optional | Description |
62+
| --- | --- | --- | --- | --- |
63+
| itemKey | String | | No | Name of the property that is unique in each list item. |
64+
| list | Array | | No | List of items, if defined as a v-model any updates will be applied to provided list. |
65+
| attributes | Object | | Yes | Object of functions or attributes of any type that will be called or applied to each item and added as an attribute. |
66+
| tag | String | `div` | Yes | Name of the HTML element of each item. |
67+
| group | String | | Yes | Name of the group, so you can move items between different lists in the same group. Leaving it empty will disable moving between lists. |
68+
| disabled | Boolean or Function | `false` | Yes | Used to disable dragging inside a list in general, or with a function you can prevent specific items from being dragged. |
69+
70+
### Emits
71+
72+
| Name | Data | Description |
73+
| --- | --- | --- |
74+
| start | | Emitted when dragging starts. |
75+
| end | | Emitted when dragging stops. |
76+
| update | `{ moved: { oldIndex: Number, newIndex: Number, updatedList: Array }` | Emitted when an element is dropped in the same list, which returns the old and new index and the new list of items. |

SECURITY.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
Only the latest published production version is supported.
6+
7+
## Reporting a Vulnerability
8+
9+
To report a vulnerability with a supported version please get in touch with us
10+
via email at [[email protected]](mailto:[email protected]).
11+
12+
We endeavour to respond to reports as soon as possible, this may however take a
13+
few days. Please refrain from reporting security issues in public forums such as
14+
GitHub issues.
15+
16+
Reports will be disclosed via a security advisory once fixes are included in a
17+
production release.

package-lock.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
11
{
22
"name": "vue-draggable-list",
3-
"version": "1.0.0",
3+
"description": "vue draggable list",
4+
"version": "0.1.0",
45
"type": "module",
6+
"license": "GPL-3.0",
7+
"author": {
8+
"name": "Musare",
9+
"url": "https://github.com/Musare",
10+
"email": "[email protected]"
11+
},
12+
"contributors": [
13+
"Kristian Vos <[email protected]>",
14+
"Owen Diffey <[email protected]>"
15+
],
16+
"homepage": "https://github.com/Musare/vue-draggable-list",
17+
"bugs": {
18+
"url": "https://github.com/Musare/vue-draggable-list/issues",
19+
"email": "[email protected]"
20+
},
21+
"repository": {
22+
"type": "git",
23+
"url": "https://github.com/Musare/vue-draggable-list.git"
24+
},
525
"scripts": {
626
"dev": "vite",
727
"build": "vite build && vue-tsc --emitDeclarationOnly",

src/components/DraggableList.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const props = defineProps({
66
list: { type: Array as PropType<any[]>, default: () => [] },
77
attributes: { type: Object, default: () => ({}) },
88
tag: { type: String, default: "div" },
9-
class: { type: String, default: "" },
109
group: { type: String, default: "" },
1110
disabled: { type: [Boolean, Function], default: false }
1211
});

0 commit comments

Comments
 (0)