@strapi/content-manager 5.4.1 → 5.5.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 (109) hide show
  1. package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -1
  2. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-ClKl_TA2.js → ComponentConfigurationPage-BPiQrhZ6.js} +4 -5
  4. package/dist/_chunks/{ComponentConfigurationPage-ClKl_TA2.js.map → ComponentConfigurationPage-BPiQrhZ6.js.map} +1 -1
  5. package/dist/_chunks/{ComponentConfigurationPage-D3ZWDAHG.mjs → ComponentConfigurationPage-viOAdZM6.mjs} +3 -3
  6. package/dist/_chunks/{ComponentConfigurationPage-D3ZWDAHG.mjs.map → ComponentConfigurationPage-viOAdZM6.mjs.map} +1 -1
  7. package/dist/_chunks/{ComponentIcon-BXdiCGQp.js → ComponentIcon-CRbtQEUV.js} +2 -3
  8. package/dist/_chunks/{ComponentIcon-BXdiCGQp.js.map → ComponentIcon-CRbtQEUV.js.map} +1 -1
  9. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -1
  10. package/dist/_chunks/{EditConfigurationPage-OWez0Kxp.js → EditConfigurationPage-CZRKq8CN.js} +4 -5
  11. package/dist/_chunks/{EditConfigurationPage-OWez0Kxp.js.map → EditConfigurationPage-CZRKq8CN.js.map} +1 -1
  12. package/dist/_chunks/{EditConfigurationPage-BYCBSJxP.mjs → EditConfigurationPage-DKtPyjs_.mjs} +3 -3
  13. package/dist/_chunks/{EditConfigurationPage-BYCBSJxP.mjs.map → EditConfigurationPage-DKtPyjs_.mjs.map} +1 -1
  14. package/dist/_chunks/{EditViewPage-BEs5iGDi.js → EditViewPage-C-TZmK5r.js} +4 -5
  15. package/dist/_chunks/{EditViewPage-BEs5iGDi.js.map → EditViewPage-C-TZmK5r.js.map} +1 -1
  16. package/dist/_chunks/{EditViewPage-5pdbvsO_.mjs → EditViewPage-D2FPb5Mh.mjs} +3 -3
  17. package/dist/_chunks/{EditViewPage-5pdbvsO_.mjs.map → EditViewPage-D2FPb5Mh.mjs.map} +1 -1
  18. package/dist/_chunks/{Field-DNHm4wHx.js → Field-IMBnqF-k.js} +26 -46
  19. package/dist/_chunks/Field-IMBnqF-k.js.map +1 -0
  20. package/dist/_chunks/{Field-DcKuFHYK.mjs → Field-hD0Y00Mt.mjs} +25 -44
  21. package/dist/_chunks/Field-hD0Y00Mt.mjs.map +1 -0
  22. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
  23. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
  24. package/dist/_chunks/{Form-CoRxWJOz.js → Form-BaURS01O.js} +5 -6
  25. package/dist/_chunks/{Form-CoRxWJOz.js.map → Form-BaURS01O.js.map} +1 -1
  26. package/dist/_chunks/{Form-CGwM_-5c.mjs → Form-ZQ9fzWkd.mjs} +3 -3
  27. package/dist/_chunks/{Form-CGwM_-5c.mjs.map → Form-ZQ9fzWkd.mjs.map} +1 -1
  28. package/dist/_chunks/{History-BcUTQrfG.js → History-BqRQm2Lc.js} +6 -7
  29. package/dist/_chunks/History-BqRQm2Lc.js.map +1 -0
  30. package/dist/_chunks/{History-DEvr3Q_V.mjs → History-C4X3jiQJ.mjs} +5 -5
  31. package/dist/_chunks/History-C4X3jiQJ.mjs.map +1 -0
  32. package/dist/_chunks/{ListConfigurationPage-BE_Ho7tV.js → ListConfigurationPage-BT69-TvF.js} +4 -5
  33. package/dist/_chunks/{ListConfigurationPage-BE_Ho7tV.js.map → ListConfigurationPage-BT69-TvF.js.map} +1 -1
  34. package/dist/_chunks/{ListConfigurationPage-BM4zZZcM.mjs → ListConfigurationPage-CwMU6tWQ.mjs} +3 -3
  35. package/dist/_chunks/{ListConfigurationPage-BM4zZZcM.mjs.map → ListConfigurationPage-CwMU6tWQ.mjs.map} +1 -1
  36. package/dist/_chunks/{ListViewPage-BkT8Eao0.js → ListViewPage-CYkrfWsm.js} +51 -51
  37. package/dist/_chunks/ListViewPage-CYkrfWsm.js.map +1 -0
  38. package/dist/_chunks/{ListViewPage-BK2mkrql.mjs → ListViewPage-CvxfiNTc.mjs} +50 -49
  39. package/dist/_chunks/ListViewPage-CvxfiNTc.mjs.map +1 -0
  40. package/dist/_chunks/{NoContentTypePage-C8mtyc4H.js → NoContentTypePage-BZMfRsrg.js} +2 -2
  41. package/dist/_chunks/{NoContentTypePage-C8mtyc4H.js.map → NoContentTypePage-BZMfRsrg.js.map} +1 -1
  42. package/dist/_chunks/{NoContentTypePage-BvcAutu9.mjs → NoContentTypePage-Dy6sa9LT.mjs} +2 -2
  43. package/dist/_chunks/{NoContentTypePage-BvcAutu9.mjs.map → NoContentTypePage-Dy6sa9LT.mjs.map} +1 -1
  44. package/dist/_chunks/{NoPermissionsPage-BmbRz7PR.mjs → NoPermissionsPage-DiW-TIzq.mjs} +2 -2
  45. package/dist/_chunks/{NoPermissionsPage-BmbRz7PR.mjs.map → NoPermissionsPage-DiW-TIzq.mjs.map} +1 -1
  46. package/dist/_chunks/{NoPermissionsPage-B5Y9Y78B.js → NoPermissionsPage-DjUdvhJ6.js} +2 -2
  47. package/dist/_chunks/{NoPermissionsPage-B5Y9Y78B.js.map → NoPermissionsPage-DjUdvhJ6.js.map} +1 -1
  48. package/dist/_chunks/{Preview-BF8ZDYqS.js → Preview-BqRUSbFU.js} +17 -7
  49. package/dist/_chunks/Preview-BqRUSbFU.js.map +1 -0
  50. package/dist/_chunks/{Preview-DcexhKJE.mjs → Preview-DwWET-X7.mjs} +17 -6
  51. package/dist/_chunks/Preview-DwWET-X7.mjs.map +1 -0
  52. package/dist/_chunks/{Relations-BjIzc4EK.mjs → Relations-BOTC_ZqE.mjs} +6 -8
  53. package/dist/_chunks/{Relations-BjIzc4EK.mjs.map → Relations-BOTC_ZqE.mjs.map} +1 -1
  54. package/dist/_chunks/{Relations-BKnoK1R0.js → Relations-DnCdLzq_.js} +7 -10
  55. package/dist/_chunks/{Relations-BKnoK1R0.js.map → Relations-DnCdLzq_.js.map} +1 -1
  56. package/dist/_chunks/{en-DTWPCdTS.js → en-BK8Xyl5I.js} +3 -2
  57. package/dist/_chunks/{en-DTWPCdTS.js.map → en-BK8Xyl5I.js.map} +1 -1
  58. package/dist/_chunks/{en-CfIXaZf9.mjs → en-Dtk_ot79.mjs} +3 -2
  59. package/dist/_chunks/{en-CfIXaZf9.mjs.map → en-Dtk_ot79.mjs.map} +1 -1
  60. package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
  61. package/dist/_chunks/{index-BW-rXkjn.mjs → index-BeYsz0Vi.mjs} +89 -51
  62. package/dist/_chunks/index-BeYsz0Vi.mjs.map +1 -0
  63. package/dist/_chunks/{index-DOzAG2cq.js → index-CptTdHNy.js} +90 -53
  64. package/dist/_chunks/index-CptTdHNy.js.map +1 -0
  65. package/dist/_chunks/{layout-DFVbgjp2.mjs → layout-CzSSEy9b.mjs} +4 -4
  66. package/dist/_chunks/{layout-DFVbgjp2.mjs.map → layout-CzSSEy9b.mjs.map} +1 -1
  67. package/dist/_chunks/{layout-RC3W2obV.js → layout-szfTCeYm.js} +5 -6
  68. package/dist/_chunks/{layout-RC3W2obV.js.map → layout-szfTCeYm.js.map} +1 -1
  69. package/dist/_chunks/objects-BcXOv6_9.js.map +1 -1
  70. package/dist/_chunks/objects-D6yBsdmx.mjs.map +1 -1
  71. package/dist/_chunks/{relations-Dogh8HWI.mjs → relations-DvzmDbWc.mjs} +2 -2
  72. package/dist/_chunks/{relations-Dogh8HWI.mjs.map → relations-DvzmDbWc.mjs.map} +1 -1
  73. package/dist/_chunks/{relations-zam7-5H7.js → relations-qssSbh1V.js} +2 -2
  74. package/dist/_chunks/{relations-zam7-5H7.js.map → relations-qssSbh1V.js.map} +1 -1
  75. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -1
  76. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -1
  77. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
  78. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
  79. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
  80. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
  81. package/dist/admin/index.js +1 -1
  82. package/dist/admin/index.mjs +1 -1
  83. package/dist/admin/src/content-manager.d.ts +3 -2
  84. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
  85. package/dist/admin/src/services/documents.d.ts +0 -3
  86. package/dist/server/index.js +74 -45
  87. package/dist/server/index.js.map +1 -1
  88. package/dist/server/index.mjs +74 -44
  89. package/dist/server/index.mjs.map +1 -1
  90. package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -1
  91. package/dist/server/src/preview/index.d.ts.map +1 -1
  92. package/dist/server/src/preview/services/index.d.ts +1 -0
  93. package/dist/server/src/preview/services/index.d.ts.map +1 -1
  94. package/dist/server/src/preview/services/preview-config.d.ts +2 -0
  95. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -1
  96. package/dist/server/src/preview/utils.d.ts +1 -0
  97. package/dist/server/src/preview/utils.d.ts.map +1 -1
  98. package/dist/server/src/register.d.ts.map +1 -1
  99. package/package.json +9 -9
  100. package/dist/_chunks/Field-DNHm4wHx.js.map +0 -1
  101. package/dist/_chunks/Field-DcKuFHYK.mjs.map +0 -1
  102. package/dist/_chunks/History-BcUTQrfG.js.map +0 -1
  103. package/dist/_chunks/History-DEvr3Q_V.mjs.map +0 -1
  104. package/dist/_chunks/ListViewPage-BK2mkrql.mjs.map +0 -1
  105. package/dist/_chunks/ListViewPage-BkT8Eao0.js.map +0 -1
  106. package/dist/_chunks/Preview-BF8ZDYqS.js.map +0 -1
  107. package/dist/_chunks/Preview-DcexhKJE.mjs.map +0 -1
  108. package/dist/_chunks/index-BW-rXkjn.mjs.map +0 -1
  109. package/dist/_chunks/index-DOzAG2cq.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Preview-DwWET-X7.mjs","sources":["../../admin/src/preview/components/PreviewContent.tsx","../../admin/src/preview/components/PreviewHeader.tsx","../../admin/src/preview/pages/Preview.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Box } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { usePreviewContext } from '../pages/Preview';\n\nconst PreviewContent = () => {\n const previewUrl = usePreviewContext('PreviewContent', (state) => state.url);\n\n const { formatMessage } = useIntl();\n\n return (\n <Box\n src={previewUrl}\n title={formatMessage({\n id: 'content-manager.preview.panel.title',\n defaultMessage: 'Preview',\n })}\n width=\"100%\"\n height=\"100%\"\n borderWidth={0}\n tag=\"iframe\"\n />\n );\n};\n\nexport { PreviewContent };\n","import * as React from 'react';\n\nimport { useClipboard, useNotification, useQueryParams } from '@strapi/admin/strapi-admin';\nimport { IconButton, Tabs, Typography, Grid } from '@strapi/design-system';\nimport { Cross, Link as LinkIcon } from '@strapi/icons';\nimport { stringify } from 'qs';\nimport { useIntl } from 'react-intl';\nimport { Link } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { DocumentStatus } from '../../pages/EditView/components/DocumentStatus';\nimport { getDocumentStatus } from '../../pages/EditView/EditViewPage';\nimport { usePreviewContext } from '../pages/Preview';\n\n/* -------------------------------------------------------------------------------------------------\n * ClosePreviewButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst ClosePreviewButton = () => {\n const [{ query }] = useQueryParams<{\n plugins?: Record<string, unknown>;\n }>();\n const { formatMessage } = useIntl();\n\n return (\n <IconButton\n tag={Link}\n relative=\"path\"\n to={{\n pathname: '..',\n search: stringify({ plugins: query.plugins }, { encode: false }),\n }}\n label={formatMessage({\n id: 'content-manager.preview.header.close',\n defaultMessage: 'Close preview',\n })}\n >\n <Cross />\n </IconButton>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Status\n * -----------------------------------------------------------------------------------------------*/\n\nconst Status = () => {\n // Get status\n const document = usePreviewContext('PreviewHeader', (state) => state.document);\n const schema = usePreviewContext('PreviewHeader', (state) => state.schema);\n const meta = usePreviewContext('PreviewHeader', (state) => state.meta);\n const hasDraftAndPublished = schema?.options?.draftAndPublish ?? false;\n\n if (!hasDraftAndPublished) {\n return null;\n }\n\n const status = getDocumentStatus(document, meta);\n\n return <DocumentStatus status={status} size=\"XS\" />;\n};\n\nconst PreviewTabs = () => {\n const { formatMessage } = useIntl();\n\n // URL query params\n const [{ query }, setQuery] = useQueryParams<{ status: 'draft' | 'published' }>();\n\n // Get status\n const document = usePreviewContext('PreviewHeader', (state) => state.document);\n const schema = usePreviewContext('PreviewHeader', (state) => state.schema);\n const meta = usePreviewContext('PreviewHeader', (state) => state.meta);\n const hasDraftAndPublish = schema?.options?.draftAndPublish ?? false;\n const documentStatus = getDocumentStatus(document, meta);\n\n const handleTabChange = (status: string) => {\n if (status === 'published' || status === 'draft') {\n setQuery({ status }, 'push', true);\n }\n };\n\n if (!hasDraftAndPublish) {\n return null;\n }\n\n return (\n <>\n <Tabs.Root variant=\"simple\" value={query.status || 'draft'} onValueChange={handleTabChange}>\n <Tabs.List\n aria-label={formatMessage({\n id: 'preview.tabs.label',\n defaultMessage: 'Document status',\n })}\n >\n <StatusTab value=\"draft\">\n {formatMessage({\n id: 'content-manager.containers.List.draft',\n defaultMessage: 'draft',\n })}\n </StatusTab>\n <StatusTab value=\"published\" disabled={documentStatus === 'draft'}>\n {formatMessage({\n id: 'content-manager.containers.List.published',\n defaultMessage: 'published',\n })}\n </StatusTab>\n </Tabs.List>\n </Tabs.Root>\n </>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PreviewHeader\n * -----------------------------------------------------------------------------------------------*/\n\nconst PreviewHeader = () => {\n // Get main field\n const mainField = usePreviewContext('PreviewHeader', (state) => state.mainField);\n const document = usePreviewContext('PreviewHeader', (state) => state.document);\n const schema = usePreviewContext('PreviewHeader', (state) => state.schema);\n\n /**\n * We look to see what the mainField is from the configuration, if it's an id\n * we don't use it because it's a uuid format and not very user friendly.\n * Instead, we display the schema name for single-type documents\n * or \"Untitled\".\n */\n let documentTitle = 'Untitled';\n if (mainField !== 'id' && document?.[mainField]) {\n documentTitle = document[mainField];\n } else if (schema.kind === 'singleType' && schema?.info.displayName) {\n documentTitle = schema.info.displayName;\n }\n\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { copy } = useClipboard();\n\n const handleCopyLink = () => {\n copy(window.location.href);\n toggleNotification({\n message: formatMessage({\n id: 'content-manager.preview.copy.success',\n defaultMessage: 'Copied preview link',\n }),\n type: 'success',\n });\n };\n\n return (\n <Grid.Root\n gap={3}\n gridCols={3}\n paddingLeft={2}\n paddingRight={2}\n background=\"neutral0\"\n borderColor=\"neutral150\"\n tag=\"header\"\n >\n {/* Title and status */}\n <Grid.Item xs={1} paddingTop={2} paddingBottom={2} gap={3}>\n <ClosePreviewButton />\n <PreviewTitle tag=\"h1\" fontWeight={600} fontSize={2} maxWidth=\"200px\" title={documentTitle}>\n {documentTitle}\n </PreviewTitle>\n <Status />\n </Grid.Item>\n {/* Tabs */}\n <Grid.Item xs={1} marginBottom=\"-1px\" alignItems=\"end\" margin=\"auto\">\n <PreviewTabs />\n </Grid.Item>\n {/* Copy link */}\n <Grid.Item xs={1} justifyContent=\"end\" paddingTop={2} paddingBottom={2}>\n <IconButton\n type=\"button\"\n label={formatMessage({\n id: 'preview.copy.label',\n defaultMessage: 'Copy preview link',\n })}\n onClick={handleCopyLink}\n >\n <LinkIcon />\n </IconButton>\n </Grid.Item>\n </Grid.Root>\n );\n};\n\nconst PreviewTitle = styled(Typography)`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst StatusTab = styled(Tabs.Trigger)`\n text-transform: uppercase;\n`;\n\nexport { PreviewHeader };\n","import * as React from 'react';\n\nimport { Page, useQueryParams, useRBAC, createContext } from '@strapi/admin/strapi-admin';\nimport { Box, Flex, FocusTrap, Portal } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport { useParams } from 'react-router-dom';\n\nimport { GetPreviewUrl } from '../../../../shared/contracts/preview';\nimport { COLLECTION_TYPES } from '../../constants/collections';\nimport { DocumentRBAC } from '../../features/DocumentRBAC';\nimport { type UseDocument, useDocument } from '../../hooks/useDocument';\nimport { useDocumentLayout } from '../../hooks/useDocumentLayout';\nimport { buildValidParams } from '../../utils/api';\nimport { PreviewContent } from '../components/PreviewContent';\nimport { PreviewHeader } from '../components/PreviewHeader';\nimport { useGetPreviewUrlQuery } from '../services/preview';\n\nimport type { UID } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * PreviewProvider\n * -----------------------------------------------------------------------------------------------*/\n\ninterface PreviewContextValue {\n url: string;\n mainField: string;\n document: NonNullable<ReturnType<UseDocument>['document']>;\n meta: NonNullable<ReturnType<UseDocument>['meta']>;\n schema: NonNullable<ReturnType<UseDocument>['schema']>;\n}\n\nconst [PreviewProvider, usePreviewContext] = createContext<PreviewContextValue>('PreviewPage');\n\n/* -------------------------------------------------------------------------------------------------\n * PreviewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst PreviewPage = () => {\n const { formatMessage } = useIntl();\n\n // Read all the necessary data from the URL to find the right preview URL\n const {\n slug: model,\n id: documentId,\n collectionType,\n } = useParams<{\n slug: UID.ContentType;\n id: string;\n collectionType: string;\n }>();\n const [{ query }] = useQueryParams<{\n plugins?: Record<string, unknown>;\n }>();\n\n const params = React.useMemo(() => buildValidParams(query), [query]);\n\n if (!collectionType) {\n throw new Error('Could not find collectionType in url params');\n }\n\n if (!model) {\n throw new Error('Could not find model in url params');\n }\n\n // Only collection types must have a documentId\n if (collectionType === COLLECTION_TYPES && !documentId) {\n throw new Error('Could not find documentId in url params');\n }\n\n const previewUrlResponse = useGetPreviewUrlQuery({\n params: {\n contentType: model,\n },\n query: {\n documentId,\n locale: params.locale,\n status: params.status as GetPreviewUrl.Request['query']['status'],\n },\n });\n\n const documentResponse = useDocument({\n model,\n collectionType,\n documentId,\n params,\n });\n\n const documentLayoutResponse = useDocumentLayout(model);\n\n if (\n documentResponse.isLoading ||\n previewUrlResponse.isLoading ||\n documentLayoutResponse.isLoading\n ) {\n return <Page.Loading />;\n }\n\n if (\n previewUrlResponse.error ||\n documentLayoutResponse.error ||\n !documentResponse.document ||\n !documentResponse.meta ||\n !documentResponse.schema\n ) {\n return <Page.Error />;\n }\n\n if (!previewUrlResponse.data?.data?.url) {\n return <Page.NoData />;\n }\n\n return (\n <>\n <Page.Title>\n {formatMessage(\n {\n id: 'content-manager.preview.page-title',\n defaultMessage: '{contentType} preview',\n },\n {\n contentType: documentLayoutResponse.edit.settings.displayName,\n }\n )}\n </Page.Title>\n <PreviewProvider\n url={previewUrlResponse.data.data.url}\n mainField={documentLayoutResponse.edit.settings.mainField}\n document={documentResponse.document}\n meta={documentResponse.meta}\n schema={documentResponse.schema}\n >\n <Flex direction=\"column\" height=\"100%\" alignItems={'stretch'}>\n <PreviewHeader />\n <PreviewContent />\n </Flex>\n </PreviewProvider>\n </>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ProtectedPreviewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedPreviewPageImpl = () => {\n const { slug: model } = useParams<{\n slug: string;\n }>();\n const {\n permissions = [],\n isLoading,\n error,\n } = useRBAC([{ action: 'plugin::content-manager.explorer.read', subject: model }]);\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (error || !model) {\n return (\n <Box\n height=\"100vh\"\n width=\"100vw\"\n position=\"fixed\"\n top={0}\n left={0}\n zIndex={2}\n background=\"neutral0\"\n >\n <Page.Error />\n </Box>\n );\n }\n\n return (\n <Box\n height=\"100vh\"\n width=\"100vw\"\n position=\"fixed\"\n top={0}\n left={0}\n zIndex={2}\n background=\"neutral0\"\n >\n <Page.Protect permissions={permissions}>\n {({ permissions }) => (\n <DocumentRBAC permissions={permissions}>\n <PreviewPage />\n </DocumentRBAC>\n )}\n </Page.Protect>\n </Box>\n );\n};\n\nconst ProtectedPreviewPage = () => {\n return (\n <Portal>\n <FocusTrap>\n <ProtectedPreviewPageImpl />\n </FocusTrap>\n </Portal>\n );\n};\n\nexport { ProtectedPreviewPage, usePreviewContext };\n"],"names":["Link","LinkIcon","permissions"],"mappings":";;;;;;;;;;;AAOA,MAAM,iBAAiB,MAAM;AAC3B,QAAM,aAAa,kBAAkB,kBAAkB,CAAC,UAAU,MAAM,GAAG;AAErE,QAAA,EAAE,cAAc,IAAI,QAAQ;AAGhC,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,OAAO,cAAc;AAAA,QACnB,IAAI;AAAA,QACJ,gBAAgB;AAAA,MAAA,CACjB;AAAA,MACD,OAAM;AAAA,MACN,QAAO;AAAA,MACP,aAAa;AAAA,MACb,KAAI;AAAA,IAAA;AAAA,EACN;AAEJ;ACPA,MAAM,qBAAqB,MAAM;AAC/B,QAAM,CAAC,EAAE,OAAO,IAAI,eAEjB;AACG,QAAA,EAAE,cAAc,IAAI,QAAQ;AAGhC,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAKA;AAAAA,MACL,UAAS;AAAA,MACT,IAAI;AAAA,QACF,UAAU;AAAA,QACV,QAAQ,UAAU,EAAE,SAAS,MAAM,WAAW,EAAE,QAAQ,MAAO,CAAA;AAAA,MACjE;AAAA,MACA,OAAO,cAAc;AAAA,QACnB,IAAI;AAAA,QACJ,gBAAgB;AAAA,MAAA,CACjB;AAAA,MAED,8BAAC,OAAM,CAAA,CAAA;AAAA,IAAA;AAAA,EACT;AAEJ;AAMA,MAAM,SAAS,MAAM;AAEnB,QAAM,WAAW,kBAAkB,iBAAiB,CAAC,UAAU,MAAM,QAAQ;AAC7E,QAAM,SAAS,kBAAkB,iBAAiB,CAAC,U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;AAEJ;AAMA,MAAM,2BAA2B,MAAM;AACrC,QAAM,EAAE,MAAM,MAAM,IAAI,UAErB;AACG,QAAA;AAAA,IACJ,cAAc,CAAC;AAAA,IACf;AAAA,IACA;AAAA,EAAA,IACE,QAAQ,CAAC,EAAE,QAAQ,yCAAyC,SAAS,MAAM,CAAC,CAAC;AAEjF,MAAI,WAAW;AACN,WAAA,oBAAC,KAAK,SAAL,EAAa;AAAA,EAAA;AAGnB,MAAA,SAAS,CAAC,OAAO;AAEjB,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,QAAO;AAAA,QACP,OAAM;AAAA,QACN,UAAS;AAAA,QACT,KAAK;AAAA,QACL,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,YAAW;AAAA,QAEX,UAAA,oBAAC,KAAK,OAAL,CAAW,CAAA;AAAA,MAAA;AAAA,IACd;AAAA,EAAA;AAKF,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,QAAO;AAAA,MACP,OAAM;AAAA,MACN,UAAS;AAAA,MACT,KAAK;AAAA,MACL,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,YAAW;AAAA,MAEX,8BAAC,KAAK,SAAL,EAAa,aACX,WAAC,EAAE,aAAAC,aAAY,0BACb,cAAa,EAAA,aAAaA,cACzB,UAAC,oBAAA,aAAA,EAAY,GACf,EAEJ,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;AAEA,MAAM,uBAAuB,MAAM;AACjC,6BACG,QACC,EAAA,UAAA,oBAAC,aACC,UAAC,oBAAA,0BAAA,EAAyB,GAC5B,EACF,CAAA;AAEJ;"}
