Add useFormFields composable (#691)

* Extract use-form-fields into separate composable

* Use new composable on fields detail
This commit is contained in:
Rijk van Zanten
2020-06-09 14:44:13 -04:00
committed by GitHub
parent 6777ba94c3
commit 7f43356b6a
4 changed files with 92 additions and 76 deletions

View File

@@ -135,6 +135,7 @@ import useFieldsStore from '@/stores/fields';
import { Field } from '@/stores/fields/types';
import FileInfoDrawerDetail from './components/file-info-drawer-detail.vue';
import marked from 'marked';
import useFormFields from '@/composables/use-form-fields';
type Values = {
[field: string]: any;
@@ -193,12 +194,14 @@ export default defineComponent({
// These are the fields that will be prevented from showing up in the form
const fieldsBlacklist: string[] = ['type', 'width', 'height', 'filesize', 'checksum'];
const formFields = computed(() => {
const fieldsFiltered = computed(() => {
return fieldsStore
.getFieldsForCollection('directus_files')
.filter((field: Field) => fieldsBlacklist.includes(field.field) === false);
});
const { formFields } = useFormFields(fieldsFiltered);
const confirmLeave = ref(false);
const leaveTo = ref<string | null>(null);