Skip to content

Commit af8898d

Browse files
committed
chore: removed prop itemClass
1 parent 56910d4 commit af8898d

File tree

10 files changed

+250
-274
lines changed

10 files changed

+250
-274
lines changed

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# vue-virtual-draglist
1+
# vue-virtual-sortable
22

3-
[![npm](https://img.shields.io/npm/v/vue-virtual-draglist/next.svg)](https://www.npmjs.com/package/vue-virtual-draglist) [![npm](https://img.shields.io/npm/dm/vue-virtual-draglist.svg)](https://www.npmjs.com/package/vue-virtual-draglist) [![vue2](https://img.shields.io/badge/vue-3.x-brightgreen.svg)](https://vuejs.org/) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
3+
[![npm](https://img.shields.io/npm/v/vue-virtual-sortable/next.svg)](https://www.npmjs.com/package/vue-virtual-sortable) [![npm](https://img.shields.io/npm/dm/vue-virtual-sortable.svg)](https://www.npmjs.com/package/vue-virtual-sortable) [![vue2](https://img.shields.io/badge/vue-3.x-brightgreen.svg)](https://vuejs.org/) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
44

55
A virtual scrolling list component that can be sorted by dragging, support vue3
66

7-
If you use vue with 2.x, see [here](https://github.com/mfuu/vue-virtual-drag-list)
7+
If you use vue with 2.x, see [here](https://github.com/mfuu/vue-virtual-sortable)
88

9-
### [Live demo](https://mfuu.github.io/vue3-virtual-drag-list/)
9+
### [Live demo](https://mfuu.github.io/vue3-virtual-sortable/)
1010

1111
## Simple usage
1212

1313
```bash
14-
npm i vue-virtual-draglist@next
14+
npm i vue-virtual-sortable@next
1515
```
1616

1717
Root component:
@@ -42,7 +42,7 @@ Root component:
4242
</template>
4343
4444
<script setup lang="ts">
45-
import VirtualList from 'vue-virtual-draglist';
45+
import VirtualList from 'vue-virtual-sortable';
4646
4747
const list = ref([
4848
{ id: '1', text: 'abc' },
@@ -103,8 +103,7 @@ const list = ref([
103103
| **Prop** | **Type** | **Default** | **Description** |
104104
| ------------------ | --------- | ------------------------ | ------------------------------------------------------------- |
105105
| `sortable` | `Boolean` | `true` | Whether the current list can be sorted by dragging |
106-
| `draggable` | `String` | `.virtual-dnd-list-item` | Specifies which items inside the element should be draggable. |
107-
| `itemClass` | `String` | `virtual-dnd-list-item` | Default list item class |
106+
| `draggable` | `String` | `[role="item"]` | Specifies which items inside the element should be draggable. |
108107
| `disabled` | `Boolean` | `false` | Disables the sortable if set to true |
109108
| `animation` | `Number` | `150` | Animation speed moving items when sorting |
110109
| `autoScroll` | `Boolean` | `true` | Automatic scrolling when moving to the edge of the container |

dist/virtual-drag-list.min.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

dist/virtual-drag-list.js renamed to dist/virtual-list.js

Lines changed: 216 additions & 222 deletions
Large diffs are not rendered by default.

dist/virtual-list.min.js

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

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "vue-virtual-draglist",
3-
"version": "3.3.8",
2+
"name": "vue-virtual-sortable",
3+
"version": "3.0.0",
44
"description": "A virtual scrolling list component that can be sorted by dragging, support vue3",
5-
"main": "dist/virtual-drag-list.min.js",
5+
"main": "dist/virtual-list.min.js",
66
"types": "types/index.d.ts",
77
"files": [
88
"dist",
@@ -18,7 +18,7 @@
1818
},
1919
"repository": {
2020
"type": "git",
21-
"url": "git+https://github.com/mfuu/vue-virtual-drag-list.git"
21+
"url": "git+https://github.com/mfuu/vue-virtual-sortable.git"
2222
},
2323
"keywords": [
2424
"vue",
@@ -42,7 +42,7 @@
4242
},
4343
"homepage": "https://github.com/mfuu/vue3-virtual-drag-list#readme",
4444
"dependencies": {
45-
"sortable-dnd": "^0.6.20"
45+
"sortable-dnd": "^0.6.22"
4646
},
4747
"devDependencies": {
4848
"@babel/core": "^7.15.0",
@@ -56,13 +56,13 @@
5656
"@vitepress-demo-preview/component": "^2.3.2",
5757
"@vitepress-demo-preview/plugin": "^1.2.3",
5858
"cross-env": "^7.0.3",
59-
"lint-staged": "^11.1.2",
6059
"mockjs": "^1.1.0",
6160
"prettier": "^2.3.2",
6261
"rollup": "^2.56.2",
6362
"rollup-plugin-dts": "^4.2.3",
63+
"tslib": "^2.8.1",
6464
"typescript": "^4.3.5",
65-
"vitepress": "^1.4.1",
65+
"vitepress": "~1.4.1",
6666
"vue": "~3.2.2"
6767
}
6868
}

rollup.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const homepage = packageJson.homepage;
1111
const extensions = ['.js', '.jsx', '.ts', '.tsx'];
1212
const banner = `
1313
/*!
14-
* vue-virtual-draglist v${version}
14+
* vue-virtual-sortable v${version}
1515
* open source under the MIT license
1616
* ${homepage}
1717
*/
@@ -24,7 +24,7 @@ export default [
2424
output: [
2525
{
2626
format: 'umd',
27-
file: 'dist/virtual-drag-list.js',
27+
file: 'dist/virtual-list.js',
2828
name: 'VirtualList',
2929
sourcemap: false,
3030
globals: {
@@ -34,7 +34,7 @@ export default [
3434
},
3535
{
3636
format: 'umd',
37-
file: 'dist/virtual-drag-list.min.js',
37+
file: 'dist/virtual-list.min.js',
3838
name: 'VirtualList',
3939
sourcemap: false,
4040
globals: {

src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,9 @@ const VirtualList = defineComponent({
326326

327327
// ========================================== layout ==========================================
328328
const renderSpacer = (offset) => {
329+
const offsetKey = horizontal.value ? 'width' : 'height';
329330
if (props.tableMode) {
330-
const tdStyle = { padding: 0, border: 0, height: `${offset}px` };
331+
const tdStyle = { padding: 0, border: 0, [offsetKey]: `${offset}px` };
331332

332333
return h('tr', {}, [h('td', { style: tdStyle })]);
333334
}
@@ -353,7 +354,6 @@ const VirtualList = defineComponent({
353354
Item,
354355
{
355356
key: dataKey,
356-
class: props.itemClass,
357357
style: dragging.value && isChosen && { display: 'none' },
358358
dataKey: dataKey,
359359
sizeKey: sizeKey,

src/item.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ const Item = defineComponent({
5555
const customSlot = createSlot({ mounted, updated, unmounted });
5656

5757
return () => {
58-
const { dataKey, itemClass } = props;
58+
const { dataKey } = props;
5959
const [defaultSlot] = slots.default?.() || [];
6060
return h(
6161
customSlot,
6262
{
6363
key: dataKey,
64-
class: itemClass,
64+
role: 'item',
6565
vnode: defaultSlot,
6666
'data-key': dataKey,
6767
},

src/props.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ export const VirtualProps = {
1616
},
1717
draggable: {
1818
type: String,
19-
default: '.virtual-dnd-list-item',
20-
},
21-
itemClass: {
22-
type: String,
23-
default: 'virtual-dnd-list-item',
19+
default: '[role="item"]',
2420
},
2521
sortable: {
2622
type: Boolean,
@@ -141,8 +137,4 @@ export const ItemProps = {
141137
type: String,
142138
default: 'offsetHeight',
143139
},
144-
itemClass: {
145-
type: String,
146-
default: undefined,
147-
},
148140
};

types/index.d.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ declare const VirtualList: vue.DefineComponent<{
1515
type: StringConstructor;
1616
default: string;
1717
};
18-
itemClass: {
19-
type: StringConstructor;
20-
default: string;
21-
};
2218
sortable: {
2319
type: BooleanConstructor;
2420
default: boolean;
@@ -153,10 +149,6 @@ declare const VirtualList: vue.DefineComponent<{
153149
type: StringConstructor;
154150
default: string;
155151
};
156-
itemClass: {
157-
type: StringConstructor;
158-
default: string;
159-
};
160152
sortable: {
161153
type: BooleanConstructor;
162154
default: boolean;
@@ -285,7 +277,6 @@ declare const VirtualList: vue.DefineComponent<{
285277
dataKey: string;
286278
tableMode: boolean;
287279
draggable: string;
288-
itemClass: string;
289280
sortable: boolean;
290281
handle: string | Function;
291282
group: string | Record<string, any>;

0 commit comments

Comments
 (0)