forked from mirrors/homebox
chore: developer cleanup (#300)
* new PR tasks * add homebox to know words * formatting * bump deps * generate db models * ts errors * drop id * fix accessor * drop unused time field * change CI * add expected error * add type check * resolve serveral type errors * hoise in CI
This commit is contained in:
parent
88f9ff90d4
commit
bd321af29f
142 changed files with 817 additions and 1200 deletions
|
@ -28,7 +28,7 @@
|
|||
<li v-for="(obj, idx) in filtered" :key="idx">
|
||||
<div type="button" @click="select(obj)">
|
||||
<slot name="display" v-bind="{ item: obj }">
|
||||
{{ usingObjects ? obj[itemText] : obj }}
|
||||
{{ extractor(obj, itemText) }}
|
||||
</slot>
|
||||
</div>
|
||||
</li>
|
||||
|
@ -94,6 +94,14 @@
|
|||
}
|
||||
);
|
||||
|
||||
function extractor(obj: string | ItemsObject, key: string | number): string {
|
||||
if (typeof obj === "string") {
|
||||
return obj;
|
||||
}
|
||||
|
||||
return obj[key] as string;
|
||||
}
|
||||
|
||||
const value = useVModel(props, "modelValue", emit);
|
||||
|
||||
const usingObjects = computed(() => {
|
||||
|
@ -135,6 +143,7 @@
|
|||
value.value = "";
|
||||
return;
|
||||
}
|
||||
// @ts-ignore
|
||||
value.value = obj;
|
||||
} else {
|
||||
if (obj === value.value) {
|
||||
|
@ -142,6 +151,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
value.value = obj;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,12 +38,10 @@
|
|||
default: "",
|
||||
},
|
||||
modelValue: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type: Array as () => any[],
|
||||
default: null,
|
||||
},
|
||||
items: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type: Array as () => any[],
|
||||
required: true,
|
||||
},
|
||||
|
|
|
@ -24,12 +24,10 @@
|
|||
default: "",
|
||||
},
|
||||
modelValue: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type: [Object, String] as any,
|
||||
default: null,
|
||||
},
|
||||
items: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type: Array as () => any[],
|
||||
required: true,
|
||||
},
|
||||
|
@ -86,7 +84,6 @@
|
|||
{ immediate: true }
|
||||
);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function compare(a: any, b: any): boolean {
|
||||
if (a === b) {
|
||||
return true;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ItemCreate, LocationOut } from "~~/lib/api/types/data-contracts";
|
||||
import { ItemCreate, LabelOut, LocationOut } from "~~/lib/api/types/data-contracts";
|
||||
import { useLabelStore } from "~~/stores/labels";
|
||||
import { useLocationStore } from "~~/stores/locations";
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
|||
name: "",
|
||||
description: "",
|
||||
color: "", // Future!
|
||||
labels: [],
|
||||
labels: [] as LabelOut[],
|
||||
});
|
||||
|
||||
whenever(
|
||||
|
@ -91,7 +91,10 @@
|
|||
focused.value = true;
|
||||
|
||||
if (locationId.value) {
|
||||
form.location = locations.value.find(l => l.id === locationId.value);
|
||||
const found = locations.value.find(l => l.id === locationId.value);
|
||||
if (found) {
|
||||
form.location = found;
|
||||
}
|
||||
}
|
||||
|
||||
if (labelId.value) {
|
||||
|
@ -106,7 +109,7 @@
|
|||
}
|
||||
|
||||
const out: ItemCreate = {
|
||||
parentId: undefined,
|
||||
parentId: null,
|
||||
name: form.name,
|
||||
description: form.description,
|
||||
locationId: form.location.id as string,
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
const emit = defineEmits(["update:modelValue", "drop"]);
|
||||
|
||||
const el = ref<HTMLDivElement>(null);
|
||||
const el = ref<HTMLDivElement>();
|
||||
const { isOverDropZone } = useDropZone(el, files => {
|
||||
emit("drop", files);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue