diff --git a/app/src/interfaces/file/index.ts b/app/src/interfaces/file/index.ts index db37f79171..3940bbbdad 100644 --- a/app/src/interfaces/file/index.ts +++ b/app/src/interfaces/file/index.ts @@ -8,6 +8,7 @@ export default defineInterface(({ i18n }) => ({ icon: 'note_add', component: InterfaceFile, types: ['uuid'], + localTypes: ['file'], relationship: 'm2o', options: [], recommendedDisplays: ['file'], diff --git a/app/src/interfaces/files/index.ts b/app/src/interfaces/files/index.ts index abc0db0cd2..78581adf2a 100644 --- a/app/src/interfaces/files/index.ts +++ b/app/src/interfaces/files/index.ts @@ -8,6 +8,7 @@ export default defineInterface(({ i18n }) => ({ icon: 'note_add', component: InterfaceFiles, types: ['alias'], + localTypes: ['files'], relationship: 'm2m', options: [], recommendedDisplays: ['files'], diff --git a/app/src/interfaces/image/index.ts b/app/src/interfaces/image/index.ts index 73daa4fce7..08e80f9335 100644 --- a/app/src/interfaces/image/index.ts +++ b/app/src/interfaces/image/index.ts @@ -8,6 +8,7 @@ export default defineInterface(({ i18n }) => ({ icon: 'insert_photo', component: InterfaceImage, types: ['uuid'], + localTypes: ['file'], relationship: 'm2o', options: [], recommendedDisplays: ['image'], diff --git a/app/src/interfaces/many-to-many/index.ts b/app/src/interfaces/many-to-many/index.ts index 506a5912ce..62ff560397 100644 --- a/app/src/interfaces/many-to-many/index.ts +++ b/app/src/interfaces/many-to-many/index.ts @@ -10,6 +10,7 @@ export default defineInterface(({ i18n }) => ({ component: InterfaceManyToMany, relationship: 'm2m', types: ['alias'], + localTypes: ['m2m'], options: Options, recommendedDisplays: ['related-values'], })); diff --git a/app/src/interfaces/many-to-one/index.ts b/app/src/interfaces/many-to-one/index.ts index addb0eac52..abab1d4154 100644 --- a/app/src/interfaces/many-to-one/index.ts +++ b/app/src/interfaces/many-to-one/index.ts @@ -10,6 +10,7 @@ export default defineInterface(({ i18n }) => ({ component: InterfaceManyToOne, types: ['uuid', 'string', 'text', 'integer', 'bigInteger'], relationship: 'm2o', + localTypes: ['m2o'], options: Options, recommendedDisplays: ['related-values'], })); diff --git a/app/src/interfaces/one-to-many/index.ts b/app/src/interfaces/one-to-many/index.ts index 9bb215b1e9..27c9e175fc 100644 --- a/app/src/interfaces/one-to-many/index.ts +++ b/app/src/interfaces/one-to-many/index.ts @@ -9,6 +9,7 @@ export default defineInterface(({ i18n }) => ({ icon: 'arrow_right_alt', component: InterfaceOneToMany, types: ['alias'], + localTypes: ['o2m'], relationship: 'o2m', options: Options, recommendedDisplays: ['related-values'], diff --git a/app/src/interfaces/types.ts b/app/src/interfaces/types.ts index 05352bd95a..c9c2d51ee3 100644 --- a/app/src/interfaces/types.ts +++ b/app/src/interfaces/types.ts @@ -1,6 +1,6 @@ import VueI18n from 'vue-i18n'; import { Component } from 'vue'; -import { Field, types } from '@/types'; +import { Field, types, localTypes } from '@/types'; export type InterfaceConfig = { id: string; @@ -10,6 +10,7 @@ export type InterfaceConfig = { component: Component; options: DeepPartial[] | Component; types: typeof types[number][]; + localTypes?: readonly typeof localTypes[number][]; relationship?: null | 'm2o' | 'o2m' | 'm2m' | 'translations'; hideLabel?: boolean; hideLoader?: boolean; diff --git a/app/src/modules/settings/routes/data-model/field-detail/store.ts b/app/src/modules/settings/routes/data-model/field-detail/store.ts index 33e0a73a6a..49cc2e55a0 100644 --- a/app/src/modules/settings/routes/data-model/field-detail/store.ts +++ b/app/src/modules/settings/routes/data-model/field-detail/store.ts @@ -67,6 +67,7 @@ function initLocalStore(collection: string, field: string, type: typeof localTyp if (inter.system === true) return false; const matchesType = inter.types.includes(state.fieldData?.type || 'alias'); + const matchesLocalType = inter.localTypes?.includes(type); let matchesRelation = false; if (type === 'standard' || type === 'presentation') { @@ -81,7 +82,7 @@ function initLocalStore(collection: string, field: string, type: typeof localTyp matchesRelation = inter.relationship === type; } - return matchesType && matchesRelation; + return matchesType && matchesRelation && (matchesLocalType === undefined || matchesLocalType); }) .sort((a, b) => (a.name > b.name ? 1 : -1)); });