mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
@@ -47,6 +47,7 @@ const props = defineProps<{
|
||||
collection: string;
|
||||
primaryKey: string | number;
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const { activity, loading, refresh, count, userPreviews } = useActivity(props.collection, props.primaryKey);
|
||||
@@ -98,6 +99,7 @@ function useActivity(collection: string, primaryKey: string | number) {
|
||||
regex,
|
||||
(match) => `<mark>${userPreviews.value[match.substring(2)]}</mark>`
|
||||
);
|
||||
|
||||
return {
|
||||
...comment,
|
||||
display,
|
||||
|
||||
@@ -135,8 +135,10 @@ const fieldsStore = useFieldsStore();
|
||||
const relationsStore = useRelationsStore();
|
||||
|
||||
const { internalActive } = useActiveState();
|
||||
|
||||
const { junctionFieldInfo, relatedCollection, relatedCollectionInfo, setRelationEdits, relatedPrimaryKeyField } =
|
||||
useRelation();
|
||||
|
||||
const { internalEdits, loading, initialValues } = useItem();
|
||||
const { save, cancel } = useActions();
|
||||
|
||||
@@ -296,6 +298,7 @@ function useItem() {
|
||||
loading.value = true;
|
||||
|
||||
const baseEndpoint = getEndpoint(props.collection);
|
||||
|
||||
const endpoint = props.collection.startsWith('directus_')
|
||||
? `${baseEndpoint}/${props.primaryKey}`
|
||||
: `${baseEndpoint}/${encodeURIComponent(props.primaryKey)}`;
|
||||
@@ -325,6 +328,7 @@ function useItem() {
|
||||
loading.value = true;
|
||||
|
||||
const baseEndpoint = getEndpoint(collection);
|
||||
|
||||
const endpoint = collection.startsWith('directus_')
|
||||
? `${baseEndpoint}/${props.relatedPrimaryKey}`
|
||||
: `${baseEndpoint}/${encodeURIComponent(props.relatedPrimaryKey)}`;
|
||||
@@ -391,6 +395,7 @@ function useActions() {
|
||||
const fieldsToValidate = props.junctionField ? relatedCollectionFields.value : fieldsWithoutCircular.value;
|
||||
const defaultValues = getDefaultValuesFromFields(fieldsToValidate);
|
||||
const existingValues = props.junctionField ? initialValues?.value?.[props.junctionField] : initialValues?.value;
|
||||
|
||||
let errors = validateItem(
|
||||
merge({}, defaultValues.value, existingValues, editsToValidate),
|
||||
fieldsToValidate,
|
||||
|
||||
@@ -70,6 +70,7 @@ export default defineComponent({
|
||||
|
||||
const loading = ref(false);
|
||||
const folders = ref<FolderRaw[]>([]);
|
||||
|
||||
const tree = computed<Folder[]>(() => {
|
||||
return folders.value
|
||||
.filter((folder) => folder.parent === null)
|
||||
|
||||
@@ -406,6 +406,7 @@ export default defineComponent({
|
||||
});
|
||||
|
||||
const localCropping = ref(false);
|
||||
|
||||
const cropping = computed({
|
||||
get() {
|
||||
return localCropping.value;
|
||||
|
||||
@@ -76,6 +76,7 @@ const parts = computed(() =>
|
||||
|
||||
function handleArray(fieldKeyBefore: string, fieldKeyAfter: string) {
|
||||
const value = get(props.item, fieldKeyBefore);
|
||||
|
||||
const field =
|
||||
fieldsStore.getField(props.collection, fieldKeyBefore) ||
|
||||
props.fields?.find((field) => field.field === fieldKeyBefore);
|
||||
|
||||
@@ -47,6 +47,7 @@ export default defineComponent({
|
||||
},
|
||||
setup(props) {
|
||||
const { t } = useI18n();
|
||||
|
||||
const changesFiltered = computed(() => {
|
||||
return (props.changes as Change[]).filter((change: any) => {
|
||||
if (props.updated) return true;
|
||||
|
||||
@@ -73,6 +73,7 @@ export default defineComponent({
|
||||
if (isEqual(currentValue, previousValue)) {
|
||||
if (field?.meta?.special && field.meta.special.includes('conceal')) {
|
||||
updated = true;
|
||||
|
||||
changes = [
|
||||
{
|
||||
updated: true,
|
||||
|
||||
@@ -205,6 +205,7 @@ export default defineComponent({
|
||||
sort: 'name',
|
||||
},
|
||||
});
|
||||
|
||||
count.value = response.data.data.length;
|
||||
shares.value = response.data.data;
|
||||
} catch (error: any) {
|
||||
|
||||
@@ -55,6 +55,7 @@ export default defineComponent({
|
||||
value: props.title,
|
||||
group: 'sidebar-detail',
|
||||
});
|
||||
|
||||
const appStore = useAppStore();
|
||||
const { sidebarOpen } = toRefs(appStore);
|
||||
return { active, toggle, sidebarOpen };
|
||||
|
||||
@@ -89,6 +89,7 @@ export default defineComponent({
|
||||
fields: ['id', 'first_name', 'last_name', 'avatar.id', 'role.name', 'status', 'email'],
|
||||
},
|
||||
});
|
||||
|
||||
data.value = response.data.data;
|
||||
} catch (err: any) {
|
||||
error.value = err;
|
||||
|
||||
@@ -115,8 +115,10 @@ const { width: contentWidth } = useElementSize(contentEl);
|
||||
const { width: sidebarWidth } = useElementSize(sidebarEl);
|
||||
|
||||
const moduleNavEl = ref<HTMLElement>();
|
||||
|
||||
const { handleHover, onResizeHandlePointerDown, resetModuleNavWidth, onPointerMove, onPointerUp } =
|
||||
useModuleNavResize();
|
||||
|
||||
useEventListener(window, 'pointermove', onPointerMove);
|
||||
useEventListener(window, 'pointerup', onPointerUp);
|
||||
|
||||
@@ -224,6 +226,7 @@ function useModuleNavResize() {
|
||||
function onPointerUp() {
|
||||
if (dragging.value === true) {
|
||||
dragging.value = false;
|
||||
|
||||
if (rafId.value) {
|
||||
window.cancelAnimationFrame(rafId.value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user