@strapi/content-manager 5.59.0 → 5.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/admin/history/components/VersionInputRenderer.js +2 -1
  2. package/dist/admin/history/components/VersionInputRenderer.js.map +1 -1
  3. package/dist/admin/history/components/VersionInputRenderer.mjs +2 -1
  4. package/dist/admin/history/components/VersionInputRenderer.mjs.map +1 -1
  5. package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.js +1 -0
  6. package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.js.map +1 -1
  7. package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.mjs +1 -0
  8. package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.mjs.map +1 -1
  9. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.js +1 -0
  10. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.js.map +1 -1
  11. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.mjs +1 -0
  12. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.mjs.map +1 -1
  13. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js +2 -0
  14. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js.map +1 -1
  15. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs +2 -0
  16. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs.map +1 -1
  17. package/dist/admin/pages/EditView/components/FormLayout.js +1 -0
  18. package/dist/admin/pages/EditView/components/FormLayout.js.map +1 -1
  19. package/dist/admin/pages/EditView/components/FormLayout.mjs +1 -0
  20. package/dist/admin/pages/EditView/components/FormLayout.mjs.map +1 -1
  21. package/dist/admin/pages/EditView/components/InputRenderer.js +3 -1
  22. package/dist/admin/pages/EditView/components/InputRenderer.js.map +1 -1
  23. package/dist/admin/pages/EditView/components/InputRenderer.mjs +3 -1
  24. package/dist/admin/pages/EditView/components/InputRenderer.mjs.map +1 -1
  25. package/dist/admin/preview/components/PreviewSidePanel.js +2 -1
  26. package/dist/admin/preview/components/PreviewSidePanel.js.map +1 -1
  27. package/dist/admin/preview/components/PreviewSidePanel.mjs +2 -1
  28. package/dist/admin/preview/components/PreviewSidePanel.mjs.map +1 -1
  29. package/dist/admin/preview/utils/getPreviewUrlStatus.js +17 -0
  30. package/dist/admin/preview/utils/getPreviewUrlStatus.js.map +1 -0
  31. package/dist/admin/preview/utils/getPreviewUrlStatus.mjs +15 -0
  32. package/dist/admin/preview/utils/getPreviewUrlStatus.mjs.map +1 -0
  33. package/dist/admin/src/history/components/VersionInputRenderer.d.ts +3 -1
  34. package/dist/admin/src/pages/EditView/components/InputRenderer.d.ts +2 -0
  35. package/dist/admin/src/preview/utils/getPreviewUrlStatus.d.ts +6 -0
  36. package/dist/server/controllers/relations.js +48 -16
  37. package/dist/server/controllers/relations.js.map +1 -1
  38. package/dist/server/controllers/relations.mjs +49 -17
  39. package/dist/server/controllers/relations.mjs.map +1 -1
  40. package/dist/server/history/services/history.js +1 -1
  41. package/dist/server/history/services/history.js.map +1 -1
  42. package/dist/server/history/services/history.mjs +1 -1
  43. package/dist/server/history/services/history.mjs.map +1 -1
  44. package/dist/server/mcp/schemas/filters-schema.js +10 -2
  45. package/dist/server/mcp/schemas/filters-schema.js.map +1 -1
  46. package/dist/server/mcp/schemas/filters-schema.mjs +10 -2
  47. package/dist/server/mcp/schemas/filters-schema.mjs.map +1 -1
  48. package/dist/server/preview/controllers/validation/preview.js +1 -1
  49. package/dist/server/preview/controllers/validation/preview.js.map +1 -1
  50. package/dist/server/preview/controllers/validation/preview.mjs +2 -2
  51. package/dist/server/preview/controllers/validation/preview.mjs.map +1 -1
  52. package/dist/server/services/document-metadata.js +1 -1
  53. package/dist/server/services/document-metadata.js.map +1 -1
  54. package/dist/server/services/document-metadata.mjs +1 -1
  55. package/dist/server/services/document-metadata.mjs.map +1 -1
  56. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  57. package/dist/server/src/mcp/schemas/filters-schema.d.ts.map +1 -1
  58. package/package.json +7 -7
