minor v1.4.0 #84
2 changed files with 24 additions and 2 deletions
|
@ -8,6 +8,10 @@
|
||||||
:table="table"
|
:table="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:alreadySorted="alreadySorted"
|
:alreadySorted="alreadySorted"
|
||||||
|
:notFirst="index != 0"
|
||||||
|
:notLast="index != value.length - 1"
|
||||||
|
@up="changeSort('up', index)"
|
||||||
|
@down="changeSort('down', index)"
|
||||||
@update:model-value="($event) => (value[index] = $event)"
|
@update:model-value="($event) => (value[index] = $event)"
|
||||||
@remove="removeAtIndex(index)"
|
@remove="removeAtIndex(index)"
|
||||||
/>
|
/>
|
||||||
|
@ -82,6 +86,12 @@ export default defineComponent({
|
||||||
removeAtIndex(index: number) {
|
removeAtIndex(index: number) {
|
||||||
this.value.splice(index, 1);
|
this.value.splice(index, 1);
|
||||||
},
|
},
|
||||||
|
changeSort(dir: "up" | "down", index: number) {
|
||||||
|
const swapIndex = dir === "up" ? index - 1 : index + 1;
|
||||||
|
if (swapIndex >= 0 && swapIndex < this.value.length) {
|
||||||
|
[this.value[index], this.value[swapIndex]] = [this.value[swapIndex], this.value[index]];
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-row gap-2 items-center w-full">
|
<div class="flex flex-row gap-2 items-center w-full">
|
||||||
|
<div class="flex flex-col min-w-fit">
|
||||||
|
<ChevronUpIcon v-if="notFirst" class="w-4 h-4 stroke-2 cursor-pointer" @click.prevent="$emit('up')" />
|
||||||
|
<ChevronDownIcon v-if="notLast" class="w-4 h-4 stroke-2 cursor-pointer" @click.prevent="$emit('down')" />
|
||||||
|
</div>
|
||||||
<select v-model="column" class="w-full">
|
<select v-model="column" class="w-full">
|
||||||
<option value="" disabled>Spalte auswählen</option>
|
<option value="" disabled>Spalte auswählen</option>
|
||||||
<option
|
<option
|
||||||
|
@ -30,12 +34,20 @@ import { defineComponent, type PropType } from "vue";
|
||||||
import { mapActions, mapState } from "pinia";
|
import { mapActions, mapState } from "pinia";
|
||||||
import type { OrderByStructure, OrderByType } from "@/types/dynamicQueries";
|
import type { OrderByStructure, OrderByType } from "@/types/dynamicQueries";
|
||||||
import { useQueryBuilderStore } from "@/stores/admin/club/queryBuilder";
|
import { useQueryBuilderStore } from "@/stores/admin/club/queryBuilder";
|
||||||
import { TrashIcon } from "@heroicons/vue/24/outline";
|
import { TrashIcon, ChevronDownIcon, ChevronUpIcon } from "@heroicons/vue/24/outline";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
|
notFirst: {
|
||||||
|
type: Boolean,
|
||||||
|
defailt: false,
|
||||||
|
},
|
||||||
|
notLast: {
|
||||||
|
type: Boolean,
|
||||||
|
defailt: false,
|
||||||
|
},
|
||||||
table: {
|
table: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: "",
|
||||||
|
@ -59,7 +71,7 @@ export default defineComponent({
|
||||||
default: [],
|
default: [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
emits: ["update:model-value", "remove"],
|
emits: ["update:model-value", "remove", "up", "down"],
|
||||||
watch: {
|
watch: {
|
||||||
columns() {
|
columns() {
|
||||||
if (!this.columns.some((c) => c.id == this.modelValue.id)) {
|
if (!this.columns.some((c) => c.id == this.modelValue.id)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue