fix: clean up dependencies and config schema (#704)

This commit is contained in:
Daniel Lautzenheiser
2023-04-17 10:35:35 -04:00
committed by GitHub
parent 778e6bac75
commit ecb1218646
28 changed files with 304 additions and 179 deletions

View File

@ -279,7 +279,7 @@ const CodeControl: FC<WidgetControlProps<string | { [key: string]: string }, Cod
{field.hint}
</Hint>
) : null}
<ErrorMessage errors={errors} />
<ErrorMessage errors={errors} className="pt-2 pb-3" />
</div>
</div>
);

View File

@ -11,6 +11,15 @@ const CodeWidget = (): WidgetParam<string | { [key: string]: string }, CodeField
previewComponent,
options: {
schema,
getValidValue: (value, field) => {
if (!value || typeof value === 'string') {
return value;
}
const codeKey = field.keys ? field.keys.code : 'code';
return value[codeKey];
},
getDefaultValue: (
defaultValue: string | { [key: string]: string } | null | undefined,
field: CodeField,

View File

@ -1,14 +1,15 @@
export default {
properties: {
default: {
oneOf: [{ type: 'string' }, { type: 'object' }],
},
default_language: { type: 'string' },
allow_language_selection: { type: 'boolean' },
output_code_only: { type: 'boolean' },
keys: {
type: 'object',
properties: { code: { type: 'string' }, lang: { type: 'string' } },
},
default: {
oneOf: [{ type: 'string' }, { type: 'object' }],
},
output_code_only: { type: 'boolean' },
code_mirror_config: { type: 'object' },
},
};

View File

@ -1,5 +1,7 @@
export default {
properties: {
default: { type: 'string' },
allow_input: { type: 'boolean' },
enable_alpha: { type: 'boolean' },
},
};

View File

@ -1,9 +1,9 @@
export default {
properties: {
default: { type: 'string' },
format: { type: 'string' },
date_format: { oneOf: [{ type: 'string' }, { type: 'boolean' }] },
time_format: { oneOf: [{ type: 'string' }, { type: 'boolean' }] },
picker_utc: { type: 'boolean' },
default: { type: 'string' },
},
};

View File

@ -12,5 +12,17 @@ export default {
},
],
},
media_folder: { type: 'string' },
public_folder: { type: 'string' },
choose_url: { type: 'boolean' },
multiple: { type: 'boolean' },
media_library: {
type: 'object',
properties: {
max_file_size: { type: 'number' },
folder_support: { type: 'boolean' },
},
additionalProperties: false,
},
},
};

View File

@ -12,5 +12,17 @@ export default {
},
],
},
media_folder: { type: 'string' },
public_folder: { type: 'string' },
choose_url: { type: 'boolean' },
multiple: { type: 'boolean' },
media_library: {
type: 'object',
properties: {
max_file_size: { type: 'number' },
folder_support: { type: 'boolean' },
},
additionalProperties: false,
},
},
};

View File

@ -142,7 +142,7 @@ const ListFieldWrapper: FC<ListFieldWrapperProps> = ({
{hint}
</Hint>
) : null}
<ErrorMessage errors={errors} />
<ErrorMessage errors={errors} className="pb-3" />
</div>
</div>
);

View File

@ -1,11 +1,27 @@
export default {
properties: {
default: {
oneOf: [
{ type: 'boolean' },
{ type: 'string' },
{ type: 'number' },
{
type: 'array',
minItems: 1,
items: { oneOf: [{ type: 'boolean' }, { type: 'string' }, { type: 'number' }] },
},
],
},
allow_add: { type: 'boolean' },
collapsed: { type: 'boolean' },
summary: { type: 'string' },
label_singular: { type: 'string' },
i18n: { type: 'boolean' },
min: { type: 'number' },
fields: { type: 'object' },
max: { type: 'number' },
min: { type: 'number' },
i18n: { type: 'boolean' },
add_to_top: { type: 'boolean' },
types: { type: 'object' },
type_key: { type: 'string' },
},
};

View File

@ -1,5 +1,17 @@
export default {
properties: {
default: { type: 'string' },
media_folder: { type: 'string' },
public_folder: { type: 'string' },
choose_url: { type: 'boolean' },
multiple: { type: 'boolean' },
media_library: {
type: 'object',
properties: {
max_file_size: { type: 'number' },
folder_support: { type: 'boolean' },
},
additionalProperties: false,
},
},
};

View File

@ -134,7 +134,7 @@ const ObjectFieldWrapper: FC<ObjectFieldWrapperProps> = ({
{hint}
</Hint>
) : null}
<ErrorMessage errors={errors} />
<ErrorMessage errors={errors} className="pl-4 pt-2 pb-3" />
</div>
);
};

View File

@ -1,6 +1,9 @@
export default {
properties: {
default: { type: 'object' },
collapsed: { type: 'boolean' },
summary: { type: 'string' },
i18n: { type: 'boolean' },
fields: { type: 'object' },
},
};

View File

@ -322,7 +322,7 @@ const RelationControl: FC<WidgetControlProps<string | string[], RelationField>>
label={
<>
{Array.isArray(selectedValue) && selectedValue.length > 0 ? (
<div className="flex flex-wrap gap-0.5 w-full pr-4 p-2">
<div className="flex flex-wrap gap-2 w-full p-2 pr-0 max-w-fit">
{selectedValue.map(selectValue => {
const option = uniqueOptionsByValue[selectValue];
return (

View File

@ -1,14 +1,5 @@
export default {
properties: {
collection: { type: 'string' },
value_field: { type: 'string' },
search_fields: { type: 'array', minItems: 1, items: { type: 'string' } },
file: { type: 'string' },
multiple: { type: 'boolean' },
min: { type: 'integer' },
max: { type: 'integer' },
display_fields: { type: 'array', minItems: 1, items: { type: 'string' } },
options_length: { type: 'integer' },
default: {
oneOf: [
{ type: 'string' },
@ -20,6 +11,15 @@ export default {
},
],
},
collection: { type: 'string' },
value_field: { type: 'string' },
search_fields: { type: 'array', minItems: 1, items: { type: 'string' } },
file: { type: 'string' },
display_fields: { type: 'array', minItems: 1, items: { type: 'string' } },
multiple: { type: 'boolean' },
min: { type: 'integer' },
max: { type: 'integer' },
options_length: { type: 'integer' },
},
oneOf: [
{

View File

@ -126,7 +126,7 @@ const SelectControl: FC<WidgetControlProps<string | number | (string | number)[]
<Select
label={
Array.isArray(stringValue) ? (
<div className="flex wrap gap-0.5">
<div className="flex wrap gap-2 max-w-fit">
{stringValue.map(selectValue => {
const label = optionsByValue[selectValue]?.label ?? selectValue;
return (

View File

@ -1,8 +1,5 @@
export default {
properties: {
multiple: { type: 'boolean' },
min: { type: 'integer' },
max: { type: 'integer' },
default: {
oneOf: [
{ type: 'string' },
@ -32,6 +29,9 @@ export default {
],
},
},
multiple: { type: 'boolean' },
min: { type: 'integer' },
max: { type: 'integer' },
},
required: ['options'],
};