@strapi/content-manager 5.12.3 → 5.12.5
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/Widgets.js +161 -0
- package/dist/admin/components/Widgets.js.map +1 -0
- package/dist/admin/components/Widgets.mjs +158 -0
- package/dist/admin/components/Widgets.mjs.map +1 -0
- 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/index.js +41 -2
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +42 -3
- package/dist/admin/index.mjs.map +1 -1
- 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/services/homepage.js +26 -0
- package/dist/admin/services/homepage.js.map +1 -0
- package/dist/admin/services/homepage.mjs +24 -0
- package/dist/admin/services/homepage.mjs.map +1 -0
- package/dist/admin/src/components/Widgets.d.ts +3 -0
- 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/dist/admin/src/services/homepage.d.ts +5 -0
- package/dist/server/src/services/homepage.d.ts +11 -0
- package/dist/server/src/services/homepage.d.ts.map +1 -0
- package/dist/shared/contracts/homepage.d.ts +25 -0
- package/dist/shared/contracts/homepage.d.ts.map +1 -0
- 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":"Relations.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Relations/Relations.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n type InputProps,\n useField,\n useForm,\n useNotification,\n useFocusInputField,\n useQueryParams,\n} from '@strapi/admin/strapi-admin';\nimport {\n Box,\n Combobox,\n ComboboxOption,\n Flex,\n IconButton,\n TextButton,\n Typography,\n VisuallyHidden,\n useComposedRefs,\n Link,\n Field,\n FlexComponent,\n BoxComponent,\n} from '@strapi/design-system';\nimport { Cross, Drag, ArrowClockwise } from '@strapi/icons';\nimport { generateNKeysBetween } from 'fractional-indexing';\nimport pipe from 'lodash/fp/pipe';\nimport { getEmptyImage } from 'react-dnd-html5-backend';\nimport { useIntl } from 'react-intl';\nimport { FixedSizeList, ListChildComponentProps } from 'react-window';\nimport { styled } from 'styled-components';\n\nimport { RelationDragPreviewProps } from '../../../../../components/DragPreviews/RelationDragPreview';\nimport { COLLECTION_TYPES } from '../../../../../constants/collections';\nimport { ItemTypes } from '../../../../../constants/dragAndDrop';\nimport { useDocumentContext } from '../../../../../features/DocumentContext';\nimport { useDebounce } from '../../../../../hooks/useDebounce';\nimport { type EditFieldLayout } from '../../../../../hooks/useDocumentLayout';\nimport {\n DROP_SENSITIVITY,\n UseDragAndDropOptions,\n useDragAndDrop,\n} from '../../../../../hooks/useDragAndDrop';\nimport {\n useGetRelationsQuery,\n useLazySearchRelationsQuery,\n RelationResult,\n} from '../../../../../services/relations';\nimport { buildValidParams } from '../../../../../utils/api';\nimport { getRelationLabel } from '../../../../../utils/relations';\nimport { getTranslation } from '../../../../../utils/translations';\nimport { DocumentStatus } from '../../DocumentStatus';\nimport { useComponent } from '../ComponentContext';\nimport { RelationModalForm, getCollectionType } from '../Relations/RelationModal';\n\nimport type { Schema } from '@strapi/types';\n\n/**\n * Remove a relation, whether it's been already saved or not.\n * It's used both in RelationsList, where the \"remove relation\" button is, and in the input,\n * because we sometimes need to remove a previous relation when selecting a new one.\n */\nfunction useHandleDisconnect(fieldName: string, consumerName: string) {\n const field = useField(fieldName);\n const removeFieldRow = useForm(consumerName, (state) => state.removeFieldRow);\n const addFieldRow = useForm(consumerName, (state) => state.addFieldRow);\n\n const handleDisconnect: ListItemProps['data']['handleDisconnect'] = (relation) => {\n if (field.value && field.value.connect) {\n /**\n * A relation will exist in the `connect` array _if_ it has\n * been added without saving. In this case, we just remove it\n * from the connect array\n */\n const indexOfRelationInConnectArray = field.value.connect.findIndex(\n (rel: NonNullable<RelationsFormValue['connect']>[number]) => rel.id === relation.id\n );\n\n if (indexOfRelationInConnectArray >= 0) {\n removeFieldRow(`${fieldName}.connect`, indexOfRelationInConnectArray);\n return;\n }\n }\n\n addFieldRow(`${fieldName}.disconnect`, {\n id: relation.id,\n apiData: {\n id: relation.id,\n documentId: relation.documentId,\n locale: relation.locale,\n },\n });\n };\n\n return handleDisconnect;\n}\n\n/* -------------------------------------------------------------------------------------------------\n * RelationsField\n * -----------------------------------------------------------------------------------------------*/\n\nconst RELATIONS_TO_DISPLAY = 5;\nconst ONE_WAY_RELATIONS = ['oneWay', 'oneToOne', 'manyToOne', 'oneToManyMorph', 'oneToOneMorph'];\n\ntype RelationPosition =\n | (Pick<RelationResult, 'status' | 'locale'> & {\n before: string;\n end?: never;\n })\n | { end: boolean; before?: never; status?: never; locale?: never };\n\ninterface Relation extends Pick<RelationResult, 'documentId' | 'id' | 'locale' | 'status'> {\n href: string;\n label: string;\n position?: RelationPosition;\n __temp_key__: string;\n apiData?: {\n documentId: RelationResult['documentId'];\n id: RelationResult['id'];\n locale?: RelationResult['locale'];\n position: RelationPosition;\n };\n}\n\ninterface RelationsFieldProps\n extends Omit<Extract<EditFieldLayout, { type: 'relation' }>, 'size' | 'hint'>,\n Pick<InputProps, 'hint'> {}\n\nexport interface RelationsFormValue {\n connect?: Relation[];\n disconnect?: Pick<Relation, 'id'>[];\n}\n\n/**\n * TODO: we get a rather ugly flash when we remove a single relation from the list leaving\n * no other relations when we press save. The initial relation re-renders, probably because\n * of the lag in the Form cleaning it's \"disconnect\" array, whilst our data has not been invalidated.\n *\n * Could we invalidate relation data on the document actions? Should we?\n */\n\n/**\n * @internal\n * @description The relations field holds a lot of domain logic for handling relations which is rather complicated\n * At present we do not expose this to plugin developers, however, they are able to overwrite it themselves should\n * they wish to do so.\n */\nconst RelationsField = React.forwardRef<HTMLDivElement, RelationsFieldProps>(\n ({ disabled, label, ...props }, ref) => {\n const currentDocumentMeta = useDocumentContext('RelationsField', (state) => state.meta);\n const currentDocument = useDocumentContext('RelationsField', (state) => state.document);\n const rootDocumentMeta = useDocumentContext(\n 'RelationsField',\n (state) => state.rootDocumentMeta\n );\n\n const [currentPage, setCurrentPage] = React.useState(1);\n const isRootDocument = rootDocumentMeta.documentId === currentDocumentMeta.documentId;\n const documentMeta = isRootDocument ? rootDocumentMeta : currentDocumentMeta;\n\n // Use the documentId from the actual document, not the params (meta)\n const documentId = currentDocument.document?.documentId;\n\n const { formatMessage } = useIntl();\n\n const [{ query }] = useQueryParams();\n const params = documentMeta.params ?? buildValidParams(query);\n\n const isMorph = props.attribute.relation.toLowerCase().includes('morph');\n const isDisabled = isMorph || disabled;\n\n const { componentId, componentUID } = useComponent('RelationsField', ({ uid, id }) => ({\n componentId: id,\n componentUID: uid,\n }));\n\n const isSubmitting = useForm('RelationsList', (state) => state.isSubmitting);\n\n React.useEffect(() => {\n setCurrentPage(1);\n }, [isSubmitting]);\n\n const component = componentUID && currentDocument.components[componentUID];\n /**\n * We'll always have a documentId in a created entry, so we look for a componentId first.\n * Same with `uid` and `documentModel`.\n */\n const model = component ? component.uid : documentMeta.model;\n const id = component && componentId ? componentId.toString() : documentId;\n\n /**\n * The `name` prop is a complete path to the field, e.g. `field1.field2.field3`.\n * Where the above example would a nested field within two components, however\n * we only require the field on the component not the complete path since we query\n * individual components. Therefore we split the string and take the last item.\n */\n const [targetField] = props.name.split('.').slice(-1);\n\n const schemaAttributes = component\n ? (component.attributes ?? {})\n : (currentDocument.schema?.attributes ?? {});\n\n /**\n * Confirm the target field is related to the current document.\n * Since relations can exist in a modal on top of the root document,\n * we need to ensure we are fetching relations for the correct document (root document vs related document),\n */\n const isRelatedToCurrentDocument =\n Object.values(schemaAttributes).filter(\n (attribute) =>\n attribute.type === 'relation' &&\n 'target' in attribute &&\n 'target' in props.attribute &&\n attribute.target === props.attribute.target\n ).length > 0;\n\n const { data, isLoading, isFetching } = useGetRelationsQuery(\n {\n model,\n targetField,\n // below we don't run the query if there is no id.\n id,\n params: {\n ...params,\n pageSize: RELATIONS_TO_DISPLAY,\n page: currentPage,\n },\n },\n {\n refetchOnMountOrArgChange: true,\n skip: !id || !isRelatedToCurrentDocument,\n selectFromResult: (result) => {\n return {\n ...result,\n data: {\n ...result.data,\n results: result.data?.results ? result.data.results : [],\n },\n };\n },\n }\n );\n\n const handleLoadMore = () => {\n setCurrentPage((prev) => prev + 1);\n };\n\n const field = useField(props.name);\n\n const isFetchingMoreRelations = isLoading || isFetching;\n\n const realServerRelationsCount =\n 'pagination' in data && data.pagination ? data.pagination.total : 0;\n\n /**\n * Items that are already connected, but reordered would be in\n * this list, so to get an accurate figure, we remove them.\n */\n const relationsConnected =\n (field.value?.connect ?? []).filter(\n (rel: Relation) => data.results.findIndex((relation) => relation.id === rel.id) === -1\n ).length ?? 0;\n const relationsDisconnected = field.value?.disconnect?.length ?? 0;\n\n const relationsCount = realServerRelationsCount + relationsConnected - relationsDisconnected;\n\n /**\n * This is it, the source of truth for reordering in conjunction with partial loading & updating\n * of relations. Relations on load are given __temp_key__ when fetched, because we don't want to\n * create brand new keys everytime the data updates, just keep adding them onto the newly loaded ones.\n */\n const relations = React.useMemo(() => {\n const ctx = {\n field: field.value,\n // @ts-expect-error – targetModel does exist on the attribute. But it's not typed.\n href: `../${COLLECTION_TYPES}/${props.attribute.targetModel}`,\n mainField: props.mainField,\n };\n\n /**\n * Tidy up our data.\n */\n const transformations = pipe(\n removeConnected(ctx),\n removeDisconnected(ctx),\n addLabelAndHref(ctx)\n );\n\n const transformedRels = transformations([...data.results]);\n\n /**\n * THIS IS CRUCIAL. If you don't sort by the __temp_key__ which comes from fractional indexing\n * then the list will be in the wrong order.\n */\n return [...transformedRels, ...(field.value?.connect ?? [])].sort((a, b) => {\n if (a.__temp_key__ < b.__temp_key__) return -1;\n if (a.__temp_key__ > b.__temp_key__) return 1;\n return 0;\n });\n }, [\n data.results,\n field.value,\n // @ts-expect-error – targetModel does exist on the attribute. But it's not typed.\n props.attribute.targetModel,\n props.mainField,\n ]);\n\n const handleDisconnect = useHandleDisconnect(props.name, 'RelationsField');\n\n const handleConnect: RelationsInputProps['onChange'] = (relation) => {\n const [lastItemInList] = relations.slice(-1);\n\n const item = {\n id: relation.id,\n apiData: {\n id: relation.id,\n documentId: relation.documentId,\n locale: relation.locale,\n },\n status: relation.status,\n /**\n * If there's a last item, that's the first key we use to generate out next one.\n */\n __temp_key__: generateNKeysBetween(lastItemInList?.__temp_key__ ?? null, null, 1)[0],\n // Fallback to `id` if there is no `mainField` value, which will overwrite the above `id` property with the exact same data.\n [props.mainField?.name ?? 'documentId']: relation[props.mainField?.name ?? 'documentId'],\n label: getRelationLabel(relation, props.mainField),\n // @ts-expect-error – targetModel does exist on the attribute, but it's not typed.\n href: `../${COLLECTION_TYPES}/${props.attribute.targetModel}/${relation.documentId}?${relation.locale ? `plugins[i18n][locale]=${relation.locale}` : ''}`,\n };\n\n if (ONE_WAY_RELATIONS.includes(props.attribute.relation)) {\n // Remove any existing relation so they can be replaced with the new one\n field.value?.connect?.forEach(handleDisconnect);\n relations.forEach(handleDisconnect);\n\n field.onChange(`${props.name}.connect`, [item]);\n } else {\n field.onChange(`${props.name}.connect`, [...(field.value?.connect ?? []), item]);\n }\n };\n\n return (\n <Flex\n ref={ref}\n direction=\"column\"\n gap={3}\n justifyContent=\"space-between\"\n alignItems=\"stretch\"\n wrap=\"wrap\"\n >\n <StyledFlex direction=\"column\" alignItems=\"start\" gap={2} width=\"100%\">\n <RelationsInput\n disabled={isDisabled}\n // NOTE: we should not default to using the documentId if the component is being created (componentUID is undefined)\n id={componentUID && component ? (componentId ? `${componentId}` : '') : documentId}\n label={`${label} ${relationsCount > 0 ? `(${relationsCount})` : ''}`}\n model={model}\n onChange={handleConnect}\n isRelatedToCurrentDocument={isRelatedToCurrentDocument}\n {...props}\n />\n {'pagination' in data &&\n data.pagination &&\n data.pagination.pageCount > data.pagination.page ? (\n <TextButton\n disabled={isFetchingMoreRelations}\n onClick={handleLoadMore}\n loading={isFetchingMoreRelations}\n startIcon={<ArrowClockwise />}\n // prevent the label from line-wrapping\n shrink={0}\n >\n {formatMessage({\n id: getTranslation('relation.loadMore'),\n defaultMessage: 'Load More',\n })}\n </TextButton>\n ) : null}\n </StyledFlex>\n <RelationsList\n data={relations}\n serverData={data.results}\n disabled={isDisabled}\n name={props.name}\n isLoading={isFetchingMoreRelations}\n relationType={props.attribute.relation}\n // @ts-expect-error – targetModel does exist on the attribute. But it's not typed.\n targetModel={props.attribute.targetModel}\n />\n </Flex>\n );\n }\n);\n\n/**\n * TODO: this can be removed once we stop shipping Inputs with\n * labels wrapped round in DS@2.\n */\nconst StyledFlex = styled<FlexComponent>(Flex)`\n & > div {\n width: 100%;\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * Relation Transformations\n * -----------------------------------------------------------------------------------------------*/\n\ninterface TransformationContext extends Pick<RelationsFieldProps, 'mainField'> {\n field?: RelationsFormValue;\n href: string;\n}\n\n/**\n * If it's in the connected array, it can get out of our data array,\n * we'll be putting it back in later and sorting it anyway.\n */\nconst removeConnected =\n ({ field }: TransformationContext) =>\n (relations: RelationResult[]) => {\n return relations.filter((relation) => {\n const connectedRelations = field?.connect ?? [];\n\n return connectedRelations.findIndex((rel) => rel.id === relation.id) === -1;\n });\n };\n\n/**\n * @description Removes relations that are in the `disconnect` array of the field\n */\nconst removeDisconnected =\n ({ field }: TransformationContext) =>\n (relations: RelationResult[]): RelationResult[] =>\n relations.filter((relation) => {\n const disconnectedRelations = field?.disconnect ?? [];\n\n return disconnectedRelations.findIndex((rel) => rel.id === relation.id) === -1;\n });\n\n/**\n * @description Adds a label and href to the relation object we use this to render\n * a better UI where we can link to the relation and display a human-readable label.\n */\nconst addLabelAndHref =\n ({ mainField, href }: TransformationContext) =>\n (relations: RelationResult[]): Relation[] =>\n relations.map((relation) => {\n return {\n ...relation,\n // Fallback to `id` if there is no `mainField` value, which will overwrite the above `documentId` property with the exact same data.\n [mainField?.name ?? 'documentId']: relation[mainField?.name ?? 'documentId'],\n label: getRelationLabel(relation, mainField),\n href: `${href}/${relation.documentId}?${relation.locale ? `plugins[i18n][locale]=${relation.locale}` : ''}`,\n };\n });\n\n/* -------------------------------------------------------------------------------------------------\n * RelationsInput\n * -----------------------------------------------------------------------------------------------*/\n\ninterface RelationsInputProps extends Omit<RelationsFieldProps, 'type'> {\n id?: string;\n model: string;\n isRelatedToCurrentDocument: boolean;\n onChange: (\n relation: Pick<RelationResult, 'documentId' | 'id' | 'locale' | 'status'> & {\n [key: string]: any;\n }\n ) => void;\n}\n\n/**\n * @description Contains all the logic for the combobox that can search\n * for relations and then add them to the field's connect array.\n */\nconst RelationsInput = ({\n hint,\n id,\n model,\n label,\n labelAction,\n name,\n mainField,\n placeholder,\n required,\n unique: _unique,\n 'aria-label': _ariaLabel,\n onChange,\n isRelatedToCurrentDocument,\n ...props\n}: RelationsInputProps) => {\n const [textValue, setTextValue] = React.useState<string | undefined>('');\n const [searchParams, setSearchParams] = React.useState({\n _q: '',\n page: 1,\n });\n const { toggleNotification } = useNotification();\n const [{ query }] = useQueryParams();\n const currentDocumentMeta = useDocumentContext('RelationsInput', (state) => state.meta);\n const rootDocumentMeta = useDocumentContext('RelationsInput', (state) => state.rootDocumentMeta);\n const isRootDocument = rootDocumentMeta.documentId === currentDocumentMeta.documentId;\n const documentMeta = isRootDocument ? rootDocumentMeta : currentDocumentMeta;\n\n const { formatMessage } = useIntl();\n const fieldRef = useFocusInputField<HTMLInputElement>(name);\n const field = useField<RelationsFormValue>(name);\n\n const searchParamsDebounced = useDebounce(searchParams, 300);\n const [searchForTrigger, { data, isLoading }] = useLazySearchRelationsQuery();\n\n /**\n * Because we're using a lazy query, we need to trigger the search\n * when the component mounts and when the search params change.\n * We also need to trigger the search when the field value changes\n * so that we can filter out the relations that are already connected.\n */\n React.useEffect(() => {\n /**\n * The `name` prop is a complete path to the field, e.g. `field1.field2.field3`.\n * Where the above example would a nested field within two components, however\n * we only require the field on the component not the complete path since we query\n * individual components. Therefore we split the string and take the last item.\n */\n const [targetField] = name.split('.').slice(-1);\n\n // Return early if there is no relation to the document\n if (!isRelatedToCurrentDocument) return;\n\n const params = documentMeta.params ?? buildValidParams(query);\n\n searchForTrigger({\n model,\n targetField,\n params: {\n ...params,\n id: id ?? '',\n pageSize: 10,\n idsToInclude: field.value?.disconnect?.map((rel) => rel.id.toString()) ?? [],\n idsToOmit: field.value?.connect?.map((rel) => rel.id.toString()) ?? [],\n ...searchParamsDebounced,\n },\n });\n }, [\n field.value?.connect,\n field.value?.disconnect,\n id,\n model,\n name,\n query,\n searchForTrigger,\n searchParamsDebounced,\n isRelatedToCurrentDocument,\n documentMeta,\n ]);\n\n const handleSearch = async (search: string) => {\n setSearchParams((s) => ({ ...s, _q: search, page: 1 }));\n };\n\n const hasNextPage = data?.pagination ? data.pagination.page < data.pagination.pageCount : false;\n\n const options = data?.results ?? [];\n\n const handleChange = (relationId?: string) => {\n if (!relationId) {\n return;\n }\n\n const relation = options.find((opt) => opt.id.toString() === relationId);\n\n if (!relation) {\n // This is very unlikely to happen, but it ensures we don't have any data for.\n console.error(\n \"You've tried to add a relation with an id that does not exist in the options you can see, this is likely a bug with Strapi. Please open an issue.\"\n );\n\n toggleNotification({\n message: formatMessage({\n id: getTranslation('relation.error-adding-relation'),\n defaultMessage: 'An error occurred while trying to add the relation.',\n }),\n type: 'danger',\n });\n\n return;\n }\n\n /**\n * You need to give this relation a correct _temp_key_ but\n * this component doesn't know about those ones, you can't rely\n * on the connect array because that doesn't hold items that haven't\n * moved. So use a callback to fill in the gaps when connecting.\n *\n */\n onChange(relation);\n };\n\n const handleLoadMore = () => {\n if (!data || !data.pagination) {\n return;\n } else if (data.pagination.page < data.pagination.pageCount) {\n setSearchParams((s) => ({ ...s, page: s.page + 1 }));\n }\n };\n\n React.useLayoutEffect(() => {\n setTextValue('');\n }, [field.value]);\n\n return (\n <Field.Root error={field.error} hint={hint} name={name} required={required}>\n <Field.Label action={labelAction}>{label}</Field.Label>\n <Combobox\n ref={fieldRef}\n name={name}\n autocomplete=\"list\"\n placeholder={\n placeholder ||\n formatMessage({\n id: getTranslation('relation.add'),\n defaultMessage: 'Add relation',\n })\n }\n hasMoreItems={hasNextPage}\n loading={isLoading}\n onOpenChange={() => {\n handleSearch(textValue ?? '');\n }}\n noOptionsMessage={() =>\n formatMessage({\n id: getTranslation('relation.notAvailable'),\n defaultMessage: 'No relations available',\n })\n }\n loadingMessage={formatMessage({\n id: getTranslation('relation.isLoading'),\n defaultMessage: 'Relations are loading',\n })}\n onLoadMore={handleLoadMore}\n textValue={textValue}\n onChange={handleChange}\n onTextValueChange={(text) => {\n setTextValue(text);\n }}\n onInputChange={(event) => {\n handleSearch(event.currentTarget.value);\n }}\n {...props}\n >\n {options.map((opt) => {\n const textValue = getRelationLabel(opt, mainField);\n\n return (\n <ComboboxOption key={opt.id} value={opt.id.toString()} textValue={textValue}>\n <Flex gap={2} justifyContent=\"space-between\">\n <Typography ellipsis>{textValue}</Typography>\n {opt.status ? <DocumentStatus status={opt.status} /> : null}\n </Flex>\n </ComboboxOption>\n );\n })}\n </Combobox>\n <Field.Error />\n <Field.Hint />\n </Field.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * RelationsList\n * -----------------------------------------------------------------------------------------------*/\nconst RELATION_ITEM_HEIGHT = 50;\nconst RELATION_GUTTER = 4;\n\ninterface RelationsListProps extends Pick<RelationsFieldProps, 'disabled' | 'name'> {\n data: Relation[];\n isLoading?: boolean;\n relationType: Schema.Attribute.RelationKind.Any;\n /**\n * The existing relations connected on the server. We need these to diff against.\n */\n serverData: RelationResult[];\n targetModel: string;\n}\n\nconst RelationsList = ({\n data,\n serverData,\n disabled,\n name,\n isLoading,\n relationType,\n targetModel,\n}: RelationsListProps) => {\n const ariaDescriptionId = React.useId();\n const { formatMessage } = useIntl();\n const listRef = React.useRef<FixedSizeList>(null);\n const outerListRef = React.useRef<HTMLUListElement>(null);\n const [overflow, setOverflow] = React.useState<'top' | 'bottom' | 'top-bottom'>();\n const [liveText, setLiveText] = React.useState('');\n const field = useField(name);\n\n React.useEffect(() => {\n if (data.length <= RELATIONS_TO_DISPLAY) {\n return setOverflow(undefined);\n }\n\n const handleNativeScroll = (e: Event) => {\n const el = e.target as HTMLUListElement;\n const parentScrollContainerHeight = (el.parentNode as HTMLDivElement).scrollHeight;\n const maxScrollBottom = el.scrollHeight - el.scrollTop;\n\n if (el.scrollTop === 0) {\n return setOverflow('bottom');\n }\n\n if (maxScrollBottom === parentScrollContainerHeight) {\n return setOverflow('top');\n }\n\n return setOverflow('top-bottom');\n };\n\n const outerListRefCurrent = outerListRef?.current;\n\n if (!isLoading && data.length > 0 && outerListRefCurrent) {\n outerListRef.current.addEventListener('scroll', handleNativeScroll);\n }\n\n return () => {\n if (outerListRefCurrent) {\n outerListRefCurrent.removeEventListener('scroll', handleNativeScroll);\n }\n };\n }, [isLoading, data.length]);\n\n const getItemPos = (index: number) => `${index + 1} of ${data.length}`;\n\n const handleMoveItem: UseDragAndDropOptions['onMoveItem'] = (newIndex, oldIndex) => {\n const item = data[oldIndex];\n\n setLiveText(\n formatMessage(\n {\n id: getTranslation('dnd.reorder'),\n defaultMessage: '{item}, moved. New position in list: {position}.',\n },\n {\n item: item.label ?? item.documentId,\n position: getItemPos(newIndex),\n }\n )\n );\n\n /**\n * Splicing mutates the array, so we need to create a new array\n */\n const newData = [...data];\n const currentRow = data[oldIndex];\n\n const startKey =\n oldIndex > newIndex ? newData[newIndex - 1]?.__temp_key__ : newData[newIndex]?.__temp_key__;\n const endKey =\n oldIndex > newIndex ? newData[newIndex]?.__temp_key__ : newData[newIndex + 1]?.__temp_key__;\n\n /**\n * We're moving the relation between two other relations, so\n * we need to generate a new key that keeps the order\n */\n const [newKey] = generateNKeysBetween(startKey, endKey, 1);\n\n newData.splice(oldIndex, 1);\n newData.splice(newIndex, 0, { ...currentRow, __temp_key__: newKey });\n\n /**\n * Now we diff against the server to understand what's different so we\n * can keep the connect array nice and tidy. It also needs reversing because\n * we reverse the relations from the server in the first place.\n */\n const connectedRelations = newData\n .reduce<Relation[]>((acc, relation, currentIndex, array) => {\n const relationOnServer = serverData.find((oldRelation) => oldRelation.id === relation.id);\n\n const relationInFront = array[currentIndex + 1];\n\n if (!relationOnServer || relationOnServer.__temp_key__ !== relation.__temp_key__) {\n const position = relationInFront\n ? {\n before: relationInFront.documentId,\n locale: relationInFront.locale,\n status:\n 'publishedAt' in relationInFront && relationInFront.publishedAt\n ? ('published' as Relation['status'])\n : ('draft' as Relation['status']),\n }\n : { end: true };\n\n const relationWithPosition: Relation = {\n ...relation,\n ...{\n apiData: {\n id: relation.id,\n documentId: relation.documentId ?? relation.apiData?.documentId ?? '',\n locale: relation.locale || relation.apiData?.locale,\n position,\n },\n },\n };\n\n return [...acc, relationWithPosition];\n }\n\n return acc;\n }, [])\n .toReversed();\n\n field.onChange(`${name}.connect`, connectedRelations);\n };\n\n const handleGrabItem: UseDragAndDropOptions['onGrabItem'] = (index) => {\n const item = data[index];\n\n setLiveText(\n formatMessage(\n {\n id: getTranslation('dnd.grab-item'),\n defaultMessage: `{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel.`,\n },\n {\n item: item.label ?? item.documentId,\n position: getItemPos(index),\n }\n )\n );\n };\n\n const handleDropItem: UseDragAndDropOptions['onDropItem'] = (index) => {\n const { href: _href, label, ...item } = data[index];\n\n setLiveText(\n formatMessage(\n {\n id: getTranslation('dnd.drop-item'),\n defaultMessage: `{item}, dropped. Final position in list: {position}.`,\n },\n {\n item: label ?? item.documentId,\n position: getItemPos(index),\n }\n )\n );\n };\n\n const handleCancel: UseDragAndDropOptions['onCancel'] = (index) => {\n const item = data[index];\n\n setLiveText(\n formatMessage(\n {\n id: getTranslation('dnd.cancel-item'),\n defaultMessage: '{item}, dropped. Re-order cancelled.',\n },\n {\n item: item.label ?? item.documentId,\n }\n )\n );\n };\n\n const handleDisconnect = useHandleDisconnect(name, 'RelationsList');\n\n /**\n * These relation types will only ever have one item\n * in their list, so you can't reorder a single item!\n */\n const canReorder = !ONE_WAY_RELATIONS.includes(relationType);\n\n const dynamicListHeight =\n data.length > RELATIONS_TO_DISPLAY\n ? Math.min(data.length, RELATIONS_TO_DISPLAY) * (RELATION_ITEM_HEIGHT + RELATION_GUTTER) +\n RELATION_ITEM_HEIGHT / 2\n : Math.min(data.length, RELATIONS_TO_DISPLAY) * (RELATION_ITEM_HEIGHT + RELATION_GUTTER);\n\n return (\n <ShadowBox $overflowDirection={overflow}>\n <VisuallyHidden id={ariaDescriptionId}>\n {formatMessage({\n id: getTranslation('dnd.instructions'),\n defaultMessage: `Press spacebar to grab and re-order`,\n })}\n </VisuallyHidden>\n <VisuallyHidden aria-live=\"assertive\">{liveText}</VisuallyHidden>\n {/* @ts-expect-error – width is expected, but we've not needed to pass it before. */}\n <FixedSizeList\n height={dynamicListHeight}\n ref={listRef}\n outerRef={outerListRef}\n itemCount={data.length}\n itemSize={RELATION_ITEM_HEIGHT + RELATION_GUTTER}\n itemData={{\n ariaDescribedBy: ariaDescriptionId,\n canDrag: canReorder,\n disabled,\n handleCancel,\n handleDropItem,\n handleGrabItem,\n handleMoveItem,\n name,\n handleDisconnect,\n relations: data,\n targetModel,\n }}\n itemKey={(index) => data[index].id}\n innerElementType=\"ol\"\n >\n {ListItem}\n </FixedSizeList>\n </ShadowBox>\n );\n};\n\nconst ShadowBox = styled<BoxComponent>(Box)<{\n $overflowDirection?: 'top-bottom' | 'top' | 'bottom';\n}>`\n position: relative;\n overflow: hidden;\n flex: 1;\n\n &:before,\n &:after {\n position: absolute;\n width: 100%;\n height: 4px;\n z-index: 1;\n }\n\n &:before {\n /* TODO: as for DS Table component we would need this to be handled by the DS theme */\n content: '';\n background: linear-gradient(rgba(3, 3, 5, 0.2) 0%, rgba(0, 0, 0, 0) 100%);\n top: 0;\n opacity: ${({ $overflowDirection }) =>\n $overflowDirection === 'top-bottom' || $overflowDirection === 'top' ? 1 : 0};\n transition: opacity 0.2s ease-in-out;\n }\n\n &:after {\n /* TODO: as for DS Table component we would need this to be handled by the DS theme */\n content: '';\n background: linear-gradient(0deg, rgba(3, 3, 5, 0.2) 0%, rgba(0, 0, 0, 0) 100%);\n bottom: 0;\n opacity: ${({ $overflowDirection }) =>\n $overflowDirection === 'top-bottom' || $overflowDirection === 'bottom' ? 1 : 0};\n transition: opacity 0.2s ease-in-out;\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * ListItem\n * -----------------------------------------------------------------------------------------------*/\n\ninterface ListItemProps extends Pick<ListChildComponentProps, 'style' | 'index'> {\n data: {\n ariaDescribedBy: string;\n canDrag?: boolean;\n disabled?: boolean;\n handleCancel: UseDragAndDropOptions['onCancel'];\n handleDropItem: UseDragAndDropOptions['onDropItem'];\n handleGrabItem: UseDragAndDropOptions['onGrabItem'];\n handleMoveItem: UseDragAndDropOptions['onMoveItem'];\n handleDisconnect: (relation: Relation) => void;\n name: string;\n relations: Relation[];\n targetModel: string;\n };\n}\n\nconst ListItem = ({ data, index, style }: ListItemProps) => {\n const {\n ariaDescribedBy,\n canDrag = false,\n disabled = false,\n handleCancel,\n handleDisconnect,\n handleDropItem,\n handleGrabItem,\n handleMoveItem,\n name,\n relations,\n targetModel,\n } = data;\n\n const { formatMessage } = useIntl();\n\n const { href, id, label, status, documentId, apiData, locale } = relations[index];\n\n const [{ handlerId, isDragging, handleKeyDown }, relationRef, dropRef, dragRef, dragPreviewRef] =\n useDragAndDrop<number, Omit<RelationDragPreviewProps, 'width'>, HTMLDivElement>(\n canDrag && !disabled,\n {\n type: `${ItemTypes.RELATION}_${name}`,\n index,\n item: {\n displayedValue: label,\n status,\n id: id,\n index,\n },\n onMoveItem: handleMoveItem,\n onDropItem: handleDropItem,\n onGrabItem: handleGrabItem,\n onCancel: handleCancel,\n dropSensitivity: DROP_SENSITIVITY.REGULAR,\n }\n );\n\n const composedRefs = useComposedRefs<HTMLDivElement>(relationRef, dragRef);\n\n React.useEffect(() => {\n dragPreviewRef(getEmptyImage());\n }, [dragPreviewRef]);\n\n return (\n <Box\n style={style}\n tag=\"li\"\n ref={dropRef}\n aria-describedby={ariaDescribedBy}\n cursor={canDrag ? 'all-scroll' : 'default'}\n >\n {isDragging ? (\n <RelationItemPlaceholder />\n ) : (\n <Flex\n paddingTop={2}\n paddingBottom={2}\n paddingLeft={canDrag ? 2 : 4}\n paddingRight={4}\n hasRadius\n borderColor=\"neutral200\"\n background={disabled ? 'neutral150' : 'neutral0'}\n justifyContent=\"space-between\"\n ref={composedRefs}\n data-handler-id={handlerId}\n >\n <FlexWrapper gap={1}>\n {canDrag ? (\n <IconButton\n tag=\"div\"\n role=\"button\"\n tabIndex={0}\n withTooltip={false}\n label={formatMessage({\n id: getTranslation('components.RelationInput.icon-button-aria-label'),\n defaultMessage: 'Drag',\n })}\n variant=\"ghost\"\n onKeyDown={handleKeyDown}\n disabled={disabled}\n >\n <Drag />\n </IconButton>\n ) : null}\n <Flex width=\"100%\" minWidth={0} justifyContent=\"space-between\">\n <Box minWidth={0} paddingTop={1} paddingBottom={1} paddingRight={4}>\n <RelationModalForm\n triggerButtonLabel={label}\n relation={{\n documentId: documentId ?? apiData?.documentId,\n model: targetModel,\n collectionType: getCollectionType(href)!,\n params: {\n locale: locale || apiData?.locale || null,\n },\n }}\n />\n </Box>\n {status ? <DocumentStatus status={status} /> : null}\n </Flex>\n </FlexWrapper>\n <Box paddingLeft={4}>\n <IconButton\n onClick={() => handleDisconnect(relations[index])}\n disabled={disabled}\n label={formatMessage({\n id: getTranslation('relation.disconnect'),\n defaultMessage: 'Remove',\n })}\n variant=\"ghost\"\n size=\"S\"\n >\n <Cross />\n </IconButton>\n </Box>\n </Flex>\n )}\n </Box>\n );\n};\n\nconst FlexWrapper = styled<FlexComponent>(Flex)`\n width: 100%;\n /* Used to prevent endAction to be pushed out of container */\n min-width: 0;\n\n & > div[role='button'] {\n cursor: all-scroll;\n }\n`;\n\nconst DisconnectButton = styled.button`\n svg path {\n fill: ${({ theme, disabled }) =>\n disabled ? theme.colors.neutral600 : theme.colors.neutral500};\n }\n\n &:hover svg path,\n &:focus svg path {\n fill: ${({ theme, disabled }) => !disabled && theme.colors.neutral600};\n }\n`;\n\nconst LinkEllipsis = styled(Link)`\n display: block;\n\n & > span {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: block;\n }\n`;\n\nconst RelationItemPlaceholder = () => (\n <Box\n paddingTop={2}\n paddingBottom={2}\n paddingLeft={4}\n paddingRight={4}\n hasRadius\n borderStyle=\"dashed\"\n borderColor=\"primary600\"\n borderWidth=\"1px\"\n background=\"primary100\"\n height={`calc(100% - ${RELATION_GUTTER}px)`}\n />\n);\n\nconst MemoizedRelationsField = React.memo(RelationsField);\n\nexport { MemoizedRelationsField as RelationsInput, FlexWrapper, DisconnectButton, LinkEllipsis };\nexport type { RelationsFieldProps };\n"],"names":["useHandleDisconnect","fieldName","consumerName","field","useField","removeFieldRow","useForm","state","addFieldRow","handleDisconnect","relation","value","connect","indexOfRelationInConnectArray","findIndex","rel","id","apiData","documentId","locale","RELATIONS_TO_DISPLAY","ONE_WAY_RELATIONS","RelationsField","React","forwardRef","disabled","label","props","ref","currentDocumentMeta","useDocumentContext","meta","currentDocument","document","rootDocumentMeta","currentPage","setCurrentPage","useState","isRootDocument","documentMeta","formatMessage","useIntl","query","useQueryParams","params","buildValidParams","isMorph","attribute","toLowerCase","includes","isDisabled","componentId","componentUID","useComponent","uid","isSubmitting","useEffect","component","components","model","toString","targetField","name","split","slice","schemaAttributes","attributes","schema","isRelatedToCurrentDocument","Object","values","filter","type","target","length","data","isLoading","isFetching","useGetRelationsQuery","pageSize","page","refetchOnMountOrArgChange","skip","selectFromResult","result","results","handleLoadMore","prev","isFetchingMoreRelations","realServerRelationsCount","pagination","total","relationsConnected","relationsDisconnected","disconnect","relationsCount","relations","useMemo","ctx","href","COLLECTION_TYPES","targetModel","mainField","transformations","pipe","removeConnected","removeDisconnected","addLabelAndHref","transformedRels","sort","a","b","__temp_key__","handleConnect","lastItemInList","item","status","generateNKeysBetween","getRelationLabel","forEach","onChange","_jsxs","Flex","direction","gap","justifyContent","alignItems","wrap","StyledFlex","width","_jsx","RelationsInput","pageCount","TextButton","onClick","loading","startIcon","ArrowClockwise","shrink","getTranslation","defaultMessage","RelationsList","serverData","relationType","styled","connectedRelations","disconnectedRelations","map","hint","labelAction","placeholder","required","unique","_unique","_ariaLabel","textValue","setTextValue","searchParams","setSearchParams","_q","toggleNotification","useNotification","fieldRef","useFocusInputField","searchParamsDebounced","useDebounce","searchForTrigger","useLazySearchRelationsQuery","idsToInclude","idsToOmit","handleSearch","search","s","hasNextPage","options","handleChange","relationId","find","opt","console","error","message","useLayoutEffect","Field","Root","Label","action","Combobox","autocomplete","hasMoreItems","onOpenChange","noOptionsMessage","loadingMessage","onLoadMore","onTextValueChange","text","onInputChange","event","currentTarget","ComboboxOption","Typography","ellipsis","DocumentStatus","Error","Hint","RELATION_ITEM_HEIGHT","RELATION_GUTTER","ariaDescriptionId","useId","listRef","useRef","outerListRef","overflow","setOverflow","liveText","setLiveText","undefined","handleNativeScroll","e","el","parentScrollContainerHeight","parentNode","scrollHeight","maxScrollBottom","scrollTop","outerListRefCurrent","current","addEventListener","removeEventListener","getItemPos","index","handleMoveItem","newIndex","oldIndex","position","newData","currentRow","startKey","endKey","newKey","splice","reduce","acc","currentIndex","array","relationOnServer","oldRelation","relationInFront","before","publishedAt","end","relationWithPosition","toReversed","handleGrabItem","handleDropItem","_href","handleCancel","canReorder","dynamicListHeight","Math","min","ShadowBox","$overflowDirection","VisuallyHidden","aria-live","FixedSizeList","height","outerRef","itemCount","itemSize","itemData","ariaDescribedBy","canDrag","itemKey","innerElementType","ListItem","Box","style","handlerId","isDragging","handleKeyDown","relationRef","dropRef","dragRef","dragPreviewRef","useDragAndDrop","ItemTypes","RELATION","displayedValue","onMoveItem","onDropItem","onGrabItem","onCancel","dropSensitivity","DROP_SENSITIVITY","REGULAR","composedRefs","useComposedRefs","getEmptyImage","tag","aria-describedby","cursor","RelationItemPlaceholder","paddingTop","paddingBottom","paddingLeft","paddingRight","hasRadius","borderColor","background","data-handler-id","FlexWrapper","IconButton","role","tabIndex","withTooltip","variant","onKeyDown","Drag","minWidth","RelationModalForm","triggerButtonLabel","collectionType","getCollectionType","size","Cross","DisconnectButton","button","theme","colors","neutral600","neutral500","LinkEllipsis","Link","borderStyle","borderWidth","MemoizedRelationsField","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA;;;;AAIC,IACD,SAASA,mBAAAA,CAAoBC,SAAiB,EAAEC,YAAoB,EAAA;AAClE,IAAA,MAAMC,QAAQC,oBAASH,CAAAA,SAAAA,CAAAA;AACvB,IAAA,MAAMI,iBAAiBC,mBAAQJ,CAAAA,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|
1
|
+
{"version":3,"file":"Relations.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Relations/Relations.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n type InputProps,\n useField,\n useForm,\n useNotification,\n useFocusInputField,\n} from '@strapi/admin/strapi-admin';\nimport {\n Box,\n Combobox,\n ComboboxOption,\n Flex,\n IconButton,\n TextButton,\n Typography,\n VisuallyHidden,\n useComposedRefs,\n Link,\n Field,\n FlexComponent,\n BoxComponent,\n} from '@strapi/design-system';\nimport { Cross, Drag, ArrowClockwise } from '@strapi/icons';\nimport { generateNKeysBetween } from 'fractional-indexing';\nimport pipe from 'lodash/fp/pipe';\nimport { getEmptyImage } from 'react-dnd-html5-backend';\nimport { useIntl } from 'react-intl';\nimport { FixedSizeList, ListChildComponentProps } from 'react-window';\nimport { styled } from 'styled-components';\n\nimport { RelationDragPreviewProps } from '../../../../../components/DragPreviews/RelationDragPreview';\nimport { COLLECTION_TYPES } from '../../../../../constants/collections';\nimport { ItemTypes } from '../../../../../constants/dragAndDrop';\nimport { useDebounce } from '../../../../../hooks/useDebounce';\nimport { useDocument } from '../../../../../hooks/useDocument';\nimport { type DocumentMeta, useDocumentContext } from '../../../../../hooks/useDocumentContext';\nimport { type EditFieldLayout } from '../../../../../hooks/useDocumentLayout';\nimport {\n DROP_SENSITIVITY,\n UseDragAndDropOptions,\n useDragAndDrop,\n} from '../../../../../hooks/useDragAndDrop';\nimport {\n useGetRelationsQuery,\n useLazySearchRelationsQuery,\n RelationResult,\n} from '../../../../../services/relations';\nimport { type MainField } from '../../../../../utils/attributes';\nimport { getRelationLabel } from '../../../../../utils/relations';\nimport { getTranslation } from '../../../../../utils/translations';\nimport { DocumentStatus } from '../../DocumentStatus';\nimport { useComponent } from '../ComponentContext';\nimport { RelationModal, getCollectionType } from '../Relations/RelationModal';\n\nimport type { Schema } from '@strapi/types';\n\n/**\n * Remove a relation, whether it's been already saved or not.\n * It's used both in RelationsList, where the \"remove relation\" button is, and in the input,\n * because we sometimes need to remove a previous relation when selecting a new one.\n */\nfunction useHandleDisconnect(fieldName: string, consumerName: string) {\n const field = useField(fieldName);\n const removeFieldRow = useForm(consumerName, (state) => state.removeFieldRow);\n const addFieldRow = useForm(consumerName, (state) => state.addFieldRow);\n\n const handleDisconnect: ListItemProps['data']['handleDisconnect'] = (relation) => {\n if (field.value && field.value.connect) {\n /**\n * A relation will exist in the `connect` array _if_ it has\n * been added without saving. In this case, we just remove it\n * from the connect array\n */\n const indexOfRelationInConnectArray = field.value.connect.findIndex(\n (rel: NonNullable<RelationsFormValue['connect']>[number]) => rel.id === relation.id\n );\n\n if (indexOfRelationInConnectArray >= 0) {\n removeFieldRow(`${fieldName}.connect`, indexOfRelationInConnectArray);\n return;\n }\n }\n\n addFieldRow(`${fieldName}.disconnect`, {\n id: relation.id,\n apiData: {\n id: relation.id,\n documentId: relation.documentId,\n locale: relation.locale,\n },\n });\n };\n\n return handleDisconnect;\n}\n\n/* -------------------------------------------------------------------------------------------------\n * RelationsField\n * -----------------------------------------------------------------------------------------------*/\n\nconst RELATIONS_TO_DISPLAY = 5;\nconst ONE_WAY_RELATIONS = ['oneWay', 'oneToOne', 'manyToOne', 'oneToManyMorph', 'oneToOneMorph'];\n\ntype RelationPosition =\n | (Pick<RelationResult, 'status' | 'locale'> & {\n before: string;\n end?: never;\n })\n | { end: boolean; before?: never; status?: never; locale?: never };\n\ninterface Relation extends Pick<RelationResult, 'documentId' | 'id' | 'locale' | 'status'> {\n href: string;\n label: string;\n position?: RelationPosition;\n __temp_key__: string;\n apiData?: {\n documentId: RelationResult['documentId'];\n id: RelationResult['id'];\n locale?: RelationResult['locale'];\n position: RelationPosition;\n // Added this property to prevent call useDocument with a not temporary relation (one already saved in the database)\n isTemporary?: boolean;\n };\n}\n\ninterface RelationsFieldProps\n extends Omit<Extract<EditFieldLayout, { type: 'relation' }>, 'size' | 'hint'>,\n Pick<InputProps, 'hint'> {}\n\nexport interface RelationsFormValue {\n connect?: Relation[];\n disconnect?: Pick<Relation, 'id'>[];\n}\n\n/**\n * TODO: we get a rather ugly flash when we remove a single relation from the list leaving\n * no other relations when we press save. The initial relation re-renders, probably because\n * of the lag in the Form cleaning it's \"disconnect\" array, whilst our data has not been invalidated.\n *\n * Could we invalidate relation data on the document actions? Should we?\n */\n\n/**\n * @internal\n * @description The relations field holds a lot of domain logic for handling relations which is rather complicated\n * At present we do not expose this to plugin developers, however, they are able to overwrite it themselves should\n * they wish to do so.\n */\nconst RelationsField = React.forwardRef<HTMLDivElement, RelationsFieldProps>(\n ({ disabled, label, ...props }, ref) => {\n const { currentDocument, currentDocumentMeta } = useDocumentContext('RelationsField');\n\n const [currentPage, setCurrentPage] = React.useState(1);\n\n // Use the documentId from the actual document, not the params (meta)\n const documentId = currentDocument.document?.documentId;\n\n const { formatMessage } = useIntl();\n\n const isMorph = props.attribute.relation.toLowerCase().includes('morph');\n const isDisabled = isMorph || disabled;\n\n const { componentId, componentUID } = useComponent('RelationsField', ({ uid, id }) => ({\n componentId: id,\n componentUID: uid,\n }));\n\n const isSubmitting = useForm('RelationsList', (state) => state.isSubmitting);\n\n React.useEffect(() => {\n setCurrentPage(1);\n }, [isSubmitting]);\n\n const component = componentUID && currentDocument.components[componentUID];\n /**\n * We'll always have a documentId in a created entry, so we look for a componentId first.\n * Same with `uid` and `documentModel`.\n */\n const model = component ? component.uid : currentDocumentMeta.model;\n const id = component && componentId ? componentId.toString() : documentId;\n\n /**\n * The `name` prop is a complete path to the field, e.g. `field1.field2.field3`.\n * Where the above example would a nested field within two components, however\n * we only require the field on the component not the complete path since we query\n * individual components. Therefore we split the string and take the last item.\n */\n const [targetField] = props.name.split('.').slice(-1);\n\n const schemaAttributes = component\n ? (component.attributes ?? {})\n : (currentDocument.schema?.attributes ?? {});\n\n /**\n * Confirm the target field is related to the current document.\n * Since relations can exist in a modal on top of the root document,\n * we need to ensure we are fetching relations for the correct document (root document vs related document),\n */\n const isRelatedToCurrentDocument =\n Object.values(schemaAttributes).filter(\n (attribute) =>\n attribute.type === 'relation' &&\n 'target' in attribute &&\n 'target' in props.attribute &&\n attribute.target === props.attribute.target\n ).length > 0;\n\n const { data, isLoading, isFetching } = useGetRelationsQuery(\n {\n model,\n targetField,\n // below we don't run the query if there is no id.\n id,\n params: {\n ...currentDocumentMeta.params,\n pageSize: RELATIONS_TO_DISPLAY,\n page: currentPage,\n },\n },\n {\n refetchOnMountOrArgChange: true,\n skip: !id || !isRelatedToCurrentDocument,\n selectFromResult: (result) => {\n return {\n ...result,\n data: {\n ...result.data,\n results: result.data?.results ? result.data.results : [],\n },\n };\n },\n }\n );\n\n const handleLoadMore = () => {\n setCurrentPage((prev) => prev + 1);\n };\n\n const field = useField(props.name);\n\n const isFetchingMoreRelations = isLoading || isFetching;\n\n const realServerRelationsCount =\n 'pagination' in data && data.pagination ? data.pagination.total : 0;\n\n /**\n * Items that are already connected, but reordered would be in\n * this list, so to get an accurate figure, we remove them.\n */\n const relationsConnected =\n (field.value?.connect ?? []).filter(\n (rel: Relation) => data.results.findIndex((relation) => relation.id === rel.id) === -1\n ).length ?? 0;\n const relationsDisconnected = field.value?.disconnect?.length ?? 0;\n\n const relationsCount = realServerRelationsCount + relationsConnected - relationsDisconnected;\n\n /**\n * This is it, the source of truth for reordering in conjunction with partial loading & updating\n * of relations. Relations on load are given __temp_key__ when fetched, because we don't want to\n * create brand new keys everytime the data updates, just keep adding them onto the newly loaded ones.\n */\n const relations = React.useMemo(() => {\n const ctx = {\n field: field.value,\n // @ts-expect-error – targetModel does exist on the attribute. But it's not typed.\n href: `../${COLLECTION_TYPES}/${props.attribute.targetModel}`,\n mainField: props.mainField,\n };\n\n /**\n * Tidy up our data.\n */\n const transformations = pipe(\n removeConnected(ctx),\n removeDisconnected(ctx),\n addLabelAndHref(ctx)\n );\n\n const transformedRels = transformations([...data.results]);\n\n /**\n * THIS IS CRUCIAL. If you don't sort by the __temp_key__ which comes from fractional indexing\n * then the list will be in the wrong order.\n */\n return [...transformedRels, ...(field.value?.connect ?? [])].sort((a, b) => {\n if (a.__temp_key__ < b.__temp_key__) return -1;\n if (a.__temp_key__ > b.__temp_key__) return 1;\n return 0;\n });\n }, [\n data.results,\n field.value,\n // @ts-expect-error – targetModel does exist on the attribute. But it's not typed.\n props.attribute.targetModel,\n props.mainField,\n ]);\n\n const handleDisconnect = useHandleDisconnect(props.name, 'RelationsField');\n\n const handleConnect: RelationsInputProps['onChange'] = (relation) => {\n const [lastItemInList] = relations.slice(-1);\n\n const item = {\n id: relation.id,\n apiData: {\n id: relation.id,\n documentId: relation.documentId,\n locale: relation.locale,\n isTemporary: true,\n },\n status: relation.status,\n /**\n * If there's a last item, that's the first key we use to generate out next one.\n */\n __temp_key__: generateNKeysBetween(lastItemInList?.__temp_key__ ?? null, null, 1)[0],\n // Fallback to `id` if there is no `mainField` value, which will overwrite the above `id` property with the exact same data.\n [props.mainField?.name ?? 'documentId']: relation[props.mainField?.name ?? 'documentId'],\n label: getRelationLabel(relation, props.mainField),\n // @ts-expect-error – targetModel does exist on the attribute, but it's not typed.\n href: `../${COLLECTION_TYPES}/${props.attribute.targetModel}/${relation.documentId}?${relation.locale ? `plugins[i18n][locale]=${relation.locale}` : ''}`,\n };\n\n if (ONE_WAY_RELATIONS.includes(props.attribute.relation)) {\n // Remove any existing relation so they can be replaced with the new one\n field.value?.connect?.forEach(handleDisconnect);\n relations.forEach(handleDisconnect);\n\n field.onChange(`${props.name}.connect`, [item]);\n } else {\n field.onChange(`${props.name}.connect`, [...(field.value?.connect ?? []), item]);\n }\n };\n\n return (\n <Flex\n ref={ref}\n direction=\"column\"\n gap={3}\n justifyContent=\"space-between\"\n alignItems=\"stretch\"\n wrap=\"wrap\"\n >\n <StyledFlex direction=\"column\" alignItems=\"start\" gap={2} width=\"100%\">\n <RelationsInput\n disabled={isDisabled}\n // NOTE: we should not default to using the documentId if the component is being created (componentUID is undefined)\n id={componentUID && component ? (componentId ? `${componentId}` : '') : documentId}\n label={`${label} ${relationsCount > 0 ? `(${relationsCount})` : ''}`}\n model={model}\n onChange={handleConnect}\n isRelatedToCurrentDocument={isRelatedToCurrentDocument}\n {...props}\n />\n {'pagination' in data &&\n data.pagination &&\n data.pagination.pageCount > data.pagination.page ? (\n <TextButton\n disabled={isFetchingMoreRelations}\n onClick={handleLoadMore}\n loading={isFetchingMoreRelations}\n startIcon={<ArrowClockwise />}\n // prevent the label from line-wrapping\n shrink={0}\n >\n {formatMessage({\n id: getTranslation('relation.loadMore'),\n defaultMessage: 'Load More',\n })}\n </TextButton>\n ) : null}\n </StyledFlex>\n <RelationsList\n data={relations}\n serverData={data.results}\n disabled={isDisabled}\n name={props.name}\n isLoading={isFetchingMoreRelations}\n relationType={props.attribute.relation}\n // @ts-expect-error – targetModel does exist on the attribute. But it's not typed.\n targetModel={props.attribute.targetModel}\n mainField={props.mainField}\n />\n </Flex>\n );\n }\n);\n\n/**\n * TODO: this can be removed once we stop shipping Inputs with\n * labels wrapped round in DS@2.\n */\nconst StyledFlex = styled<FlexComponent>(Flex)`\n & > div {\n width: 100%;\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * Relation Transformations\n * -----------------------------------------------------------------------------------------------*/\n\ninterface TransformationContext extends Pick<RelationsFieldProps, 'mainField'> {\n field?: RelationsFormValue;\n href: string;\n}\n\n/**\n * If it's in the connected array, it can get out of our data array,\n * we'll be putting it back in later and sorting it anyway.\n */\nconst removeConnected =\n ({ field }: TransformationContext) =>\n (relations: RelationResult[]) => {\n return relations.filter((relation) => {\n const connectedRelations = field?.connect ?? [];\n\n return connectedRelations.findIndex((rel) => rel.id === relation.id) === -1;\n });\n };\n\n/**\n * @description Removes relations that are in the `disconnect` array of the field\n */\nconst removeDisconnected =\n ({ field }: TransformationContext) =>\n (relations: RelationResult[]): RelationResult[] =>\n relations.filter((relation) => {\n const disconnectedRelations = field?.disconnect ?? [];\n\n return disconnectedRelations.findIndex((rel) => rel.id === relation.id) === -1;\n });\n\n/**\n * @description Adds a label and href to the relation object we use this to render\n * a better UI where we can link to the relation and display a human-readable label.\n */\nconst addLabelAndHref =\n ({ mainField, href }: TransformationContext) =>\n (relations: RelationResult[]): Relation[] =>\n relations.map((relation) => {\n return {\n ...relation,\n // Fallback to `id` if there is no `mainField` value, which will overwrite the above `documentId` property with the exact same data.\n [mainField?.name ?? 'documentId']: relation[mainField?.name ?? 'documentId'],\n label: getRelationLabel(relation, mainField),\n href: `${href}/${relation.documentId}?${relation.locale ? `plugins[i18n][locale]=${relation.locale}` : ''}`,\n };\n });\n\n/* -------------------------------------------------------------------------------------------------\n * RelationsInput\n * -----------------------------------------------------------------------------------------------*/\ninterface RelationsInputProps extends Omit<RelationsFieldProps, 'type'> {\n id?: string;\n model: string;\n isRelatedToCurrentDocument: boolean;\n onChange: (\n relation: Pick<RelationResult, 'documentId' | 'id' | 'locale' | 'status'> & {\n [key: string]: any;\n }\n ) => void;\n}\n\n/**\n * @description Contains all the logic for the combobox that can search\n * for relations and then add them to the field's connect array.\n */\nconst RelationsInput = ({\n hint,\n id,\n model,\n label,\n labelAction,\n name,\n mainField,\n placeholder,\n required,\n unique: _unique,\n 'aria-label': _ariaLabel,\n onChange,\n isRelatedToCurrentDocument,\n ...props\n}: RelationsInputProps) => {\n const [textValue, setTextValue] = React.useState<string | undefined>('');\n const [searchParams, setSearchParams] = React.useState({\n _q: '',\n page: 1,\n });\n const { toggleNotification } = useNotification();\n const { currentDocumentMeta } = useDocumentContext('RelationsInput');\n\n const { formatMessage } = useIntl();\n const fieldRef = useFocusInputField<HTMLInputElement>(name);\n const field = useField<RelationsFormValue>(name);\n\n const searchParamsDebounced = useDebounce(searchParams, 300);\n const [searchForTrigger, { data, isLoading }] = useLazySearchRelationsQuery();\n\n /**\n * Because we're using a lazy query, we need to trigger the search\n * when the component mounts and when the search params change.\n * We also need to trigger the search when the field value changes\n * so that we can filter out the relations that are already connected.\n */\n React.useEffect(() => {\n /**\n * The `name` prop is a complete path to the field, e.g. `field1.field2.field3`.\n * Where the above example would a nested field within two components, however\n * we only require the field on the component not the complete path since we query\n * individual components. Therefore we split the string and take the last item.\n */\n const [targetField] = name.split('.').slice(-1);\n\n // Return early if there is no relation to the document\n if (!isRelatedToCurrentDocument) return;\n\n searchForTrigger({\n model,\n targetField,\n params: {\n ...currentDocumentMeta.params,\n id: id ?? '',\n pageSize: 10,\n idsToInclude: field.value?.disconnect?.map((rel) => rel.id.toString()) ?? [],\n idsToOmit: field.value?.connect?.map((rel) => rel.id.toString()) ?? [],\n ...searchParamsDebounced,\n },\n });\n }, [\n field.value?.connect,\n field.value?.disconnect,\n id,\n model,\n name,\n searchForTrigger,\n searchParamsDebounced,\n isRelatedToCurrentDocument,\n currentDocumentMeta.params,\n ]);\n\n const handleSearch = async (search: string) => {\n setSearchParams((s) => ({ ...s, _q: search, page: 1 }));\n };\n\n const hasNextPage = data?.pagination ? data.pagination.page < data.pagination.pageCount : false;\n\n const options = data?.results ?? [];\n\n const handleChange = (relationId?: string) => {\n if (!relationId) {\n return;\n }\n\n const relation = options.find((opt) => opt.id.toString() === relationId);\n\n if (!relation) {\n // This is very unlikely to happen, but it ensures we don't have any data for.\n console.error(\n \"You've tried to add a relation with an id that does not exist in the options you can see, this is likely a bug with Strapi. Please open an issue.\"\n );\n\n toggleNotification({\n message: formatMessage({\n id: getTranslation('relation.error-adding-relation'),\n defaultMessage: 'An error occurred while trying to add the relation.',\n }),\n type: 'danger',\n });\n\n return;\n }\n\n /**\n * You need to give this relation a correct _temp_key_ but\n * this component doesn't know about those ones, you can't rely\n * on the connect array because that doesn't hold items that haven't\n * moved. So use a callback to fill in the gaps when connecting.\n *\n */\n onChange(relation);\n };\n\n const handleLoadMore = () => {\n if (!data || !data.pagination) {\n return;\n } else if (data.pagination.page < data.pagination.pageCount) {\n setSearchParams((s) => ({ ...s, page: s.page + 1 }));\n }\n };\n\n React.useLayoutEffect(() => {\n setTextValue('');\n }, [field.value]);\n\n return (\n <Field.Root error={field.error} hint={hint} name={name} required={required}>\n <Field.Label action={labelAction}>{label}</Field.Label>\n <Combobox\n ref={fieldRef}\n name={name}\n autocomplete=\"list\"\n placeholder={\n placeholder ||\n formatMessage({\n id: getTranslation('relation.add'),\n defaultMessage: 'Add relation',\n })\n }\n hasMoreItems={hasNextPage}\n loading={isLoading}\n onOpenChange={() => {\n handleSearch(textValue ?? '');\n }}\n noOptionsMessage={() =>\n formatMessage({\n id: getTranslation('relation.notAvailable'),\n defaultMessage: 'No relations available',\n })\n }\n loadingMessage={formatMessage({\n id: getTranslation('relation.isLoading'),\n defaultMessage: 'Relations are loading',\n })}\n onLoadMore={handleLoadMore}\n textValue={textValue}\n onChange={handleChange}\n onTextValueChange={(text) => {\n setTextValue(text);\n }}\n onInputChange={(event) => {\n handleSearch(event.currentTarget.value);\n }}\n {...props}\n >\n {options.map((opt) => {\n const textValue = getRelationLabel(opt, mainField);\n\n return (\n <ComboboxOption key={opt.id} value={opt.id.toString()} textValue={textValue}>\n <Flex gap={2} justifyContent=\"space-between\">\n <Typography ellipsis>{textValue}</Typography>\n {opt.status ? <DocumentStatus status={opt.status} /> : null}\n </Flex>\n </ComboboxOption>\n );\n })}\n </Combobox>\n <Field.Error />\n <Field.Hint />\n </Field.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * RelationsList\n * -----------------------------------------------------------------------------------------------*/\nconst RELATION_ITEM_HEIGHT = 50;\nconst RELATION_GUTTER = 4;\n\ninterface RelationsListProps extends Pick<RelationsFieldProps, 'disabled' | 'name'> {\n data: Relation[];\n isLoading?: boolean;\n relationType: Schema.Attribute.RelationKind.Any;\n /**\n * The existing relations connected on the server. We need these to diff against.\n */\n serverData: RelationResult[];\n targetModel: string;\n mainField?: MainField;\n}\n\nconst RelationsList = ({\n data,\n serverData,\n disabled,\n name,\n isLoading,\n relationType,\n targetModel,\n mainField,\n}: RelationsListProps) => {\n const ariaDescriptionId = React.useId();\n const { formatMessage } = useIntl();\n const listRef = React.useRef<FixedSizeList>(null);\n const outerListRef = React.useRef<HTMLUListElement>(null);\n const [overflow, setOverflow] = React.useState<'top' | 'bottom' | 'top-bottom'>();\n const [liveText, setLiveText] = React.useState('');\n const field = useField(name);\n\n React.useEffect(() => {\n if (data.length <= RELATIONS_TO_DISPLAY) {\n return setOverflow(undefined);\n }\n\n const handleNativeScroll = (e: Event) => {\n const el = e.target as HTMLUListElement;\n const parentScrollContainerHeight = (el.parentNode as HTMLDivElement).scrollHeight;\n const maxScrollBottom = el.scrollHeight - el.scrollTop;\n\n if (el.scrollTop === 0) {\n return setOverflow('bottom');\n }\n\n if (maxScrollBottom === parentScrollContainerHeight) {\n return setOverflow('top');\n }\n\n return setOverflow('top-bottom');\n };\n\n const outerListRefCurrent = outerListRef?.current;\n\n if (!isLoading && data.length > 0 && outerListRefCurrent) {\n outerListRef.current.addEventListener('scroll', handleNativeScroll);\n }\n\n return () => {\n if (outerListRefCurrent) {\n outerListRefCurrent.removeEventListener('scroll', handleNativeScroll);\n }\n };\n }, [isLoading, data.length]);\n\n const getItemPos = (index: number) => `${index + 1} of ${data.length}`;\n\n const handleMoveItem: UseDragAndDropOptions['onMoveItem'] = (newIndex, oldIndex) => {\n const item = data[oldIndex];\n\n setLiveText(\n formatMessage(\n {\n id: getTranslation('dnd.reorder'),\n defaultMessage: '{item}, moved. New position in list: {position}.',\n },\n {\n item: item.label ?? item.documentId,\n position: getItemPos(newIndex),\n }\n )\n );\n\n /**\n * Splicing mutates the array, so we need to create a new array\n */\n const newData = [...data];\n const currentRow = data[oldIndex];\n\n const startKey =\n oldIndex > newIndex ? newData[newIndex - 1]?.__temp_key__ : newData[newIndex]?.__temp_key__;\n const endKey =\n oldIndex > newIndex ? newData[newIndex]?.__temp_key__ : newData[newIndex + 1]?.__temp_key__;\n\n /**\n * We're moving the relation between two other relations, so\n * we need to generate a new key that keeps the order\n */\n const [newKey] = generateNKeysBetween(startKey, endKey, 1);\n\n newData.splice(oldIndex, 1);\n newData.splice(newIndex, 0, { ...currentRow, __temp_key__: newKey });\n\n /**\n * Now we diff against the server to understand what's different so we\n * can keep the connect array nice and tidy. It also needs reversing because\n * we reverse the relations from the server in the first place.\n */\n const connectedRelations = newData\n .reduce<Relation[]>((acc, relation, currentIndex, array) => {\n const relationOnServer = serverData.find((oldRelation) => oldRelation.id === relation.id);\n\n const relationInFront = array[currentIndex + 1];\n\n if (!relationOnServer || relationOnServer.__temp_key__ !== relation.__temp_key__) {\n const position = relationInFront\n ? {\n before: relationInFront.documentId,\n locale: relationInFront.locale,\n status:\n 'publishedAt' in relationInFront && relationInFront.publishedAt\n ? ('published' as Relation['status'])\n : ('draft' as Relation['status']),\n }\n : { end: true };\n\n const relationWithPosition: Relation = {\n ...relation,\n ...{\n apiData: {\n id: relation.id,\n documentId: relation.documentId ?? relation.apiData?.documentId ?? '',\n locale: relation.locale || relation.apiData?.locale,\n isTemporary: relation.apiData?.isTemporary,\n position,\n },\n },\n };\n\n return [...acc, relationWithPosition];\n }\n\n return acc;\n }, [])\n .toReversed();\n\n field.onChange(`${name}.connect`, connectedRelations);\n };\n\n const handleGrabItem: UseDragAndDropOptions['onGrabItem'] = (index) => {\n const item = data[index];\n\n setLiveText(\n formatMessage(\n {\n id: getTranslation('dnd.grab-item'),\n defaultMessage: `{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel.`,\n },\n {\n item: item.label ?? item.documentId,\n position: getItemPos(index),\n }\n )\n );\n };\n\n const handleDropItem: UseDragAndDropOptions['onDropItem'] = (index) => {\n const { href: _href, label, ...item } = data[index];\n\n setLiveText(\n formatMessage(\n {\n id: getTranslation('dnd.drop-item'),\n defaultMessage: `{item}, dropped. Final position in list: {position}.`,\n },\n {\n item: label ?? item.documentId,\n position: getItemPos(index),\n }\n )\n );\n };\n\n const handleCancel: UseDragAndDropOptions['onCancel'] = (index) => {\n const item = data[index];\n\n setLiveText(\n formatMessage(\n {\n id: getTranslation('dnd.cancel-item'),\n defaultMessage: '{item}, dropped. Re-order cancelled.',\n },\n {\n item: item.label ?? item.documentId,\n }\n )\n );\n };\n\n const handleDisconnect = useHandleDisconnect(name, 'RelationsList');\n\n /**\n * These relation types will only ever have one item\n * in their list, so you can't reorder a single item!\n */\n const canReorder = !ONE_WAY_RELATIONS.includes(relationType);\n\n const dynamicListHeight =\n data.length > RELATIONS_TO_DISPLAY\n ? Math.min(data.length, RELATIONS_TO_DISPLAY) * (RELATION_ITEM_HEIGHT + RELATION_GUTTER) +\n RELATION_ITEM_HEIGHT / 2\n : Math.min(data.length, RELATIONS_TO_DISPLAY) * (RELATION_ITEM_HEIGHT + RELATION_GUTTER);\n\n return (\n <ShadowBox $overflowDirection={overflow}>\n <VisuallyHidden id={ariaDescriptionId}>\n {formatMessage({\n id: getTranslation('dnd.instructions'),\n defaultMessage: `Press spacebar to grab and re-order`,\n })}\n </VisuallyHidden>\n <VisuallyHidden aria-live=\"assertive\">{liveText}</VisuallyHidden>\n {/* @ts-expect-error – width is expected, but we've not needed to pass it before. */}\n <FixedSizeList\n height={dynamicListHeight}\n ref={listRef}\n outerRef={outerListRef}\n itemCount={data.length}\n itemSize={RELATION_ITEM_HEIGHT + RELATION_GUTTER}\n itemData={{\n ariaDescribedBy: ariaDescriptionId,\n canDrag: canReorder,\n disabled,\n handleCancel,\n handleDropItem,\n handleGrabItem,\n handleMoveItem,\n name,\n handleDisconnect,\n relations: data,\n targetModel,\n mainField,\n }}\n itemKey={(index) => data[index].id}\n innerElementType=\"ol\"\n >\n {ListItem}\n </FixedSizeList>\n </ShadowBox>\n );\n};\n\nconst ShadowBox = styled<BoxComponent>(Box)<{\n $overflowDirection?: 'top-bottom' | 'top' | 'bottom';\n}>`\n position: relative;\n overflow: hidden;\n flex: 1;\n\n &:before,\n &:after {\n position: absolute;\n width: 100%;\n height: 4px;\n z-index: 1;\n }\n\n &:before {\n /* TODO: as for DS Table component we would need this to be handled by the DS theme */\n content: '';\n background: linear-gradient(rgba(3, 3, 5, 0.2) 0%, rgba(0, 0, 0, 0) 100%);\n top: 0;\n opacity: ${({ $overflowDirection }) =>\n $overflowDirection === 'top-bottom' || $overflowDirection === 'top' ? 1 : 0};\n transition: opacity 0.2s ease-in-out;\n }\n\n &:after {\n /* TODO: as for DS Table component we would need this to be handled by the DS theme */\n content: '';\n background: linear-gradient(0deg, rgba(3, 3, 5, 0.2) 0%, rgba(0, 0, 0, 0) 100%);\n bottom: 0;\n opacity: ${({ $overflowDirection }) =>\n $overflowDirection === 'top-bottom' || $overflowDirection === 'bottom' ? 1 : 0};\n transition: opacity 0.2s ease-in-out;\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * ListItem\n * -----------------------------------------------------------------------------------------------*/\n\ninterface ListItemProps extends Pick<ListChildComponentProps, 'style' | 'index'> {\n data: {\n ariaDescribedBy: string;\n canDrag?: boolean;\n disabled?: boolean;\n handleCancel: UseDragAndDropOptions['onCancel'];\n handleDropItem: UseDragAndDropOptions['onDropItem'];\n handleGrabItem: UseDragAndDropOptions['onGrabItem'];\n handleMoveItem: UseDragAndDropOptions['onMoveItem'];\n handleDisconnect: (relation: Relation) => void;\n name: string;\n relations: Relation[];\n targetModel: string;\n mainField?: MainField;\n };\n}\n\nconst ListItem = ({ data, index, style }: ListItemProps) => {\n const {\n ariaDescribedBy,\n canDrag = false,\n disabled = false,\n handleCancel,\n handleDisconnect,\n handleDropItem,\n handleGrabItem,\n handleMoveItem,\n name,\n relations,\n targetModel,\n mainField,\n } = data;\n const { currentDocumentMeta } = useDocumentContext('RelationsField');\n\n const { formatMessage } = useIntl();\n\n const {\n href,\n id,\n label: originalLabel,\n status: originalStatus,\n documentId,\n apiData,\n locale,\n } = relations[index];\n\n /**\n * The code above attempts to retrieve the updated value of a relation that has not yet been saved.\n * This is necessary when a relation modal is opened, and the mainField or its status is updated.\n * These changes need to be reflected in the initial relation field.\n */\n const collectionType = getCollectionType(href)!;\n const isTemporary = apiData?.isTemporary ?? false;\n const { document } = useDocument(\n {\n collectionType,\n model: targetModel,\n documentId: documentId ?? apiData?.documentId,\n params: currentDocumentMeta.params,\n },\n { skip: !isTemporary }\n );\n const label = isTemporary && document ? getRelationLabel(document, mainField) : originalLabel;\n const status = isTemporary && document ? document?.status : originalStatus;\n\n const [{ handlerId, isDragging, handleKeyDown }, relationRef, dropRef, dragRef, dragPreviewRef] =\n useDragAndDrop<number, Omit<RelationDragPreviewProps, 'width'>, HTMLDivElement>(\n canDrag && !disabled,\n {\n type: `${ItemTypes.RELATION}_${name}`,\n index,\n item: {\n displayedValue: label,\n status,\n id: id,\n index,\n },\n onMoveItem: handleMoveItem,\n onDropItem: handleDropItem,\n onGrabItem: handleGrabItem,\n onCancel: handleCancel,\n dropSensitivity: DROP_SENSITIVITY.REGULAR,\n }\n );\n\n const composedRefs = useComposedRefs<HTMLDivElement>(relationRef, dragRef);\n\n React.useEffect(() => {\n dragPreviewRef(getEmptyImage());\n }, [dragPreviewRef]);\n\n const safeDocumentId = documentId ?? apiData?.documentId;\n const safeLocale = locale ?? apiData?.locale ?? null;\n const documentMeta = React.useMemo(\n () =>\n ({\n documentId: safeDocumentId,\n model: targetModel,\n collectionType: getCollectionType(href)!,\n params: {\n locale: safeLocale,\n },\n }) as DocumentMeta,\n [safeDocumentId, href, safeLocale, targetModel]\n );\n\n return (\n <Box\n style={style}\n tag=\"li\"\n ref={dropRef}\n aria-describedby={ariaDescribedBy}\n cursor={canDrag ? 'all-scroll' : 'default'}\n >\n {isDragging ? (\n <RelationItemPlaceholder />\n ) : (\n <Flex\n paddingTop={2}\n paddingBottom={2}\n paddingLeft={canDrag ? 2 : 4}\n paddingRight={4}\n hasRadius\n borderColor=\"neutral200\"\n background={disabled ? 'neutral150' : 'neutral0'}\n justifyContent=\"space-between\"\n ref={composedRefs}\n data-handler-id={handlerId}\n >\n <FlexWrapper gap={1}>\n {canDrag ? (\n <IconButton\n tag=\"div\"\n role=\"button\"\n tabIndex={0}\n withTooltip={false}\n label={formatMessage({\n id: getTranslation('components.RelationInput.icon-button-aria-label'),\n defaultMessage: 'Drag',\n })}\n variant=\"ghost\"\n onKeyDown={handleKeyDown}\n disabled={disabled}\n >\n <Drag />\n </IconButton>\n ) : null}\n <Flex width=\"100%\" minWidth={0} gap={4} justifyContent=\"space-between\">\n <Box flex={1} minWidth={0} paddingTop={1} paddingBottom={1}>\n <RelationModal relation={documentMeta}>{label}</RelationModal>\n </Box>\n {status ? <DocumentStatus status={status} /> : null}\n </Flex>\n </FlexWrapper>\n <Box paddingLeft={4}>\n <IconButton\n onClick={() => handleDisconnect(relations[index])}\n disabled={disabled}\n label={formatMessage({\n id: getTranslation('relation.disconnect'),\n defaultMessage: 'Remove',\n })}\n variant=\"ghost\"\n size=\"S\"\n >\n <Cross />\n </IconButton>\n </Box>\n </Flex>\n )}\n </Box>\n );\n};\n\nconst FlexWrapper = styled<FlexComponent>(Flex)`\n width: 100%;\n /* Used to prevent endAction to be pushed out of container */\n min-width: 0;\n\n & > div[role='button'] {\n cursor: all-scroll;\n }\n`;\n\nconst DisconnectButton = styled.button`\n svg path {\n fill: ${({ theme, disabled }) =>\n disabled ? theme.colors.neutral600 : theme.colors.neutral500};\n }\n\n &:hover svg path,\n &:focus svg path {\n fill: ${({ theme, disabled }) => !disabled && theme.colors.neutral600};\n }\n`;\n\nconst LinkEllipsis = styled(Link)`\n display: block;\n\n & > span {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: block;\n }\n`;\n\nconst RelationItemPlaceholder = () => (\n <Box\n paddingTop={2}\n paddingBottom={2}\n paddingLeft={4}\n paddingRight={4}\n hasRadius\n borderStyle=\"dashed\"\n borderColor=\"primary600\"\n borderWidth=\"1px\"\n background=\"primary100\"\n height={`calc(100% - ${RELATION_GUTTER}px)`}\n />\n);\n\nconst MemoizedRelationsField = React.memo(RelationsField);\n\nexport { MemoizedRelationsField as RelationsInput, FlexWrapper, DisconnectButton, LinkEllipsis };\nexport type { RelationsFieldProps };\n"],"names":["useHandleDisconnect","fieldName","consumerName","field","useField","removeFieldRow","useForm","state","addFieldRow","handleDisconnect","relation","value","connect","indexOfRelationInConnectArray","findIndex","rel","id","apiData","documentId","locale","RELATIONS_TO_DISPLAY","ONE_WAY_RELATIONS","RelationsField","React","forwardRef","disabled","label","props","ref","currentDocument","currentDocumentMeta","useDocumentContext","currentPage","setCurrentPage","useState","document","formatMessage","useIntl","isMorph","attribute","toLowerCase","includes","isDisabled","componentId","componentUID","useComponent","uid","isSubmitting","useEffect","component","components","model","toString","targetField","name","split","slice","schemaAttributes","attributes","schema","isRelatedToCurrentDocument","Object","values","filter","type","target","length","data","isLoading","isFetching","useGetRelationsQuery","params","pageSize","page","refetchOnMountOrArgChange","skip","selectFromResult","result","results","handleLoadMore","prev","isFetchingMoreRelations","realServerRelationsCount","pagination","total","relationsConnected","relationsDisconnected","disconnect","relationsCount","relations","useMemo","ctx","href","COLLECTION_TYPES","targetModel","mainField","transformations","pipe","removeConnected","removeDisconnected","addLabelAndHref","transformedRels","sort","a","b","__temp_key__","handleConnect","lastItemInList","item","isTemporary","status","generateNKeysBetween","getRelationLabel","forEach","onChange","_jsxs","Flex","direction","gap","justifyContent","alignItems","wrap","StyledFlex","width","_jsx","RelationsInput","pageCount","TextButton","onClick","loading","startIcon","ArrowClockwise","shrink","getTranslation","defaultMessage","RelationsList","serverData","relationType","styled","connectedRelations","disconnectedRelations","map","hint","labelAction","placeholder","required","unique","_unique","_ariaLabel","textValue","setTextValue","searchParams","setSearchParams","_q","toggleNotification","useNotification","fieldRef","useFocusInputField","searchParamsDebounced","useDebounce","searchForTrigger","useLazySearchRelationsQuery","idsToInclude","idsToOmit","handleSearch","search","s","hasNextPage","options","handleChange","relationId","find","opt","console","error","message","useLayoutEffect","Field","Root","Label","action","Combobox","autocomplete","hasMoreItems","onOpenChange","noOptionsMessage","loadingMessage","onLoadMore","onTextValueChange","text","onInputChange","event","currentTarget","ComboboxOption","Typography","ellipsis","DocumentStatus","Error","Hint","RELATION_ITEM_HEIGHT","RELATION_GUTTER","ariaDescriptionId","useId","listRef","useRef","outerListRef","overflow","setOverflow","liveText","setLiveText","undefined","handleNativeScroll","e","el","parentScrollContainerHeight","parentNode","scrollHeight","maxScrollBottom","scrollTop","outerListRefCurrent","current","addEventListener","removeEventListener","getItemPos","index","handleMoveItem","newIndex","oldIndex","position","newData","currentRow","startKey","endKey","newKey","splice","reduce","acc","currentIndex","array","relationOnServer","oldRelation","relationInFront","before","publishedAt","end","relationWithPosition","toReversed","handleGrabItem","handleDropItem","_href","handleCancel","canReorder","dynamicListHeight","Math","min","ShadowBox","$overflowDirection","VisuallyHidden","aria-live","FixedSizeList","height","outerRef","itemCount","itemSize","itemData","ariaDescribedBy","canDrag","itemKey","innerElementType","ListItem","Box","style","originalLabel","originalStatus","collectionType","getCollectionType","useDocument","handlerId","isDragging","handleKeyDown","relationRef","dropRef","dragRef","dragPreviewRef","useDragAndDrop","ItemTypes","RELATION","displayedValue","onMoveItem","onDropItem","onGrabItem","onCancel","dropSensitivity","DROP_SENSITIVITY","REGULAR","composedRefs","useComposedRefs","getEmptyImage","safeDocumentId","safeLocale","documentMeta","tag","aria-describedby","cursor","RelationItemPlaceholder","paddingTop","paddingBottom","paddingLeft","paddingRight","hasRadius","borderColor","background","data-handler-id","FlexWrapper","IconButton","role","tabIndex","withTooltip","variant","onKeyDown","Drag","minWidth","flex","RelationModal","size","Cross","DisconnectButton","button","theme","colors","neutral600","neutral500","LinkEllipsis","Link","borderStyle","borderWidth","MemoizedRelationsField","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA;;;;AAIC,IACD,SAASA,mBAAAA,CAAoBC,SAAiB,EAAEC,YAAoB,EAAA;AAClE,IAAA,MAAMC,QAAQC,oBAASH,CAAAA,SAAAA,CAAAA;AACvB,IAAA,MAAMI,iBAAiBC,mBAAQJ,CAAAA,YAAAA,EAAc,CAACK,KAAAA,GAAUA,MAAMF,cAAc,CAAA;AAC5E,IAAA,MAAMG,cAAcF,mBAAQJ,CAAAA,YAAAA,EAAc,CAACK,KAAAA,GAAUA,MAAMC,WAAW,C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CAAgB,GAAG;;AAIxCwI,MAAAA,sBAAAA,iBAAyBzT,gBAAM0T,CAAAA,IAAI,CAAC3T,cAAAA;;;;;;;"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
2
2
|
import * as React from 'react';
|
3
|
-
import {
|
3
|
+
import { useForm, useField, useNotification, useFocusInputField } from '@strapi/admin/strapi-admin';
|
4
4
|
import { Flex, Box, Link, TextButton, Field, Combobox, ComboboxOption, Typography, VisuallyHidden, useComposedRefs, IconButton } from '@strapi/design-system';
|
5
5
|
import { ArrowClockwise, Drag, Cross } from '@strapi/icons';
|
6
6
|
import { generateNKeysBetween } from 'fractional-indexing';
|
@@ -11,16 +11,16 @@ import { FixedSizeList } from 'react-window';
|
|
11
11
|
import { styled } from 'styled-components';
|
12
12
|
import { COLLECTION_TYPES } from '../../../../../constants/collections.mjs';
|
13
13
|
import { ItemTypes } from '../../../../../constants/dragAndDrop.mjs';
|
14
|
-
import { useDocumentContext } from '../../../../../features/DocumentContext.mjs';
|
15
14
|
import { useDebounce } from '../../../../../hooks/useDebounce.mjs';
|
15
|
+
import { useDocument } from '../../../../../hooks/useDocument.mjs';
|
16
|
+
import { useDocumentContext } from '../../../../../hooks/useDocumentContext.mjs';
|
16
17
|
import { useDragAndDrop, DROP_SENSITIVITY } from '../../../../../hooks/useDragAndDrop.mjs';
|
17
18
|
import { useGetRelationsQuery, useLazySearchRelationsQuery } from '../../../../../services/relations.mjs';
|
18
|
-
import { buildValidParams } from '../../../../../utils/api.mjs';
|
19
19
|
import { getRelationLabel } from '../../../../../utils/relations.mjs';
|
20
20
|
import { getTranslation } from '../../../../../utils/translations.mjs';
|
21
21
|
import { DocumentStatus } from '../../DocumentStatus.mjs';
|
22
22
|
import { useComponent } from '../ComponentContext.mjs';
|
23
|
-
import {
|
23
|
+
import { getCollectionType, RelationModal } from './RelationModal.mjs';
|
24
24
|
|
25
25
|
/**
|
26
26
|
* Remove a relation, whether it's been already saved or not.
|
@@ -75,17 +75,11 @@ const ONE_WAY_RELATIONS = [
|
|
75
75
|
* At present we do not expose this to plugin developers, however, they are able to overwrite it themselves should
|
76
76
|
* they wish to do so.
|
77
77
|
*/ const RelationsField = /*#__PURE__*/ React.forwardRef(({ disabled, label, ...props }, ref)=>{
|
78
|
-
const currentDocumentMeta = useDocumentContext('RelationsField'
|
79
|
-
const currentDocument = useDocumentContext('RelationsField', (state)=>state.document);
|
80
|
-
const rootDocumentMeta = useDocumentContext('RelationsField', (state)=>state.rootDocumentMeta);
|
78
|
+
const { currentDocument, currentDocumentMeta } = useDocumentContext('RelationsField');
|
81
79
|
const [currentPage, setCurrentPage] = React.useState(1);
|
82
|
-
const isRootDocument = rootDocumentMeta.documentId === currentDocumentMeta.documentId;
|
83
|
-
const documentMeta = isRootDocument ? rootDocumentMeta : currentDocumentMeta;
|
84
80
|
// Use the documentId from the actual document, not the params (meta)
|
85
81
|
const documentId = currentDocument.document?.documentId;
|
86
82
|
const { formatMessage } = useIntl();
|
87
|
-
const [{ query }] = useQueryParams();
|
88
|
-
const params = documentMeta.params ?? buildValidParams(query);
|
89
83
|
const isMorph = props.attribute.relation.toLowerCase().includes('morph');
|
90
84
|
const isDisabled = isMorph || disabled;
|
91
85
|
const { componentId, componentUID } = useComponent('RelationsField', ({ uid, id })=>({
|
@@ -102,7 +96,7 @@ const ONE_WAY_RELATIONS = [
|
|
102
96
|
/**
|
103
97
|
* We'll always have a documentId in a created entry, so we look for a componentId first.
|
104
98
|
* Same with `uid` and `documentModel`.
|
105
|
-
*/ const model = component ? component.uid :
|
99
|
+
*/ const model = component ? component.uid : currentDocumentMeta.model;
|
106
100
|
const id = component && componentId ? componentId.toString() : documentId;
|
107
101
|
/**
|
108
102
|
* The `name` prop is a complete path to the field, e.g. `field1.field2.field3`.
|
@@ -122,7 +116,7 @@ const ONE_WAY_RELATIONS = [
|
|
122
116
|
// below we don't run the query if there is no id.
|
123
117
|
id,
|
124
118
|
params: {
|
125
|
-
...params,
|
119
|
+
...currentDocumentMeta.params,
|
126
120
|
pageSize: RELATIONS_TO_DISPLAY,
|
127
121
|
page: currentPage
|
128
122
|
}
|
@@ -194,7 +188,8 @@ const ONE_WAY_RELATIONS = [
|
|
194
188
|
apiData: {
|
195
189
|
id: relation.id,
|
196
190
|
documentId: relation.documentId,
|
197
|
-
locale: relation.locale
|
191
|
+
locale: relation.locale,
|
192
|
+
isTemporary: true
|
198
193
|
},
|
199
194
|
status: relation.status,
|
200
195
|
/**
|
@@ -266,7 +261,8 @@ const ONE_WAY_RELATIONS = [
|
|
266
261
|
isLoading: isFetchingMoreRelations,
|
267
262
|
relationType: props.attribute.relation,
|
268
263
|
// @ts-expect-error – targetModel does exist on the attribute. But it's not typed.
|
269
|
-
targetModel: props.attribute.targetModel
|
264
|
+
targetModel: props.attribute.targetModel,
|
265
|
+
mainField: props.mainField
|
270
266
|
})
|
271
267
|
]
|
272
268
|
});
|
@@ -316,11 +312,7 @@ const ONE_WAY_RELATIONS = [
|
|
316
312
|
page: 1
|
317
313
|
});
|
318
314
|
const { toggleNotification } = useNotification();
|
319
|
-
const
|
320
|
-
const currentDocumentMeta = useDocumentContext('RelationsInput', (state)=>state.meta);
|
321
|
-
const rootDocumentMeta = useDocumentContext('RelationsInput', (state)=>state.rootDocumentMeta);
|
322
|
-
const isRootDocument = rootDocumentMeta.documentId === currentDocumentMeta.documentId;
|
323
|
-
const documentMeta = isRootDocument ? rootDocumentMeta : currentDocumentMeta;
|
315
|
+
const { currentDocumentMeta } = useDocumentContext('RelationsInput');
|
324
316
|
const { formatMessage } = useIntl();
|
325
317
|
const fieldRef = useFocusInputField(name);
|
326
318
|
const field = useField(name);
|
@@ -340,12 +332,11 @@ const ONE_WAY_RELATIONS = [
|
|
340
332
|
*/ const [targetField] = name.split('.').slice(-1);
|
341
333
|
// Return early if there is no relation to the document
|
342
334
|
if (!isRelatedToCurrentDocument) return;
|
343
|
-
const params = documentMeta.params ?? buildValidParams(query);
|
344
335
|
searchForTrigger({
|
345
336
|
model,
|
346
337
|
targetField,
|
347
338
|
params: {
|
348
|
-
...params,
|
339
|
+
...currentDocumentMeta.params,
|
349
340
|
id: id ?? '',
|
350
341
|
pageSize: 10,
|
351
342
|
idsToInclude: field.value?.disconnect?.map((rel)=>rel.id.toString()) ?? [],
|
@@ -359,11 +350,10 @@ const ONE_WAY_RELATIONS = [
|
|
359
350
|
id,
|
360
351
|
model,
|
361
352
|
name,
|
362
|
-
query,
|
363
353
|
searchForTrigger,
|
364
354
|
searchParamsDebounced,
|
365
355
|
isRelatedToCurrentDocument,
|
366
|
-
|
356
|
+
currentDocumentMeta.params
|
367
357
|
]);
|
368
358
|
const handleSearch = async (search)=>{
|
369
359
|
setSearchParams((s)=>({
|
@@ -485,7 +475,7 @@ const ONE_WAY_RELATIONS = [
|
|
485
475
|
* RelationsList
|
486
476
|
* -----------------------------------------------------------------------------------------------*/ const RELATION_ITEM_HEIGHT = 50;
|
487
477
|
const RELATION_GUTTER = 4;
|
488
|
-
const RelationsList = ({ data, serverData, disabled, name, isLoading, relationType, targetModel })=>{
|
478
|
+
const RelationsList = ({ data, serverData, disabled, name, isLoading, relationType, targetModel, mainField })=>{
|
489
479
|
const ariaDescriptionId = React.useId();
|
490
480
|
const { formatMessage } = useIntl();
|
491
481
|
const listRef = React.useRef(null);
|
@@ -571,6 +561,7 @@ const RelationsList = ({ data, serverData, disabled, name, isLoading, relationTy
|
|
571
561
|
id: relation.id,
|
572
562
|
documentId: relation.documentId ?? relation.apiData?.documentId ?? '',
|
573
563
|
locale: relation.locale || relation.apiData?.locale,
|
564
|
+
isTemporary: relation.apiData?.isTemporary,
|
574
565
|
position
|
575
566
|
}
|
576
567
|
}
|
@@ -650,7 +641,8 @@ const RelationsList = ({ data, serverData, disabled, name, isLoading, relationTy
|
|
650
641
|
name,
|
651
642
|
handleDisconnect,
|
652
643
|
relations: data,
|
653
|
-
targetModel
|
644
|
+
targetModel,
|
645
|
+
mainField
|
654
646
|
},
|
655
647
|
itemKey: (index)=>data[index].id,
|
656
648
|
innerElementType: "ol",
|
@@ -691,9 +683,26 @@ const ShadowBox = styled(Box)`
|
|
691
683
|
}
|
692
684
|
`;
|
693
685
|
const ListItem = ({ data, index, style })=>{
|
694
|
-
const { ariaDescribedBy, canDrag = false, disabled = false, handleCancel, handleDisconnect, handleDropItem, handleGrabItem, handleMoveItem, name, relations, targetModel } = data;
|
686
|
+
const { ariaDescribedBy, canDrag = false, disabled = false, handleCancel, handleDisconnect, handleDropItem, handleGrabItem, handleMoveItem, name, relations, targetModel, mainField } = data;
|
687
|
+
const { currentDocumentMeta } = useDocumentContext('RelationsField');
|
695
688
|
const { formatMessage } = useIntl();
|
696
|
-
const { href, id, label, status, documentId, apiData, locale } = relations[index];
|
689
|
+
const { href, id, label: originalLabel, status: originalStatus, documentId, apiData, locale } = relations[index];
|
690
|
+
/**
|
691
|
+
* The code above attempts to retrieve the updated value of a relation that has not yet been saved.
|
692
|
+
* This is necessary when a relation modal is opened, and the mainField or its status is updated.
|
693
|
+
* These changes need to be reflected in the initial relation field.
|
694
|
+
*/ const collectionType = getCollectionType(href);
|
695
|
+
const isTemporary = apiData?.isTemporary ?? false;
|
696
|
+
const { document } = useDocument({
|
697
|
+
collectionType,
|
698
|
+
model: targetModel,
|
699
|
+
documentId: documentId ?? apiData?.documentId,
|
700
|
+
params: currentDocumentMeta.params
|
701
|
+
}, {
|
702
|
+
skip: !isTemporary
|
703
|
+
});
|
704
|
+
const label = isTemporary && document ? getRelationLabel(document, mainField) : originalLabel;
|
705
|
+
const status = isTemporary && document ? document?.status : originalStatus;
|
697
706
|
const [{ handlerId, isDragging, handleKeyDown }, relationRef, dropRef, dragRef, dragPreviewRef] = useDragAndDrop(canDrag && !disabled, {
|
698
707
|
type: `${ItemTypes.RELATION}_${name}`,
|
699
708
|
index,
|
@@ -715,6 +724,21 @@ const ListItem = ({ data, index, style })=>{
|
|
715
724
|
}, [
|
716
725
|
dragPreviewRef
|
717
726
|
]);
|
727
|
+
const safeDocumentId = documentId ?? apiData?.documentId;
|
728
|
+
const safeLocale = locale ?? apiData?.locale ?? null;
|
729
|
+
const documentMeta = React.useMemo(()=>({
|
730
|
+
documentId: safeDocumentId,
|
731
|
+
model: targetModel,
|
732
|
+
collectionType: getCollectionType(href),
|
733
|
+
params: {
|
734
|
+
locale: safeLocale
|
735
|
+
}
|
736
|
+
}), [
|
737
|
+
safeDocumentId,
|
738
|
+
href,
|
739
|
+
safeLocale,
|
740
|
+
targetModel
|
741
|
+
]);
|
718
742
|
return /*#__PURE__*/ jsx(Box, {
|
719
743
|
style: style,
|
720
744
|
tag: "li",
|
@@ -753,23 +777,17 @@ const ListItem = ({ data, index, style })=>{
|
|
753
777
|
/*#__PURE__*/ jsxs(Flex, {
|
754
778
|
width: "100%",
|
755
779
|
minWidth: 0,
|
780
|
+
gap: 4,
|
756
781
|
justifyContent: "space-between",
|
757
782
|
children: [
|
758
783
|
/*#__PURE__*/ jsx(Box, {
|
784
|
+
flex: 1,
|
759
785
|
minWidth: 0,
|
760
786
|
paddingTop: 1,
|
761
787
|
paddingBottom: 1,
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
relation: {
|
766
|
-
documentId: documentId ?? apiData?.documentId,
|
767
|
-
model: targetModel,
|
768
|
-
collectionType: getCollectionType(href),
|
769
|
-
params: {
|
770
|
-
locale: locale || apiData?.locale || null
|
771
|
-
}
|
772
|
-
}
|
788
|
+
children: /*#__PURE__*/ jsx(RelationModal, {
|
789
|
+
relation: documentMeta,
|
790
|
+
children: label
|
773
791
|
})
|
774
792
|
}),
|
775
793
|
status ? /*#__PURE__*/ jsx(DocumentStatus, {
|