diff --git a/frontend/src/components/ReorderableList.vue b/frontend/src/components/ReorderableList.vue index 445f769..8065be4 100644 --- a/frontend/src/components/ReorderableList.vue +++ b/frontend/src/components/ReorderableList.vue @@ -5,10 +5,12 @@ const props = withDefaults(defineProps<{ items: T[]; itemKey: (item: T) => string | number; itemLabel: (item: T) => string; + listKeyPrefix?: string; disabled?: boolean; handleLabel: (name: string) => string; handleTitle: string; }>(), { + listKeyPrefix: '', disabled: false }); @@ -28,6 +30,10 @@ function keyFor(item: T): string | number { return props.itemKey(item); } +function transitionKeyFor(item: T): string { + return props.listKeyPrefix ? `${props.listKeyPrefix}:${String(keyFor(item))}` : String(keyFor(item)); +} + function sameKey(first: string | number, second: string | number): boolean { return String(first) === String(second); } @@ -181,7 +187,7 @@ function handleKeydown(item: T, event: KeyboardEvent) {
  • { :items="configRows" :item-key="configKey" :item-label="configLabel" + :list-key-prefix="`config-${activeConfigType}`" :disabled="busy" :handle-label="dragSortLabel" :handle-title="t('pages.admin.dragSortTitle')" @@ -662,6 +664,7 @@ onMounted(() => { :items="languageRows" :item-key="languageKey" :item-label="languageLabel" + list-key-prefix="languages" :disabled="busy" :handle-label="dragSortLabel" :handle-title="t('pages.admin.dragSortTitle')" @@ -690,6 +693,7 @@ onMounted(() => { :items="pokemonRows" :item-key="pokemonKey" :item-label="pokemonLabel" + list-key-prefix="pokemon" :disabled="busy" :handle-label="dragSortLabel" :handle-title="t('pages.admin.dragSortTitle')" @@ -714,6 +718,7 @@ onMounted(() => { :items="itemRows" :item-key="itemKey" :item-label="itemLabel" + list-key-prefix="items" :disabled="busy" :handle-label="dragSortLabel" :handle-title="t('pages.admin.dragSortTitle')" @@ -738,6 +743,7 @@ onMounted(() => { :items="recipeRows" :item-key="recipeKey" :item-label="recipeLabel" + list-key-prefix="recipes" :disabled="busy" :handle-label="dragSortLabel" :handle-title="t('pages.admin.dragSortTitle')" @@ -762,6 +768,7 @@ onMounted(() => { :items="habitatRows" :item-key="habitatKey" :item-label="habitatLabel" + list-key-prefix="habitats" :disabled="busy" :handle-label="dragSortLabel" :handle-title="t('pages.admin.dragSortTitle')"