mirror of
https://github.com/directus/directus.git
synced 2026-01-22 22:58:00 -05:00
@@ -5,7 +5,7 @@ import getDefaultInterfaceForType from '@/utils/get-default-interface-for-type';
|
||||
import { getInterfaces } from '@/interfaces';
|
||||
import { FormField } from '@/components/v-form/types';
|
||||
import { Field } from '@/types';
|
||||
import { clone, orderBy } from 'lodash';
|
||||
import { clone } from 'lodash';
|
||||
|
||||
export default function useFormFields(fields: Ref<Field[]>) {
|
||||
const interfaces = getInterfaces();
|
||||
@@ -13,9 +13,6 @@ export default function useFormFields(fields: Ref<Field[]>) {
|
||||
const formFields = computed(() => {
|
||||
let formFields = clone(fields.value);
|
||||
|
||||
// Sort the fields on the sort column value
|
||||
formFields = orderBy(formFields, [(o) => o.meta?.sort || null, (o) => o.meta?.id]);
|
||||
|
||||
formFields = formFields.map((field, index) => {
|
||||
if (!field.meta) return field;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { i18n } from '@/lang';
|
||||
import formatTitle from '@directus/format-title';
|
||||
import { useRelationsStore } from '@/stores/';
|
||||
import { Relation, FieldRaw, Field } from '@/types';
|
||||
import { merge } from 'lodash';
|
||||
import { merge, orderBy } from 'lodash';
|
||||
import { nanoid } from 'nanoid';
|
||||
import { unexpectedError } from '@/utils/unexpected-error';
|
||||
|
||||
@@ -221,7 +221,10 @@ export const useFieldsStore = createStore({
|
||||
return primaryKeyField;
|
||||
},
|
||||
getFieldsForCollection(collection: string): Field[] {
|
||||
return this.state.fields.filter((field) => field.collection === collection);
|
||||
return orderBy(
|
||||
this.state.fields.filter((field) => field.collection === collection),
|
||||
(collection) => (collection.meta?.sort ? Number(collection.meta?.sort) : null)
|
||||
);
|
||||
},
|
||||
getFieldsForCollectionAlphabetical(collection: string): Field[] {
|
||||
return this.getFieldsForCollection(collection).sort((a: Field, b: Field) => {
|
||||
|
||||
Reference in New Issue
Block a user