diff --git a/client/src/components/Form/Elements/FormData/FormData.vue b/client/src/components/Form/Elements/FormData/FormData.vue index fcf318eed156..28bddeb966da 100644 --- a/client/src/components/Form/Elements/FormData/FormData.vue +++ b/client/src/components/Form/Elements/FormData/FormData.vue @@ -1,25 +1,27 @@ + + + + diff --git a/client/src/components/Form/Elements/FormData/types.ts b/client/src/components/Form/Elements/FormData/types.ts index 46929c8b876d..52c8a418897e 100644 --- a/client/src/components/Form/Elements/FormData/types.ts +++ b/client/src/components/Form/Elements/FormData/types.ts @@ -1,4 +1,4 @@ -export interface DataOption { +export type DataOption = { id: string; hid: number; is_dataset?: boolean; @@ -7,4 +7,4 @@ export interface DataOption { name: string; src: string; tags: Array; -} +}; diff --git a/client/src/components/Form/Elements/FormSelect.vue b/client/src/components/Form/Elements/FormSelect.vue index 275d61a7c694..3b93539f0de6 100644 --- a/client/src/components/Form/Elements/FormSelect.vue +++ b/client/src/components/Form/Elements/FormSelect.vue @@ -154,23 +154,27 @@ onMounted(() => { diff --git a/client/src/components/Form/FormElement.vue b/client/src/components/Form/FormElement.vue index 208664bdb616..17314b77cbcc 100644 --- a/client/src/components/Form/FormElement.vue +++ b/client/src/components/Form/FormElement.vue @@ -277,7 +277,7 @@ const isOptional = computed(() => !isRequired.value && attrs.value["optional"] ! :id="id" v-model="currentValue" :loading="loading" - :extension="attrs.extension" + :extensions="attrs.extensions" :flavor="attrs.flavor" :multiple="attrs.multiple" :optional="attrs.optional" diff --git a/client/src/utils/strings.ts b/client/src/utils/strings.ts new file mode 100644 index 000000000000..503169c6f9af --- /dev/null +++ b/client/src/utils/strings.ts @@ -0,0 +1,30 @@ +/** + * Converts an array of strings to a list, ending with "or" + * + * @example + * // returns the string "a, b or c" + * orList(["a", "b", "c"]); + * @param items array of strings to join + * @returns human readable comma + or separated list + */ +export function orList(items: string[]): string { + if (items.length === 0) { + return ""; + } else if (items.length === 1) { + return items[0] as string; + } + + return items + .reverse() + .flatMap((item, index) => { + if (index === 0) { + return [item, " or "]; + } else if (index !== 1) { + return [", ", item]; + } else { + return [item]; + } + }) + .reverse() + .join(""); +}