diff --git a/packages/core/package.json b/packages/core/package.json index 0050a27b..9c389d07 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -156,8 +156,6 @@ "symbol-observable": "4.0.0", "unified": "10.1.2", "unist-util-visit": "4.1.2", - "uploadcare-widget": "3.21.0", - "uploadcare-widget-tab-effects": "1.6.0", "url": "0.11.0", "url-join": "5.0.0", "uuid": "9.0.0", diff --git a/packages/core/src/components/collections/CollectionRoute.tsx b/packages/core/src/components/collections/CollectionRoute.tsx index 1beb363a..d746990e 100644 --- a/packages/core/src/components/collections/CollectionRoute.tsx +++ b/packages/core/src/components/collections/CollectionRoute.tsx @@ -1,5 +1,5 @@ import React, { useMemo } from 'react'; -import { Navigate, useParams } from 'react-router-dom'; +import { Navigate, useParams, useSearchParams } from 'react-router-dom'; import { selectCollection, @@ -16,6 +16,8 @@ interface CollectionRouteProps { const CollectionRoute = ({ isSearchResults, isSingleSearchResult }: CollectionRouteProps) => { const { name, searchTerm } = useParams(); + const [searchParams] = useSearchParams(); + const noRedirect = searchParams.has('noredirect'); const collectionSelector = useMemo(() => selectCollection(name), [name]); const collection = useAppSelector(collectionSelector); @@ -27,7 +29,12 @@ const CollectionRoute = ({ isSearchResults, isSingleSearchResult }: CollectionRo return ; } - if (collection && 'files' in collection && collection.files?.length === 1) { + if (collection && 'files' in collection && collection.files?.length === 1 && !noRedirect) { + const href = window.location.href; + if (!href.includes('noredirect')) { + window.history.replaceState(null, document.title, `${href}?noredirect`); + console.log('REPLACE STATE', document.title, `${href}?noredirect`); + } return ; } diff --git a/packages/core/src/components/common/field/ErrorMessage.tsx b/packages/core/src/components/common/field/ErrorMessage.tsx index 846f2893..b0de317a 100644 --- a/packages/core/src/components/common/field/ErrorMessage.tsx +++ b/packages/core/src/components/common/field/ErrorMessage.tsx @@ -1,23 +1,31 @@ import React from 'react'; -import type { FC } from 'react'; +import classNames from '@staticcms/core/lib/util/classNames.util'; + import type { FieldError } from '@staticcms/core/interface'; +import type { FC } from 'react'; export interface ErrorMessageProps { errors: FieldError[]; + className?: string; } -const ErrorMessage: FC = ({ errors }) => { +const ErrorMessage: FC = ({ errors, className }) => { return errors.length ? (
{errors[0].message}
diff --git a/packages/core/src/components/common/pill/Pill.tsx b/packages/core/src/components/common/pill/Pill.tsx index f03a0a7f..0cc492d3 100644 --- a/packages/core/src/components/common/pill/Pill.tsx +++ b/packages/core/src/components/common/pill/Pill.tsx @@ -58,7 +58,6 @@ const Pill: FC = ({ ` text-xs font-medium - mr-2 px-3 py-1 rounded-lg diff --git a/packages/core/src/components/entry-editor/editor-control-pane/EditorControl.tsx b/packages/core/src/components/entry-editor/editor-control-pane/EditorControl.tsx index 0797d25a..5f2754e0 100644 --- a/packages/core/src/components/entry-editor/editor-control-pane/EditorControl.tsx +++ b/packages/core/src/components/entry-editor/editor-control-pane/EditorControl.tsx @@ -80,7 +80,7 @@ const EditorControl = ({ [field.name, fieldName, parentPath], ); - const [dirty, setDirty] = useState(!isEmpty(value)); + const [dirty, setDirty] = useState(!isEmpty(widget.getValidValue(value, field as UnknownField))); const fieldErrorsSelector = useMemo( () => selectFieldErrors(path, i18n, isMeta), @@ -114,10 +114,12 @@ const EditorControl = ({ const handleChangeDraftField = useCallback( (value: ValueOrNestedValue) => { - setDirty(true); + setDirty( + oldDirty => oldDirty || !isEmpty(widget.getValidValue(value, field as UnknownField)), + ); changeDraftField({ path, field, value, i18n, isMeta }); }, - [changeDraftField, field, i18n, isMeta, path], + [changeDraftField, field, i18n, isMeta, path, widget], ); const config = useMemo(() => configState.config, [configState.config]); diff --git a/packages/core/src/constants/configSchema.tsx b/packages/core/src/constants/configSchema.tsx index d4700c37..6abe6840 100644 --- a/packages/core/src/constants/configSchema.tsx +++ b/packages/core/src/constants/configSchema.tsx @@ -113,6 +113,9 @@ const viewFilters = { { type: 'string', }, + { + type: 'number', + }, ], }, }, @@ -149,52 +152,42 @@ function getConfigSchema() { type: 'object', properties: { name: { type: 'string', examples: ['test-repo'] }, + repo: { type: 'string' }, + branch: { type: 'string' }, + api_root: { type: 'string' }, + site_domain: { type: 'string' }, + base_url: { type: 'string' }, + auth_endpoint: { type: 'string' }, + app_id: { type: 'string' }, + auth_type: { + type: 'string', + examples: ['implicit', 'pkce'], + enum: ['implicit', 'public_pkcerepo'], + }, + proxy_url: { type: 'string' }, + large_media_url: { type: 'string' }, + login: { type: 'boolean' }, + identity_url: { type: 'string' }, + gateway_url: { type: 'string' }, auth_scope: { type: 'string', examples: ['repo', 'public_repo'], enum: ['repo', 'public_repo'], }, - }, - required: ['name'], - }, - local_backend: { - oneOf: [ - { type: 'boolean' }, - { + commit_messages: { type: 'object', properties: { - url: { type: 'string', examples: ['http://localhost:8081/api/v1'] }, - allowed_hosts: { - type: 'array', - items: { type: 'string' }, - }, + create: { type: 'string' }, + update: { type: 'string' }, + delete: { type: 'string' }, + uploadMedia: { type: 'string' }, + deleteMedia: { type: 'string' }, }, additionalProperties: false, }, - ], - }, - locale: { type: 'string', examples: ['en', 'fr', 'de'] }, - i18n: i18nRoot, - site_url: { type: 'string', examples: ['https://example.com'] }, - display_url: { type: 'string', examples: ['https://example.com'] }, - logo_url: { type: 'string', examples: ['https://example.com/images/logo.svg'] }, - media_folder: { type: 'string', examples: ['assets/uploads'] }, - public_folder: { type: 'string', examples: ['/uploads'] }, - media_folder_relative: { type: 'boolean' }, - media_library: { - type: 'object', - properties: { - name: { type: 'string', examples: ['uploadcare'] }, - config: { type: 'object' }, - }, - required: [], - }, - slug: { - type: 'object', - properties: { - encoding: { type: 'string', enum: ['unicode', 'ascii'] }, - clean_accents: { type: 'boolean' }, }, + required: ['name'], + additionalProperties: false, }, collections: { type: 'array', @@ -204,34 +197,8 @@ function getConfigSchema() { type: 'object', properties: { name: { type: 'string' }, - label: { type: 'string' }, - label_singular: { type: 'string' }, description: { type: 'string' }, - folder: { type: 'string' }, - files: { - type: 'array', - items: { - // ------- Each file: ------- - type: 'object', - properties: { - name: { type: 'string' }, - label: { type: 'string' }, - label_singular: { type: 'string' }, - description: { type: 'string' }, - file: { type: 'string' }, - editor: { - type: 'object', - properties: { - preview: { type: 'boolean' }, - }, - }, - fields: fieldsConfig(), - }, - required: ['name', 'label', 'file', 'fields'], - }, - uniqueItemProperties: ['name'], - }, - identifier_field: { type: 'string' }, + icon: { type: 'string' }, summary: { type: 'string' }, summary_fields: { type: 'array', @@ -239,28 +206,17 @@ function getConfigSchema() { type: 'string', }, }, - slug: { type: 'string' }, - path: { type: 'string' }, - create: { type: 'boolean' }, - publish: { type: 'boolean' }, - hide: { type: 'boolean' }, - editor: { + filter: { type: 'object', properties: { - preview: { type: 'boolean' }, + value: { type: 'string' }, + field: { type: 'string' }, }, + required: ['value', 'field'], + additionalProperties: false, }, - format: { type: 'string', enum: Object.keys(formatExtensions) }, - extension: { type: 'string' }, - frontmatter_delimiter: { - type: ['string', 'array'], - minItems: 2, - maxItems: 2, - items: { - type: 'string', - }, - }, - fields: fieldsConfig(), + label_singular: { type: 'string' }, + label: { type: 'string' }, sortable_fields: { type: 'object', properties: { @@ -275,6 +231,7 @@ function getConfigSchema() { }, }, required: ['field'], + additionalProperties: false, }, fields: { type: 'array', @@ -284,9 +241,47 @@ function getConfigSchema() { }, }, required: ['fields'], + additionalProperties: false, }, view_filters: viewFilters, view_groups: viewGroups, + i18n: i18nCollection, + hide: { type: 'boolean' }, + editor: { + type: 'object', + properties: { + preview: { type: 'boolean' }, + frame: { type: 'boolean' }, + }, + additionalProperties: false, + }, + identifier_field: { type: 'string' }, + path: { type: 'string' }, + extension: { type: 'string' }, + format: { type: 'string', enum: Object.keys(formatExtensions) }, + frontmatter_delimiter: { + type: ['string', 'array'], + minItems: 2, + maxItems: 2, + items: { + type: 'string', + }, + }, + slug: { type: 'string' }, + media_folder: { type: 'string' }, + public_folder: { type: 'string' }, + media_library: { + type: 'object', + properties: { + max_file_size: { type: 'number' }, + folder_support: { type: 'boolean' }, + }, + additionalProperties: false, + }, + folder: { type: 'string' }, + fields: fieldsConfig(), + create: { type: 'boolean' }, + delete: { type: 'boolean' }, nested: { type: 'object', properties: { @@ -299,11 +294,49 @@ function getConfigSchema() { index_file: { type: 'string' }, }, required: ['index_file'], + additionalProperties: false, }, }, required: ['depth'], + additionalProperties: false, + }, + files: { + type: 'array', + items: { + // ------- Each file: ------- + type: 'object', + properties: { + name: { type: 'string' }, + label: { type: 'string' }, + file: { type: 'string' }, + fields: fieldsConfig(), + label_singular: { type: 'string' }, + description: { type: 'string' }, + media_folder: { type: 'string' }, + public_folder: { type: 'string' }, + media_library: { + type: 'object', + properties: { + max_file_size: { type: 'number' }, + folder_support: { type: 'boolean' }, + }, + additionalProperties: false, + }, + i18n: i18nCollection, + editor: { + type: 'object', + properties: { + preview: { type: 'boolean' }, + frame: { type: 'boolean' }, + }, + additionalProperties: false, + }, + }, + required: ['name', 'label', 'file', 'fields'], + additionalProperties: false, + }, + uniqueItemProperties: ['name'], }, - i18n: i18nCollection, }, required: ['name', 'label'], oneOf: [{ required: ['files'] }, { required: ['folder', 'fields'] }], @@ -328,15 +361,62 @@ function getConfigSchema() { }, uniqueItemProperties: ['name'], }, + locale: { type: 'string', examples: ['en', 'fr', 'de'] }, + site_id: { type: 'string' }, + site_url: { type: 'string', examples: ['https://example.com'] }, + display_url: { type: 'string', examples: ['https://example.com'] }, + base_url: { type: 'string' }, + logo_url: { type: 'string', examples: ['https://example.com/images/logo.svg'] }, + media_folder: { type: 'string', examples: ['assets/uploads'] }, + public_folder: { type: 'string', examples: ['/uploads'] }, + media_folder_relative: { type: 'boolean' }, + media_library: { + type: 'object', + properties: { + max_file_size: { type: 'number' }, + folder_support: { type: 'boolean' }, + }, + additionalProperties: false, + }, + load_config_file: { type: 'boolean' }, + slug: { + type: 'object', + properties: { + encoding: { type: 'string', enum: ['unicode', 'ascii'] }, + clean_accents: { type: 'boolean' }, + sanitize_replacement: { type: 'string' }, + }, + additionalProperties: false, + }, + i18n: i18nRoot, + local_backend: { + oneOf: [ + { type: 'boolean' }, + { + type: 'object', + properties: { + url: { type: 'string', examples: ['http://localhost:8081/api/v1'] }, + allowed_hosts: { + type: 'array', + items: { type: 'string' }, + }, + }, + additionalProperties: false, + }, + ], + }, editor: { type: 'object', properties: { preview: { type: 'boolean' }, + frame: { type: 'boolean' }, }, + additionalProperties: false, }, + search: { type: 'string' }, }, - required: ['backend', 'collections'], - anyOf: [{ required: ['media_folder'] }, { required: ['media_library'] }], + required: ['backend', 'collections', 'media_folder'], + additionalProperties: false, }; } diff --git a/packages/core/src/interface.ts b/packages/core/src/interface.ts index a5d2f627..88cad25e 100644 --- a/packages/core/src/interface.ts +++ b/packages/core/src/interface.ts @@ -121,8 +121,9 @@ export interface FieldsErrors { [field: string]: FieldError[]; } -export type FieldGetValidValueMethod = ( +export type FieldGetValidValueMethod = ( value: T | undefined | null, + field: F, ) => T | undefined | null; export type FieldGetDefaultMethod = ( @@ -363,7 +364,7 @@ export interface Widget { control: ComponentType>; preview?: WidgetPreviewComponent; validator: FieldValidationMethod; - getValidValue: FieldGetValidValueMethod; + getValidValue: FieldGetValidValueMethod; getDefaultValue?: FieldGetDefaultMethod; schema?: PropertiesSchema; } diff --git a/packages/core/src/lib/hooks/useBreadcrumbs.ts b/packages/core/src/lib/hooks/useBreadcrumbs.ts index ae0636c3..7014ce3c 100644 --- a/packages/core/src/lib/hooks/useBreadcrumbs.ts +++ b/packages/core/src/lib/hooks/useBreadcrumbs.ts @@ -34,7 +34,7 @@ export default function useBreadcrumbs( const crumbs: Breadcrumb[] = [ { name: collection.label, - to: `/collections/${collection.name}`, + to: `/collections/${collection.name}?noredirect`, }, ]; diff --git a/packages/core/src/lib/util/validation.util.ts b/packages/core/src/lib/util/validation.util.ts index 7f53f9f2..34430eb8 100644 --- a/packages/core/src/lib/util/validation.util.ts +++ b/packages/core/src/lib/util/validation.util.ts @@ -83,7 +83,7 @@ export async function validate( widget: Widget, t: t, ): Promise { - const validValue = widget.getValidValue(value); + const validValue = widget.getValidValue(value, field); const errors: FieldError[] = []; const validations: FieldValidationMethod[] = [ validatePresence, diff --git a/packages/core/src/reducers/entries.ts b/packages/core/src/reducers/entries.ts index da7e2cd4..03c7feb7 100644 --- a/packages/core/src/reducers/entries.ts +++ b/packages/core/src/reducers/entries.ts @@ -8,6 +8,7 @@ import { ENTRIES_SUCCESS, ENTRY_DELETE_SUCCESS, ENTRY_FAILURE, + ENTRY_PERSIST_SUCCESS, ENTRY_REQUEST, ENTRY_SUCCESS, FILTER_ENTRIES_FAILURE, @@ -551,6 +552,19 @@ function entries( }; } + case ENTRY_PERSIST_SUCCESS: { + const payload = action.payload; + const { collectionName } = payload; + + const pages = { ...state.pages }; + delete pages[collectionName]; + + return { + ...state, + pages, + }; + } + default: return state; } diff --git a/packages/core/src/types/uploadcare.d.ts b/packages/core/src/types/uploadcare.d.ts deleted file mode 100644 index d2b5286d..00000000 --- a/packages/core/src/types/uploadcare.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -declare module 'uploadcare-widget-tab-effects'; - -declare module 'uploadcare-widget' { - interface UploadcareFileGroupInfo { - cdnUrl: string; - name: string; - isImage: boolean; - } - - const Uploadcare: { - loadFileGroup: (groupId: string | undefined) => { - done: (callback: (group: UploadcareFileGroupInfo) => void) => void; - }; - fileFrom: (uploadedOrUrl: 'uploaded' | 'url', url: string) => Promise; - registerTab: (tab: string, tabContent: unknown) => void; - openDialog: ( - files: - | UploadcareFileGroupInfo - | UploadcareFileGroupInfo[] - | Promise, - settings: Record, - ) => { - done: ( - callback: (values: { - promise: () => Promise; - files: () => Promise[]; - }) => void, - ) => void; - }; - }; - - export default Uploadcare; -} diff --git a/packages/core/src/widgets/code/CodeControl.tsx b/packages/core/src/widgets/code/CodeControl.tsx index afb0981c..134f90eb 100644 --- a/packages/core/src/widgets/code/CodeControl.tsx +++ b/packages/core/src/widgets/code/CodeControl.tsx @@ -279,7 +279,7 @@ const CodeControl: FC ) : null} - + ); diff --git a/packages/core/src/widgets/code/index.ts b/packages/core/src/widgets/code/index.ts index d3514392..85bb1408 100644 --- a/packages/core/src/widgets/code/index.ts +++ b/packages/core/src/widgets/code/index.ts @@ -11,6 +11,15 @@ const CodeWidget = (): WidgetParam { + 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, diff --git a/packages/core/src/widgets/code/schema.ts b/packages/core/src/widgets/code/schema.ts index e5575750..cb5e2a13 100644 --- a/packages/core/src/widgets/code/schema.ts +++ b/packages/core/src/widgets/code/schema.ts @@ -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' }, }, }; diff --git a/packages/core/src/widgets/colorstring/schema.ts b/packages/core/src/widgets/colorstring/schema.ts index c1d7002a..b461618a 100644 --- a/packages/core/src/widgets/colorstring/schema.ts +++ b/packages/core/src/widgets/colorstring/schema.ts @@ -1,5 +1,7 @@ export default { properties: { default: { type: 'string' }, + allow_input: { type: 'boolean' }, + enable_alpha: { type: 'boolean' }, }, }; diff --git a/packages/core/src/widgets/datetime/schema.ts b/packages/core/src/widgets/datetime/schema.ts index 8b92e769..ee41021f 100644 --- a/packages/core/src/widgets/datetime/schema.ts +++ b/packages/core/src/widgets/datetime/schema.ts @@ -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' }, }, }; diff --git a/packages/core/src/widgets/file/schema.ts b/packages/core/src/widgets/file/schema.ts index 433db5ba..83f35912 100644 --- a/packages/core/src/widgets/file/schema.ts +++ b/packages/core/src/widgets/file/schema.ts @@ -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, + }, }, }; diff --git a/packages/core/src/widgets/image/schema.ts b/packages/core/src/widgets/image/schema.ts index 433db5ba..83f35912 100644 --- a/packages/core/src/widgets/image/schema.ts +++ b/packages/core/src/widgets/image/schema.ts @@ -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, + }, }, }; diff --git a/packages/core/src/widgets/list/components/ListFieldWrapper.tsx b/packages/core/src/widgets/list/components/ListFieldWrapper.tsx index 4d4be6d6..4eb1a05a 100644 --- a/packages/core/src/widgets/list/components/ListFieldWrapper.tsx +++ b/packages/core/src/widgets/list/components/ListFieldWrapper.tsx @@ -142,7 +142,7 @@ const ListFieldWrapper: FC = ({ {hint} ) : null} - + ); diff --git a/packages/core/src/widgets/list/schema.ts b/packages/core/src/widgets/list/schema.ts index 12c135c0..4743f469 100644 --- a/packages/core/src/widgets/list/schema.ts +++ b/packages/core/src/widgets/list/schema.ts @@ -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' }, }, }; diff --git a/packages/core/src/widgets/markdown/schema.ts b/packages/core/src/widgets/markdown/schema.ts index c1d7002a..933c6598 100644 --- a/packages/core/src/widgets/markdown/schema.ts +++ b/packages/core/src/widgets/markdown/schema.ts @@ -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, + }, }, }; diff --git a/packages/core/src/widgets/object/ObjectFieldWrapper.tsx b/packages/core/src/widgets/object/ObjectFieldWrapper.tsx index a29e7194..8fc3ff1e 100644 --- a/packages/core/src/widgets/object/ObjectFieldWrapper.tsx +++ b/packages/core/src/widgets/object/ObjectFieldWrapper.tsx @@ -134,7 +134,7 @@ const ObjectFieldWrapper: FC = ({ {hint} ) : null} - + ); }; diff --git a/packages/core/src/widgets/object/schema.ts b/packages/core/src/widgets/object/schema.ts index a8569789..f735da01 100644 --- a/packages/core/src/widgets/object/schema.ts +++ b/packages/core/src/widgets/object/schema.ts @@ -1,6 +1,9 @@ export default { properties: { + default: { type: 'object' }, collapsed: { type: 'boolean' }, + summary: { type: 'string' }, i18n: { type: 'boolean' }, + fields: { type: 'object' }, }, }; diff --git a/packages/core/src/widgets/relation/RelationControl.tsx b/packages/core/src/widgets/relation/RelationControl.tsx index bff69095..35f76f36 100644 --- a/packages/core/src/widgets/relation/RelationControl.tsx +++ b/packages/core/src/widgets/relation/RelationControl.tsx @@ -322,7 +322,7 @@ const RelationControl: FC> label={ <> {Array.isArray(selectedValue) && selectedValue.length > 0 ? ( -
+
{selectedValue.map(selectValue => { const option = uniqueOptionsByValue[selectValue]; return ( diff --git a/packages/core/src/widgets/relation/schema.ts b/packages/core/src/widgets/relation/schema.ts index dc8f3c70..eaf5d84a 100644 --- a/packages/core/src/widgets/relation/schema.ts +++ b/packages/core/src/widgets/relation/schema.ts @@ -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: [ { diff --git a/packages/core/src/widgets/select/SelectControl.tsx b/packages/core/src/widgets/select/SelectControl.tsx index 38d2c148..d5d357f5 100644 --- a/packages/core/src/widgets/select/SelectControl.tsx +++ b/packages/core/src/widgets/select/SelectControl.tsx @@ -126,7 +126,7 @@ const SelectControl: FC +
{stringValue.map(selectValue => { const label = optionsByValue[selectValue]?.label ?? selectValue; return ( diff --git a/packages/core/src/widgets/select/schema.ts b/packages/core/src/widgets/select/schema.ts index 9f012fca..e3bc1207 100644 --- a/packages/core/src/widgets/select/schema.ts +++ b/packages/core/src/widgets/select/schema.ts @@ -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'], }; diff --git a/yarn.lock b/yarn.lock index ff46e8f1..f189cca1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8470,7 +8470,7 @@ escape-goat@^3.0.0: resolved "https://registry.yarnpkg.com/escape-goat/-/escape-goat-3.0.0.tgz#e8b5fb658553fe8a3c4959c316c6ebb8c842b19c" integrity sha512-w3PwNZJwRxlp47QGzhuEBldEqVHHhh8/tIPcl6ecf2Bou99cdAt0knihBV0Ecc7CGxYduXVBDheH1K2oADRlvw== -escape-html@1.0.3, escape-html@^1.0.3, escape-html@~1.0.3: +escape-html@1.0.3, escape-html@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== @@ -11905,11 +11905,6 @@ jotai@^1.7.2: resolved "https://registry.yarnpkg.com/jotai/-/jotai-1.13.1.tgz#20cc46454cbb39096b12fddfa635b873b3668236" integrity sha512-RUmH1S4vLsG3V6fbGlKzGJnLrDcC/HNb5gH2AeA9DzuJknoVxSGvvg8OBB7lke+gDc4oXmdVsaKn/xDUhWZ0vw== -jquery@^3.6.0: - version "3.6.4" - resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.6.4.tgz#ba065c188142100be4833699852bf7c24dc0252f" - integrity sha512-v28EW9DWDFpzcD9O5iyJXg3R3+q+mET5JhnjJzQUZMHOv67bpSIHq81GEYpPNZHG+XXHsfSme3nxp/hndKEcsQ== - js-base64@3.7.5: version "3.7.5" resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-3.7.5.tgz#21e24cf6b886f76d6f5f165bfcd69cc55b9e3fca" @@ -18605,19 +18600,6 @@ update-browserslist-db@^1.0.10: escalade "^3.1.1" picocolors "^1.0.0" -uploadcare-widget-tab-effects@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/uploadcare-widget-tab-effects/-/uploadcare-widget-tab-effects-1.6.0.tgz#6de4664b0b2fa47100b5a3e0afc1d41b35b8f429" - integrity sha512-RoWxeZnk41qm8Mo19R8Zvshsuqetc4y+gFtxA89x+noLCSFItuviGZJBf7rcX3ocwn+aFNKbXp44dlaVDoYRIA== - -uploadcare-widget@3.21.0: - version "3.21.0" - resolved "https://registry.yarnpkg.com/uploadcare-widget/-/uploadcare-widget-3.21.0.tgz#db67e7f97d257c3ab8da65328121502f8ab6b1f8" - integrity sha512-9C/WLwK3Anx+76rDzg/pe1vBv41j4HapgxfbyVLS+3oolB3bd9NvURAkvfyEif8QUnt7MwK2Ubw3f7UP/a3v9w== - dependencies: - escape-html "^1.0.3" - jquery "^3.6.0" - uri-js@^4.2.2: version "4.4.1" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"