Make draggable a prop

This commit is contained in:
Samuel Lorch 2023-04-02 02:54:15 +02:00
parent 04a11626f5
commit 8d957a53e2
4 changed files with 6 additions and 5 deletions

View file

@ -16,8 +16,9 @@ const props = defineModel<{
sortBy?: string,
sortDesc?: boolean,
selection?: number[],
draggable?: boolean,
}>();
let { columns, data, sort, sortSelf, sortBy, sortDesc, selection } = $(props);
let { columns, data, sort, sortSelf, sortBy, sortDesc, selection, draggable } = $(props);
const emit = defineEmits<{
(event: 'rowAction', index: number): void,
@ -126,7 +127,7 @@ function dragDropRow() {
</thead>
<tbody>
<tr v-for="(row, index) in displayData" :key="index"
draggable="true"
:draggable="draggable"
@click="() => rowSelection(index)"
@dblclick="() => emit('rowAction', index)"
@dragstart="() => draggedRow = index"

View file

@ -32,6 +32,6 @@ onMounted(async() => {
<PageHeader title="DNAT Rules">
<button @click="loadRules">Load Rules</button>
</PageHeader>
<NiceTable :columns="columns" v-model:data="rules"/>
<NiceTable :columns="columns" v-model:data="rules" draggable="true"/>
</div>
</template>

View file

@ -33,6 +33,6 @@ onMounted(async() => {
<PageHeader title="Forward Rules">
<button @click="loadRules">Load Rules</button>
</PageHeader>
<NiceTable :columns="columns" v-model:data="rules"/>
<NiceTable :columns="columns" v-model:data="rules" draggable="true"/>
</div>
</template>

View file

@ -32,6 +32,6 @@ onMounted(async() => {
<PageHeader title="SNAT Rules">
<button @click="loadRules">Load Rules</button>
</PageHeader>
<NiceTable :columns="columns" v-model:data="rules"/>
<NiceTable :columns="columns" v-model:data="rules" draggable="true"/>
</div>
</template>