mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Interface many to one (#524)
* Start on m2o * Render preview in m2o * Add icons * Style inline icons * Add editing modal * Disable any linter * Add add-new button * Pass existing selection on to layout * Update v-table to allow for keys-only-selection * Fix batch on tabular
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
</template>
|
||||
|
||||
<template #drawer>
|
||||
<layout-drawer-detail v-model="viewType" />
|
||||
<layout-drawer-detail @input="viewType = $event" :value="viewType || 'tabular'" />
|
||||
<portal-target name="drawer" />
|
||||
</template>
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
v-else
|
||||
class="layout"
|
||||
ref="layout"
|
||||
:is="`layout-${viewType}`"
|
||||
:is="`layout-${viewType || 'tabular'}`"
|
||||
:collection="collection"
|
||||
:selection.sync="selection"
|
||||
:view-options.sync="viewOptions"
|
||||
@@ -140,7 +140,6 @@ const redirectIfNeeded: NavigationGuard = async (to, from, next) => {
|
||||
};
|
||||
|
||||
type Item = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[field: string]: any;
|
||||
};
|
||||
|
||||
@@ -190,10 +189,6 @@ export default defineComponent({
|
||||
|
||||
const { addBookmarkActive, creatingBookmark, createBookmark } = useBookmarks();
|
||||
|
||||
if (viewType.value === null) {
|
||||
viewType.value = 'tabular';
|
||||
}
|
||||
|
||||
return {
|
||||
addNewLink,
|
||||
batchDelete,
|
||||
@@ -267,10 +262,7 @@ export default defineComponent({
|
||||
|
||||
const batchLink = computed<string>(() => {
|
||||
const currentProjectKey = projectsStore.state.currentProjectKey;
|
||||
const batchPrimaryKeys = selection.value
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
.map((item) => item[primaryKeyField.value!.field])
|
||||
.join();
|
||||
const batchPrimaryKeys = selection.value.join();
|
||||
return `/${currentProjectKey}/collections/${props.collection}/${batchPrimaryKeys}`;
|
||||
});
|
||||
|
||||
|
||||
@@ -163,7 +163,6 @@ import useItem from '@/composables/use-item';
|
||||
import SaveOptions from '@/views/private/components/save-options';
|
||||
|
||||
type Values = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[field: string]: any;
|
||||
};
|
||||
|
||||
@@ -250,7 +249,6 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
async function saveAndStay() {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const savedItem: Record<string, any> = await save();
|
||||
|
||||
if (props.primaryKey === '+') {
|
||||
|
||||
Reference in New Issue
Block a user