@strapi/content-manager 5.12.2 → 5.12.4
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/content-manager.js.map +1 -1
- package/dist/admin/content-manager.mjs.map +1 -1
- package/dist/admin/history/pages/History.js +1 -9
- package/dist/admin/history/pages/History.js.map +1 -1
- package/dist/admin/history/pages/History.mjs +1 -9
- package/dist/admin/history/pages/History.mjs.map +1 -1
- package/dist/admin/hooks/useDocumentActions.js +8 -1
- package/dist/admin/hooks/useDocumentActions.js.map +1 -1
- package/dist/admin/hooks/useDocumentActions.mjs +8 -1
- package/dist/admin/hooks/useDocumentActions.mjs.map +1 -1
- package/dist/admin/hooks/useDocumentContext.js +57 -0
- package/dist/admin/hooks/useDocumentContext.js.map +1 -0
- package/dist/admin/hooks/useDocumentContext.mjs +36 -0
- package/dist/admin/hooks/useDocumentContext.mjs.map +1 -0
- package/dist/admin/pages/EditView/EditViewPage.js +85 -93
- package/dist/admin/pages/EditView/EditViewPage.js.map +1 -1
- package/dist/admin/pages/EditView/EditViewPage.mjs +86 -94
- package/dist/admin/pages/EditView/EditViewPage.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/DocumentActions.js +28 -32
- package/dist/admin/pages/EditView/components/DocumentActions.js.map +1 -1
- package/dist/admin/pages/EditView/components/DocumentActions.mjs +32 -36
- package/dist/admin/pages/EditView/components/DocumentActions.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Input.js +2 -2
- package/dist/admin/pages/EditView/components/FormInputs/Component/Input.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Input.mjs +2 -2
- package/dist/admin/pages/EditView/components/FormInputs/Component/Input.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.js +2 -2
- package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.mjs +2 -2
- package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.js +2 -2
- package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.mjs +2 -2
- package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js +5 -16
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs +5 -16
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js +2 -3
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs +2 -3
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js +432 -344
- package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs +432 -346
- package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js +55 -37
- package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs +57 -39
- package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/UID.js +7 -7
- package/dist/admin/pages/EditView/components/FormInputs/UID.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/UID.mjs +7 -7
- package/dist/admin/pages/EditView/components/FormInputs/UID.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/InputRenderer.js +3 -10
- package/dist/admin/pages/EditView/components/InputRenderer.js.map +1 -1
- package/dist/admin/pages/EditView/components/InputRenderer.mjs +3 -10
- package/dist/admin/pages/EditView/components/InputRenderer.mjs.map +1 -1
- package/dist/admin/preview/components/PreviewHeader.js +2 -5
- package/dist/admin/preview/components/PreviewHeader.js.map +1 -1
- package/dist/admin/preview/components/PreviewHeader.mjs +2 -5
- package/dist/admin/preview/components/PreviewHeader.mjs.map +1 -1
- package/dist/admin/preview/pages/Preview.js +94 -102
- package/dist/admin/preview/pages/Preview.js.map +1 -1
- package/dist/admin/preview/pages/Preview.mjs +94 -102
- package/dist/admin/preview/pages/Preview.mjs.map +1 -1
- package/dist/admin/src/content-manager.d.ts +0 -3
- package/dist/admin/src/features/DocumentRBAC.d.ts +1 -1
- package/dist/admin/src/history/pages/History.d.ts +1 -1
- package/dist/admin/src/hooks/useDocumentContext.d.ts +30 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/ComponentContext.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/Relations/RelationModal.d.ts +50 -5
- package/dist/admin/src/pages/EditView/components/FormInputs/Relations/Relations.d.ts +1 -0
- package/dist/admin/src/pages/EditView/components/InputRenderer.d.ts +1 -1
- package/dist/admin/src/preview/pages/Preview.d.ts +2 -1
- package/package.json +8 -8
- package/dist/admin/features/DocumentContext.js +0 -71
- package/dist/admin/features/DocumentContext.js.map +0 -1
- package/dist/admin/features/DocumentContext.mjs +0 -49
- package/dist/admin/features/DocumentContext.mjs.map +0 -1
- package/dist/admin/src/features/DocumentContext.d.ts +0 -53
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RelationModal.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Relations/RelationModal.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n ConfirmDialog,\n DescriptionComponentRenderer,\n Form as FormContext,\n useRBAC,\n useStrapiApp,\n createContext,\n} from '@strapi/admin/strapi-admin';\nimport {\n Box,\n Button,\n Dialog,\n EmptyStateLayout,\n Flex,\n IconButton,\n Loader,\n Modal,\n Typography,\n Tooltip,\n TextButton,\n} from '@strapi/design-system';\nimport { ArrowLeft, ArrowsOut, WarningCircle } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { useLocation, useNavigate } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { COLLECTION_TYPES, SINGLE_TYPES } from '../../../../../constants/collections';\nimport { PERMISSIONS } from '../../../../../constants/plugin';\nimport { type DocumentMeta, useDocumentContext } from '../../../../../features/DocumentContext';\nimport { DocumentRBAC } from '../../../../../features/DocumentRBAC';\nimport { useDocumentLayout } from '../../../../../hooks/useDocumentLayout';\nimport { useLazyGetDocumentQuery } from '../../../../../services/documents';\nimport { createYupSchema } from '../../../../../utils/validation';\nimport { DocumentActionButton } from '../../../components/DocumentActions';\nimport { DocumentStatus } from '../../DocumentStatus';\nimport { FormLayout } from '../../FormLayout';\n\nimport type { ContentManagerPlugin, DocumentActionProps } from '../../../../../content-manager';\n\ninterface RelationModalProps {\n triggerButtonLabel: string;\n relation: DocumentMeta;\n}\n\nexport function getCollectionType(url: string) {\n const regex = new RegExp(`(${COLLECTION_TYPES}|${SINGLE_TYPES})`);\n const match = url.match(regex);\n return match ? match[1] : undefined;\n}\n\nconst CustomModalContent = styled(Modal.Content)`\n width: 90%;\n max-width: 100%;\n height: 90%;\n max-height: 100%;\n`;\n\ninterface RelationModalContextValue {\n parentModified: boolean;\n depth: number;\n}\n\nconst [RelationModalProvider, useRelationModal] = createContext<RelationModalContextValue>(\n 'RelationModal',\n {\n parentModified: false,\n depth: 0,\n }\n);\n\nconst RelationModalForm = ({ relation, triggerButtonLabel }: RelationModalProps) => {\n const navigate = useNavigate();\n const { pathname, search } = useLocation();\n const { formatMessage } = useIntl();\n\n const [triggerRefetchDocument] = useLazyGetDocumentQuery();\n\n const currentDocument = useDocumentContext('RelationModalForm', (state) => state.document);\n const rootDocumentMeta = useDocumentContext(\n 'RelationModalForm',\n (state) => state.rootDocumentMeta\n );\n const currentDocumentMeta = useDocumentContext('RelationModalForm', (state) => state.meta);\n const changeDocument = useDocumentContext('RelationModalForm', (state) => state.changeDocument);\n const documentHistory = useDocumentContext('RelationModalForm', (state) => state.documentHistory);\n const setDocumentHistory = useDocumentContext(\n 'RelationModalForm',\n (state) => state.setDocumentHistory\n );\n\n const [isConfirmationOpen, setIsConfirmationOpen] = React.useState(false);\n const [actionPosition, setActionPosition] = React.useState<'cancel' | 'back' | 'navigate'>(\n 'cancel'\n );\n\n const [isModalOpen, setIsModalOpen] = React.useState(false);\n // NOTE: Not sure about this relation modal context, maybe we should move this to DocumentContext?\n // Get parent modal context if it exists\n const parentContext = useRelationModal('RelationModalForm', (state) => state);\n // Get depth of nested modals\n const depth = parentContext ? parentContext.depth + 1 : 0;\n // Check if this is a nested modal\n const isNested = depth > 0;\n\n const addDocumentToHistory = (document: DocumentMeta) =>\n setDocumentHistory((prev) => [...prev, document]);\n\n const getPreviousDocument = () => {\n if (documentHistory.length === 0) return undefined;\n\n const lastDocument = documentHistory[documentHistory.length - 1];\n\n return lastDocument;\n };\n\n const removeLastDocumentFromHistory = () => {\n setDocumentHistory((prev) => [...prev].slice(0, prev.length - 1));\n };\n\n const handleToggleModal = () => {\n if (isModalOpen) {\n setIsModalOpen(false);\n const document = {\n collectionType: rootDocumentMeta.collectionType,\n model: rootDocumentMeta.model,\n documentId: rootDocumentMeta.documentId,\n };\n // Change back to the root document\n changeDocument(document);\n // Reset the document history\n setDocumentHistory([]);\n // Reset action position\n setActionPosition('cancel');\n // Read from cache or refetch root document\n triggerRefetchDocument(\n document,\n // Favor the cache\n true\n );\n } else {\n changeDocument(relation);\n setIsModalOpen(true);\n }\n };\n\n const getFullPageLink = (): string => {\n const isSingleType = currentDocumentMeta.collectionType === SINGLE_TYPES;\n const queryParams = currentDocumentMeta.params?.locale\n ? `?plugins[i18n][locale]=${currentDocumentMeta.params.locale}`\n : '';\n\n return `/content-manager/${currentDocumentMeta.collectionType}/${currentDocumentMeta.model}${isSingleType ? '' : '/' + currentDocumentMeta.documentId}${queryParams}`;\n };\n\n const handleRedirection = () => {\n const editViewUrl = `${pathname}${search}`;\n const isRootDocumentUrl = editViewUrl.includes(getFullPageLink());\n\n if (isRootDocumentUrl) {\n handleToggleModal();\n } else {\n navigate(getFullPageLink());\n }\n };\n\n const handleConfirm = () => {\n if (actionPosition === 'navigate') {\n handleRedirection();\n } else if (actionPosition === 'back') {\n const previousRelation = getPreviousDocument();\n if (previousRelation) {\n removeLastDocumentFromHistory();\n changeDocument(previousRelation);\n }\n } else {\n // Add current relation to history before opening a new one in case we are opening a new one\n if (currentDocumentMeta && Object.keys(currentDocumentMeta).length > 0) {\n addDocumentToHistory(currentDocumentMeta);\n }\n handleToggleModal();\n }\n };\n\n return (\n <FormContext\n method=\"PUT\"\n initialValues={currentDocument.getInitialFormValues()}\n validate={(values: Record<string, unknown>, options: Record<string, string>) => {\n const yupSchema = createYupSchema(\n currentDocument.schema?.attributes,\n currentDocument.components,\n {\n status: currentDocument.document?.status,\n ...options,\n }\n );\n\n return yupSchema.validate(values, { abortEarly: false });\n }}\n >\n {({ modified, isSubmitting, resetForm }) => {\n // We don't count the root document, so history starts after 1\n const hasHistory = documentHistory.length > 1;\n\n return (\n <RelationModalProvider parentModified={modified} depth={depth}>\n <Modal.Root\n open={isModalOpen}\n onOpenChange={() => {\n if (isModalOpen) {\n if (modified && !isSubmitting) {\n setIsConfirmationOpen(true);\n } else {\n handleToggleModal();\n }\n }\n }}\n >\n <Modal.Trigger>\n <Tooltip description={triggerButtonLabel}>\n <CustomTextButton\n onClick={() => {\n // Check if parent modal has unsaved changes\n if (isNested && parentContext.parentModified) {\n setIsConfirmationOpen(true);\n // Return early to avoid opening the modal\n return;\n } else {\n if (modified && !isSubmitting) {\n setIsConfirmationOpen(true);\n } else {\n // Add current relation to history before opening a new one\n if (currentDocumentMeta && Object.keys(currentDocumentMeta).length > 0) {\n addDocumentToHistory(currentDocumentMeta);\n }\n handleToggleModal();\n }\n\n if (!isModalOpen) {\n setIsModalOpen(true);\n }\n }\n }}\n width=\"100%\"\n >\n {triggerButtonLabel}\n </CustomTextButton>\n </Tooltip>\n </Modal.Trigger>\n <CustomModalContent>\n <Modal.Header gap={2}>\n <Flex justifyContent=\"space-between\" alignItems=\"center\" width=\"100%\">\n <Flex gap={2}>\n <IconButton\n withTooltip={false}\n label=\"Back\"\n variant=\"ghost\"\n disabled={!hasHistory}\n onClick={() => {\n setActionPosition('back');\n if (modified && !isSubmitting) {\n setIsConfirmationOpen(true);\n } else {\n const previousRelation = getPreviousDocument();\n if (previousRelation) {\n removeLastDocumentFromHistory();\n changeDocument(previousRelation);\n }\n }\n }}\n marginRight={1}\n >\n <ArrowLeft />\n </IconButton>\n <Typography tag=\"span\" fontWeight={600}>\n {formatMessage({\n id: 'content-manager.components.RelationInputModal.modal-title',\n defaultMessage: 'Edit a relation',\n })}\n </Typography>\n </Flex>\n </Flex>\n </Modal.Header>\n <RelationModalBody>\n <IconButton\n onClick={() => {\n setActionPosition('navigate');\n\n if (modified && !isSubmitting) {\n setIsConfirmationOpen(true);\n } else {\n navigate(getFullPageLink());\n }\n }}\n variant=\"tertiary\"\n label={formatMessage({\n id: 'content-manager.components.RelationInputModal.button-fullpage',\n defaultMessage: 'Go to entry',\n })}\n >\n <ArrowsOut />\n </IconButton>\n </RelationModalBody>\n <Modal.Footer>\n <Button\n onClick={() => {\n if (modified && !isSubmitting) {\n setIsConfirmationOpen(true);\n } else {\n handleToggleModal();\n }\n }}\n variant=\"tertiary\"\n >\n {formatMessage({\n id: 'app.components.Button.cancel',\n defaultMessage: 'Cancel',\n })}\n </Button>\n </Modal.Footer>\n </CustomModalContent>\n </Modal.Root>\n <Dialog.Root open={isConfirmationOpen} onOpenChange={setIsConfirmationOpen}>\n <ConfirmDialog\n onConfirm={() => {\n handleConfirm();\n setIsConfirmationOpen(false);\n resetForm();\n }}\n onCancel={() => {\n setIsConfirmationOpen(false);\n }}\n variant=\"danger\"\n >\n {formatMessage({\n id: 'content-manager.components.RelationInputModal.confirmation-message',\n defaultMessage:\n 'Some changes were not saved. Are you sure you want to close this relation? All changes that were not saved will be lost.',\n })}\n </ConfirmDialog>\n </Dialog.Root>\n </RelationModalProvider>\n );\n }}\n </FormContext>\n );\n};\n\nconst CustomTextButton = styled(TextButton)`\n & > span {\n font-size: ${({ theme }) => theme.fontSizes[2]};\n width: inherit;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n`;\n\ninterface RelationModalBodyProps {\n /**\n * Additional modal actions such as \"Open in full page\"\n */\n children: React.ReactNode;\n}\n\nconst RelationModalBody = ({ children }: RelationModalBodyProps) => {\n const { formatMessage } = useIntl();\n\n const documentMeta = useDocumentContext('RelationModalBody', (state) => state.meta);\n const documentResponse = useDocumentContext('RelationModalBody', (state) => state.document);\n const onPreview = useDocumentContext('RelationModalBody', (state) => state.onPreview);\n const documentLayoutResponse = useDocumentLayout(documentMeta.model);\n const plugins = useStrapiApp('RelationModalBody', (state) => state.plugins);\n\n const initialValues = documentResponse.getInitialFormValues();\n\n const {\n permissions = [],\n isLoading: isLoadingPermissions,\n error,\n } = useRBAC(\n PERMISSIONS.map((action) => ({\n action,\n subject: documentMeta.model,\n }))\n );\n\n const isLoading =\n isLoadingPermissions || documentLayoutResponse.isLoading || documentResponse.isLoading;\n if (isLoading && !documentResponse.document?.documentId) {\n return (\n <Loader small>\n {formatMessage({\n id: 'content-manager.ListViewTable.relation-loading',\n defaultMessage: 'Relations are loading',\n })}\n </Loader>\n );\n }\n\n if (\n error ||\n !documentMeta.model ||\n documentLayoutResponse.error ||\n !documentResponse.document ||\n !documentResponse.meta ||\n !documentResponse.schema ||\n !initialValues\n ) {\n return (\n <Flex alignItems=\"center\" height=\"100%\" justifyContent=\"center\">\n <EmptyStateLayout\n icon={<WarningCircle width=\"16rem\" />}\n content={formatMessage({\n id: 'anErrorOccurred',\n defaultMessage: 'Whoops! Something went wrong. Please, try again.',\n })}\n />\n </Flex>\n );\n }\n\n const documentTitle = documentResponse.getTitle(documentLayoutResponse.edit.settings.mainField);\n const hasDraftAndPublished = documentResponse.schema?.options?.draftAndPublish ?? false;\n\n const props = {\n activeTab: 'draft',\n collectionType: documentMeta.collectionType,\n model: documentMeta.model,\n documentId: documentMeta.documentId,\n document: documentResponse.document,\n meta: documentResponse.meta,\n onPreview,\n fromRelationModal: true,\n fromPreview: onPreview !== undefined,\n } satisfies DocumentActionProps;\n\n return (\n <Modal.Body>\n <DocumentRBAC permissions={permissions} model={documentMeta.model}>\n <Flex alignItems=\"flex-start\" direction=\"column\" gap={2}>\n <Flex width=\"100%\" justifyContent=\"space-between\" gap={2}>\n <Typography tag=\"h2\" variant=\"alpha\">\n {documentTitle}\n </Typography>\n <Flex gap={2}>\n {children}\n <DescriptionComponentRenderer\n props={props}\n descriptions={(\n plugins['content-manager'].apis as ContentManagerPlugin['config']['apis']\n ).getDocumentActions('relation-modal')}\n >\n {(actions) => {\n const filteredActions = actions.filter((action) => {\n return [action.position].flat().includes('relation-modal');\n });\n const [primaryAction, secondaryAction] = filteredActions;\n\n if (!primaryAction && !secondaryAction) return null;\n\n // Both actions are available when draft and publish enabled\n if (primaryAction && secondaryAction) {\n return (\n <>\n {/* Save */}\n <DocumentActionButton\n {...secondaryAction}\n variant={secondaryAction.variant || 'secondary'}\n />\n {/* Publish */}\n <DocumentActionButton\n {...primaryAction}\n variant={primaryAction.variant || 'default'}\n />\n </>\n );\n }\n\n // Otherwise we just have the save action\n return (\n <DocumentActionButton\n {...primaryAction}\n variant={primaryAction.variant || 'secondary'}\n />\n );\n }}\n </DescriptionComponentRenderer>\n </Flex>\n </Flex>\n {hasDraftAndPublished ? (\n <Box>\n <DocumentStatus status={documentResponse.document?.status} />\n </Box>\n ) : null}\n </Flex>\n\n <Flex flex={1} overflow=\"auto\" alignItems=\"stretch\" paddingTop={7}>\n <Box overflow=\"auto\" flex={1}>\n <FormLayout\n layout={documentLayoutResponse.edit.layout}\n document={documentResponse}\n hasBackground={false}\n />\n </Box>\n </Flex>\n </DocumentRBAC>\n </Modal.Body>\n );\n};\n\nexport { RelationModalForm };\n"],"names":["getCollectionType","url","regex","RegExp","COLLECTION_TYPES","SINGLE_TYPES","match","undefined","CustomModalContent","styled","Modal","Content","RelationModalProvider","useRelationModal","createContext","parentModified","depth","RelationModalForm","relation","triggerButtonLabel","navigate","useNavigate","pathname","search","useLocation","formatMessage","useIntl","triggerRefetchDocument","useLazyGetDocumentQuery","currentDocument","useDocumentContext","state","document","rootDocumentMeta","currentDocumentMeta","meta","changeDocument","documentHistory","setDocumentHistory","isConfirmationOpen","setIsConfirmationOpen","React","useState","actionPosition","setActionPosition","isModalOpen","setIsModalOpen","parentContext","isNested","addDocumentToHistory","prev","getPreviousDocument","length","lastDocument","removeLastDocumentFromHistory","slice","handleToggleModal","collectionType","model","documentId","getFullPageLink","isSingleType","queryParams","params","locale","handleRedirection","editViewUrl","isRootDocumentUrl","includes","handleConfirm","previousRelation","Object","keys","_jsx","FormContext","method","initialValues","getInitialFormValues","validate","values","options","yupSchema","createYupSchema","schema","attributes","components","status","abortEarly","modified","isSubmitting","resetForm","hasHistory","_jsxs","Root","open","onOpenChange","Trigger","Tooltip","description","CustomTextButton","onClick","width","Header","gap","Flex","justifyContent","alignItems","IconButton","withTooltip","label","variant","disabled","marginRight","ArrowLeft","Typography","tag","fontWeight","id","defaultMessage","RelationModalBody","ArrowsOut","Footer","Button","Dialog","ConfirmDialog","onConfirm","onCancel","TextButton","theme","fontSizes","children","documentMeta","documentResponse","onPreview","documentLayoutResponse","useDocumentLayout","plugins","useStrapiApp","permissions","isLoading","isLoadingPermissions","error","useRBAC","PERMISSIONS","map","action","subject","Loader","small","height","EmptyStateLayout","icon","WarningCircle","content","documentTitle","getTitle","edit","settings","mainField","hasDraftAndPublished","draftAndPublish","props","activeTab","fromRelationModal","fromPreview","Body","DocumentRBAC","direction","DescriptionComponentRenderer","descriptions","apis","getDocumentActions","actions","filteredActions","filter","position","flat","primaryAction","secondaryAction","_Fragment","DocumentActionButton","Box","DocumentStatus","flex","overflow","paddingTop","FormLayout","layout","hasBackground"],"mappings":";;;;;;;;;;;;;;;;;;;AA8CO,SAASA,kBAAkBC,GAAW,EAAA;IAC3C,MAAMC,KAAAA,GAAQ,IAAIC,MAAAA,CAAO,CAAC,CAAC,EAAEC,gBAAAA,CAAiB,CAAC,EAAEC,YAAa,CAAA,CAAC,CAAC,CAAA;IAChE,MAAMC,KAAAA,GAAQL,GAAIK,CAAAA,KAAK,CAACJ,KAAAA,CAAAA;AACxB,IAAA,OAAOI,KAAQA,GAAAA,KAAK,CAAC,CAAA,CAAE,GAAGC,SAAAA;AAC5B;AAEA,MAAMC,kBAAqBC,GAAAA,MAAAA,CAAOC,KAAMC,CAAAA,OAAO,CAAC;;;;;AAKhD,CAAC;AAOD,MAAM,CAACC,qBAAAA,EAAuBC,gBAAiB,CAAA,GAAGC,cAChD,eACA,EAAA;IACEC,cAAgB,EAAA,KAAA;IAChBC,KAAO,EAAA;AACT,CAAA,CAAA;AAGF,MAAMC,oBAAoB,CAAC,EAAEC,QAAQ,EAAEC,kBAAkB,EAAsB,GAAA;AAC7E,IAAA,MAAMC,QAAWC,GAAAA,WAAAA,EAAAA;AACjB,IAAA,MAAM,EAAEC,QAAQ,EAAEC,MAAM,EAAE,GAAGC,WAAAA,EAAAA;IAC7B,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;IAE1B,MAAM,CAACC,uBAAuB,GAAGC,uBAAAA,EAAAA;AAEjC,IAAA,MAAMC,kBAAkBC,kBAAmB,CAAA,mBAAA,EAAqB,CAACC,KAAAA,GAAUA,MAAMC,QAAQ,CAAA;AACzF,IAAA,MAAMC,mBAAmBH,kBACvB,CAAA,mBA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GNb,GAAC+B,CAAAA,IAAAA,EAAAA;oBAAK+E,IAAM,EAAA,CAAA;oBAAGC,QAAS,EAAA,MAAA;oBAAO9E,UAAW,EAAA,SAAA;oBAAU+E,UAAY,EAAA,CAAA;AAC9D,oBAAA,QAAA,gBAAAhH,GAAC4G,CAAAA,GAAAA,EAAAA;wBAAIG,QAAS,EAAA,MAAA;wBAAOD,IAAM,EAAA,CAAA;AACzB,wBAAA,QAAA,gBAAA9G,GAACiH,CAAAA,UAAAA,EAAAA;4BACCC,MAAQrD,EAAAA,sBAAAA,CAAuBsB,IAAI,CAAC+B,MAAM;4BAC1C3J,QAAUoG,EAAAA,gBAAAA;4BACVwD,aAAe,EAAA;;;;;;;AAO7B,CAAA;;;;"}
|
1
|
+
{"version":3,"file":"RelationModal.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Relations/RelationModal.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n ConfirmDialog,\n DescriptionComponentRenderer,\n Form as FormContext,\n useRBAC,\n useStrapiApp,\n createContext,\n useForm,\n useQueryParams,\n} from '@strapi/admin/strapi-admin';\nimport {\n Box,\n Dialog,\n EmptyStateLayout,\n Flex,\n IconButton,\n Loader,\n Modal,\n Typography,\n TextButton,\n} from '@strapi/design-system';\nimport { ArrowLeft, ArrowsOut, WarningCircle } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { useLocation, useNavigate } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { COLLECTION_TYPES, SINGLE_TYPES } from '../../../../../constants/collections';\nimport { PERMISSIONS } from '../../../../../constants/plugin';\nimport { buildValidParams } from '../../../../../exports';\nimport { DocumentRBAC } from '../../../../../features/DocumentRBAC';\nimport { useDoc, useDocument, type UseDocument } from '../../../../../hooks/useDocument';\nimport { type DocumentMeta } from '../../../../../hooks/useDocumentContext';\nimport { useDocumentLayout } from '../../../../../hooks/useDocumentLayout';\nimport { useLazyGetDocumentQuery } from '../../../../../services/documents';\nimport { createYupSchema } from '../../../../../utils/validation';\nimport { DocumentActionButton } from '../../../components/DocumentActions';\nimport { DocumentStatus } from '../../DocumentStatus';\nimport { FormLayout } from '../../FormLayout';\n\nimport type { ContentManagerPlugin, DocumentActionProps } from '../../../../../content-manager';\n\nexport function getCollectionType(url: string) {\n const regex = new RegExp(`(${COLLECTION_TYPES}|${SINGLE_TYPES})`);\n const match = url.match(regex);\n return match ? match[1] : undefined;\n}\n\nconst StyledModalContent = styled(Modal.Content)`\n width: 90%;\n max-width: 100%;\n height: 90%;\n max-height: 100%;\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * RelationContextWrapper\n * -----------------------------------------------------------------------------------------------*/\n\ninterface State {\n documentHistory: DocumentMeta[];\n confirmDialogIntent:\n | null // No dialog\n | 'close' // Close the modal\n | 'back' // Go back one document in the modal's history\n | 'navigate' // Open the document in the edit view instead of in the modal\n | DocumentMeta; // Open a specific document in the modal\n isModalOpen: boolean;\n hasUnsavedChanges: boolean;\n}\n\ntype Action =\n | {\n type: 'GO_TO_RELATION';\n payload: {\n document: DocumentMeta;\n shouldBypassConfirmation: boolean;\n };\n }\n | {\n type: 'GO_BACK';\n payload: { shouldBypassConfirmation: boolean };\n }\n | {\n type: 'GO_FULL_PAGE';\n }\n | {\n type: 'CANCEL_CONFIRM_DIALOG';\n }\n | {\n type: 'CLOSE_MODAL';\n payload: { shouldBypassConfirmation: boolean };\n }\n | {\n type: 'SET_HAS_UNSAVED_CHANGES';\n payload: { hasUnsavedChanges: boolean };\n };\n\nfunction reducer(state: State, action: Action): State {\n switch (action.type) {\n case 'GO_TO_RELATION':\n if (state.hasUnsavedChanges && !action.payload.shouldBypassConfirmation) {\n return { ...state, confirmDialogIntent: action.payload.document };\n }\n\n return {\n ...state,\n documentHistory: [...state.documentHistory, action.payload.document],\n confirmDialogIntent: null,\n isModalOpen: true,\n };\n case 'GO_BACK':\n if (state.hasUnsavedChanges && !action.payload.shouldBypassConfirmation) {\n return { ...state, confirmDialogIntent: 'back' };\n }\n\n return {\n ...state,\n documentHistory: state.documentHistory.slice(0, -1),\n confirmDialogIntent: null,\n };\n case 'GO_FULL_PAGE':\n if (state.hasUnsavedChanges) {\n return { ...state, confirmDialogIntent: 'navigate' };\n }\n\n return {\n ...state,\n documentHistory: [],\n hasUnsavedChanges: false,\n isModalOpen: false,\n confirmDialogIntent: null,\n };\n case 'CANCEL_CONFIRM_DIALOG':\n return {\n ...state,\n confirmDialogIntent: null,\n };\n case 'CLOSE_MODAL':\n if (state.hasUnsavedChanges && !action.payload.shouldBypassConfirmation) {\n return { ...state, confirmDialogIntent: 'close' };\n }\n\n return {\n ...state,\n documentHistory: [],\n confirmDialogIntent: null,\n hasUnsavedChanges: false,\n isModalOpen: false,\n };\n case 'SET_HAS_UNSAVED_CHANGES':\n return {\n ...state,\n hasUnsavedChanges: action.payload.hasUnsavedChanges,\n };\n default:\n return state;\n }\n}\n\ninterface RelationModalContextValue {\n state: State;\n dispatch: React.Dispatch<Action>;\n rootDocumentMeta: DocumentMeta;\n currentDocumentMeta: DocumentMeta;\n currentDocument: ReturnType<UseDocument>;\n onPreview?: () => void;\n}\n\nconst [RelationModalProvider, useRelationModal] =\n createContext<RelationModalContextValue>('RelationModal');\n\nconst getFullPageUrl = (currentDocumentMeta: DocumentMeta): string => {\n const isSingleType = currentDocumentMeta.collectionType === SINGLE_TYPES;\n const queryParams = currentDocumentMeta.params?.locale\n ? `?plugins[i18n][locale]=${currentDocumentMeta.params.locale}`\n : '';\n\n return `/content-manager/${currentDocumentMeta.collectionType}/${currentDocumentMeta.model}${isSingleType ? '' : '/' + currentDocumentMeta.documentId}${queryParams}`;\n};\n\n/**\n * Component responsible of rendering its children wrapped in a modal, form and context if needed\n */\nconst RelationModalRenderer = ({\n children,\n trigger,\n relation,\n}: {\n children: React.ReactNode;\n trigger: React.ReactNode;\n relation: DocumentMeta;\n}) => {\n const { formatMessage } = useIntl();\n const navigate = useNavigate();\n\n const [state, dispatch] = React.useReducer(reducer, {\n documentHistory: [],\n confirmDialogIntent: null,\n isModalOpen: false,\n hasUnsavedChanges: false,\n });\n\n const rootDocument = useDoc();\n const [{ query }] = useQueryParams();\n const params = React.useMemo(() => buildValidParams(query ?? {}), [query]);\n\n const rootDocumentMeta: DocumentMeta = {\n documentId: rootDocument.document?.documentId || '',\n model: rootDocument.model,\n collectionType: rootDocument.collectionType,\n params,\n };\n\n const currentDocumentMeta = state.documentHistory.at(-1) ?? rootDocumentMeta;\n const currentDocument = useDocument(currentDocumentMeta);\n\n const parentContextValue = useRelationModal('RelationContextWrapper', (state) => state, false);\n\n // A parent relation is already rendering a modal. In this case simply render the trigger\n if (parentContextValue) {\n return trigger;\n }\n\n /**\n * There is no parent relation, so the relation modal doesn't exist. Create it and set up all the\n * pieces that will be used by potential child relations: the context, header, form, and footer.\n */\n return (\n <RelationModalProvider\n state={state}\n dispatch={dispatch}\n rootDocumentMeta={rootDocumentMeta}\n currentDocumentMeta={currentDocumentMeta}\n currentDocument={currentDocument}\n >\n <Modal.Root\n open={state.isModalOpen}\n onOpenChange={(open) => {\n if (open) {\n dispatch({\n type: 'GO_TO_RELATION',\n payload: { document: relation, shouldBypassConfirmation: false },\n });\n } else {\n dispatch({\n type: 'CLOSE_MODAL',\n payload: { shouldBypassConfirmation: false },\n });\n }\n }}\n >\n {trigger}\n <StyledModalContent>\n <Modal.Header gap={2}>\n <Flex justifyContent=\"space-between\" alignItems=\"center\" width=\"100%\">\n <Flex gap={2}>\n <IconButton\n withTooltip={false}\n label={formatMessage({ id: 'global.back', defaultMessage: 'Back' })}\n variant=\"ghost\"\n disabled={state.documentHistory.length < 2}\n onClick={() => {\n dispatch({\n type: 'GO_BACK',\n payload: { shouldBypassConfirmation: false },\n });\n }}\n marginRight={1}\n >\n <ArrowLeft />\n </IconButton>\n <Typography tag=\"span\" fontWeight={600}>\n {formatMessage({\n id: 'content-manager.components.RelationInputModal.modal-title',\n defaultMessage: 'Edit a relation',\n })}\n </Typography>\n </Flex>\n <IconButton\n onClick={() => {\n dispatch({\n type: 'GO_FULL_PAGE',\n });\n if (!state.hasUnsavedChanges) {\n navigate(getFullPageUrl(currentDocumentMeta));\n }\n }}\n variant=\"tertiary\"\n label={formatMessage({\n id: 'content-manager.components.RelationInputModal.button-fullpage',\n defaultMessage: 'Go to entry',\n })}\n >\n <ArrowsOut />\n </IconButton>\n </Flex>\n </Modal.Header>\n <Modal.Body>\n <FormContext\n method=\"PUT\"\n initialValues={currentDocument.getInitialFormValues()}\n validate={(values: Record<string, unknown>, options: Record<string, string>) => {\n const yupSchema = createYupSchema(\n currentDocument.schema?.attributes,\n currentDocument.components,\n {\n status: currentDocument.document?.status,\n ...options,\n }\n );\n\n return yupSchema.validate(values, { abortEarly: false });\n }}\n >\n {children}\n </FormContext>\n </Modal.Body>\n </StyledModalContent>\n </Modal.Root>\n </RelationModalProvider>\n );\n};\n\n/**\n * All the main content (not header and footer) of the relation modal, plus the confirmation dialog.\n * Will be wrapped in a Modal.Body by the RelationModalRenderer.\n * Cannot be moved directly inside RelationModal because it needs access to the context via hooks.\n */\nconst RelationModalBody = () => {\n const navigate = useNavigate();\n const { pathname, search } = useLocation();\n const { formatMessage } = useIntl();\n\n const [triggerRefetchDocument] = useLazyGetDocumentQuery();\n\n const state = useRelationModal('RelationModalForm', (state) => state.state);\n const dispatch = useRelationModal('RelationModalForm', (state) => state.dispatch);\n const rootDocumentMeta = useRelationModal('RelationModalForm', (state) => state.rootDocumentMeta);\n const currentDocumentMeta = useRelationModal(\n 'RelationModalForm',\n (state) => state.currentDocumentMeta\n );\n\n /**\n * One-way sync the modified state from the form to the modal state.\n * It is needed because we need to consume state from the form context in order to lift it up\n * into the modal context. It is not possible otherwise because the modal needs the form state,\n * but it must be a parent of the form.\n */\n const modified = useForm('FormWatcher', (state) => state.modified);\n const isSubmitting = useForm('FormWatcher', (state) => state.isSubmitting);\n const hasUnsavedChanges = modified && !isSubmitting;\n React.useEffect(() => {\n dispatch({ type: 'SET_HAS_UNSAVED_CHANGES', payload: { hasUnsavedChanges } });\n }, [hasUnsavedChanges, dispatch]);\n\n const handleCloseModal = (shouldBypassConfirmation: boolean) => {\n dispatch({ type: 'CLOSE_MODAL', payload: { shouldBypassConfirmation } });\n\n if (shouldBypassConfirmation || !state.hasUnsavedChanges) {\n // TODO: check if we can avoid this by relying on RTK invalidatesTags.\n // If so we can delete this function and dispatch the events directly\n triggerRefetchDocument(\n // TODO check if params should be removed (as they were before)\n rootDocumentMeta,\n // Favor the cache\n true\n );\n }\n };\n\n const handleRedirection = () => {\n const editViewUrl = `${pathname}${search}`;\n const fullPageUrl = getFullPageUrl(currentDocumentMeta);\n const isRootDocumentUrl = editViewUrl.includes(fullPageUrl);\n\n if (isRootDocumentUrl) {\n handleCloseModal(true);\n } else {\n navigate(fullPageUrl);\n }\n };\n\n const handleConfirm = () => {\n if (state.confirmDialogIntent === null) {\n return;\n }\n if (state.confirmDialogIntent === 'navigate') {\n handleRedirection();\n } else if (state.confirmDialogIntent === 'back') {\n dispatch({ type: 'GO_BACK', payload: { shouldBypassConfirmation: true } });\n } else if (state.confirmDialogIntent === 'close') {\n handleCloseModal(true);\n } else if ('documentId' in state.confirmDialogIntent) {\n dispatch({\n type: 'GO_TO_RELATION',\n payload: { document: state.confirmDialogIntent, shouldBypassConfirmation: true },\n });\n }\n };\n\n return (\n <>\n <RelationEditView />\n <Dialog.Root open={state.confirmDialogIntent != null}>\n <ConfirmDialog\n onConfirm={() => handleConfirm()}\n onCancel={() => dispatch({ type: 'CANCEL_CONFIRM_DIALOG' })}\n variant=\"danger\"\n >\n {formatMessage({\n id: 'content-manager.components.RelationInputModal.confirmation-message',\n defaultMessage:\n 'Some changes were not saved. Are you sure you want to close this relation? All changes that were not saved will be lost.',\n })}\n </ConfirmDialog>\n </Dialog.Root>\n </>\n );\n};\n\nconst ModalTrigger = ({\n children,\n relation,\n}: {\n children: React.ReactNode;\n relation: DocumentMeta;\n}) => {\n const dispatch = useRelationModal('ModalTrigger', (state) => state.dispatch);\n\n return (\n <StyledTextButton\n onClick={() => {\n dispatch({\n type: 'GO_TO_RELATION',\n payload: { document: relation, shouldBypassConfirmation: false },\n });\n }}\n >\n {children}\n </StyledTextButton>\n );\n};\n\ninterface RelationModalProps {\n children: React.ReactNode;\n relation: DocumentMeta;\n}\n\nconst RelationModal = React.memo(({ relation, children }: RelationModalProps) => {\n return (\n <RelationModalRenderer\n relation={relation}\n trigger={<ModalTrigger relation={relation}>{children}</ModalTrigger>}\n >\n <RelationModalBody />\n </RelationModalRenderer>\n );\n});\n\nconst StyledTextButton = styled(TextButton)`\n max-width: 100%;\n & > span {\n font-size: ${({ theme }) => theme.fontSizes[2]};\n width: inherit;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n`;\n\n/**\n * The mini edit view for a relation that is displayed inside a modal.\n * It's complete with its header, document actions and form layout.\n */\nconst RelationEditView = () => {\n const { formatMessage } = useIntl();\n\n const currentDocumentMeta = useRelationModal(\n 'RelationModalBody',\n (state) => state.currentDocumentMeta\n );\n const currentDocument = useRelationModal('RelationModalBody', (state) => state.currentDocument);\n const documentLayoutResponse = useDocumentLayout(currentDocumentMeta.model);\n const plugins = useStrapiApp('RelationModalBody', (state) => state.plugins);\n\n const initialValues = currentDocument.getInitialFormValues();\n\n const {\n permissions = [],\n isLoading: isLoadingPermissions,\n error,\n } = useRBAC(\n PERMISSIONS.map((action) => ({\n action,\n subject: currentDocumentMeta.model,\n }))\n );\n\n const isLoading =\n isLoadingPermissions || documentLayoutResponse.isLoading || currentDocument.isLoading;\n\n if (isLoading && !currentDocument.document?.documentId) {\n return (\n <Loader small>\n {formatMessage({\n id: 'content-manager.ListViewTable.relation-loading',\n defaultMessage: 'Relations are loading',\n })}\n </Loader>\n );\n }\n\n if (\n error ||\n !currentDocumentMeta.model ||\n documentLayoutResponse.error ||\n !currentDocument.document ||\n !currentDocument.meta ||\n !currentDocument.schema ||\n !initialValues\n ) {\n return (\n <Flex alignItems=\"center\" height=\"100%\" justifyContent=\"center\">\n <EmptyStateLayout\n icon={<WarningCircle width=\"16rem\" />}\n content={formatMessage({\n id: 'anErrorOccurred',\n defaultMessage: 'Whoops! Something went wrong. Please, try again.',\n })}\n />\n </Flex>\n );\n }\n\n const documentTitle = currentDocument.getTitle(documentLayoutResponse.edit.settings.mainField);\n const hasDraftAndPublished = currentDocument.schema?.options?.draftAndPublish ?? false;\n\n const props = {\n activeTab: 'draft',\n collectionType: currentDocumentMeta.collectionType,\n model: currentDocumentMeta.model,\n documentId: currentDocumentMeta.documentId,\n document: currentDocument.document,\n meta: currentDocument.meta,\n } satisfies DocumentActionProps;\n\n return (\n <DocumentRBAC permissions={permissions} model={currentDocumentMeta.model}>\n <Flex alignItems=\"flex-start\" direction=\"column\" gap={2}>\n <Flex width=\"100%\" justifyContent=\"space-between\" gap={2}>\n <Typography tag=\"h2\" variant=\"alpha\">\n {documentTitle}\n </Typography>\n <Flex gap={2}>\n <DescriptionComponentRenderer\n props={props}\n descriptions={(\n plugins['content-manager'].apis as ContentManagerPlugin['config']['apis']\n ).getDocumentActions('relation-modal')}\n >\n {(actions) => {\n const filteredActions = actions.filter((action) => {\n return [action.position].flat().includes('relation-modal');\n });\n const [primaryAction, secondaryAction] = filteredActions;\n\n if (!primaryAction && !secondaryAction) return null;\n\n // Both actions are available when draft and publish enabled\n if (primaryAction && secondaryAction) {\n return (\n <>\n {/* Save */}\n <DocumentActionButton\n {...secondaryAction}\n variant={secondaryAction.variant || 'secondary'}\n />\n {/* Publish */}\n <DocumentActionButton\n {...primaryAction}\n variant={primaryAction.variant || 'default'}\n />\n </>\n );\n }\n\n // Otherwise we just have the save action\n return (\n <DocumentActionButton\n {...primaryAction}\n variant={primaryAction.variant || 'secondary'}\n />\n );\n }}\n </DescriptionComponentRenderer>\n </Flex>\n </Flex>\n {hasDraftAndPublished ? (\n <Box>\n <DocumentStatus status={currentDocument.document?.status} />\n </Box>\n ) : null}\n </Flex>\n\n <Flex flex={1} overflow=\"auto\" alignItems=\"stretch\" paddingTop={7}>\n <Box overflow=\"auto\" flex={1}>\n <FormLayout\n layout={documentLayoutResponse.edit.layout}\n document={currentDocument}\n hasBackground={false}\n />\n </Box>\n </Flex>\n </DocumentRBAC>\n );\n};\n\nexport { RelationModal, reducer, useRelationModal };\nexport type { State, Action };\n"],"names":["getCollectionType","url","regex","RegExp","COLLECTION_TYPES","SINGLE_TYPES","match","undefined","StyledModalContent","styled","Modal","Content","reducer","state","action","type","hasUnsavedChanges","payload","shouldBypassConfirmation","confirmDialogIntent","document","documentHistory","isModalOpen","slice","RelationModalProvider","useRelationModal","createContext","getFullPageUrl","currentDocumentMeta","isSingleType","collectionType","queryParams","params","locale","model","documentId","RelationModalRenderer","children","trigger","relation","formatMessage","useIntl","navigate","useNavigate","dispatch","React","useReducer","rootDocument","useDoc","query","useQueryParams","useMemo","buildValidParams","rootDocumentMeta","at","currentDocument","useDocument","parentContextValue","_jsx","_jsxs","Root","open","onOpenChange","Header","gap","Flex","justifyContent","alignItems","width","IconButton","withTooltip","label","id","defaultMessage","variant","disabled","length","onClick","marginRight","ArrowLeft","Typography","tag","fontWeight","ArrowsOut","Body","FormContext","method","initialValues","getInitialFormValues","validate","values","options","yupSchema","createYupSchema","schema","attributes","components","status","abortEarly","RelationModalBody","pathname","search","useLocation","triggerRefetchDocument","useLazyGetDocumentQuery","modified","useForm","isSubmitting","useEffect","handleCloseModal","handleRedirection","editViewUrl","fullPageUrl","isRootDocumentUrl","includes","handleConfirm","_Fragment","RelationEditView","Dialog","ConfirmDialog","onConfirm","onCancel","ModalTrigger","StyledTextButton","RelationModal","memo","TextButton","theme","fontSizes","documentLayoutResponse","useDocumentLayout","plugins","useStrapiApp","permissions","isLoading","isLoadingPermissions","error","useRBAC","PERMISSIONS","map","subject","Loader","small","meta","height","EmptyStateLayout","icon","WarningCircle","content","documentTitle","getTitle","edit","settings","mainField","hasDraftAndPublished","draftAndPublish","props","activeTab","DocumentRBAC","direction","DescriptionComponentRenderer","descriptions","apis","getDocumentActions","actions","filteredActions","filter","position","flat","primaryAction","secondaryAction","DocumentActionButton","Box","DocumentStatus","flex","overflow","paddingTop","FormLayout","layout","hasBackground"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2CO,SAASA,kBAAkBC,GAAW,EAAA;IAC3C,MAAMC,KAAAA,GAAQ,IAAIC,MAAAA,CAAO,CAAC,CAAC,EAAEC,gBAAAA,CAAiB,CAAC,EAAEC,YAAa,CAAA,CAAC,CAAC,CAAA;IAChE,MAAMC,KAAAA,GAAQL,GAAIK,CAAAA,KAAK,CAACJ,KAAAA,CAAAA;AACxB,IAAA,OAAOI,KAAQA,GAAAA,KAAK,CAAC,CAAA,CAAE,GAAGC,SAAAA;AAC5B;AAEA,MAAMC,kBAAqBC,GAAAA,MAAAA,CAAOC,KAAMC,CAAAA,OAAO,CAAC;;;;;AAKhD,CAAC;AA6CD,SAASC,OAAAA,CAAQC,KAAY,EAAEC,MAAc,EAAA;AAC3C,IAAA,OAAQA,OAAOC,IAAI;QACjB,KAAK,gBAAA;YACH,IAAIF,KAAAA,CAAMG,iBAAiB,IAAI,CAACF,OAAOG,OAAO,CAACC,wBAAwB,EAAE;gBACvE,OAAO;AAAE,oBAAA,GAAGL,KAAK;oBAAEM,mBAAqBL,EAAAA,MAAAA,CAAOG,OAAO,CAACG;AAAS,iBAAA;AAClE;YAEA,OAAO;AACL,gBAAA,GAAGP,KAAK;gBACRQ,eAAiB,EAAA;AAAIR,oBAAAA,GAAAA,KAAAA,CAAMQ,eAAe;oBAAEP,MAAOG,CAAAA,OAAO,CAACG;AAAS,iBAAA;gBACpED,mBAAqB,EAAA,IAAA;gBACrBG,WAAa,EAAA;AACf,aAAA;QACF,KAAK,SAAA;YACH,IAAIT,KAAAA,CAAMG,iBAAiB,IAAI,CAACF,OAAOG,OAAO,CAACC,wBAAwB,EAAE;gBACvE,OAAO;AAAE,oBAAA,GAAGL,KAAK;oBAAEM,mBAAqB,EAAA;AAAO,iBAAA;AACjD;YAEA,OAAO;AACL,gBAAA,GA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AAAA,cAAAA,EAAAA;4BAAe5E,MAAQ1C,EAAAA,eAAAA,CAAgBnC,QAAQ,EAAE6E;;AAElD,qBAAA,CAAA,GAAA;;;0BAGNvC,GAACO,CAAAA,IAAAA,EAAAA;gBAAK6G,IAAM,EAAA,CAAA;gBAAGC,QAAS,EAAA,MAAA;gBAAO5G,UAAW,EAAA,SAAA;gBAAU6G,UAAY,EAAA,CAAA;AAC9D,gBAAA,QAAA,gBAAAtH,GAACkH,CAAAA,GAAAA,EAAAA;oBAAIG,QAAS,EAAA,MAAA;oBAAOD,IAAM,EAAA,CAAA;AACzB,oBAAA,QAAA,gBAAApH,GAACuH,CAAAA,UAAAA,EAAAA;wBACCC,MAAQjD,EAAAA,sBAAAA,CAAuBsB,IAAI,CAAC2B,MAAM;wBAC1C9J,QAAUmC,EAAAA,eAAAA;wBACV4H,aAAe,EAAA;;;;;;AAM3B,CAAA;;;;"}
|
@@ -13,11 +13,11 @@ var reactWindow = require('react-window');
|
|
13
13
|
var styledComponents = require('styled-components');
|
14
14
|
var collections = require('../../../../../constants/collections.js');
|
15
15
|
var dragAndDrop = require('../../../../../constants/dragAndDrop.js');
|
16
|
-
var DocumentContext = require('../../../../../features/DocumentContext.js');
|
17
16
|
var useDebounce = require('../../../../../hooks/useDebounce.js');
|
17
|
+
var useDocument = require('../../../../../hooks/useDocument.js');
|
18
|
+
var useDocumentContext = require('../../../../../hooks/useDocumentContext.js');
|
18
19
|
var useDragAndDrop = require('../../../../../hooks/useDragAndDrop.js');
|
19
20
|
var relations = require('../../../../../services/relations.js');
|
20
|
-
var api = require('../../../../../utils/api.js');
|
21
21
|
var relations$1 = require('../../../../../utils/relations.js');
|
22
22
|
var translations = require('../../../../../utils/translations.js');
|
23
23
|
var DocumentStatus = require('../../DocumentStatus.js');
|
@@ -96,17 +96,11 @@ const ONE_WAY_RELATIONS = [
|
|
96
96
|
* At present we do not expose this to plugin developers, however, they are able to overwrite it themselves should
|
97
97
|
* they wish to do so.
|
98
98
|
*/ const RelationsField = /*#__PURE__*/ React__namespace.forwardRef(({ disabled, label, ...props }, ref)=>{
|
99
|
-
const currentDocumentMeta =
|
100
|
-
const currentDocument = DocumentContext.useDocumentContext('RelationsField', (state)=>state.document);
|
101
|
-
const rootDocumentMeta = DocumentContext.useDocumentContext('RelationsField', (state)=>state.rootDocumentMeta);
|
99
|
+
const { currentDocument, currentDocumentMeta } = useDocumentContext.useDocumentContext('RelationsField');
|
102
100
|
const [currentPage, setCurrentPage] = React__namespace.useState(1);
|
103
|
-
const isRootDocument = rootDocumentMeta.documentId === currentDocumentMeta.documentId;
|
104
|
-
const documentMeta = isRootDocument ? rootDocumentMeta : currentDocumentMeta;
|
105
101
|
// Use the documentId from the actual document, not the params (meta)
|
106
102
|
const documentId = currentDocument.document?.documentId;
|
107
103
|
const { formatMessage } = reactIntl.useIntl();
|
108
|
-
const [{ query }] = strapiAdmin.useQueryParams();
|
109
|
-
const params = documentMeta.params ?? api.buildValidParams(query);
|
110
104
|
const isMorph = props.attribute.relation.toLowerCase().includes('morph');
|
111
105
|
const isDisabled = isMorph || disabled;
|
112
106
|
const { componentId, componentUID } = ComponentContext.useComponent('RelationsField', ({ uid, id })=>({
|
@@ -123,7 +117,7 @@ const ONE_WAY_RELATIONS = [
|
|
123
117
|
/**
|
124
118
|
* We'll always have a documentId in a created entry, so we look for a componentId first.
|
125
119
|
* Same with `uid` and `documentModel`.
|
126
|
-
*/ const model = component ? component.uid :
|
120
|
+
*/ const model = component ? component.uid : currentDocumentMeta.model;
|
127
121
|
const id = component && componentId ? componentId.toString() : documentId;
|
128
122
|
/**
|
129
123
|
* The `name` prop is a complete path to the field, e.g. `field1.field2.field3`.
|
@@ -143,7 +137,7 @@ const ONE_WAY_RELATIONS = [
|
|
143
137
|
// below we don't run the query if there is no id.
|
144
138
|
id,
|
145
139
|
params: {
|
146
|
-
...params,
|
140
|
+
...currentDocumentMeta.params,
|
147
141
|
pageSize: RELATIONS_TO_DISPLAY,
|
148
142
|
page: currentPage
|
149
143
|
}
|
@@ -215,7 +209,8 @@ const ONE_WAY_RELATIONS = [
|
|
215
209
|
apiData: {
|
216
210
|
id: relation.id,
|
217
211
|
documentId: relation.documentId,
|
218
|
-
locale: relation.locale
|
212
|
+
locale: relation.locale,
|
213
|
+
isTemporary: true
|
219
214
|
},
|
220
215
|
status: relation.status,
|
221
216
|
/**
|
@@ -287,7 +282,8 @@ const ONE_WAY_RELATIONS = [
|
|
287
282
|
isLoading: isFetchingMoreRelations,
|
288
283
|
relationType: props.attribute.relation,
|
289
284
|
// @ts-expect-error – targetModel does exist on the attribute. But it's not typed.
|
290
|
-
targetModel: props.attribute.targetModel
|
285
|
+
targetModel: props.attribute.targetModel,
|
286
|
+
mainField: props.mainField
|
291
287
|
})
|
292
288
|
]
|
293
289
|
});
|
@@ -337,11 +333,7 @@ const ONE_WAY_RELATIONS = [
|
|
337
333
|
page: 1
|
338
334
|
});
|
339
335
|
const { toggleNotification } = strapiAdmin.useNotification();
|
340
|
-
const
|
341
|
-
const currentDocumentMeta = DocumentContext.useDocumentContext('RelationsInput', (state)=>state.meta);
|
342
|
-
const rootDocumentMeta = DocumentContext.useDocumentContext('RelationsInput', (state)=>state.rootDocumentMeta);
|
343
|
-
const isRootDocument = rootDocumentMeta.documentId === currentDocumentMeta.documentId;
|
344
|
-
const documentMeta = isRootDocument ? rootDocumentMeta : currentDocumentMeta;
|
336
|
+
const { currentDocumentMeta } = useDocumentContext.useDocumentContext('RelationsInput');
|
345
337
|
const { formatMessage } = reactIntl.useIntl();
|
346
338
|
const fieldRef = strapiAdmin.useFocusInputField(name);
|
347
339
|
const field = strapiAdmin.useField(name);
|
@@ -361,12 +353,11 @@ const ONE_WAY_RELATIONS = [
|
|
361
353
|
*/ const [targetField] = name.split('.').slice(-1);
|
362
354
|
// Return early if there is no relation to the document
|
363
355
|
if (!isRelatedToCurrentDocument) return;
|
364
|
-
const params = documentMeta.params ?? api.buildValidParams(query);
|
365
356
|
searchForTrigger({
|
366
357
|
model,
|
367
358
|
targetField,
|
368
359
|
params: {
|
369
|
-
...params,
|
360
|
+
...currentDocumentMeta.params,
|
370
361
|
id: id ?? '',
|
371
362
|
pageSize: 10,
|
372
363
|
idsToInclude: field.value?.disconnect?.map((rel)=>rel.id.toString()) ?? [],
|
@@ -380,11 +371,10 @@ const ONE_WAY_RELATIONS = [
|
|
380
371
|
id,
|
381
372
|
model,
|
382
373
|
name,
|
383
|
-
query,
|
384
374
|
searchForTrigger,
|
385
375
|
searchParamsDebounced,
|
386
376
|
isRelatedToCurrentDocument,
|
387
|
-
|
377
|
+
currentDocumentMeta.params
|
388
378
|
]);
|
389
379
|
const handleSearch = async (search)=>{
|
390
380
|
setSearchParams((s)=>({
|
@@ -506,7 +496,7 @@ const ONE_WAY_RELATIONS = [
|
|
506
496
|
* RelationsList
|
507
497
|
* -----------------------------------------------------------------------------------------------*/ const RELATION_ITEM_HEIGHT = 50;
|
508
498
|
const RELATION_GUTTER = 4;
|
509
|
-
const RelationsList = ({ data, serverData, disabled, name, isLoading, relationType, targetModel })=>{
|
499
|
+
const RelationsList = ({ data, serverData, disabled, name, isLoading, relationType, targetModel, mainField })=>{
|
510
500
|
const ariaDescriptionId = React__namespace.useId();
|
511
501
|
const { formatMessage } = reactIntl.useIntl();
|
512
502
|
const listRef = React__namespace.useRef(null);
|
@@ -592,6 +582,7 @@ const RelationsList = ({ data, serverData, disabled, name, isLoading, relationTy
|
|
592
582
|
id: relation.id,
|
593
583
|
documentId: relation.documentId ?? relation.apiData?.documentId ?? '',
|
594
584
|
locale: relation.locale || relation.apiData?.locale,
|
585
|
+
isTemporary: relation.apiData?.isTemporary,
|
595
586
|
position
|
596
587
|
}
|
597
588
|
}
|
@@ -671,7 +662,8 @@ const RelationsList = ({ data, serverData, disabled, name, isLoading, relationTy
|
|
671
662
|
name,
|
672
663
|
handleDisconnect,
|
673
664
|
relations: data,
|
674
|
-
targetModel
|
665
|
+
targetModel,
|
666
|
+
mainField
|
675
667
|
},
|
676
668
|
itemKey: (index)=>data[index].id,
|
677
669
|
innerElementType: "ol",
|
@@ -712,9 +704,26 @@ const ShadowBox = styledComponents.styled(designSystem.Box)`
|
|
712
704
|
}
|
713
705
|
`;
|
714
706
|
const ListItem = ({ data, index, style })=>{
|
715
|
-
const { ariaDescribedBy, canDrag = false, disabled = false, handleCancel, handleDisconnect, handleDropItem, handleGrabItem, handleMoveItem, name, relations, targetModel } = data;
|
707
|
+
const { ariaDescribedBy, canDrag = false, disabled = false, handleCancel, handleDisconnect, handleDropItem, handleGrabItem, handleMoveItem, name, relations, targetModel, mainField } = data;
|
708
|
+
const { currentDocumentMeta } = useDocumentContext.useDocumentContext('RelationsField');
|
716
709
|
const { formatMessage } = reactIntl.useIntl();
|
717
|
-
const { href, id, label, status, documentId, apiData, locale } = relations[index];
|
710
|
+
const { href, id, label: originalLabel, status: originalStatus, documentId, apiData, locale } = relations[index];
|
711
|
+
/**
|
712
|
+
* The code above attempts to retrieve the updated value of a relation that has not yet been saved.
|
713
|
+
* This is necessary when a relation modal is opened, and the mainField or its status is updated.
|
714
|
+
* These changes need to be reflected in the initial relation field.
|
715
|
+
*/ const collectionType = RelationModal.getCollectionType(href);
|
716
|
+
const isTemporary = apiData?.isTemporary ?? false;
|
717
|
+
const { document } = useDocument.useDocument({
|
718
|
+
collectionType,
|
719
|
+
model: targetModel,
|
720
|
+
documentId: documentId ?? apiData?.documentId,
|
721
|
+
params: currentDocumentMeta.params
|
722
|
+
}, {
|
723
|
+
skip: !isTemporary
|
724
|
+
});
|
725
|
+
const label = isTemporary && document ? relations$1.getRelationLabel(document, mainField) : originalLabel;
|
726
|
+
const status = isTemporary && document ? document?.status : originalStatus;
|
718
727
|
const [{ handlerId, isDragging, handleKeyDown }, relationRef, dropRef, dragRef, dragPreviewRef] = useDragAndDrop.useDragAndDrop(canDrag && !disabled, {
|
719
728
|
type: `${dragAndDrop.ItemTypes.RELATION}_${name}`,
|
720
729
|
index,
|
@@ -736,6 +745,21 @@ const ListItem = ({ data, index, style })=>{
|
|
736
745
|
}, [
|
737
746
|
dragPreviewRef
|
738
747
|
]);
|
748
|
+
const safeDocumentId = documentId ?? apiData?.documentId;
|
749
|
+
const safeLocale = locale ?? apiData?.locale ?? null;
|
750
|
+
const documentMeta = React__namespace.useMemo(()=>({
|
751
|
+
documentId: safeDocumentId,
|
752
|
+
model: targetModel,
|
753
|
+
collectionType: RelationModal.getCollectionType(href),
|
754
|
+
params: {
|
755
|
+
locale: safeLocale
|
756
|
+
}
|
757
|
+
}), [
|
758
|
+
safeDocumentId,
|
759
|
+
href,
|
760
|
+
safeLocale,
|
761
|
+
targetModel
|
762
|
+
]);
|
739
763
|
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
740
764
|
style: style,
|
741
765
|
tag: "li",
|
@@ -774,23 +798,17 @@ const ListItem = ({ data, index, style })=>{
|
|
774
798
|
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
775
799
|
width: "100%",
|
776
800
|
minWidth: 0,
|
801
|
+
gap: 4,
|
777
802
|
justifyContent: "space-between",
|
778
803
|
children: [
|
779
804
|
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
805
|
+
flex: 1,
|
780
806
|
minWidth: 0,
|
781
807
|
paddingTop: 1,
|
782
808
|
paddingBottom: 1,
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
relation: {
|
787
|
-
documentId: documentId ?? apiData?.documentId,
|
788
|
-
model: targetModel,
|
789
|
-
collectionType: RelationModal.getCollectionType(href),
|
790
|
-
params: {
|
791
|
-
locale: locale || apiData?.locale || null
|
792
|
-
}
|
793
|
-
}
|
809
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(RelationModal.RelationModal, {
|
810
|
+
relation: documentMeta,
|
811
|
+
children: label
|
794
812
|
})
|
795
813
|
}),
|
796
814
|
status ? /*#__PURE__*/ jsxRuntime.jsx(DocumentStatus.DocumentStatus, {
|