mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Run prettier across app and api
This commit is contained in:
@@ -40,9 +40,7 @@ export default function (expandedParentClass = '', xAxis = false) {
|
||||
void el.offsetHeight; // force reflow
|
||||
|
||||
el.style.transition =
|
||||
initialStyle.transition !== ''
|
||||
? initialStyle.transition
|
||||
: `${sizeProperty} var(--medium) var(--transition)`;
|
||||
initialStyle.transition !== '' ? initialStyle.transition : `${sizeProperty} var(--medium) var(--transition)`;
|
||||
|
||||
if (expandedParentClass && el._parent) {
|
||||
el._parent.classList.add(expandedParentClass);
|
||||
|
||||
@@ -14,4 +14,4 @@ export type ValidationError = {
|
||||
valid?: number | string | (number | string)[];
|
||||
invalid?: number | string | (number | string)[];
|
||||
substring?: string;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -149,15 +149,15 @@ export function useGroupableParent(
|
||||
// Register a child within the context of this group
|
||||
function register(item: GroupableInstance) {
|
||||
items.value = [...items.value, item];
|
||||
const value = getValueForItem(item)
|
||||
const value = getValueForItem(item);
|
||||
|
||||
// If you're required to select a value, make sure a value is selected on first render
|
||||
if (selection.value.length === 0 && options?.mandatory?.value === true && items.value.length === 1) {
|
||||
selection.value = [value];
|
||||
}
|
||||
|
||||
if(item.active.value && selection.value.includes(value) === false) {
|
||||
toggle(item)
|
||||
if (item.active.value && selection.value.includes(value) === false) {
|
||||
toggle(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,7 @@ export function useCustomSelection(currentValue: Ref<string>, items: Ref<any[]>,
|
||||
// Check if set value is one of the existing keys
|
||||
const values = items.value.map((item) => item.value);
|
||||
return (
|
||||
currentValue.value !== null &&
|
||||
currentValue.value.length > 0 &&
|
||||
values.includes(currentValue.value) === false
|
||||
currentValue.value !== null && currentValue.value.length > 0 && values.includes(currentValue.value) === false
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -17,8 +17,7 @@ export default function useFieldTree(collection: Ref<string>, inject?: { fields:
|
||||
const fieldsInLevel = cloneDeep(fieldsStore.getFieldsForCollection(collection))
|
||||
.filter((field: Field) => {
|
||||
const shown =
|
||||
field.meta?.special?.includes('alias') !== true &&
|
||||
field.meta?.special?.includes('no-data') !== true;
|
||||
field.meta?.special?.includes('alias') !== true && field.meta?.special?.includes('no-data') !== true;
|
||||
return shown;
|
||||
})
|
||||
.map((field: Field) => ({
|
||||
|
||||
@@ -17,11 +17,7 @@ export async function registerDisplays() {
|
||||
try {
|
||||
const customResponse = await api.get('/extensions/displays');
|
||||
|
||||
if (
|
||||
customResponse.data.data &&
|
||||
Array.isArray(customResponse.data.data) &&
|
||||
customResponse.data.data.length > 0
|
||||
) {
|
||||
if (customResponse.data.data && Array.isArray(customResponse.data.data) && customResponse.data.data.length > 0) {
|
||||
for (const customKey of customResponse.data.data) {
|
||||
try {
|
||||
const module = await import(/* webpackIgnore: true */ `/extensions/displays/${customKey}/index.js`);
|
||||
|
||||
@@ -3,4 +3,6 @@ import mitt from 'mitt';
|
||||
const emitter = mitt();
|
||||
|
||||
export default emitter;
|
||||
export enum Events { upload = 'upload' }
|
||||
export enum Events {
|
||||
upload = 'upload',
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ export default defineInterface(({ i18n }) => ({
|
||||
type: 'string',
|
||||
meta: {
|
||||
width: 'full',
|
||||
interface: 'text-input'
|
||||
interface: 'text-input',
|
||||
},
|
||||
schema: {
|
||||
default_value: null,
|
||||
|
||||
@@ -37,8 +37,7 @@ export default function useActions(
|
||||
if (value.value === null || junctionField === null) return [];
|
||||
|
||||
return value.value.filter(
|
||||
(item) =>
|
||||
typeof get(item, junctionField) === 'object' && has(item, [junctionField, relationPkField]) === false
|
||||
(item) => typeof get(item, junctionField) === 'object' && has(item, [junctionField, relationPkField]) === false
|
||||
) as Record<string, any>[];
|
||||
}
|
||||
|
||||
|
||||
@@ -54,12 +54,7 @@ export default function usePreview(
|
||||
let responseData: Record<string, any>[] = [];
|
||||
|
||||
if (relatedPrimaryKeys.length > 0) {
|
||||
responseData = await request(
|
||||
relationCollection,
|
||||
filteredFields,
|
||||
relationPkField,
|
||||
relatedPrimaryKeys
|
||||
);
|
||||
responseData = await request(relationCollection, filteredFields, relationPkField, relatedPrimaryKeys);
|
||||
}
|
||||
|
||||
// Insert the related items into the junction items
|
||||
@@ -80,9 +75,7 @@ export default function usePreview(
|
||||
// Replace existing items with it's updated counterparts
|
||||
responseData = responseData
|
||||
.map((item) => {
|
||||
const updatedItem = updatedItems.find(
|
||||
(updated) => updated[junctionPkField] === item[junctionPkField]
|
||||
);
|
||||
const updatedItem = updatedItems.find((updated) => updated[junctionPkField] === item[junctionPkField]);
|
||||
if (updatedItem !== undefined) return updatedItem;
|
||||
return item;
|
||||
})
|
||||
|
||||
@@ -54,8 +54,8 @@ export default defineInterface(({ i18n }) => ({
|
||||
interface: 'icon',
|
||||
},
|
||||
schema: {
|
||||
default_value: 'radio_button_checked'
|
||||
}
|
||||
default_value: 'radio_button_checked',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'iconOff',
|
||||
@@ -66,8 +66,8 @@ export default defineInterface(({ i18n }) => ({
|
||||
interface: 'icon',
|
||||
},
|
||||
schema: {
|
||||
default_value: 'radio_button_unchecked'
|
||||
}
|
||||
default_value: 'radio_button_unchecked',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'color',
|
||||
|
||||
@@ -17,16 +17,10 @@ export async function registerInterfaces() {
|
||||
try {
|
||||
const customResponse = await api.get('/extensions/interfaces');
|
||||
|
||||
if (
|
||||
customResponse.data.data &&
|
||||
Array.isArray(customResponse.data.data) &&
|
||||
customResponse.data.data.length > 0
|
||||
) {
|
||||
if (customResponse.data.data && Array.isArray(customResponse.data.data) && customResponse.data.data.length > 0) {
|
||||
for (const customKey of customResponse.data.data) {
|
||||
try {
|
||||
const module = await import(
|
||||
/* webpackIgnore: true */ `/extensions/interfaces/${customKey}/index.js`
|
||||
);
|
||||
const module = await import(/* webpackIgnore: true */ `/extensions/interfaces/${customKey}/index.js`);
|
||||
modules.push(module.default);
|
||||
} catch (err) {
|
||||
console.warn(`Couldn't load custom interface "${customKey}"`);
|
||||
|
||||
@@ -16,11 +16,7 @@ export async function registerLayouts() {
|
||||
try {
|
||||
const customResponse = await api.get('/extensions/layouts');
|
||||
|
||||
if (
|
||||
customResponse.data.data &&
|
||||
Array.isArray(customResponse.data.data) &&
|
||||
customResponse.data.data.length > 0
|
||||
) {
|
||||
if (customResponse.data.data && Array.isArray(customResponse.data.data) && customResponse.data.data.length > 0) {
|
||||
for (const customKey of customResponse.data.data) {
|
||||
try {
|
||||
const module = await import(/* webpackIgnore: true */ `/extensions/layouts/${customKey}/index.js`);
|
||||
|
||||
@@ -62,9 +62,7 @@ export default function useFolders() {
|
||||
}
|
||||
|
||||
export function nestFolders(rawFolders: FolderRaw[]) {
|
||||
return rawFolders
|
||||
.map((rawFolder) => nestChildren(rawFolder, rawFolders))
|
||||
.filter((folder) => folder.parent === null);
|
||||
return rawFolders.map((rawFolder) => nestChildren(rawFolder, rawFolders)).filter((folder) => folder.parent === null);
|
||||
}
|
||||
|
||||
export function nestChildren(rawFolder: FolderRaw, rawFolders: FolderRaw[]) {
|
||||
|
||||
@@ -19,11 +19,7 @@ export async function loadModules() {
|
||||
try {
|
||||
const customResponse = await api.get('/extensions/modules');
|
||||
|
||||
if (
|
||||
customResponse.data.data &&
|
||||
Array.isArray(customResponse.data.data) &&
|
||||
customResponse.data.data.length > 0
|
||||
) {
|
||||
if (customResponse.data.data && Array.isArray(customResponse.data.data) && customResponse.data.data.length > 0) {
|
||||
for (const customKey of customResponse.data.data) {
|
||||
try {
|
||||
const module = await import(/* webpackIgnore: true */ `/extensions/modules/${customKey}/index.js`);
|
||||
|
||||
@@ -28,7 +28,7 @@ export default function useNavigation() {
|
||||
const rolesResponse = await api.get(`/roles`, {
|
||||
params: {
|
||||
sort: 'name',
|
||||
}
|
||||
},
|
||||
});
|
||||
roles.value = rolesResponse.data.data;
|
||||
loading.value = false;
|
||||
|
||||
@@ -184,9 +184,7 @@ export const useFieldsStore = createStore({
|
||||
if (currentUpdate === updateID) {
|
||||
this.state.fields = this.state.fields.map((field) => {
|
||||
if (field.collection === collectionKey) {
|
||||
const newDataForField = response.data.data.find(
|
||||
(update: Field) => update.field === field.field
|
||||
);
|
||||
const newDataForField = response.data.data.find((update: Field) => update.field === field.field);
|
||||
if (newDataForField) return this.parseField(newDataForField);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,5 +3,5 @@ export type APIError = {
|
||||
extensions: {
|
||||
code: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -33,20 +33,7 @@ export default function getAvailableOperatorsForType(type: string) {
|
||||
case 'sort':
|
||||
return {
|
||||
type: 'number',
|
||||
operators: [
|
||||
'eq',
|
||||
'neq',
|
||||
'lt',
|
||||
'lte',
|
||||
'gt',
|
||||
'gte',
|
||||
'between',
|
||||
'nbetween',
|
||||
'empty',
|
||||
'nempty',
|
||||
'in',
|
||||
'nin',
|
||||
],
|
||||
operators: ['eq', 'neq', 'lt', 'lte', 'gt', 'gte', 'between', 'nbetween', 'empty', 'nempty', 'in', 'nin'],
|
||||
};
|
||||
// Datetime
|
||||
case 'datetime':
|
||||
@@ -56,20 +43,7 @@ export default function getAvailableOperatorsForType(type: string) {
|
||||
case 'datetime_updated':
|
||||
return {
|
||||
type: 'datetime',
|
||||
operators: [
|
||||
'eq',
|
||||
'neq',
|
||||
'lt',
|
||||
'lte',
|
||||
'gt',
|
||||
'gte',
|
||||
'between',
|
||||
'nbetween',
|
||||
'empty',
|
||||
'nempty',
|
||||
'in',
|
||||
'nin',
|
||||
],
|
||||
operators: ['eq', 'neq', 'lt', 'lte', 'gt', 'gte', 'between', 'nbetween', 'empty', 'nempty', 'in', 'nin'],
|
||||
};
|
||||
default:
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user