@@ -10,9 +10,9 @@ import { useIntl } from "react-intl";
10
10
  import { NavLink } from "react-router-dom";
11
11
  import { FixedSizeList } from "react-window";
12
12
  import { styled } from "styled-components";
13
- import { c as useDoc, d as buildValidParams, C as COLLECTION_TYPES, g as getTranslation, D as DocumentStatus } from "./index-BW-rXkjn.mjs";
14
- import { u as useDragAndDrop, I as ItemTypes, D as DROP_SENSITIVITY } from "./useDragAndDrop-DdHgKsqq.mjs";
15
- import { u as useGetRelationsQuery, g as getRelationLabel, a as useLazySearchRelationsQuery } from "./relations-Dogh8HWI.mjs";
13
+ import { c as useDoc, d as buildValidParams, C as COLLECTION_TYPES, g as getTranslation, D as DocumentStatus } from "./index-BeYsz0Vi.mjs";
14
+ import { u as useDragAndDrop, I as ItemTypes, D as DROP_SENSITIVITY } from "./useDragAndDrop-DJ6jqvZN.mjs";
15
+ import { u as useGetRelationsQuery, g as getRelationLabel, a as useLazySearchRelationsQuery } from "./relations-DvzmDbWc.mjs";
16
16
  const [ComponentProvider, useComponent] = createContext("ComponentContext", {
17
17
  id: void 0,
18
18
  level: -1,
@@ -118,10 +118,8 @@ const RelationsField = React.forwardRef(
118
118
  );
119
119
  const transformedRels = transformations([...data.results]);
120
120
  return [...transformedRels, ...field.value?.connect ?? []].sort((a, b) => {
121
- if (a.__temp_key__ < b.__temp_key__)
122
- return -1;
123
- if (a.__temp_key__ > b.__temp_key__)
124
- return 1;
121
+ if (a.__temp_key__ < b.__temp_key__) return -1;
122
+ if (a.__temp_key__ > b.__temp_key__) return 1;
125
123
  return 0;
126
124
  });
127
125
  }, [
@@ -727,4 +725,4 @@ export {
727
725
  MemoizedRelationsField as M,
728
726
  useComponent as u
729
727
  };
730
- //# sourceMappingURL=Relations-BjIzc4EK.mjs.map
728
+ //# sourceMappingURL=Relations-BOTC_ZqE.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Relations-BjIzc4EK.mjs","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":["id","textValue"],"mappings":";;;;;;;;;;;;;;;AAqCA,MAAM,CAAC,mBAAmB,YAAY,IAAI,cAAqC,oBAAoB;AAA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,IACZ,aAAY;AAAA,IACZ,YAAW;AAAA,IACX,QAAQ,eAAe,eAAe;AAAA,EAAA;AACxC;AAGI,MAAA,yBAAyB,MAAM,KAAK,cAAc;"}
1
+ {"version":3,"file":"Relations-BOTC_ZqE.mjs","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":["id","textValue"],"mappings":";;;;;;;;;;;;;;;AAqCA,MAAM,CAAC,mBAAmB,YAAY,IAAI,cAAqC,oBAAoB;AAAA,EACjG,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AACR,CAAC;ACsBD,SAAS,oBAAoB,WAAmB,cAAsB;AAC9D,QAAA,QAAQ,SAAS,SAAS;AAChC,QAAM,iBAAiB,QAAQ,cAAc,CAAC,UAAU,MAAM,cAAc;AAC5E,QAAM,cAAc,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,CAAC,QAA4D,IAAI,OAAO,SAAS;AAAA,MACnF;AAEA,UAAI,iCAAiC,GAAG;AACvB,uBAAA,GAAG,SAAS,YAAY,6BAA6B;AACpE;AAAA,MAAA;AAAA,IACF;AAGU,gBAAA,GAAG,SAAS,eAAe;AAAA,MACrC,IAAI,SAAS;AAAA,MACb,SAAS;AAAA,QACP,IAAI,SAAS;AAAA,QACb,YAAY,SAAS;AAAA,QACrB,QAAQ,SAAS;AAAA,MAAA;AAAA,IACnB,CACD;AAAA,EACH;AAEO,SAAA;AACT;AAKA,MAAM,uBAAuB;AAC7B,MAAM,oBAAoB,CAAC,UAAU,YAA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AAA,IACF;AAAA,EAEJ;AAEJ;AAEM,MAAA,cAAc,OAAsB,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAU9C,MAAM,mBAAmB,OAAO;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,eAAe,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWhC,MAAM,0BAA0B,MAC9B;AAAA,EAAC;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,MAAM,KAAK,cAAc;"}
@@ -11,13 +11,12 @@ const reactIntl = require("react-intl");
11
11
  const reactRouterDom = require("react-router-dom");
12
12
  const reactWindow = require("react-window");
13
13
  const styledComponents = require("styled-components");
14
- const index = require("./index-DOzAG2cq.js");
15
- const useDragAndDrop = require("./useDragAndDrop-J0TUUbR6.js");
16
- const relations = require("./relations-zam7-5H7.js");
14
+ const index = require("./index-CptTdHNy.js");
15
+ const useDragAndDrop = require("./useDragAndDrop-BMtgCYzL.js");
16
+ const relations = require("./relations-qssSbh1V.js");
17
17
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
18
18
  function _interopNamespace(e) {
19
- if (e && e.__esModule)
20
- return e;
19
+ if (e && e.__esModule) return e;
21
20
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
22
21
  if (e) {
23
22
  for (const k in e) {
@@ -140,10 +139,8 @@ const RelationsField = React__namespace.forwardRef(
140
139
  );
141
140
  const transformedRels = transformations([...data.results]);
142
141
  return [...transformedRels, ...field.value?.connect ?? []].sort((a, b) => {
143
- if (a.__temp_key__ < b.__temp_key__)
144
- return -1;
145
- if (a.__temp_key__ > b.__temp_key__)
146
- return 1;
142
+ if (a.__temp_key__ < b.__temp_key__) return -1;
143
+ if (a.__temp_key__ > b.__temp_key__) return 1;
147
144
  return 0;
148
145
  });
149
146
  }, [
@@ -747,4 +744,4 @@ exports.FlexWrapper = FlexWrapper;
747
744
  exports.LinkEllipsis = LinkEllipsis;
748
745
  exports.MemoizedRelationsField = MemoizedRelationsField;
749
746
  exports.useComponent = useComponent;
750
- //# sourceMappingURL=Relations-BKnoK1R0.js.map
747
+ //# sourceMappingURL=Relations-DnCdLzq_.js.map