@strapi/content-manager 5.12.3 → 5.12.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/components/Widgets.js +161 -0
- package/dist/admin/components/Widgets.js.map +1 -0
- package/dist/admin/components/Widgets.mjs +158 -0
- package/dist/admin/components/Widgets.mjs.map +1 -0
- package/dist/admin/content-manager.js.map +1 -1
- package/dist/admin/content-manager.mjs.map +1 -1
- package/dist/admin/history/pages/History.js +1 -9
- package/dist/admin/history/pages/History.js.map +1 -1
- package/dist/admin/history/pages/History.mjs +1 -9
- package/dist/admin/history/pages/History.mjs.map +1 -1
- package/dist/admin/hooks/useDocumentActions.js +8 -1
- package/dist/admin/hooks/useDocumentActions.js.map +1 -1
- package/dist/admin/hooks/useDocumentActions.mjs +8 -1
- package/dist/admin/hooks/useDocumentActions.mjs.map +1 -1
- package/dist/admin/hooks/useDocumentContext.js +57 -0
- package/dist/admin/hooks/useDocumentContext.js.map +1 -0
- package/dist/admin/hooks/useDocumentContext.mjs +36 -0
- package/dist/admin/hooks/useDocumentContext.mjs.map +1 -0
- package/dist/admin/index.js +41 -2
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +42 -3
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/pages/EditView/EditViewPage.js +85 -93
- package/dist/admin/pages/EditView/EditViewPage.js.map +1 -1
- package/dist/admin/pages/EditView/EditViewPage.mjs +86 -94
- package/dist/admin/pages/EditView/EditViewPage.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/DocumentActions.js +28 -32
- package/dist/admin/pages/EditView/components/DocumentActions.js.map +1 -1
- package/dist/admin/pages/EditView/components/DocumentActions.mjs +32 -36
- package/dist/admin/pages/EditView/components/DocumentActions.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Input.js +2 -2
- package/dist/admin/pages/EditView/components/FormInputs/Component/Input.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Input.mjs +2 -2
- package/dist/admin/pages/EditView/components/FormInputs/Component/Input.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.js +2 -2
- package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.mjs +2 -2
- package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.js +2 -2
- package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.mjs +2 -2
- package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js +5 -16
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs +5 -16
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js +2 -3
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs +2 -3
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js +432 -344
- package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs +432 -346
- package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js +55 -37
- package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs +57 -39
- package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/UID.js +7 -7
- package/dist/admin/pages/EditView/components/FormInputs/UID.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/UID.mjs +7 -7
- package/dist/admin/pages/EditView/components/FormInputs/UID.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/InputRenderer.js +3 -10
- package/dist/admin/pages/EditView/components/InputRenderer.js.map +1 -1
- package/dist/admin/pages/EditView/components/InputRenderer.mjs +3 -10
- package/dist/admin/pages/EditView/components/InputRenderer.mjs.map +1 -1
- package/dist/admin/preview/components/PreviewHeader.js +2 -5
- package/dist/admin/preview/components/PreviewHeader.js.map +1 -1
- package/dist/admin/preview/components/PreviewHeader.mjs +2 -5
- package/dist/admin/preview/components/PreviewHeader.mjs.map +1 -1
- package/dist/admin/preview/pages/Preview.js +94 -102
- package/dist/admin/preview/pages/Preview.js.map +1 -1
- package/dist/admin/preview/pages/Preview.mjs +94 -102
- package/dist/admin/preview/pages/Preview.mjs.map +1 -1
- package/dist/admin/services/homepage.js +26 -0
- package/dist/admin/services/homepage.js.map +1 -0
- package/dist/admin/services/homepage.mjs +24 -0
- package/dist/admin/services/homepage.mjs.map +1 -0
- package/dist/admin/src/components/Widgets.d.ts +3 -0
- package/dist/admin/src/content-manager.d.ts +0 -3
- package/dist/admin/src/features/DocumentRBAC.d.ts +1 -1
- package/dist/admin/src/history/pages/History.d.ts +1 -1
- package/dist/admin/src/hooks/useDocumentContext.d.ts +30 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/ComponentContext.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/Relations/RelationModal.d.ts +50 -5
- package/dist/admin/src/pages/EditView/components/FormInputs/Relations/Relations.d.ts +1 -0
- package/dist/admin/src/pages/EditView/components/InputRenderer.d.ts +1 -1
- package/dist/admin/src/preview/pages/Preview.d.ts +2 -1
- package/dist/admin/src/services/homepage.d.ts +5 -0
- package/dist/server/src/services/homepage.d.ts +11 -0
- package/dist/server/src/services/homepage.d.ts.map +1 -0
- package/dist/shared/contracts/homepage.d.ts +25 -0
- package/dist/shared/contracts/homepage.d.ts.map +1 -0
- package/package.json +8 -8
- package/dist/admin/features/DocumentContext.js +0 -71
- package/dist/admin/features/DocumentContext.js.map +0 -1
- package/dist/admin/features/DocumentContext.mjs +0 -49
- package/dist/admin/features/DocumentContext.mjs.map +0 -1
- package/dist/admin/src/features/DocumentContext.d.ts +0 -53
@@ -0,0 +1,161 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
4
|
+
var strapiAdmin = require('@strapi/admin/strapi-admin');
|
5
|
+
var designSystem = require('@strapi/design-system');
|
6
|
+
var Icons = require('@strapi/icons');
|
7
|
+
var reactIntl = require('react-intl');
|
8
|
+
var reactRouterDom = require('react-router-dom');
|
9
|
+
var styledComponents = require('styled-components');
|
10
|
+
var DocumentStatus = require('../pages/EditView/components/DocumentStatus.js');
|
11
|
+
var homepage = require('../services/homepage.js');
|
12
|
+
var RelativeTime = require('./RelativeTime.js');
|
13
|
+
|
14
|
+
const CellTypography = styledComponents.styled(designSystem.Typography).attrs({
|
15
|
+
maxWidth: '14.4rem',
|
16
|
+
display: 'block'
|
17
|
+
})`
|
18
|
+
overflow: hidden;
|
19
|
+
text-overflow: ellipsis;
|
20
|
+
white-space: nowrap;
|
21
|
+
`;
|
22
|
+
const RecentDocumentsTable = ({ documents })=>{
|
23
|
+
const { formatMessage } = reactIntl.useIntl();
|
24
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
25
|
+
const navigate = reactRouterDom.useNavigate();
|
26
|
+
const getEditViewLink = (document)=>{
|
27
|
+
const isSingleType = document.kind === 'singleType';
|
28
|
+
const kindPath = isSingleType ? 'single-types' : 'collection-types';
|
29
|
+
const queryParams = document.locale ? `?plugins[i18n][locale]=${document.locale}` : '';
|
30
|
+
return `/content-manager/${kindPath}/${document.contentTypeUid}${isSingleType ? '' : '/' + document.documentId}${queryParams}`;
|
31
|
+
};
|
32
|
+
const handleRowClick = (document)=>()=>{
|
33
|
+
trackUsage('willEditEntryFromHome');
|
34
|
+
const link = getEditViewLink(document);
|
35
|
+
navigate(link);
|
36
|
+
};
|
37
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Table, {
|
38
|
+
colCount: 5,
|
39
|
+
rowCount: documents?.length ?? 0,
|
40
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tbody, {
|
41
|
+
children: documents?.map((document)=>/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Tr, {
|
42
|
+
onClick: handleRowClick(document),
|
43
|
+
cursor: "pointer",
|
44
|
+
children: [
|
45
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
|
46
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(CellTypography, {
|
47
|
+
title: document.title,
|
48
|
+
variant: "omega",
|
49
|
+
textColor: "neutral800",
|
50
|
+
children: document.title
|
51
|
+
})
|
52
|
+
}),
|
53
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
|
54
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(CellTypography, {
|
55
|
+
variant: "omega",
|
56
|
+
textColor: "neutral600",
|
57
|
+
children: document.kind === 'singleType' ? formatMessage({
|
58
|
+
id: 'content-manager.widget.last-edited.single-type',
|
59
|
+
defaultMessage: 'Single-Type'
|
60
|
+
}) : formatMessage({
|
61
|
+
id: document.contentTypeDisplayName,
|
62
|
+
defaultMessage: document.contentTypeDisplayName
|
63
|
+
})
|
64
|
+
})
|
65
|
+
}),
|
66
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
|
67
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
68
|
+
display: "inline-block",
|
69
|
+
children: document.status ? /*#__PURE__*/ jsxRuntime.jsx(DocumentStatus.DocumentStatus, {
|
70
|
+
status: document.status
|
71
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
72
|
+
textColor: "neutral600",
|
73
|
+
"aria-hidden": true,
|
74
|
+
children: "-"
|
75
|
+
})
|
76
|
+
})
|
77
|
+
}),
|
78
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
|
79
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
80
|
+
textColor: "neutral600",
|
81
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(RelativeTime.RelativeTime, {
|
82
|
+
timestamp: new Date(document.updatedAt)
|
83
|
+
})
|
84
|
+
})
|
85
|
+
}),
|
86
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
|
87
|
+
onClick: (e)=>e.stopPropagation(),
|
88
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
89
|
+
display: "inline-block",
|
90
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
|
91
|
+
tag: reactRouterDom.Link,
|
92
|
+
to: getEditViewLink(document),
|
93
|
+
onClick: ()=>trackUsage('willEditEntryFromHome'),
|
94
|
+
label: formatMessage({
|
95
|
+
id: 'content-manager.actions.edit.label',
|
96
|
+
defaultMessage: 'Edit'
|
97
|
+
}),
|
98
|
+
variant: "ghost",
|
99
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Pencil, {})
|
100
|
+
})
|
101
|
+
})
|
102
|
+
})
|
103
|
+
]
|
104
|
+
}, document.documentId))
|
105
|
+
})
|
106
|
+
});
|
107
|
+
};
|
108
|
+
/* -------------------------------------------------------------------------------------------------
|
109
|
+
* LastEditedWidget
|
110
|
+
* -----------------------------------------------------------------------------------------------*/ const LastEditedWidget = ()=>{
|
111
|
+
const { formatMessage } = reactIntl.useIntl();
|
112
|
+
const { data, isLoading, error } = homepage.useGetRecentDocumentsQuery({
|
113
|
+
action: 'update'
|
114
|
+
});
|
115
|
+
if (isLoading) {
|
116
|
+
return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.Loading, {});
|
117
|
+
}
|
118
|
+
if (error || !data) {
|
119
|
+
return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.Error, {});
|
120
|
+
}
|
121
|
+
if (data.length === 0) {
|
122
|
+
return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.NoData, {
|
123
|
+
children: formatMessage({
|
124
|
+
id: 'content-manager.widget.last-edited.no-data',
|
125
|
+
defaultMessage: 'No edited entries'
|
126
|
+
})
|
127
|
+
});
|
128
|
+
}
|
129
|
+
return /*#__PURE__*/ jsxRuntime.jsx(RecentDocumentsTable, {
|
130
|
+
documents: data
|
131
|
+
});
|
132
|
+
};
|
133
|
+
/* -------------------------------------------------------------------------------------------------
|
134
|
+
* LastPublishedWidget
|
135
|
+
* -----------------------------------------------------------------------------------------------*/ const LastPublishedWidget = ()=>{
|
136
|
+
const { formatMessage } = reactIntl.useIntl();
|
137
|
+
const { data, isLoading, error } = homepage.useGetRecentDocumentsQuery({
|
138
|
+
action: 'publish'
|
139
|
+
});
|
140
|
+
if (isLoading) {
|
141
|
+
return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.Loading, {});
|
142
|
+
}
|
143
|
+
if (error || !data) {
|
144
|
+
return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.Error, {});
|
145
|
+
}
|
146
|
+
if (data.length === 0) {
|
147
|
+
return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.NoData, {
|
148
|
+
children: formatMessage({
|
149
|
+
id: 'content-manager.widget.last-published.no-data',
|
150
|
+
defaultMessage: 'No published entries'
|
151
|
+
})
|
152
|
+
});
|
153
|
+
}
|
154
|
+
return /*#__PURE__*/ jsxRuntime.jsx(RecentDocumentsTable, {
|
155
|
+
documents: data
|
156
|
+
});
|
157
|
+
};
|
158
|
+
|
159
|
+
exports.LastEditedWidget = LastEditedWidget;
|
160
|
+
exports.LastPublishedWidget = LastPublishedWidget;
|
161
|
+
//# sourceMappingURL=Widgets.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Widgets.js","sources":["../../../admin/src/components/Widgets.tsx"],"sourcesContent":["import { Widget, useTracking } from '@strapi/admin/strapi-admin';\nimport { Box, IconButton, Table, Tbody, Td, Tr, Typography } from '@strapi/design-system';\nimport { Pencil } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { Link, useNavigate } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { DocumentStatus } from '../pages/EditView/components/DocumentStatus';\nimport { useGetRecentDocumentsQuery } from '../services/homepage';\n\nimport { RelativeTime } from './RelativeTime';\n\nimport type { RecentDocument } from '../../../shared/contracts/homepage';\n\nconst CellTypography = styled(Typography).attrs({ maxWidth: '14.4rem', display: 'block' })`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst RecentDocumentsTable = ({ documents }: { documents: RecentDocument[] }) => {\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const navigate = useNavigate();\n\n const getEditViewLink = (document: RecentDocument): string => {\n const isSingleType = document.kind === 'singleType';\n const kindPath = isSingleType ? 'single-types' : 'collection-types';\n const queryParams = document.locale ? `?plugins[i18n][locale]=${document.locale}` : '';\n\n return `/content-manager/${kindPath}/${document.contentTypeUid}${isSingleType ? '' : '/' + document.documentId}${queryParams}`;\n };\n\n const handleRowClick = (document: RecentDocument) => () => {\n trackUsage('willEditEntryFromHome');\n const link = getEditViewLink(document);\n navigate(link);\n };\n\n return (\n <Table colCount={5} rowCount={documents?.length ?? 0}>\n <Tbody>\n {documents?.map((document) => (\n <Tr onClick={handleRowClick(document)} cursor=\"pointer\" key={document.documentId}>\n <Td>\n <CellTypography title={document.title} variant=\"omega\" textColor=\"neutral800\">\n {document.title}\n </CellTypography>\n </Td>\n <Td>\n <CellTypography variant=\"omega\" textColor=\"neutral600\">\n {document.kind === 'singleType'\n ? formatMessage({\n id: 'content-manager.widget.last-edited.single-type',\n defaultMessage: 'Single-Type',\n })\n : formatMessage({\n id: document.contentTypeDisplayName,\n defaultMessage: document.contentTypeDisplayName,\n })}\n </CellTypography>\n </Td>\n <Td>\n <Box display=\"inline-block\">\n {document.status ? (\n <DocumentStatus status={document.status} />\n ) : (\n <Typography textColor=\"neutral600\" aria-hidden>\n -\n </Typography>\n )}\n </Box>\n </Td>\n <Td>\n <Typography textColor=\"neutral600\">\n <RelativeTime timestamp={new Date(document.updatedAt)} />\n </Typography>\n </Td>\n <Td onClick={(e) => e.stopPropagation()}>\n <Box display=\"inline-block\">\n <IconButton\n tag={Link}\n to={getEditViewLink(document)}\n onClick={() => trackUsage('willEditEntryFromHome')}\n label={formatMessage({\n id: 'content-manager.actions.edit.label',\n defaultMessage: 'Edit',\n })}\n variant=\"ghost\"\n >\n <Pencil />\n </IconButton>\n </Box>\n </Td>\n </Tr>\n ))}\n </Tbody>\n </Table>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * LastEditedWidget\n * -----------------------------------------------------------------------------------------------*/\n\nconst LastEditedWidget = () => {\n const { formatMessage } = useIntl();\n const { data, isLoading, error } = useGetRecentDocumentsQuery({ action: 'update' });\n\n if (isLoading) {\n return <Widget.Loading />;\n }\n\n if (error || !data) {\n return <Widget.Error />;\n }\n\n if (data.length === 0) {\n return (\n <Widget.NoData>\n {formatMessage({\n id: 'content-manager.widget.last-edited.no-data',\n defaultMessage: 'No edited entries',\n })}\n </Widget.NoData>\n );\n }\n\n return <RecentDocumentsTable documents={data} />;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * LastPublishedWidget\n * -----------------------------------------------------------------------------------------------*/\n\nconst LastPublishedWidget = () => {\n const { formatMessage } = useIntl();\n const { data, isLoading, error } = useGetRecentDocumentsQuery({ action: 'publish' });\n\n if (isLoading) {\n return <Widget.Loading />;\n }\n\n if (error || !data) {\n return <Widget.Error />;\n }\n\n if (data.length === 0) {\n return (\n <Widget.NoData>\n {formatMessage({\n id: 'content-manager.widget.last-published.no-data',\n defaultMessage: 'No published entries',\n })}\n </Widget.NoData>\n );\n }\n\n return <RecentDocumentsTable documents={data} />;\n};\n\nexport { LastEditedWidget, LastPublishedWidget };\n"],"names":["CellTypography","styled","Typography","attrs","maxWidth","display","RecentDocumentsTable","documents","formatMessage","useIntl","trackUsage","useTracking","navigate","useNavigate","getEditViewLink","document","isSingleType","kind","kindPath","queryParams","locale","contentTypeUid","documentId","handleRowClick","link","_jsx","Table","colCount","rowCount","length","Tbody","map","_jsxs","Tr","onClick","cursor","Td","title","variant","textColor","id","defaultMessage","contentTypeDisplayName","Box","status","DocumentStatus","aria-hidden","RelativeTime","timestamp","Date","updatedAt","e","stopPropagation","IconButton","tag","Link","to","label","Pencil","LastEditedWidget","data","isLoading","error","useGetRecentDocumentsQuery","action","Widget","Loading","Error","NoData","LastPublishedWidget"],"mappings":";;;;;;;;;;;;;AAcA,MAAMA,cAAiBC,GAAAA,uBAAAA,CAAOC,uBAAYC,CAAAA,CAAAA,KAAK,CAAC;IAAEC,QAAU,EAAA,SAAA;IAAWC,OAAS,EAAA;AAAQ,CAAA,CAAE;;;;AAI1F,CAAC;AAED,MAAMC,oBAAuB,GAAA,CAAC,EAAEC,SAAS,EAAmC,GAAA;IAC1E,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;IAC1B,MAAM,EAAEC,UAAU,EAAE,GAAGC,uBAAAA,EAAAA;AACvB,IAAA,MAAMC,QAAWC,GAAAA,0BAAAA,EAAAA;AAEjB,IAAA,MAAMC,kBAAkB,CAACC,QAAAA,GAAAA;QACvB,MAAMC,YAAAA,GAAeD,QAASE,CAAAA,IAAI,KAAK,YAAA;QACvC,MAAMC,QAAAA,GAAWF,eAAe,cAAiB,GAAA,kBAAA;QACjD,MAAMG,WAAAA,GAAcJ,QAASK,C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qBAAOpC,cAAA,CAACwC,mBAAOC,OAAO,EAAA,EAAA,CAAA;AACxB;IAEA,IAAIJ,KAAAA,IAAS,CAACF,IAAM,EAAA;QAClB,qBAAOnC,cAAA,CAACwC,mBAAOE,KAAK,EAAA,EAAA,CAAA;AACtB;IAEA,IAAIP,IAAAA,CAAK/B,MAAM,KAAK,CAAG,EAAA;QACrB,qBACEJ,cAAA,CAACwC,mBAAOG,MAAM,EAAA;sBACX5D,aAAc,CAAA;gBACbgC,EAAI,EAAA,+CAAA;gBACJC,cAAgB,EAAA;AAClB,aAAA;;AAGN;AAEA,IAAA,qBAAOhB,cAACnB,CAAAA,oBAAAA,EAAAA;QAAqBC,SAAWqD,EAAAA;;AAC1C;;;;;"}
|
@@ -0,0 +1,158 @@
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
2
|
+
import { Widget, useTracking } from '@strapi/admin/strapi-admin';
|
3
|
+
import { Typography, Table, Tbody, Tr, Td, Box, IconButton } from '@strapi/design-system';
|
4
|
+
import { Pencil } from '@strapi/icons';
|
5
|
+
import { useIntl } from 'react-intl';
|
6
|
+
import { useNavigate, Link } from 'react-router-dom';
|
7
|
+
import { styled } from 'styled-components';
|
8
|
+
import { DocumentStatus } from '../pages/EditView/components/DocumentStatus.mjs';
|
9
|
+
import { useGetRecentDocumentsQuery } from '../services/homepage.mjs';
|
10
|
+
import { RelativeTime } from './RelativeTime.mjs';
|
11
|
+
|
12
|
+
const CellTypography = styled(Typography).attrs({
|
13
|
+
maxWidth: '14.4rem',
|
14
|
+
display: 'block'
|
15
|
+
})`
|
16
|
+
overflow: hidden;
|
17
|
+
text-overflow: ellipsis;
|
18
|
+
white-space: nowrap;
|
19
|
+
`;
|
20
|
+
const RecentDocumentsTable = ({ documents })=>{
|
21
|
+
const { formatMessage } = useIntl();
|
22
|
+
const { trackUsage } = useTracking();
|
23
|
+
const navigate = useNavigate();
|
24
|
+
const getEditViewLink = (document)=>{
|
25
|
+
const isSingleType = document.kind === 'singleType';
|
26
|
+
const kindPath = isSingleType ? 'single-types' : 'collection-types';
|
27
|
+
const queryParams = document.locale ? `?plugins[i18n][locale]=${document.locale}` : '';
|
28
|
+
return `/content-manager/${kindPath}/${document.contentTypeUid}${isSingleType ? '' : '/' + document.documentId}${queryParams}`;
|
29
|
+
};
|
30
|
+
const handleRowClick = (document)=>()=>{
|
31
|
+
trackUsage('willEditEntryFromHome');
|
32
|
+
const link = getEditViewLink(document);
|
33
|
+
navigate(link);
|
34
|
+
};
|
35
|
+
return /*#__PURE__*/ jsx(Table, {
|
36
|
+
colCount: 5,
|
37
|
+
rowCount: documents?.length ?? 0,
|
38
|
+
children: /*#__PURE__*/ jsx(Tbody, {
|
39
|
+
children: documents?.map((document)=>/*#__PURE__*/ jsxs(Tr, {
|
40
|
+
onClick: handleRowClick(document),
|
41
|
+
cursor: "pointer",
|
42
|
+
children: [
|
43
|
+
/*#__PURE__*/ jsx(Td, {
|
44
|
+
children: /*#__PURE__*/ jsx(CellTypography, {
|
45
|
+
title: document.title,
|
46
|
+
variant: "omega",
|
47
|
+
textColor: "neutral800",
|
48
|
+
children: document.title
|
49
|
+
})
|
50
|
+
}),
|
51
|
+
/*#__PURE__*/ jsx(Td, {
|
52
|
+
children: /*#__PURE__*/ jsx(CellTypography, {
|
53
|
+
variant: "omega",
|
54
|
+
textColor: "neutral600",
|
55
|
+
children: document.kind === 'singleType' ? formatMessage({
|
56
|
+
id: 'content-manager.widget.last-edited.single-type',
|
57
|
+
defaultMessage: 'Single-Type'
|
58
|
+
}) : formatMessage({
|
59
|
+
id: document.contentTypeDisplayName,
|
60
|
+
defaultMessage: document.contentTypeDisplayName
|
61
|
+
})
|
62
|
+
})
|
63
|
+
}),
|
64
|
+
/*#__PURE__*/ jsx(Td, {
|
65
|
+
children: /*#__PURE__*/ jsx(Box, {
|
66
|
+
display: "inline-block",
|
67
|
+
children: document.status ? /*#__PURE__*/ jsx(DocumentStatus, {
|
68
|
+
status: document.status
|
69
|
+
}) : /*#__PURE__*/ jsx(Typography, {
|
70
|
+
textColor: "neutral600",
|
71
|
+
"aria-hidden": true,
|
72
|
+
children: "-"
|
73
|
+
})
|
74
|
+
})
|
75
|
+
}),
|
76
|
+
/*#__PURE__*/ jsx(Td, {
|
77
|
+
children: /*#__PURE__*/ jsx(Typography, {
|
78
|
+
textColor: "neutral600",
|
79
|
+
children: /*#__PURE__*/ jsx(RelativeTime, {
|
80
|
+
timestamp: new Date(document.updatedAt)
|
81
|
+
})
|
82
|
+
})
|
83
|
+
}),
|
84
|
+
/*#__PURE__*/ jsx(Td, {
|
85
|
+
onClick: (e)=>e.stopPropagation(),
|
86
|
+
children: /*#__PURE__*/ jsx(Box, {
|
87
|
+
display: "inline-block",
|
88
|
+
children: /*#__PURE__*/ jsx(IconButton, {
|
89
|
+
tag: Link,
|
90
|
+
to: getEditViewLink(document),
|
91
|
+
onClick: ()=>trackUsage('willEditEntryFromHome'),
|
92
|
+
label: formatMessage({
|
93
|
+
id: 'content-manager.actions.edit.label',
|
94
|
+
defaultMessage: 'Edit'
|
95
|
+
}),
|
96
|
+
variant: "ghost",
|
97
|
+
children: /*#__PURE__*/ jsx(Pencil, {})
|
98
|
+
})
|
99
|
+
})
|
100
|
+
})
|
101
|
+
]
|
102
|
+
}, document.documentId))
|
103
|
+
})
|
104
|
+
});
|
105
|
+
};
|
106
|
+
/* -------------------------------------------------------------------------------------------------
|
107
|
+
* LastEditedWidget
|
108
|
+
* -----------------------------------------------------------------------------------------------*/ const LastEditedWidget = ()=>{
|
109
|
+
const { formatMessage } = useIntl();
|
110
|
+
const { data, isLoading, error } = useGetRecentDocumentsQuery({
|
111
|
+
action: 'update'
|
112
|
+
});
|
113
|
+
if (isLoading) {
|
114
|
+
return /*#__PURE__*/ jsx(Widget.Loading, {});
|
115
|
+
}
|
116
|
+
if (error || !data) {
|
117
|
+
return /*#__PURE__*/ jsx(Widget.Error, {});
|
118
|
+
}
|
119
|
+
if (data.length === 0) {
|
120
|
+
return /*#__PURE__*/ jsx(Widget.NoData, {
|
121
|
+
children: formatMessage({
|
122
|
+
id: 'content-manager.widget.last-edited.no-data',
|
123
|
+
defaultMessage: 'No edited entries'
|
124
|
+
})
|
125
|
+
});
|
126
|
+
}
|
127
|
+
return /*#__PURE__*/ jsx(RecentDocumentsTable, {
|
128
|
+
documents: data
|
129
|
+
});
|
130
|
+
};
|
131
|
+
/* -------------------------------------------------------------------------------------------------
|
132
|
+
* LastPublishedWidget
|
133
|
+
* -----------------------------------------------------------------------------------------------*/ const LastPublishedWidget = ()=>{
|
134
|
+
const { formatMessage } = useIntl();
|
135
|
+
const { data, isLoading, error } = useGetRecentDocumentsQuery({
|
136
|
+
action: 'publish'
|
137
|
+
});
|
138
|
+
if (isLoading) {
|
139
|
+
return /*#__PURE__*/ jsx(Widget.Loading, {});
|
140
|
+
}
|
141
|
+
if (error || !data) {
|
142
|
+
return /*#__PURE__*/ jsx(Widget.Error, {});
|
143
|
+
}
|
144
|
+
if (data.length === 0) {
|
145
|
+
return /*#__PURE__*/ jsx(Widget.NoData, {
|
146
|
+
children: formatMessage({
|
147
|
+
id: 'content-manager.widget.last-published.no-data',
|
148
|
+
defaultMessage: 'No published entries'
|
149
|
+
})
|
150
|
+
});
|
151
|
+
}
|
152
|
+
return /*#__PURE__*/ jsx(RecentDocumentsTable, {
|
153
|
+
documents: data
|
154
|
+
});
|
155
|
+
};
|
156
|
+
|
157
|
+
export { LastEditedWidget, LastPublishedWidget };
|
158
|
+
//# sourceMappingURL=Widgets.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Widgets.mjs","sources":["../../../admin/src/components/Widgets.tsx"],"sourcesContent":["import { Widget, useTracking } from '@strapi/admin/strapi-admin';\nimport { Box, IconButton, Table, Tbody, Td, Tr, Typography } from '@strapi/design-system';\nimport { Pencil } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { Link, useNavigate } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { DocumentStatus } from '../pages/EditView/components/DocumentStatus';\nimport { useGetRecentDocumentsQuery } from '../services/homepage';\n\nimport { RelativeTime } from './RelativeTime';\n\nimport type { RecentDocument } from '../../../shared/contracts/homepage';\n\nconst CellTypography = styled(Typography).attrs({ maxWidth: '14.4rem', display: 'block' })`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst RecentDocumentsTable = ({ documents }: { documents: RecentDocument[] }) => {\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const navigate = useNavigate();\n\n const getEditViewLink = (document: RecentDocument): string => {\n const isSingleType = document.kind === 'singleType';\n const kindPath = isSingleType ? 'single-types' : 'collection-types';\n const queryParams = document.locale ? `?plugins[i18n][locale]=${document.locale}` : '';\n\n return `/content-manager/${kindPath}/${document.contentTypeUid}${isSingleType ? '' : '/' + document.documentId}${queryParams}`;\n };\n\n const handleRowClick = (document: RecentDocument) => () => {\n trackUsage('willEditEntryFromHome');\n const link = getEditViewLink(document);\n navigate(link);\n };\n\n return (\n <Table colCount={5} rowCount={documents?.length ?? 0}>\n <Tbody>\n {documents?.map((document) => (\n <Tr onClick={handleRowClick(document)} cursor=\"pointer\" key={document.documentId}>\n <Td>\n <CellTypography title={document.title} variant=\"omega\" textColor=\"neutral800\">\n {document.title}\n </CellTypography>\n </Td>\n <Td>\n <CellTypography variant=\"omega\" textColor=\"neutral600\">\n {document.kind === 'singleType'\n ? formatMessage({\n id: 'content-manager.widget.last-edited.single-type',\n defaultMessage: 'Single-Type',\n })\n : formatMessage({\n id: document.contentTypeDisplayName,\n defaultMessage: document.contentTypeDisplayName,\n })}\n </CellTypography>\n </Td>\n <Td>\n <Box display=\"inline-block\">\n {document.status ? (\n <DocumentStatus status={document.status} />\n ) : (\n <Typography textColor=\"neutral600\" aria-hidden>\n -\n </Typography>\n )}\n </Box>\n </Td>\n <Td>\n <Typography textColor=\"neutral600\">\n <RelativeTime timestamp={new Date(document.updatedAt)} />\n </Typography>\n </Td>\n <Td onClick={(e) => e.stopPropagation()}>\n <Box display=\"inline-block\">\n <IconButton\n tag={Link}\n to={getEditViewLink(document)}\n onClick={() => trackUsage('willEditEntryFromHome')}\n label={formatMessage({\n id: 'content-manager.actions.edit.label',\n defaultMessage: 'Edit',\n })}\n variant=\"ghost\"\n >\n <Pencil />\n </IconButton>\n </Box>\n </Td>\n </Tr>\n ))}\n </Tbody>\n </Table>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * LastEditedWidget\n * -----------------------------------------------------------------------------------------------*/\n\nconst LastEditedWidget = () => {\n const { formatMessage } = useIntl();\n const { data, isLoading, error } = useGetRecentDocumentsQuery({ action: 'update' });\n\n if (isLoading) {\n return <Widget.Loading />;\n }\n\n if (error || !data) {\n return <Widget.Error />;\n }\n\n if (data.length === 0) {\n return (\n <Widget.NoData>\n {formatMessage({\n id: 'content-manager.widget.last-edited.no-data',\n defaultMessage: 'No edited entries',\n })}\n </Widget.NoData>\n );\n }\n\n return <RecentDocumentsTable documents={data} />;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * LastPublishedWidget\n * -----------------------------------------------------------------------------------------------*/\n\nconst LastPublishedWidget = () => {\n const { formatMessage } = useIntl();\n const { data, isLoading, error } = useGetRecentDocumentsQuery({ action: 'publish' });\n\n if (isLoading) {\n return <Widget.Loading />;\n }\n\n if (error || !data) {\n return <Widget.Error />;\n }\n\n if (data.length === 0) {\n return (\n <Widget.NoData>\n {formatMessage({\n id: 'content-manager.widget.last-published.no-data',\n defaultMessage: 'No published entries',\n })}\n </Widget.NoData>\n );\n }\n\n return <RecentDocumentsTable documents={data} />;\n};\n\nexport { LastEditedWidget, LastPublishedWidget };\n"],"names":["CellTypography","styled","Typography","attrs","maxWidth","display","RecentDocumentsTable","documents","formatMessage","useIntl","trackUsage","useTracking","navigate","useNavigate","getEditViewLink","document","isSingleType","kind","kindPath","queryParams","locale","contentTypeUid","documentId","handleRowClick","link","_jsx","Table","colCount","rowCount","length","Tbody","map","_jsxs","Tr","onClick","cursor","Td","title","variant","textColor","id","defaultMessage","contentTypeDisplayName","Box","status","DocumentStatus","aria-hidden","RelativeTime","timestamp","Date","updatedAt","e","stopPropagation","IconButton","tag","Link","to","label","Pencil","LastEditedWidget","data","isLoading","error","useGetRecentDocumentsQuery","action","Widget","Loading","Error","NoData","LastPublishedWidget"],"mappings":";;;;;;;;;;;AAcA,MAAMA,cAAiBC,GAAAA,MAAAA,CAAOC,UAAYC,CAAAA,CAAAA,KAAK,CAAC;IAAEC,QAAU,EAAA,SAAA;IAAWC,OAAS,EAAA;AAAQ,CAAA,CAAE;;;;AAI1F,CAAC;AAED,MAAMC,oBAAuB,GAAA,CAAC,EAAEC,SAAS,EAAmC,GAAA;IAC1E,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;IAC1B,MAAM,EAAEC,UAAU,EAAE,GAAGC,WAAAA,EAAAA;AACvB,IAAA,MAAMC,QAAWC,GAAAA,WAAAA,EAAAA;AAEjB,IAAA,MAAMC,kBAAkB,CAACC,QAAAA,GAAAA;QACvB,MAAMC,YAAAA,GAAeD,QAASE,CAAAA,IAAI,KAAK,YAAA;QACvC,MAAMC,QAAAA,GAAWF,eAAe,cAAiB,GAAA,kBAAA;QACjD,MAAMG,WAAAA,GAAcJ,QAASK,CAAAA,MAAM,GAAG,CAAC,uBAAuB,EAAEL,QAASK,CAAAA,MAAM,CAAC,CAAC,GAAG,EAAA;AAEpF,QAAA,OAAO,CAAC,iBAAiB,EAAEF,SAAS,CAAC,EAAEH,SAASM,cAAc,CAAC,EAAEL,YAAAA,GAAe,KAAK,GAAMD,GAAAA,QAAAA,CAASO,UAAU,CAAC,EAAEH,YAAY,CAAC;AAChI,KAAA;IAEA,MAAMI,cAAAA,GAAiB,CAACR,QAA6B,GAAA,IAAA;YACnDL,UAAW,CAAA,uBAAA,CAAA;AACX,YAAA,MAAMc,OAAOV,eAAgBC,CAAAA,QAAAA,CAAAA;YAC7BH,QAASY,CAAAA,IAAAA,CAAAA;AACX,SAAA;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@@
|
|
1
|
-
{"version":3,"file":"content-manager.js","sources":["../../admin/src/content-manager.ts"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { INJECTION_ZONES } from './components/InjectionZone';\nimport { PLUGIN_ID } from './constants/plugin';\nimport {\n DEFAULT_ACTIONS,\n type DocumentActionPosition,\n type DocumentActionDescription,\n} from './pages/EditView/components/DocumentActions';\nimport {\n DEFAULT_HEADER_ACTIONS,\n type HeaderActionDescription,\n} from './pages/EditView/components/Header';\nimport { ActionsPanel, type PanelDescription } from './pages/EditView/components/Panels';\nimport {\n DEFAULT_BULK_ACTIONS,\n type BulkActionDescription,\n} from './pages/ListView/components/BulkActions/Actions';\nimport { DEFAULT_TABLE_ROW_ACTIONS } from './pages/ListView/components/TableActions';\n\nimport type { Document } from './hooks/useDocument';\nimport type { DocumentMetadata } from '../../shared/contracts/collection-types';\nimport type { DescriptionComponent, PluginConfig } from '@strapi/admin/strapi-admin';\n\n/* -------------------------------------------------------------------------------------------------\n * Configuration Types\n * -----------------------------------------------------------------------------------------------*/\n\ntype DescriptionReducer<Config extends object> = (prev: Config[]) => Config[];\n\ninterface EditViewContext {\n /**\n * This will ONLY be null, if the content-type\n * does not have draft & published enabled.\n */\n activeTab: 'draft' | 'published' | null;\n /**\n * Will be either 'single-types' | 'collection-types'\n */\n collectionType: string;\n /**\n * this will be undefined if someone is creating an entry.\n */\n document?: Document;\n /**\n * this will be undefined if someone is creating an entry.\n */\n documentId?: string;\n /**\n * this will be undefined if someone is creating an entry.\n */\n meta?: DocumentMetadata;\n /**\n * The current content-type's model.\n */\n model: string;\n}\n\ninterface ListViewContext {\n /**\n * Will be either 'single-types' | 'collection-types'\n */\n collectionType: string;\n /**\n * The current selected documents in the table\n */\n documents: Document[];\n /**\n * The current content-type's model.\n */\n model: string;\n}\n\ninterface PanelComponentProps extends EditViewContext {}\n\ninterface PanelComponent extends DescriptionComponent<PanelComponentProps, PanelDescription> {\n /**\n * The defaults are added by Strapi only, if you're providing your own component,\n * you do not need to provide this.\n */\n type?: 'actions' | 'releases';\n}\n\ninterface DocumentActionProps extends EditViewContext {\n onPreview?: () => void;\n fromPreview?: boolean;\n fromRelationModal?: boolean;\n}\n\ninterface DocumentActionComponent\n extends DescriptionComponent<DocumentActionProps, DocumentActionDescription> {\n type?:\n | 'clone'\n | 'configure-the-view'\n | 'delete'\n | 'discard'\n | 'edit'\n | 'edit-the-model'\n | 'history'\n | 'publish'\n | 'unpublish'\n | 'update';\n position?: DocumentActionDescription['position'];\n}\n\ninterface HeaderActionProps extends EditViewContext {}\n\ninterface HeaderActionComponent\n extends DescriptionComponent<HeaderActionProps, HeaderActionDescription> {}\n\ninterface BulkActionComponentProps extends ListViewContext {}\n\ninterface BulkActionComponent\n extends DescriptionComponent<BulkActionComponentProps, BulkActionDescription> {\n type?: 'delete' | 'publish' | 'unpublish';\n}\n\n/* -------------------------------------------------------------------------------------------------\n * ContentManager plugin\n * -----------------------------------------------------------------------------------------------*/\n\nclass ContentManagerPlugin {\n /**\n * The following properties are the stored ones provided by any plugins registering with\n * the content-manager. The function calls however, need to be called at runtime in the\n * application, so instead we collate them and run them later with the complete list incl.\n * ones already registered & the context of the view.\n */\n bulkActions: BulkActionComponent[] = [...DEFAULT_BULK_ACTIONS];\n documentActions: DocumentActionComponent[] = [\n ...DEFAULT_ACTIONS,\n ...DEFAULT_TABLE_ROW_ACTIONS,\n ...DEFAULT_HEADER_ACTIONS,\n ];\n editViewSidePanels: PanelComponent[] = [ActionsPanel];\n headerActions: HeaderActionComponent[] = [];\n\n constructor() {}\n\n addEditViewSidePanel(panels: DescriptionReducer<PanelComponent>): void;\n addEditViewSidePanel(panels: PanelComponent[]): void;\n addEditViewSidePanel(panels: DescriptionReducer<PanelComponent> | PanelComponent[]) {\n if (Array.isArray(panels)) {\n this.editViewSidePanels = [...this.editViewSidePanels, ...panels];\n } else if (typeof panels === 'function') {\n this.editViewSidePanels = panels(this.editViewSidePanels);\n } else {\n throw new Error(\n `Expected the \\`panels\\` passed to \\`addEditViewSidePanel\\` to be an array or a function, but received ${getPrintableType(\n panels\n )}`\n );\n }\n }\n\n addDocumentAction(actions: DescriptionReducer<DocumentActionComponent>): void;\n addDocumentAction(actions: DocumentActionComponent[]): void;\n addDocumentAction(\n actions: DescriptionReducer<DocumentActionComponent> | DocumentActionComponent[]\n ) {\n if (Array.isArray(actions)) {\n this.documentActions = [...this.documentActions, ...actions];\n } else if (typeof actions === 'function') {\n this.documentActions = actions(this.documentActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addDocumentAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n addDocumentHeaderAction(actions: DescriptionReducer<HeaderActionComponent>): void;\n addDocumentHeaderAction(actions: HeaderActionComponent[]): void;\n addDocumentHeaderAction(\n actions: DescriptionReducer<HeaderActionComponent> | HeaderActionComponent[]\n ) {\n if (Array.isArray(actions)) {\n this.headerActions = [...this.headerActions, ...actions];\n } else if (typeof actions === 'function') {\n this.headerActions = actions(this.headerActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addDocumentHeaderAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n addBulkAction(actions: DescriptionReducer<BulkActionComponent>): void;\n addBulkAction(actions: BulkActionComponent[]): void;\n addBulkAction(actions: DescriptionReducer<BulkActionComponent> | BulkActionComponent[]) {\n if (Array.isArray(actions)) {\n this.bulkActions = [...this.bulkActions, ...actions];\n } else if (typeof actions === 'function') {\n this.bulkActions = actions(this.bulkActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addBulkAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n get config() {\n return {\n id: PLUGIN_ID,\n name: 'Content Manager',\n injectionZones: INJECTION_ZONES,\n apis: {\n addBulkAction: this.addBulkAction.bind(this),\n addDocumentAction: this.addDocumentAction.bind(this),\n addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),\n addEditViewSidePanel: this.addEditViewSidePanel.bind(this),\n getBulkActions: () => this.bulkActions,\n getDocumentActions: (position?: DocumentActionPosition) => {\n /**\n * When possible, pre-filter the actions by the components static position property.\n * This avoids rendering the actions in multiple places where they weren't displayed,\n * which wasn't visible but created issues with useEffect for instance.\n * The response should still be filtered by the position, as the static property is new\n * and not mandatory to avoid a breaking change.\n */\n if (position) {\n return this.documentActions.filter((action) => {\n return action.position == undefined || [action.position].flat().includes(position);\n });\n }\n\n return this.documentActions;\n },\n getEditViewSidePanels: () => this.editViewSidePanels,\n getHeaderActions: () => this.headerActions,\n },\n } satisfies PluginConfig;\n }\n}\n\n/* -------------------------------------------------------------------------------------------------\n * getPrintableType\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description Gets the human-friendly printable type name for the given value, for instance it will yield\n * `array` instead of `object`, as the native `typeof` operator would do.\n */\nconst getPrintableType = (value: unknown): string => {\n const nativeType = typeof value;\n\n if (nativeType === 'object') {\n if (value === null) return 'null';\n if (Array.isArray(value)) return 'array';\n if (value instanceof Object && value.constructor.name !== 'Object') {\n return value.constructor.name;\n }\n }\n\n return nativeType;\n};\n\nexport { ContentManagerPlugin };\nexport type {\n EditViewContext,\n ListViewContext,\n BulkActionComponent,\n BulkActionComponentProps,\n BulkActionDescription,\n DescriptionComponent,\n DescriptionReducer,\n PanelComponentProps,\n PanelComponent,\n PanelDescription,\n DocumentActionComponent,\n DocumentActionDescription,\n DocumentActionProps,\n HeaderActionComponent,\n HeaderActionDescription,\n HeaderActionProps,\n};\n"],"names":["ContentManagerPlugin","addEditViewSidePanel","panels","Array","isArray","editViewSidePanels","Error","getPrintableType","addDocumentAction","actions","documentActions","addDocumentHeaderAction","headerActions","addBulkAction","bulkActions","config","id","PLUGIN_ID","name","injectionZones","INJECTION_ZONES","apis","bind","getBulkActions","getDocumentActions","position","filter","action","undefined","flat","includes","getEditViewSidePanels","getHeaderActions","constructor","DEFAULT_BULK_ACTIONS","DEFAULT_ACTI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AEA,OAAOsB,UAAAA;AACT,CAAA;;;;"}
|
1
|
+
{"version":3,"file":"content-manager.js","sources":["../../admin/src/content-manager.ts"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { INJECTION_ZONES } from './components/InjectionZone';\nimport { PLUGIN_ID } from './constants/plugin';\nimport {\n DEFAULT_ACTIONS,\n type DocumentActionPosition,\n type DocumentActionDescription,\n} from './pages/EditView/components/DocumentActions';\nimport {\n DEFAULT_HEADER_ACTIONS,\n type HeaderActionDescription,\n} from './pages/EditView/components/Header';\nimport { ActionsPanel, type PanelDescription } from './pages/EditView/components/Panels';\nimport {\n DEFAULT_BULK_ACTIONS,\n type BulkActionDescription,\n} from './pages/ListView/components/BulkActions/Actions';\nimport { DEFAULT_TABLE_ROW_ACTIONS } from './pages/ListView/components/TableActions';\n\nimport type { Document } from './hooks/useDocument';\nimport type { DocumentMetadata } from '../../shared/contracts/collection-types';\nimport type { DescriptionComponent, PluginConfig } from '@strapi/admin/strapi-admin';\n\n/* -------------------------------------------------------------------------------------------------\n * Configuration Types\n * -----------------------------------------------------------------------------------------------*/\n\ntype DescriptionReducer<Config extends object> = (prev: Config[]) => Config[];\n\ninterface EditViewContext {\n /**\n * This will ONLY be null, if the content-type\n * does not have draft & published enabled.\n */\n activeTab: 'draft' | 'published' | null;\n /**\n * Will be either 'single-types' | 'collection-types'\n */\n collectionType: string;\n /**\n * this will be undefined if someone is creating an entry.\n */\n document?: Document;\n /**\n * this will be undefined if someone is creating an entry.\n */\n documentId?: string;\n /**\n * this will be undefined if someone is creating an entry.\n */\n meta?: DocumentMetadata;\n /**\n * The current content-type's model.\n */\n model: string;\n}\n\ninterface ListViewContext {\n /**\n * Will be either 'single-types' | 'collection-types'\n */\n collectionType: string;\n /**\n * The current selected documents in the table\n */\n documents: Document[];\n /**\n * The current content-type's model.\n */\n model: string;\n}\n\ninterface PanelComponentProps extends EditViewContext {}\n\ninterface PanelComponent extends DescriptionComponent<PanelComponentProps, PanelDescription> {\n /**\n * The defaults are added by Strapi only, if you're providing your own component,\n * you do not need to provide this.\n */\n type?: 'actions' | 'releases';\n}\n\ninterface DocumentActionProps extends EditViewContext {}\n\ninterface DocumentActionComponent\n extends DescriptionComponent<DocumentActionProps, DocumentActionDescription> {\n type?:\n | 'clone'\n | 'configure-the-view'\n | 'delete'\n | 'discard'\n | 'edit'\n | 'edit-the-model'\n | 'history'\n | 'publish'\n | 'unpublish'\n | 'update';\n position?: DocumentActionDescription['position'];\n}\n\ninterface HeaderActionProps extends EditViewContext {}\n\ninterface HeaderActionComponent\n extends DescriptionComponent<HeaderActionProps, HeaderActionDescription> {}\n\ninterface BulkActionComponentProps extends ListViewContext {}\n\ninterface BulkActionComponent\n extends DescriptionComponent<BulkActionComponentProps, BulkActionDescription> {\n type?: 'delete' | 'publish' | 'unpublish';\n}\n\n/* -------------------------------------------------------------------------------------------------\n * ContentManager plugin\n * -----------------------------------------------------------------------------------------------*/\n\nclass ContentManagerPlugin {\n /**\n * The following properties are the stored ones provided by any plugins registering with\n * the content-manager. The function calls however, need to be called at runtime in the\n * application, so instead we collate them and run them later with the complete list incl.\n * ones already registered & the context of the view.\n */\n bulkActions: BulkActionComponent[] = [...DEFAULT_BULK_ACTIONS];\n documentActions: DocumentActionComponent[] = [\n ...DEFAULT_ACTIONS,\n ...DEFAULT_TABLE_ROW_ACTIONS,\n ...DEFAULT_HEADER_ACTIONS,\n ];\n editViewSidePanels: PanelComponent[] = [ActionsPanel];\n headerActions: HeaderActionComponent[] = [];\n\n constructor() {}\n\n addEditViewSidePanel(panels: DescriptionReducer<PanelComponent>): void;\n addEditViewSidePanel(panels: PanelComponent[]): void;\n addEditViewSidePanel(panels: DescriptionReducer<PanelComponent> | PanelComponent[]) {\n if (Array.isArray(panels)) {\n this.editViewSidePanels = [...this.editViewSidePanels, ...panels];\n } else if (typeof panels === 'function') {\n this.editViewSidePanels = panels(this.editViewSidePanels);\n } else {\n throw new Error(\n `Expected the \\`panels\\` passed to \\`addEditViewSidePanel\\` to be an array or a function, but received ${getPrintableType(\n panels\n )}`\n );\n }\n }\n\n addDocumentAction(actions: DescriptionReducer<DocumentActionComponent>): void;\n addDocumentAction(actions: DocumentActionComponent[]): void;\n addDocumentAction(\n actions: DescriptionReducer<DocumentActionComponent> | DocumentActionComponent[]\n ) {\n if (Array.isArray(actions)) {\n this.documentActions = [...this.documentActions, ...actions];\n } else if (typeof actions === 'function') {\n this.documentActions = actions(this.documentActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addDocumentAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n addDocumentHeaderAction(actions: DescriptionReducer<HeaderActionComponent>): void;\n addDocumentHeaderAction(actions: HeaderActionComponent[]): void;\n addDocumentHeaderAction(\n actions: DescriptionReducer<HeaderActionComponent> | HeaderActionComponent[]\n ) {\n if (Array.isArray(actions)) {\n this.headerActions = [...this.headerActions, ...actions];\n } else if (typeof actions === 'function') {\n this.headerActions = actions(this.headerActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addDocumentHeaderAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n addBulkAction(actions: DescriptionReducer<BulkActionComponent>): void;\n addBulkAction(actions: BulkActionComponent[]): void;\n addBulkAction(actions: DescriptionReducer<BulkActionComponent> | BulkActionComponent[]) {\n if (Array.isArray(actions)) {\n this.bulkActions = [...this.bulkActions, ...actions];\n } else if (typeof actions === 'function') {\n this.bulkActions = actions(this.bulkActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addBulkAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n get config() {\n return {\n id: PLUGIN_ID,\n name: 'Content Manager',\n injectionZones: INJECTION_ZONES,\n apis: {\n addBulkAction: this.addBulkAction.bind(this),\n addDocumentAction: this.addDocumentAction.bind(this),\n addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),\n addEditViewSidePanel: this.addEditViewSidePanel.bind(this),\n getBulkActions: () => this.bulkActions,\n getDocumentActions: (position?: DocumentActionPosition) => {\n /**\n * When possible, pre-filter the actions by the components static position property.\n * This avoids rendering the actions in multiple places where they weren't displayed,\n * which wasn't visible but created issues with useEffect for instance.\n * The response should still be filtered by the position, as the static property is new\n * and not mandatory to avoid a breaking change.\n */\n if (position) {\n return this.documentActions.filter((action) => {\n return action.position == undefined || [action.position].flat().includes(position);\n });\n }\n\n return this.documentActions;\n },\n getEditViewSidePanels: () => this.editViewSidePanels,\n getHeaderActions: () => this.headerActions,\n },\n } satisfies PluginConfig;\n }\n}\n\n/* -------------------------------------------------------------------------------------------------\n * getPrintableType\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description Gets the human-friendly printable type name for the given value, for instance it will yield\n * `array` instead of `object`, as the native `typeof` operator would do.\n */\nconst getPrintableType = (value: unknown): string => {\n const nativeType = typeof value;\n\n if (nativeType === 'object') {\n if (value === null) return 'null';\n if (Array.isArray(value)) return 'array';\n if (value instanceof Object && value.constructor.name !== 'Object') {\n return value.constructor.name;\n }\n }\n\n return nativeType;\n};\n\nexport { ContentManagerPlugin };\nexport type {\n EditViewContext,\n ListViewContext,\n BulkActionComponent,\n BulkActionComponentProps,\n BulkActionDescription,\n DescriptionComponent,\n DescriptionReducer,\n PanelComponentProps,\n PanelComponent,\n PanelDescription,\n DocumentActionComponent,\n DocumentActionDescription,\n DocumentActionProps,\n HeaderActionComponent,\n HeaderActionDescription,\n HeaderActionProps,\n};\n"],"names":["ContentManagerPlugin","addEditViewSidePanel","panels","Array","isArray","editViewSidePanels","Error","getPrintableType","addDocumentAction","actions","documentActions","addDocumentHeaderAction","headerActions","addBulkAction","bulkActions","config","id","PLUGIN_ID","name","injectionZones","INJECTION_ZONES","apis","bind","getBulkActions","getDocumentActions","position","filter","action","undefined","flat","includes","getEditViewSidePanels","getHeaderActions","constructor","DEFAULT_BULK_ACTIONS","DEFAULT_ACTIONS","DEFAULT_TABLE_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A;AACT,CAAA;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"content-manager.mjs","sources":["../../admin/src/content-manager.ts"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { INJECTION_ZONES } from './components/InjectionZone';\nimport { PLUGIN_ID } from './constants/plugin';\nimport {\n DEFAULT_ACTIONS,\n type DocumentActionPosition,\n type DocumentActionDescription,\n} from './pages/EditView/components/DocumentActions';\nimport {\n DEFAULT_HEADER_ACTIONS,\n type HeaderActionDescription,\n} from './pages/EditView/components/Header';\nimport { ActionsPanel, type PanelDescription } from './pages/EditView/components/Panels';\nimport {\n DEFAULT_BULK_ACTIONS,\n type BulkActionDescription,\n} from './pages/ListView/components/BulkActions/Actions';\nimport { DEFAULT_TABLE_ROW_ACTIONS } from './pages/ListView/components/TableActions';\n\nimport type { Document } from './hooks/useDocument';\nimport type { DocumentMetadata } from '../../shared/contracts/collection-types';\nimport type { DescriptionComponent, PluginConfig } from '@strapi/admin/strapi-admin';\n\n/* -------------------------------------------------------------------------------------------------\n * Configuration Types\n * -----------------------------------------------------------------------------------------------*/\n\ntype DescriptionReducer<Config extends object> = (prev: Config[]) => Config[];\n\ninterface EditViewContext {\n /**\n * This will ONLY be null, if the content-type\n * does not have draft & published enabled.\n */\n activeTab: 'draft' | 'published' | null;\n /**\n * Will be either 'single-types' | 'collection-types'\n */\n collectionType: string;\n /**\n * this will be undefined if someone is creating an entry.\n */\n document?: Document;\n /**\n * this will be undefined if someone is creating an entry.\n */\n documentId?: string;\n /**\n * this will be undefined if someone is creating an entry.\n */\n meta?: DocumentMetadata;\n /**\n * The current content-type's model.\n */\n model: string;\n}\n\ninterface ListViewContext {\n /**\n * Will be either 'single-types' | 'collection-types'\n */\n collectionType: string;\n /**\n * The current selected documents in the table\n */\n documents: Document[];\n /**\n * The current content-type's model.\n */\n model: string;\n}\n\ninterface PanelComponentProps extends EditViewContext {}\n\ninterface PanelComponent extends DescriptionComponent<PanelComponentProps, PanelDescription> {\n /**\n * The defaults are added by Strapi only, if you're providing your own component,\n * you do not need to provide this.\n */\n type?: 'actions' | 'releases';\n}\n\ninterface DocumentActionProps extends EditViewContext {\n onPreview?: () => void;\n fromPreview?: boolean;\n fromRelationModal?: boolean;\n}\n\ninterface DocumentActionComponent\n extends DescriptionComponent<DocumentActionProps, DocumentActionDescription> {\n type?:\n | 'clone'\n | 'configure-the-view'\n | 'delete'\n | 'discard'\n | 'edit'\n | 'edit-the-model'\n | 'history'\n | 'publish'\n | 'unpublish'\n | 'update';\n position?: DocumentActionDescription['position'];\n}\n\ninterface HeaderActionProps extends EditViewContext {}\n\ninterface HeaderActionComponent\n extends DescriptionComponent<HeaderActionProps, HeaderActionDescription> {}\n\ninterface BulkActionComponentProps extends ListViewContext {}\n\ninterface BulkActionComponent\n extends DescriptionComponent<BulkActionComponentProps, BulkActionDescription> {\n type?: 'delete' | 'publish' | 'unpublish';\n}\n\n/* -------------------------------------------------------------------------------------------------\n * ContentManager plugin\n * -----------------------------------------------------------------------------------------------*/\n\nclass ContentManagerPlugin {\n /**\n * The following properties are the stored ones provided by any plugins registering with\n * the content-manager. The function calls however, need to be called at runtime in the\n * application, so instead we collate them and run them later with the complete list incl.\n * ones already registered & the context of the view.\n */\n bulkActions: BulkActionComponent[] = [...DEFAULT_BULK_ACTIONS];\n documentActions: DocumentActionComponent[] = [\n ...DEFAULT_ACTIONS,\n ...DEFAULT_TABLE_ROW_ACTIONS,\n ...DEFAULT_HEADER_ACTIONS,\n ];\n editViewSidePanels: PanelComponent[] = [ActionsPanel];\n headerActions: HeaderActionComponent[] = [];\n\n constructor() {}\n\n addEditViewSidePanel(panels: DescriptionReducer<PanelComponent>): void;\n addEditViewSidePanel(panels: PanelComponent[]): void;\n addEditViewSidePanel(panels: DescriptionReducer<PanelComponent> | PanelComponent[]) {\n if (Array.isArray(panels)) {\n this.editViewSidePanels = [...this.editViewSidePanels, ...panels];\n } else if (typeof panels === 'function') {\n this.editViewSidePanels = panels(this.editViewSidePanels);\n } else {\n throw new Error(\n `Expected the \\`panels\\` passed to \\`addEditViewSidePanel\\` to be an array or a function, but received ${getPrintableType(\n panels\n )}`\n );\n }\n }\n\n addDocumentAction(actions: DescriptionReducer<DocumentActionComponent>): void;\n addDocumentAction(actions: DocumentActionComponent[]): void;\n addDocumentAction(\n actions: DescriptionReducer<DocumentActionComponent> | DocumentActionComponent[]\n ) {\n if (Array.isArray(actions)) {\n this.documentActions = [...this.documentActions, ...actions];\n } else if (typeof actions === 'function') {\n this.documentActions = actions(this.documentActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addDocumentAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n addDocumentHeaderAction(actions: DescriptionReducer<HeaderActionComponent>): void;\n addDocumentHeaderAction(actions: HeaderActionComponent[]): void;\n addDocumentHeaderAction(\n actions: DescriptionReducer<HeaderActionComponent> | HeaderActionComponent[]\n ) {\n if (Array.isArray(actions)) {\n this.headerActions = [...this.headerActions, ...actions];\n } else if (typeof actions === 'function') {\n this.headerActions = actions(this.headerActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addDocumentHeaderAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n addBulkAction(actions: DescriptionReducer<BulkActionComponent>): void;\n addBulkAction(actions: BulkActionComponent[]): void;\n addBulkAction(actions: DescriptionReducer<BulkActionComponent> | BulkActionComponent[]) {\n if (Array.isArray(actions)) {\n this.bulkActions = [...this.bulkActions, ...actions];\n } else if (typeof actions === 'function') {\n this.bulkActions = actions(this.bulkActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addBulkAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n get config() {\n return {\n id: PLUGIN_ID,\n name: 'Content Manager',\n injectionZones: INJECTION_ZONES,\n apis: {\n addBulkAction: this.addBulkAction.bind(this),\n addDocumentAction: this.addDocumentAction.bind(this),\n addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),\n addEditViewSidePanel: this.addEditViewSidePanel.bind(this),\n getBulkActions: () => this.bulkActions,\n getDocumentActions: (position?: DocumentActionPosition) => {\n /**\n * When possible, pre-filter the actions by the components static position property.\n * This avoids rendering the actions in multiple places where they weren't displayed,\n * which wasn't visible but created issues with useEffect for instance.\n * The response should still be filtered by the position, as the static property is new\n * and not mandatory to avoid a breaking change.\n */\n if (position) {\n return this.documentActions.filter((action) => {\n return action.position == undefined || [action.position].flat().includes(position);\n });\n }\n\n return this.documentActions;\n },\n getEditViewSidePanels: () => this.editViewSidePanels,\n getHeaderActions: () => this.headerActions,\n },\n } satisfies PluginConfig;\n }\n}\n\n/* -------------------------------------------------------------------------------------------------\n * getPrintableType\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description Gets the human-friendly printable type name for the given value, for instance it will yield\n * `array` instead of `object`, as the native `typeof` operator would do.\n */\nconst getPrintableType = (value: unknown): string => {\n const nativeType = typeof value;\n\n if (nativeType === 'object') {\n if (value === null) return 'null';\n if (Array.isArray(value)) return 'array';\n if (value instanceof Object && value.constructor.name !== 'Object') {\n return value.constructor.name;\n }\n }\n\n return nativeType;\n};\n\nexport { ContentManagerPlugin };\nexport type {\n EditViewContext,\n ListViewContext,\n BulkActionComponent,\n BulkActionComponentProps,\n BulkActionDescription,\n DescriptionComponent,\n DescriptionReducer,\n PanelComponentProps,\n PanelComponent,\n PanelDescription,\n DocumentActionComponent,\n DocumentActionDescription,\n DocumentActionProps,\n HeaderActionComponent,\n HeaderActionDescription,\n HeaderActionProps,\n};\n"],"names":["ContentManagerPlugin","addEditViewSidePanel","panels","Array","isArray","editViewSidePanels","Error","getPrintableType","addDocumentAction","actions","documentActions","addDocumentHeaderAction","headerActions","addBulkAction","bulkActions","config","id","PLUGIN_ID","name","injectionZones","INJECTION_ZONES","apis","bind","getBulkActions","getDocumentActions","position","filter","action","undefined","flat","includes","getEditViewSidePanels","getHeaderActions","constructor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AAW,CAACf,IAAI;AAC/B;AACF;IAEA,OAAOsB,UAAAA;AACT,CAAA;;;;"}
|
1
|
+
{"version":3,"file":"content-manager.mjs","sources":["../../admin/src/content-manager.ts"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { INJECTION_ZONES } from './components/InjectionZone';\nimport { PLUGIN_ID } from './constants/plugin';\nimport {\n DEFAULT_ACTIONS,\n type DocumentActionPosition,\n type DocumentActionDescription,\n} from './pages/EditView/components/DocumentActions';\nimport {\n DEFAULT_HEADER_ACTIONS,\n type HeaderActionDescription,\n} from './pages/EditView/components/Header';\nimport { ActionsPanel, type PanelDescription } from './pages/EditView/components/Panels';\nimport {\n DEFAULT_BULK_ACTIONS,\n type BulkActionDescription,\n} from './pages/ListView/components/BulkActions/Actions';\nimport { DEFAULT_TABLE_ROW_ACTIONS } from './pages/ListView/components/TableActions';\n\nimport type { Document } from './hooks/useDocument';\nimport type { DocumentMetadata } from '../../shared/contracts/collection-types';\nimport type { DescriptionComponent, PluginConfig } from '@strapi/admin/strapi-admin';\n\n/* -------------------------------------------------------------------------------------------------\n * Configuration Types\n * -----------------------------------------------------------------------------------------------*/\n\ntype DescriptionReducer<Config extends object> = (prev: Config[]) => Config[];\n\ninterface EditViewContext {\n /**\n * This will ONLY be null, if the content-type\n * does not have draft & published enabled.\n */\n activeTab: 'draft' | 'published' | null;\n /**\n * Will be either 'single-types' | 'collection-types'\n */\n collectionType: string;\n /**\n * this will be undefined if someone is creating an entry.\n */\n document?: Document;\n /**\n * this will be undefined if someone is creating an entry.\n */\n documentId?: string;\n /**\n * this will be undefined if someone is creating an entry.\n */\n meta?: DocumentMetadata;\n /**\n * The current content-type's model.\n */\n model: string;\n}\n\ninterface ListViewContext {\n /**\n * Will be either 'single-types' | 'collection-types'\n */\n collectionType: string;\n /**\n * The current selected documents in the table\n */\n documents: Document[];\n /**\n * The current content-type's model.\n */\n model: string;\n}\n\ninterface PanelComponentProps extends EditViewContext {}\n\ninterface PanelComponent extends DescriptionComponent<PanelComponentProps, PanelDescription> {\n /**\n * The defaults are added by Strapi only, if you're providing your own component,\n * you do not need to provide this.\n */\n type?: 'actions' | 'releases';\n}\n\ninterface DocumentActionProps extends EditViewContext {}\n\ninterface DocumentActionComponent\n extends DescriptionComponent<DocumentActionProps, DocumentActionDescription> {\n type?:\n | 'clone'\n | 'configure-the-view'\n | 'delete'\n | 'discard'\n | 'edit'\n | 'edit-the-model'\n | 'history'\n | 'publish'\n | 'unpublish'\n | 'update';\n position?: DocumentActionDescription['position'];\n}\n\ninterface HeaderActionProps extends EditViewContext {}\n\ninterface HeaderActionComponent\n extends DescriptionComponent<HeaderActionProps, HeaderActionDescription> {}\n\ninterface BulkActionComponentProps extends ListViewContext {}\n\ninterface BulkActionComponent\n extends DescriptionComponent<BulkActionComponentProps, BulkActionDescription> {\n type?: 'delete' | 'publish' | 'unpublish';\n}\n\n/* -------------------------------------------------------------------------------------------------\n * ContentManager plugin\n * -----------------------------------------------------------------------------------------------*/\n\nclass ContentManagerPlugin {\n /**\n * The following properties are the stored ones provided by any plugins registering with\n * the content-manager. The function calls however, need to be called at runtime in the\n * application, so instead we collate them and run them later with the complete list incl.\n * ones already registered & the context of the view.\n */\n bulkActions: BulkActionComponent[] = [...DEFAULT_BULK_ACTIONS];\n documentActions: DocumentActionComponent[] = [\n ...DEFAULT_ACTIONS,\n ...DEFAULT_TABLE_ROW_ACTIONS,\n ...DEFAULT_HEADER_ACTIONS,\n ];\n editViewSidePanels: PanelComponent[] = [ActionsPanel];\n headerActions: HeaderActionComponent[] = [];\n\n constructor() {}\n\n addEditViewSidePanel(panels: DescriptionReducer<PanelComponent>): void;\n addEditViewSidePanel(panels: PanelComponent[]): void;\n addEditViewSidePanel(panels: DescriptionReducer<PanelComponent> | PanelComponent[]) {\n if (Array.isArray(panels)) {\n this.editViewSidePanels = [...this.editViewSidePanels, ...panels];\n } else if (typeof panels === 'function') {\n this.editViewSidePanels = panels(this.editViewSidePanels);\n } else {\n throw new Error(\n `Expected the \\`panels\\` passed to \\`addEditViewSidePanel\\` to be an array or a function, but received ${getPrintableType(\n panels\n )}`\n );\n }\n }\n\n addDocumentAction(actions: DescriptionReducer<DocumentActionComponent>): void;\n addDocumentAction(actions: DocumentActionComponent[]): void;\n addDocumentAction(\n actions: DescriptionReducer<DocumentActionComponent> | DocumentActionComponent[]\n ) {\n if (Array.isArray(actions)) {\n this.documentActions = [...this.documentActions, ...actions];\n } else if (typeof actions === 'function') {\n this.documentActions = actions(this.documentActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addDocumentAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n addDocumentHeaderAction(actions: DescriptionReducer<HeaderActionComponent>): void;\n addDocumentHeaderAction(actions: HeaderActionComponent[]): void;\n addDocumentHeaderAction(\n actions: DescriptionReducer<HeaderActionComponent> | HeaderActionComponent[]\n ) {\n if (Array.isArray(actions)) {\n this.headerActions = [...this.headerActions, ...actions];\n } else if (typeof actions === 'function') {\n this.headerActions = actions(this.headerActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addDocumentHeaderAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n addBulkAction(actions: DescriptionReducer<BulkActionComponent>): void;\n addBulkAction(actions: BulkActionComponent[]): void;\n addBulkAction(actions: DescriptionReducer<BulkActionComponent> | BulkActionComponent[]) {\n if (Array.isArray(actions)) {\n this.bulkActions = [...this.bulkActions, ...actions];\n } else if (typeof actions === 'function') {\n this.bulkActions = actions(this.bulkActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addBulkAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n get config() {\n return {\n id: PLUGIN_ID,\n name: 'Content Manager',\n injectionZones: INJECTION_ZONES,\n apis: {\n addBulkAction: this.addBulkAction.bind(this),\n addDocumentAction: this.addDocumentAction.bind(this),\n addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),\n addEditViewSidePanel: this.addEditViewSidePanel.bind(this),\n getBulkActions: () => this.bulkActions,\n getDocumentActions: (position?: DocumentActionPosition) => {\n /**\n * When possible, pre-filter the actions by the components static position property.\n * This avoids rendering the actions in multiple places where they weren't displayed,\n * which wasn't visible but created issues with useEffect for instance.\n * The response should still be filtered by the position, as the static property is new\n * and not mandatory to avoid a breaking change.\n */\n if (position) {\n return this.documentActions.filter((action) => {\n return action.position == undefined || [action.position].flat().includes(position);\n });\n }\n\n return this.documentActions;\n },\n getEditViewSidePanels: () => this.editViewSidePanels,\n getHeaderActions: () => this.headerActions,\n },\n } satisfies PluginConfig;\n }\n}\n\n/* -------------------------------------------------------------------------------------------------\n * getPrintableType\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description Gets the human-friendly printable type name for the given value, for instance it will yield\n * `array` instead of `object`, as the native `typeof` operator would do.\n */\nconst getPrintableType = (value: unknown): string => {\n const nativeType = typeof value;\n\n if (nativeType === 'object') {\n if (value === null) return 'null';\n if (Array.isArray(value)) return 'array';\n if (value instanceof Object && value.constructor.name !== 'Object') {\n return value.constructor.name;\n }\n }\n\n return nativeType;\n};\n\nexport { ContentManagerPlugin };\nexport type {\n EditViewContext,\n ListViewContext,\n BulkActionComponent,\n BulkActionComponentProps,\n BulkActionDescription,\n DescriptionComponent,\n DescriptionReducer,\n PanelComponentProps,\n PanelComponent,\n PanelDescription,\n DocumentActionComponent,\n DocumentActionDescription,\n DocumentActionProps,\n HeaderActionComponent,\n HeaderActionDescription,\n HeaderActionProps,\n};\n"],"names":["ContentManagerPlugin","addEditViewSidePanel","panels","Array","isArray","editViewSidePanels","Error","getPrintableType","addDocumentAction","actions","documentActions","addDocumentHeaderAction","headerActions","addBulkAction","bulkActions","config","id","PLUGIN_ID","name","injectionZones","INJECTION_ZONES","apis","bind","getBulkActions","getDocumentActions","position","filter","action","undefined","flat","includes","getEditViewSidePanels","getHeaderActions","constructor","DEFAULT_BULK_ACTIONS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B;AACF;IAEA,OAAOsB,UAAAA;AACT,CAAA;;;;"}
|
@@ -9,7 +9,6 @@ var reactIntl = require('react-intl');
|
|
9
9
|
var reactRouterDom = require('react-router-dom');
|
10
10
|
var collections = require('../../constants/collections.js');
|
11
11
|
var plugin = require('../../constants/plugin.js');
|
12
|
-
var DocumentContext = require('../../features/DocumentContext.js');
|
13
12
|
var DocumentRBAC = require('../../features/DocumentRBAC.js');
|
14
13
|
var useDocument = require('../../hooks/useDocument.js');
|
15
14
|
var useDocumentLayout = require('../../hooks/useDocumentLayout.js');
|
@@ -157,14 +156,7 @@ const [HistoryProvider, useHistoryContext] = strapiAdmin.createContext('HistoryP
|
|
157
156
|
/*#__PURE__*/ jsxRuntime.jsx(VersionHeader.VersionHeader, {
|
158
157
|
headerId: headerId
|
159
158
|
}),
|
160
|
-
/*#__PURE__*/ jsxRuntime.jsx(
|
161
|
-
initialDocument: {
|
162
|
-
documentId: documentId || '',
|
163
|
-
model: slug,
|
164
|
-
collectionType: collectionType || ''
|
165
|
-
},
|
166
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(VersionContent.VersionContent, {})
|
167
|
-
})
|
159
|
+
/*#__PURE__*/ jsxRuntime.jsx(VersionContent.VersionContent, {})
|
168
160
|
]
|
169
161
|
}),
|
170
162
|
/*#__PURE__*/ jsxRuntime.jsx(VersionsList.VersionsList, {})
|