@strapi/content-manager 5.1.1 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/_chunks/{ComponentConfigurationPage-CpJNPBgk.js → ComponentConfigurationPage-Cr0ttPAZ.js} +3 -3
  2. package/dist/_chunks/{ComponentConfigurationPage-CpJNPBgk.js.map → ComponentConfigurationPage-Cr0ttPAZ.js.map} +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-TYDPg5WG.mjs → ComponentConfigurationPage-UGIFDkPO.mjs} +3 -3
  4. package/dist/_chunks/{ComponentConfigurationPage-TYDPg5WG.mjs.map → ComponentConfigurationPage-UGIFDkPO.mjs.map} +1 -1
  5. package/dist/_chunks/{EditConfigurationPage-DqL8Pq5r.mjs → EditConfigurationPage-7hF4_8yK.mjs} +3 -3
  6. package/dist/_chunks/{EditConfigurationPage-DqL8Pq5r.mjs.map → EditConfigurationPage-7hF4_8yK.mjs.map} +1 -1
  7. package/dist/_chunks/{EditConfigurationPage-CFDe6SA1.js → EditConfigurationPage-Ds3BOL2z.js} +3 -3
  8. package/dist/_chunks/{EditConfigurationPage-CFDe6SA1.js.map → EditConfigurationPage-Ds3BOL2z.js.map} +1 -1
  9. package/dist/_chunks/{EditViewPage-RXrFLav2.mjs → EditViewPage-CA98g5_g.mjs} +38 -8
  10. package/dist/_chunks/EditViewPage-CA98g5_g.mjs.map +1 -0
  11. package/dist/_chunks/{EditViewPage-khfP2CR3.js → EditViewPage-DoQm9llG.js} +37 -7
  12. package/dist/_chunks/EditViewPage-DoQm9llG.js.map +1 -0
  13. package/dist/_chunks/{Field--rQeS6Zj.mjs → Field-B2C1tq9_.mjs} +26 -6
  14. package/dist/_chunks/Field-B2C1tq9_.mjs.map +1 -0
  15. package/dist/_chunks/{Field-C1ftmTe9.js → Field-CQtLQzHl.js} +26 -6
  16. package/dist/_chunks/Field-CQtLQzHl.js.map +1 -0
  17. package/dist/_chunks/{Form-COtGXyUE.mjs → Form-CxQ2pPjq.mjs} +2 -2
  18. package/dist/_chunks/{Form-COtGXyUE.mjs.map → Form-CxQ2pPjq.mjs.map} +1 -1
  19. package/dist/_chunks/{Form-CwdX5oLw.js → Form-YQaS3_NH.js} +2 -2
  20. package/dist/_chunks/{Form-CwdX5oLw.js.map → Form-YQaS3_NH.js.map} +1 -1
  21. package/dist/_chunks/{History-BevwkPO1.mjs → History-DTYKr2Cg.mjs} +4 -11
  22. package/dist/_chunks/History-DTYKr2Cg.mjs.map +1 -0
  23. package/dist/_chunks/{History-DKS2aqqM.js → History-DbdpigyF.js} +4 -11
  24. package/dist/_chunks/History-DbdpigyF.js.map +1 -0
  25. package/dist/_chunks/{ListConfigurationPage-DNfZDtDA.mjs → ListConfigurationPage-DQG-j52q.mjs} +2 -2
  26. package/dist/_chunks/{ListConfigurationPage-DNfZDtDA.mjs.map → ListConfigurationPage-DQG-j52q.mjs.map} +1 -1
  27. package/dist/_chunks/{ListConfigurationPage-LSYSPZHH.js → ListConfigurationPage-DRGhXnUA.js} +2 -2
  28. package/dist/_chunks/{ListConfigurationPage-LSYSPZHH.js.map → ListConfigurationPage-DRGhXnUA.js.map} +1 -1
  29. package/dist/_chunks/{ListViewPage-DlUpqLIo.js → ListViewPage-CVIEfYWN.js} +16 -5
  30. package/dist/_chunks/{ListViewPage-DlUpqLIo.js.map → ListViewPage-CVIEfYWN.js.map} +1 -1
  31. package/dist/_chunks/{ListViewPage-C1PyuYRS.mjs → ListViewPage-DAekmnvp.mjs} +16 -5
  32. package/dist/_chunks/{ListViewPage-C1PyuYRS.mjs.map → ListViewPage-DAekmnvp.mjs.map} +1 -1
  33. package/dist/_chunks/{NoContentTypePage-C9q744z1.mjs → NoContentTypePage-5kwUPeFg.mjs} +2 -2
  34. package/dist/_chunks/{NoContentTypePage-C9q744z1.mjs.map → NoContentTypePage-5kwUPeFg.mjs.map} +1 -1
  35. package/dist/_chunks/{NoContentTypePage-m8wt3sf6.js → NoContentTypePage-CTcfA2-Q.js} +2 -2
  36. package/dist/_chunks/{NoContentTypePage-m8wt3sf6.js.map → NoContentTypePage-CTcfA2-Q.js.map} +1 -1
  37. package/dist/_chunks/{NoPermissionsPage-8BM-LWta.mjs → NoPermissionsPage-d-JtEVAw.mjs} +2 -2
  38. package/dist/_chunks/{NoPermissionsPage-8BM-LWta.mjs.map → NoPermissionsPage-d-JtEVAw.mjs.map} +1 -1
  39. package/dist/_chunks/{NoPermissionsPage-DLfPsA0Q.js → NoPermissionsPage-pVeCVj9a.js} +2 -2
  40. package/dist/_chunks/{NoPermissionsPage-DLfPsA0Q.js.map → NoPermissionsPage-pVeCVj9a.js.map} +1 -1
  41. package/dist/_chunks/Preview-COsm52rZ.js +307 -0
  42. package/dist/_chunks/Preview-COsm52rZ.js.map +1 -0
  43. package/dist/_chunks/Preview-gkmvcwhu.mjs +288 -0
  44. package/dist/_chunks/Preview-gkmvcwhu.mjs.map +1 -0
  45. package/dist/_chunks/{Relations-D25xRcFy.mjs → Relations-7ItTFWp7.mjs} +3 -3
  46. package/dist/_chunks/{Relations-D25xRcFy.mjs.map → Relations-7ItTFWp7.mjs.map} +1 -1
  47. package/dist/_chunks/{Relations-OMriCP_L.js → Relations-Beo_uDz1.js} +3 -3
  48. package/dist/_chunks/{Relations-OMriCP_L.js.map → Relations-Beo_uDz1.js.map} +1 -1
  49. package/dist/_chunks/{en-Bdpa50w3.js → en-CHOp_xJv.js} +6 -1
  50. package/dist/_chunks/{en-Bdpa50w3.js.map → en-CHOp_xJv.js.map} +1 -1
  51. package/dist/_chunks/{en-CZw4xdPY.mjs → en-D_BMf0hT.mjs} +6 -1
  52. package/dist/_chunks/{en-CZw4xdPY.mjs.map → en-D_BMf0hT.mjs.map} +1 -1
  53. package/dist/_chunks/{index-DqZnjo8F.js → index-CJX65DLa.js} +68 -94
  54. package/dist/_chunks/index-CJX65DLa.js.map +1 -0
  55. package/dist/_chunks/{index-BvGihCJp.mjs → index-D3IiO0X8.mjs} +74 -100
  56. package/dist/_chunks/index-D3IiO0X8.mjs.map +1 -0
  57. package/dist/_chunks/{layout-CmaemAO3.js → layout-9fI2_QJt.js} +3 -3
  58. package/dist/_chunks/{layout-CmaemAO3.js.map → layout-9fI2_QJt.js.map} +1 -1
  59. package/dist/_chunks/{layout-ykHSe2KQ.mjs → layout-OhrmoJVB.mjs} +3 -3
  60. package/dist/_chunks/{layout-ykHSe2KQ.mjs.map → layout-OhrmoJVB.mjs.map} +1 -1
  61. package/dist/_chunks/{relations-D9fKsCLY.js → relations-DIT8sP52.js} +6 -3
  62. package/dist/_chunks/relations-DIT8sP52.js.map +1 -0
  63. package/dist/_chunks/{relations-u-Vz51Ea.mjs → relations-sRERvWmr.mjs} +6 -3
  64. package/dist/_chunks/relations-sRERvWmr.mjs.map +1 -0
  65. package/dist/admin/index.js +1 -1
  66. package/dist/admin/index.mjs +4 -4
  67. package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
  68. package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +1 -1
  69. package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
  70. package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
  71. package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
  72. package/dist/admin/src/preview/routes.d.ts +3 -0
  73. package/dist/admin/src/router.d.ts +1 -1
  74. package/dist/server/index.js.map +1 -1
  75. package/dist/server/index.mjs.map +1 -1
  76. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  77. package/package.json +8 -8
  78. package/dist/_chunks/EditViewPage-RXrFLav2.mjs.map +0 -1
  79. package/dist/_chunks/EditViewPage-khfP2CR3.js.map +0 -1
  80. package/dist/_chunks/Field--rQeS6Zj.mjs.map +0 -1
  81. package/dist/_chunks/Field-C1ftmTe9.js.map +0 -1
  82. package/dist/_chunks/History-BevwkPO1.mjs.map +0 -1
  83. package/dist/_chunks/History-DKS2aqqM.js.map +0 -1
  84. package/dist/_chunks/index-BvGihCJp.mjs.map +0 -1
  85. package/dist/_chunks/index-DqZnjo8F.js.map +0 -1
  86. package/dist/_chunks/relations-D9fKsCLY.js.map +0 -1
  87. package/dist/_chunks/relations-u-Vz51Ea.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Relations-OMriCP_L.js","sources":["../../admin/src/pages/EditView/components/FormInputs/ComponentContext.tsx","../../admin/src/pages/EditView/components/FormInputs/Relations.tsx"],"sourcesContent":["import { createContext } from '@strapi/admin/strapi-admin';\n\ninterface ComponentContextValue {\n /**\n * The id of the component. It will be undefined if the component\n * has not been created in the database yet. This could be on a new\n * or existing entry.\n */\n id?: number;\n /**\n * The level of the component. This is used to determine the nesting\n * of the component. The default is set to -1 so that the base level is 0\n * for the top level component, and increases by 1 for each level of nesting.\n */\n level: number;\n /**\n * The uid of the component. This is used to determine the type of the\n * component. Within an attribute, it is normally the `component` value.\n * It will be undefined if the hook is not called within the confines\n * of a provider.\n */\n uid?: string;\n /**\n * The type of component parent. It will be undefined if the hook\n * is not called within the confines of a provider.\n */\n type?: 'dynamiczone' | 'repeatable' | 'component';\n}\n\n/**\n * We use this component to wrap any individual component field in the Edit View,\n * this could be a component field in a dynamic zone, a component within a repeatable space,\n * or even nested components.\n *\n * We primarily need this to provide the component id to the components so that they can\n * correctly fetch their relations.\n */\nconst [ComponentProvider, useComponent] = createContext<ComponentContextValue>('ComponentContext', {\n id: undefined,\n level: -1,\n uid: undefined,\n type: undefined,\n});\n\nexport { ComponentProvider, useComponent };\n","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 Tooltip,\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 { NavLink } from 'react-router-dom';\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 { useDoc } from '../../../../hooks/useDocument';\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';\n\nimport { useComponent } from './ComponentContext';\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 * -----------------------------------------------------------------------------------------------*/\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}\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 [currentPage, setCurrentPage] = React.useState(1);\n const { document, model: documentModel } = useDoc();\n const documentId = document?.documentId;\n const { formatMessage } = useIntl();\n const [{ query }] = useQueryParams();\n const 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 /**\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 id = componentId ? componentId.toString() : documentId;\n const model = componentUID ?? documentModel;\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 { data, isLoading, isFetching } = useGetRelationsQuery(\n {\n model,\n targetField,\n // below we don't run the query if there is no id.\n id: id!,\n params: {\n ...params,\n pageSize: RELATIONS_TO_DISPLAY,\n page: currentPage,\n },\n },\n {\n refetchOnMountOrArgChange: true,\n skip: !id,\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 ? (componentId ? `${componentId}` : '') : documentId}\n label={`${label} ${relationsCount > 0 ? `(${relationsCount})` : ''}`}\n model={model}\n onChange={handleConnect}\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 />\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 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 ...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\n const { formatMessage } = useIntl();\n const fieldRef = useFocusInputField<HTMLInputElement>(name);\n const field = useField<RelationsFormValue>(name);\n\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 searchForTrigger({\n model,\n targetField,\n params: {\n ...buildValidParams(query),\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 ...searchParams,\n },\n });\n }, [\n field.value?.connect,\n field.value?.disconnect,\n id,\n model,\n name,\n query,\n searchForTrigger,\n searchParams,\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}\n\nconst RelationsList = ({\n data,\n serverData,\n disabled,\n name,\n isLoading,\n relationType,\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'\n : 'draft',\n }\n : { end: true };\n\n const relationWithPosition: Relation = {\n ...relation,\n ...{\n apiData: {\n id: relation.id,\n documentId: relation.documentId,\n locale: relation.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 }}\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 };\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 } = data;\n const { formatMessage } = useIntl();\n\n const { href, id, label, status } = 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 <Tooltip description={label}>\n {href ? (\n <LinkEllipsis tag={NavLink} to={href} isExternal={false}>\n {label}\n </LinkEllipsis>\n ) : (\n <Typography textColor={disabled ? 'neutral600' : 'primary600'} ellipsis>\n {label}\n </Typography>\n )}\n </Tooltip>\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":["createContext","useField","useForm","React","useDoc","useIntl","useQueryParams","buildValidParams","id","useGetRelationsQuery","relations","COLLECTION_TYPES","pipe","generateNKeysBetween","getRelationLabel","jsxs","Flex","jsx","TextButton","ArrowClockwise","getTranslation","styled","useNotification","useFocusInputField","useLazySearchRelationsQuery","Field","Combobox","textValue","ComboboxOption","Typography","DocumentStatus","index","VisuallyHidden","FixedSizeList","Box","useDragAndDrop","ItemTypes","DROP_SENSITIVITY","useComposedRefs","getEmptyImage","IconButton","Drag","Tooltip","NavLink","Cross","Link"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAM,CAAC,mBAAmB,YAAY,IAAIA,YAAAA,cAAqC,oBAAoB;AAAA,EACjG,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AACR,CAAC;ACsBD,SAAS,oBAAoB,WAAmB,cAAsB;AAC9D,QAAA,QAAQC,qBAAS,SAAS;AAChC,QAAM,iBAAiBC,YAAAA,QAAQ,cAAc,CAAC,UAAU,MAAM,cAAc;AAC5E,QAAM,cAAcA,YAAAA,QAAQ,cAAc,CAAC,UAAU,MAAM,WAAW;AAEhE,QAAA,mBAA8D,CAAC,aAAa;AAChF,QAAI,MAAM,SAAS,MAAM,MAAM,SAAS;AAMhC,YAAA,gCAAgC,MAAM,MAAM,QAAQ;AAAA,QACxD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MAAM,OAAO,aAAa,MAAM,OAAO,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,YAKtD,CAAC,EAAE,OAAO,eAAe,CAAC,YAAY,MAAM,OAAO,UAAU;AAAA;AAAA;AAInE,MAAA,eAAeA,iBAAAA,OAAOwB,aAAAA,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWhC,MAAM,0BAA0B,MAC9B5B,2BAAA;AAAA,EAACiB,aAAA;AAAA,EAAA;AAAA,IACC,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,aAAa;AAAA,IACb,cAAc;AAAA,IACd,WAAS;AAAA,IACT,aAAY;AAAA,IACZ,aAAY;AAAA,IACZ,aAAY;AAAA,IACZ,YAAW;AAAA,IACX,QAAQ,eAAe,eAAe;AAAA,EAAA;AACxC;AAGI,MAAA,yBAAyB/B,iBAAM,KAAK,cAAc;;;;;;;"}
1
+ {"version":3,"file":"Relations-Beo_uDz1.js","sources":["../../admin/src/pages/EditView/components/FormInputs/ComponentContext.tsx","../../admin/src/pages/EditView/components/FormInputs/Relations.tsx"],"sourcesContent":["import { createContext } from '@strapi/admin/strapi-admin';\n\ninterface ComponentContextValue {\n /**\n * The id of the component. It will be undefined if the component\n * has not been created in the database yet. This could be on a new\n * or existing entry.\n */\n id?: number;\n /**\n * The level of the component. This is used to determine the nesting\n * of the component. The default is set to -1 so that the base level is 0\n * for the top level component, and increases by 1 for each level of nesting.\n */\n level: number;\n /**\n * The uid of the component. This is used to determine the type of the\n * component. Within an attribute, it is normally the `component` value.\n * It will be undefined if the hook is not called within the confines\n * of a provider.\n */\n uid?: string;\n /**\n * The type of component parent. It will be undefined if the hook\n * is not called within the confines of a provider.\n */\n type?: 'dynamiczone' | 'repeatable' | 'component';\n}\n\n/**\n * We use this component to wrap any individual component field in the Edit View,\n * this could be a component field in a dynamic zone, a component within a repeatable space,\n * or even nested components.\n *\n * We primarily need this to provide the component id to the components so that they can\n * correctly fetch their relations.\n */\nconst [ComponentProvider, useComponent] = createContext<ComponentContextValue>('ComponentContext', {\n id: undefined,\n level: -1,\n uid: undefined,\n type: undefined,\n});\n\nexport { ComponentProvider, useComponent };\n","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 Tooltip,\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 { NavLink } from 'react-router-dom';\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 { useDoc } from '../../../../hooks/useDocument';\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';\n\nimport { useComponent } from './ComponentContext';\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 * -----------------------------------------------------------------------------------------------*/\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}\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 [currentPage, setCurrentPage] = React.useState(1);\n const { document, model: documentModel } = useDoc();\n const documentId = document?.documentId;\n const { formatMessage } = useIntl();\n const [{ query }] = useQueryParams();\n const 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 /**\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 id = componentId ? componentId.toString() : documentId;\n const model = componentUID ?? documentModel;\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 { data, isLoading, isFetching } = useGetRelationsQuery(\n {\n model,\n targetField,\n // below we don't run the query if there is no id.\n id: id!,\n params: {\n ...params,\n pageSize: RELATIONS_TO_DISPLAY,\n page: currentPage,\n },\n },\n {\n refetchOnMountOrArgChange: true,\n skip: !id,\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 ? (componentId ? `${componentId}` : '') : documentId}\n label={`${label} ${relationsCount > 0 ? `(${relationsCount})` : ''}`}\n model={model}\n onChange={handleConnect}\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 />\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 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 ...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\n const { formatMessage } = useIntl();\n const fieldRef = useFocusInputField<HTMLInputElement>(name);\n const field = useField<RelationsFormValue>(name);\n\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 searchForTrigger({\n model,\n targetField,\n params: {\n ...buildValidParams(query),\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 ...searchParams,\n },\n });\n }, [\n field.value?.connect,\n field.value?.disconnect,\n id,\n model,\n name,\n query,\n searchForTrigger,\n searchParams,\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}\n\nconst RelationsList = ({\n data,\n serverData,\n disabled,\n name,\n isLoading,\n relationType,\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'\n : 'draft',\n }\n : { end: true };\n\n const relationWithPosition: Relation = {\n ...relation,\n ...{\n apiData: {\n id: relation.id,\n documentId: relation.documentId,\n locale: relation.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 }}\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 };\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 } = data;\n const { formatMessage } = useIntl();\n\n const { href, id, label, status } = 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 <Tooltip description={label}>\n {href ? (\n <LinkEllipsis tag={NavLink} to={href} isExternal={false}>\n {label}\n </LinkEllipsis>\n ) : (\n <Typography textColor={disabled ? 'neutral600' : 'primary600'} ellipsis>\n {label}\n </Typography>\n )}\n </Tooltip>\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":["createContext","useField","useForm","React","useDoc","useIntl","useQueryParams","buildValidParams","id","useGetRelationsQuery","relations","COLLECTION_TYPES","pipe","generateNKeysBetween","getRelationLabel","jsxs","Flex","jsx","TextButton","ArrowClockwise","getTranslation","styled","useNotification","useFocusInputField","useLazySearchRelationsQuery","Field","Combobox","textValue","ComboboxOption","Typography","DocumentStatus","index","VisuallyHidden","FixedSizeList","Box","useDragAndDrop","ItemTypes","DROP_SENSITIVITY","useComposedRefs","getEmptyImage","IconButton","Drag","Tooltip","NavLink","Cross","Link"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAM,CAAC,mBAAmB,YAAY,IAAIA,YAAAA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IAAIX,qBAAe,qBAAqB;AAAA,kBACxC,gBAAgB;AAAA,gBAAA,CACjB;AAAA,gBACD,SAAQ;AAAA,gBACR,MAAK;AAAA,gBAEL,yCAACwB,MAAM,OAAA,EAAA;AAAA,cAAA;AAAA,YAAA,GAEX;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAIR;AAEM,MAAA,cAAcvB,iBAAAA,OAAsBL,aAAAA,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAU9C,MAAM,mBAAmBK,iBAAO,OAAA;AAAA;AAAA,YAEpB,CAAC,EAAE,OAAO,SAAS,MACzB,WAAW,MAAM,OAAO,aAAa,MAAM,OAAO,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,YAKtD,CAAC,EAAE,OAAO,eAAe,CAAC,YAAY,MAAM,OAAO,UAAU;AAAA;AAAA;AAInE,MAAA,eAAeA,iBAAAA,OAAOwB,aAAAA,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWhC,MAAM,0BAA0B,MAC9B5B,2BAAA;AAAA,EAACiB,aAAA;AAAA,EAAA;AAAA,IACC,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,aAAa;AAAA,IACb,cAAc;AAAA,IACd,WAAS;AAAA,IACT,aAAY;AAAA,IACZ,aAAY;AAAA,IACZ,aAAY;AAAA,IACZ,YAAW;AAAA,IACX,QAAQ,eAAe,eAAe;AAAA,EAAA;AACxC;AAGI,MAAA,yBAAyB/B,iBAAM,KAAK,cAAc;;;;;;;"}
@@ -106,6 +106,9 @@ const en = {
106
106
  "containers.Home.introduction": "To edit your entries go to the specific link in the left menu. This plugin doesn't have a proper way to edit settings and it's still under active development.",
107
107
  "containers.Home.pluginHeaderDescription": "Manage your entries through a powerful and beautiful interface.",
108
108
  "containers.Home.pluginHeaderTitle": "Content Manager",
109
+ "containers.List.draft": "Draft",
110
+ "containers.List.published": "Published",
111
+ "containers.List.modified": "Modified",
109
112
  "containers.list.displayedFields": "Displayed Fields",
110
113
  "containers.list.items": "{number} {number, plural, =0 {items} one {item} other {items}}",
111
114
  "containers.list.table.row-actions": "Row actions",
@@ -238,6 +241,8 @@ const en = {
238
241
  "popover.display-relations.label": "Display relations",
239
242
  "preview.panel.title": "Preview",
240
243
  "preview.panel.button": "Open preview",
244
+ "preview.page-title": "{contentType} preview",
245
+ "preview.header.close": "Close preview",
241
246
  "preview.copy.label": "Copy preview link",
242
247
  "preview.copy.success": "Copied preview link",
243
248
  "relation.add": "Add relation",
@@ -294,4 +299,4 @@ exports.default = en;
294
299
  exports.groups = groups;
295
300
  exports.models = models;
296
301
  exports.pageNotFound = pageNotFound;
297
- //# sourceMappingURL=en-Bdpa50w3.js.map
302
+ //# sourceMappingURL=en-CHOp_xJv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"en-Bdpa50w3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"en-CHOp_xJv.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -104,6 +104,9 @@ const en = {
104
104
  "containers.Home.introduction": "To edit your entries go to the specific link in the left menu. This plugin doesn't have a proper way to edit settings and it's still under active development.",
105
105
  "containers.Home.pluginHeaderDescription": "Manage your entries through a powerful and beautiful interface.",
106
106
  "containers.Home.pluginHeaderTitle": "Content Manager",
107
+ "containers.List.draft": "Draft",
108
+ "containers.List.published": "Published",
109
+ "containers.List.modified": "Modified",
107
110
  "containers.list.displayedFields": "Displayed Fields",
108
111
  "containers.list.items": "{number} {number, plural, =0 {items} one {item} other {items}}",
109
112
  "containers.list.table.row-actions": "Row actions",
@@ -236,6 +239,8 @@ const en = {
236
239
  "popover.display-relations.label": "Display relations",
237
240
  "preview.panel.title": "Preview",
238
241
  "preview.panel.button": "Open preview",
242
+ "preview.page-title": "{contentType} preview",
243
+ "preview.header.close": "Close preview",
239
244
  "preview.copy.label": "Copy preview link",
240
245
  "preview.copy.success": "Copied preview link",
241
246
  "relation.add": "Add relation",
@@ -294,4 +299,4 @@ export {
294
299
  models,
295
300
  pageNotFound
296
301
  };
297
- //# sourceMappingURL=en-CZw4xdPY.mjs.map
302
+ //# sourceMappingURL=en-D_BMf0hT.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"en-CZw4xdPY.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"en-D_BMf0hT.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1685,10 +1685,10 @@ const useDocumentActions = () => {
1685
1685
  update
1686
1686
  };
1687
1687
  };
1688
- const ProtectedHistoryPage = React.lazy(
1689
- () => Promise.resolve().then(() => require("./History-DKS2aqqM.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1688
+ const ProtectedHistoryPage = React__namespace.lazy(
1689
+ () => Promise.resolve().then(() => require("./History-DbdpigyF.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1690
1690
  );
1691
- const routes$1 = [
1691
+ const routes$2 = [
1692
1692
  {
1693
1693
  path: ":collectionType/:slug/:id/history",
1694
1694
  Component: ProtectedHistoryPage
@@ -1698,32 +1698,45 @@ const routes$1 = [
1698
1698
  Component: ProtectedHistoryPage
1699
1699
  }
1700
1700
  ];
1701
+ const ProtectedPreviewPage = React__namespace.lazy(
1702
+ () => Promise.resolve().then(() => require("./Preview-COsm52rZ.js")).then((mod) => ({ default: mod.ProtectedPreviewPage }))
1703
+ );
1704
+ const routes$1 = [
1705
+ {
1706
+ path: ":collectionType/:slug/:id/preview",
1707
+ Component: ProtectedPreviewPage
1708
+ },
1709
+ {
1710
+ path: ":collectionType/:slug/preview",
1711
+ Component: ProtectedPreviewPage
1712
+ }
1713
+ ];
1701
1714
  const ProtectedEditViewPage = React.lazy(
1702
- () => Promise.resolve().then(() => require("./EditViewPage-khfP2CR3.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1715
+ () => Promise.resolve().then(() => require("./EditViewPage-DoQm9llG.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1703
1716
  );
1704
1717
  const ProtectedListViewPage = React.lazy(
1705
- () => Promise.resolve().then(() => require("./ListViewPage-DlUpqLIo.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1718
+ () => Promise.resolve().then(() => require("./ListViewPage-CVIEfYWN.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1706
1719
  );
1707
1720
  const ProtectedListConfiguration = React.lazy(
1708
- () => Promise.resolve().then(() => require("./ListConfigurationPage-LSYSPZHH.js")).then((mod) => ({
1721
+ () => Promise.resolve().then(() => require("./ListConfigurationPage-DRGhXnUA.js")).then((mod) => ({
1709
1722
  default: mod.ProtectedListConfiguration
1710
1723
  }))
1711
1724
  );
1712
1725
  const ProtectedEditConfigurationPage = React.lazy(
1713
- () => Promise.resolve().then(() => require("./EditConfigurationPage-CFDe6SA1.js")).then((mod) => ({
1726
+ () => Promise.resolve().then(() => require("./EditConfigurationPage-Ds3BOL2z.js")).then((mod) => ({
1714
1727
  default: mod.ProtectedEditConfigurationPage
1715
1728
  }))
1716
1729
  );
1717
1730
  const ProtectedComponentConfigurationPage = React.lazy(
1718
- () => Promise.resolve().then(() => require("./ComponentConfigurationPage-CpJNPBgk.js")).then((mod) => ({
1731
+ () => Promise.resolve().then(() => require("./ComponentConfigurationPage-Cr0ttPAZ.js")).then((mod) => ({
1719
1732
  default: mod.ProtectedComponentConfigurationPage
1720
1733
  }))
1721
1734
  );
1722
1735
  const NoPermissions = React.lazy(
1723
- () => Promise.resolve().then(() => require("./NoPermissionsPage-DLfPsA0Q.js")).then((mod) => ({ default: mod.NoPermissions }))
1736
+ () => Promise.resolve().then(() => require("./NoPermissionsPage-pVeCVj9a.js")).then((mod) => ({ default: mod.NoPermissions }))
1724
1737
  );
1725
1738
  const NoContentType = React.lazy(
1726
- () => Promise.resolve().then(() => require("./NoContentTypePage-m8wt3sf6.js")).then((mod) => ({ default: mod.NoContentType }))
1739
+ () => Promise.resolve().then(() => require("./NoContentTypePage-CTcfA2-Q.js")).then((mod) => ({ default: mod.NoContentType }))
1727
1740
  );
1728
1741
  const CollectionTypePages = () => {
1729
1742
  const { collectionType } = reactRouterDom.useParams();
@@ -1735,7 +1748,7 @@ const CollectionTypePages = () => {
1735
1748
  const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
1736
1749
  const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
1737
1750
  const LIST_RELATIVE_PATH = ":collectionType/:slug";
1738
- const LIST_PATH = `/content-manager/${LIST_RELATIVE_PATH}`;
1751
+ const LIST_PATH = `/content-manager/collection-types/:slug`;
1739
1752
  const routes = [
1740
1753
  {
1741
1754
  path: LIST_RELATIVE_PATH,
@@ -1769,6 +1782,7 @@ const routes = [
1769
1782
  path: "no-content-types",
1770
1783
  Component: NoContentType
1771
1784
  },
1785
+ ...routes$2,
1772
1786
  ...routes$1
1773
1787
  ];
1774
1788
  const DocumentActions = ({ actions: actions2 }) => {
@@ -1930,43 +1944,25 @@ const DocumentActionsMenu = ({
1930
1944
  disabled: action.disabled,
1931
1945
  onSelect: handleClick(action),
1932
1946
  display: "block",
1933
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: [
1934
- /* @__PURE__ */ jsxRuntime.jsxs(
1935
- designSystem.Flex,
1936
- {
1937
- color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
1938
- gap: 2,
1939
- tag: "span",
1940
- children: [
1941
- /* @__PURE__ */ jsxRuntime.jsx(
1942
- designSystem.Flex,
1943
- {
1944
- tag: "span",
1945
- color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
1946
- children: action.icon
1947
- }
1948
- ),
1949
- action.label
1950
- ]
1951
- }
1952
- ),
1953
- action.id.startsWith("HistoryAction") && /* @__PURE__ */ jsxRuntime.jsx(
1954
- designSystem.Flex,
1955
- {
1956
- alignItems: "center",
1957
- background: "alternative100",
1958
- borderStyle: "solid",
1959
- borderColor: "alternative200",
1960
- borderWidth: "1px",
1961
- height: 5,
1962
- paddingLeft: 2,
1963
- paddingRight: 2,
1964
- hasRadius: true,
1965
- color: "alternative600",
1966
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", fontWeight: "bold", lineHeight: 1, children: formatMessage({ id: "global.new", defaultMessage: "New" }) })
1967
- }
1968
- )
1969
- ] })
1947
+ children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(
1948
+ designSystem.Flex,
1949
+ {
1950
+ color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
1951
+ gap: 2,
1952
+ tag: "span",
1953
+ children: [
1954
+ /* @__PURE__ */ jsxRuntime.jsx(
1955
+ designSystem.Flex,
1956
+ {
1957
+ tag: "span",
1958
+ color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
1959
+ children: action.icon
1960
+ }
1961
+ ),
1962
+ action.label
1963
+ ]
1964
+ }
1965
+ ) })
1970
1966
  },
1971
1967
  action.id
1972
1968
  );
@@ -2593,7 +2589,11 @@ const getDisplayName = ({
2593
2589
  const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
2594
2590
  const DocumentStatus = ({ status = "draft", ...restProps }) => {
2595
2591
  const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
2596
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps, showBullet: false, size: "S", variant: statusVariant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: capitalise(status) }) });
2592
+ const { formatMessage } = reactIntl.useIntl();
2593
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps, size: "S", variant: statusVariant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
2594
+ id: `content-manager.containers.List.${status}`,
2595
+ defaultMessage: capitalise(status)
2596
+ }) }) });
2597
2597
  };
2598
2598
  const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
2599
2599
  const { formatMessage } = reactIntl.useIntl();
@@ -4041,9 +4041,8 @@ const previewApi = contentManagerApi.injectEndpoints({
4041
4041
  const { useGetPreviewUrlQuery } = previewApi;
4042
4042
  const PreviewSidePanel = ({ model, documentId, document }) => {
4043
4043
  const { formatMessage } = reactIntl.useIntl();
4044
- const { toggleNotification } = strapiAdmin.useNotification();
4045
- const { copy } = strapiAdmin.useClipboard();
4046
4044
  const { trackUsage } = strapiAdmin.useTracking();
4045
+ const [{ query }] = strapiAdmin.useQueryParams();
4047
4046
  const { data, error } = useGetPreviewUrlQuery({
4048
4047
  params: {
4049
4048
  contentType: model
@@ -4057,51 +4056,25 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
4057
4056
  if (!data?.data?.url || error) {
4058
4057
  return null;
4059
4058
  }
4060
- const { url } = data.data;
4061
- const handleCopyLink = () => {
4062
- copy(url);
4063
- toggleNotification({
4064
- message: formatMessage({
4065
- id: "content-manager.preview.copy.success",
4066
- defaultMessage: "Copied preview link"
4067
- }),
4068
- type: "success"
4069
- });
4070
- };
4071
4059
  const handleClick = () => {
4072
4060
  trackUsage("willOpenPreview");
4073
4061
  };
4074
4062
  return {
4075
4063
  title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
4076
- content: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, width: "100%", children: [
4077
- /* @__PURE__ */ jsxRuntime.jsx(
4078
- designSystem.Button,
4079
- {
4080
- variant: "tertiary",
4081
- tag: reactRouterDom.Link,
4082
- to: url,
4083
- onClick: handleClick,
4084
- target: "_blank",
4085
- flex: "auto",
4086
- children: formatMessage({
4087
- id: "content-manager.preview.panel.button",
4088
- defaultMessage: "Open preview"
4089
- })
4090
- }
4091
- ),
4092
- /* @__PURE__ */ jsxRuntime.jsx(
4093
- designSystem.IconButton,
4094
- {
4095
- type: "button",
4096
- label: formatMessage({
4097
- id: "preview.copy.label",
4098
- defaultMessage: "Copy preview link"
4099
- }),
4100
- onClick: handleCopyLink,
4101
- children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Link, {})
4102
- }
4103
- )
4104
- ] })
4064
+ content: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
4065
+ designSystem.Button,
4066
+ {
4067
+ variant: "tertiary",
4068
+ tag: reactRouterDom.Link,
4069
+ to: { pathname: "preview", search: qs.stringify(query, { encode: false }) },
4070
+ onClick: handleClick,
4071
+ flex: "auto",
4072
+ children: formatMessage({
4073
+ id: "content-manager.preview.panel.button",
4074
+ defaultMessage: "Open preview"
4075
+ })
4076
+ }
4077
+ ) })
4105
4078
  };
4106
4079
  };
4107
4080
  const FEATURE_ID = "preview";
@@ -4133,7 +4106,7 @@ const index = {
4133
4106
  app.router.addRoute({
4134
4107
  path: "content-manager/*",
4135
4108
  lazy: async () => {
4136
- const { Layout } = await Promise.resolve().then(() => require("./layout-CmaemAO3.js"));
4109
+ const { Layout } = await Promise.resolve().then(() => require("./layout-9fI2_QJt.js"));
4137
4110
  return {
4138
4111
  Component: Layout
4139
4112
  };
@@ -4153,7 +4126,7 @@ const index = {
4153
4126
  async registerTrads({ locales }) {
4154
4127
  const importedTrads = await Promise.all(
4155
4128
  locales.map((locale) => {
4156
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-Bdpa50w3.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-9K52xZIr.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-B2Kyv8Z9.js")), "./translations/gu.json": () => Promise.resolve().then(() => require("./gu-BRmF601H.js")), "./translations/hi.json": () => Promise.resolve().then(() => require("./hi-CCJBptSq.js")), "./translations/hu.json": () => Promise.resolve().then(() => require("./hu-sNV_yLYy.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-B5Ser98A.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-DkBIs7vD.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-7sfIbjxE.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-woFZPmLk.js")), "./translations/ml.json": () => Promise.resolve().then(() => require("./ml-C2W8N8k1.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-BuFotyP_.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-bbEOHChV.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-uzwG-hk7.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-BiOz37D9.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CeXQuq50.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BT3ybNny.js")), "./translations/sa.json": () => Promise.resolve().then(() => require("./sa-CcvkYInH.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-CvY09Xjv.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-MYDuzgvT.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-D9_GfAjc.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-D9UH-O_R.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-C8EiqJY7.js")), "./translations/vi.json": () => Promise.resolve().then(() => require("./vi-CJlYDheJ.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-9kOncHGw.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CQQfszqR.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
4129
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-CHOp_xJv.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-9K52xZIr.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-B2Kyv8Z9.js")), "./translations/gu.json": () => Promise.resolve().then(() => require("./gu-BRmF601H.js")), "./translations/hi.json": () => Promise.resolve().then(() => require("./hi-CCJBptSq.js")), "./translations/hu.json": () => Promise.resolve().then(() => require("./hu-sNV_yLYy.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-B5Ser98A.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-DkBIs7vD.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-7sfIbjxE.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-woFZPmLk.js")), "./translations/ml.json": () => Promise.resolve().then(() => require("./ml-C2W8N8k1.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-BuFotyP_.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-bbEOHChV.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-uzwG-hk7.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-BiOz37D9.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CeXQuq50.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BT3ybNny.js")), "./translations/sa.json": () => Promise.resolve().then(() => require("./sa-CcvkYInH.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-CvY09Xjv.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-MYDuzgvT.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-D9_GfAjc.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-D9UH-O_R.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-C8EiqJY7.js")), "./translations/vi.json": () => Promise.resolve().then(() => require("./vi-CJlYDheJ.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-9kOncHGw.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CQQfszqR.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
4157
4130
  return {
4158
4131
  data: prefixPluginTranslations(data, PLUGIN_ID),
4159
4132
  locale
@@ -4211,5 +4184,6 @@ exports.useGetAllContentTypeSettingsQuery = useGetAllContentTypeSettingsQuery;
4211
4184
  exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
4212
4185
  exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
4213
4186
  exports.useGetInitialDataQuery = useGetInitialDataQuery;
4187
+ exports.useGetPreviewUrlQuery = useGetPreviewUrlQuery;
4214
4188
  exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
4215
- //# sourceMappingURL=index-DqZnjo8F.js.map
4189
+ //# sourceMappingURL=index-CJX65DLa.js.map