@strapi/content-manager 5.54.0 → 5.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/components/LeftMenu.js +131 -52
- package/dist/admin/components/LeftMenu.js.map +1 -1
- package/dist/admin/components/LeftMenu.mjs +133 -54
- package/dist/admin/components/LeftMenu.mjs.map +1 -1
- package/dist/admin/hooks/useContentManagerInitData.js +3 -2
- package/dist/admin/hooks/useContentManagerInitData.js.map +1 -1
- package/dist/admin/hooks/useContentManagerInitData.mjs +3 -2
- package/dist/admin/hooks/useContentManagerInitData.mjs.map +1 -1
- package/dist/admin/hooks/useDocumentActions.js +3 -1
- package/dist/admin/hooks/useDocumentActions.js.map +1 -1
- package/dist/admin/hooks/useDocumentActions.mjs +4 -2
- package/dist/admin/hooks/useDocumentActions.mjs.map +1 -1
- package/dist/admin/layout.js +2 -4
- package/dist/admin/layout.js.map +1 -1
- package/dist/admin/layout.mjs +2 -4
- package/dist/admin/layout.mjs.map +1 -1
- package/dist/admin/modules/app.js +3 -1
- package/dist/admin/modules/app.js.map +1 -1
- package/dist/admin/modules/app.mjs +3 -1
- package/dist/admin/modules/app.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js +58 -1
- package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs +58 -2
- package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs.map +1 -1
- package/dist/admin/src/modules/app.d.ts +2 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/Relations/RelationModal.d.ts +14 -1
- package/dist/admin/src/services/init.d.ts +1 -0
- package/dist/admin/src/utils/contentStructure.d.ts +59 -0
- package/dist/admin/utils/contentStructure.js +136 -0
- package/dist/admin/utils/contentStructure.js.map +1 -0
- package/dist/admin/utils/contentStructure.mjs +130 -0
- package/dist/admin/utils/contentStructure.mjs.map +1 -0
- package/dist/server/controllers/init.js +7 -2
- package/dist/server/controllers/init.js.map +1 -1
- package/dist/server/controllers/init.mjs +7 -2
- package/dist/server/controllers/init.mjs.map +1 -1
- package/dist/server/services/content-structure.js +53 -0
- package/dist/server/services/content-structure.js.map +1 -0
- package/dist/server/services/content-structure.mjs +51 -0
- package/dist/server/services/content-structure.mjs.map +1 -0
- package/dist/server/services/index.js +2 -0
- package/dist/server/services/index.js.map +1 -1
- package/dist/server/services/index.mjs +2 -0
- package/dist/server/services/index.mjs.map +1 -1
- package/dist/server/src/controllers/index.d.ts +1 -1
- package/dist/server/src/controllers/init.d.ts +1 -1
- package/dist/server/src/controllers/init.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +6 -1
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/services/content-structure.d.ts +8 -0
- package/dist/server/src/services/content-structure.d.ts.map +1 -0
- package/dist/server/src/services/index.d.ts +5 -0
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts +2 -0
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/server/utils/index.js.map +1 -1
- package/dist/server/utils/index.mjs.map +1 -1
- package/dist/shared/contracts/init.d.ts +2 -0
- package/dist/shared/contracts/init.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -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 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 { Link as RouterLink, 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';\nimport { ComponentProvider } from '../ComponentContext';\n\nimport type { RelationOpenMode } from '../../../../../../../shared/contracts/content-types';\nimport type { ContentManagerPlugin, DocumentActionProps } from '../../../../../content-manager';\nimport type { AnyData } from '../../../utils/data';\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\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 * RelationModalRenderer\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 fieldToConnect?: string;\n fieldToConnectUID?: string;\n getParentFormValues?: () => AnyData;\n}\n\ntype Action =\n | {\n type: 'GO_TO_RELATION';\n payload: {\n document: DocumentMeta;\n shouldBypassConfirmation: boolean;\n fieldToConnect?: string;\n fieldToConnectUID?: string;\n getParentFormValues?: () => AnyData;\n };\n }\n | {\n type: 'GO_BACK';\n payload: { shouldBypassConfirmation: boolean };\n }\n | {\n type: 'GO_FULL_PAGE';\n }\n | {\n type: 'GO_TO_CREATED_RELATION';\n payload: {\n document: DocumentMeta;\n shouldBypassConfirmation: boolean;\n fieldToConnect?: string;\n fieldToConnectUID?: string;\n getParentFormValues?: () => AnyData;\n };\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 {\n ...state,\n confirmDialogIntent: action.payload.document,\n fieldToConnect: action.payload.fieldToConnect,\n fieldToConnectUID: action.payload.fieldToConnectUID,\n getParentFormValues: action.payload.getParentFormValues,\n };\n }\n\n const lastItemDocumentHistory = state.documentHistory.at(-1);\n const hasToResetDocumentHistory =\n lastItemDocumentHistory && !lastItemDocumentHistory.documentId;\n return {\n ...state,\n // Reset document history if the last item has documentId undefined\n documentHistory: hasToResetDocumentHistory\n ? [action.payload.document]\n : [...state.documentHistory, action.payload.document],\n confirmDialogIntent: null,\n isModalOpen: true,\n fieldToConnect: hasToResetDocumentHistory ? undefined : action.payload.fieldToConnect,\n fieldToConnectUID: hasToResetDocumentHistory ? undefined : action.payload.fieldToConnectUID,\n getParentFormValues: hasToResetDocumentHistory\n ? undefined\n : action.payload.getParentFormValues,\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 'GO_TO_CREATED_RELATION':\n return {\n ...state,\n // Reset document history if the last item has documentId undefined\n documentHistory: state.documentHistory\n ? [...state.documentHistory.slice(0, -1), action.payload.document]\n : [action.payload.document],\n confirmDialogIntent: null,\n isModalOpen: true,\n fieldToConnect: undefined,\n fieldToConnectUID: undefined,\n getParentFormValues: undefined,\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 fieldToConnect: undefined,\n fieldToConnectUID: undefined,\n getParentFormValues: undefined,\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 isCreating: boolean;\n relationOpenMode: RelationOpenMode;\n}\n\nconst [RelationModalProvider, useRelationModal] =\n createContext<RelationModalContextValue>('RelationModal');\n\nfunction isRenderProp(\n children: RelationModalRendererProps['children']\n): children is (props: {\n dispatch: (action: Action) => void;\n relationOpenMode: RelationOpenMode;\n}) => React.ReactNode {\n return typeof children === 'function';\n}\n\ntype RelationModalRendererProps =\n // Is editing\n | {\n relation: DocumentMeta;\n children: React.ReactNode;\n }\n // Is creating\n | {\n relation?: never;\n children: (props: {\n dispatch: (action: Action) => void;\n relationOpenMode: RelationOpenMode;\n }) => React.ReactNode;\n };\n\nconst RootRelationRenderer = (props: RelationModalRendererProps) => {\n const { children } = props;\n\n const [state, dispatch] = React.useReducer(reducer, {\n documentHistory: [],\n confirmDialogIntent: null,\n isModalOpen: false,\n hasUnsavedChanges: false,\n fieldToConnect: undefined,\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 // Get the relationOpenMode setting from the current document's layout configuration\n const documentLayoutResponse = useDocumentLayout(rootDocument.model);\n const relationOpenMode: RelationOpenMode =\n documentLayoutResponse.edit?.settings?.relationOpenMode ?? 'modal';\n\n const currentDocumentMeta = state.documentHistory.at(-1) ?? rootDocumentMeta;\n const currentDocument = useDocument(currentDocumentMeta);\n // TODO: check if we can remove the single type check\n const isSingleType = currentDocumentMeta.collectionType === SINGLE_TYPES;\n const isCreating = !currentDocumentMeta.documentId && !isSingleType;\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 isCreating={isCreating}\n relationOpenMode={relationOpenMode}\n >\n <RelationModal>\n {isRenderProp(children)\n ? children({ dispatch, relationOpenMode })\n : props.relation && (\n <RelationModalTrigger relation={props.relation}>{children}</RelationModalTrigger>\n )}\n </RelationModal>\n </RelationModalProvider>\n );\n};\n\nconst NestedRelationRenderer = (props: RelationModalRendererProps) => {\n const { children } = props;\n const dispatch = useRelationModal('NestedRelation', (state) => state.dispatch);\n const relationOpenMode = useRelationModal('NestedRelation', (state) => state.relationOpenMode);\n\n return isRenderProp(children)\n ? children({ dispatch, relationOpenMode })\n : props.relation && (\n <RelationModalTrigger relation={props.relation}>{children}</RelationModalTrigger>\n ); /* This is the trigger that will be rendered in the parent relation */\n};\n\n/**\n * Component responsible for rendering its children wrapped in a modal, form and context if needed\n */\nconst RelationModalRenderer = (props: RelationModalRendererProps) => {\n // We're in a nested relation if the relation modal context is not undefined\n const isNested = useRelationModal('RelationContextWrapper', (state) => state != undefined, false);\n\n return isNested ? <NestedRelationRenderer {...props} /> : <RootRelationRenderer {...props} />;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * RelationModal\n * -----------------------------------------------------------------------------------------------*/\nconst generateCreateUrl = (currentDocumentMeta: DocumentMeta) => {\n return `/content-manager/${currentDocumentMeta.collectionType}/${currentDocumentMeta.model}/create${\n currentDocumentMeta.params?.locale\n ? `?plugins[i18n][locale]=${currentDocumentMeta.params.locale}`\n : ''\n }`;\n};\n\nconst RelationModal = ({ children }: { children: React.ReactNode }) => {\n const { formatMessage } = useIntl();\n const navigate = useNavigate();\n const state = useRelationModal('RelationModalForm', (state) => state.state);\n const dispatch = useRelationModal('RelationModalForm', (state) => state.dispatch);\n const currentDocumentMeta = useRelationModal(\n 'RelationModalForm',\n (state) => state.currentDocumentMeta\n );\n const currentDocument = useRelationModal('RelationModalForm', (state) => state.currentDocument);\n const isCreating = useRelationModal('RelationModalForm', (state) => state.isCreating);\n\n /*\n * We must wrap the modal window with Component Provider with reset values\n * to avoid inheriting id and uid from the root document and having weird\n * behaviors with simple relationships..\n */\n return (\n <ComponentProvider id={undefined} level={-1} uid={undefined} type={undefined}>\n <Modal.Root\n open={state.isModalOpen}\n onOpenChange={(open) => {\n if (!open) {\n dispatch({\n type: 'CLOSE_MODAL',\n payload: { shouldBypassConfirmation: false },\n });\n }\n }}\n >\n {children}\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 {isCreating\n ? formatMessage({\n id: 'content-manager.relation.create',\n defaultMessage: 'Create a relation',\n })\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 if (isCreating) {\n navigate(generateCreateUrl(currentDocumentMeta));\n } else {\n navigate(getFullPageUrl(currentDocumentMeta));\n }\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={isCreating ? 'POST' : 'PUT'}\n initialValues={currentDocument.getInitialFormValues(isCreating)}\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 <RelationModalBody />\n </FormContext>\n </Modal.Body>\n </StyledModalContent>\n </Modal.Root>\n </ComponentProvider>\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 RelationModal component.\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 const isCreating = useRelationModal('RelationModalForm', (state) => state.isCreating);\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 if (isCreating) {\n navigate(generateCreateUrl(currentDocumentMeta));\n } else {\n navigate(fullPageUrl);\n }\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: {\n document: state.confirmDialogIntent,\n shouldBypassConfirmation: true,\n fieldToConnect: state.fieldToConnect,\n fieldToConnectUID: state.fieldToConnectUID,\n getParentFormValues: state.getParentFormValues,\n },\n });\n }\n };\n\n return (\n <>\n <RelationModalForm />\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 RelationModalTrigger = ({\n children,\n relation,\n}: {\n children: React.ReactNode;\n relation: DocumentMeta;\n}) => {\n const dispatch = useRelationModal('ModalTrigger', (state) => state.dispatch);\n const relationOpenMode = useRelationModal('ModalTrigger', (state) => state.relationOpenMode);\n\n const fullPageUrl = getFullPageUrl(relation);\n\n if (relationOpenMode === 'newTab') {\n return (\n <StyledRelationLink to={fullPageUrl} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </StyledRelationLink>\n );\n }\n\n if (relationOpenMode === 'page') {\n return <StyledRelationLink to={fullPageUrl}>{children}</StyledRelationLink>;\n }\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\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\nconst StyledRelationLink = styled(RouterLink)`\n max-width: 100%;\n font-size: ${({ theme }) => theme.fontSizes[2]};\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: block;\n color: ${({ theme }) => theme.colors.primary600};\n text-decoration: none;\n\n &:hover,\n &:focus {\n color: ${({ theme }) => theme.colors.primary700};\n text-decoration: underline;\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 RelationModalForm = () => {\n const { formatMessage } = useIntl();\n\n const currentDocumentMeta = useRelationModal(\n 'RelationModalForm',\n (state) => state.currentDocumentMeta\n );\n const isCreating = useRelationModal('RelationModalForm', (state) => state.isCreating);\n const currentDocument = useRelationModal('RelationModalForm', (state) => state.currentDocument);\n const documentLayoutResponse = useDocumentLayout(currentDocumentMeta.model);\n const plugins = useStrapiApp('RelationModalForm', (state) => state.plugins);\n\n const initialValues = isCreating\n ? currentDocument.getInitialFormValues(isCreating)\n : 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 (!isCreating && !currentDocument.document) ||\n (!isCreating && !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 { reducer, RelationModalRenderer, useRelationModal, getFullPageUrl, generateCreateUrl };\nexport type { State, Action, RelationOpenMode };\n"],"names":["getCollectionType","url","regex","RegExp","COLLECTION_TYPES","SINGLE_TYPES","match","undefined","StyledModalContent","styled","Modal","Content","getFullPageUrl","currentDocumentMeta","isSingleType","collectionType","queryParams","params","locale","model","documentId","reducer","state","action","type","hasUnsavedChanges","payload","shouldBypassConfirmation","confirmDialogIntent","document","fieldToConnect","fieldToConnectUID","getParentFormValues","lastItemDocumentHistory","documentHistory","at","hasToResetDocumentHistory","isModalOpen","slice","RelationModalProvider","useRelationModal","createContext","isRenderProp","children","RootRelationRenderer","props","dispatch","React","useReducer","rootDocument","useDoc","query","useQueryParams","useMemo","buildValidParams","rootDocumentMeta","documentLayoutResponse","useDocumentLayout","relationOpenMode","edit","settings","currentDocument","useDocument","isCreating","_jsx","RelationModal","relation","RelationModalTrigger","NestedRelationRenderer","RelationModalRenderer","isNested","generateCreateUrl","formatMessage","useIntl","navigate","useNavigate","ComponentProvider","id","level","uid","_jsxs","Root","open","onOpenChange","Header","gap","Flex","justifyContent","alignItems","width","IconButton","withTooltip","label","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","RelationModalForm","Dialog","ConfirmDialog","onConfirm","onCancel","StyledRelationLink","to","target","rel","StyledTextButton","TextButton","theme","fontSizes","RouterLink","colors","primary600","primary700","plugins","useStrapiApp","permissions","isLoading","isLoadingPermissions","error","useRBAC","PERMISSIONS","map","subject","Loader","small","meta","height","EmptyStateLayout","icon","WarningCircle","content","documentTitle","getTitle","mainField","hasDraftAndPublished","draftAndPublish","activeTab","DocumentRBAC","direction","DescriptionComponentRenderer","descriptions","apis","getDocumentActions","actions","filteredActions","filter","position","flat","primaryAction","secondaryAction","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,YAAAA,CAAa,CAAC,CAAC,CAAA;IAChE,MAAMC,KAAAA,GAAQL,GAAAA,CAAIK,KAAK,CAACJ,KAAAA,CAAAA;AACxB,IAAA,OAAOI,KAAAA,GAAQA,KAAK,CAAC,CAAA,CAAE,GAAGC,SAAAA;AAC5B;AAEA,MAAMC,kBAAAA,GAAqBC,MAAAA,CAAOC,KAAAA,CAAMC,OAAO,CAAC;;;;;AAKhD,CAAC;AAED,MAAMC,iBAAiB,CAACC,mBAAAA,GAAAA;IACtB,MAAMC,YAAAA,GAAeD,mBAAAA,CAAoBE,cAAc,KAAKV,YAAAA;AAC5D,IAAA,MAAMW,WAAAA,GAAcH,mBAAAA,CAAoBI,MAAM,EAAEC,MAAAA,GAC5C,CAAC,uBAAuB,EAAEL,mBAAAA,CAAoBI,MAAM,CAACC,MAAM,EAAE,GAC7D,EAAA;AAEJ,IAAA,OAAO,CAAC,iBAAiB,EAAEL,mBAAAA,CAAoBE,cAAc,CAAC,CAAC,EAAEF,mBAAAA,CAAoBM,KAAK,GAAGL,YAAAA,GAAe,EAAA,GAAK,MAAMD,mBAAAA,CAAoBO,UAAU,GAAGJ,WAAAA,CAAAA,CAAa;AACvK;AA6DA,SAASK,OAAAA,CAAQC,KAAY,EAAEC,MAAc,EAAA;AAC3C,IAA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|
+
{"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 { generateNKeysBetween } from 'fractional-indexing';\nimport { useIntl } from 'react-intl';\nimport { Link as RouterLink, 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';\nimport { ComponentProvider } from '../ComponentContext';\n\nimport type { RelationOpenMode } from '../../../../../../../shared/contracts/content-types';\nimport type { ContentManagerPlugin, DocumentActionProps } from '../../../../../content-manager';\nimport type { AnyData } from '../../../utils/data';\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\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 * RelationModalRenderer\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 fieldToConnect?: string;\n fieldToConnectUID?: string;\n getParentFormValues?: () => AnyData;\n}\n\ntype Action =\n | {\n type: 'GO_TO_RELATION';\n payload: {\n document: DocumentMeta;\n shouldBypassConfirmation: boolean;\n fieldToConnect?: string;\n fieldToConnectUID?: string;\n getParentFormValues?: () => AnyData;\n };\n }\n | {\n type: 'GO_BACK';\n payload: { shouldBypassConfirmation: boolean };\n }\n | {\n type: 'GO_FULL_PAGE';\n }\n | {\n type: 'GO_TO_CREATED_RELATION';\n payload: {\n document: DocumentMeta;\n shouldBypassConfirmation: boolean;\n fieldToConnect?: string;\n fieldToConnectUID?: string;\n getParentFormValues?: () => AnyData;\n };\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 {\n ...state,\n confirmDialogIntent: action.payload.document,\n fieldToConnect: action.payload.fieldToConnect,\n fieldToConnectUID: action.payload.fieldToConnectUID,\n getParentFormValues: action.payload.getParentFormValues,\n };\n }\n\n const lastItemDocumentHistory = state.documentHistory.at(-1);\n const hasToResetDocumentHistory =\n lastItemDocumentHistory && !lastItemDocumentHistory.documentId;\n return {\n ...state,\n // Reset document history if the last item has documentId undefined\n documentHistory: hasToResetDocumentHistory\n ? [action.payload.document]\n : [...state.documentHistory, action.payload.document],\n confirmDialogIntent: null,\n isModalOpen: true,\n fieldToConnect: hasToResetDocumentHistory ? undefined : action.payload.fieldToConnect,\n fieldToConnectUID: hasToResetDocumentHistory ? undefined : action.payload.fieldToConnectUID,\n getParentFormValues: hasToResetDocumentHistory\n ? undefined\n : action.payload.getParentFormValues,\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 'GO_TO_CREATED_RELATION':\n return {\n ...state,\n // Reset document history if the last item has documentId undefined\n documentHistory: state.documentHistory\n ? [...state.documentHistory.slice(0, -1), action.payload.document]\n : [action.payload.document],\n confirmDialogIntent: null,\n isModalOpen: true,\n fieldToConnect: undefined,\n fieldToConnectUID: undefined,\n getParentFormValues: undefined,\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 fieldToConnect: undefined,\n fieldToConnectUID: undefined,\n getParentFormValues: undefined,\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 isCreating: boolean;\n relationOpenMode: RelationOpenMode;\n}\n\nconst [RelationModalProvider, useRelationModal] =\n createContext<RelationModalContextValue>('RelationModal');\n\nfunction isRenderProp(\n children: RelationModalRendererProps['children']\n): children is (props: {\n dispatch: (action: Action) => void;\n relationOpenMode: RelationOpenMode;\n}) => React.ReactNode {\n return typeof children === 'function';\n}\n\ntype RelationModalRendererProps =\n // Is editing\n | {\n relation: DocumentMeta;\n children: React.ReactNode;\n }\n // Is creating\n | {\n relation?: never;\n children: (props: {\n dispatch: (action: Action) => void;\n relationOpenMode: RelationOpenMode;\n }) => React.ReactNode;\n };\n\nconst RootRelationRenderer = (props: RelationModalRendererProps) => {\n const { children } = props;\n\n const [state, dispatch] = React.useReducer(reducer, {\n documentHistory: [],\n confirmDialogIntent: null,\n isModalOpen: false,\n hasUnsavedChanges: false,\n fieldToConnect: undefined,\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 // Get the relationOpenMode setting from the current document's layout configuration\n const documentLayoutResponse = useDocumentLayout(rootDocument.model);\n const relationOpenMode: RelationOpenMode =\n documentLayoutResponse.edit?.settings?.relationOpenMode ?? 'modal';\n\n const currentDocumentMeta = state.documentHistory.at(-1) ?? rootDocumentMeta;\n const currentDocument = useDocument(currentDocumentMeta);\n // TODO: check if we can remove the single type check\n const isSingleType = currentDocumentMeta.collectionType === SINGLE_TYPES;\n const isCreating = !currentDocumentMeta.documentId && !isSingleType;\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 isCreating={isCreating}\n relationOpenMode={relationOpenMode}\n >\n <RelationModal>\n {isRenderProp(children)\n ? children({ dispatch, relationOpenMode })\n : props.relation && (\n <RelationModalTrigger relation={props.relation}>{children}</RelationModalTrigger>\n )}\n </RelationModal>\n </RelationModalProvider>\n );\n};\n\nconst NestedRelationRenderer = (props: RelationModalRendererProps) => {\n const { children } = props;\n const dispatch = useRelationModal('NestedRelation', (state) => state.dispatch);\n const relationOpenMode = useRelationModal('NestedRelation', (state) => state.relationOpenMode);\n\n return isRenderProp(children)\n ? children({ dispatch, relationOpenMode })\n : props.relation && (\n <RelationModalTrigger relation={props.relation}>{children}</RelationModalTrigger>\n ); /* This is the trigger that will be rendered in the parent relation */\n};\n\n/**\n * Component responsible for rendering its children wrapped in a modal, form and context if needed\n */\nconst RelationModalRenderer = (props: RelationModalRendererProps) => {\n // We're in a nested relation if the relation modal context is not undefined\n const isNested = useRelationModal('RelationContextWrapper', (state) => state != undefined, false);\n\n return isNested ? <NestedRelationRenderer {...props} /> : <RootRelationRenderer {...props} />;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * RelationModal\n * -----------------------------------------------------------------------------------------------*/\nconst generateCreateUrl = (currentDocumentMeta: DocumentMeta) => {\n return `/content-manager/${currentDocumentMeta.collectionType}/${currentDocumentMeta.model}/create${\n currentDocumentMeta.params?.locale\n ? `?plugins[i18n][locale]=${currentDocumentMeta.params.locale}`\n : ''\n }`;\n};\n\n/**\n * Pre-fill the inverse relation with the parent that opened create-on-the-fly.\n * One-way relations have no inverse; unsaved parents have no documentId.\n */\nconst prefillParentRelation = ({\n initialValues,\n fieldToConnect,\n childSchema,\n parentDocument,\n parentModel,\n}: {\n initialValues?: AnyData;\n fieldToConnect?: string;\n childSchema?: { attributes?: Record<string, unknown> };\n parentDocument?: Record<string, unknown>;\n parentModel?: string;\n}): AnyData | undefined => {\n const documentId = parentDocument?.documentId;\n // mappedBy/inversedBy names a top-level attribute, not a component path.\n const parentFieldName = fieldToConnect;\n\n if (!initialValues || typeof documentId !== 'string' || !documentId || !parentFieldName) {\n return initialValues;\n }\n\n const inverseField = Object.entries(childSchema?.attributes ?? {}).find(([, attribute]) => {\n const relation = attribute as {\n type?: string;\n target?: string;\n inversedBy?: string;\n mappedBy?: string;\n };\n\n return (\n relation.type === 'relation' &&\n relation.target === parentModel &&\n (relation.inversedBy === parentFieldName || relation.mappedBy === parentFieldName)\n );\n })?.[0];\n\n if (!inverseField) {\n return initialValues;\n }\n\n const id = parentDocument.id ?? documentId;\n\n return {\n ...initialValues,\n [inverseField]: {\n connect: [\n {\n ...Object.fromEntries(\n Object.entries(parentDocument).filter(\n ([, value]) =>\n value === null || ['string', 'number', 'boolean'].includes(typeof value)\n )\n ),\n id,\n documentId,\n apiData: {\n id,\n documentId,\n locale: parentDocument.locale,\n isTemporary: true,\n },\n __temp_key__: generateNKeysBetween(null, null, 1)[0],\n },\n ],\n disconnect: [],\n },\n };\n};\n\nconst RelationModal = ({ children }: { children: React.ReactNode }) => {\n const { formatMessage } = useIntl();\n const navigate = useNavigate();\n const state = useRelationModal('RelationModalForm', (state) => state.state);\n const dispatch = useRelationModal('RelationModalForm', (state) => state.dispatch);\n const currentDocumentMeta = useRelationModal(\n 'RelationModalForm',\n (state) => state.currentDocumentMeta\n );\n const currentDocument = useRelationModal('RelationModalForm', (state) => state.currentDocument);\n const isCreating = useRelationModal('RelationModalForm', (state) => state.isCreating);\n const rootDocumentMeta = useRelationModal('RelationModalForm', (state) => state.rootDocumentMeta);\n const parentDocumentMeta = state.documentHistory.at(-2) ?? rootDocumentMeta;\n const parentDocument = useDocument(parentDocumentMeta, {\n skip: !isCreating || !state.fieldToConnect,\n });\n const initialValues = prefillParentRelation({\n initialValues: currentDocument.getInitialFormValues(isCreating),\n fieldToConnect: isCreating ? state.fieldToConnect : undefined,\n childSchema: currentDocument.schema,\n parentDocument: parentDocument.document,\n parentModel: parentDocumentMeta.model,\n });\n\n /*\n * We must wrap the modal window with Component Provider with reset values\n * to avoid inheriting id and uid from the root document and having weird\n * behaviors with simple relationships..\n */\n return (\n <ComponentProvider id={undefined} level={-1} uid={undefined} type={undefined}>\n <Modal.Root\n open={state.isModalOpen}\n onOpenChange={(open) => {\n if (!open) {\n dispatch({\n type: 'CLOSE_MODAL',\n payload: { shouldBypassConfirmation: false },\n });\n }\n }}\n >\n {children}\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 {isCreating\n ? formatMessage({\n id: 'content-manager.relation.create',\n defaultMessage: 'Create a relation',\n })\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 if (isCreating) {\n navigate(generateCreateUrl(currentDocumentMeta));\n } else {\n navigate(getFullPageUrl(currentDocumentMeta));\n }\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={isCreating ? 'POST' : 'PUT'}\n initialValues={initialValues}\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 <RelationModalBody />\n </FormContext>\n </Modal.Body>\n </StyledModalContent>\n </Modal.Root>\n </ComponentProvider>\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 RelationModal component.\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 const isCreating = useRelationModal('RelationModalForm', (state) => state.isCreating);\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 if (isCreating) {\n navigate(generateCreateUrl(currentDocumentMeta));\n } else {\n navigate(fullPageUrl);\n }\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: {\n document: state.confirmDialogIntent,\n shouldBypassConfirmation: true,\n fieldToConnect: state.fieldToConnect,\n fieldToConnectUID: state.fieldToConnectUID,\n getParentFormValues: state.getParentFormValues,\n },\n });\n }\n };\n\n return (\n <>\n <RelationModalForm />\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 RelationModalTrigger = ({\n children,\n relation,\n}: {\n children: React.ReactNode;\n relation: DocumentMeta;\n}) => {\n const dispatch = useRelationModal('ModalTrigger', (state) => state.dispatch);\n const relationOpenMode = useRelationModal('ModalTrigger', (state) => state.relationOpenMode);\n\n const fullPageUrl = getFullPageUrl(relation);\n\n if (relationOpenMode === 'newTab') {\n return (\n <StyledRelationLink to={fullPageUrl} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </StyledRelationLink>\n );\n }\n\n if (relationOpenMode === 'page') {\n return <StyledRelationLink to={fullPageUrl}>{children}</StyledRelationLink>;\n }\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\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\nconst StyledRelationLink = styled(RouterLink)`\n max-width: 100%;\n font-size: ${({ theme }) => theme.fontSizes[2]};\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: block;\n color: ${({ theme }) => theme.colors.primary600};\n text-decoration: none;\n\n &:hover,\n &:focus {\n color: ${({ theme }) => theme.colors.primary700};\n text-decoration: underline;\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 RelationModalForm = () => {\n const { formatMessage } = useIntl();\n\n const currentDocumentMeta = useRelationModal(\n 'RelationModalForm',\n (state) => state.currentDocumentMeta\n );\n const isCreating = useRelationModal('RelationModalForm', (state) => state.isCreating);\n const currentDocument = useRelationModal('RelationModalForm', (state) => state.currentDocument);\n const documentLayoutResponse = useDocumentLayout(currentDocumentMeta.model);\n const plugins = useStrapiApp('RelationModalForm', (state) => state.plugins);\n\n const initialValues = isCreating\n ? currentDocument.getInitialFormValues(isCreating)\n : 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 (!isCreating && !currentDocument.document) ||\n (!isCreating && !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 {\n reducer,\n RelationModalRenderer,\n useRelationModal,\n getFullPageUrl,\n generateCreateUrl,\n prefillParentRelation,\n};\nexport type { State, Action, RelationOpenMode };\n"],"names":["getCollectionType","url","regex","RegExp","COLLECTION_TYPES","SINGLE_TYPES","match","undefined","StyledModalContent","styled","Modal","Content","getFullPageUrl","currentDocumentMeta","isSingleType","collectionType","queryParams","params","locale","model","documentId","reducer","state","action","type","hasUnsavedChanges","payload","shouldBypassConfirmation","confirmDialogIntent","document","fieldToConnect","fieldToConnectUID","getParentFormValues","lastItemDocumentHistory","documentHistory","at","hasToResetDocumentHistory","isModalOpen","slice","RelationModalProvider","useRelationModal","createContext","isRenderProp","children","RootRelationRenderer","props","dispatch","React","useReducer","rootDocument","useDoc","query","useQueryParams","useMemo","buildValidParams","rootDocumentMeta","documentLayoutResponse","useDocumentLayout","relationOpenMode","edit","settings","currentDocument","useDocument","isCreating","_jsx","RelationModal","relation","RelationModalTrigger","NestedRelationRenderer","RelationModalRenderer","isNested","generateCreateUrl","prefillParentRelation","initialValues","childSchema","parentDocument","parentModel","parentFieldName","inverseField","Object","entries","attributes","find","attribute","target","inversedBy","mappedBy","id","connect","fromEntries","filter","value","includes","apiData","isTemporary","__temp_key__","generateNKeysBetween","disconnect","formatMessage","useIntl","navigate","useNavigate","parentDocumentMeta","skip","getInitialFormValues","schema","ComponentProvider","level","uid","_jsxs","Root","open","onOpenChange","Header","gap","Flex","justifyContent","alignItems","width","IconButton","withTooltip","label","defaultMessage","variant","disabled","length","onClick","marginRight","ArrowLeft","Typography","tag","fontWeight","ArrowsOut","Body","FormContext","method","validate","values","options","yupSchema","createYupSchema","components","status","abortEarly","RelationModalBody","pathname","search","useLocation","triggerRefetchDocument","useLazyGetDocumentQuery","modified","useForm","isSubmitting","useEffect","handleCloseModal","handleRedirection","editViewUrl","fullPageUrl","isRootDocumentUrl","handleConfirm","_Fragment","RelationModalForm","Dialog","ConfirmDialog","onConfirm","onCancel","StyledRelationLink","to","rel","StyledTextButton","TextButton","theme","fontSizes","RouterLink","colors","primary600","primary700","plugins","useStrapiApp","permissions","isLoading","isLoadingPermissions","error","useRBAC","PERMISSIONS","map","subject","Loader","small","meta","height","EmptyStateLayout","icon","WarningCircle","content","documentTitle","getTitle","mainField","hasDraftAndPublished","draftAndPublish","activeTab","DocumentRBAC","direction","DescriptionComponentRenderer","descriptions","apis","getDocumentActions","actions","filteredActions","position","flat","primaryAction","secondaryAction","DocumentActionButton","Box","DocumentStatus","flex","overflow","paddingTop","FormLayout","layout","hasBackground"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA+CO,SAASA,kBAAkBC,GAAW,EAAA;IAC3C,MAAMC,KAAAA,GAAQ,IAAIC,MAAAA,CAAO,CAAC,CAAC,EAAEC,gBAAAA,CAAiB,CAAC,EAAEC,YAAAA,CAAa,CAAC,CAAC,CAAA;IAChE,MAAMC,KAAAA,GAAQL,GAAAA,CAAIK,KAAK,CAACJ,KAAAA,CAAAA;AACxB,IAAA,OAAOI,KAAAA,GAAQA,KAAK,CAAC,CAAA,CAAE,GAAGC,SAAAA;AAC5B;AAEA,MAAMC,kBAAAA,GAAqBC,MAAAA,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AAA;gBAAGC,QAAAA,EAAS,MAAA;gBAAOpG,UAAAA,EAAW,SAAA;gBAAUqG,UAAAA,EAAY,CAAA;AAC9D,gBAAA,QAAA,gBAAA1J,GAAA,CAACsJ,GAAAA,EAAAA;oBAAIG,QAAAA,EAAS,MAAA;oBAAOD,IAAAA,EAAM,CAAA;AACzB,oBAAA,QAAA,gBAAAxJ,GAAA,CAAC2J,UAAAA,EAAAA;wBACCC,MAAAA,EAAQpK,sBAAAA,CAAuBG,IAAI,CAACiK,MAAM;wBAC1C/L,QAAAA,EAAUgC,eAAAA;wBACVgK,aAAAA,EAAe;;;;;;AAM3B,CAAA;;;;"}
|
|
@@ -3,6 +3,7 @@ import type { ContentManagerLink } from '../hooks/useContentManagerInitData';
|
|
|
3
3
|
interface AppState {
|
|
4
4
|
collectionTypeLinks: ContentManagerLink[];
|
|
5
5
|
components: GetInitData.Response['data']['components'];
|
|
6
|
+
contentStructure?: GetInitData.Response['data']['contentStructure'];
|
|
6
7
|
fieldSizes: GetInitData.Response['data']['fieldSizes'];
|
|
7
8
|
models: GetInitData.Response['data']['contentTypes'];
|
|
8
9
|
singleTypeLinks: ContentManagerLink[];
|
|
@@ -13,6 +14,7 @@ declare const setInitialData: import("@reduxjs/toolkit").ActionCreatorWithPayloa
|
|
|
13
14
|
authorizedCollectionTypeLinks: AppState["collectionTypeLinks"];
|
|
14
15
|
authorizedSingleTypeLinks: AppState["singleTypeLinks"];
|
|
15
16
|
components: AppState["components"];
|
|
17
|
+
contentStructure?: AppState["contentStructure"];
|
|
16
18
|
contentTypeSchemas: AppState["models"];
|
|
17
19
|
fieldSizes: AppState["fieldSizes"];
|
|
18
20
|
}, "app/setInitialData">;
|
|
@@ -79,5 +79,18 @@ type RelationModalRendererProps = {
|
|
|
79
79
|
*/
|
|
80
80
|
declare const RelationModalRenderer: (props: RelationModalRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
81
81
|
declare const generateCreateUrl: (currentDocumentMeta: DocumentMeta) => string;
|
|
82
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Pre-fill the inverse relation with the parent that opened create-on-the-fly.
|
|
84
|
+
* One-way relations have no inverse; unsaved parents have no documentId.
|
|
85
|
+
*/
|
|
86
|
+
declare const prefillParentRelation: ({ initialValues, fieldToConnect, childSchema, parentDocument, parentModel, }: {
|
|
87
|
+
initialValues?: AnyData;
|
|
88
|
+
fieldToConnect?: string;
|
|
89
|
+
childSchema?: {
|
|
90
|
+
attributes?: Record<string, unknown>;
|
|
91
|
+
};
|
|
92
|
+
parentDocument?: Record<string, unknown>;
|
|
93
|
+
parentModel?: string;
|
|
94
|
+
}) => AnyData | undefined;
|
|
95
|
+
export { reducer, RelationModalRenderer, useRelationModal, getFullPageUrl, generateCreateUrl, prefillParentRelation, };
|
|
83
96
|
export type { State, Action, RelationOpenMode };
|
|
@@ -5,5 +5,6 @@ declare const useGetInitialDataQuery: import("@reduxjs/toolkit/dist/query/react/
|
|
|
5
5
|
}>;
|
|
6
6
|
components: import("../../../shared/contracts/components").Component[];
|
|
7
7
|
contentTypes: import("../../../shared/contracts/content-types").ContentType[];
|
|
8
|
+
contentStructure?: import("@strapi/types/dist/modules/content-structure.js").ResolvedContentStructure;
|
|
8
9
|
}, "adminApi">>;
|
|
9
10
|
export { useGetInitialDataQuery };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ContentManagerLink } from '../hooks/useContentManagerInitData';
|
|
2
|
+
import type { Modules } from '@strapi/types';
|
|
3
|
+
type ResolvedGroupNode = Modules.ContentStructure.ResolvedGroupNode;
|
|
4
|
+
type VisibleTreeNode<TLink> = {
|
|
5
|
+
type: 'folder';
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
children: VisibleTreeNode<TLink>[];
|
|
9
|
+
} | {
|
|
10
|
+
type: 'link';
|
|
11
|
+
link: TLink;
|
|
12
|
+
};
|
|
13
|
+
export type LinkTreeNode = VisibleTreeNode<ContentManagerLink>;
|
|
14
|
+
/**
|
|
15
|
+
* Reconcile a resolved content-structure section (folder groups) with the set of links the user can
|
|
16
|
+
* actually see with respect to their RBAC permissions.
|
|
17
|
+
*/
|
|
18
|
+
export declare const deriveVisibleTree: <TLink extends {
|
|
19
|
+
uid: string;
|
|
20
|
+
}>(groups: ResolvedGroupNode[], links: TLink[], compareUngrouped?: (a: TLink, b: TLink) => number) => VisibleTreeNode<TLink>[];
|
|
21
|
+
export declare function flattenTreeLinks<TLink>(nodes: VisibleTreeNode<TLink>[], parentPath?: string[]): Array<{
|
|
22
|
+
link: TLink;
|
|
23
|
+
path: string[];
|
|
24
|
+
}>;
|
|
25
|
+
export declare function countTreeLinks<TLink>(nodes: VisibleTreeNode<TLink>[]): number;
|
|
26
|
+
type FilterTreeLinksParams<TLink> = {
|
|
27
|
+
matchFolderName: (name: string) => boolean;
|
|
28
|
+
matchLink: (link: TLink) => boolean;
|
|
29
|
+
nodes: VisibleTreeNode<TLink>[];
|
|
30
|
+
parentPath?: string[];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Search the contentStructure tree, returning the matching links with their folder path.
|
|
34
|
+
*
|
|
35
|
+
* A **link** matches on whatever `matchLink` tests (display name and/or UID) and is returned with its ancestor folder path.
|
|
36
|
+
*
|
|
37
|
+
* A **folder** matches on its name and, when it does, surfaces *all* of its descendant content types (each with
|
|
38
|
+
* its own path).
|
|
39
|
+
*/
|
|
40
|
+
export declare function filterTreeLinks<TLink>({ matchFolderName, matchLink, nodes, parentPath, }: FilterTreeLinksParams<TLink>): Array<{
|
|
41
|
+
link: TLink;
|
|
42
|
+
path: string[];
|
|
43
|
+
}>;
|
|
44
|
+
type BuildContentStructureSectionParams = {
|
|
45
|
+
compareLinks: (a: ContentManagerLink, b: ContentManagerLink) => number;
|
|
46
|
+
groups: Modules.ContentStructure.ResolvedGroupNode[];
|
|
47
|
+
id: Modules.ContentStructure.ContentStructureSectionKey;
|
|
48
|
+
links: ContentManagerLink[];
|
|
49
|
+
title: string;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Builds a content structure section for the left menu from the RBAC-provided links and the resolved content structure configuration.
|
|
53
|
+
*/
|
|
54
|
+
export declare function buildContentStructureSection({ compareLinks, groups, links, title, id, }: BuildContentStructureSectionParams): {
|
|
55
|
+
id: Modules.ContentStructure.ContentStructureSectionKey;
|
|
56
|
+
title: string;
|
|
57
|
+
tree: LinkTreeNode[];
|
|
58
|
+
};
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Reconcile a resolved content-structure section (folder groups) with the set of links the user can
|
|
5
|
+
* actually see with respect to their RBAC permissions.
|
|
6
|
+
*/ const deriveVisibleTree = (groups, links, compareUngrouped)=>{
|
|
7
|
+
const linkByUid = new Map(links.map((link)=>[
|
|
8
|
+
link.uid,
|
|
9
|
+
link
|
|
10
|
+
]));
|
|
11
|
+
const grouped = new Set();
|
|
12
|
+
const resolveChildAsNode = (child)=>{
|
|
13
|
+
if (child.type === 'contentType') {
|
|
14
|
+
const link = linkByUid.get(child.uid);
|
|
15
|
+
if (!link) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
grouped.add(child.uid);
|
|
19
|
+
return {
|
|
20
|
+
type: 'link',
|
|
21
|
+
link
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return resolveGroupAsNode(child);
|
|
25
|
+
};
|
|
26
|
+
const isTreeNode = (node)=>{
|
|
27
|
+
return node !== null;
|
|
28
|
+
};
|
|
29
|
+
const resolveGroupAsNode = (group)=>{
|
|
30
|
+
const children = group.children.map(resolveChildAsNode).filter(isTreeNode);
|
|
31
|
+
if (children.length === 0) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
type: 'folder',
|
|
36
|
+
id: group.id,
|
|
37
|
+
name: group.name,
|
|
38
|
+
children
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
const folders = groups.map(resolveGroupAsNode).filter(isTreeNode);
|
|
42
|
+
const ungrouped = links.filter((link)=>!grouped.has(link.uid));
|
|
43
|
+
if (compareUngrouped) {
|
|
44
|
+
ungrouped.sort(compareUngrouped);
|
|
45
|
+
}
|
|
46
|
+
return [
|
|
47
|
+
...folders,
|
|
48
|
+
...ungrouped.map((link)=>({
|
|
49
|
+
type: 'link',
|
|
50
|
+
link
|
|
51
|
+
}))
|
|
52
|
+
];
|
|
53
|
+
};
|
|
54
|
+
function flattenTreeLinks(nodes, parentPath = []) {
|
|
55
|
+
return nodes.flatMap((node)=>{
|
|
56
|
+
if (node.type === 'link') {
|
|
57
|
+
return [
|
|
58
|
+
{
|
|
59
|
+
link: node.link,
|
|
60
|
+
path: parentPath
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
return flattenTreeLinks(node.children, [
|
|
65
|
+
...parentPath,
|
|
66
|
+
node.name
|
|
67
|
+
]);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function countTreeLinks(nodes) {
|
|
71
|
+
return flattenTreeLinks(nodes).length;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Search the contentStructure tree, returning the matching links with their folder path.
|
|
75
|
+
*
|
|
76
|
+
* A **link** matches on whatever `matchLink` tests (display name and/or UID) and is returned with its ancestor folder path.
|
|
77
|
+
*
|
|
78
|
+
* A **folder** matches on its name and, when it does, surfaces *all* of its descendant content types (each with
|
|
79
|
+
* its own path).
|
|
80
|
+
*/ function filterTreeLinks({ matchFolderName, matchLink, nodes, parentPath = [] }) {
|
|
81
|
+
return nodes.flatMap((node)=>{
|
|
82
|
+
if (node.type === 'link') {
|
|
83
|
+
return matchLink(node.link) ? [
|
|
84
|
+
{
|
|
85
|
+
link: node.link,
|
|
86
|
+
path: parentPath
|
|
87
|
+
}
|
|
88
|
+
] : [];
|
|
89
|
+
}
|
|
90
|
+
const path = [
|
|
91
|
+
...parentPath,
|
|
92
|
+
node.name
|
|
93
|
+
];
|
|
94
|
+
if (matchFolderName(node.name)) {
|
|
95
|
+
return flattenTreeLinks(node.children, path);
|
|
96
|
+
}
|
|
97
|
+
return filterTreeLinks({
|
|
98
|
+
nodes: node.children,
|
|
99
|
+
matchFolderName,
|
|
100
|
+
matchLink,
|
|
101
|
+
parentPath: path
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Builds a content structure section for the left menu from the RBAC-provided links and the resolved content structure configuration.
|
|
107
|
+
*/ function buildContentStructureSection({ compareLinks, groups, links, title, id }) {
|
|
108
|
+
try {
|
|
109
|
+
return {
|
|
110
|
+
id,
|
|
111
|
+
title,
|
|
112
|
+
tree: deriveVisibleTree(groups, links, compareLinks)
|
|
113
|
+
};
|
|
114
|
+
} catch {
|
|
115
|
+
const tree = [
|
|
116
|
+
...links
|
|
117
|
+
].sort(compareLinks).map((link)=>{
|
|
118
|
+
return {
|
|
119
|
+
type: 'link',
|
|
120
|
+
link
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
id,
|
|
125
|
+
title,
|
|
126
|
+
tree
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
exports.buildContentStructureSection = buildContentStructureSection;
|
|
132
|
+
exports.countTreeLinks = countTreeLinks;
|
|
133
|
+
exports.deriveVisibleTree = deriveVisibleTree;
|
|
134
|
+
exports.filterTreeLinks = filterTreeLinks;
|
|
135
|
+
exports.flattenTreeLinks = flattenTreeLinks;
|
|
136
|
+
//# sourceMappingURL=contentStructure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentStructure.js","sources":["../../../admin/src/utils/contentStructure.ts"],"sourcesContent":["import type { ContentManagerLink } from '../hooks/useContentManagerInitData';\nimport type { Modules } from '@strapi/types';\n\ntype ResolvedGroupNode = Modules.ContentStructure.ResolvedGroupNode;\ntype ResolvedStructureChild = Modules.ContentStructure.ResolvedStructureChild;\n\ntype VisibleTreeNode<TLink> =\n | { type: 'folder'; id: string; name: string; children: VisibleTreeNode<TLink>[] }\n | { type: 'link'; link: TLink };\n\nexport type LinkTreeNode = VisibleTreeNode<ContentManagerLink>;\n\n/**\n * Reconcile a resolved content-structure section (folder groups) with the set of links the user can\n * actually see with respect to their RBAC permissions.\n */\nexport const deriveVisibleTree = <TLink extends { uid: string }>(\n groups: ResolvedGroupNode[],\n links: TLink[],\n compareUngrouped?: (a: TLink, b: TLink) => number\n): VisibleTreeNode<TLink>[] => {\n const linkByUid = new Map(links.map((link) => [link.uid, link]));\n const grouped = new Set<string>();\n\n const resolveChildAsNode = (child: ResolvedStructureChild): VisibleTreeNode<TLink> | null => {\n if (child.type === 'contentType') {\n const link = linkByUid.get(child.uid);\n\n if (!link) {\n return null;\n }\n\n grouped.add(child.uid);\n\n return { type: 'link', link };\n }\n\n return resolveGroupAsNode(child);\n };\n\n const isTreeNode = (node: VisibleTreeNode<TLink> | null): node is VisibleTreeNode<TLink> => {\n return node !== null;\n };\n\n const resolveGroupAsNode = (group: ResolvedGroupNode): VisibleTreeNode<TLink> | null => {\n const children = group.children.map(resolveChildAsNode).filter(isTreeNode);\n\n if (children.length === 0) {\n return null;\n }\n\n return { type: 'folder', id: group.id, name: group.name, children };\n };\n\n const folders = groups.map(resolveGroupAsNode).filter(isTreeNode);\n\n const ungrouped = links.filter((link) => !grouped.has(link.uid));\n\n if (compareUngrouped) {\n ungrouped.sort(compareUngrouped);\n }\n\n return [...folders, ...ungrouped.map((link): VisibleTreeNode<TLink> => ({ type: 'link', link }))];\n};\n\nexport function flattenTreeLinks<TLink>(\n nodes: VisibleTreeNode<TLink>[],\n parentPath: string[] = []\n): Array<{ link: TLink; path: string[] }> {\n return nodes.flatMap((node) => {\n if (node.type === 'link') {\n return [{ link: node.link, path: parentPath }];\n }\n\n return flattenTreeLinks(node.children, [...parentPath, node.name]);\n });\n}\n\nexport function countTreeLinks<TLink>(nodes: VisibleTreeNode<TLink>[]): number {\n return flattenTreeLinks(nodes).length;\n}\n\ntype FilterTreeLinksParams<TLink> = {\n matchFolderName: (name: string) => boolean;\n matchLink: (link: TLink) => boolean;\n nodes: VisibleTreeNode<TLink>[];\n parentPath?: string[];\n};\n\n/**\n * Search the contentStructure tree, returning the matching links with their folder path.\n *\n * A **link** matches on whatever `matchLink` tests (display name and/or UID) and is returned with its ancestor folder path.\n *\n * A **folder** matches on its name and, when it does, surfaces *all* of its descendant content types (each with\n * its own path).\n */\nexport function filterTreeLinks<TLink>({\n matchFolderName,\n matchLink,\n nodes,\n parentPath = [],\n}: FilterTreeLinksParams<TLink>): Array<{ link: TLink; path: string[] }> {\n return nodes.flatMap((node) => {\n if (node.type === 'link') {\n return matchLink(node.link) ? [{ link: node.link, path: parentPath }] : [];\n }\n\n const path = [...parentPath, node.name];\n\n if (matchFolderName(node.name)) {\n return flattenTreeLinks(node.children, path);\n }\n\n return filterTreeLinks({\n nodes: node.children,\n matchFolderName,\n matchLink,\n parentPath: path,\n });\n });\n}\n\ntype BuildContentStructureSectionParams = {\n compareLinks: (a: ContentManagerLink, b: ContentManagerLink) => number;\n groups: Modules.ContentStructure.ResolvedGroupNode[];\n id: Modules.ContentStructure.ContentStructureSectionKey;\n links: ContentManagerLink[];\n title: string;\n};\n/**\n * Builds a content structure section for the left menu from the RBAC-provided links and the resolved content structure configuration.\n */\nexport function buildContentStructureSection({\n compareLinks,\n groups,\n links,\n title,\n id,\n}: BuildContentStructureSectionParams): {\n id: Modules.ContentStructure.ContentStructureSectionKey;\n title: string;\n tree: LinkTreeNode[];\n} {\n try {\n return { id, title, tree: deriveVisibleTree(groups, links, compareLinks) };\n } catch {\n const tree: LinkTreeNode[] = [...links].sort(compareLinks).map((link) => {\n return { type: 'link', link };\n });\n\n return { id, title, tree };\n }\n}\n"],"names":["deriveVisibleTree","groups","links","compareUngrouped","linkByUid","Map","map","link","uid","grouped","Set","resolveChildAsNode","child","type","get","add","resolveGroupAsNode","isTreeNode","node","group","children","filter","length","id","name","folders","ungrouped","has","sort","flattenTreeLinks","nodes","parentPath","flatMap","path","countTreeLinks","filterTreeLinks","matchFolderName","matchLink","buildContentStructureSection","compareLinks","title","tree"],"mappings":";;AAYA;;;AAGC,IACM,MAAMA,iBAAAA,GAAoB,CAC/BC,QACAC,KAAAA,EACAC,gBAAAA,GAAAA;AAEA,IAAA,MAAMC,YAAY,IAAIC,GAAAA,CAAIH,MAAMI,GAAG,CAAC,CAACC,IAAAA,GAAS;AAACA,YAAAA,IAAAA,CAAKC,GAAG;AAAED,YAAAA;AAAK,SAAA,CAAA,CAAA;AAC9D,IAAA,MAAME,UAAU,IAAIC,GAAAA,EAAAA;AAEpB,IAAA,MAAMC,qBAAqB,CAACC,KAAAA,GAAAA;QAC1B,IAAIA,KAAAA,CAAMC,IAAI,KAAK,aAAA,EAAe;AAChC,YAAA,MAAMN,IAAAA,GAAOH,SAAAA,CAAUU,GAAG,CAACF,MAAMJ,GAAG,CAAA;AAEpC,YAAA,IAAI,CAACD,IAAAA,EAAM;gBACT,OAAO,IAAA;AACT,YAAA;YAEAE,OAAAA,CAAQM,GAAG,CAACH,KAAAA,CAAMJ,GAAG,CAAA;YAErB,OAAO;gBAAEK,IAAAA,EAAM,MAAA;AAAQN,gBAAAA;AAAK,aAAA;AAC9B,QAAA;AAEA,QAAA,OAAOS,kBAAAA,CAAmBJ,KAAAA,CAAAA;AAC5B,IAAA,CAAA;AAEA,IAAA,MAAMK,aAAa,CAACC,IAAAA,GAAAA;AAClB,QAAA,OAAOA,IAAAA,KAAS,IAAA;AAClB,IAAA,CAAA;AAEA,IAAA,MAAMF,qBAAqB,CAACG,KAAAA,GAAAA;QAC1B,MAAMC,QAAAA,GAAWD,MAAMC,QAAQ,CAACd,GAAG,CAACK,kBAAAA,CAAAA,CAAoBU,MAAM,CAACJ,UAAAA,CAAAA;QAE/D,IAAIG,QAAAA,CAASE,MAAM,KAAK,CAAA,EAAG;YACzB,OA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