Skip to content

Commit a95fe49

Browse files
committed
use vue-draggable-plus
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
1 parent c49f399 commit a95fe49

7 files changed

Lines changed: 100 additions & 183 deletions

File tree

package-lock.json

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

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
"qrcode": "^1.5.4",
4949
"v-click-outside": "^3.2.0",
5050
"vue": "^3.5.22",
51+
"vue-draggable-plus": "^0.6.1",
5152
"vue-material-design-icons": "^5.3.1",
52-
"vue-router": "^4.6.0",
53-
"vuedraggable": "^4.1.0"
53+
"vue-router": "^4.6.0"
5454
},
5555
"devDependencies": {
5656
"@mdi/js": "^7.4.47",

patches/vuedraggable+4.1.0.patch

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

src/components/Questions/QuestionDropdown.vue

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
{{ t('forms', 'Add multiple options') }}
2525
</NcActionButton>
2626
</template>
27-
<div
27+
<NcSelect
2828
v-if="readOnly"
2929
:modelValue="selectedOption"
3030
:name="name || undefined"
@@ -36,7 +36,7 @@
3636
label="text"
3737
:aria-label-combobox="selectOptionPlaceholder"
3838
:aria-labelledby="titleId"
39-
:aria-describedby="description ? descriptionId : undefined">
39+
:aria-describedby="description ? descriptionId : undefined"
4040
@input="onInput" />
4141
<template v-else>
4242
<div v-if="isLoading">
@@ -45,7 +45,6 @@
4545
<Draggable
4646
v-else
4747
v-model="choices"
48-
:itemKey="(item) => (item.local ? 'option-local' : item.id)"
4948
class="question__content"
5049
:animation="200"
5150
direction="vertical"
@@ -60,26 +59,25 @@
6059
@change="saveOptionsOrder('choice')"
6160
@start="isDragging = true"
6261
@end="isDragging = false">
63-
<template #item="{ element: answer, index }">
64-
<!-- Answer text input edit -->
65-
<AnswerInput
66-
ref="input"
67-
:answer="answer"
68-
:formId="formId"
69-
isDropdown
70-
:index="index"
71-
:isUnique="!isMultiple"
72-
:maxIndex="options.length - 1"
73-
:maxOptionLength="maxStringLengths.optionText"
74-
optionType="choice"
75-
@createAnswer="onCreateAnswer"
76-
@update:answer="updateAnswer"
77-
@delete="deleteOption"
78-
@focusNext="focusNextInput"
79-
@moveUp="onOptionMoveUp(index)"
80-
@moveDown="onOptionMoveDown(index)"
81-
@tabbedOut="checkValidOption" />
82-
</template>
62+
<AnswerInput
63+
v-for="(answer, index) in choices"
64+
:key="answer.local ? 'option-local' : answer.id"
65+
ref="input"
66+
:answer="answer"
67+
:formId="formId"
68+
isDropdown
69+
:index="index"
70+
:isUnique="!isMultiple"
71+
:maxIndex="options.length - 1"
72+
:maxOptionLength="maxStringLengths.optionText"
73+
optionType="choice"
74+
@createAnswer="onCreateAnswer"
75+
@update:answer="updateAnswer"
76+
@delete="deleteOption"
77+
@focusNext="focusNextInput"
78+
@moveUp="onOptionMoveUp(index)"
79+
@moveDown="onOptionMoveDown(index)"
80+
@tabbedOut="checkValidOption" />
8381
</Draggable>
8482
</template>
8583

@@ -91,7 +89,7 @@
9189
</template>
9290

9391
<script>
94-
import Draggable from 'vuedraggable'
92+
import { VueDraggable as Draggable } from 'vue-draggable-plus'
9593
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
9694
import NcActionCheckbox from '@nextcloud/vue/components/NcActionCheckbox'
9795
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'

src/components/Questions/QuestionGrid.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181

182182
<script>
183183
import { translatePlural as n, translate as t } from '@nextcloud/l10n'
184-
import Draggable from 'vuedraggable'
184+
import { VueDraggable as Draggable } from 'vue-draggable-plus'
185185
import NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwitch'
186186
import NcInputField from '@nextcloud/vue/components/NcInputField'
187187
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'

src/components/Questions/QuestionMultiple.vue

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@
120120
<Draggable
121121
v-else
122122
v-model="choices"
123-
:itemKey="(item) => (item.local ? 'option-local' : item.id)"
124123
class="question__content"
125124
:animation="200"
126125
direction="vertical"
@@ -135,24 +134,24 @@
135134
@change="saveOptionsOrder('choice')"
136135
@start="isDragging = true"
137136
@end="isDragging = false">
138-
<template #item="{ element: answer, index }">
139-
<AnswerInput
140-
ref="input"
141-
:answer="answer"
142-
:formId="formId"
143-
:index="index"
144-
:isUnique="isUnique"
145-
:maxIndex="options.length - 1"
146-
:maxOptionLength="maxStringLengths.optionText"
147-
optionType="choice"
148-
@createAnswer="onCreateAnswer"
149-
@update:answer="updateAnswer"
150-
@delete="deleteOption"
151-
@focusNext="focusNextInput"
152-
@moveUp="onOptionMoveUp(index)"
153-
@moveDown="onOptionMoveDown(index)"
154-
@tabbedOut="checkValidOption" />
155-
</template>
137+
<AnswerInput
138+
v-for="(answer, index) in choices"
139+
:key="answer.local ? 'option-local' : answer.id"
140+
ref="input"
141+
:answer="answer"
142+
:formId="formId"
143+
:index="index"
144+
:isUnique="isUnique"
145+
:maxIndex="options.length - 1"
146+
:maxOptionLength="maxStringLengths.optionText"
147+
optionType="choice"
148+
@createAnswer="onCreateAnswer"
149+
@update:answer="updateAnswer"
150+
@delete="deleteOption"
151+
@focusNext="focusNextInput"
152+
@moveUp="onOptionMoveUp(index)"
153+
@moveDown="onOptionMoveDown(index)"
154+
@tabbedOut="checkValidOption" />
156155
</Draggable>
157156
<li
158157
v-if="allowOtherAnswer"
@@ -180,7 +179,7 @@
180179
<script>
181180
import { showError } from '@nextcloud/dialogs'
182181
import { translatePlural as n, translate as t } from '@nextcloud/l10n'
183-
import Draggable from 'vuedraggable'
182+
import { VueDraggable as Draggable } from 'vue-draggable-plus'
184183
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
185184
import NcActionCheckbox from '@nextcloud/vue/components/NcActionCheckbox'
186185
import NcActionInput from '@nextcloud/vue/components/NcActionInput'

0 commit comments

Comments
 (0)