@@ -303,7 +303,8 @@ const CustomMediaInput = (props)=>{
303
303
  * @description An abstraction around the regular form input renderer designed specifically
304
304
  * to be used on the History page in the content-manager. It understands how to render specific
305
305
  * inputs within the context of a history version (i.e. relations, media, ignored RBAC, etc...)
306
- */ const VersionInputRenderer = ({ visible, hint: providedHint, shouldIgnoreRBAC = false, labelAction, ...props })=>{
306
+ */ const VersionInputRenderer = ({ visible, hint: providedHint, shouldIgnoreRBAC = false, labelAction, // Not spread with the rest: design-system inputs have a `size` prop of their own.
307
+ size: _size, ...props })=>{
307
308
  const customLabelAction = getLabelAction(labelAction);
308
309
  const { formatMessage } = reactIntl.useIntl();
309
310
  const version = History.useHistoryContext('VersionContent', (state)=>state.selectedVersion);
@@ -1 +1 @@
1
- {"version":3,"file":"VersionInputRenderer.js","sources":["../../../../admin/src/history/components/VersionInputRenderer.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n useStrapiApp,\n useForm,\n InputRenderer as FormInputRenderer,\n useField,\n Form,\n} from '@strapi/admin/strapi-admin';\nimport { Alert, Box, Field, Flex, Link, Tooltip, Typography } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport { NavLink } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { COLLECTION_TYPES } from '../../constants/collections';\nimport { useDocumentRBAC } from '../../features/DocumentRBAC';\nimport { useDoc } from '../../hooks/useDocument';\nimport { useDocLayout } from '../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../hooks/useLazyComponents';\nimport { useTypedSelector } from '../../modules/hooks';\nimport { DocumentStatus } from '../../pages/EditView/components/DocumentStatus';\nimport { BlocksInput } from '../../pages/EditView/components/FormInputs/BlocksInput/BlocksInput';\nimport { ComponentInput } from '../../pages/EditView/components/FormInputs/Component/Input';\nimport {\n DynamicZone,\n useDynamicZone,\n} from '../../pages/EditView/components/FormInputs/DynamicZone/Field';\nimport { NotAllowedInput } from '../../pages/EditView/components/FormInputs/NotAllowed';\nimport { UIDInput } from '../../pages/EditView/components/FormInputs/UID';\nimport { Wysiwyg } from '../../pages/EditView/components/FormInputs/Wysiwyg/Field';\nimport { useFieldHint } from '../../pages/EditView/components/InputRenderer';\nimport { getRelationLabel } from '../../utils/relations';\nimport { useHistoryContext } from '../pages/History';\n\nimport { getRemaingFieldsLayout } from './VersionContent';\n\nimport type { EditFieldLayout } from '../../hooks/useDocumentLayout';\nimport type { RelationsFieldProps } from '../../pages/EditView/components/FormInputs/Relations/Relations';\nimport type { RelationResult } from '../../services/relations';\nimport type { Schema } from '@strapi/types';\nimport type { DistributiveOmit } from 'react-redux';\n\nconst StyledAlert = styled(Alert).attrs({ closeLabel: 'Close', onClose: () => {}, shadow: 'none' })`\n button {\n display: none;\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * CustomRelationInput\n * -----------------------------------------------------------------------------------------------*/\n\nconst LinkEllipsis = styled(Link)`\n display: block;\n\n & > span {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: block;\n }\n`;\n\nconst CustomRelationInput = (props: RelationsFieldProps) => {\n const { formatMessage } = useIntl();\n const emptyLabel = formatMessage({\n id: 'content-manager.containers.empty-label',\n defaultMessage: 'Untitled',\n });\n const field = useField<\n { results: RelationResult[]; meta: { missingCount: number } } | RelationResult[]\n >(props.name);\n\n /**\n * Ideally the server would return the correct shape, however, for admin user relations\n * it sanitizes everything out when it finds an object for the relation value.\n */\n let formattedFieldValue;\n if (field) {\n formattedFieldValue = Array.isArray(field.value)\n ? { results: field.value, meta: { missingCount: 0 } }\n : field.value;\n }\n\n // Be defensive about the shape: admin-user relations are sanitized to a\n // plain user object on the server, and historical version data can carry\n // shapes that pre-date the `{ results, meta }` contract. Treat anything\n // without an array `results` as \"no relations\".\n const hasResultsShape =\n !!formattedFieldValue &&\n typeof formattedFieldValue === 'object' &&\n Array.isArray((formattedFieldValue as { results?: unknown }).results);\n const missingCount =\n hasResultsShape &&\n typeof (formattedFieldValue as { meta?: { missingCount?: number } }).meta?.missingCount ===\n 'number'\n ? (formattedFieldValue as { meta: { missingCount: number } }).meta.missingCount\n : 0;\n\n if (\n !hasResultsShape ||\n ((formattedFieldValue as { results: unknown[] }).results.length === 0 && missingCount === 0)\n ) {\n return (\n <>\n <Field.Label action={props.labelAction}>{props.label}</Field.Label>\n <Box marginTop={1}>\n <StyledAlert variant=\"default\">\n {formatMessage({\n id: 'content-manager.history.content.no-relations',\n defaultMessage: 'No relations.',\n })}\n </StyledAlert>\n </Box>\n </>\n );\n }\n\n const { results, meta } = formattedFieldValue as {\n results: RelationResult[];\n meta: { missingCount: number };\n };\n\n return (\n <Box>\n <Field.Label>{props.label}</Field.Label>\n {results.length > 0 && (\n <Flex direction=\"column\" gap={2} marginTop={1} alignItems=\"stretch\">\n {results.map((relationData) => {\n // @ts-expect-error - targetModel does exist on the attribute. But it's not typed.\n const { targetModel } = props.attribute;\n const href = `../${COLLECTION_TYPES}/${targetModel}/${relationData.documentId}`;\n const label = getRelationLabel(relationData, props.mainField, emptyLabel);\n const isAdminUserRelation = targetModel === 'admin::user';\n\n return (\n <Flex\n key={relationData.documentId ?? relationData.id}\n paddingTop={2}\n paddingBottom={2}\n paddingLeft={4}\n paddingRight={4}\n hasRadius\n borderColor=\"neutral200\"\n background=\"neutral150\"\n justifyContent=\"space-between\"\n >\n <Box minWidth={0} paddingTop={1} paddingBottom={1} paddingRight={4}>\n <Tooltip label={label}>\n {isAdminUserRelation ? (\n <Typography>{label}</Typography>\n ) : (\n <LinkEllipsis tag={NavLink} to={href}>\n {label}\n </LinkEllipsis>\n )}\n </Tooltip>\n </Box>\n <DocumentStatus status={relationData.status as string} />\n </Flex>\n );\n })}\n </Flex>\n )}\n {meta.missingCount > 0 && (\n <StyledAlert\n marginTop={1}\n variant=\"warning\"\n title={formatMessage(\n {\n id: 'content-manager.history.content.missing-relations.title',\n defaultMessage:\n '{number, plural, =1 {Missing relation} other {{number} missing relations}}',\n },\n { number: meta.missingCount }\n )}\n >\n {formatMessage(\n {\n id: 'content-manager.history.content.missing-relations.message',\n defaultMessage:\n \"{number, plural, =1 {It has} other {They have}} been deleted and can't be restored.\",\n },\n { number: meta.missingCount }\n )}\n </StyledAlert>\n )}\n </Box>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * CustomMediaInput\n * -----------------------------------------------------------------------------------------------*/\n\n// Create an object with value at key path (i.e. 'a.b.c')\nconst createInitialValuesForPath = (keyPath: string, value: unknown) => {\n const keys = keyPath.split('.');\n // The root level object\n const root: Record<string, unknown> = {};\n\n // Make the first node the root\n let node = root;\n keys.forEach((key, index) => {\n // Skip prototype pollution keys\n if (key === '__proto__' || key === 'constructor') return;\n // If it's the last key, set the node value\n if (index === keys.length - 1) {\n node[key] = value;\n } else {\n // Ensure the key exists and is an object\n const nextNode =\n typeof node[key] === 'object' && node[key] !== null && Array.isArray(node[key]) === false\n ? (node[key] as Record<string, unknown>)\n : {};\n node[key] = nextNode;\n node = nextNode;\n }\n });\n\n return root;\n};\n\nconst CustomMediaInput = (props: VersionInputRendererProps) => {\n const { value } = useField<{ results: unknown[]; meta: { missingCount: number } }>(props.name);\n const results = value?.results ?? [];\n const meta = value?.meta ?? { missingCount: 0 };\n\n const { formatMessage } = useIntl();\n\n const fields = useStrapiApp('CustomMediaInput', (state) => state.fields);\n const MediaLibrary = fields.media as React.ComponentType<\n VersionInputRendererProps & { multiple: boolean }\n >;\n\n return (\n <Flex direction=\"column\" gap={2} alignItems=\"stretch\">\n <Form\n method=\"PUT\"\n disabled={true}\n initialValues={createInitialValuesForPath(props.name, results)}\n >\n <MediaLibrary {...props} disabled={true} multiple={results.length > 1} />\n </Form>\n {meta.missingCount > 0 && (\n <StyledAlert\n variant=\"warning\"\n closeLabel=\"Close\"\n onClose={() => {}}\n title={formatMessage(\n {\n id: 'content-manager.history.content.missing-assets.title',\n defaultMessage:\n '{number, plural, =1 {Missing asset} other {{number} missing assets}}',\n },\n { number: meta.missingCount }\n )}\n >\n {formatMessage(\n {\n id: 'content-manager.history.content.missing-assets.message',\n defaultMessage:\n \"{number, plural, =1 {It has} other {They have}} been deleted in the Media Library and can't be restored.\",\n },\n { number: meta.missingCount }\n )}\n </StyledAlert>\n )}\n </Flex>\n );\n};\n\ntype VersionInputRendererProps = DistributiveOmit<EditFieldLayout, 'size'> & {\n /**\n * In the context of content history, deleted fields need to ignore RBAC\n * @default false\n */\n shouldIgnoreRBAC?: boolean;\n};\n\n/**\n * Checks if the i18n plugin added a label action to the field and modifies it\n * to adapt the wording for the history page.\n */\nconst getLabelAction = (labelAction: VersionInputRendererProps['labelAction']) => {\n if (!React.isValidElement(labelAction)) {\n return labelAction;\n }\n\n // TODO: find a better way to do this rather than access internals\n const labelActionTitleId = labelAction.props.title.id;\n\n if (labelActionTitleId === 'i18n.Field.localized') {\n return React.cloneElement(labelAction, {\n ...labelAction.props,\n title: {\n id: 'history.content.localized',\n defaultMessage:\n 'This value is specific to this locale. If you restore this version, the content will not be replaced for other locales.',\n },\n });\n }\n\n if (labelActionTitleId === 'i18n.Field.not-localized') {\n return React.cloneElement(labelAction, {\n ...labelAction.props,\n title: {\n id: 'history.content.not-localized',\n defaultMessage:\n 'This value is common to all locales. If you restore this version and save the changes, the content will be replaced for all locales.',\n },\n });\n }\n\n // Label action is unrelated to i18n, don't touch it.\n return labelAction;\n};\n\n/**\n * Resolve the layout, configuration metadata and schema attributes needed to\n * render a component field on the history page. Returns `null` when any of\n * those are missing — happens when the component schema referenced by the\n * version was deleted via the Content-Type Builder, in which case the caller\n * should render a fallback instead of crashing on the destructuring.\n */\nconst resolveComponentRenderResources = (\n componentUID: string,\n componentsLayout: { [uid: string]: { layout: unknown } | undefined },\n configurationComponents: { [uid: string]: { metadatas: unknown } | undefined },\n components: { [uid: string]: { attributes: unknown } | undefined }\n) => {\n const componentLayout = componentsLayout[componentUID];\n const componentConfiguration = configurationComponents[componentUID];\n const componentSchema = components[componentUID];\n\n if (!componentLayout || !componentConfiguration || !componentSchema) {\n return null;\n }\n\n return {\n layout: componentLayout.layout,\n metadatas: componentConfiguration.metadatas,\n schemaAttributes: componentSchema.attributes,\n };\n};\n\n/**\n * @internal\n *\n * @description An abstraction around the regular form input renderer designed specifically\n * to be used on the History page in the content-manager. It understands how to render specific\n * inputs within the context of a history version (i.e. relations, media, ignored RBAC, etc...)\n */\nconst VersionInputRenderer = ({\n visible,\n hint: providedHint,\n shouldIgnoreRBAC = false,\n labelAction,\n ...props\n}: VersionInputRendererProps) => {\n const customLabelAction = getLabelAction(labelAction);\n\n const { formatMessage } = useIntl();\n const version = useHistoryContext('VersionContent', (state) => state.selectedVersion);\n const configuration = useHistoryContext('VersionContent', (state) => state.configuration);\n const fieldSizes = useTypedSelector((state) => state['content-manager'].app.fieldSizes);\n\n const { id, components } = useDoc();\n const isFormDisabled = useForm('InputRenderer', (state) => state.disabled);\n\n const isInDynamicZone = useDynamicZone('isInDynamicZone', (state) => state.isInDynamicZone);\n\n const canCreateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canCreateFields);\n const canReadFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canReadFields);\n const canUpdateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUpdateFields);\n const canUserAction = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUserAction);\n\n const editableFields = id ? canUpdateFields : canCreateFields;\n const readableFields = id ? canReadFields : canCreateFields;\n /**\n * Component fields are always readable and editable,\n * however the fields within them may not be.\n */\n const canUserReadField = canUserAction(props.name, readableFields, props.type);\n const canUserEditField = canUserAction(props.name, editableFields, props.type);\n\n const fields = useStrapiApp('InputRenderer', (app) => app.fields);\n const { lazyComponentStore } = useLazyComponents(\n attributeHasCustomFieldProperty(props.attribute) ? [props.attribute.customField] : undefined\n );\n\n const hint = useFieldHint(providedHint, props.attribute);\n const {\n edit: { components: componentsLayout },\n } = useDocLayout();\n\n if (!visible) {\n return null;\n }\n\n /**\n * Don't render the field if the user can't read it.\n */\n if (!shouldIgnoreRBAC && !canUserReadField && !isInDynamicZone) {\n return <NotAllowedInput hint={hint} {...props} />;\n }\n\n const fieldIsDisabled =\n (!canUserEditField && !isInDynamicZone) || props.disabled || isFormDisabled;\n\n /**\n * Attributes found on the current content-type schema cannot be restored. We handle\n * this by displaying a warning alert to the user instead of the input for that field type.\n */\n const addedAttributes = version.meta.unknownAttributes.added;\n if (Object.keys(addedAttributes).includes(props.name)) {\n return (\n <Flex direction=\"column\" alignItems=\"flex-start\" gap={1}>\n <Field.Label>{props.label}</Field.Label>\n <StyledAlert\n width=\"100%\"\n closeLabel=\"Close\"\n onClose={() => {}}\n variant=\"warning\"\n title={formatMessage({\n id: 'content-manager.history.content.new-field.title',\n defaultMessage: 'New field',\n })}\n >\n {formatMessage({\n id: 'content-manager.history.content.new-field.message',\n defaultMessage:\n \"This field didn't exist when this version was saved. If you restore this version, it will be empty.\",\n })}\n </StyledAlert>\n </Flex>\n );\n }\n\n /**\n * Because a custom field has a unique prop but the type could be confused with either\n * the useField hook or the type of the field we need to handle it separately and first.\n */\n if (attributeHasCustomFieldProperty(props.attribute)) {\n const CustomInput = lazyComponentStore[props.attribute.customField];\n\n if (CustomInput) {\n return (\n <CustomInput\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n return (\n <FormInputRenderer\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n // @ts-expect-error – this workaround lets us display that the custom field is missing.\n type={props.attribute.customField}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * Since media fields use a custom input via the upload plugin provided by the useLibrary hook,\n * we need to handle the them before other custom inputs coming from the useLibrary hook.\n */\n if (props.type === 'media') {\n return (\n <CustomMediaInput {...props} labelAction={customLabelAction} disabled={fieldIsDisabled} />\n );\n }\n /**\n * This is where we handle ONLY the fields from the `useLibrary` hook.\n */\n const addedInputTypes = Object.keys(fields);\n if (!attributeHasCustomFieldProperty(props.attribute) && addedInputTypes.includes(props.type)) {\n const CustomInput = fields[props.type];\n return (\n <CustomInput\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLibrary hook.\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * These include the content-manager specific fields, failing that we fall back\n * to the more generic form input renderer.\n */\n switch (props.type) {\n case 'blocks':\n return <BlocksInput {...props} hint={hint} type={props.type} disabled={fieldIsDisabled} />;\n case 'component': {\n const renderResources = resolveComponentRenderResources(\n props.attribute.component,\n componentsLayout,\n configuration.components,\n components\n );\n\n // The component schema referenced by this version is no longer present\n // (deleted via the Content-Type Builder). Render the label only so the\n // rest of the page still loads instead of crashing on the lookups below.\n if (!renderResources) {\n return <Field.Label>{props.label}</Field.Label>;\n }\n\n const { layout, metadatas, schemaAttributes } = renderResources as {\n layout: Array<EditFieldLayout[]>;\n metadatas: Parameters<typeof getRemaingFieldsLayout>[0]['metadatas'];\n schemaAttributes: Parameters<typeof getRemaingFieldsLayout>[0]['schemaAttributes'];\n };\n\n // Components can only have one panel, so only save the first layout item\n const [remainingFieldsLayout] = getRemaingFieldsLayout({\n layout: [layout],\n metadatas,\n fieldSizes,\n schemaAttributes,\n });\n\n return (\n <ComponentInput\n {...props}\n layout={[...layout, ...(remainingFieldsLayout || [])]}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n >\n {(inputProps) => <VersionInputRenderer {...inputProps} shouldIgnoreRBAC={true} />}\n </ComponentInput>\n );\n }\n case 'dynamiczone':\n return (\n <DynamicZone\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n >\n {(inputProps) => <VersionInputRenderer {...inputProps} shouldIgnoreRBAC={true} />}\n </DynamicZone>\n );\n case 'relation':\n return (\n <CustomRelationInput\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n case 'richtext':\n return (\n <Wysiwyg\n {...props}\n hint={hint}\n type={props.type}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n case 'uid':\n return (\n <UIDInput\n {...props}\n hint={hint}\n type={props.type}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n /**\n * Enumerations are a special case because they require options.\n */\n case 'enumeration':\n return (\n <FormInputRenderer\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n options={props.attribute.enum.map((value) => ({ value }))}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n default:\n // These props are not needed for the generic form input renderer.\n const { unique: _unique, mainField: _mainField, ...restProps } = props;\n return (\n <FormInputRenderer\n {...restProps}\n hint={hint}\n labelAction={customLabelAction}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n }\n};\n\nconst attributeHasCustomFieldProperty = (\n attribute: Schema.Attribute.AnyAttribute\n): attribute is Schema.Attribute.AnyAttribute & Schema.Attribute.CustomField<string> =>\n 'customField' in attribute && typeof attribute.customField === 'string';\n\nexport type { VersionInputRendererProps };\nexport { VersionInputRenderer, CustomRelationInput, resolveComponentRenderResources };\n"],"names":["StyledAlert","styled","Alert","attrs","closeLabel","onClose","shadow","LinkEllipsis","Link","CustomRelationInput","props","formatMessage","useIntl","emptyLabel","id","defaultMessage","field","useField","name","formattedFieldValue","Array","isArray","value","results","meta","missingCount","hasResultsShape","length","_jsxs","_Fragment","_jsx","Field","Label","action","labelAction","label","Box","marginTop","variant","Flex","direction","gap","alignItems","map","relationData","targetModel","attribute","href","COLLECTION_TYPES","documentId","getRelationLabel","mainField","isAdminUserRelation","paddingTop","paddingBottom","paddingLeft","paddingRight","hasRadius","borderColor","background","justifyContent","minWidth","Tooltip","Typography","tag","NavLink","to","DocumentStatus","status","title","number","createInitialValuesForPath","keyPath","keys","split","root","node","forEach","key","index","nextNode","CustomMediaInput","fields","useStrapiApp","state","MediaLibrary","media","Form","method","disabled","initialValues","multiple","getLabelAction","React","isValidElement","labelActionTitleId","cloneElement","resolveComponentRenderResources","componentUID","componentsLayout","configurationComponents","components","componentLayout","componentConfiguration","componentSchema","layout","metadatas","schemaAttributes","attributes","VersionInputRenderer","visible","hint","providedHint","shouldIgnoreRBAC","customLabelAction","version","useHistoryContext","selectedVersion","configuration","fieldSizes","useTypedSelector","app","useDoc","isFormDisabled","useForm","isInDynamicZone","useDynamicZone","canCreateFields","useDocumentRBAC","rbac","canReadFields","canUpdateFields","canUserAction","editableFields","readableFields","canUserReadField","type","canUserEditField","lazyComponentStore","useLazyComponents","attributeHasCustomFieldProperty","customField","undefined","useFieldHint","edit","useDocLayout","NotAllowedInput","fieldIsDisabled","addedAttributes","unknownAttributes","added","Object","includes","width","CustomInput","FormInputRenderer","addedInputTypes","BlocksInput","renderResources","component","remainingFieldsLayout","getRemaingFieldsLayout","ComponentInput","inputProps","DynamicZone","Wysiwyg","UIDInput","options","enum","unique","_unique","_mainField","restProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAMA,WAAAA,GAAcC,uBAAAA,CAAOC,kBAAAA,CAAAA,CAAOC,KAAK,CAAC;IAAEC,UAAAA,EAAY,OAAA;AAASC,IAAAA,OAAAA,EAAS,IAAA,CAAO,CAAA;IAAGC,MAAAA,EAAQ;AAAO,CAAA,CAAE;;;;AAInG,CAAC;AAED;;AAEkG,qGAElG,MAAMC,YAAAA,GAAeN,uBAAAA,CAAOO,iBAAAA,CAAK;;;;;;;;;AASjC,CAAC;AAED,MAAMC,sBAAsB,CAACC,KAAAA,GAAAA;IAC3B,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;AAC1B,IAAA,MAAMC,aAAaF,aAAAA,CAAc;QAC/BG,EAA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VersionInputRenderer.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n useStrapiApp,\n useForm,\n InputRenderer as FormInputRenderer,\n useField,\n Form,\n} from '@strapi/admin/strapi-admin';\nimport { Alert, Box, Field, Flex, Link, Tooltip, Typography } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport { NavLink } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { COLLECTION_TYPES } from '../../constants/collections';\nimport { useDocumentRBAC } from '../../features/DocumentRBAC';\nimport { useDoc } from '../../hooks/useDocument';\nimport { useDocLayout } from '../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../hooks/useLazyComponents';\nimport { useTypedSelector } from '../../modules/hooks';\nimport { DocumentStatus } from '../../pages/EditView/components/DocumentStatus';\nimport { BlocksInput } from '../../pages/EditView/components/FormInputs/BlocksInput/BlocksInput';\nimport { ComponentInput } from '../../pages/EditView/components/FormInputs/Component/Input';\nimport {\n DynamicZone,\n useDynamicZone,\n} from '../../pages/EditView/components/FormInputs/DynamicZone/Field';\nimport { NotAllowedInput } from '../../pages/EditView/components/FormInputs/NotAllowed';\nimport { UIDInput } from '../../pages/EditView/components/FormInputs/UID';\nimport { Wysiwyg } from '../../pages/EditView/components/FormInputs/Wysiwyg/Field';\nimport { useFieldHint } from '../../pages/EditView/components/InputRenderer';\nimport { getRelationLabel } from '../../utils/relations';\nimport { useHistoryContext } from '../pages/History';\n\nimport { getRemaingFieldsLayout } from './VersionContent';\n\nimport type { EditFieldLayout } from '../../hooks/useDocumentLayout';\nimport type { RelationsFieldProps } from '../../pages/EditView/components/FormInputs/Relations/Relations';\nimport type { RelationResult } from '../../services/relations';\nimport type { Schema } from '@strapi/types';\nimport type { DistributiveOmit } from 'react-redux';\n\nconst StyledAlert = styled(Alert).attrs({ closeLabel: 'Close', onClose: () => {}, shadow: 'none' })`\n button {\n display: none;\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * CustomRelationInput\n * -----------------------------------------------------------------------------------------------*/\n\nconst LinkEllipsis = styled(Link)`\n display: block;\n\n & > span {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: block;\n }\n`;\n\nconst CustomRelationInput = (props: RelationsFieldProps) => {\n const { formatMessage } = useIntl();\n const emptyLabel = formatMessage({\n id: 'content-manager.containers.empty-label',\n defaultMessage: 'Untitled',\n });\n const field = useField<\n { results: RelationResult[]; meta: { missingCount: number } } | RelationResult[]\n >(props.name);\n\n /**\n * Ideally the server would return the correct shape, however, for admin user relations\n * it sanitizes everything out when it finds an object for the relation value.\n */\n let formattedFieldValue;\n if (field) {\n formattedFieldValue = Array.isArray(field.value)\n ? { results: field.value, meta: { missingCount: 0 } }\n : field.value;\n }\n\n // Be defensive about the shape: admin-user relations are sanitized to a\n // plain user object on the server, and historical version data can carry\n // shapes that pre-date the `{ results, meta }` contract. Treat anything\n // without an array `results` as \"no relations\".\n const hasResultsShape =\n !!formattedFieldValue &&\n typeof formattedFieldValue === 'object' &&\n Array.isArray((formattedFieldValue as { results?: unknown }).results);\n const missingCount =\n hasResultsShape &&\n typeof (formattedFieldValue as { meta?: { missingCount?: number } }).meta?.missingCount ===\n 'number'\n ? (formattedFieldValue as { meta: { missingCount: number } }).meta.missingCount\n : 0;\n\n if (\n !hasResultsShape ||\n ((formattedFieldValue as { results: unknown[] }).results.length === 0 && missingCount === 0)\n ) {\n return (\n <>\n <Field.Label action={props.labelAction}>{props.label}</Field.Label>\n <Box marginTop={1}>\n <StyledAlert variant=\"default\">\n {formatMessage({\n id: 'content-manager.history.content.no-relations',\n defaultMessage: 'No relations.',\n })}\n </StyledAlert>\n </Box>\n </>\n );\n }\n\n const { results, meta } = formattedFieldValue as {\n results: RelationResult[];\n meta: { missingCount: number };\n };\n\n return (\n <Box>\n <Field.Label>{props.label}</Field.Label>\n {results.length > 0 && (\n <Flex direction=\"column\" gap={2} marginTop={1} alignItems=\"stretch\">\n {results.map((relationData) => {\n // @ts-expect-error - targetModel does exist on the attribute. But it's not typed.\n const { targetModel } = props.attribute;\n const href = `../${COLLECTION_TYPES}/${targetModel}/${relationData.documentId}`;\n const label = getRelationLabel(relationData, props.mainField, emptyLabel);\n const isAdminUserRelation = targetModel === 'admin::user';\n\n return (\n <Flex\n key={relationData.documentId ?? relationData.id}\n paddingTop={2}\n paddingBottom={2}\n paddingLeft={4}\n paddingRight={4}\n hasRadius\n borderColor=\"neutral200\"\n background=\"neutral150\"\n justifyContent=\"space-between\"\n >\n <Box minWidth={0} paddingTop={1} paddingBottom={1} paddingRight={4}>\n <Tooltip label={label}>\n {isAdminUserRelation ? (\n <Typography>{label}</Typography>\n ) : (\n <LinkEllipsis tag={NavLink} to={href}>\n {label}\n </LinkEllipsis>\n )}\n </Tooltip>\n </Box>\n <DocumentStatus status={relationData.status as string} />\n </Flex>\n );\n })}\n </Flex>\n )}\n {meta.missingCount > 0 && (\n <StyledAlert\n marginTop={1}\n variant=\"warning\"\n title={formatMessage(\n {\n id: 'content-manager.history.content.missing-relations.title',\n defaultMessage:\n '{number, plural, =1 {Missing relation} other {{number} missing relations}}',\n },\n { number: meta.missingCount }\n )}\n >\n {formatMessage(\n {\n id: 'content-manager.history.content.missing-relations.message',\n defaultMessage:\n \"{number, plural, =1 {It has} other {They have}} been deleted and can't be restored.\",\n },\n { number: meta.missingCount }\n )}\n </StyledAlert>\n )}\n </Box>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * CustomMediaInput\n * -----------------------------------------------------------------------------------------------*/\n\n// Create an object with value at key path (i.e. 'a.b.c')\nconst createInitialValuesForPath = (keyPath: string, value: unknown) => {\n const keys = keyPath.split('.');\n // The root level object\n const root: Record<string, unknown> = {};\n\n // Make the first node the root\n let node = root;\n keys.forEach((key, index) => {\n // Skip prototype pollution keys\n if (key === '__proto__' || key === 'constructor') return;\n // If it's the last key, set the node value\n if (index === keys.length - 1) {\n node[key] = value;\n } else {\n // Ensure the key exists and is an object\n const nextNode =\n typeof node[key] === 'object' && node[key] !== null && Array.isArray(node[key]) === false\n ? (node[key] as Record<string, unknown>)\n : {};\n node[key] = nextNode;\n node = nextNode;\n }\n });\n\n return root;\n};\n\nconst CustomMediaInput = (props: VersionInputRendererProps) => {\n const { value } = useField<{ results: unknown[]; meta: { missingCount: number } }>(props.name);\n const results = value?.results ?? [];\n const meta = value?.meta ?? { missingCount: 0 };\n\n const { formatMessage } = useIntl();\n\n const fields = useStrapiApp('CustomMediaInput', (state) => state.fields);\n const MediaLibrary = fields.media as React.ComponentType<\n VersionInputRendererProps & { multiple: boolean }\n >;\n\n return (\n <Flex direction=\"column\" gap={2} alignItems=\"stretch\">\n <Form\n method=\"PUT\"\n disabled={true}\n initialValues={createInitialValuesForPath(props.name, results)}\n >\n <MediaLibrary {...props} disabled={true} multiple={results.length > 1} />\n </Form>\n {meta.missingCount > 0 && (\n <StyledAlert\n variant=\"warning\"\n closeLabel=\"Close\"\n onClose={() => {}}\n title={formatMessage(\n {\n id: 'content-manager.history.content.missing-assets.title',\n defaultMessage:\n '{number, plural, =1 {Missing asset} other {{number} missing assets}}',\n },\n { number: meta.missingCount }\n )}\n >\n {formatMessage(\n {\n id: 'content-manager.history.content.missing-assets.message',\n defaultMessage:\n \"{number, plural, =1 {It has} other {They have}} been deleted in the Media Library and can't be restored.\",\n },\n { number: meta.missingCount }\n )}\n </StyledAlert>\n )}\n </Flex>\n );\n};\n\ntype VersionInputRendererProps = DistributiveOmit<EditFieldLayout, 'size'> & {\n /**\n * In the context of content history, deleted fields need to ignore RBAC\n * @default false\n */\n shouldIgnoreRBAC?: boolean;\n /** Passed down by component and dynamic zone layouts; not used here. */\n size?: number;\n};\n\n/**\n * Checks if the i18n plugin added a label action to the field and modifies it\n * to adapt the wording for the history page.\n */\nconst getLabelAction = (labelAction: VersionInputRendererProps['labelAction']) => {\n if (!React.isValidElement(labelAction)) {\n return labelAction;\n }\n\n // TODO: find a better way to do this rather than access internals\n const labelActionTitleId = labelAction.props.title.id;\n\n if (labelActionTitleId === 'i18n.Field.localized') {\n return React.cloneElement(labelAction, {\n ...labelAction.props,\n title: {\n id: 'history.content.localized',\n defaultMessage:\n 'This value is specific to this locale. If you restore this version, the content will not be replaced for other locales.',\n },\n });\n }\n\n if (labelActionTitleId === 'i18n.Field.not-localized') {\n return React.cloneElement(labelAction, {\n ...labelAction.props,\n title: {\n id: 'history.content.not-localized',\n defaultMessage:\n 'This value is common to all locales. If you restore this version and save the changes, the content will be replaced for all locales.',\n },\n });\n }\n\n // Label action is unrelated to i18n, don't touch it.\n return labelAction;\n};\n\n/**\n * Resolve the layout, configuration metadata and schema attributes needed to\n * render a component field on the history page. Returns `null` when any of\n * those are missing — happens when the component schema referenced by the\n * version was deleted via the Content-Type Builder, in which case the caller\n * should render a fallback instead of crashing on the destructuring.\n */\nconst resolveComponentRenderResources = (\n componentUID: string,\n componentsLayout: { [uid: string]: { layout: unknown } | undefined },\n configurationComponents: { [uid: string]: { metadatas: unknown } | undefined },\n components: { [uid: string]: { attributes: unknown } | undefined }\n) => {\n const componentLayout = componentsLayout[componentUID];\n const componentConfiguration = configurationComponents[componentUID];\n const componentSchema = components[componentUID];\n\n if (!componentLayout || !componentConfiguration || !componentSchema) {\n return null;\n }\n\n return {\n layout: componentLayout.layout,\n metadatas: componentConfiguration.metadatas,\n schemaAttributes: componentSchema.attributes,\n };\n};\n\n/**\n * @internal\n *\n * @description An abstraction around the regular form input renderer designed specifically\n * to be used on the History page in the content-manager. It understands how to render specific\n * inputs within the context of a history version (i.e. relations, media, ignored RBAC, etc...)\n */\nconst VersionInputRenderer = ({\n visible,\n hint: providedHint,\n shouldIgnoreRBAC = false,\n labelAction,\n // Not spread with the rest: design-system inputs have a `size` prop of their own.\n size: _size,\n ...props\n}: VersionInputRendererProps) => {\n const customLabelAction = getLabelAction(labelAction);\n\n const { formatMessage } = useIntl();\n const version = useHistoryContext('VersionContent', (state) => state.selectedVersion);\n const configuration = useHistoryContext('VersionContent', (state) => state.configuration);\n const fieldSizes = useTypedSelector((state) => state['content-manager'].app.fieldSizes);\n\n const { id, components } = useDoc();\n const isFormDisabled = useForm('InputRenderer', (state) => state.disabled);\n\n const isInDynamicZone = useDynamicZone('isInDynamicZone', (state) => state.isInDynamicZone);\n\n const canCreateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canCreateFields);\n const canReadFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canReadFields);\n const canUpdateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUpdateFields);\n const canUserAction = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUserAction);\n\n const editableFields = id ? canUpdateFields : canCreateFields;\n const readableFields = id ? canReadFields : canCreateFields;\n /**\n * Component fields are always readable and editable,\n * however the fields within them may not be.\n */\n const canUserReadField = canUserAction(props.name, readableFields, props.type);\n const canUserEditField = canUserAction(props.name, editableFields, props.type);\n\n const fields = useStrapiApp('InputRenderer', (app) => app.fields);\n const { lazyComponentStore } = useLazyComponents(\n attributeHasCustomFieldProperty(props.attribute) ? [props.attribute.customField] : undefined\n );\n\n const hint = useFieldHint(providedHint, props.attribute);\n const {\n edit: { components: componentsLayout },\n } = useDocLayout();\n\n if (!visible) {\n return null;\n }\n\n /**\n * Don't render the field if the user can't read it.\n */\n if (!shouldIgnoreRBAC && !canUserReadField && !isInDynamicZone) {\n return <NotAllowedInput hint={hint} {...props} />;\n }\n\n const fieldIsDisabled =\n (!canUserEditField && !isInDynamicZone) || props.disabled || isFormDisabled;\n\n /**\n * Attributes found on the current content-type schema cannot be restored. We handle\n * this by displaying a warning alert to the user instead of the input for that field type.\n */\n const addedAttributes = version.meta.unknownAttributes.added;\n if (Object.keys(addedAttributes).includes(props.name)) {\n return (\n <Flex direction=\"column\" alignItems=\"flex-start\" gap={1}>\n <Field.Label>{props.label}</Field.Label>\n <StyledAlert\n width=\"100%\"\n closeLabel=\"Close\"\n onClose={() => {}}\n variant=\"warning\"\n title={formatMessage({\n id: 'content-manager.history.content.new-field.title',\n defaultMessage: 'New field',\n })}\n >\n {formatMessage({\n id: 'content-manager.history.content.new-field.message',\n defaultMessage:\n \"This field didn't exist when this version was saved. If you restore this version, it will be empty.\",\n })}\n </StyledAlert>\n </Flex>\n );\n }\n\n /**\n * Because a custom field has a unique prop but the type could be confused with either\n * the useField hook or the type of the field we need to handle it separately and first.\n */\n if (attributeHasCustomFieldProperty(props.attribute)) {\n const CustomInput = lazyComponentStore[props.attribute.customField];\n\n if (CustomInput) {\n return (\n <CustomInput\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n return (\n <FormInputRenderer\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n // @ts-expect-error – this workaround lets us display that the custom field is missing.\n type={props.attribute.customField}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * Since media fields use a custom input via the upload plugin provided by the useLibrary hook,\n * we need to handle the them before other custom inputs coming from the useLibrary hook.\n */\n if (props.type === 'media') {\n return (\n <CustomMediaInput {...props} labelAction={customLabelAction} disabled={fieldIsDisabled} />\n );\n }\n /**\n * This is where we handle ONLY the fields from the `useLibrary` hook.\n */\n const addedInputTypes = Object.keys(fields);\n if (!attributeHasCustomFieldProperty(props.attribute) && addedInputTypes.includes(props.type)) {\n const CustomInput = fields[props.type];\n return (\n <CustomInput\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLibrary hook.\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * These include the content-manager specific fields, failing that we fall back\n * to the more generic form input renderer.\n */\n switch (props.type) {\n case 'blocks':\n return <BlocksInput {...props} hint={hint} type={props.type} disabled={fieldIsDisabled} />;\n case 'component': {\n const renderResources = resolveComponentRenderResources(\n props.attribute.component,\n componentsLayout,\n configuration.components,\n components\n );\n\n // The component schema referenced by this version is no longer present\n // (deleted via the Content-Type Builder). Render the label only so the\n // rest of the page still loads instead of crashing on the lookups below.\n if (!renderResources) {\n return <Field.Label>{props.label}</Field.Label>;\n }\n\n const { layout, metadatas, schemaAttributes } = renderResources as {\n layout: Array<EditFieldLayout[]>;\n metadatas: Parameters<typeof getRemaingFieldsLayout>[0]['metadatas'];\n schemaAttributes: Parameters<typeof getRemaingFieldsLayout>[0]['schemaAttributes'];\n };\n\n // Components can only have one panel, so only save the first layout item\n const [remainingFieldsLayout] = getRemaingFieldsLayout({\n layout: [layout],\n metadatas,\n fieldSizes,\n schemaAttributes,\n });\n\n return (\n <ComponentInput\n {...props}\n layout={[...layout, ...(remainingFieldsLayout || [])]}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n >\n {(inputProps) => <VersionInputRenderer {...inputProps} shouldIgnoreRBAC={true} />}\n </ComponentInput>\n );\n }\n case 'dynamiczone':\n return (\n <DynamicZone\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n >\n {(inputProps) => <VersionInputRenderer {...inputProps} shouldIgnoreRBAC={true} />}\n </DynamicZone>\n );\n case 'relation':\n return (\n <CustomRelationInput\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n case 'richtext':\n return (\n <Wysiwyg\n {...props}\n hint={hint}\n type={props.type}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n case 'uid':\n return (\n <UIDInput\n {...props}\n hint={hint}\n type={props.type}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n /**\n * Enumerations are a special case because they require options.\n */\n case 'enumeration':\n return (\n <FormInputRenderer\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n options={props.attribute.enum.map((value) => ({ value }))}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n default:\n // These props are not needed for the generic form input renderer.\n const { unique: _unique, mainField: _mainField, ...restProps } = props;\n return (\n <FormInputRenderer\n {...restProps}\n hint={hint}\n labelAction={customLabelAction}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n }\n};\n\nconst attributeHasCustomFieldProperty = (\n attribute: Schema.Attribute.AnyAttribute\n): attribute is Schema.Attribute.AnyAttribute & Schema.Attribute.CustomField<string> =>\n 'customField' in attribute && typeof attribute.customField === 'string';\n\nexport type { VersionInputRendererProps };\nexport { VersionInputRenderer, CustomRelationInput, resolveComponentRenderResources };\n"],"names":["StyledAlert","styled","Alert","attrs","closeLabel","onClose","shadow","LinkEllipsis","Link","CustomRelationInput","props","formatMessage","useIntl","emptyLabel","id","defaultMessage","field","useField","name","formattedFieldValue","Array","isArray","value","results","meta","missingCount","hasResultsShape","length","_jsxs","_Fragment","_jsx","Field","Label","action","labelAction","label","Box","marginTop","variant","Flex","direction","gap","alignItems","map","relationData","targetModel","attribute","href","COLLECTION_TYPES","documentId","getRelationLabel","mainField","isAdminUserRelation","paddingTop","paddingBottom","paddingLeft","paddingRight","hasRadius","borderColor","background","justifyContent","minWidth","Tooltip","Typography","tag","NavLink","to","DocumentStatus","status","title","number","createInitialValuesForPath","keyPath","keys","split","root","node","forEach","key","index","nextNode","CustomMediaInput","fields","useStrapiApp","state","MediaLibrary","media","Form","method","disabled","initialValues","multiple","getLabelAction","React","isValidElement","labelActionTitleId","cloneElement","resolveComponentRenderResources","componentUID","componentsLayout","configurationComponents","components","componentLayout","componentConfiguration","componentSchema","layout","metadatas","schemaAttributes","attributes","VersionInputRenderer","visible","hint","providedHint","shouldIgnoreRBAC","size","_size","customLabelAction","version","useHistoryContext","selectedVersion","configuration","fieldSizes","useTypedSelector","app","useDoc","isFormDisabled","useForm","isInDynamicZone","useDynamicZone","canCreateFields","useDocumentRBAC","rbac","canReadFields","canUpdateFields","canUserAction","editableFields","readableFields","canUserReadField","type","canUserEditField","lazyComponentStore","useLazyComponents","attributeHasCustomFieldProperty","customField","undefined","useFieldHint","edit","useDocLayout","NotAllowedInput","fieldIsDisabled","addedAttributes","unknownAttributes","added","Object","includes","width","CustomInput","FormInputRenderer","addedInputTypes","BlocksInput","renderResources","component","remainingFieldsLayout","getRemaingFieldsLayout","ComponentInput","inputProps","DynamicZone","Wysiwyg","UIDInput","options","enum","unique","_unique","_mainField","restProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAMA,WAAAA,GAAcC,uBAAAA,CAAOC,kBAAAA,CAAAA,CAAOC,KAAK,CAAC;IAAEC,UAAAA,EAAY,OAAA;AAASC,IAAAA,OAAAA,EAAS,IAAA,CAAO,CAAA;IAAGC,MAAAA,EAAQ;AAAO,CAAA,CAAE;;;;AAInG,CAAC;AAED;;AAEkG,qGAElG,MAAMC,YAAAA,GAAeN,uBAAAA,CAAOO,iBAAAA,CAAK;;;;;;;;;AASjC,CAAC;AAED,MAAMC,sBAAsB,CAACC,KAAAA,GAAAA;IAC3B,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;AAC1B,IAAA,MAAMC,aAAaF,aAAAA,CAAc;QAC/BG,EAAAA,EAAI,wCAAA;QACJC,cAAAA,EAAgB;AAClB,KAAA,CAAA;IACA,MAAMC,KAAAA,GAAQC,oBAAAA,CAEZP,KAAAA,CAAMQ,IAAI,CAAA;AAEZ;;;AAGC,MACD,IAAIC,mBAAAA;AACJ,IAAA,IAAIH,KAAAA,EAAO;AACTG,QAAAA,mBAAAA,GAAsBC,KAAAA,CAAMC,OAAO,CAACL,KAAAA,CAAMM,KAAK,CAAA,GAC3C;AAAEC,YAAAA,OAAAA,EAASP,MAAMM,KAAK;YAAEE,IAAAA,EAAM;gBAAEC,YAAAA,EAAc;AAAE;AAAE,SAAA,GAClDT,MAAMM,KAAK;AACjB,IAAA;;;;;AAMA,IAAA,MAAMI,eAAAA,GACJ,CAAC,CAACP,mBAAAA,IACF,OAAOA,mBAAAA,KAAwB,QAAA,IAC/BC,KAAAA,CAAMC,OAAO,CAAC,mB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AACrB,KAAAA,IAAW;AAAEA,wBAAAA;qBAAM,CAAA,CAAA;;AAEtDoH,gBAAAA,IAAAA,EAAMhI,KAAAA,CAAMqI,WAAW,GAAG,cAAA,GAAiBrI,MAAMgI,IAAI;gBACrDjD,QAAAA,EAAU4D;;AAGhB,QAAA;;YAEE,MAAM,EAAEsB,QAAQC,OAAO,EAAEzH,WAAW0H,UAAU,EAAE,GAAGC,SAAAA,EAAW,GAAGpK,KAAAA;AACjE,YAAA,qBACEoB,cAAA,CAAC+H,yBAAAA,EAAAA;AACE,gBAAA,GAAGiB,SAAS;gBACb/D,IAAAA,EAAMA,IAAAA;gBACN7E,WAAAA,EAAakF,iBAAAA;;AAEbsB,gBAAAA,IAAAA,EAAMhI,KAAAA,CAAMqI,WAAW,GAAG,cAAA,GAAiBrI,MAAMgI,IAAI;gBACrDjD,QAAAA,EAAU4D;;AAGlB;AACF;AAEA,MAAMP,+BAAAA,GAAkC,CACtChG,SAAAA,GAEA,aAAA,IAAiBA,aAAa,OAAOA,SAAAA,CAAUiG,WAAW,KAAK,QAAA;;;;;;"}
@@ -281,7 +281,8 @@ const CustomMediaInput = (props)=>{
281
281
  * @description An abstraction around the regular form input renderer designed specifically
282
282
  * to be used on the History page in the content-manager. It understands how to render specific
283
283
  * inputs within the context of a history version (i.e. relations, media, ignored RBAC, etc...)
284
- */ const VersionInputRenderer = ({ visible, hint: providedHint, shouldIgnoreRBAC = false, labelAction, ...props })=>{
284
+ */ const VersionInputRenderer = ({ visible, hint: providedHint, shouldIgnoreRBAC = false, labelAction, // Not spread with the rest: design-system inputs have a `size` prop of their own.
285
+ size: _size, ...props })=>{
285
286
  const customLabelAction = getLabelAction(labelAction);
286
287
  const { formatMessage } = useIntl();
287
288
  const version = useHistoryContext('VersionContent', (state)=>state.selectedVersion);
@@ -1 +1 @@
1
- {"version":3,"file":"VersionInputRenderer.mjs","sources":["../../../../admin/src/history/components/VersionInputRenderer.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n useStrapiApp,\n useForm,\n InputRenderer as FormInputRenderer,\n useField,\n Form,\n} from '@strapi/admin/strapi-admin';\nimport { Alert, Box, Field, Flex, Link, Tooltip, Typography } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport { NavLink } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { COLLECTION_TYPES } from '../../constants/collections';\nimport { useDocumentRBAC } from '../../features/DocumentRBAC';\nimport { useDoc } from '../../hooks/useDocument';\nimport { useDocLayout } from '../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../hooks/useLazyComponents';\nimport { useTypedSelector } from '../../modules/hooks';\nimport { DocumentStatus } from '../../pages/EditView/components/DocumentStatus';\nimport { BlocksInput } from '../../pages/EditView/components/FormInputs/BlocksInput/BlocksInput';\nimport { ComponentInput } from '../../pages/EditView/components/FormInputs/Component/Input';\nimport {\n DynamicZone,\n useDynamicZone,\n} from '../../pages/EditView/components/FormInputs/DynamicZone/Field';\nimport { NotAllowedInput } from '../../pages/EditView/components/FormInputs/NotAllowed';\nimport { UIDInput } from '../../pages/EditView/components/FormInputs/UID';\nimport { Wysiwyg } from '../../pages/EditView/components/FormInputs/Wysiwyg/Field';\nimport { useFieldHint } from '../../pages/EditView/components/InputRenderer';\nimport { getRelationLabel } from '../../utils/relations';\nimport { useHistoryContext } from '../pages/History';\n\nimport { getRemaingFieldsLayout } from './VersionContent';\n\nimport type { EditFieldLayout } from '../../hooks/useDocumentLayout';\nimport type { RelationsFieldProps } from '../../pages/EditView/components/FormInputs/Relations/Relations';\nimport type { RelationResult } from '../../services/relations';\nimport type { Schema } from '@strapi/types';\nimport type { DistributiveOmit } from 'react-redux';\n\nconst StyledAlert = styled(Alert).attrs({ closeLabel: 'Close', onClose: () => {}, shadow: 'none' })`\n button {\n display: none;\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * CustomRelationInput\n * -----------------------------------------------------------------------------------------------*/\n\nconst LinkEllipsis = styled(Link)`\n display: block;\n\n & > span {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: block;\n }\n`;\n\nconst CustomRelationInput = (props: RelationsFieldProps) => {\n const { formatMessage } = useIntl();\n const emptyLabel = formatMessage({\n id: 'content-manager.containers.empty-label',\n defaultMessage: 'Untitled',\n });\n const field = useField<\n { results: RelationResult[]; meta: { missingCount: number } } | RelationResult[]\n >(props.name);\n\n /**\n * Ideally the server would return the correct shape, however, for admin user relations\n * it sanitizes everything out when it finds an object for the relation value.\n */\n let formattedFieldValue;\n if (field) {\n formattedFieldValue = Array.isArray(field.value)\n ? { results: field.value, meta: { missingCount: 0 } }\n : field.value;\n }\n\n // Be defensive about the shape: admin-user relations are sanitized to a\n // plain user object on the server, and historical version data can carry\n // shapes that pre-date the `{ results, meta }` contract. Treat anything\n // without an array `results` as \"no relations\".\n const hasResultsShape =\n !!formattedFieldValue &&\n typeof formattedFieldValue === 'object' &&\n Array.isArray((formattedFieldValue as { results?: unknown }).results);\n const missingCount =\n hasResultsShape &&\n typeof (formattedFieldValue as { meta?: { missingCount?: number } }).meta?.missingCount ===\n 'number'\n ? (formattedFieldValue as { meta: { missingCount: number } }).meta.missingCount\n : 0;\n\n if (\n !hasResultsShape ||\n ((formattedFieldValue as { results: unknown[] }).results.length === 0 && missingCount === 0)\n ) {\n return (\n <>\n <Field.Label action={props.labelAction}>{props.label}</Field.Label>\n <Box marginTop={1}>\n <StyledAlert variant=\"default\">\n {formatMessage({\n id: 'content-manager.history.content.no-relations',\n defaultMessage: 'No relations.',\n })}\n </StyledAlert>\n </Box>\n </>\n );\n }\n\n const { results, meta } = formattedFieldValue as {\n results: RelationResult[];\n meta: { missingCount: number };\n };\n\n return (\n <Box>\n <Field.Label>{props.label}</Field.Label>\n {results.length > 0 && (\n <Flex direction=\"column\" gap={2} marginTop={1} alignItems=\"stretch\">\n {results.map((relationData) => {\n // @ts-expect-error - targetModel does exist on the attribute. But it's not typed.\n const { targetModel } = props.attribute;\n const href = `../${COLLECTION_TYPES}/${targetModel}/${relationData.documentId}`;\n const label = getRelationLabel(relationData, props.mainField, emptyLabel);\n const isAdminUserRelation = targetModel === 'admin::user';\n\n return (\n <Flex\n key={relationData.documentId ?? relationData.id}\n paddingTop={2}\n paddingBottom={2}\n paddingLeft={4}\n paddingRight={4}\n hasRadius\n borderColor=\"neutral200\"\n background=\"neutral150\"\n justifyContent=\"space-between\"\n >\n <Box minWidth={0} paddingTop={1} paddingBottom={1} paddingRight={4}>\n <Tooltip label={label}>\n {isAdminUserRelation ? (\n <Typography>{label}</Typography>\n ) : (\n <LinkEllipsis tag={NavLink} to={href}>\n {label}\n </LinkEllipsis>\n )}\n </Tooltip>\n </Box>\n <DocumentStatus status={relationData.status as string} />\n </Flex>\n );\n })}\n </Flex>\n )}\n {meta.missingCount > 0 && (\n <StyledAlert\n marginTop={1}\n variant=\"warning\"\n title={formatMessage(\n {\n id: 'content-manager.history.content.missing-relations.title',\n defaultMessage:\n '{number, plural, =1 {Missing relation} other {{number} missing relations}}',\n },\n { number: meta.missingCount }\n )}\n >\n {formatMessage(\n {\n id: 'content-manager.history.content.missing-relations.message',\n defaultMessage:\n \"{number, plural, =1 {It has} other {They have}} been deleted and can't be restored.\",\n },\n { number: meta.missingCount }\n )}\n </StyledAlert>\n )}\n </Box>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * CustomMediaInput\n * -----------------------------------------------------------------------------------------------*/\n\n// Create an object with value at key path (i.e. 'a.b.c')\nconst createInitialValuesForPath = (keyPath: string, value: unknown) => {\n const keys = keyPath.split('.');\n // The root level object\n const root: Record<string, unknown> = {};\n\n // Make the first node the root\n let node = root;\n keys.forEach((key, index) => {\n // Skip prototype pollution keys\n if (key === '__proto__' || key === 'constructor') return;\n // If it's the last key, set the node value\n if (index === keys.length - 1) {\n node[key] = value;\n } else {\n // Ensure the key exists and is an object\n const nextNode =\n typeof node[key] === 'object' && node[key] !== null && Array.isArray(node[key]) === false\n ? (node[key] as Record<string, unknown>)\n : {};\n node[key] = nextNode;\n node = nextNode;\n }\n });\n\n return root;\n};\n\nconst CustomMediaInput = (props: VersionInputRendererProps) => {\n const { value } = useField<{ results: unknown[]; meta: { missingCount: number } }>(props.name);\n const results = value?.results ?? [];\n const meta = value?.meta ?? { missingCount: 0 };\n\n const { formatMessage } = useIntl();\n\n const fields = useStrapiApp('CustomMediaInput', (state) => state.fields);\n const MediaLibrary = fields.media as React.ComponentType<\n VersionInputRendererProps & { multiple: boolean }\n >;\n\n return (\n <Flex direction=\"column\" gap={2} alignItems=\"stretch\">\n <Form\n method=\"PUT\"\n disabled={true}\n initialValues={createInitialValuesForPath(props.name, results)}\n >\n <MediaLibrary {...props} disabled={true} multiple={results.length > 1} />\n </Form>\n {meta.missingCount > 0 && (\n <StyledAlert\n variant=\"warning\"\n closeLabel=\"Close\"\n onClose={() => {}}\n title={formatMessage(\n {\n id: 'content-manager.history.content.missing-assets.title',\n defaultMessage:\n '{number, plural, =1 {Missing asset} other {{number} missing assets}}',\n },\n { number: meta.missingCount }\n )}\n >\n {formatMessage(\n {\n id: 'content-manager.history.content.missing-assets.message',\n defaultMessage:\n \"{number, plural, =1 {It has} other {They have}} been deleted in the Media Library and can't be restored.\",\n },\n { number: meta.missingCount }\n )}\n </StyledAlert>\n )}\n </Flex>\n );\n};\n\ntype VersionInputRendererProps = DistributiveOmit<EditFieldLayout, 'size'> & {\n /**\n * In the context of content history, deleted fields need to ignore RBAC\n * @default false\n */\n shouldIgnoreRBAC?: boolean;\n};\n\n/**\n * Checks if the i18n plugin added a label action to the field and modifies it\n * to adapt the wording for the history page.\n */\nconst getLabelAction = (labelAction: VersionInputRendererProps['labelAction']) => {\n if (!React.isValidElement(labelAction)) {\n return labelAction;\n }\n\n // TODO: find a better way to do this rather than access internals\n const labelActionTitleId = labelAction.props.title.id;\n\n if (labelActionTitleId === 'i18n.Field.localized') {\n return React.cloneElement(labelAction, {\n ...labelAction.props,\n title: {\n id: 'history.content.localized',\n defaultMessage:\n 'This value is specific to this locale. If you restore this version, the content will not be replaced for other locales.',\n },\n });\n }\n\n if (labelActionTitleId === 'i18n.Field.not-localized') {\n return React.cloneElement(labelAction, {\n ...labelAction.props,\n title: {\n id: 'history.content.not-localized',\n defaultMessage:\n 'This value is common to all locales. If you restore this version and save the changes, the content will be replaced for all locales.',\n },\n });\n }\n\n // Label action is unrelated to i18n, don't touch it.\n return labelAction;\n};\n\n/**\n * Resolve the layout, configuration metadata and schema attributes needed to\n * render a component field on the history page. Returns `null` when any of\n * those are missing — happens when the component schema referenced by the\n * version was deleted via the Content-Type Builder, in which case the caller\n * should render a fallback instead of crashing on the destructuring.\n */\nconst resolveComponentRenderResources = (\n componentUID: string,\n componentsLayout: { [uid: string]: { layout: unknown } | undefined },\n configurationComponents: { [uid: string]: { metadatas: unknown } | undefined },\n components: { [uid: string]: { attributes: unknown } | undefined }\n) => {\n const componentLayout = componentsLayout[componentUID];\n const componentConfiguration = configurationComponents[componentUID];\n const componentSchema = components[componentUID];\n\n if (!componentLayout || !componentConfiguration || !componentSchema) {\n return null;\n }\n\n return {\n layout: componentLayout.layout,\n metadatas: componentConfiguration.metadatas,\n schemaAttributes: componentSchema.attributes,\n };\n};\n\n/**\n * @internal\n *\n * @description An abstraction around the regular form input renderer designed specifically\n * to be used on the History page in the content-manager. It understands how to render specific\n * inputs within the context of a history version (i.e. relations, media, ignored RBAC, etc...)\n */\nconst VersionInputRenderer = ({\n visible,\n hint: providedHint,\n shouldIgnoreRBAC = false,\n labelAction,\n ...props\n}: VersionInputRendererProps) => {\n const customLabelAction = getLabelAction(labelAction);\n\n const { formatMessage } = useIntl();\n const version = useHistoryContext('VersionContent', (state) => state.selectedVersion);\n const configuration = useHistoryContext('VersionContent', (state) => state.configuration);\n const fieldSizes = useTypedSelector((state) => state['content-manager'].app.fieldSizes);\n\n const { id, components } = useDoc();\n const isFormDisabled = useForm('InputRenderer', (state) => state.disabled);\n\n const isInDynamicZone = useDynamicZone('isInDynamicZone', (state) => state.isInDynamicZone);\n\n const canCreateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canCreateFields);\n const canReadFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canReadFields);\n const canUpdateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUpdateFields);\n const canUserAction = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUserAction);\n\n const editableFields = id ? canUpdateFields : canCreateFields;\n const readableFields = id ? canReadFields : canCreateFields;\n /**\n * Component fields are always readable and editable,\n * however the fields within them may not be.\n */\n const canUserReadField = canUserAction(props.name, readableFields, props.type);\n const canUserEditField = canUserAction(props.name, editableFields, props.type);\n\n const fields = useStrapiApp('InputRenderer', (app) => app.fields);\n const { lazyComponentStore } = useLazyComponents(\n attributeHasCustomFieldProperty(props.attribute) ? [props.attribute.customField] : undefined\n );\n\n const hint = useFieldHint(providedHint, props.attribute);\n const {\n edit: { components: componentsLayout },\n } = useDocLayout();\n\n if (!visible) {\n return null;\n }\n\n /**\n * Don't render the field if the user can't read it.\n */\n if (!shouldIgnoreRBAC && !canUserReadField && !isInDynamicZone) {\n return <NotAllowedInput hint={hint} {...props} />;\n }\n\n const fieldIsDisabled =\n (!canUserEditField && !isInDynamicZone) || props.disabled || isFormDisabled;\n\n /**\n * Attributes found on the current content-type schema cannot be restored. We handle\n * this by displaying a warning alert to the user instead of the input for that field type.\n */\n const addedAttributes = version.meta.unknownAttributes.added;\n if (Object.keys(addedAttributes).includes(props.name)) {\n return (\n <Flex direction=\"column\" alignItems=\"flex-start\" gap={1}>\n <Field.Label>{props.label}</Field.Label>\n <StyledAlert\n width=\"100%\"\n closeLabel=\"Close\"\n onClose={() => {}}\n variant=\"warning\"\n title={formatMessage({\n id: 'content-manager.history.content.new-field.title',\n defaultMessage: 'New field',\n })}\n >\n {formatMessage({\n id: 'content-manager.history.content.new-field.message',\n defaultMessage:\n \"This field didn't exist when this version was saved. If you restore this version, it will be empty.\",\n })}\n </StyledAlert>\n </Flex>\n );\n }\n\n /**\n * Because a custom field has a unique prop but the type could be confused with either\n * the useField hook or the type of the field we need to handle it separately and first.\n */\n if (attributeHasCustomFieldProperty(props.attribute)) {\n const CustomInput = lazyComponentStore[props.attribute.customField];\n\n if (CustomInput) {\n return (\n <CustomInput\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n return (\n <FormInputRenderer\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n // @ts-expect-error – this workaround lets us display that the custom field is missing.\n type={props.attribute.customField}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * Since media fields use a custom input via the upload plugin provided by the useLibrary hook,\n * we need to handle the them before other custom inputs coming from the useLibrary hook.\n */\n if (props.type === 'media') {\n return (\n <CustomMediaInput {...props} labelAction={customLabelAction} disabled={fieldIsDisabled} />\n );\n }\n /**\n * This is where we handle ONLY the fields from the `useLibrary` hook.\n */\n const addedInputTypes = Object.keys(fields);\n if (!attributeHasCustomFieldProperty(props.attribute) && addedInputTypes.includes(props.type)) {\n const CustomInput = fields[props.type];\n return (\n <CustomInput\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLibrary hook.\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * These include the content-manager specific fields, failing that we fall back\n * to the more generic form input renderer.\n */\n switch (props.type) {\n case 'blocks':\n return <BlocksInput {...props} hint={hint} type={props.type} disabled={fieldIsDisabled} />;\n case 'component': {\n const renderResources = resolveComponentRenderResources(\n props.attribute.component,\n componentsLayout,\n configuration.components,\n components\n );\n\n // The component schema referenced by this version is no longer present\n // (deleted via the Content-Type Builder). Render the label only so the\n // rest of the page still loads instead of crashing on the lookups below.\n if (!renderResources) {\n return <Field.Label>{props.label}</Field.Label>;\n }\n\n const { layout, metadatas, schemaAttributes } = renderResources as {\n layout: Array<EditFieldLayout[]>;\n metadatas: Parameters<typeof getRemaingFieldsLayout>[0]['metadatas'];\n schemaAttributes: Parameters<typeof getRemaingFieldsLayout>[0]['schemaAttributes'];\n };\n\n // Components can only have one panel, so only save the first layout item\n const [remainingFieldsLayout] = getRemaingFieldsLayout({\n layout: [layout],\n metadatas,\n fieldSizes,\n schemaAttributes,\n });\n\n return (\n <ComponentInput\n {...props}\n layout={[...layout, ...(remainingFieldsLayout || [])]}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n >\n {(inputProps) => <VersionInputRenderer {...inputProps} shouldIgnoreRBAC={true} />}\n </ComponentInput>\n );\n }\n case 'dynamiczone':\n return (\n <DynamicZone\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n >\n {(inputProps) => <VersionInputRenderer {...inputProps} shouldIgnoreRBAC={true} />}\n </DynamicZone>\n );\n case 'relation':\n return (\n <CustomRelationInput\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n case 'richtext':\n return (\n <Wysiwyg\n {...props}\n hint={hint}\n type={props.type}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n case 'uid':\n return (\n <UIDInput\n {...props}\n hint={hint}\n type={props.type}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n /**\n * Enumerations are a special case because they require options.\n */\n case 'enumeration':\n return (\n <FormInputRenderer\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n options={props.attribute.enum.map((value) => ({ value }))}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n default:\n // These props are not needed for the generic form input renderer.\n const { unique: _unique, mainField: _mainField, ...restProps } = props;\n return (\n <FormInputRenderer\n {...restProps}\n hint={hint}\n labelAction={customLabelAction}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n }\n};\n\nconst attributeHasCustomFieldProperty = (\n attribute: Schema.Attribute.AnyAttribute\n): attribute is Schema.Attribute.AnyAttribute & Schema.Attribute.CustomField<string> =>\n 'customField' in attribute && typeof attribute.customField === 'string';\n\nexport type { VersionInputRendererProps };\nexport { VersionInputRenderer, CustomRelationInput, resolveComponentRenderResources };\n"],"names":["StyledAlert","styled","Alert","attrs","closeLabel","onClose","shadow","LinkEllipsis","Link","CustomRelationInput","props","formatMessage","useIntl","emptyLabel","id","defaultMessage","field","useField","name","formattedFieldValue","Array","isArray","value","results","meta","missingCount","hasResultsShape","length","_jsxs","_Fragment","_jsx","Field","Label","action","labelAction","label","Box","marginTop","variant","Flex","direction","gap","alignItems","map","relationData","targetModel","attribute","href","COLLECTION_TYPES","documentId","getRelationLabel","mainField","isAdminUserRelation","paddingTop","paddingBottom","paddingLeft","paddingRight","hasRadius","borderColor","background","justifyContent","minWidth","Tooltip","Typography","tag","NavLink","to","DocumentStatus","status","title","number","createInitialValuesForPath","keyPath","keys","split","root","node","forEach","key","index","nextNode","CustomMediaInput","fields","useStrapiApp","state","MediaLibrary","media","Form","method","disabled","initialValues","multiple","getLabelAction","React","isValidElement","labelActionTitleId","cloneElement","resolveComponentRenderResources","componentUID","componentsLayout","configurationComponents","components","componentLayout","componentConfiguration","componentSchema","layout","metadatas","schemaAttributes","attributes","VersionInputRenderer","visible","hint","providedHint","shouldIgnoreRBAC","customLabelAction","version","useHistoryContext","selectedVersion","configuration","fieldSizes","useTypedSelector","app","useDoc","isFormDisabled","useForm","isInDynamicZone","useDynamicZone","canCreateFields","useDocumentRBAC","rbac","canReadFields","canUpdateFields","canUserAction","editableFields","readableFields","canUserReadField","type","canUserEditField","lazyComponentStore","useLazyComponents","attributeHasCustomFieldProperty","customField","undefined","useFieldHint","edit","useDocLayout","NotAllowedInput","fieldIsDisabled","addedAttributes","unknownAttributes","added","Object","includes","width","CustomInput","FormInputRenderer","addedInputTypes","BlocksInput","renderResources","component","remainingFieldsLayout","getRemaingFieldsLayout","ComponentInput","inputProps","DynamicZone","Wysiwy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AAAA,EAAW,GAAGlK,KAAAA;AACjE,YAAA,qBACEoB,GAAA,CAAC6H,aAAAA,EAAAA;AACE,gBAAA,GAAGiB,SAAS;gBACb7D,IAAAA,EAAMA,IAAAA;gBACN7E,WAAAA,EAAagF,iBAAAA;;AAEbsB,gBAAAA,IAAAA,EAAM9H,KAAAA,CAAMmI,WAAW,GAAG,cAAA,GAAiBnI,MAAM8H,IAAI;gBACrD/C,QAAAA,EAAU0D;;AAGlB;AACF;AAEA,MAAMP,+BAAAA,GAAkC,CACtC9F,SAAAA,GAEA,aAAA,IAAiBA,aAAa,OAAOA,SAAAA,CAAU+F,WAAW,KAAK,QAAA;;;;"}
1
+ {"version":3,"file":"VersionInputRenderer.mjs","sources":["../../../../admin/src/history/components/VersionInputRenderer.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n useStrapiApp,\n useForm,\n InputRenderer as FormInputRenderer,\n useField,\n Form,\n} from '@strapi/admin/strapi-admin';\nimport { Alert, Box, Field, Flex, Link, Tooltip, Typography } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport { NavLink } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { COLLECTION_TYPES } from '../../constants/collections';\nimport { useDocumentRBAC } from '../../features/DocumentRBAC';\nimport { useDoc } from '../../hooks/useDocument';\nimport { useDocLayout } from '../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../hooks/useLazyComponents';\nimport { useTypedSelector } from '../../modules/hooks';\nimport { DocumentStatus } from '../../pages/EditView/components/DocumentStatus';\nimport { BlocksInput } from '../../pages/EditView/components/FormInputs/BlocksInput/BlocksInput';\nimport { ComponentInput } from '../../pages/EditView/components/FormInputs/Component/Input';\nimport {\n DynamicZone,\n useDynamicZone,\n} from '../../pages/EditView/components/FormInputs/DynamicZone/Field';\nimport { NotAllowedInput } from '../../pages/EditView/components/FormInputs/NotAllowed';\nimport { UIDInput } from '../../pages/EditView/components/FormInputs/UID';\nimport { Wysiwyg } from '../../pages/EditView/components/FormInputs/Wysiwyg/Field';\nimport { useFieldHint } from '../../pages/EditView/components/InputRenderer';\nimport { getRelationLabel } from '../../utils/relations';\nimport { useHistoryContext } from '../pages/History';\n\nimport { getRemaingFieldsLayout } from './VersionContent';\n\nimport type { EditFieldLayout } from '../../hooks/useDocumentLayout';\nimport type { RelationsFieldProps } from '../../pages/EditView/components/FormInputs/Relations/Relations';\nimport type { RelationResult } from '../../services/relations';\nimport type { Schema } from '@strapi/types';\nimport type { DistributiveOmit } from 'react-redux';\n\nconst StyledAlert = styled(Alert).attrs({ closeLabel: 'Close', onClose: () => {}, shadow: 'none' })`\n button {\n display: none;\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * CustomRelationInput\n * -----------------------------------------------------------------------------------------------*/\n\nconst LinkEllipsis = styled(Link)`\n display: block;\n\n & > span {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: block;\n }\n`;\n\nconst CustomRelationInput = (props: RelationsFieldProps) => {\n const { formatMessage } = useIntl();\n const emptyLabel = formatMessage({\n id: 'content-manager.containers.empty-label',\n defaultMessage: 'Untitled',\n });\n const field = useField<\n { results: RelationResult[]; meta: { missingCount: number } } | RelationResult[]\n >(props.name);\n\n /**\n * Ideally the server would return the correct shape, however, for admin user relations\n * it sanitizes everything out when it finds an object for the relation value.\n */\n let formattedFieldValue;\n if (field) {\n formattedFieldValue = Array.isArray(field.value)\n ? { results: field.value, meta: { missingCount: 0 } }\n : field.value;\n }\n\n // Be defensive about the shape: admin-user relations are sanitized to a\n // plain user object on the server, and historical version data can carry\n // shapes that pre-date the `{ results, meta }` contract. Treat anything\n // without an array `results` as \"no relations\".\n const hasResultsShape =\n !!formattedFieldValue &&\n typeof formattedFieldValue === 'object' &&\n Array.isArray((formattedFieldValue as { results?: unknown }).results);\n const missingCount =\n hasResultsShape &&\n typeof (formattedFieldValue as { meta?: { missingCount?: number } }).meta?.missingCount ===\n 'number'\n ? (formattedFieldValue as { meta: { missingCount: number } }).meta.missingCount\n : 0;\n\n if (\n !hasResultsShape ||\n ((formattedFieldValue as { results: unknown[] }).results.length === 0 && missingCount === 0)\n ) {\n return (\n <>\n <Field.Label action={props.labelAction}>{props.label}</Field.Label>\n <Box marginTop={1}>\n <StyledAlert variant=\"default\">\n {formatMessage({\n id: 'content-manager.history.content.no-relations',\n defaultMessage: 'No relations.',\n })}\n </StyledAlert>\n </Box>\n </>\n );\n }\n\n const { results, meta } = formattedFieldValue as {\n results: RelationResult[];\n meta: { missingCount: number };\n };\n\n return (\n <Box>\n <Field.Label>{props.label}</Field.Label>\n {results.length > 0 && (\n <Flex direction=\"column\" gap={2} marginTop={1} alignItems=\"stretch\">\n {results.map((relationData) => {\n // @ts-expect-error - targetModel does exist on the attribute. But it's not typed.\n const { targetModel } = props.attribute;\n const href = `../${COLLECTION_TYPES}/${targetModel}/${relationData.documentId}`;\n const label = getRelationLabel(relationData, props.mainField, emptyLabel);\n const isAdminUserRelation = targetModel === 'admin::user';\n\n return (\n <Flex\n key={relationData.documentId ?? relationData.id}\n paddingTop={2}\n paddingBottom={2}\n paddingLeft={4}\n paddingRight={4}\n hasRadius\n borderColor=\"neutral200\"\n background=\"neutral150\"\n justifyContent=\"space-between\"\n >\n <Box minWidth={0} paddingTop={1} paddingBottom={1} paddingRight={4}>\n <Tooltip label={label}>\n {isAdminUserRelation ? (\n <Typography>{label}</Typography>\n ) : (\n <LinkEllipsis tag={NavLink} to={href}>\n {label}\n </LinkEllipsis>\n )}\n </Tooltip>\n </Box>\n <DocumentStatus status={relationData.status as string} />\n </Flex>\n );\n })}\n </Flex>\n )}\n {meta.missingCount > 0 && (\n <StyledAlert\n marginTop={1}\n variant=\"warning\"\n title={formatMessage(\n {\n id: 'content-manager.history.content.missing-relations.title',\n defaultMessage:\n '{number, plural, =1 {Missing relation} other {{number} missing relations}}',\n },\n { number: meta.missingCount }\n )}\n >\n {formatMessage(\n {\n id: 'content-manager.history.content.missing-relations.message',\n defaultMessage:\n \"{number, plural, =1 {It has} other {They have}} been deleted and can't be restored.\",\n },\n { number: meta.missingCount }\n )}\n </StyledAlert>\n )}\n </Box>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * CustomMediaInput\n * -----------------------------------------------------------------------------------------------*/\n\n// Create an object with value at key path (i.e. 'a.b.c')\nconst createInitialValuesForPath = (keyPath: string, value: unknown) => {\n const keys = keyPath.split('.');\n // The root level object\n const root: Record<string, unknown> = {};\n\n // Make the first node the root\n let node = root;\n keys.forEach((key, index) => {\n // Skip prototype pollution keys\n if (key === '__proto__' || key === 'constructor') return;\n // If it's the last key, set the node value\n if (index === keys.length - 1) {\n node[key] = value;\n } else {\n // Ensure the key exists and is an object\n const nextNode =\n typeof node[key] === 'object' && node[key] !== null && Array.isArray(node[key]) === false\n ? (node[key] as Record<string, unknown>)\n : {};\n node[key] = nextNode;\n node = nextNode;\n }\n });\n\n return root;\n};\n\nconst CustomMediaInput = (props: VersionInputRendererProps) => {\n const { value } = useField<{ results: unknown[]; meta: { missingCount: number } }>(props.name);\n const results = value?.results ?? [];\n const meta = value?.meta ?? { missingCount: 0 };\n\n const { formatMessage } = useIntl();\n\n const fields = useStrapiApp('CustomMediaInput', (state) => state.fields);\n const MediaLibrary = fields.media as React.ComponentType<\n VersionInputRendererProps & { multiple: boolean }\n >;\n\n return (\n <Flex direction=\"column\" gap={2} alignItems=\"stretch\">\n <Form\n method=\"PUT\"\n disabled={true}\n initialValues={createInitialValuesForPath(props.name, results)}\n >\n <MediaLibrary {...props} disabled={true} multiple={results.length > 1} />\n </Form>\n {meta.missingCount > 0 && (\n <StyledAlert\n variant=\"warning\"\n closeLabel=\"Close\"\n onClose={() => {}}\n title={formatMessage(\n {\n id: 'content-manager.history.content.missing-assets.title',\n defaultMessage:\n '{number, plural, =1 {Missing asset} other {{number} missing assets}}',\n },\n { number: meta.missingCount }\n )}\n >\n {formatMessage(\n {\n id: 'content-manager.history.content.missing-assets.message',\n defaultMessage:\n \"{number, plural, =1 {It has} other {They have}} been deleted in the Media Library and can't be restored.\",\n },\n { number: meta.missingCount }\n )}\n </StyledAlert>\n )}\n </Flex>\n );\n};\n\ntype VersionInputRendererProps = DistributiveOmit<EditFieldLayout, 'size'> & {\n /**\n * In the context of content history, deleted fields need to ignore RBAC\n * @default false\n */\n shouldIgnoreRBAC?: boolean;\n /** Passed down by component and dynamic zone layouts; not used here. */\n size?: number;\n};\n\n/**\n * Checks if the i18n plugin added a label action to the field and modifies it\n * to adapt the wording for the history page.\n */\nconst getLabelAction = (labelAction: VersionInputRendererProps['labelAction']) => {\n if (!React.isValidElement(labelAction)) {\n return labelAction;\n }\n\n // TODO: find a better way to do this rather than access internals\n const labelActionTitleId = labelAction.props.title.id;\n\n if (labelActionTitleId === 'i18n.Field.localized') {\n return React.cloneElement(labelAction, {\n ...labelAction.props,\n title: {\n id: 'history.content.localized',\n defaultMessage:\n 'This value is specific to this locale. If you restore this version, the content will not be replaced for other locales.',\n },\n });\n }\n\n if (labelActionTitleId === 'i18n.Field.not-localized') {\n return React.cloneElement(labelAction, {\n ...labelAction.props,\n title: {\n id: 'history.content.not-localized',\n defaultMessage:\n 'This value is common to all locales. If you restore this version and save the changes, the content will be replaced for all locales.',\n },\n });\n }\n\n // Label action is unrelated to i18n, don't touch it.\n return labelAction;\n};\n\n/**\n * Resolve the layout, configuration metadata and schema attributes needed to\n * render a component field on the history page. Returns `null` when any of\n * those are missing — happens when the component schema referenced by the\n * version was deleted via the Content-Type Builder, in which case the caller\n * should render a fallback instead of crashing on the destructuring.\n */\nconst resolveComponentRenderResources = (\n componentUID: string,\n componentsLayout: { [uid: string]: { layout: unknown } | undefined },\n configurationComponents: { [uid: string]: { metadatas: unknown } | undefined },\n components: { [uid: string]: { attributes: unknown } | undefined }\n) => {\n const componentLayout = componentsLayout[componentUID];\n const componentConfiguration = configurationComponents[componentUID];\n const componentSchema = components[componentUID];\n\n if (!componentLayout || !componentConfiguration || !componentSchema) {\n return null;\n }\n\n return {\n layout: componentLayout.layout,\n metadatas: componentConfiguration.metadatas,\n schemaAttributes: componentSchema.attributes,\n };\n};\n\n/**\n * @internal\n *\n * @description An abstraction around the regular form input renderer designed specifically\n * to be used on the History page in the content-manager. It understands how to render specific\n * inputs within the context of a history version (i.e. relations, media, ignored RBAC, etc...)\n */\nconst VersionInputRenderer = ({\n visible,\n hint: providedHint,\n shouldIgnoreRBAC = false,\n labelAction,\n // Not spread with the rest: design-system inputs have a `size` prop of their own.\n size: _size,\n ...props\n}: VersionInputRendererProps) => {\n const customLabelAction = getLabelAction(labelAction);\n\n const { formatMessage } = useIntl();\n const version = useHistoryContext('VersionContent', (state) => state.selectedVersion);\n const configuration = useHistoryContext('VersionContent', (state) => state.configuration);\n const fieldSizes = useTypedSelector((state) => state['content-manager'].app.fieldSizes);\n\n const { id, components } = useDoc();\n const isFormDisabled = useForm('InputRenderer', (state) => state.disabled);\n\n const isInDynamicZone = useDynamicZone('isInDynamicZone', (state) => state.isInDynamicZone);\n\n const canCreateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canCreateFields);\n const canReadFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canReadFields);\n const canUpdateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUpdateFields);\n const canUserAction = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUserAction);\n\n const editableFields = id ? canUpdateFields : canCreateFields;\n const readableFields = id ? canReadFields : canCreateFields;\n /**\n * Component fields are always readable and editable,\n * however the fields within them may not be.\n */\n const canUserReadField = canUserAction(props.name, readableFields, props.type);\n const canUserEditField = canUserAction(props.name, editableFields, props.type);\n\n const fields = useStrapiApp('InputRenderer', (app) => app.fields);\n const { lazyComponentStore } = useLazyComponents(\n attributeHasCustomFieldProperty(props.attribute) ? [props.attribute.customField] : undefined\n );\n\n const hint = useFieldHint(providedHint, props.attribute);\n const {\n edit: { components: componentsLayout },\n } = useDocLayout();\n\n if (!visible) {\n return null;\n }\n\n /**\n * Don't render the field if the user can't read it.\n */\n if (!shouldIgnoreRBAC && !canUserReadField && !isInDynamicZone) {\n return <NotAllowedInput hint={hint} {...props} />;\n }\n\n const fieldIsDisabled =\n (!canUserEditField && !isInDynamicZone) || props.disabled || isFormDisabled;\n\n /**\n * Attributes found on the current content-type schema cannot be restored. We handle\n * this by displaying a warning alert to the user instead of the input for that field type.\n */\n const addedAttributes = version.meta.unknownAttributes.added;\n if (Object.keys(addedAttributes).includes(props.name)) {\n return (\n <Flex direction=\"column\" alignItems=\"flex-start\" gap={1}>\n <Field.Label>{props.label}</Field.Label>\n <StyledAlert\n width=\"100%\"\n closeLabel=\"Close\"\n onClose={() => {}}\n variant=\"warning\"\n title={formatMessage({\n id: 'content-manager.history.content.new-field.title',\n defaultMessage: 'New field',\n })}\n >\n {formatMessage({\n id: 'content-manager.history.content.new-field.message',\n defaultMessage:\n \"This field didn't exist when this version was saved. If you restore this version, it will be empty.\",\n })}\n </StyledAlert>\n </Flex>\n );\n }\n\n /**\n * Because a custom field has a unique prop but the type could be confused with either\n * the useField hook or the type of the field we need to handle it separately and first.\n */\n if (attributeHasCustomFieldProperty(props.attribute)) {\n const CustomInput = lazyComponentStore[props.attribute.customField];\n\n if (CustomInput) {\n return (\n <CustomInput\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n return (\n <FormInputRenderer\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n // @ts-expect-error – this workaround lets us display that the custom field is missing.\n type={props.attribute.customField}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * Since media fields use a custom input via the upload plugin provided by the useLibrary hook,\n * we need to handle the them before other custom inputs coming from the useLibrary hook.\n */\n if (props.type === 'media') {\n return (\n <CustomMediaInput {...props} labelAction={customLabelAction} disabled={fieldIsDisabled} />\n );\n }\n /**\n * This is where we handle ONLY the fields from the `useLibrary` hook.\n */\n const addedInputTypes = Object.keys(fields);\n if (!attributeHasCustomFieldProperty(props.attribute) && addedInputTypes.includes(props.type)) {\n const CustomInput = fields[props.type];\n return (\n <CustomInput\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLibrary hook.\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * These include the content-manager specific fields, failing that we fall back\n * to the more generic form input renderer.\n */\n switch (props.type) {\n case 'blocks':\n return <BlocksInput {...props} hint={hint} type={props.type} disabled={fieldIsDisabled} />;\n case 'component': {\n const renderResources = resolveComponentRenderResources(\n props.attribute.component,\n componentsLayout,\n configuration.components,\n components\n );\n\n // The component schema referenced by this version is no longer present\n // (deleted via the Content-Type Builder). Render the label only so the\n // rest of the page still loads instead of crashing on the lookups below.\n if (!renderResources) {\n return <Field.Label>{props.label}</Field.Label>;\n }\n\n const { layout, metadatas, schemaAttributes } = renderResources as {\n layout: Array<EditFieldLayout[]>;\n metadatas: Parameters<typeof getRemaingFieldsLayout>[0]['metadatas'];\n schemaAttributes: Parameters<typeof getRemaingFieldsLayout>[0]['schemaAttributes'];\n };\n\n // Components can only have one panel, so only save the first layout item\n const [remainingFieldsLayout] = getRemaingFieldsLayout({\n layout: [layout],\n metadatas,\n fieldSizes,\n schemaAttributes,\n });\n\n return (\n <ComponentInput\n {...props}\n layout={[...layout, ...(remainingFieldsLayout || [])]}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n >\n {(inputProps) => <VersionInputRenderer {...inputProps} shouldIgnoreRBAC={true} />}\n </ComponentInput>\n );\n }\n case 'dynamiczone':\n return (\n <DynamicZone\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n >\n {(inputProps) => <VersionInputRenderer {...inputProps} shouldIgnoreRBAC={true} />}\n </DynamicZone>\n );\n case 'relation':\n return (\n <CustomRelationInput\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n case 'richtext':\n return (\n <Wysiwyg\n {...props}\n hint={hint}\n type={props.type}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n case 'uid':\n return (\n <UIDInput\n {...props}\n hint={hint}\n type={props.type}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n /**\n * Enumerations are a special case because they require options.\n */\n case 'enumeration':\n return (\n <FormInputRenderer\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n options={props.attribute.enum.map((value) => ({ value }))}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n default:\n // These props are not needed for the generic form input renderer.\n const { unique: _unique, mainField: _mainField, ...restProps } = props;\n return (\n <FormInputRenderer\n {...restProps}\n hint={hint}\n labelAction={customLabelAction}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n }\n};\n\nconst attributeHasCustomFieldProperty = (\n attribute: Schema.Attribute.AnyAttribute\n): attribute is Schema.Attribute.AnyAttribute & Schema.Attribute.CustomField<string> =>\n 'customField' in attribute && typeof attribute.customField === 'string';\n\nexport type { VersionInputRendererProps };\nexport { VersionInputRenderer, CustomRelationInput, resolveComponentRenderResources };\n"],"names":["StyledAlert","styled","Alert","attrs","closeLabel","onClose","shadow","LinkEllipsis","Link","CustomRelationInput","props","formatMessage","useIntl","emptyLabel","id","defaultMessage","field","useField","name","formattedFieldValue","Array","isArray","value","results","meta","missingCount","hasResultsShape","length","_jsxs","_Fragment","_jsx","Field","Label","action","labelAction","label","Box","marginTop","variant","Flex","direction","gap","alignItems","map","relationData","targetModel","attribute","href","COLLECTION_TYPES","documentId","getRelationLabel","mainField","isAdminUserRelation","paddingTop","paddingBottom","paddingLeft","paddingRight","hasRadius","borderColor","background","justifyContent","minWidth","Tooltip","Typography","tag","NavLink","to","DocumentStatus","status","title","number","createInitialValuesForPath","keyPath","keys","split","root","node","forEach","key","index","nextNode","CustomMediaInput","fields","useStrapiApp","state","MediaLibrary","media","Form","method","disabled","initialValues","multiple","getLabelAction","React","isValidElement","labelActionTitleId","cloneElement","resolveComponentRenderResources","componentUID","componentsLayout","configurationComponents","components","componentLayout","componentConfiguration","componentSchema","layout","metadatas","schemaAttributes","attributes","VersionInputRenderer","visible","hint","providedHint","shouldIgnoreRBAC","size","_size","customLabelAction","version","useHistoryContext","selectedVersion","configuration","fieldSizes","useTypedSelector","app","useDoc","isFormDisabled","useForm","isInDynamicZone","useDynamicZone","canCreateFields","useDocumentRBAC","rbac","canReadFields","canUpdateFields","canUserAction","editableFields","readableFields","canUserReadField","type","canUserEditField","lazyComponentStore","useLazyComponents","attributeHasCustomFieldProperty","customField","undefined","useFieldHint","edit","useDocLayout","NotAllowedInput","fieldIsDisabled","addedAttributes","unknownAttributes","added","Object","includes","width","CustomInput","FormInputRenderer","addedInputTypes","BlocksInput","renderResources","component","remainingFieldsLayout","getRemaingFieldsLayout","ComponentInput","inputProps","DynamicZone","Wysiwyg","UIDInput","options","enum","unique","_unique","_mainField","restProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAMA,WAAAA,GAAcC,MAAAA,CAAOC,KAAAA,CAAAA,CAAOC,KAAK,CAAC;IAAEC,UAAAA,EAAY,OAAA;AAASC,IAAAA,OAAAA,EAAS,IAAA,CAAO,CAAA;IAAGC,MAAAA,EAAQ;AAAO,CAAA,CAAE;;;;AAInG,CAAC;AAED;;AAEkG,qGAElG,MAAMC,YAAAA,GAAeN,MAAAA,CAAOO,IAAAA,CAAK;;;;;;;;;AASjC,CAAC;AAED,MAAMC,sBAAsB,CAACC,KAAAA,GAAAA;IAC3B,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAC1B,IAAA,MAAMC,aAAaF,aAAAA,CAAc;QAC/BG,EAAAA,EAAI,wCAAA;QACJC,cAAAA,EAAgB;AAClB,KAAA,CAAA;IACA,MAAMC,KAAAA,GAAQC,QAAAA,CAEZP,KAAAA,CAAMQ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KAAK;gBACTqG,IAAAA,EAAMA,IAAAA;AACN2B,gBAAAA,IAAAA,EAAMhI,MAAMgI,IAAI;gBAChBxG,WAAAA,EAAakF,iBAAAA;gBACb3B,QAAAA,EAAU4D;;AAGhB;;AAEC,QACD,KAAK,aAAA;AACH,YAAA,qBACEvH,GAAA,CAAC+H,aAAAA,EAAAA;AACE,gBAAA,GAAGnJ,KAAK;gBACTqG,IAAAA,EAAMA,IAAAA;gBACN7E,WAAAA,EAAakF,iBAAAA;gBACbqD,OAAAA,EAAS/J,KAAAA,CAAMoC,SAAS,CAAC4H,IAAI,CAAC/H,GAAG,CAAC,CAACrB,KAAAA,IAAW;AAAEA,wBAAAA;qBAAM,CAAA,CAAA;;AAEtDoH,gBAAAA,IAAAA,EAAMhI,KAAAA,CAAMqI,WAAW,GAAG,cAAA,GAAiBrI,MAAMgI,IAAI;gBACrDjD,QAAAA,EAAU4D;;AAGhB,QAAA;;YAEE,MAAM,EAAEsB,QAAQC,OAAO,EAAEzH,WAAW0H,UAAU,EAAE,GAAGC,SAAAA,EAAW,GAAGpK,KAAAA;AACjE,YAAA,qBACEoB,GAAA,CAAC+H,aAAAA,EAAAA;AACE,gBAAA,GAAGiB,SAAS;gBACb/D,IAAAA,EAAMA,IAAAA;gBACN7E,WAAAA,EAAakF,iBAAAA;;AAEbsB,gBAAAA,IAAAA,EAAMhI,KAAAA,CAAMqI,WAAW,GAAG,cAAA,GAAiBrI,MAAMgI,IAAI;gBACrDjD,QAAAA,EAAU4D;;AAGlB;AACF;AAEA,MAAMP,+BAAAA,GAAkC,CACtChG,SAAAA,GAEA,aAAA,IAAiBA,aAAa,OAAOA,SAAAA,CAAUiG,WAAW,KAAK,QAAA;;;;"}
@@ -87,6 +87,7 @@ const NonRepeatableComponentFields = /*#__PURE__*/ React__namespace.memo(({ attr
87
87
  alignItems: "stretch",
88
88
  children: children({
89
89
  ...field,
90
+ size,
90
91
  label: translatedLabel,
91
92
  name: completeFieldName
92
93
  })
@@ -1 +1 @@
1
- {"version":3,"file":"NonRepeatable.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Component/NonRepeatable.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useForm, useIsMobile } from '@strapi/admin/strapi-admin';\nimport { Box, Flex } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { getIn } from '../../../../../utils/objects';\nimport { ResponsiveGridItem, ResponsiveGridRoot } from '../../FormLayout';\nimport { ComponentProvider, useComponent } from '../ComponentContext';\n\nimport type { ComponentInputProps } from './Input';\n\ntype NonRepeatableComponentProps = Omit<ComponentInputProps, 'required' | 'label'>;\n\nconst NonRepeatableComponent = ({\n attribute,\n name,\n children,\n layout,\n}: NonRepeatableComponentProps) => {\n const componentId = useForm(\n 'NonRepeatableComponent',\n (state) => getIn(state.values, `${name}.id`) as number | undefined\n );\n const level = useComponent('NonRepeatableComponent', (state) => state.level);\n const isNested = level > 0;\n const isMobile = useIsMobile();\n\n return (\n <ComponentProvider\n id={componentId}\n uid={attribute.component}\n level={level + 1}\n type=\"component\"\n >\n <Box\n background={'neutral100'}\n padding={{ initial: 4, medium: 6 }}\n hasRadius={isNested}\n borderColor={isNested || isMobile ? 'neutral200' : undefined}\n >\n <NonRepeatableComponentFields attribute={attribute} name={name} layout={layout}>\n {children}\n </NonRepeatableComponentFields>\n </Box>\n </ComponentProvider>\n );\n};\n\ninterface NonRepeatableComponentFieldsProps extends Pick<\n NonRepeatableComponentProps,\n 'attribute' | 'children' | 'layout' | 'name'\n> {}\n\nconst NonRepeatableComponentFields = React.memo(\n ({ attribute, children, layout, name }: NonRepeatableComponentFieldsProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {layout.map((row) => {\n return (\n <ResponsiveGridRoot\n gap={{ initial: 3, medium: 4 }}\n key={row.map((field) => field.name).join('.')}\n >\n {row.map(({ size, ...field }) => {\n /**\n * Layouts are built from schemas so they don't understand the complete\n * schema tree, for components we append the parent name to the field name\n * because this is the structure for the data & permissions also understand\n * the nesting involved.\n */\n const completeFieldName = `${name}.${field.name}`;\n\n const translatedLabel = formatMessage({\n id: `content-manager.components.${attribute.component}.${field.name}`,\n defaultMessage: field.label,\n });\n\n return (\n <ResponsiveGridItem\n col={size}\n key={completeFieldName}\n s={12}\n xs={12}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n {children({\n ...field,\n label: translatedLabel,\n name: completeFieldName,\n })}\n </ResponsiveGridItem>\n );\n })}\n </ResponsiveGridRoot>\n );\n })}\n </Flex>\n );\n }\n);\n\nNonRepeatableComponentFields.displayName = 'NonRepeatableComponentFields';\n\nconst MemoizedNonRepeatableComponent = React.memo(NonRepeatableComponent);\n\nexport { MemoizedNonRepeatableComponent as NonRepeatableComponent };\nexport type { NonRepeatableComponentProps };\n"],"names":["NonRepeatableComponent","attribute","name","children","layout","componentId","useForm","state","getIn","values","level","useComponent","isNested","isMobile","useIsMobile","_jsx","ComponentProvider","id","uid","component","type","Box","background","padding","initial","medium","hasRadius","borderColor","undefined","NonRepeatableComponentFields","React","memo","formatMessage","useIntl","Flex","direction","alignItems","gap","map","row","ResponsiveGridRoot","size","field","completeFieldName","translatedLabel","defaultMessage","label","ResponsiveGridItem","col","s","xs","join","displayName","MemoizedNonRepeatableComponent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAMA,sBAAAA,GAAyB,CAAC,EAC9BC,SAAS,EACTC,IAAI,EACJC,QAAQ,EACRC,MAAM,EACsB,GAAA;AAC5B,IAAA,MAAMC,WAAAA,GAAcC,mBAAAA,CAClB,wBAAA,EACA,CAACC,KAAAA,GAAUC,aAAAA,CAAMD,KAAAA,CAAME,MAAM,EAAE,CAAA,EAAGP,IAAAA,CAAK,GAAG,CAAC,CAAA,CAAA;AAE7C,IAAA,MAAMQ,QAAQC,6BAAAA,CAAa,wBAAA,EAA0B,CAACJ,KAAAA,GAAUA,MAAMG,KAAK,CAAA;AAC3E,IAAA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5Bc,gBAAAA,QAAAA,EAAAA,GAAAA,CAAID,GAAG,CAAC,CAAC,EAAEG,IAAI,EAAE,GAAGC,KAAAA,EAAO,GAAA;AAC1B;;;;;oBAMA,MAAMC,oBAAoB,CAAA,EAAGzC,IAAAA,CAAK,CAAC,EAAEwC,KAAAA,CAAMxC,IAAI,CAAA,CAAE;AAEjD,oBAAA,MAAM0C,kBAAkBZ,aAAAA,CAAc;wBACpCf,EAAAA,EAAI,CAAC,2BAA2B,EAAEhB,SAAAA,CAAUkB,SAAS,CAAC,CAAC,EAAEuB,KAAAA,CAAMxC,IAAI,CAAA,CAAE;AACrE2C,wBAAAA,cAAAA,EAAgBH,MAAMI;AACxB,qBAAA,CAAA;AAEA,oBAAA,qBACE/B,cAAA,CAACgC,6BAAAA,EAAAA;wBACCC,GAAAA,EAAKP,IAAAA;wBAELQ,CAAAA,EAAG,EAAA;wBACHC,EAAAA,EAAI,EAAA;wBACJf,SAAAA,EAAU,QAAA;wBACVC,UAAAA,EAAW,SAAA;kCAEVjC,QAAAA,CAAS;AACR,4BAAA,GAAGuC,KAAK;4BACRI,KAAAA,EAAOF,eAAAA;4BACP1C,IAAAA,EAAMyC;AACR,yBAAA;AAVKA,qBAAAA,EAAAA,iBAAAA,CAAAA;AAaX,gBAAA,CAAA;eAhCKJ,GAAAA,CAAID,GAAG,CAAC,CAACI,KAAAA,GAAUA,MAAMxC,IAAI,CAAA,CAAEiD,IAAI,CAAC,GAAA,CAAA,CAAA;AAmC/C,QAAA,CAAA;;AAGN,CAAA,CAAA;AAGFtB,4BAAAA,CAA6BuB,WAAW,GAAG,8BAAA;AAE3C,MAAMC,8BAAAA,iBAAiCvB,gBAAAA,CAAMC,IAAI,CAAC/B,sBAAAA;;;;"}
1
+ {"version":3,"file":"NonRepeatable.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Component/NonRepeatable.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useForm, useIsMobile } from '@strapi/admin/strapi-admin';\nimport { Box, Flex } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { getIn } from '../../../../../utils/objects';\nimport { ResponsiveGridItem, ResponsiveGridRoot } from '../../FormLayout';\nimport { ComponentProvider, useComponent } from '../ComponentContext';\n\nimport type { ComponentInputProps } from './Input';\n\ntype NonRepeatableComponentProps = Omit<ComponentInputProps, 'required' | 'label'>;\n\nconst NonRepeatableComponent = ({\n attribute,\n name,\n children,\n layout,\n}: NonRepeatableComponentProps) => {\n const componentId = useForm(\n 'NonRepeatableComponent',\n (state) => getIn(state.values, `${name}.id`) as number | undefined\n );\n const level = useComponent('NonRepeatableComponent', (state) => state.level);\n const isNested = level > 0;\n const isMobile = useIsMobile();\n\n return (\n <ComponentProvider\n id={componentId}\n uid={attribute.component}\n level={level + 1}\n type=\"component\"\n >\n <Box\n background={'neutral100'}\n padding={{ initial: 4, medium: 6 }}\n hasRadius={isNested}\n borderColor={isNested || isMobile ? 'neutral200' : undefined}\n >\n <NonRepeatableComponentFields attribute={attribute} name={name} layout={layout}>\n {children}\n </NonRepeatableComponentFields>\n </Box>\n </ComponentProvider>\n );\n};\n\ninterface NonRepeatableComponentFieldsProps extends Pick<\n NonRepeatableComponentProps,\n 'attribute' | 'children' | 'layout' | 'name'\n> {}\n\nconst NonRepeatableComponentFields = React.memo(\n ({ attribute, children, layout, name }: NonRepeatableComponentFieldsProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {layout.map((row) => {\n return (\n <ResponsiveGridRoot\n gap={{ initial: 3, medium: 4 }}\n key={row.map((field) => field.name).join('.')}\n >\n {row.map(({ size, ...field }) => {\n /**\n * Layouts are built from schemas so they don't understand the complete\n * schema tree, for components we append the parent name to the field name\n * because this is the structure for the data & permissions also understand\n * the nesting involved.\n */\n const completeFieldName = `${name}.${field.name}`;\n\n const translatedLabel = formatMessage({\n id: `content-manager.components.${attribute.component}.${field.name}`,\n defaultMessage: field.label,\n });\n\n return (\n <ResponsiveGridItem\n col={size}\n key={completeFieldName}\n s={12}\n xs={12}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n {children({\n ...field,\n size,\n label: translatedLabel,\n name: completeFieldName,\n })}\n </ResponsiveGridItem>\n );\n })}\n </ResponsiveGridRoot>\n );\n })}\n </Flex>\n );\n }\n);\n\nNonRepeatableComponentFields.displayName = 'NonRepeatableComponentFields';\n\nconst MemoizedNonRepeatableComponent = React.memo(NonRepeatableComponent);\n\nexport { MemoizedNonRepeatableComponent as NonRepeatableComponent };\nexport type { NonRepeatableComponentProps };\n"],"names":["NonRepeatableComponent","attribute","name","children","layout","componentId","useForm","state","getIn","values","level","useComponent","isNested","isMobile","useIsMobile","_jsx","ComponentProvider","id","uid","component","type","Box","background","padding","initial","medium","hasRadius","borderColor","undefined","NonRepeatableComponentFields","React","memo","formatMessage","useIntl","Flex","direction","alignItems","gap","map","row","ResponsiveGridRoot","size","field","completeFieldName","translatedLabel","defaultMessage","label","ResponsiveGridItem","col","s","xs","join","displayName","MemoizedNonRepeatableComponent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAMA,sBAAAA,GAAyB,CAAC,EAC9BC,SAAS,EACTC,IAAI,EACJC,QAAQ,EACRC,MAAM,EACsB,GAAA;AAC5B,IAAA,MAAMC,WAAAA,GAAcC,mBAAAA,CAClB,wBAAA,EACA,CAACC,KAAAA,GAAUC,aAAAA,CAAMD,KAAAA,CAAME,MAAM,EAAE,CAAA,EAAGP,IAAAA,CAAK,GAAG,CAAC,CAAA,CAAA;AAE7C,IAAA,MAAMQ,QAAQC,6BAAAA,CAAa,wBAAA,EAA0B,CAACJ,KAAAA,GAAUA,MAAMG,KAAK,CAAA;AAC3E,IAAA,MAAME,WAAWF,KAAAA,GAAQ,CAAA;AACzB,IAAA,MAAMG,QAAAA,GAAWC,uBAAAA,EAAAA;AAEjB,IAAA,qBACEC,cAAA,CAACC,kCAAAA,EAAAA;QACCC,EAAAA,EAAI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GzC,IAAAA,CAAK,CAAC,EAAEwC,KAAAA,CAAMxC,IAAI,CAAA,CAAE;AAEjD,oBAAA,MAAM0C,kBAAkBZ,aAAAA,CAAc;wBACpCf,EAAAA,EAAI,CAAC,2BAA2B,EAAEhB,SAAAA,CAAUkB,SAAS,CAAC,CAAC,EAAEuB,KAAAA,CAAMxC,IAAI,CAAA,CAAE;AACrE2C,wBAAAA,cAAAA,EAAgBH,MAAMI;AACxB,qBAAA,CAAA;AAEA,oBAAA,qBACE/B,cAAA,CAACgC,6BAAAA,EAAAA;wBACCC,GAAAA,EAAKP,IAAAA;wBAELQ,CAAAA,EAAG,EAAA;wBACHC,EAAAA,EAAI,EAAA;wBACJf,SAAAA,EAAU,QAAA;wBACVC,UAAAA,EAAW,SAAA;kCAEVjC,QAAAA,CAAS;AACR,4BAAA,GAAGuC,KAAK;AACRD,4BAAAA,IAAAA;4BACAK,KAAAA,EAAOF,eAAAA;4BACP1C,IAAAA,EAAMyC;AACR,yBAAA;AAXKA,qBAAAA,EAAAA,iBAAAA,CAAAA;AAcX,gBAAA,CAAA;eAjCKJ,GAAAA,CAAID,GAAG,CAAC,CAACI,KAAAA,GAAUA,MAAMxC,IAAI,CAAA,CAAEiD,IAAI,CAAC,GAAA,CAAA,CAAA;AAoC/C,QAAA,CAAA;;AAGN,CAAA,CAAA;AAGFtB,4BAAAA,CAA6BuB,WAAW,GAAG,8BAAA;AAE3C,MAAMC,8BAAAA,iBAAiCvB,gBAAAA,CAAMC,IAAI,CAAC/B,sBAAAA;;;;"}
@@ -65,6 +65,7 @@ const NonRepeatableComponentFields = /*#__PURE__*/ React.memo(({ attribute, chil
65
65
  alignItems: "stretch",
66
66
  children: children({
67
67
  ...field,
68
+ size,
68
69
  label: translatedLabel,
69
70
  name: completeFieldName
70
71
  })
@@ -1 +1 @@
1
- {"version":3,"file":"NonRepeatable.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Component/NonRepeatable.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useForm, useIsMobile } from '@strapi/admin/strapi-admin';\nimport { Box, Flex } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { getIn } from '../../../../../utils/objects';\nimport { ResponsiveGridItem, ResponsiveGridRoot } from '../../FormLayout';\nimport { ComponentProvider, useComponent } from '../ComponentContext';\n\nimport type { ComponentInputProps } from './Input';\n\ntype NonRepeatableComponentProps = Omit<ComponentInputProps, 'required' | 'label'>;\n\nconst NonRepeatableComponent = ({\n attribute,\n name,\n children,\n layout,\n}: NonRepeatableComponentProps) => {\n const componentId = useForm(\n 'NonRepeatableComponent',\n (state) => getIn(state.values, `${name}.id`) as number | undefined\n );\n const level = useComponent('NonRepeatableComponent', (state) => state.level);\n const isNested = level > 0;\n const isMobile = useIsMobile();\n\n return (\n <ComponentProvider\n id={componentId}\n uid={attribute.component}\n level={level + 1}\n type=\"component\"\n >\n <Box\n background={'neutral100'}\n padding={{ initial: 4, medium: 6 }}\n hasRadius={isNested}\n borderColor={isNested || isMobile ? 'neutral200' : undefined}\n >\n <NonRepeatableComponentFields attribute={attribute} name={name} layout={layout}>\n {children}\n </NonRepeatableComponentFields>\n </Box>\n </ComponentProvider>\n );\n};\n\ninterface NonRepeatableComponentFieldsProps extends Pick<\n NonRepeatableComponentProps,\n 'attribute' | 'children' | 'layout' | 'name'\n> {}\n\nconst NonRepeatableComponentFields = React.memo(\n ({ attribute, children, layout, name }: NonRepeatableComponentFieldsProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {layout.map((row) => {\n return (\n <ResponsiveGridRoot\n gap={{ initial: 3, medium: 4 }}\n key={row.map((field) => field.name).join('.')}\n >\n {row.map(({ size, ...field }) => {\n /**\n * Layouts are built from schemas so they don't understand the complete\n * schema tree, for components we append the parent name to the field name\n * because this is the structure for the data & permissions also understand\n * the nesting involved.\n */\n const completeFieldName = `${name}.${field.name}`;\n\n const translatedLabel = formatMessage({\n id: `content-manager.components.${attribute.component}.${field.name}`,\n defaultMessage: field.label,\n });\n\n return (\n <ResponsiveGridItem\n col={size}\n key={completeFieldName}\n s={12}\n xs={12}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n {children({\n ...field,\n label: translatedLabel,\n name: completeFieldName,\n })}\n </ResponsiveGridItem>\n );\n })}\n </ResponsiveGridRoot>\n );\n })}\n </Flex>\n );\n }\n);\n\nNonRepeatableComponentFields.displayName = 'NonRepeatableComponentFields';\n\nconst MemoizedNonRepeatableComponent = React.memo(NonRepeatableComponent);\n\nexport { MemoizedNonRepeatableComponent as NonRepeatableComponent };\nexport type { NonRepeatableComponentProps };\n"],"names":["NonRepeatableComponent","attribute","name","children","layout","componentId","useForm","state","getIn","values","level","useComponent","isNested","isMobile","useIsMobile","_jsx","ComponentProvider","id","uid","component","type","Box","background","padding","initial","medium","hasRadius","borderColor","undefined","NonRepeatableComponentFields","React","memo","formatMessage","useIntl","Flex","direction","alignItems","gap","map","row","ResponsiveGridRoot","size","field","completeFieldName","translatedLabel","defaultMessage","label","ResponsiveGridItem","col","s","xs","join","displayName","MemoizedNonRepeatableComponent"],"mappings":";;;;;;;;;AAcA,MAAMA,sBAAAA,GAAyB,CAAC,EAC9BC,SAAS,EACTC,IAAI,EACJC,QAAQ,EACRC,MAAM,EACsB,GAAA;AAC5B,IAAA,MAAMC,WAAAA,GAAcC,OAAAA,CAClB,wBAAA,EACA,CAACC,KAAAA,GAAUC,KAAAA,CAAMD,KAAAA,CAAME,MAAM,EAAE,CAAA,EAAGP,IAAAA,CAAK,GAAG,CAAC,CAAA,CAAA;AAE7C,IAAA,MAAMQ,QAAQC,YAAAA,CAAa,wBAAA,EAA0B,CAACJ,KAAAA,GAAUA,MAAMG,KAAK,CAAA;AAC3E,IAAA,MAAME,WAAWF,KAAAA,GAAQ,CAAA;AACzB,IAAA,MAAMG,QAAAA,GAAWC,WAAAA,EAAAA;AAEjB,IAAA,qBACEC,GAAA,CAACC,iBAAAA,EAAAA;QACCC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AAA,EAAGzC,IAAAA,CAAK,CAAC,EAAEwC,KAAAA,CAAMxC,IAAI,CAAA,CAAE;AAEjD,oBAAA,MAAM0C,kBAAkBZ,aAAAA,CAAc;wBACpCf,EAAAA,EAAI,CAAC,2BAA2B,EAAEhB,SAAAA,CAAUkB,SAAS,CAAC,CAAC,EAAEuB,KAAAA,CAAMxC,IAAI,CAAA,CAAE;AACrE2C,wBAAAA,cAAAA,EAAgBH,MAAMI;AACxB,qBAAA,CAAA;AAEA,oBAAA,qBACE/B,GAAA,CAACgC,kBAAAA,EAAAA;wBACCC,GAAAA,EAAKP,IAAAA;wBAELQ,CAAAA,EAAG,EAAA;wBACHC,EAAAA,EAAI,EAAA;wBACJf,SAAAA,EAAU,QAAA;wBACVC,UAAAA,EAAW,SAAA;kCAEVjC,QAAAA,CAAS;AACR,4BAAA,GAAGuC,KAAK;4BACRI,KAAAA,EAAOF,eAAAA;4BACP1C,IAAAA,EAAMyC;AACR,yBAAA;AAVKA,qBAAAA,EAAAA,iBAAAA,CAAAA;AAaX,gBAAA,CAAA;eAhCKJ,GAAAA,CAAID,GAAG,CAAC,CAACI,KAAAA,GAAUA,MAAMxC,IAAI,CAAA,CAAEiD,IAAI,CAAC,GAAA,CAAA,CAAA;AAmC/C,QAAA,CAAA;;AAGN,CAAA,CAAA;AAGFtB,4BAAAA,CAA6BuB,WAAW,GAAG,8BAAA;AAE3C,MAAMC,8BAAAA,iBAAiCvB,KAAAA,CAAMC,IAAI,CAAC/B,sBAAAA;;;;"}
1
+ {"version":3,"file":"NonRepeatable.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Component/NonRepeatable.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useForm, useIsMobile } from '@strapi/admin/strapi-admin';\nimport { Box, Flex } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { getIn } from '../../../../../utils/objects';\nimport { ResponsiveGridItem, ResponsiveGridRoot } from '../../FormLayout';\nimport { ComponentProvider, useComponent } from '../ComponentContext';\n\nimport type { ComponentInputProps } from './Input';\n\ntype NonRepeatableComponentProps = Omit<ComponentInputProps, 'required' | 'label'>;\n\nconst NonRepeatableComponent = ({\n attribute,\n name,\n children,\n layout,\n}: NonRepeatableComponentProps) => {\n const componentId = useForm(\n 'NonRepeatableComponent',\n (state) => getIn(state.values, `${name}.id`) as number | undefined\n );\n const level = useComponent('NonRepeatableComponent', (state) => state.level);\n const isNested = level > 0;\n const isMobile = useIsMobile();\n\n return (\n <ComponentProvider\n id={componentId}\n uid={attribute.component}\n level={level + 1}\n type=\"component\"\n >\n <Box\n background={'neutral100'}\n padding={{ initial: 4, medium: 6 }}\n hasRadius={isNested}\n borderColor={isNested || isMobile ? 'neutral200' : undefined}\n >\n <NonRepeatableComponentFields attribute={attribute} name={name} layout={layout}>\n {children}\n </NonRepeatableComponentFields>\n </Box>\n </ComponentProvider>\n );\n};\n\ninterface NonRepeatableComponentFieldsProps extends Pick<\n NonRepeatableComponentProps,\n 'attribute' | 'children' | 'layout' | 'name'\n> {}\n\nconst NonRepeatableComponentFields = React.memo(\n ({ attribute, children, layout, name }: NonRepeatableComponentFieldsProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {layout.map((row) => {\n return (\n <ResponsiveGridRoot\n gap={{ initial: 3, medium: 4 }}\n key={row.map((field) => field.name).join('.')}\n >\n {row.map(({ size, ...field }) => {\n /**\n * Layouts are built from schemas so they don't understand the complete\n * schema tree, for components we append the parent name to the field name\n * because this is the structure for the data & permissions also understand\n * the nesting involved.\n */\n const completeFieldName = `${name}.${field.name}`;\n\n const translatedLabel = formatMessage({\n id: `content-manager.components.${attribute.component}.${field.name}`,\n defaultMessage: field.label,\n });\n\n return (\n <ResponsiveGridItem\n col={size}\n key={completeFieldName}\n s={12}\n xs={12}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n {children({\n ...field,\n size,\n label: translatedLabel,\n name: completeFieldName,\n })}\n </ResponsiveGridItem>\n );\n })}\n </ResponsiveGridRoot>\n );\n })}\n </Flex>\n );\n }\n);\n\nNonRepeatableComponentFields.displayName = 'NonRepeatableComponentFields';\n\nconst MemoizedNonRepeatableComponent = React.memo(NonRepeatableComponent);\n\nexport { MemoizedNonRepeatableComponent as NonRepeatableComponent };\nexport type { NonRepeatableComponentProps };\n"],"names":["NonRepeatableComponent","attribute","name","children","layout","componentId","useForm","state","getIn","values","level","useComponent","isNested","isMobile","useIsMobile","_jsx","ComponentProvider","id","uid","component","type","Box","background","padding","initial","medium","hasRadius","borderColor","undefined","NonRepeatableComponentFields","React","memo","formatMessage","useIntl","Flex","direction","alignItems","gap","map","row","ResponsiveGridRoot","size","field","completeFieldName","translatedLabel","defaultMessage","label","ResponsiveGridItem","col","s","xs","join","displayName","MemoizedNonRepeatableComponent"],"mappings":";;;;;;;;;AAcA,MAAMA,sBAAAA,GAAyB,CAAC,EAC9BC,SAAS,EACTC,IAAI,EACJC,QAAQ,EACRC,MAAM,EACsB,GAAA;AAC5B,IAAA,MAAMC,WAAAA,GAAcC,OAAAA,CAClB,wBAAA,EACA,CAACC,KAAAA,GAAUC,KAAAA,CAAMD,KAAAA,CAAME,MAAM,EAAE,CAAA,EAAGP,IAAAA,CAAK,GAAG,CAAC,CAAA,CAAA;AAE7C,IAAA,MAAMQ,QAAQC,YAAAA,CAAa,wBAAA,EAA0B,CAACJ,KAAAA,GAAUA,MAAMG,KAAK,CAAA;AAC3E,IAAA,MAAME,WAAWF,KAAAA,GAAQ,CAAA;AACzB,IAAA,MAAMG,QAAAA,GAAWC,WAAAA,EAAAA;AAEjB,IAAA,qBACEC,GAAA,CAACC,iBAAAA,EAAAA;QACCC,EAAAA,EAAIZ,WAAAA;AACJa,QAAAA,GAAAA,EAAKjB,UAAUkB,SAAS;AACxBT,QAAAA,KAAAA,EAAOA,KAAAA,GAAQ,CAAA;QACfU,IAAAA,EAAK,WAAA;AAEL,QAAA,QAAA,gBAAAL,GAAA,CAACM,GAA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AS,CAAC,CAAC,EAAEuB,KAAAA,CAAMxC,IAAI,CAAA,CAAE;AACrE2C,wBAAAA,cAAAA,EAAgBH,MAAMI;AACxB,qBAAA,CAAA;AAEA,oBAAA,qBACE/B,GAAA,CAACgC,kBAAAA,EAAAA;wBACCC,GAAAA,EAAKP,IAAAA;wBAELQ,CAAAA,EAAG,EAAA;wBACHC,EAAAA,EAAI,EAAA;wBACJf,SAAAA,EAAU,QAAA;wBACVC,UAAAA,EAAW,SAAA;kCAEVjC,QAAAA,CAAS;AACR,4BAAA,GAAGuC,KAAK;AACRD,4BAAAA,IAAAA;4BACAK,KAAAA,EAAOF,eAAAA;4BACP1C,IAAAA,EAAMyC;AACR,yBAAA;AAXKA,qBAAAA,EAAAA,iBAAAA,CAAAA;AAcX,gBAAA,CAAA;eAjCKJ,GAAAA,CAAID,GAAG,CAAC,CAACI,KAAAA,GAAUA,MAAMxC,IAAI,CAAA,CAAEiD,IAAI,CAAC,GAAA,CAAA,CAAA;AAoC/C,QAAA,CAAA;;AAGN,CAAA,CAAA;AAGFtB,4BAAAA,CAA6BuB,WAAW,GAAG,8BAAA;AAE3C,MAAMC,8BAAAA,iBAAiCvB,KAAAA,CAAMC,IAAI,CAAC/B,sBAAAA;;;;"}
@@ -333,6 +333,7 @@ const RepeatableComponentFields = /*#__PURE__*/ React__namespace.memo(({ attribu
333
333
  alignItems: "stretch",
334
334
  children: children({
335
335
  ...field,
336
+ size,
336
337
  label: translatedLabel,
337
338
  name: completeFieldName
338
339
  })