Prevent self-referencing locations and items as parents (#773)

* prevent current location and descendants from being selected as parent

* prevent an item from showing up in the parent items drop-down for itself

* pass location object to filter function to allow for more flexible filtering

* align exclude prop and fix type comparison, change item filter to array of ItemsObjects to allow for descendant filtering in future

* fix linting prop reference
This commit is contained in:
Nikolai Oakfield
2025-06-28 18:58:46 -04:00
committed by GitHub
parent c1c8eb649c
commit c9d055fe03
5 changed files with 45 additions and 10 deletions

View File

@@ -58,6 +58,7 @@
type Props = {
modelValue?: LocationSummary | null;
currentLocation?: LocationSummary;
};
const props = defineProps<Props>();
@@ -66,7 +67,7 @@
const open = ref(false);
const search = ref("");
const id = useId();
const locations = useFlatLocations();
const locations = useFlatLocations(props.currentLocation);
const value = useVModel(props, "modelValue", emit);
function selectLocation(location: LocationSummary) {