Skip to content

Commit 7ca8c31

Browse files
committed
Replace vue-smoothdnd with vuedraggable
Signed-off-by: Julius Härtl <[email protected]>
1 parent 3736a45 commit 7ca8c31

File tree

3 files changed

+39
-29
lines changed

3 files changed

+39
-29
lines changed

apps/dashboard/src/App.vue

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,18 @@
22
<div id="app-dashboard">
33
<h2>{{ greeting.icon }} {{ greeting.text }}</h2>
44

5-
<Container class="panels"
6-
orientation="horizontal"
7-
drag-handle-selector=".panel--header"
8-
@drop="onDrop">
9-
<Draggable v-for="panelId in layout" :key="panels[panelId].id" class="panel">
5+
<Draggable class="panels" v-model="layout">
6+
<div v-for="panelId in layout" :key="panels[panelId].id" class="panel">
107
<div class="panel--header">
11-
<a :href="panels[panelId].url">
12-
<h3 :class="panels[panelId].iconClass">
13-
{{ panels[panelId].title }}
14-
</h3>
15-
</a>
8+
<h3 :class="panels[panelId].iconClass">
9+
{{ panels[panelId].title }}
10+
</h3>
1611
</div>
1712
<div class="panel--content">
1813
<div :ref="panels[panelId].id" :data-id="panels[panelId].id" />
1914
</div>
20-
</Draggable>
21-
</Container>
15+
</div>
16+
</Draggable>
2217
<a class="edit-panels icon-add" @click="showModal">{{ t('dashboard', 'Edit panels') }}</a>
2318
<Modal v-if="modal" @close="closeModal">
2419
<div class="modal__content">
@@ -30,7 +25,7 @@
3025
class="checkbox"
3126
:checked="isActive(panel)"
3227
@input="updateCheckbox(panel, $event.target.checked)">
33-
<label :for="'panel-checkbox-' + panel.id">
28+
<label :for="'panel-checkbox-' + panel.id" :class="panel.iconClass">
3429
{{ panel.title }}
3530
</label>
3631
</li>
@@ -48,7 +43,7 @@ import Vue from 'vue'
4843
import { loadState } from '@nextcloud/initial-state'
4944
import { getCurrentUser } from '@nextcloud/auth'
5045
import { Modal } from '@nextcloud/vue'
51-
import { Container, Draggable } from 'vue-smooth-dnd'
46+
import Draggable from 'vuedraggable'
5247
import axios from '@nextcloud/axios'
5348
import { generateUrl } from '@nextcloud/router'
5449
@@ -76,7 +71,6 @@ export default {
7671
name: 'App',
7772
components: {
7873
Modal,
79-
Container,
8074
Draggable,
8175
},
8276
data() {
@@ -216,6 +210,10 @@ export default {
216210
border-radius: var(--border-radius-large);
217211
border: 2px solid var(--color-border);
218212
213+
&.sortable-ghost {
214+
opacity: 0.1;
215+
}
216+
219217
& > .panel--header {
220218
position: sticky;
221219
display: flex;
@@ -229,6 +227,15 @@ export default {
229227
backdrop-filter: blur(4px);
230228
cursor: grab;
231229
230+
&, ::v-deep * {
231+
-webkit-touch-callout: none;
232+
-webkit-user-select: none;
233+
-khtml-user-select: none;
234+
-moz-user-select: none;
235+
-ms-user-select: none;
236+
user-select: none;
237+
}
238+
232239
&:active {
233240
cursor: grabbing;
234241
}
@@ -282,6 +289,9 @@ export default {
282289
padding: 10px;
283290
display: block;
284291
list-style-type: none;
292+
background-size: 16px;
293+
background-position: left center;
294+
padding-left: 26px;
285295
}
286296
}
287297

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"vue-localstorage": "^0.6.2",
8080
"vue-multiselect": "^2.1.6",
8181
"vue-router": "^3.3.4",
82-
"vue-smooth-dnd": "^0.8.1",
82+
"vuedraggable": "^2.24.0",
8383
"vuex": "^3.4.0",
8484
"vuex-router-sync": "^5.0.0"
8585
},

0 commit comments

Comments
 (0)