@strapi/content-manager 5.29.0 → 5.30.1
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.
- package/dist/admin/components/ComponentIcon.js +3 -0
- package/dist/admin/components/ComponentIcon.js.map +1 -1
- package/dist/admin/components/ComponentIcon.mjs +3 -0
- package/dist/admin/components/ComponentIcon.mjs.map +1 -1
- package/dist/admin/components/ConfigurationForm/Fields.js.map +1 -1
- package/dist/admin/components/ConfigurationForm/Fields.mjs.map +1 -1
- package/dist/admin/components/RelativeTime.js.map +1 -1
- package/dist/admin/components/RelativeTime.mjs.map +1 -1
- package/dist/admin/components/Widgets.js.map +1 -1
- package/dist/admin/components/Widgets.mjs.map +1 -1
- package/dist/admin/content-manager.js.map +1 -1
- package/dist/admin/content-manager.mjs.map +1 -1
- package/dist/admin/history/components/HistoryAction.js.map +1 -1
- package/dist/admin/history/components/HistoryAction.mjs.map +1 -1
- package/dist/admin/history/components/VersionHeader.js.map +1 -1
- package/dist/admin/history/components/VersionHeader.mjs.map +1 -1
- package/dist/admin/history/components/VersionInputRenderer.js.map +1 -1
- package/dist/admin/history/components/VersionInputRenderer.mjs.map +1 -1
- package/dist/admin/history/components/VersionsList.js.map +1 -1
- package/dist/admin/history/components/VersionsList.mjs.map +1 -1
- package/dist/admin/history/pages/History.js.map +1 -1
- package/dist/admin/history/pages/History.mjs.map +1 -1
- package/dist/admin/history/services/historyVersion.js.map +1 -1
- package/dist/admin/history/services/historyVersion.mjs.map +1 -1
- package/dist/admin/hooks/useContentManagerInitData.js.map +1 -1
- package/dist/admin/hooks/useContentManagerInitData.mjs.map +1 -1
- package/dist/admin/hooks/useDocumentActions.js +24 -5
- package/dist/admin/hooks/useDocumentActions.js.map +1 -1
- package/dist/admin/hooks/useDocumentActions.mjs +24 -5
- package/dist/admin/hooks/useDocumentActions.mjs.map +1 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/DocumentActions.js +5 -3
- package/dist/admin/pages/EditView/components/DocumentActions.js.map +1 -1
- package/dist/admin/pages/EditView/components/DocumentActions.mjs +5 -3
- package/dist/admin/pages/EditView/components/DocumentActions.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/DocumentStatus.js.map +1 -1
- package/dist/admin/pages/EditView/components/DocumentStatus.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.js +66 -2
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.mjs +66 -2
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Quote.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Quote.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Modifiers.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Modifiers.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/utils/links.js +7 -3
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/utils/links.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/utils/links.mjs +7 -3
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/utils/links.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js +1 -0
- package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs +1 -0
- package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/UID.js +2 -1
- package/dist/admin/pages/EditView/components/FormInputs/UID.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/UID.mjs +2 -1
- package/dist/admin/pages/EditView/components/FormInputs/UID.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/utils.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/utils.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormLayout.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormLayout.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/Header.js +10 -5
- package/dist/admin/pages/EditView/components/Header.js.map +1 -1
- package/dist/admin/pages/EditView/components/Header.mjs +10 -5
- package/dist/admin/pages/EditView/components/Header.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/InputRenderer.js +12 -11
- package/dist/admin/pages/EditView/components/InputRenderer.js.map +1 -1
- package/dist/admin/pages/EditView/components/InputRenderer.mjs +12 -11
- package/dist/admin/pages/EditView/components/InputRenderer.mjs.map +1 -1
- package/dist/admin/pages/EditView/utils/data.js.map +1 -1
- package/dist/admin/pages/EditView/utils/data.mjs.map +1 -1
- package/dist/admin/pages/ListConfiguration/ListConfigurationPage.js.map +1 -1
- package/dist/admin/pages/ListConfiguration/ListConfigurationPage.mjs.map +1 -1
- package/dist/admin/pages/ListConfiguration/components/DraggableCard.js.map +1 -1
- package/dist/admin/pages/ListConfiguration/components/DraggableCard.mjs.map +1 -1
- package/dist/admin/pages/ListConfiguration/components/Header.js.map +1 -1
- package/dist/admin/pages/ListConfiguration/components/Header.mjs.map +1 -1
- package/dist/admin/pages/ListView/ListViewPage.js +0 -2
- package/dist/admin/pages/ListView/ListViewPage.js.map +1 -1
- package/dist/admin/pages/ListView/ListViewPage.mjs +0 -2
- package/dist/admin/pages/ListView/ListViewPage.mjs.map +1 -1
- package/dist/admin/pages/ListView/components/AutoCloneFailureModal.js.map +1 -1
- package/dist/admin/pages/ListView/components/AutoCloneFailureModal.mjs.map +1 -1
- package/dist/admin/pages/ListView/components/BulkActions/PublishAction.js.map +1 -1
- package/dist/admin/pages/ListView/components/BulkActions/PublishAction.mjs.map +1 -1
- package/dist/admin/pages/ListView/components/TableActions.js.map +1 -1
- package/dist/admin/pages/ListView/components/TableActions.mjs.map +1 -1
- package/dist/admin/pages/ListView/components/TableCells/Media.js.map +1 -1
- package/dist/admin/pages/ListView/components/TableCells/Media.mjs.map +1 -1
- package/dist/admin/preview/services/preview.js.map +1 -1
- package/dist/admin/preview/services/preview.mjs.map +1 -1
- package/dist/admin/preview/utils/fieldUtils.js.map +1 -1
- package/dist/admin/preview/utils/fieldUtils.mjs.map +1 -1
- package/dist/admin/preview/utils/previewScript.js.map +1 -1
- package/dist/admin/preview/utils/previewScript.mjs.map +1 -1
- package/dist/admin/router.js.map +1 -1
- package/dist/admin/router.mjs.map +1 -1
- package/dist/admin/services/api.js +2 -1
- package/dist/admin/services/api.js.map +1 -1
- package/dist/admin/services/api.mjs +2 -1
- package/dist/admin/services/api.mjs.map +1 -1
- package/dist/admin/services/documents.js +10 -2
- package/dist/admin/services/documents.js.map +1 -1
- package/dist/admin/services/documents.mjs +10 -2
- package/dist/admin/services/documents.mjs.map +1 -1
- package/dist/admin/services/homepage.js.map +1 -1
- package/dist/admin/services/homepage.mjs.map +1 -1
- package/dist/admin/services/relations.js.map +1 -1
- package/dist/admin/services/relations.mjs.map +1 -1
- package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/links.d.ts +2 -0
- package/dist/admin/src/pages/EditView/components/Header.d.ts +12 -1
- package/dist/admin/src/preview/services/preview.d.ts +1 -1
- package/dist/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/components.d.ts +2 -2
- package/dist/admin/src/services/contentTypes.d.ts +3 -3
- package/dist/admin/src/services/documents.d.ts +16 -16
- package/dist/admin/src/services/homepage.d.ts +1 -1
- package/dist/admin/src/services/init.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +2 -2
- package/dist/admin/src/services/uid.d.ts +3 -3
- package/dist/admin/translations/fr.json.js +1 -1
- package/dist/admin/translations/fr.json.mjs +1 -1
- package/dist/admin/utils/translations.js.map +1 -1
- package/dist/admin/utils/translations.mjs.map +1 -1
- package/dist/admin/utils/urls.js.map +1 -1
- package/dist/admin/utils/urls.mjs.map +1 -1
- package/dist/admin/utils/users.js.map +1 -1
- package/dist/admin/utils/users.mjs.map +1 -1
- package/dist/admin/utils/validation.js.map +1 -1
- package/dist/admin/utils/validation.mjs.map +1 -1
- package/dist/server/controllers/collection-types.js +2 -1
- package/dist/server/controllers/collection-types.js.map +1 -1
- package/dist/server/controllers/collection-types.mjs +2 -1
- package/dist/server/controllers/collection-types.mjs.map +1 -1
- package/dist/server/controllers/relations.js.map +1 -1
- package/dist/server/controllers/relations.mjs.map +1 -1
- package/dist/server/controllers/single-types.js.map +1 -1
- package/dist/server/controllers/single-types.mjs.map +1 -1
- package/dist/server/controllers/validation/dimensions.js.map +1 -1
- package/dist/server/controllers/validation/dimensions.mjs.map +1 -1
- package/dist/server/controllers/validation/index.js.map +1 -1
- package/dist/server/controllers/validation/index.mjs.map +1 -1
- package/dist/server/history/utils.js.map +1 -1
- package/dist/server/history/utils.mjs.map +1 -1
- package/dist/server/homepage/services/homepage.js.map +1 -1
- package/dist/server/homepage/services/homepage.mjs.map +1 -1
- package/dist/server/middlewares/routing.js.map +1 -1
- package/dist/server/middlewares/routing.mjs.map +1 -1
- package/dist/server/preview/services/preview-config.js +8 -33
- package/dist/server/preview/services/preview-config.js.map +1 -1
- package/dist/server/preview/services/preview-config.mjs +9 -34
- package/dist/server/preview/services/preview-config.mjs.map +1 -1
- package/dist/server/preview/services/preview.js.map +1 -1
- package/dist/server/preview/services/preview.mjs.map +1 -1
- package/dist/server/preview/utils.js.map +1 -1
- package/dist/server/preview/utils.mjs.map +1 -1
- package/dist/server/services/configuration.js.map +1 -1
- package/dist/server/services/configuration.mjs.map +1 -1
- package/dist/server/services/document-metadata.js +23 -1
- package/dist/server/services/document-metadata.js.map +1 -1
- package/dist/server/services/document-metadata.mjs +23 -1
- package/dist/server/services/document-metadata.mjs.map +1 -1
- package/dist/server/services/field-sizes.js.map +1 -1
- package/dist/server/services/field-sizes.mjs.map +1 -1
- package/dist/server/services/uid.js.map +1 -1
- package/dist/server/services/uid.mjs.map +1 -1
- package/dist/server/services/utils/store.js.map +1 -1
- package/dist/server/services/utils/store.mjs.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/single-types.d.ts.map +1 -1
- package/dist/server/src/preview/services/preview-config.d.ts.map +1 -1
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.mjs","sources":["../../../../../admin/src/pages/EditView/components/Header.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n DescriptionComponentRenderer,\n useForm,\n BackButton,\n useNotification,\n useStrapiApp,\n useQueryParams,\n useIsDesktop,\n useDebounce,\n} from '@strapi/admin/strapi-admin';\nimport {\n Box,\n Flex,\n SingleSelect,\n SingleSelectOption,\n Typography,\n IconButton,\n Dialog,\n Popover,\n} from '@strapi/design-system';\nimport { ListPlus, Pencil, Trash, WarningCircle } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { useMatch, useNavigate, useParams } from 'react-router-dom';\n\nimport { RelativeTime } from '../../../components/RelativeTime';\nimport {\n CREATED_AT_ATTRIBUTE_NAME,\n CREATED_BY_ATTRIBUTE_NAME,\n PUBLISHED_AT_ATTRIBUTE_NAME,\n PUBLISHED_BY_ATTRIBUTE_NAME,\n UPDATED_AT_ATTRIBUTE_NAME,\n UPDATED_BY_ATTRIBUTE_NAME,\n} from '../../../constants/attributes';\nimport { COLLECTION_TYPES, SINGLE_TYPES } from '../../../constants/collections';\nimport { useDocumentRBAC } from '../../../features/DocumentRBAC';\nimport { useDoc } from '../../../hooks/useDocument';\nimport { useDocumentActions } from '../../../hooks/useDocumentActions';\nimport { CLONE_PATH, LIST_PATH } from '../../../router';\nimport { getDisplayName } from '../../../utils/users';\n\nimport { DocumentActionsMenu } from './DocumentActions';\nimport { DocumentStatus } from './DocumentStatus';\n\nimport type { ContentManagerPlugin, DocumentActionComponent } from '../../../content-manager';\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\ninterface HeaderProps {\n isCreating?: boolean;\n status?: 'draft' | 'published' | 'modified';\n title?: string;\n}\n\nconst Header = ({ isCreating, status, title: documentTitle = 'Untitled' }: HeaderProps) => {\n const { formatMessage } = useIntl();\n const isCloning = useMatch(CLONE_PATH) !== null;\n const params = useParams<{ collectionType: string; slug: string }>();\n\n const title = isCreating\n ? formatMessage({\n id: 'content-manager.containers.edit.title.new',\n defaultMessage: 'Create an entry',\n })\n : documentTitle;\n\n return (\n <Flex\n direction=\"column\"\n alignItems=\"flex-start\"\n paddingTop={{\n initial: 4,\n large: 6,\n }}\n paddingBottom={{\n initial: 0,\n large: 4,\n }}\n gap={2}\n >\n <BackButton\n fallback={\n params.collectionType === SINGLE_TYPES\n ? undefined\n : `../${COLLECTION_TYPES}/${params.slug}`\n }\n />\n <Flex\n width=\"100%\"\n justifyContent=\"space-between\"\n gap={{\n initial: 2,\n medium: '8rem',\n }}\n alignItems=\"flex-start\"\n direction={{\n initial: 'column',\n medium: 'row',\n }}\n >\n <Typography variant=\"alpha\" tag=\"h1\">\n {title}\n </Typography>\n <HeaderToolbar />\n </Flex>\n {status ? (\n <Box marginTop={1}>\n <DocumentStatus status={isCloning ? 'draft' : status} />\n </Box>\n ) : null}\n </Flex>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * HeaderToolbar\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DialogOptions {\n type: 'dialog';\n title: string;\n content?: React.ReactNode;\n footer?: React.ReactNode;\n}\n\ninterface HeaderActionDescription {\n disabled?: boolean;\n label: string;\n icon?: React.ReactNode;\n type?: 'icon' | 'default';\n onClick?: (event: React.SyntheticEvent) => Promise<boolean | void> | boolean | void;\n dialog?: DialogOptions;\n options?: Array<{\n disabled?: boolean;\n label: string;\n startIcon?: React.ReactNode;\n textValue?: string;\n value: string;\n }>;\n status?: {\n message: React.ReactNode;\n tooltip?: React.ReactNode;\n };\n onSelect?: (value: string) => void;\n value?: string;\n customizeContent?: (value: string) => React.ReactNode;\n}\n\n/**\n * @description Contains the document actions that have `position: header`, if there are\n * none we still render the menu because we render the information about the document there.\n */\nconst HeaderToolbar = () => {\n const { formatMessage } = useIntl();\n const isCloning = useMatch(CLONE_PATH) !== null;\n const [\n {\n query: { status = 'draft' },\n },\n ] = useQueryParams<{ status: 'draft' | 'published' }>();\n const { model, id, document, meta, collectionType } = useDoc();\n const plugins = useStrapiApp('HeaderToolbar', (state) => state.plugins);\n\n return (\n <Flex gap={2}>\n <DescriptionComponentRenderer\n props={{\n activeTab: status,\n model,\n documentId: id,\n document: isCloning ? undefined : document,\n meta: isCloning ? undefined : meta,\n collectionType,\n }}\n descriptions={(\n plugins['content-manager'].apis as ContentManagerPlugin['config']['apis']\n ).getHeaderActions()}\n >\n {(actions) => {\n if (actions.length > 0) {\n return <HeaderActions actions={actions} />;\n } else {\n return null;\n }\n }}\n </DescriptionComponentRenderer>\n <DescriptionComponentRenderer\n props={{\n activeTab: status,\n model,\n documentId: id,\n document: isCloning ? undefined : document,\n meta: isCloning ? undefined : meta,\n collectionType,\n }}\n descriptions={(\n plugins['content-manager'].apis as ContentManagerPlugin['config']['apis']\n ).getDocumentActions('header')}\n >\n {(actions) => {\n const headerActions = actions.filter((action) => {\n const positions = Array.isArray(action.position) ? action.position : [action.position];\n return positions.includes('header');\n });\n\n return (\n <DocumentActionsMenu\n actions={headerActions}\n label={formatMessage({\n id: 'content-manager.containers.edit.header.more-actions',\n defaultMessage: 'More actions',\n })}\n >\n <Information activeTab={status} />\n </DocumentActionsMenu>\n );\n }}\n </DescriptionComponentRenderer>\n </Flex>\n );\n};\n\ninterface InformationProps {\n activeTab: 'draft' | 'published';\n}\n\nconst Information = ({ activeTab }: InformationProps) => {\n const { formatMessage } = useIntl();\n const { document, meta } = useDoc();\n\n if (!document || !document.id) {\n return null;\n }\n\n /**\n * Because in the backend separate entries are made for draft and published\n * documents, the creator fields are different for each of them. For example,\n * you could make your draft in January and then publish it for the first time\n * in Feb. This would make the createdAt value for the published entry in Feb\n * but really we want to show the document as a whole. The draft entry will also\n * never have the publishedAt values.\n *\n * So, we decipher which document to show the creator for based on the activeTab.\n */\n\n const createAndUpdateDocument =\n activeTab === 'draft'\n ? document\n : meta?.availableStatus.find((status) => status.publishedAt === null);\n\n const publishDocument =\n activeTab === 'published'\n ? document\n : meta?.availableStatus.find((status) => status.publishedAt !== null);\n\n const creator = createAndUpdateDocument?.[CREATED_BY_ATTRIBUTE_NAME]\n ? getDisplayName(createAndUpdateDocument[CREATED_BY_ATTRIBUTE_NAME])\n : null;\n\n const updator = createAndUpdateDocument?.[UPDATED_BY_ATTRIBUTE_NAME]\n ? getDisplayName(createAndUpdateDocument[UPDATED_BY_ATTRIBUTE_NAME])\n : null;\n\n const information: Array<{ isDisplayed?: boolean; label: string; value: React.ReactNode }> = [\n {\n isDisplayed: !!publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME],\n label: formatMessage({\n id: 'content-manager.containers.edit.information.last-published.label',\n defaultMessage: 'Published',\n }),\n value: formatMessage(\n {\n id: 'content-manager.containers.edit.information.last-published.value',\n defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`,\n },\n {\n time: (\n <RelativeTime timestamp={new Date(publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME])} />\n ),\n isAnonymous: !publishDocument?.[PUBLISHED_BY_ATTRIBUTE_NAME],\n author: publishDocument?.[PUBLISHED_BY_ATTRIBUTE_NAME]\n ? getDisplayName(publishDocument?.[PUBLISHED_BY_ATTRIBUTE_NAME])\n : null,\n }\n ),\n },\n {\n isDisplayed: !!createAndUpdateDocument?.[UPDATED_AT_ATTRIBUTE_NAME],\n label: formatMessage({\n id: 'content-manager.containers.edit.information.last-draft.label',\n defaultMessage: 'Updated',\n }),\n value: formatMessage(\n {\n id: 'content-manager.containers.edit.information.last-draft.value',\n defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`,\n },\n {\n time: (\n <RelativeTime\n timestamp={new Date(createAndUpdateDocument?.[UPDATED_AT_ATTRIBUTE_NAME])}\n />\n ),\n isAnonymous: !updator,\n author: updator,\n }\n ),\n },\n {\n isDisplayed: !!createAndUpdateDocument?.[CREATED_AT_ATTRIBUTE_NAME],\n label: formatMessage({\n id: 'content-manager.containers.edit.information.document.label',\n defaultMessage: 'Created',\n }),\n value: formatMessage(\n {\n id: 'content-manager.containers.edit.information.document.value',\n defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`,\n },\n {\n time: (\n <RelativeTime\n timestamp={new Date(createAndUpdateDocument?.[CREATED_AT_ATTRIBUTE_NAME])}\n />\n ),\n isAnonymous: !creator,\n author: creator,\n }\n ),\n },\n ].filter((info) => info.isDisplayed);\n\n return (\n <Flex\n borderWidth=\"1px 0 0 0\"\n borderStyle=\"solid\"\n borderColor=\"neutral150\"\n direction=\"column\"\n marginTop={2}\n tag=\"dl\"\n padding={5}\n gap={3}\n alignItems=\"flex-start\"\n /**\n * The menu content has a padding of 4px, but we want our divider (the border top applied) to\n * be flush with the menu content. So we need to adjust the margin & width to account for the padding.\n */\n marginLeft=\"-0.4rem\"\n marginRight=\"-0.4rem\"\n width=\"calc(100% + 8px)\"\n >\n {information.map((info) => (\n <Flex gap={1} direction=\"column\" alignItems=\"flex-start\" key={info.label}>\n <Typography tag=\"dt\" variant=\"pi\" fontWeight=\"bold\">\n {info.label}\n </Typography>\n <Typography tag=\"dd\" variant=\"pi\" textColor=\"neutral600\">\n {info.value}\n </Typography>\n </Flex>\n ))}\n </Flex>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * HeaderActions\n * -----------------------------------------------------------------------------------------------*/\n\ninterface HeaderActionsProps {\n actions: Array<HeaderActionDescription & { id: string }>;\n}\n\nconst HeaderActions = ({ actions }: HeaderActionsProps) => {\n const [dialogId, setDialogId] = React.useState<string | null>(null);\n\n const handleClick =\n (action: HeaderActionDescription & { id: string }) => async (e: React.MouseEvent) => {\n if (!('options' in action)) {\n const { onClick = () => false, dialog, id } = action;\n\n const muteDialog = await onClick(e);\n\n if (dialog && !muteDialog) {\n e.preventDefault();\n setDialogId(id);\n }\n }\n };\n\n const handleClose = () => {\n setDialogId(null);\n };\n\n return (\n <Flex gap={1}>\n {actions.map((action) => {\n if (action.options) {\n return (\n <SingleSelect\n key={action.id}\n size=\"S\"\n // @ts-expect-error – the DS will handle numbers, but we're not allowing the API.\n onChange={action.onSelect}\n aria-label={action.label}\n {...action}\n >\n {action.options.map(({ label, ...option }) => (\n <SingleSelectOption key={option.value} {...option}>\n {label}\n </SingleSelectOption>\n ))}\n </SingleSelect>\n );\n } else if (action.status) {\n return (\n <HeaderActionStatus tooltip={action.status?.tooltip} key={action.id}>\n {action.status.message}\n </HeaderActionStatus>\n );\n } else {\n return (\n <React.Fragment key={action.id}>\n <IconButton\n disabled={action.disabled}\n label={action.label}\n size=\"S\"\n onClick={handleClick(action)}\n >\n {action.icon}\n </IconButton>\n {action.dialog ? (\n <HeaderActionDialog\n {...action.dialog}\n isOpen={dialogId === action.id}\n onClose={handleClose}\n />\n ) : null}\n </React.Fragment>\n );\n }\n })}\n </Flex>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * HeaderActionStatus\n * -----------------------------------------------------------------------------------------------*/\n\ninterface HeaderActionStatusProps {\n tooltip: React.ReactNode;\n children: React.ReactNode;\n}\n\nconst HeaderActionStatus = ({ tooltip, children }: HeaderActionStatusProps) => {\n const [open, setOpen] = React.useState(false);\n // Debounce the open/close so the user can hover over the popover content before it closes\n const debouncedOpen = useDebounce(open, 100);\n\n const handleMouseEnter = () => {\n if (tooltip) {\n setOpen(true);\n }\n };\n const handleMouseLeave = () => {\n if (tooltip) {\n setOpen(false);\n }\n };\n\n return (\n <Popover.Root open={debouncedOpen} onOpenChange={setOpen}>\n <Popover.Anchor\n style={{ alignSelf: 'stretch' }}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n aria-describedby=\"document-header-action-status\"\n >\n <Box height=\"100%\">{children}</Box>\n </Popover.Anchor>\n <Popover.Content\n role=\"tooltip\"\n id=\"document-header-action-status\"\n side=\"bottom\"\n align=\"center\"\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {tooltip}\n </Popover.Content>\n </Popover.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * HeaderActionDialog\n * -----------------------------------------------------------------------------------------------*/\ninterface HeaderActionDialogProps {\n onClose: () => void;\n onCancel?: () => Promise<void>;\n title: string;\n content?: React.ReactNode | ((props: { onClose: () => void }) => React.ReactNode);\n isOpen: boolean;\n}\n\nconst HeaderActionDialog = ({\n onClose,\n onCancel,\n title,\n content: Content,\n isOpen,\n}: HeaderActionDialogProps) => {\n const handleClose = async () => {\n if (onCancel) {\n await onCancel();\n }\n\n onClose();\n };\n\n return (\n <Dialog.Root open={isOpen} onOpenChange={handleClose}>\n <Dialog.Content>\n <Dialog.Header>{title}</Dialog.Header>\n {typeof Content === 'function' ? <Content onClose={handleClose} /> : Content}\n </Dialog.Content>\n </Dialog.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DocumentActionComponents\n * -----------------------------------------------------------------------------------------------*/\n\nconst ConfigureTheViewAction: DocumentActionComponent = ({ collectionType, model }) => {\n const navigate = useNavigate();\n const { formatMessage } = useIntl();\n const isDesktop = useIsDesktop();\n\n return isDesktop\n ? {\n label: formatMessage({\n id: 'app.links.configure-view',\n defaultMessage: 'Configure the view',\n }),\n icon: <ListPlus />,\n onClick: () => {\n navigate(`../${collectionType}/${model}/configurations/edit`);\n },\n position: 'header',\n }\n : null;\n};\n\nConfigureTheViewAction.type = 'configure-the-view';\nConfigureTheViewAction.position = 'header';\n\nconst EditTheModelAction: DocumentActionComponent = ({ model }) => {\n const navigate = useNavigate();\n const { formatMessage } = useIntl();\n const isDesktop = useIsDesktop();\n\n return isDesktop\n ? {\n label: formatMessage({\n id: 'content-manager.link-to-ctb',\n defaultMessage: 'Edit the model',\n }),\n icon: <Pencil />,\n onClick: () => {\n navigate(`/plugins/content-type-builder/content-types/${model}`);\n },\n position: 'header',\n }\n : null;\n};\n\nEditTheModelAction.type = 'edit-the-model';\nEditTheModelAction.position = 'header';\n\nconst DeleteAction: DocumentActionComponent = ({ documentId, model, collectionType, document }) => {\n const navigate = useNavigate();\n const { formatMessage } = useIntl();\n const listViewPathMatch = useMatch(LIST_PATH);\n const canDelete = useDocumentRBAC('DeleteAction', (state) => state.canDelete);\n const { delete: deleteAction, isLoading } = useDocumentActions();\n const { toggleNotification } = useNotification();\n const setSubmitting = useForm('DeleteAction', (state) => state.setSubmitting);\n const isLocalized = document?.locale != null;\n\n return {\n disabled: !canDelete || !document,\n label: formatMessage(\n {\n id: 'content-manager.actions.delete.label',\n defaultMessage: 'Delete entry{isLocalized, select, true { (all locales)} other {}}',\n },\n { isLocalized }\n ),\n icon: <Trash />,\n dialog: {\n type: 'dialog',\n title: formatMessage({\n id: 'app.components.ConfirmDialog.title',\n defaultMessage: 'Confirmation',\n }),\n content: (\n <Flex direction=\"column\" gap={2}>\n <WarningCircle width=\"24px\" height=\"24px\" fill=\"danger600\" />\n <Typography tag=\"p\" variant=\"omega\" textAlign=\"center\">\n {formatMessage({\n id: 'content-manager.actions.delete.dialog.body',\n defaultMessage: 'Are you sure?',\n })}\n </Typography>\n </Flex>\n ),\n loading: isLoading,\n onConfirm: async () => {\n /**\n * If we have a match, we're in the list view\n * and therefore not in a form and shouldn't be\n * trying to set the submitting value.\n */\n if (!listViewPathMatch) {\n setSubmitting(true);\n }\n try {\n if (!documentId && collectionType !== SINGLE_TYPES) {\n console.error(\n \"You're trying to delete a document without an id, this is likely a bug with Strapi. Please open an issue.\"\n );\n\n toggleNotification({\n message: formatMessage({\n id: 'content-manager.actions.delete.error',\n defaultMessage: 'An error occurred while trying to delete the document.',\n }),\n type: 'danger',\n });\n\n return;\n }\n\n const res = await deleteAction({\n documentId,\n model,\n collectionType,\n params: {\n locale: '*',\n },\n });\n\n if (!('error' in res)) {\n navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });\n }\n } finally {\n if (!listViewPathMatch) {\n setSubmitting(false);\n }\n }\n },\n },\n variant: 'danger',\n position: ['header', 'table-row'],\n };\n};\n\nDeleteAction.type = 'delete';\nDeleteAction.position = ['header', 'table-row'];\n\nconst DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction];\n\nexport { Header, DEFAULT_HEADER_ACTIONS };\nexport type { HeaderProps, HeaderActionDescription };\n"],"names":["Header","isCreating","status","title","documentTitle","formatMessage","useIntl","isCloning","useMatch","CLONE_PATH","params","useParams","id","defaultMessage","_jsxs","Flex","direction","alignItems","paddingTop","initial","large","paddingBottom","gap","_jsx","BackButton","fallback","collectionType","SINGLE_TYPES","undefined","COLLECTION_TYPES","slug","width","justifyContent","medium","Typography","variant","tag","HeaderToolbar","Box","marginTop","DocumentStatus","query","useQueryParams","model","document","meta","useDoc","plugins","useStrapiApp","state","DescriptionComponentRenderer","props","activeTab","documentId","descriptions","apis","getHeaderActions","actions","length","HeaderActions","getDocumentActions","headerActions","filter","action","positions","Array","isArray","position","includes","DocumentActionsMenu","label","Information","createAndUpdateDocument","availableStatus","find","publishedAt","publishDocument","creator","CREATED_BY_ATTRIBUTE_NAME","getDisplayName","updator","UPDATED_BY_ATTRIBUTE_NAME","information","isDisplayed","PUBLISHED_AT_ATTRIBUTE_NAME","value","time","RelativeTime","timestamp","Date","isAnonymous","PUBLISHED_BY_ATTRIBUTE_NAME","author","UPDATED_AT_ATTRIBUTE_NAME","CREATED_AT_ATTRIBUTE_NAME","info","borderWidth","borderStyle","borderColor","padding","marginLeft","marginRight","map","fontWeight","textColor","dialogId","setDialogId","React","useState","handleClick","e","onClick","dialog","muteDialog","preventDefault","handleClose","options","SingleSelect","size","onChange","onSelect","aria-label","option","SingleSelectOption","HeaderActionStatus","tooltip","message","Fragment","IconButton","disabled","icon","HeaderActionDialog","isOpen","onClose","children","open","setOpen","debouncedOpen","useDebounce","handleMouseEnter","handleMouseLeave","Popover","Root","onOpenChange","Anchor","style","alignSelf","onMouseEnter","onMouseLeave","aria-describedby","height","Content","role","side","align","onCancel","content","Dialog","ConfigureTheViewAction","navigate","useNavigate","isDesktop","useIsDesktop","ListPlus","type","EditTheModelAction","Pencil","DeleteAction","listViewPathMatch","LIST_PATH","canDelete","useDocumentRBAC","delete","deleteAction","isLoading","useDocumentActions","toggleNotification","useNotification","setSubmitting","useForm","isLocalized","locale","Trash","WarningCircle","fill","textAlign","loading","onConfirm","console","error","res","pathname","replace","DEFAULT_HEADER_ACTIONS"],"mappings":";;;;;;;;;;;;;;;;;;AAyDMA,MAAAA,MAAAA,GAAS,CAAC,EAAEC,UAAU,EAAEC,MAAM,EAAEC,KAAAA,EAAOC,aAAgB,GAAA,UAAU,EAAe,GAAA;IACpF,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;IAC1B,MAAMC,SAAAA,GAAYC,SAASC,UAAgB,CAAA,KAAA,IAAA;AAC3C,IAAA,MAAMC,MAASC,GAAAA,SAAAA,EAAAA;IAEf,MAAMR,KAAAA,GAAQF,aACVI,aAAc,CAAA;QACZO,EAAI,EAAA,2CAAA;QACJC,cAAgB,EAAA;KAElBT,CAAAA,GAAAA,aAAAA;AAEJ,IAAA,qBACEU,IAACC,CAAAA,IAAAA,EAAAA;QACCC,SAAU,EAAA,QAAA;QACVC,UAAW,EAAA,YAAA;QACXC,UAAY,EAAA;YACVC,OAAS,EAAA,CAAA;YACTC,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AoG,YAAAA,CAAaH,IAAI,GAAG,QAAA;AACpBG,YAAAA,CAAapG,QAAQ,GAAG;AAAC,IAAA,QAAA;AAAU,IAAA;AAAY,CAAA;AAE/C,MAAM8H,sBAAyB,GAAA;AAAC5B,IAAAA,kBAAAA;AAAoBP,IAAAA,sBAAAA;AAAwBS,IAAAA;AAAa;;;;"}
|
|
1
|
+
{"version":3,"file":"Header.mjs","sources":["../../../../../admin/src/pages/EditView/components/Header.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n DescriptionComponentRenderer,\n useForm,\n BackButton,\n useNotification,\n useStrapiApp,\n useQueryParams,\n useIsDesktop,\n useDebounce,\n} from '@strapi/admin/strapi-admin';\nimport {\n Box,\n Flex,\n SingleSelect,\n SingleSelectOption,\n Typography,\n IconButton,\n Dialog,\n Popover,\n} from '@strapi/design-system';\nimport { ListPlus, Pencil, Trash, WarningCircle } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { useMatch, useNavigate, useParams } from 'react-router-dom';\n\nimport { RelativeTime } from '../../../components/RelativeTime';\nimport {\n CREATED_AT_ATTRIBUTE_NAME,\n CREATED_BY_ATTRIBUTE_NAME,\n PUBLISHED_AT_ATTRIBUTE_NAME,\n PUBLISHED_BY_ATTRIBUTE_NAME,\n UPDATED_AT_ATTRIBUTE_NAME,\n UPDATED_BY_ATTRIBUTE_NAME,\n} from '../../../constants/attributes';\nimport { COLLECTION_TYPES, SINGLE_TYPES } from '../../../constants/collections';\nimport { useDocumentRBAC } from '../../../features/DocumentRBAC';\nimport { useDoc } from '../../../hooks/useDocument';\nimport { useDocumentActions } from '../../../hooks/useDocumentActions';\nimport { CLONE_PATH, LIST_PATH } from '../../../router';\nimport { getDisplayName } from '../../../utils/users';\n\nimport { DocumentActionsMenu } from './DocumentActions';\nimport { DocumentStatus } from './DocumentStatus';\n\nimport type { ContentManagerPlugin, DocumentActionComponent } from '../../../content-manager';\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\ninterface HeaderProps {\n isCreating?: boolean;\n status?: 'draft' | 'published' | 'modified';\n title?: string;\n}\n\nconst Header = ({ isCreating, status, title: documentTitle = 'Untitled' }: HeaderProps) => {\n const { formatMessage } = useIntl();\n const isCloning = useMatch(CLONE_PATH) !== null;\n const params = useParams<{ collectionType: string; slug: string }>();\n\n const title = isCreating\n ? formatMessage({\n id: 'content-manager.containers.edit.title.new',\n defaultMessage: 'Create an entry',\n })\n : documentTitle;\n\n return (\n <Flex\n direction=\"column\"\n alignItems=\"flex-start\"\n paddingTop={{\n initial: 4,\n large: 6,\n }}\n paddingBottom={{\n initial: 0,\n large: 4,\n }}\n gap={2}\n >\n <BackButton\n fallback={\n params.collectionType === SINGLE_TYPES\n ? undefined\n : `../${COLLECTION_TYPES}/${params.slug}`\n }\n />\n <Flex\n width=\"100%\"\n justifyContent=\"space-between\"\n gap={{\n initial: 2,\n medium: '8rem',\n }}\n alignItems=\"flex-start\"\n direction={{\n initial: 'column',\n medium: 'row',\n }}\n >\n <Typography variant=\"alpha\" tag=\"h1\">\n {title}\n </Typography>\n <HeaderToolbar />\n </Flex>\n {status ? (\n <Box marginTop={1}>\n <DocumentStatus status={isCloning ? 'draft' : status} />\n </Box>\n ) : null}\n </Flex>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * HeaderToolbar\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DialogOptions {\n type: 'dialog';\n title: string;\n content?: React.ReactNode;\n footer?: React.ReactNode;\n}\n\ninterface HeaderActionDescription {\n disabled?: boolean;\n label: string;\n icon?: React.ReactNode;\n type?: 'icon' | 'default';\n onClick?: (event: React.SyntheticEvent) => Promise<boolean | void> | boolean | void;\n dialog?: DialogOptions;\n options?: Array<{\n disabled?: boolean;\n label: string;\n startIcon?: React.ReactNode;\n textValue?: string;\n value: string;\n /**\n * @internal\n * @description\n * Internal SelectOption renderer used to display the status of AI translation background jobs\n */\n _render?: () => React.ReactNode;\n }>;\n /**\n * @internal\n * @description\n * Internal document header action to display the status of AI translation background jobs\n */\n _status?: {\n message: React.ReactNode;\n tooltip?: React.ReactNode;\n };\n onSelect?: (value: string) => void;\n value?: string;\n customizeContent?: (value: string) => React.ReactNode;\n}\n\n/**\n * @description Contains the document actions that have `position: header`, if there are\n * none we still render the menu because we render the information about the document there.\n */\nconst HeaderToolbar = () => {\n const { formatMessage } = useIntl();\n const isCloning = useMatch(CLONE_PATH) !== null;\n const [\n {\n query: { status = 'draft' },\n },\n ] = useQueryParams<{ status: 'draft' | 'published' }>();\n const { model, id, document, meta, collectionType } = useDoc();\n const plugins = useStrapiApp('HeaderToolbar', (state) => state.plugins);\n\n return (\n <Flex gap={2}>\n <DescriptionComponentRenderer\n props={{\n activeTab: status,\n model,\n documentId: id,\n document: isCloning ? undefined : document,\n meta: isCloning ? undefined : meta,\n collectionType,\n }}\n descriptions={(\n plugins['content-manager'].apis as ContentManagerPlugin['config']['apis']\n ).getHeaderActions()}\n >\n {(actions) => {\n if (actions.length > 0) {\n return <HeaderActions actions={actions} />;\n } else {\n return null;\n }\n }}\n </DescriptionComponentRenderer>\n <DescriptionComponentRenderer\n props={{\n activeTab: status,\n model,\n documentId: id,\n document: isCloning ? undefined : document,\n meta: isCloning ? undefined : meta,\n collectionType,\n }}\n descriptions={(\n plugins['content-manager'].apis as ContentManagerPlugin['config']['apis']\n ).getDocumentActions('header')}\n >\n {(actions) => {\n const headerActions = actions.filter((action) => {\n const positions = Array.isArray(action.position) ? action.position : [action.position];\n return positions.includes('header');\n });\n\n return (\n <DocumentActionsMenu\n actions={headerActions}\n label={formatMessage({\n id: 'content-manager.containers.edit.header.more-actions',\n defaultMessage: 'More actions',\n })}\n >\n <Information activeTab={status} />\n </DocumentActionsMenu>\n );\n }}\n </DescriptionComponentRenderer>\n </Flex>\n );\n};\n\ninterface InformationProps {\n activeTab: 'draft' | 'published';\n}\n\nconst Information = ({ activeTab }: InformationProps) => {\n const { formatMessage } = useIntl();\n const { document, meta } = useDoc();\n\n if (!document || !document.id) {\n return null;\n }\n\n /**\n * Because in the backend separate entries are made for draft and published\n * documents, the creator fields are different for each of them. For example,\n * you could make your draft in January and then publish it for the first time\n * in Feb. This would make the createdAt value for the published entry in Feb\n * but really we want to show the document as a whole. The draft entry will also\n * never have the publishedAt values.\n *\n * So, we decipher which document to show the creator for based on the activeTab.\n */\n\n const createAndUpdateDocument =\n activeTab === 'draft'\n ? document\n : meta?.availableStatus.find((status) => status.publishedAt === null);\n\n const publishDocument =\n activeTab === 'published'\n ? document\n : meta?.availableStatus.find((status) => status.publishedAt !== null);\n\n const creator = createAndUpdateDocument?.[CREATED_BY_ATTRIBUTE_NAME]\n ? getDisplayName(createAndUpdateDocument[CREATED_BY_ATTRIBUTE_NAME])\n : null;\n\n const updator = createAndUpdateDocument?.[UPDATED_BY_ATTRIBUTE_NAME]\n ? getDisplayName(createAndUpdateDocument[UPDATED_BY_ATTRIBUTE_NAME])\n : null;\n\n const information: Array<{ isDisplayed?: boolean; label: string; value: React.ReactNode }> = [\n {\n isDisplayed: !!publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME],\n label: formatMessage({\n id: 'content-manager.containers.edit.information.last-published.label',\n defaultMessage: 'Published',\n }),\n value: formatMessage(\n {\n id: 'content-manager.containers.edit.information.last-published.value',\n defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`,\n },\n {\n time: (\n <RelativeTime timestamp={new Date(publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME])} />\n ),\n isAnonymous: !publishDocument?.[PUBLISHED_BY_ATTRIBUTE_NAME],\n author: publishDocument?.[PUBLISHED_BY_ATTRIBUTE_NAME]\n ? getDisplayName(publishDocument?.[PUBLISHED_BY_ATTRIBUTE_NAME])\n : null,\n }\n ),\n },\n {\n isDisplayed: !!createAndUpdateDocument?.[UPDATED_AT_ATTRIBUTE_NAME],\n label: formatMessage({\n id: 'content-manager.containers.edit.information.last-draft.label',\n defaultMessage: 'Updated',\n }),\n value: formatMessage(\n {\n id: 'content-manager.containers.edit.information.last-draft.value',\n defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`,\n },\n {\n time: (\n <RelativeTime\n timestamp={new Date(createAndUpdateDocument?.[UPDATED_AT_ATTRIBUTE_NAME])}\n />\n ),\n isAnonymous: !updator,\n author: updator,\n }\n ),\n },\n {\n isDisplayed: !!createAndUpdateDocument?.[CREATED_AT_ATTRIBUTE_NAME],\n label: formatMessage({\n id: 'content-manager.containers.edit.information.document.label',\n defaultMessage: 'Created',\n }),\n value: formatMessage(\n {\n id: 'content-manager.containers.edit.information.document.value',\n defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`,\n },\n {\n time: (\n <RelativeTime\n timestamp={new Date(createAndUpdateDocument?.[CREATED_AT_ATTRIBUTE_NAME])}\n />\n ),\n isAnonymous: !creator,\n author: creator,\n }\n ),\n },\n ].filter((info) => info.isDisplayed);\n\n return (\n <Flex\n borderWidth=\"1px 0 0 0\"\n borderStyle=\"solid\"\n borderColor=\"neutral150\"\n direction=\"column\"\n marginTop={2}\n tag=\"dl\"\n padding={5}\n gap={3}\n alignItems=\"flex-start\"\n /**\n * The menu content has a padding of 4px, but we want our divider (the border top applied) to\n * be flush with the menu content. So we need to adjust the margin & width to account for the padding.\n */\n marginLeft=\"-0.4rem\"\n marginRight=\"-0.4rem\"\n width=\"calc(100% + 8px)\"\n >\n {information.map((info) => (\n <Flex gap={1} direction=\"column\" alignItems=\"flex-start\" key={info.label}>\n <Typography tag=\"dt\" variant=\"pi\" fontWeight=\"bold\">\n {info.label}\n </Typography>\n <Typography tag=\"dd\" variant=\"pi\" textColor=\"neutral600\">\n {info.value}\n </Typography>\n </Flex>\n ))}\n </Flex>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * HeaderActions\n * -----------------------------------------------------------------------------------------------*/\n\ninterface HeaderActionsProps {\n actions: Array<HeaderActionDescription & { id: string }>;\n}\n\nconst HeaderActions = ({ actions }: HeaderActionsProps) => {\n const [dialogId, setDialogId] = React.useState<string | null>(null);\n\n const handleClick =\n (action: HeaderActionDescription & { id: string }) => async (e: React.MouseEvent) => {\n if (!('options' in action)) {\n const { onClick = () => false, dialog, id } = action;\n\n const muteDialog = await onClick(e);\n\n if (dialog && !muteDialog) {\n e.preventDefault();\n setDialogId(id);\n }\n }\n };\n\n const handleClose = () => {\n setDialogId(null);\n };\n\n return (\n <Flex gap={1}>\n {actions.map((action) => {\n if (action.options) {\n return (\n <SingleSelect\n key={action.id}\n size=\"S\"\n // @ts-expect-error – the DS will handle numbers, but we're not allowing the API.\n onChange={action.onSelect}\n aria-label={action.label}\n {...action}\n >\n {action.options.map(({ label, ...option }) => {\n if (option._render) {\n return option._render();\n }\n\n return (\n <SingleSelectOption key={option.value} {...option}>\n {label}\n </SingleSelectOption>\n );\n })}\n </SingleSelect>\n );\n } else if (action._status) {\n return (\n <HeaderActionStatus tooltip={action._status?.tooltip} key={action.id}>\n {action._status.message}\n </HeaderActionStatus>\n );\n } else {\n return (\n <React.Fragment key={action.id}>\n <IconButton\n disabled={action.disabled}\n label={action.label}\n size=\"S\"\n onClick={handleClick(action)}\n >\n {action.icon}\n </IconButton>\n {action.dialog ? (\n <HeaderActionDialog\n {...action.dialog}\n isOpen={dialogId === action.id}\n onClose={handleClose}\n />\n ) : null}\n </React.Fragment>\n );\n }\n })}\n </Flex>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * HeaderActionStatus\n * -----------------------------------------------------------------------------------------------*/\n\ninterface HeaderActionStatusProps {\n tooltip: React.ReactNode;\n children: React.ReactNode;\n}\n\nconst HeaderActionStatus = ({ tooltip, children }: HeaderActionStatusProps) => {\n const [open, setOpen] = React.useState(false);\n // Debounce the open/close so the user can hover over the popover content before it closes\n const debouncedOpen = useDebounce(open, 100);\n\n const handleMouseEnter = () => {\n if (tooltip) {\n setOpen(true);\n }\n };\n const handleMouseLeave = () => {\n if (tooltip) {\n setOpen(false);\n }\n };\n\n return (\n <Popover.Root open={debouncedOpen} onOpenChange={setOpen}>\n <Popover.Anchor\n style={{ alignSelf: 'stretch' }}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n aria-describedby=\"document-header-action-status\"\n >\n <Box height=\"100%\">{children}</Box>\n </Popover.Anchor>\n <Popover.Content\n role=\"tooltip\"\n id=\"document-header-action-status\"\n side=\"bottom\"\n align=\"center\"\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {tooltip}\n </Popover.Content>\n </Popover.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * HeaderActionDialog\n * -----------------------------------------------------------------------------------------------*/\ninterface HeaderActionDialogProps {\n onClose: () => void;\n onCancel?: () => Promise<void>;\n title: string;\n content?: React.ReactNode | ((props: { onClose: () => void }) => React.ReactNode);\n isOpen: boolean;\n}\n\nconst HeaderActionDialog = ({\n onClose,\n onCancel,\n title,\n content: Content,\n isOpen,\n}: HeaderActionDialogProps) => {\n const handleClose = async () => {\n if (onCancel) {\n await onCancel();\n }\n\n onClose();\n };\n\n return (\n <Dialog.Root open={isOpen} onOpenChange={handleClose}>\n <Dialog.Content>\n <Dialog.Header>{title}</Dialog.Header>\n {typeof Content === 'function' ? <Content onClose={handleClose} /> : Content}\n </Dialog.Content>\n </Dialog.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DocumentActionComponents\n * -----------------------------------------------------------------------------------------------*/\n\nconst ConfigureTheViewAction: DocumentActionComponent = ({ collectionType, model }) => {\n const navigate = useNavigate();\n const { formatMessage } = useIntl();\n const isDesktop = useIsDesktop();\n\n return isDesktop\n ? {\n label: formatMessage({\n id: 'app.links.configure-view',\n defaultMessage: 'Configure the view',\n }),\n icon: <ListPlus />,\n onClick: () => {\n navigate(`../${collectionType}/${model}/configurations/edit`);\n },\n position: 'header',\n }\n : null;\n};\n\nConfigureTheViewAction.type = 'configure-the-view';\nConfigureTheViewAction.position = 'header';\n\nconst EditTheModelAction: DocumentActionComponent = ({ model }) => {\n const navigate = useNavigate();\n const { formatMessage } = useIntl();\n const isDesktop = useIsDesktop();\n\n return isDesktop\n ? {\n label: formatMessage({\n id: 'content-manager.link-to-ctb',\n defaultMessage: 'Edit the model',\n }),\n icon: <Pencil />,\n onClick: () => {\n navigate(`/plugins/content-type-builder/content-types/${model}`);\n },\n position: 'header',\n }\n : null;\n};\n\nEditTheModelAction.type = 'edit-the-model';\nEditTheModelAction.position = 'header';\n\nconst DeleteAction: DocumentActionComponent = ({ documentId, model, collectionType, document }) => {\n const navigate = useNavigate();\n const { formatMessage } = useIntl();\n const listViewPathMatch = useMatch(LIST_PATH);\n const canDelete = useDocumentRBAC('DeleteAction', (state) => state.canDelete);\n const { delete: deleteAction, isLoading } = useDocumentActions();\n const { toggleNotification } = useNotification();\n const setSubmitting = useForm('DeleteAction', (state) => state.setSubmitting);\n const isLocalized = document?.locale != null;\n\n return {\n disabled: !canDelete || !document,\n label: formatMessage(\n {\n id: 'content-manager.actions.delete.label',\n defaultMessage: 'Delete entry{isLocalized, select, true { (all locales)} other {}}',\n },\n { isLocalized }\n ),\n icon: <Trash />,\n dialog: {\n type: 'dialog',\n title: formatMessage({\n id: 'app.components.ConfirmDialog.title',\n defaultMessage: 'Confirmation',\n }),\n content: (\n <Flex direction=\"column\" gap={2}>\n <WarningCircle width=\"24px\" height=\"24px\" fill=\"danger600\" />\n <Typography tag=\"p\" variant=\"omega\" textAlign=\"center\">\n {formatMessage({\n id: 'content-manager.actions.delete.dialog.body',\n defaultMessage: 'Are you sure?',\n })}\n </Typography>\n </Flex>\n ),\n loading: isLoading,\n onConfirm: async () => {\n /**\n * If we have a match, we're in the list view\n * and therefore not in a form and shouldn't be\n * trying to set the submitting value.\n */\n if (!listViewPathMatch) {\n setSubmitting(true);\n }\n try {\n if (!documentId && collectionType !== SINGLE_TYPES) {\n console.error(\n \"You're trying to delete a document without an id, this is likely a bug with Strapi. Please open an issue.\"\n );\n\n toggleNotification({\n message: formatMessage({\n id: 'content-manager.actions.delete.error',\n defaultMessage: 'An error occurred while trying to delete the document.',\n }),\n type: 'danger',\n });\n\n return;\n }\n\n const res = await deleteAction({\n documentId,\n model,\n collectionType,\n params: {\n locale: '*',\n },\n });\n\n if (!('error' in res)) {\n navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });\n }\n } finally {\n if (!listViewPathMatch) {\n setSubmitting(false);\n }\n }\n },\n },\n variant: 'danger',\n position: ['header', 'table-row'],\n };\n};\n\nDeleteAction.type = 'delete';\nDeleteAction.position = ['header', 'table-row'];\n\nconst DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction];\n\nexport { Header, DEFAULT_HEADER_ACTIONS };\nexport type { HeaderProps, HeaderActionDescription };\n"],"names":["Header","isCreating","status","title","documentTitle","formatMessage","useIntl","isCloning","useMatch","CLONE_PATH","params","useParams","id","defaultMessage","_jsxs","Flex","direction","alignItems","paddingTop","initial","large","paddingBottom","gap","_jsx","BackButton","fallback","collectionType","SINGLE_TYPES","undefined","COLLECTION_TYPES","slug","width","justifyContent","medium","Typography","variant","tag","HeaderToolbar","Box","marginTop","DocumentStatus","query","useQueryParams","model","document","meta","useDoc","plugins","useStrapiApp","state","DescriptionComponentRenderer","props","activeTab","documentId","descriptions","apis","getHeaderActions","actions","length","HeaderActions","getDocumentActions","headerActions","filter","action","positions","Array","isArray","position","includes","DocumentActionsMenu","label","Information","createAndUpdateDocument","availableStatus","find","publishedAt","publishDocument","creator","CREATED_BY_ATTRIBUTE_NAME","getDisplayName","updator","UPDATED_BY_ATTRIBUTE_NAME","information","isDisplayed","PUBLISHED_AT_ATTRIBUTE_NAME","value","time","RelativeTime","timestamp","Date","isAnonymous","PUBLISHED_BY_ATTRIBUTE_NAME","author","UPDATED_AT_ATTRIBUTE_NAME","CREATED_AT_ATTRIBUTE_NAME","info","borderWidth","borderStyle","borderColor","padding","marginLeft","marginRight","map","fontWeight","textColor","dialogId","setDialogId","React","useState","handleClick","e","onClick","dialog","muteDialog","preventDefault","handleClose","options","SingleSelect","size","onChange","onSelect","aria-label","option","_render","SingleSelectOption","_status","HeaderActionStatus","tooltip","message","Fragment","IconButton","disabled","icon","HeaderActionDialog","isOpen","onClose","children","open","setOpen","debouncedOpen","useDebounce","handleMouseEnter","handleMouseLeave","Popover","Root","onOpenChange","Anchor","style","alignSelf","onMouseEnter","onMouseLeave","aria-describedby","height","Content","role","side","align","onCancel","content","Dialog","ConfigureTheViewAction","navigate","useNavigate","isDesktop","useIsDesktop","ListPlus","type","EditTheModelAction","Pencil","DeleteAction","listViewPathMatch","LIST_PATH","canDelete","useDocumentRBAC","delete","deleteAction","isLoading","useDocumentActions","toggleNotification","useNotification","setSubmitting","useForm","isLocalized","locale","Trash","WarningCircle","fill","textAlign","loading","onConfirm","console","error","res","pathname","replace","DEFAULT_HEADER_ACTIONS"],"mappings":";;;;;;;;;;;;;;;;;;AAyDMA,MAAAA,MAAAA,GAAS,CAAC,EAAEC,UAAU,EAAEC,MAAM,EAAEC,KAAAA,EAAOC,aAAgB,GAAA,UAAU,EAAe,GAAA;IACpF,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;IAC1B,MAAMC,SAAAA,GAAYC,SAASC,UAAgB,CAAA,KAAA,IAAA;AAC3C,IAAA,MAAMC,MAASC,GAAAA,SAAAA,EAAAA;IAEf,MAAMR,KAAAA,GAAQF,aACVI,aAAc,CAAA;QACZO,EAAI,EAAA,2CAAA;QACJC,cAAgB,EAAA;KAElBT,CAAAA,GAAAA,aAAAA;AAEJ,IAAA,qBACEU,IAACC,CAAAA,IAAAA,EAAAA;QACCC,SAAU,EAAA,QAAA;QACVC,UAAW,EAAA,YAAA;QACXC,UAAY,EAAA;YACVC,OAAS,EAAA,CAAA;YACTC,KAAO,EAAA;AACT,SAAA;QACAC,aAAe,EAAA;YACbF,OAAS,EAAA,CAAA;YACTC,KAAO,EAAA;AACT,SAAA;QACAE,GAAK,EAAA,CAAA;;0BAELC,GAACC,CAAAA,UAAAA,EAAAA;AACCC,gBA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;AACpBG,YAAAA,CAAatG,QAAQ,GAAG;AAAC,IAAA,QAAA;AAAU,IAAA;AAAY,CAAA;AAE/C,MAAMgI,sBAAyB,GAAA;AAAC5B,IAAAA,kBAAAA;AAAoBP,IAAAA,sBAAAA;AAAwBS,IAAAA;AAAa;;;;"}
|
|
@@ -46,6 +46,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
46
46
|
* the complete EditFieldLayout and will handle RBAC conditions and rendering CM specific
|
|
47
47
|
* components such as Blocks / Relations.
|
|
48
48
|
*/ const InputRenderer = ({ visible, hint: providedHint, document, ...inputProps })=>{
|
|
49
|
+
const localeKey = document?.document?.locale || 'default';
|
|
49
50
|
const { currentDocumentMeta } = useDocumentContext.useDocumentContext('DynamicComponent');
|
|
50
51
|
const { edit: { components } } = useDocumentLayout.useDocumentLayout(currentDocumentMeta.model);
|
|
51
52
|
const collectionType = document.schema?.kind === 'collectionType' ? 'collection-types' : 'single-types';
|
|
@@ -114,7 +115,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
114
115
|
// @ts-expect-error – this workaround lets us display that the custom field is missing.
|
|
115
116
|
type: props.attribute.customField,
|
|
116
117
|
disabled: fieldIsDisabled
|
|
117
|
-
});
|
|
118
|
+
}, `input-${props.name}-${localeKey}`);
|
|
118
119
|
}
|
|
119
120
|
/**
|
|
120
121
|
* This is where we handle ONLY the fields from the `useLibrary` hook.
|
|
@@ -126,7 +127,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
126
127
|
// @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.
|
|
127
128
|
hint: hint,
|
|
128
129
|
disabled: fieldIsDisabled
|
|
129
|
-
});
|
|
130
|
+
}, `input-${props.name}-${localeKey}`);
|
|
130
131
|
}
|
|
131
132
|
/**
|
|
132
133
|
* These include the content-manager specific fields, failing that we fall back
|
|
@@ -138,7 +139,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
138
139
|
hint: hint,
|
|
139
140
|
type: props.type,
|
|
140
141
|
disabled: fieldIsDisabled
|
|
141
|
-
});
|
|
142
|
+
}, `input-${props.name}-${localeKey}`);
|
|
142
143
|
case 'component':
|
|
143
144
|
return /*#__PURE__*/ jsxRuntime.jsx(Input.ComponentInput, {
|
|
144
145
|
...props,
|
|
@@ -147,34 +148,34 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
147
148
|
disabled: fieldIsDisabled,
|
|
148
149
|
children: (componentInputProps)=>/*#__PURE__*/ jsxRuntime.jsx(InputRenderer, {
|
|
149
150
|
...componentInputProps
|
|
150
|
-
})
|
|
151
|
-
});
|
|
151
|
+
}, `input-${componentInputProps.name}-${localeKey}`)
|
|
152
|
+
}, `input-${props.name}-${localeKey}`);
|
|
152
153
|
case 'dynamiczone':
|
|
153
154
|
return /*#__PURE__*/ jsxRuntime.jsx(Field.DynamicZone, {
|
|
154
155
|
...props,
|
|
155
156
|
hint: hint,
|
|
156
157
|
disabled: fieldIsDisabled
|
|
157
|
-
});
|
|
158
|
+
}, `input-${props.name}-${localeKey}`);
|
|
158
159
|
case 'relation':
|
|
159
160
|
return /*#__PURE__*/ jsxRuntime.jsx(Relations.RelationsInput, {
|
|
160
161
|
...props,
|
|
161
162
|
hint: hint,
|
|
162
163
|
disabled: fieldIsDisabled
|
|
163
|
-
});
|
|
164
|
+
}, `input-${props.name}-${localeKey}`);
|
|
164
165
|
case 'richtext':
|
|
165
166
|
return /*#__PURE__*/ jsxRuntime.jsx(Field$1.Wysiwyg, {
|
|
166
167
|
...props,
|
|
167
168
|
hint: hint,
|
|
168
169
|
type: props.type,
|
|
169
170
|
disabled: fieldIsDisabled
|
|
170
|
-
});
|
|
171
|
+
}, `input-${props.name}-${localeKey}`);
|
|
171
172
|
case 'uid':
|
|
172
173
|
return /*#__PURE__*/ jsxRuntime.jsx(UID.UIDInput, {
|
|
173
174
|
...props,
|
|
174
175
|
hint: hint,
|
|
175
176
|
type: props.type,
|
|
176
177
|
disabled: fieldIsDisabled
|
|
177
|
-
});
|
|
178
|
+
}, `input-${props.name}-${localeKey}`);
|
|
178
179
|
/**
|
|
179
180
|
* Enumerations are a special case because they require options.
|
|
180
181
|
*/ case 'enumeration':
|
|
@@ -188,7 +189,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
188
189
|
// @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!
|
|
189
190
|
type: props.customField ? 'custom-field' : props.type,
|
|
190
191
|
disabled: fieldIsDisabled
|
|
191
|
-
});
|
|
192
|
+
}, `input-${props.name}-${localeKey}`);
|
|
192
193
|
default:
|
|
193
194
|
// These props are not needed for the generic form input renderer.
|
|
194
195
|
const { unique: _unique, mainField: _mainField, ...restProps } = props;
|
|
@@ -199,7 +200,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
199
200
|
// @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!
|
|
200
201
|
type: props.customField ? 'custom-field' : props.type,
|
|
201
202
|
disabled: fieldIsDisabled
|
|
202
|
-
});
|
|
203
|
+
}, `input-${props.name}-${localeKey}`);
|
|
203
204
|
}
|
|
204
205
|
};
|
|
205
206
|
const attributeHasCustomFieldProperty = (attribute)=>'customField' in attribute && typeof attribute.customField === 'string';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputRenderer.js","sources":["../../../../../admin/src/pages/EditView/components/InputRenderer.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n useStrapiApp,\n useForm,\n InputRenderer as FormInputRenderer,\n useField,\n} from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\n\nimport { SINGLE_TYPES } from '../../../constants/collections';\nimport { useDocumentRBAC } from '../../../features/DocumentRBAC';\nimport { type UseDocument } from '../../../hooks/useDocument';\nimport { useDocumentContext } from '../../../hooks/useDocumentContext';\nimport { useDocumentLayout } from '../../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../../hooks/useLazyComponents';\nimport { useHasInputPopoverParent } from '../../../preview/components/InputPopover';\nimport { usePreviewInputManager } from '../../../preview/hooks/usePreviewInputManager';\n\nimport { BlocksInput } from './FormInputs/BlocksInput/BlocksInput';\nimport { ComponentInput } from './FormInputs/Component/Input';\nimport { DynamicZone, useDynamicZone } from './FormInputs/DynamicZone/Field';\nimport { NotAllowedInput } from './FormInputs/NotAllowed';\nimport { RelationsInput } from './FormInputs/Relations/Relations';\nimport { UIDInput } from './FormInputs/UID';\nimport { Wysiwyg } from './FormInputs/Wysiwyg/Field';\n\nimport type { EditFieldLayout } from '../../../hooks/useDocumentLayout';\nimport type { Schema } from '@strapi/types';\nimport type { DistributiveOmit } from 'react-redux';\n\ntype InputRendererProps = DistributiveOmit<EditFieldLayout, 'size'> & {\n document: ReturnType<UseDocument>;\n};\n\n/**\n * @internal\n *\n * @description An abstraction around the regular form input renderer designed\n * specifically to be used in the EditView of the content-manager this understands\n * the complete EditFieldLayout and will handle RBAC conditions and rendering CM specific\n * components such as Blocks / Relations.\n */\nconst InputRenderer = ({\n visible,\n hint: providedHint,\n document,\n ...inputProps\n}: InputRendererProps) => {\n const { currentDocumentMeta } = useDocumentContext('DynamicComponent');\n const {\n edit: { components },\n } = useDocumentLayout(currentDocumentMeta.model);\n\n const collectionType =\n document.schema?.kind === 'collectionType' ? 'collection-types' : 'single-types';\n\n const isInDynamicZone = useDynamicZone('isInDynamicZone', (state) => state.isInDynamicZone);\n const isInPreviewPopover = useHasInputPopoverParent();\n const shouldIgnorePermissions = isInDynamicZone || isInPreviewPopover;\n\n const isFormDisabled = useForm('InputRenderer', (state) => state.disabled);\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 let idToCheck = document.document?.documentId;\n if (collectionType === SINGLE_TYPES) {\n idToCheck = document?.document?.documentId;\n }\n\n const editableFields = idToCheck ? canUpdateFields : canCreateFields;\n const readableFields = idToCheck ? canReadFields : canCreateFields;\n\n // Everything preview related\n const previewProps = usePreviewInputManager(inputProps.name, inputProps.attribute);\n const props = { ...inputProps, ...previewProps };\n\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\n // We pass field in case of Custom Fields to keep backward compatibility\n const field = useField(props.name);\n\n if (!visible) {\n return null;\n }\n\n /**\n * If the user can't read the field then we don't want to ever render it.\n */\n if (!canUserReadField && !shouldIgnorePermissions) {\n return <NotAllowedInput hint={hint} {...props} />;\n }\n\n const fieldIsDisabled =\n (!canUserEditField && !shouldIgnorePermissions) || props.disabled || isFormDisabled;\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 {...field}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n return (\n <FormInputRenderer\n {...props}\n {...previewProps}\n hint={hint}\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 * 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 useLazyComponents hook.\n hint={hint}\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 return (\n <ComponentInput\n {...props}\n hint={hint}\n layout={components[props.attribute.component].layout}\n disabled={fieldIsDisabled}\n >\n {(componentInputProps) => <InputRenderer {...componentInputProps} />}\n </ComponentInput>\n );\n case 'dynamiczone':\n return <DynamicZone {...props} hint={hint} disabled={fieldIsDisabled} />;\n case 'relation':\n return <RelationsInput {...props} hint={hint} disabled={fieldIsDisabled} />;\n case 'richtext':\n return <Wysiwyg {...props} hint={hint} type={props.type} disabled={fieldIsDisabled} />;\n case 'uid':\n return <UIDInput {...props} hint={hint} type={props.type} disabled={fieldIsDisabled} />;\n /**\n * Enumerations are a special case because they require options.\n */\n case 'enumeration':\n return (\n <FormInputRenderer\n {...props}\n {...previewProps}\n hint={hint}\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 {...previewProps}\n hint={hint}\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\nconst useFieldHint = (\n hint: React.ReactNode = undefined,\n attribute: Schema.Attribute.AnyAttribute\n) => {\n const { formatMessage } = useIntl();\n\n const { maximum, minimum } = getMinMax(attribute);\n\n if (!maximum && !minimum) {\n return hint;\n }\n\n const units = !['biginteger', 'integer', 'number', 'dynamiczone', 'component'].includes(\n attribute.type\n )\n ? formatMessage(\n {\n id: 'content-manager.form.Input.hint.character.unit',\n defaultMessage: '{maxValue, plural, one { character} other { characters}}',\n },\n {\n maxValue: Math.max(minimum || 0, maximum || 0),\n }\n )\n : null;\n\n const hasMinAndMax = typeof minimum === 'number' && typeof maximum === 'number';\n\n return formatMessage(\n {\n id: 'content-manager.form.Input.hint.text',\n defaultMessage:\n '{min, select, undefined {} other {min. {min}}}{divider}{max, select, undefined {} other {max. {max}}}{unit}{br}{description}',\n },\n {\n min: minimum,\n max: maximum,\n description: hint,\n unit: units,\n divider: hasMinAndMax\n ? formatMessage({\n id: 'content-manager.form.Input.hint.minMaxDivider',\n defaultMessage: ' / ',\n })\n : null,\n br: <br />,\n }\n );\n};\n\nconst getMinMax = (attribute: Schema.Attribute.AnyAttribute) => {\n if ('min' in attribute || 'max' in attribute) {\n return {\n maximum: !Number.isNaN(Number(attribute.max)) ? Number(attribute.max) : undefined,\n minimum: !Number.isNaN(Number(attribute.min)) ? Number(attribute.min) : undefined,\n };\n } else if ('maxLength' in attribute || 'minLength' in attribute) {\n return { maximum: attribute.maxLength, minimum: attribute.minLength };\n } else {\n return { maximum: undefined, minimum: undefined };\n }\n};\n\nconst MemoizedInputRenderer = React.memo(InputRenderer);\n\nexport type { InputRendererProps };\nexport { MemoizedInputRenderer as InputRenderer, useFieldHint };\n"],"names":["InputRenderer","visible","hint","providedHint","document","inputProps","currentDocumentMeta","useDocumentContext","edit","components","useDocumentLayout","model","collectionType","schema","kind","isInDynamicZone","useDynamicZone","state","isInPreviewPopover","useHasInputPopoverParent","shouldIgnorePermissions","isFormDisabled","useForm","disabled","canCreateFields","useDocumentRBAC","rbac","canReadFields","canUpdateFields","canUserAction","idToCheck","documentId","SINGLE_TYPES","editableFields","readableFields","previewProps","usePreviewInputManager","name","attribute","props","canUserReadField","type","canUserEditField","fields","useStrapiApp","app","lazyComponentStore","useLazyComponents","attributeHasCustomFieldProperty","customField","undefined","useFieldHint","field","useField","_jsx","NotAllowedInput","fieldIsDisabled","CustomInput","FormInputRenderer","addedInputTypes","Object","keys","includes","BlocksInput","ComponentInput","layout","component","componentInputProps","DynamicZone","RelationsInput","Wysiwyg","UIDInput","options","enum","map","value","unique","_unique","mainField","_mainField","restProps","formatMessage","useIntl","maximum","minimum","getMinMax","units","id","defaultMessage","maxValue","Math","max","hasMinAndMax","min","description","unit","divider","br","Number","isNaN","maxLength","minLength","MemoizedInputRenderer","React","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA;;;;;;;AAOC,IACD,MAAMA,aAAAA,GAAgB,CAAC,EACrBC,OAAO,EACPC,IAAMC,EAAAA,YAAY,EAClBC,QAAQ,EACR,GAAGC,UACgB,EAAA,GAAA;AACnB,IAAA,MAAM,EAAEC,mBAAmB,EAAE,GAAGC,qCAAmB,CAAA,kBAAA,CAAA;IACnD,MAAM,EACJC,MAAM,EAAEC,UAAU,EAAE,EACrB,GAAGC,mCAAkBJ,CAAAA,mBAAAA,CAAoBK,KAAK,CAAA;AAE/C,IAAA,MAAMC,iBACJR,QAASS,CAAAA,MAAM,EAAEC,IAAAA,KAAS,mBAAmB,kBAAqB,GAAA,cAAA;AAEpE,IAAA,MAAMC,kBAAkBC,oBAAe,CAAA,iBAAA,EAAmB,CAACC,KAAAA,GAAUA,MAAMF,eAAe,CAAA;AAC1F,IAAA,MAAMG,kBAAqBC,GAAAA,qCAAAA,EAAAA;AAC3B,IAAA,MAAMC,0BAA0BL,eAAmBG,IAAAA,kBAAAA;AAEnD,IAAA,MAAMG,iBAAiBC,mBAAQ,CAAA,eAAA,EAAiB,CAACL,KAAAA,GAAUA,MAAMM,QAAQ,CAAA;AACzE,IAAA,MAAMC,kBAAkBC,4BAAg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ASA,SAAa,IAAA,KAAA,IAASA,SAAW,EAAA;QAC5C,OAAO;YACL6C,OAAS,EAAA,CAACe,MAAOC,CAAAA,KAAK,CAACD,MAAAA,CAAO5D,SAAUqD,CAAAA,GAAG,CAAKO,CAAAA,GAAAA,MAAAA,CAAO5D,SAAUqD,CAAAA,GAAG,CAAIzC,GAAAA,SAAAA;YACxEkC,OAAS,EAAA,CAACc,MAAOC,CAAAA,KAAK,CAACD,MAAAA,CAAO5D,SAAUuD,CAAAA,GAAG,CAAKK,CAAAA,GAAAA,MAAAA,CAAO5D,SAAUuD,CAAAA,GAAG,CAAI3C,GAAAA;AAC1E,SAAA;AACF,KAAA,MAAO,IAAI,WAAA,IAAeZ,SAAa,IAAA,WAAA,IAAeA,SAAW,EAAA;QAC/D,OAAO;AAAE6C,YAAAA,OAAAA,EAAS7C,UAAU8D,SAAS;AAAEhB,YAAAA,OAAAA,EAAS9C,UAAU+D;AAAU,SAAA;KAC/D,MAAA;QACL,OAAO;YAAElB,OAASjC,EAAAA,SAAAA;YAAWkC,OAASlC,EAAAA;AAAU,SAAA;AAClD;AACF,CAAA;AAEMoD,MAAAA,qBAAAA,iBAAwBC,gBAAMC,CAAAA,IAAI,CAACxG,aAAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"InputRenderer.js","sources":["../../../../../admin/src/pages/EditView/components/InputRenderer.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n useStrapiApp,\n useForm,\n InputRenderer as FormInputRenderer,\n useField,\n} from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\n\nimport { SINGLE_TYPES } from '../../../constants/collections';\nimport { useDocumentRBAC } from '../../../features/DocumentRBAC';\nimport { type UseDocument } from '../../../hooks/useDocument';\nimport { useDocumentContext } from '../../../hooks/useDocumentContext';\nimport { useDocumentLayout } from '../../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../../hooks/useLazyComponents';\nimport { useHasInputPopoverParent } from '../../../preview/components/InputPopover';\nimport { usePreviewInputManager } from '../../../preview/hooks/usePreviewInputManager';\n\nimport { BlocksInput } from './FormInputs/BlocksInput/BlocksInput';\nimport { ComponentInput } from './FormInputs/Component/Input';\nimport { DynamicZone, useDynamicZone } from './FormInputs/DynamicZone/Field';\nimport { NotAllowedInput } from './FormInputs/NotAllowed';\nimport { RelationsInput } from './FormInputs/Relations/Relations';\nimport { UIDInput } from './FormInputs/UID';\nimport { Wysiwyg } from './FormInputs/Wysiwyg/Field';\n\nimport type { EditFieldLayout } from '../../../hooks/useDocumentLayout';\nimport type { Schema } from '@strapi/types';\nimport type { DistributiveOmit } from 'react-redux';\n\ntype InputRendererProps = DistributiveOmit<EditFieldLayout, 'size'> & {\n document: ReturnType<UseDocument>;\n};\n\n/**\n * @internal\n *\n * @description An abstraction around the regular form input renderer designed\n * specifically to be used in the EditView of the content-manager this understands\n * the complete EditFieldLayout and will handle RBAC conditions and rendering CM specific\n * components such as Blocks / Relations.\n */\nconst InputRenderer = ({\n visible,\n hint: providedHint,\n document,\n ...inputProps\n}: InputRendererProps) => {\n const localeKey = document?.document?.locale || 'default';\n const { currentDocumentMeta } = useDocumentContext('DynamicComponent');\n const {\n edit: { components },\n } = useDocumentLayout(currentDocumentMeta.model);\n\n const collectionType =\n document.schema?.kind === 'collectionType' ? 'collection-types' : 'single-types';\n\n const isInDynamicZone = useDynamicZone('isInDynamicZone', (state) => state.isInDynamicZone);\n const isInPreviewPopover = useHasInputPopoverParent();\n const shouldIgnorePermissions = isInDynamicZone || isInPreviewPopover;\n\n const isFormDisabled = useForm('InputRenderer', (state) => state.disabled);\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 let idToCheck = document.document?.documentId;\n if (collectionType === SINGLE_TYPES) {\n idToCheck = document?.document?.documentId;\n }\n\n const editableFields = idToCheck ? canUpdateFields : canCreateFields;\n const readableFields = idToCheck ? canReadFields : canCreateFields;\n\n // Everything preview related\n const previewProps = usePreviewInputManager(inputProps.name, inputProps.attribute);\n const props = { ...inputProps, ...previewProps };\n\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\n // We pass field in case of Custom Fields to keep backward compatibility\n const field = useField(props.name);\n\n if (!visible) {\n return null;\n }\n\n /**\n * If the user can't read the field then we don't want to ever render it.\n */\n if (!canUserReadField && !shouldIgnorePermissions) {\n return <NotAllowedInput hint={hint} {...props} />;\n }\n\n const fieldIsDisabled =\n (!canUserEditField && !shouldIgnorePermissions) || props.disabled || isFormDisabled;\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 {...field}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n return (\n <FormInputRenderer\n key={`input-${props.name}-${localeKey}`}\n {...props}\n {...previewProps}\n hint={hint}\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 * 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 key={`input-${props.name}-${localeKey}`}\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\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 (\n <BlocksInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n type={props.type}\n disabled={fieldIsDisabled}\n />\n );\n case 'component':\n return (\n <ComponentInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n layout={components[props.attribute.component].layout}\n disabled={fieldIsDisabled}\n >\n {(componentInputProps) => (\n <InputRenderer\n key={`input-${componentInputProps.name}-${localeKey}`}\n {...componentInputProps}\n />\n )}\n </ComponentInput>\n );\n case 'dynamiczone':\n return (\n <DynamicZone\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n case 'relation':\n return (\n <RelationsInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n case 'richtext':\n return (\n <Wysiwyg\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n type={props.type}\n disabled={fieldIsDisabled}\n />\n );\n case 'uid':\n return (\n <UIDInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n type={props.type}\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 key={`input-${props.name}-${localeKey}`}\n {...props}\n {...previewProps}\n hint={hint}\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 key={`input-${props.name}-${localeKey}`}\n {...restProps}\n {...previewProps}\n hint={hint}\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\nconst useFieldHint = (\n hint: React.ReactNode = undefined,\n attribute: Schema.Attribute.AnyAttribute\n) => {\n const { formatMessage } = useIntl();\n\n const { maximum, minimum } = getMinMax(attribute);\n\n if (!maximum && !minimum) {\n return hint;\n }\n\n const units = !['biginteger', 'integer', 'number', 'dynamiczone', 'component'].includes(\n attribute.type\n )\n ? formatMessage(\n {\n id: 'content-manager.form.Input.hint.character.unit',\n defaultMessage: '{maxValue, plural, one { character} other { characters}}',\n },\n {\n maxValue: Math.max(minimum || 0, maximum || 0),\n }\n )\n : null;\n\n const hasMinAndMax = typeof minimum === 'number' && typeof maximum === 'number';\n\n return formatMessage(\n {\n id: 'content-manager.form.Input.hint.text',\n defaultMessage:\n '{min, select, undefined {} other {min. {min}}}{divider}{max, select, undefined {} other {max. {max}}}{unit}{br}{description}',\n },\n {\n min: minimum,\n max: maximum,\n description: hint,\n unit: units,\n divider: hasMinAndMax\n ? formatMessage({\n id: 'content-manager.form.Input.hint.minMaxDivider',\n defaultMessage: ' / ',\n })\n : null,\n br: <br />,\n }\n );\n};\n\nconst getMinMax = (attribute: Schema.Attribute.AnyAttribute) => {\n if ('min' in attribute || 'max' in attribute) {\n return {\n maximum: !Number.isNaN(Number(attribute.max)) ? Number(attribute.max) : undefined,\n minimum: !Number.isNaN(Number(attribute.min)) ? Number(attribute.min) : undefined,\n };\n } else if ('maxLength' in attribute || 'minLength' in attribute) {\n return { maximum: attribute.maxLength, minimum: attribute.minLength };\n } else {\n return { maximum: undefined, minimum: undefined };\n }\n};\n\nconst MemoizedInputRenderer = React.memo(InputRenderer);\n\nexport type { InputRendererProps };\nexport { MemoizedInputRenderer as InputRenderer, useFieldHint };\n"],"names":["InputRenderer","visible","hint","providedHint","document","inputProps","localeKey","locale","currentDocumentMeta","useDocumentContext","edit","components","useDocumentLayout","model","collectionType","schema","kind","isInDynamicZone","useDynamicZone","state","isInPreviewPopover","useHasInputPopoverParent","shouldIgnorePermissions","isFormDisabled","useForm","disabled","canCreateFields","useDocumentRBAC","rbac","canReadFields","canUpdateFields","canUserAction","idToCheck","documentId","SINGLE_TYPES","editableFields","readableFields","previewProps","usePreviewInputManager","name","attribute","props","canUserReadField","type","canUserEditField","fields","useStrapiApp","app","lazyComponentStore","useLazyComponents","attributeHasCustomFieldProperty","customField","undefined","useFieldHint","field","useField","_jsx","NotAllowedInput","fieldIsDisabled","CustomInput","FormInputRenderer","addedInputTypes","Object","keys","includes","BlocksInput","ComponentInput","layout","component","componentInputProps","DynamicZone","RelationsInput","Wysiwyg","UIDInput","options","enum","map","value","unique","_unique","mainField","_mainField","restProps","formatMessage","useIntl","maximum","minimum","getMinMax","units","id","defaultMessage","maxValue","Math","max","hasMinAndMax","min","description","unit","divider","br","Number","isNaN","maxLength","minLength","MemoizedInputRenderer","React","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA;;;;;;;AAOC,IACD,MAAMA,aAAAA,GAAgB,CAAC,EACrBC,OAAO,EACPC,IAAMC,EAAAA,YAAY,EAClBC,QAAQ,EACR,GAAGC,UACgB,EAAA,GAAA;IACnB,MAAMC,SAAAA,GAAYF,QAAUA,EAAAA,QAAAA,EAAUG,MAAU,IAAA,SAAA;AAChD,IAAA,MAAM,EAAEC,mBAAmB,EAAE,GAAGC,qCAAmB,CAAA,kBAAA,CAAA;IACnD,MAAM,EACJC,MAAM,EAAEC,UAAU,EAAE,EACrB,GAAGC,mCAAkBJ,CAAAA,mBAAAA,CAAoBK,KAAK,CAAA;AAE/C,IAAA,MAAMC,iB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IAAAA;QACb+F,IAAMT,EAAAA,KAAAA;AACNU,QAAAA,OAAAA,EAASJ,eACLX,aAAc,CAAA;YACZM,EAAI,EAAA,+CAAA;YACJC,cAAgB,EAAA;SAElB,CAAA,GAAA,IAAA;AACJS,QAAAA,EAAAA,gBAAI3C,cAAC2C,CAAAA,IAAAA,EAAAA,EAAAA;AACP,KAAA,CAAA;AAEJ;AAEA,MAAMZ,YAAY,CAAC/C,SAAAA,GAAAA;IACjB,IAAI,KAAA,IAASA,SAAa,IAAA,KAAA,IAASA,SAAW,EAAA;QAC5C,OAAO;YACL6C,OAAS,EAAA,CAACe,MAAOC,CAAAA,KAAK,CAACD,MAAAA,CAAO5D,SAAUqD,CAAAA,GAAG,CAAKO,CAAAA,GAAAA,MAAAA,CAAO5D,SAAUqD,CAAAA,GAAG,CAAIzC,GAAAA,SAAAA;YACxEkC,OAAS,EAAA,CAACc,MAAOC,CAAAA,KAAK,CAACD,MAAAA,CAAO5D,SAAUuD,CAAAA,GAAG,CAAKK,CAAAA,GAAAA,MAAAA,CAAO5D,SAAUuD,CAAAA,GAAG,CAAI3C,GAAAA;AAC1E,SAAA;AACF,KAAA,MAAO,IAAI,WAAA,IAAeZ,SAAa,IAAA,WAAA,IAAeA,SAAW,EAAA;QAC/D,OAAO;AAAE6C,YAAAA,OAAAA,EAAS7C,UAAU8D,SAAS;AAAEhB,YAAAA,OAAAA,EAAS9C,UAAU+D;AAAU,SAAA;KAC/D,MAAA;QACL,OAAO;YAAElB,OAASjC,EAAAA,SAAAA;YAAWkC,OAASlC,EAAAA;AAAU,SAAA;AAClD;AACF,CAAA;AAEMoD,MAAAA,qBAAAA,iBAAwBC,gBAAMC,CAAAA,IAAI,CAAC1G,aAAAA;;;;;"}
|
|
@@ -25,6 +25,7 @@ import { Wysiwyg as MemoizedWysiwyg } from './FormInputs/Wysiwyg/Field.mjs';
|
|
|
25
25
|
* the complete EditFieldLayout and will handle RBAC conditions and rendering CM specific
|
|
26
26
|
* components such as Blocks / Relations.
|
|
27
27
|
*/ const InputRenderer = ({ visible, hint: providedHint, document, ...inputProps })=>{
|
|
28
|
+
const localeKey = document?.document?.locale || 'default';
|
|
28
29
|
const { currentDocumentMeta } = useDocumentContext('DynamicComponent');
|
|
29
30
|
const { edit: { components } } = useDocumentLayout(currentDocumentMeta.model);
|
|
30
31
|
const collectionType = document.schema?.kind === 'collectionType' ? 'collection-types' : 'single-types';
|
|
@@ -93,7 +94,7 @@ import { Wysiwyg as MemoizedWysiwyg } from './FormInputs/Wysiwyg/Field.mjs';
|
|
|
93
94
|
// @ts-expect-error – this workaround lets us display that the custom field is missing.
|
|
94
95
|
type: props.attribute.customField,
|
|
95
96
|
disabled: fieldIsDisabled
|
|
96
|
-
});
|
|
97
|
+
}, `input-${props.name}-${localeKey}`);
|
|
97
98
|
}
|
|
98
99
|
/**
|
|
99
100
|
* This is where we handle ONLY the fields from the `useLibrary` hook.
|
|
@@ -105,7 +106,7 @@ import { Wysiwyg as MemoizedWysiwyg } from './FormInputs/Wysiwyg/Field.mjs';
|
|
|
105
106
|
// @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.
|
|
106
107
|
hint: hint,
|
|
107
108
|
disabled: fieldIsDisabled
|
|
108
|
-
});
|
|
109
|
+
}, `input-${props.name}-${localeKey}`);
|
|
109
110
|
}
|
|
110
111
|
/**
|
|
111
112
|
* These include the content-manager specific fields, failing that we fall back
|
|
@@ -117,7 +118,7 @@ import { Wysiwyg as MemoizedWysiwyg } from './FormInputs/Wysiwyg/Field.mjs';
|
|
|
117
118
|
hint: hint,
|
|
118
119
|
type: props.type,
|
|
119
120
|
disabled: fieldIsDisabled
|
|
120
|
-
});
|
|
121
|
+
}, `input-${props.name}-${localeKey}`);
|
|
121
122
|
case 'component':
|
|
122
123
|
return /*#__PURE__*/ jsx(MemoizedComponentInput, {
|
|
123
124
|
...props,
|
|
@@ -126,34 +127,34 @@ import { Wysiwyg as MemoizedWysiwyg } from './FormInputs/Wysiwyg/Field.mjs';
|
|
|
126
127
|
disabled: fieldIsDisabled,
|
|
127
128
|
children: (componentInputProps)=>/*#__PURE__*/ jsx(InputRenderer, {
|
|
128
129
|
...componentInputProps
|
|
129
|
-
})
|
|
130
|
-
});
|
|
130
|
+
}, `input-${componentInputProps.name}-${localeKey}`)
|
|
131
|
+
}, `input-${props.name}-${localeKey}`);
|
|
131
132
|
case 'dynamiczone':
|
|
132
133
|
return /*#__PURE__*/ jsx(DynamicZone, {
|
|
133
134
|
...props,
|
|
134
135
|
hint: hint,
|
|
135
136
|
disabled: fieldIsDisabled
|
|
136
|
-
});
|
|
137
|
+
}, `input-${props.name}-${localeKey}`);
|
|
137
138
|
case 'relation':
|
|
138
139
|
return /*#__PURE__*/ jsx(MemoizedRelationsField, {
|
|
139
140
|
...props,
|
|
140
141
|
hint: hint,
|
|
141
142
|
disabled: fieldIsDisabled
|
|
142
|
-
});
|
|
143
|
+
}, `input-${props.name}-${localeKey}`);
|
|
143
144
|
case 'richtext':
|
|
144
145
|
return /*#__PURE__*/ jsx(MemoizedWysiwyg, {
|
|
145
146
|
...props,
|
|
146
147
|
hint: hint,
|
|
147
148
|
type: props.type,
|
|
148
149
|
disabled: fieldIsDisabled
|
|
149
|
-
});
|
|
150
|
+
}, `input-${props.name}-${localeKey}`);
|
|
150
151
|
case 'uid':
|
|
151
152
|
return /*#__PURE__*/ jsx(MemoizedUIDInput, {
|
|
152
153
|
...props,
|
|
153
154
|
hint: hint,
|
|
154
155
|
type: props.type,
|
|
155
156
|
disabled: fieldIsDisabled
|
|
156
|
-
});
|
|
157
|
+
}, `input-${props.name}-${localeKey}`);
|
|
157
158
|
/**
|
|
158
159
|
* Enumerations are a special case because they require options.
|
|
159
160
|
*/ case 'enumeration':
|
|
@@ -167,7 +168,7 @@ import { Wysiwyg as MemoizedWysiwyg } from './FormInputs/Wysiwyg/Field.mjs';
|
|
|
167
168
|
// @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!
|
|
168
169
|
type: props.customField ? 'custom-field' : props.type,
|
|
169
170
|
disabled: fieldIsDisabled
|
|
170
|
-
});
|
|
171
|
+
}, `input-${props.name}-${localeKey}`);
|
|
171
172
|
default:
|
|
172
173
|
// These props are not needed for the generic form input renderer.
|
|
173
174
|
const { unique: _unique, mainField: _mainField, ...restProps } = props;
|
|
@@ -178,7 +179,7 @@ import { Wysiwyg as MemoizedWysiwyg } from './FormInputs/Wysiwyg/Field.mjs';
|
|
|
178
179
|
// @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!
|
|
179
180
|
type: props.customField ? 'custom-field' : props.type,
|
|
180
181
|
disabled: fieldIsDisabled
|
|
181
|
-
});
|
|
182
|
+
}, `input-${props.name}-${localeKey}`);
|
|
182
183
|
}
|
|
183
184
|
};
|
|
184
185
|
const attributeHasCustomFieldProperty = (attribute)=>'customField' in attribute && typeof attribute.customField === 'string';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputRenderer.mjs","sources":["../../../../../admin/src/pages/EditView/components/InputRenderer.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n useStrapiApp,\n useForm,\n InputRenderer as FormInputRenderer,\n useField,\n} from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\n\nimport { SINGLE_TYPES } from '../../../constants/collections';\nimport { useDocumentRBAC } from '../../../features/DocumentRBAC';\nimport { type UseDocument } from '../../../hooks/useDocument';\nimport { useDocumentContext } from '../../../hooks/useDocumentContext';\nimport { useDocumentLayout } from '../../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../../hooks/useLazyComponents';\nimport { useHasInputPopoverParent } from '../../../preview/components/InputPopover';\nimport { usePreviewInputManager } from '../../../preview/hooks/usePreviewInputManager';\n\nimport { BlocksInput } from './FormInputs/BlocksInput/BlocksInput';\nimport { ComponentInput } from './FormInputs/Component/Input';\nimport { DynamicZone, useDynamicZone } from './FormInputs/DynamicZone/Field';\nimport { NotAllowedInput } from './FormInputs/NotAllowed';\nimport { RelationsInput } from './FormInputs/Relations/Relations';\nimport { UIDInput } from './FormInputs/UID';\nimport { Wysiwyg } from './FormInputs/Wysiwyg/Field';\n\nimport type { EditFieldLayout } from '../../../hooks/useDocumentLayout';\nimport type { Schema } from '@strapi/types';\nimport type { DistributiveOmit } from 'react-redux';\n\ntype InputRendererProps = DistributiveOmit<EditFieldLayout, 'size'> & {\n document: ReturnType<UseDocument>;\n};\n\n/**\n * @internal\n *\n * @description An abstraction around the regular form input renderer designed\n * specifically to be used in the EditView of the content-manager this understands\n * the complete EditFieldLayout and will handle RBAC conditions and rendering CM specific\n * components such as Blocks / Relations.\n */\nconst InputRenderer = ({\n visible,\n hint: providedHint,\n document,\n ...inputProps\n}: InputRendererProps) => {\n const { currentDocumentMeta } = useDocumentContext('DynamicComponent');\n const {\n edit: { components },\n } = useDocumentLayout(currentDocumentMeta.model);\n\n const collectionType =\n document.schema?.kind === 'collectionType' ? 'collection-types' : 'single-types';\n\n const isInDynamicZone = useDynamicZone('isInDynamicZone', (state) => state.isInDynamicZone);\n const isInPreviewPopover = useHasInputPopoverParent();\n const shouldIgnorePermissions = isInDynamicZone || isInPreviewPopover;\n\n const isFormDisabled = useForm('InputRenderer', (state) => state.disabled);\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 let idToCheck = document.document?.documentId;\n if (collectionType === SINGLE_TYPES) {\n idToCheck = document?.document?.documentId;\n }\n\n const editableFields = idToCheck ? canUpdateFields : canCreateFields;\n const readableFields = idToCheck ? canReadFields : canCreateFields;\n\n // Everything preview related\n const previewProps = usePreviewInputManager(inputProps.name, inputProps.attribute);\n const props = { ...inputProps, ...previewProps };\n\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\n // We pass field in case of Custom Fields to keep backward compatibility\n const field = useField(props.name);\n\n if (!visible) {\n return null;\n }\n\n /**\n * If the user can't read the field then we don't want to ever render it.\n */\n if (!canUserReadField && !shouldIgnorePermissions) {\n return <NotAllowedInput hint={hint} {...props} />;\n }\n\n const fieldIsDisabled =\n (!canUserEditField && !shouldIgnorePermissions) || props.disabled || isFormDisabled;\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 {...field}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n return (\n <FormInputRenderer\n {...props}\n {...previewProps}\n hint={hint}\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 * 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 useLazyComponents hook.\n hint={hint}\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 return (\n <ComponentInput\n {...props}\n hint={hint}\n layout={components[props.attribute.component].layout}\n disabled={fieldIsDisabled}\n >\n {(componentInputProps) => <InputRenderer {...componentInputProps} />}\n </ComponentInput>\n );\n case 'dynamiczone':\n return <DynamicZone {...props} hint={hint} disabled={fieldIsDisabled} />;\n case 'relation':\n return <RelationsInput {...props} hint={hint} disabled={fieldIsDisabled} />;\n case 'richtext':\n return <Wysiwyg {...props} hint={hint} type={props.type} disabled={fieldIsDisabled} />;\n case 'uid':\n return <UIDInput {...props} hint={hint} type={props.type} disabled={fieldIsDisabled} />;\n /**\n * Enumerations are a special case because they require options.\n */\n case 'enumeration':\n return (\n <FormInputRenderer\n {...props}\n {...previewProps}\n hint={hint}\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 {...previewProps}\n hint={hint}\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\nconst useFieldHint = (\n hint: React.ReactNode = undefined,\n attribute: Schema.Attribute.AnyAttribute\n) => {\n const { formatMessage } = useIntl();\n\n const { maximum, minimum } = getMinMax(attribute);\n\n if (!maximum && !minimum) {\n return hint;\n }\n\n const units = !['biginteger', 'integer', 'number', 'dynamiczone', 'component'].includes(\n attribute.type\n )\n ? formatMessage(\n {\n id: 'content-manager.form.Input.hint.character.unit',\n defaultMessage: '{maxValue, plural, one { character} other { characters}}',\n },\n {\n maxValue: Math.max(minimum || 0, maximum || 0),\n }\n )\n : null;\n\n const hasMinAndMax = typeof minimum === 'number' && typeof maximum === 'number';\n\n return formatMessage(\n {\n id: 'content-manager.form.Input.hint.text',\n defaultMessage:\n '{min, select, undefined {} other {min. {min}}}{divider}{max, select, undefined {} other {max. {max}}}{unit}{br}{description}',\n },\n {\n min: minimum,\n max: maximum,\n description: hint,\n unit: units,\n divider: hasMinAndMax\n ? formatMessage({\n id: 'content-manager.form.Input.hint.minMaxDivider',\n defaultMessage: ' / ',\n })\n : null,\n br: <br />,\n }\n );\n};\n\nconst getMinMax = (attribute: Schema.Attribute.AnyAttribute) => {\n if ('min' in attribute || 'max' in attribute) {\n return {\n maximum: !Number.isNaN(Number(attribute.max)) ? Number(attribute.max) : undefined,\n minimum: !Number.isNaN(Number(attribute.min)) ? Number(attribute.min) : undefined,\n };\n } else if ('maxLength' in attribute || 'minLength' in attribute) {\n return { maximum: attribute.maxLength, minimum: attribute.minLength };\n } else {\n return { maximum: undefined, minimum: undefined };\n }\n};\n\nconst MemoizedInputRenderer = React.memo(InputRenderer);\n\nexport type { InputRendererProps };\nexport { MemoizedInputRenderer as InputRenderer, useFieldHint };\n"],"names":["InputRenderer","visible","hint","providedHint","document","inputProps","currentDocumentMeta","useDocumentContext","edit","components","useDocumentLayout","model","collectionType","schema","kind","isInDynamicZone","useDynamicZone","state","isInPreviewPopover","useHasInputPopoverParent","shouldIgnorePermissions","isFormDisabled","useForm","disabled","canCreateFields","useDocumentRBAC","rbac","canReadFields","canUpdateFields","canUserAction","idToCheck","documentId","SINGLE_TYPES","editableFields","readableFields","previewProps","usePreviewInputManager","name","attribute","props","canUserReadField","type","canUserEditField","fields","useStrapiApp","app","lazyComponentStore","useLazyComponents","attributeHasCustomFieldProperty","customField","undefined","useFieldHint","field","useField","_jsx","NotAllowedInput","fieldIsDisabled","CustomInput","FormInputRenderer","addedInputTypes","Object","keys","includes","BlocksInput","ComponentInput","layout","component","componentInputProps","DynamicZone","RelationsInput","Wysiwyg","UIDInput","options","enum","map","value","unique","_unique","mainField","_mainField","restProps","formatMessage","useIntl","maximum","minimum","getMinMax","units","id","defaultMessage","maxValue","Math","max","hasMinAndMax","min","description","unit","divider","br","Number","isNaN","maxLength","minLength","MemoizedInputRenderer","React","memo"],"mappings":";;;;;;;;;;;;;;;;;;;AAmCA;;;;;;;AAOC,IACD,MAAMA,aAAAA,GAAgB,CAAC,EACrBC,OAAO,EACPC,IAAMC,EAAAA,YAAY,EAClBC,QAAQ,EACR,GAAGC,UACgB,EAAA,GAAA;AACnB,IAAA,MAAM,EAAEC,mBAAmB,EAAE,GAAGC,kBAAmB,CAAA,kBAAA,CAAA;IACnD,MAAM,EACJC,MAAM,EAAEC,UAAU,EAAE,EACrB,GAAGC,iBAAkBJ,CAAAA,mBAAAA,CAAoBK,KAAK,CAAA;AAE/C,IAAA,MAAMC,iBACJR,QAASS,CAAAA,MAAM,EAAEC,IAAAA,KAAS,mBAAmB,kBAAqB,GAAA,cAAA;AAEpE,IAAA,MAAMC,kBAAkBC,cAAe,CAAA,iBAAA,EAAmB,CAACC,KAAAA,GAAUA,MAAMF,eAAe,CAAA;AAC1F,IAAA,MAAMG,kBAAqBC,GAAAA,wBAAAA,EAAAA;AAC3B,IAAA,MAAMC,0BAA0BL,eAAmBG,IAAAA,kBAAAA;AAEnD,IAAA,MAAMG,iBAAiBC,OAAQ,CAAA,eAAA,EAAiB,CAACL,KAAAA,GAAUA,MAAMM,QAAQ,CAAA;AACzE,IAAA,MAAMC,kBAAkBC,eAAgB,CAAA,eAAA,EAAiB,CAACC,IAAAA,GAASA,KAAKF,eAAe,CAAA;AACvF,IAAA,MAAMG,gBAAgBF,eAAgB,CAAA,eAAA,EAAiB,CAACC,IAAAA,GAASA,KAAKC,aAAa,CAAA;AACnF,IAAA,MAAMC,kBAAkBH,eAAgB,CAAA,eAAA,EAAiB,CAACC,IAAAA,GAASA,KAAKE,eAAe,CAAA;AACvF,IAAA,MAAMC,gBAAgBJ,eAAgB,CAAA,eAAA,EAAiB,CAACC,IAAAA,GAASA,KAAK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,CAAO5D,SAAUuD,CAAAA,GAAG,CAAI3C,GAAAA;AAC1E,SAAA;AACF,KAAA,MAAO,IAAI,WAAA,IAAeZ,SAAa,IAAA,WAAA,IAAeA,SAAW,EAAA;QAC/D,OAAO;AAAE6C,YAAAA,OAAAA,EAAS7C,UAAU8D,SAAS;AAAEhB,YAAAA,OAAAA,EAAS9C,UAAU+D;AAAU,SAAA;KAC/D,MAAA;QACL,OAAO;YAAElB,OAASjC,EAAAA,SAAAA;YAAWkC,OAASlC,EAAAA;AAAU,SAAA;AAClD;AACF,CAAA;AAEMoD,MAAAA,qBAAAA,iBAAwBC,KAAMC,CAAAA,IAAI,CAACxG,aAAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"InputRenderer.mjs","sources":["../../../../../admin/src/pages/EditView/components/InputRenderer.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n useStrapiApp,\n useForm,\n InputRenderer as FormInputRenderer,\n useField,\n} from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\n\nimport { SINGLE_TYPES } from '../../../constants/collections';\nimport { useDocumentRBAC } from '../../../features/DocumentRBAC';\nimport { type UseDocument } from '../../../hooks/useDocument';\nimport { useDocumentContext } from '../../../hooks/useDocumentContext';\nimport { useDocumentLayout } from '../../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../../hooks/useLazyComponents';\nimport { useHasInputPopoverParent } from '../../../preview/components/InputPopover';\nimport { usePreviewInputManager } from '../../../preview/hooks/usePreviewInputManager';\n\nimport { BlocksInput } from './FormInputs/BlocksInput/BlocksInput';\nimport { ComponentInput } from './FormInputs/Component/Input';\nimport { DynamicZone, useDynamicZone } from './FormInputs/DynamicZone/Field';\nimport { NotAllowedInput } from './FormInputs/NotAllowed';\nimport { RelationsInput } from './FormInputs/Relations/Relations';\nimport { UIDInput } from './FormInputs/UID';\nimport { Wysiwyg } from './FormInputs/Wysiwyg/Field';\n\nimport type { EditFieldLayout } from '../../../hooks/useDocumentLayout';\nimport type { Schema } from '@strapi/types';\nimport type { DistributiveOmit } from 'react-redux';\n\ntype InputRendererProps = DistributiveOmit<EditFieldLayout, 'size'> & {\n document: ReturnType<UseDocument>;\n};\n\n/**\n * @internal\n *\n * @description An abstraction around the regular form input renderer designed\n * specifically to be used in the EditView of the content-manager this understands\n * the complete EditFieldLayout and will handle RBAC conditions and rendering CM specific\n * components such as Blocks / Relations.\n */\nconst InputRenderer = ({\n visible,\n hint: providedHint,\n document,\n ...inputProps\n}: InputRendererProps) => {\n const localeKey = document?.document?.locale || 'default';\n const { currentDocumentMeta } = useDocumentContext('DynamicComponent');\n const {\n edit: { components },\n } = useDocumentLayout(currentDocumentMeta.model);\n\n const collectionType =\n document.schema?.kind === 'collectionType' ? 'collection-types' : 'single-types';\n\n const isInDynamicZone = useDynamicZone('isInDynamicZone', (state) => state.isInDynamicZone);\n const isInPreviewPopover = useHasInputPopoverParent();\n const shouldIgnorePermissions = isInDynamicZone || isInPreviewPopover;\n\n const isFormDisabled = useForm('InputRenderer', (state) => state.disabled);\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 let idToCheck = document.document?.documentId;\n if (collectionType === SINGLE_TYPES) {\n idToCheck = document?.document?.documentId;\n }\n\n const editableFields = idToCheck ? canUpdateFields : canCreateFields;\n const readableFields = idToCheck ? canReadFields : canCreateFields;\n\n // Everything preview related\n const previewProps = usePreviewInputManager(inputProps.name, inputProps.attribute);\n const props = { ...inputProps, ...previewProps };\n\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\n // We pass field in case of Custom Fields to keep backward compatibility\n const field = useField(props.name);\n\n if (!visible) {\n return null;\n }\n\n /**\n * If the user can't read the field then we don't want to ever render it.\n */\n if (!canUserReadField && !shouldIgnorePermissions) {\n return <NotAllowedInput hint={hint} {...props} />;\n }\n\n const fieldIsDisabled =\n (!canUserEditField && !shouldIgnorePermissions) || props.disabled || isFormDisabled;\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 {...field}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n return (\n <FormInputRenderer\n key={`input-${props.name}-${localeKey}`}\n {...props}\n {...previewProps}\n hint={hint}\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 * 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 key={`input-${props.name}-${localeKey}`}\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\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 (\n <BlocksInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n type={props.type}\n disabled={fieldIsDisabled}\n />\n );\n case 'component':\n return (\n <ComponentInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n layout={components[props.attribute.component].layout}\n disabled={fieldIsDisabled}\n >\n {(componentInputProps) => (\n <InputRenderer\n key={`input-${componentInputProps.name}-${localeKey}`}\n {...componentInputProps}\n />\n )}\n </ComponentInput>\n );\n case 'dynamiczone':\n return (\n <DynamicZone\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n case 'relation':\n return (\n <RelationsInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n case 'richtext':\n return (\n <Wysiwyg\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n type={props.type}\n disabled={fieldIsDisabled}\n />\n );\n case 'uid':\n return (\n <UIDInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n type={props.type}\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 key={`input-${props.name}-${localeKey}`}\n {...props}\n {...previewProps}\n hint={hint}\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 key={`input-${props.name}-${localeKey}`}\n {...restProps}\n {...previewProps}\n hint={hint}\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\nconst useFieldHint = (\n hint: React.ReactNode = undefined,\n attribute: Schema.Attribute.AnyAttribute\n) => {\n const { formatMessage } = useIntl();\n\n const { maximum, minimum } = getMinMax(attribute);\n\n if (!maximum && !minimum) {\n return hint;\n }\n\n const units = !['biginteger', 'integer', 'number', 'dynamiczone', 'component'].includes(\n attribute.type\n )\n ? formatMessage(\n {\n id: 'content-manager.form.Input.hint.character.unit',\n defaultMessage: '{maxValue, plural, one { character} other { characters}}',\n },\n {\n maxValue: Math.max(minimum || 0, maximum || 0),\n }\n )\n : null;\n\n const hasMinAndMax = typeof minimum === 'number' && typeof maximum === 'number';\n\n return formatMessage(\n {\n id: 'content-manager.form.Input.hint.text',\n defaultMessage:\n '{min, select, undefined {} other {min. {min}}}{divider}{max, select, undefined {} other {max. {max}}}{unit}{br}{description}',\n },\n {\n min: minimum,\n max: maximum,\n description: hint,\n unit: units,\n divider: hasMinAndMax\n ? formatMessage({\n id: 'content-manager.form.Input.hint.minMaxDivider',\n defaultMessage: ' / ',\n })\n : null,\n br: <br />,\n }\n );\n};\n\nconst getMinMax = (attribute: Schema.Attribute.AnyAttribute) => {\n if ('min' in attribute || 'max' in attribute) {\n return {\n maximum: !Number.isNaN(Number(attribute.max)) ? Number(attribute.max) : undefined,\n minimum: !Number.isNaN(Number(attribute.min)) ? Number(attribute.min) : undefined,\n };\n } else if ('maxLength' in attribute || 'minLength' in attribute) {\n return { maximum: attribute.maxLength, minimum: attribute.minLength };\n } else {\n return { maximum: undefined, minimum: undefined };\n }\n};\n\nconst MemoizedInputRenderer = React.memo(InputRenderer);\n\nexport type { InputRendererProps };\nexport { MemoizedInputRenderer as InputRenderer, useFieldHint };\n"],"names":["InputRenderer","visible","hint","providedHint","document","inputProps","localeKey","locale","currentDocumentMeta","useDocumentContext","edit","components","useDocumentLayout","model","collectionType","schema","kind","isInDynamicZone","useDynamicZone","state","isInPreviewPopover","useHasInputPopoverParent","shouldIgnorePermissions","isFormDisabled","useForm","disabled","canCreateFields","useDocumentRBAC","rbac","canReadFields","canUpdateFields","canUserAction","idToCheck","documentId","SINGLE_TYPES","editableFields","readableFields","previewProps","usePreviewInputManager","name","attribute","props","canUserReadField","type","canUserEditField","fields","useStrapiApp","app","lazyComponentStore","useLazyComponents","attributeHasCustomFieldProperty","customField","undefined","useFieldHint","field","useField","_jsx","NotAllowedInput","fieldIsDisabled","CustomInput","FormInputRenderer","addedInputTypes","Object","keys","includes","BlocksInput","ComponentInput","layout","component","componentInputProps","DynamicZone","RelationsInput","Wysiwyg","UIDInput","options","enum","map","value","unique","_unique","mainField","_mainField","restProps","formatMessage","useIntl","maximum","minimum","getMinMax","units","id","defaultMessage","maxValue","Math","max","hasMinAndMax","min","description","unit","divider","br","Number","isNaN","maxLength","minLength","MemoizedInputRenderer","React","memo"],"mappings":";;;;;;;;;;;;;;;;;;;AAmCA;;;;;;;AAOC,IACD,MAAMA,aAAAA,GAAgB,CAAC,EACrBC,OAAO,EACPC,IAAMC,EAAAA,YAAY,EAClBC,QAAQ,EACR,GAAGC,UACgB,EAAA,GAAA;IACnB,MAAMC,SAAAA,GAAYF,QAAUA,EAAAA,QAAAA,EAAUG,MAAU,IAAA,SAAA;AAChD,IAAA,MAAM,EAAEC,mBAAmB,EAAE,GAAGC,kBAAmB,CAAA,kBAAA,CAAA;IACnD,MAAM,EACJC,MAAM,EAAEC,UAAU,EAAE,EACrB,GAAGC,iBAAkBJ,CAAAA,mBAAAA,CAAoBK,KAAK,CAAA;AAE/C,IAAA,MAAMC,iBACJV,QAASW,CAAAA,MAAM,EAAEC,IAAAA,KAAS,mBAAmB,kBAAqB,GAAA,cAAA;AAEpE,IAAA,MAAMC,kBAAkBC,cAAe,CAAA,iBAAA,EAAmB,CAACC,KAAAA,GAAUA,MAAMF,eAAe,CAAA;AAC1F,IAAA,MAAMG,kBAAqBC,GAAAA,wBAAAA,EAAAA;AAC3B,IAAA,MAAMC,0BAA0BL,eAAmBG,IAAAA,kBAAAA;AAEnD,IAAA,MAAMG,iBAAiBC,OAAQ,CAAA,eAAA,EAAiB,CAACL,KAAAA,GAAUA,MAAMM,QAAQ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