@strapi/content-manager 0.0.0-experimental.5b211b38912691ee2eab22d47b5095ea2fcfec76 → 0.0.0-experimental.5c463a4f3349c33b8034dcda66a04758d0efc542
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/LICENSE +18 -3
- package/dist/_chunks/{ComponentConfigurationPage-C-49MccQ.js → ComponentConfigurationPage-Cr0ttPAZ.js} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-C-49MccQ.js.map → ComponentConfigurationPage-Cr0ttPAZ.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DmwmiFQy.mjs → ComponentConfigurationPage-UGIFDkPO.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-DmwmiFQy.mjs.map → ComponentConfigurationPage-UGIFDkPO.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-JT3E7NZy.mjs → EditConfigurationPage-7hF4_8yK.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-JT3E7NZy.mjs.map → EditConfigurationPage-7hF4_8yK.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-DjFJw56M.js → EditConfigurationPage-Ds3BOL2z.js} +4 -4
- package/dist/_chunks/{EditConfigurationPage-DjFJw56M.js.map → EditConfigurationPage-Ds3BOL2z.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-CPj61RMh.mjs → EditViewPage-CA98g5_g.mjs} +63 -12
- package/dist/_chunks/EditViewPage-CA98g5_g.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-zT3fBr4Y.js → EditViewPage-DoQm9llG.js} +62 -11
- package/dist/_chunks/EditViewPage-DoQm9llG.js.map +1 -0
- package/dist/_chunks/{Field-dha5VnIQ.mjs → Field-B2C1tq9_.mjs} +269 -152
- package/dist/_chunks/Field-B2C1tq9_.mjs.map +1 -0
- package/dist/_chunks/{Field-Boxf9Ajp.js → Field-CQtLQzHl.js} +271 -154
- package/dist/_chunks/Field-CQtLQzHl.js.map +1 -0
- package/dist/_chunks/{Form-DHrru2AV.mjs → Form-CxQ2pPjq.mjs} +36 -17
- package/dist/_chunks/Form-CxQ2pPjq.mjs.map +1 -0
- package/dist/_chunks/{Form-y5g1SRsh.js → Form-YQaS3_NH.js} +36 -17
- package/dist/_chunks/Form-YQaS3_NH.js.map +1 -0
- package/dist/_chunks/{History-Bru_KoeP.mjs → History-DTYKr2Cg.mjs} +77 -62
- package/dist/_chunks/History-DTYKr2Cg.mjs.map +1 -0
- package/dist/_chunks/{History-CqN6K7SX.js → History-DbdpigyF.js} +76 -61
- package/dist/_chunks/History-DbdpigyF.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-D8wGABj0.mjs → ListConfigurationPage-DQG-j52q.mjs} +21 -9
- package/dist/_chunks/ListConfigurationPage-DQG-j52q.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-R_p-SbHZ.js → ListConfigurationPage-DRGhXnUA.js} +21 -9
- package/dist/_chunks/ListConfigurationPage-DRGhXnUA.js.map +1 -0
- package/dist/_chunks/{ListViewPage-pEw_zug9.js → ListViewPage-CVIEfYWN.js} +86 -46
- package/dist/_chunks/ListViewPage-CVIEfYWN.js.map +1 -0
- package/dist/_chunks/{ListViewPage-SID6TRb9.mjs → ListViewPage-DAekmnvp.mjs} +84 -44
- package/dist/_chunks/ListViewPage-DAekmnvp.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-CJ7UXwrQ.mjs → NoContentTypePage-5kwUPeFg.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-CJ7UXwrQ.mjs.map → NoContentTypePage-5kwUPeFg.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-C5dcQojD.js → NoContentTypePage-CTcfA2-Q.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-C5dcQojD.js.map → NoContentTypePage-CTcfA2-Q.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-B7syEq5E.mjs → NoPermissionsPage-d-JtEVAw.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-B7syEq5E.mjs.map → NoPermissionsPage-d-JtEVAw.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-BtPrImPP.js → NoPermissionsPage-pVeCVj9a.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-BtPrImPP.js.map → NoPermissionsPage-pVeCVj9a.js.map} +1 -1
- package/dist/_chunks/Preview-COsm52rZ.js +307 -0
- package/dist/_chunks/Preview-COsm52rZ.js.map +1 -0
- package/dist/_chunks/Preview-gkmvcwhu.mjs +288 -0
- package/dist/_chunks/Preview-gkmvcwhu.mjs.map +1 -0
- package/dist/_chunks/{Relations-B9Crnhnn.mjs → Relations-7ItTFWp7.mjs} +73 -37
- package/dist/_chunks/Relations-7ItTFWp7.mjs.map +1 -0
- package/dist/_chunks/{Relations-DjTQ5kGB.js → Relations-Beo_uDz1.js} +72 -36
- package/dist/_chunks/Relations-Beo_uDz1.js.map +1 -0
- package/dist/_chunks/{en-fbKQxLGn.js → en-CHOp_xJv.js} +27 -16
- package/dist/_chunks/{en-fbKQxLGn.js.map → en-CHOp_xJv.js.map} +1 -1
- package/dist/_chunks/{en-Ux26r5pl.mjs → en-D_BMf0hT.mjs} +27 -16
- package/dist/_chunks/{en-Ux26r5pl.mjs.map → en-D_BMf0hT.mjs.map} +1 -1
- package/dist/_chunks/{es-EUonQTon.js → es-9K52xZIr.js} +2 -2
- package/dist/_chunks/{ja-CcFe8diO.js.map → es-9K52xZIr.js.map} +1 -1
- package/dist/_chunks/{es-CeXiYflN.mjs → es-D34tqjMw.mjs} +2 -2
- package/dist/_chunks/{es-CeXiYflN.mjs.map → es-D34tqjMw.mjs.map} +1 -1
- package/dist/_chunks/{fr-CD9VFbPM.mjs → fr--pg5jUbt.mjs} +13 -3
- package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr--pg5jUbt.mjs.map} +1 -1
- package/dist/_chunks/{fr-B7kGGg3E.js → fr-B2Kyv8Z9.js} +13 -3
- package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-B2Kyv8Z9.js.map} +1 -1
- package/dist/_chunks/{index-DVPWZkbS.js → index-CJX65DLa.js} +1070 -680
- package/dist/_chunks/index-CJX65DLa.js.map +1 -0
- package/dist/_chunks/{index-DJXJw9V5.mjs → index-D3IiO0X8.mjs} +1088 -699
- package/dist/_chunks/index-D3IiO0X8.mjs.map +1 -0
- package/dist/_chunks/{ja-CcFe8diO.js → ja-7sfIbjxE.js} +2 -2
- package/dist/_chunks/{es-EUonQTon.js.map → ja-7sfIbjxE.js.map} +1 -1
- package/dist/_chunks/{ja-CtsUxOvk.mjs → ja-BHqhDq4V.mjs} +2 -2
- package/dist/_chunks/{ja-CtsUxOvk.mjs.map → ja-BHqhDq4V.mjs.map} +1 -1
- package/dist/_chunks/{layout-Dm6fbiQj.js → layout-9fI2_QJt.js} +24 -11
- package/dist/_chunks/layout-9fI2_QJt.js.map +1 -0
- package/dist/_chunks/{layout-Bau7ZfLV.mjs → layout-OhrmoJVB.mjs} +25 -12
- package/dist/_chunks/layout-OhrmoJVB.mjs.map +1 -0
- package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
- package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
- package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
- package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
- package/dist/_chunks/{relations-CKnpRgrN.js → relations-DIT8sP52.js} +6 -7
- package/dist/_chunks/relations-DIT8sP52.js.map +1 -0
- package/dist/_chunks/{relations-BH_kBSJ0.mjs → relations-sRERvWmr.mjs} +6 -7
- package/dist/_chunks/relations-sRERvWmr.mjs.map +1 -0
- package/dist/_chunks/{usePrev-B9w_-eYc.js → useDebounce-CtcjDB3L.js} +14 -1
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
- package/dist/admin/index.js +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +5 -4
- package/dist/admin/src/exports.d.ts +1 -1
- package/dist/admin/src/history/index.d.ts +3 -0
- package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
- package/dist/admin/src/hooks/useDocument.d.ts +32 -1
- package/dist/admin/src/index.d.ts +1 -0
- package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -0
- package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +20 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +4 -48
- package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
- package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
- package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
- package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
- package/dist/admin/src/preview/constants.d.ts +1 -0
- package/dist/admin/src/preview/index.d.ts +4 -0
- package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
- package/dist/admin/src/preview/routes.d.ts +3 -0
- package/dist/admin/src/preview/services/preview.d.ts +3 -0
- package/dist/admin/src/router.d.ts +1 -1
- package/dist/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/components.d.ts +2 -2
- package/dist/admin/src/services/contentTypes.d.ts +3 -3
- package/dist/admin/src/services/documents.d.ts +19 -17
- package/dist/admin/src/services/init.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +2 -2
- package/dist/admin/src/services/uid.d.ts +3 -3
- package/dist/admin/src/utils/validation.d.ts +4 -1
- package/dist/server/index.js +548 -261
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +549 -262
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/relations.d.ts.map +1 -1
- package/dist/server/src/controllers/uid.d.ts.map +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts +15 -1
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/dimensions.d.ts +4 -2
- package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -1
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +4 -4
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +4 -4
- package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
- package/dist/server/src/preview/constants.d.ts +2 -0
- package/dist/server/src/preview/constants.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/index.d.ts +2 -0
- package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/preview.d.ts +13 -0
- package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
- package/dist/server/src/preview/index.d.ts +4 -0
- package/dist/server/src/preview/index.d.ts.map +1 -0
- package/dist/server/src/preview/routes/index.d.ts +8 -0
- package/dist/server/src/preview/routes/index.d.ts.map +1 -0
- package/dist/server/src/preview/routes/preview.d.ts +4 -0
- package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
- package/dist/server/src/preview/services/index.d.ts +15 -0
- package/dist/server/src/preview/services/index.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview-config.d.ts +30 -0
- package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview.d.ts +12 -0
- package/dist/server/src/preview/services/preview.d.ts.map +1 -0
- package/dist/server/src/preview/utils.d.ts +18 -0
- package/dist/server/src/preview/utils.d.ts.map +1 -0
- package/dist/server/src/routes/index.d.ts.map +1 -1
- package/dist/server/src/services/document-manager.d.ts.map +1 -1
- package/dist/server/src/services/document-metadata.d.ts +8 -8
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +4 -4
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/permission-checker.d.ts.map +1 -1
- package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
- package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts +2 -0
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/shared/contracts/collection-types.d.ts +3 -1
- package/dist/shared/contracts/collection-types.d.ts.map +1 -1
- package/dist/shared/contracts/index.d.ts +1 -0
- package/dist/shared/contracts/index.d.ts.map +1 -1
- package/dist/shared/contracts/preview.d.ts +27 -0
- package/dist/shared/contracts/preview.d.ts.map +1 -0
- package/dist/shared/index.js +4 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +4 -0
- package/dist/shared/index.mjs.map +1 -1
- package/package.json +13 -13
- package/dist/_chunks/EditViewPage-CPj61RMh.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-zT3fBr4Y.js.map +0 -1
- package/dist/_chunks/Field-Boxf9Ajp.js.map +0 -1
- package/dist/_chunks/Field-dha5VnIQ.mjs.map +0 -1
- package/dist/_chunks/Form-DHrru2AV.mjs.map +0 -1
- package/dist/_chunks/Form-y5g1SRsh.js.map +0 -1
- package/dist/_chunks/History-Bru_KoeP.mjs.map +0 -1
- package/dist/_chunks/History-CqN6K7SX.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-D8wGABj0.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-R_p-SbHZ.js.map +0 -1
- package/dist/_chunks/ListViewPage-SID6TRb9.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-pEw_zug9.js.map +0 -1
- package/dist/_chunks/Relations-B9Crnhnn.mjs.map +0 -1
- package/dist/_chunks/Relations-DjTQ5kGB.js.map +0 -1
- package/dist/_chunks/index-DJXJw9V5.mjs.map +0 -1
- package/dist/_chunks/index-DVPWZkbS.js.map +0 -1
- package/dist/_chunks/layout-Bau7ZfLV.mjs.map +0 -1
- package/dist/_chunks/layout-Dm6fbiQj.js.map +0 -1
- package/dist/_chunks/relations-BH_kBSJ0.mjs.map +0 -1
- package/dist/_chunks/relations-CKnpRgrN.js.map +0 -1
- package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
- package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
- package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
- package/strapi-server.js +0 -3
@@ -2,15 +2,16 @@
|
|
2
2
|
const Icons = require("@strapi/icons");
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
4
4
|
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
5
|
-
const qs = require("qs");
|
6
|
-
const reactIntl = require("react-intl");
|
7
|
-
const reactRouterDom = require("react-router-dom");
|
8
5
|
const React = require("react");
|
9
6
|
const designSystem = require("@strapi/design-system");
|
10
|
-
const
|
7
|
+
const mapValues = require("lodash/fp/mapValues");
|
8
|
+
const reactIntl = require("react-intl");
|
9
|
+
const reactRouterDom = require("react-router-dom");
|
11
10
|
const yup = require("yup");
|
12
11
|
const pipe = require("lodash/fp/pipe");
|
13
12
|
const dateFns = require("date-fns");
|
13
|
+
const styledComponents = require("styled-components");
|
14
|
+
const qs = require("qs");
|
14
15
|
const toolkit = require("@reduxjs/toolkit");
|
15
16
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
16
17
|
function _interopNamespace(e) {
|
@@ -32,6 +33,7 @@ function _interopNamespace(e) {
|
|
32
33
|
return Object.freeze(n);
|
33
34
|
}
|
34
35
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
36
|
+
const mapValues__default = /* @__PURE__ */ _interopDefault(mapValues);
|
35
37
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
36
38
|
const pipe__default = /* @__PURE__ */ _interopDefault(pipe);
|
37
39
|
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
@@ -70,42 +72,6 @@ const useInjectionZone = (area) => {
|
|
70
72
|
const [page, position] = area.split(".");
|
71
73
|
return contentManagerPlugin.getInjectedComponents(page, position);
|
72
74
|
};
|
73
|
-
const HistoryAction = ({ model, document }) => {
|
74
|
-
const { formatMessage } = reactIntl.useIntl();
|
75
|
-
const [{ query }] = strapiAdmin.useQueryParams();
|
76
|
-
const navigate = reactRouterDom.useNavigate();
|
77
|
-
const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
|
78
|
-
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
79
|
-
return null;
|
80
|
-
}
|
81
|
-
return {
|
82
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
|
83
|
-
label: formatMessage({
|
84
|
-
id: "content-manager.history.document-action",
|
85
|
-
defaultMessage: "Content History"
|
86
|
-
}),
|
87
|
-
onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
|
88
|
-
disabled: (
|
89
|
-
/**
|
90
|
-
* The user is creating a new document.
|
91
|
-
* It hasn't been saved yet, so there's no history to go to
|
92
|
-
*/
|
93
|
-
!document || /**
|
94
|
-
* The document has been created but the current dimension has never been saved.
|
95
|
-
* For example, the user is creating a new locale in an existing document,
|
96
|
-
* so there's no history for the document in that locale
|
97
|
-
*/
|
98
|
-
!document.id || /**
|
99
|
-
* History is only available for content types created by the user.
|
100
|
-
* These have the `api::` prefix, as opposed to the ones created by Strapi or plugins,
|
101
|
-
* which start with `admin::` or `plugin::`
|
102
|
-
*/
|
103
|
-
!model.startsWith("api::")
|
104
|
-
),
|
105
|
-
position: "header"
|
106
|
-
};
|
107
|
-
};
|
108
|
-
HistoryAction.type = "history";
|
109
75
|
const ID = "id";
|
110
76
|
const CREATED_BY_ATTRIBUTE_NAME = "createdBy";
|
111
77
|
const UPDATED_BY_ATTRIBUTE_NAME = "updatedBy";
|
@@ -157,6 +123,7 @@ const DocumentRBAC = ({ children, permissions }) => {
|
|
157
123
|
if (!slug) {
|
158
124
|
throw new Error("Cannot find the slug param in the URL");
|
159
125
|
}
|
126
|
+
const [{ rawQuery }] = strapiAdmin.useQueryParams();
|
160
127
|
const userPermissions = strapiAdmin.useAuth("DocumentRBAC", (state) => state.permissions);
|
161
128
|
const contentTypePermissions = React__namespace.useMemo(() => {
|
162
129
|
const contentTypePermissions2 = userPermissions.filter(
|
@@ -167,7 +134,14 @@ const DocumentRBAC = ({ children, permissions }) => {
|
|
167
134
|
return { ...acc, [action]: [permission] };
|
168
135
|
}, {});
|
169
136
|
}, [slug, userPermissions]);
|
170
|
-
const { isLoading, allowedActions } = strapiAdmin.useRBAC(
|
137
|
+
const { isLoading, allowedActions } = strapiAdmin.useRBAC(
|
138
|
+
contentTypePermissions,
|
139
|
+
permissions ?? void 0,
|
140
|
+
// TODO: useRBAC context should be typed and built differently
|
141
|
+
// We are passing raw query as context to the hook so that it can
|
142
|
+
// rely on the locale provided from DocumentRBAC for its permission calculations.
|
143
|
+
rawQuery
|
144
|
+
);
|
171
145
|
const canCreateFields = !isLoading && allowedActions.canCreate ? extractAndDedupeFields(contentTypePermissions.create) : [];
|
172
146
|
const canReadFields = !isLoading && allowedActions.canRead ? extractAndDedupeFields(contentTypePermissions.read) : [];
|
173
147
|
const canUpdateFields = !isLoading && allowedActions.canUpdate ? extractAndDedupeFields(contentTypePermissions.update) : [];
|
@@ -215,7 +189,8 @@ const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
|
|
215
189
|
"Document",
|
216
190
|
"InitialData",
|
217
191
|
"HistoryVersion",
|
218
|
-
"Relations"
|
192
|
+
"Relations",
|
193
|
+
"UidAvailability"
|
219
194
|
]
|
220
195
|
});
|
221
196
|
const documentApi = contentManagerApi.injectEndpoints({
|
@@ -229,7 +204,12 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
229
204
|
params: query
|
230
205
|
}
|
231
206
|
}),
|
232
|
-
invalidatesTags: (_result,
|
207
|
+
invalidatesTags: (_result, error, { model }) => {
|
208
|
+
if (error) {
|
209
|
+
return [];
|
210
|
+
}
|
211
|
+
return [{ type: "Document", id: `${model}_LIST` }];
|
212
|
+
}
|
233
213
|
}),
|
234
214
|
cloneDocument: builder.mutation({
|
235
215
|
query: ({ model, sourceId, data, params }) => ({
|
@@ -240,7 +220,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
240
220
|
params
|
241
221
|
}
|
242
222
|
}),
|
243
|
-
invalidatesTags: (_result, _error, { model }) => [
|
223
|
+
invalidatesTags: (_result, _error, { model }) => [
|
224
|
+
{ type: "Document", id: `${model}_LIST` },
|
225
|
+
{ type: "UidAvailability", id: model }
|
226
|
+
]
|
244
227
|
}),
|
245
228
|
/**
|
246
229
|
* Creates a new collection-type document. This should ONLY be used for collection-types.
|
@@ -257,7 +240,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
257
240
|
}),
|
258
241
|
invalidatesTags: (result, _error, { model }) => [
|
259
242
|
{ type: "Document", id: `${model}_LIST` },
|
260
|
-
"Relations"
|
243
|
+
"Relations",
|
244
|
+
{ type: "UidAvailability", id: model }
|
261
245
|
]
|
262
246
|
}),
|
263
247
|
deleteDocument: builder.mutation({
|
@@ -298,7 +282,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
298
282
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
299
283
|
},
|
300
284
|
{ type: "Document", id: `${model}_LIST` },
|
301
|
-
"Relations"
|
285
|
+
"Relations",
|
286
|
+
{ type: "UidAvailability", id: model }
|
302
287
|
];
|
303
288
|
}
|
304
289
|
}),
|
@@ -316,6 +301,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
316
301
|
}),
|
317
302
|
providesTags: (result, _error, arg) => {
|
318
303
|
return [
|
304
|
+
{ type: "Document", id: `ALL_LIST` },
|
319
305
|
{ type: "Document", id: `${arg.model}_LIST` },
|
320
306
|
...result?.results.map(({ documentId }) => ({
|
321
307
|
type: "Document",
|
@@ -354,6 +340,11 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
354
340
|
{
|
355
341
|
type: "Document",
|
356
342
|
id: collectionType !== SINGLE_TYPES ? `${model}_${result && "documentId" in result ? result.documentId : documentId}` : model
|
343
|
+
},
|
344
|
+
// Make it easy to invalidate all individual documents queries for a model
|
345
|
+
{
|
346
|
+
type: "Document",
|
347
|
+
id: `${model}_ALL_ITEMS`
|
357
348
|
}
|
358
349
|
];
|
359
350
|
}
|
@@ -417,8 +408,21 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
417
408
|
type: "Document",
|
418
409
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
419
410
|
},
|
420
|
-
"Relations"
|
411
|
+
"Relations",
|
412
|
+
{ type: "UidAvailability", id: model }
|
421
413
|
];
|
414
|
+
},
|
415
|
+
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
416
|
+
const patchResult = dispatch(
|
417
|
+
documentApi.util.updateQueryData("getDocument", patch, (draft) => {
|
418
|
+
Object.assign(draft.data, data);
|
419
|
+
})
|
420
|
+
);
|
421
|
+
try {
|
422
|
+
await queryFulfilled;
|
423
|
+
} catch {
|
424
|
+
patchResult.undo();
|
425
|
+
}
|
422
426
|
}
|
423
427
|
}),
|
424
428
|
unpublishDocument: builder.mutation({
|
@@ -488,20 +492,39 @@ const buildValidParams = (query) => {
|
|
488
492
|
const isBaseQueryError = (error) => {
|
489
493
|
return error.name !== void 0;
|
490
494
|
};
|
491
|
-
const
|
495
|
+
const arrayValidator = (attribute, options) => ({
|
496
|
+
message: strapiAdmin.translatedErrors.required,
|
497
|
+
test(value) {
|
498
|
+
if (options.status === "draft") {
|
499
|
+
return true;
|
500
|
+
}
|
501
|
+
if (!attribute.required) {
|
502
|
+
return true;
|
503
|
+
}
|
504
|
+
if (!value) {
|
505
|
+
return false;
|
506
|
+
}
|
507
|
+
if (Array.isArray(value) && value.length === 0) {
|
508
|
+
return false;
|
509
|
+
}
|
510
|
+
return true;
|
511
|
+
}
|
512
|
+
});
|
513
|
+
const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
|
492
514
|
const createModelSchema = (attributes2) => yup__namespace.object().shape(
|
493
515
|
Object.entries(attributes2).reduce((acc, [name, attribute]) => {
|
494
516
|
if (DOCUMENT_META_FIELDS.includes(name)) {
|
495
517
|
return acc;
|
496
518
|
}
|
497
519
|
const validations = [
|
520
|
+
addNullableValidation,
|
498
521
|
addRequiredValidation,
|
499
522
|
addMinLengthValidation,
|
500
523
|
addMaxLengthValidation,
|
501
524
|
addMinValidation,
|
502
525
|
addMaxValidation,
|
503
526
|
addRegexValidation
|
504
|
-
].map((fn) => fn(attribute));
|
527
|
+
].map((fn) => fn(attribute, options));
|
505
528
|
const transformSchema = pipe__default.default(...validations);
|
506
529
|
switch (attribute.type) {
|
507
530
|
case "component": {
|
@@ -511,12 +534,12 @@ const createYupSchema = (attributes = {}, components = {}) => {
|
|
511
534
|
...acc,
|
512
535
|
[name]: transformSchema(
|
513
536
|
yup__namespace.array().of(createModelSchema(attributes3).nullable(false))
|
514
|
-
)
|
537
|
+
).test(arrayValidator(attribute, options))
|
515
538
|
};
|
516
539
|
} else {
|
517
540
|
return {
|
518
541
|
...acc,
|
519
|
-
[name]: transformSchema(createModelSchema(attributes3))
|
542
|
+
[name]: transformSchema(createModelSchema(attributes3).nullable())
|
520
543
|
};
|
521
544
|
}
|
522
545
|
}
|
@@ -538,7 +561,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
|
|
538
561
|
}
|
539
562
|
)
|
540
563
|
)
|
541
|
-
)
|
564
|
+
).test(arrayValidator(attribute, options))
|
542
565
|
};
|
543
566
|
case "relation":
|
544
567
|
return {
|
@@ -550,7 +573,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
|
|
550
573
|
} else if (Array.isArray(value)) {
|
551
574
|
return yup__namespace.array().of(
|
552
575
|
yup__namespace.object().shape({
|
553
|
-
id: yup__namespace.
|
576
|
+
id: yup__namespace.number().required()
|
554
577
|
})
|
555
578
|
);
|
556
579
|
} else if (typeof value === "object") {
|
@@ -602,6 +625,14 @@ const createAttributeSchema = (attribute) => {
|
|
602
625
|
if (!value || typeof value === "string" && value.length === 0) {
|
603
626
|
return true;
|
604
627
|
}
|
628
|
+
if (typeof value === "object") {
|
629
|
+
try {
|
630
|
+
JSON.stringify(value);
|
631
|
+
return true;
|
632
|
+
} catch (err) {
|
633
|
+
return false;
|
634
|
+
}
|
635
|
+
}
|
605
636
|
try {
|
606
637
|
JSON.parse(value);
|
607
638
|
return true;
|
@@ -620,13 +651,7 @@ const createAttributeSchema = (attribute) => {
|
|
620
651
|
return yup__namespace.mixed();
|
621
652
|
}
|
622
653
|
};
|
623
|
-
const
|
624
|
-
if (attribute.required) {
|
625
|
-
return schema.required({
|
626
|
-
id: strapiAdmin.translatedErrors.required.id,
|
627
|
-
defaultMessage: "This field is required."
|
628
|
-
});
|
629
|
-
}
|
654
|
+
const nullableSchema = (schema) => {
|
630
655
|
return schema?.nullable ? schema.nullable() : (
|
631
656
|
// In some cases '.nullable' will not be available on the schema.
|
632
657
|
// e.g. when the schema has been built using yup.lazy (e.g. for relations).
|
@@ -634,7 +659,22 @@ const addRequiredValidation = (attribute) => (schema) => {
|
|
634
659
|
schema
|
635
660
|
);
|
636
661
|
};
|
637
|
-
const
|
662
|
+
const addNullableValidation = () => (schema) => {
|
663
|
+
return nullableSchema(schema);
|
664
|
+
};
|
665
|
+
const addRequiredValidation = (attribute, options) => (schema) => {
|
666
|
+
if (options.status === "draft" || !attribute.required) {
|
667
|
+
return schema;
|
668
|
+
}
|
669
|
+
if (attribute.required && "required" in schema) {
|
670
|
+
return schema.required(strapiAdmin.translatedErrors.required);
|
671
|
+
}
|
672
|
+
return schema;
|
673
|
+
};
|
674
|
+
const addMinLengthValidation = (attribute, options) => (schema) => {
|
675
|
+
if (options.status === "draft") {
|
676
|
+
return schema;
|
677
|
+
}
|
638
678
|
if ("minLength" in attribute && attribute.minLength && Number.isInteger(attribute.minLength) && "min" in schema) {
|
639
679
|
return schema.min(attribute.minLength, {
|
640
680
|
...strapiAdmin.translatedErrors.minLength,
|
@@ -656,10 +696,13 @@ const addMaxLengthValidation = (attribute) => (schema) => {
|
|
656
696
|
}
|
657
697
|
return schema;
|
658
698
|
};
|
659
|
-
const addMinValidation = (attribute) => (schema) => {
|
660
|
-
if ("
|
699
|
+
const addMinValidation = (attribute, options) => (schema) => {
|
700
|
+
if (options.status === "draft") {
|
701
|
+
return schema;
|
702
|
+
}
|
703
|
+
if ("min" in attribute && "min" in schema) {
|
661
704
|
const min = toInteger(attribute.min);
|
662
|
-
if (
|
705
|
+
if (min) {
|
663
706
|
return schema.min(min, {
|
664
707
|
...strapiAdmin.translatedErrors.min,
|
665
708
|
values: {
|
@@ -777,16 +820,115 @@ const extractContentTypeComponents = (attributes = {}, allComponents = {}) => {
|
|
777
820
|
}, {});
|
778
821
|
return componentsByKey;
|
779
822
|
};
|
780
|
-
const
|
823
|
+
const HOOKS = {
|
824
|
+
/**
|
825
|
+
* Hook that allows to mutate the displayed headers of the list view table
|
826
|
+
* @constant
|
827
|
+
* @type {string}
|
828
|
+
*/
|
829
|
+
INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
|
830
|
+
/**
|
831
|
+
* Hook that allows to mutate the CM's collection types links pre-set filters
|
832
|
+
* @constant
|
833
|
+
* @type {string}
|
834
|
+
*/
|
835
|
+
MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
|
836
|
+
/**
|
837
|
+
* Hook that allows to mutate the CM's edit view layout
|
838
|
+
* @constant
|
839
|
+
* @type {string}
|
840
|
+
*/
|
841
|
+
MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
|
842
|
+
/**
|
843
|
+
* Hook that allows to mutate the CM's single types links pre-set filters
|
844
|
+
* @constant
|
845
|
+
* @type {string}
|
846
|
+
*/
|
847
|
+
MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
|
848
|
+
};
|
849
|
+
const contentTypesApi = contentManagerApi.injectEndpoints({
|
850
|
+
endpoints: (builder) => ({
|
851
|
+
getContentTypeConfiguration: builder.query({
|
852
|
+
query: (uid) => ({
|
853
|
+
url: `/content-manager/content-types/${uid}/configuration`,
|
854
|
+
method: "GET"
|
855
|
+
}),
|
856
|
+
transformResponse: (response) => response.data,
|
857
|
+
providesTags: (_result, _error, uid) => [
|
858
|
+
{ type: "ContentTypesConfiguration", id: uid },
|
859
|
+
{ type: "ContentTypeSettings", id: "LIST" }
|
860
|
+
]
|
861
|
+
}),
|
862
|
+
getAllContentTypeSettings: builder.query({
|
863
|
+
query: () => "/content-manager/content-types-settings",
|
864
|
+
transformResponse: (response) => response.data,
|
865
|
+
providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
|
866
|
+
}),
|
867
|
+
updateContentTypeConfiguration: builder.mutation({
|
868
|
+
query: ({ uid, ...body }) => ({
|
869
|
+
url: `/content-manager/content-types/${uid}/configuration`,
|
870
|
+
method: "PUT",
|
871
|
+
data: body
|
872
|
+
}),
|
873
|
+
transformResponse: (response) => response.data,
|
874
|
+
invalidatesTags: (_result, _error, { uid }) => [
|
875
|
+
{ type: "ContentTypesConfiguration", id: uid },
|
876
|
+
{ type: "ContentTypeSettings", id: "LIST" },
|
877
|
+
// Is this necessary?
|
878
|
+
{ type: "InitialData" }
|
879
|
+
]
|
880
|
+
})
|
881
|
+
})
|
882
|
+
});
|
883
|
+
const {
|
884
|
+
useGetContentTypeConfigurationQuery,
|
885
|
+
useGetAllContentTypeSettingsQuery,
|
886
|
+
useUpdateContentTypeConfigurationMutation
|
887
|
+
} = contentTypesApi;
|
888
|
+
const checkIfAttributeIsDisplayable = (attribute) => {
|
889
|
+
const { type } = attribute;
|
890
|
+
if (type === "relation") {
|
891
|
+
return !attribute.relation.toLowerCase().includes("morph");
|
892
|
+
}
|
893
|
+
return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
|
894
|
+
};
|
895
|
+
const getMainField = (attribute, mainFieldName, { schemas, components }) => {
|
896
|
+
if (!mainFieldName) {
|
897
|
+
return void 0;
|
898
|
+
}
|
899
|
+
const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
|
900
|
+
// @ts-expect-error – `targetModel` does exist on the attribute for a relation.
|
901
|
+
schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
|
902
|
+
);
|
903
|
+
return {
|
904
|
+
name: mainFieldName,
|
905
|
+
type: mainFieldType ?? "string"
|
906
|
+
};
|
907
|
+
};
|
908
|
+
const DEFAULT_SETTINGS = {
|
909
|
+
bulkable: false,
|
910
|
+
filterable: false,
|
911
|
+
searchable: false,
|
912
|
+
pagination: false,
|
913
|
+
defaultSortBy: "",
|
914
|
+
defaultSortOrder: "asc",
|
915
|
+
mainField: "id",
|
916
|
+
pageSize: 10
|
917
|
+
};
|
918
|
+
const useDocumentLayout = (model) => {
|
919
|
+
const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
|
920
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
921
|
+
const runHookWaterfall = strapiAdmin.useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
|
781
922
|
const { toggleNotification } = strapiAdmin.useNotification();
|
782
923
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
924
|
+
const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
|
783
925
|
const {
|
784
|
-
|
785
|
-
isLoading:
|
786
|
-
|
787
|
-
|
788
|
-
} =
|
789
|
-
const
|
926
|
+
data,
|
927
|
+
isLoading: isLoadingConfigs,
|
928
|
+
error,
|
929
|
+
isFetching: isFetchingConfigs
|
930
|
+
} = useGetContentTypeConfigurationQuery(model);
|
931
|
+
const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
|
790
932
|
React__namespace.useEffect(() => {
|
791
933
|
if (error) {
|
792
934
|
toggleNotification({
|
@@ -794,68 +936,322 @@ const useDocument = (args, opts) => {
|
|
794
936
|
message: formatAPIError(error)
|
795
937
|
});
|
796
938
|
}
|
797
|
-
}, [
|
798
|
-
const
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
(document) => {
|
806
|
-
if (!validationSchema) {
|
807
|
-
throw new Error(
|
808
|
-
"There is no validation schema generated, this is likely due to the schema not being loaded yet."
|
809
|
-
);
|
810
|
-
}
|
811
|
-
try {
|
812
|
-
validationSchema.validateSync(document, { abortEarly: false, strict: true });
|
813
|
-
return null;
|
814
|
-
} catch (error2) {
|
815
|
-
if (error2 instanceof yup.ValidationError) {
|
816
|
-
return strapiAdmin.getYupValidationErrors(error2);
|
817
|
-
}
|
818
|
-
throw error2;
|
819
|
-
}
|
939
|
+
}, [error, formatAPIError, toggleNotification]);
|
940
|
+
const editLayout = React__namespace.useMemo(
|
941
|
+
() => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
|
942
|
+
layout: [],
|
943
|
+
components: {},
|
944
|
+
metadatas: {},
|
945
|
+
options: {},
|
946
|
+
settings: DEFAULT_SETTINGS
|
820
947
|
},
|
821
|
-
[
|
948
|
+
[data, isLoading, schemas, schema, components]
|
949
|
+
);
|
950
|
+
const listLayout = React__namespace.useMemo(() => {
|
951
|
+
return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
|
952
|
+
layout: [],
|
953
|
+
metadatas: {},
|
954
|
+
options: {},
|
955
|
+
settings: DEFAULT_SETTINGS
|
956
|
+
};
|
957
|
+
}, [data, isLoading, schemas, schema, components]);
|
958
|
+
const { layout: edit } = React__namespace.useMemo(
|
959
|
+
() => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
|
960
|
+
layout: editLayout,
|
961
|
+
query
|
962
|
+
}),
|
963
|
+
[editLayout, query, runHookWaterfall]
|
822
964
|
);
|
823
|
-
const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
|
824
965
|
return {
|
825
|
-
|
826
|
-
document: data?.data,
|
827
|
-
meta: data?.meta,
|
966
|
+
error,
|
828
967
|
isLoading,
|
829
|
-
|
830
|
-
|
968
|
+
edit,
|
969
|
+
list: listLayout
|
831
970
|
};
|
832
971
|
};
|
833
|
-
const
|
834
|
-
const {
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
972
|
+
const useDocLayout = () => {
|
973
|
+
const { model } = useDoc();
|
974
|
+
return useDocumentLayout(model);
|
975
|
+
};
|
976
|
+
const formatEditLayout = (data, {
|
977
|
+
schemas,
|
978
|
+
schema,
|
979
|
+
components
|
980
|
+
}) => {
|
981
|
+
let currentPanelIndex = 0;
|
982
|
+
const panelledEditAttributes = convertEditLayoutToFieldLayouts(
|
983
|
+
data.contentType.layouts.edit,
|
984
|
+
schema?.attributes,
|
985
|
+
data.contentType.metadatas,
|
986
|
+
{ configurations: data.components, schemas: components },
|
987
|
+
schemas
|
988
|
+
).reduce((panels, row) => {
|
989
|
+
if (row.some((field) => field.type === "dynamiczone")) {
|
990
|
+
panels.push([row]);
|
991
|
+
currentPanelIndex += 2;
|
992
|
+
} else {
|
993
|
+
if (!panels[currentPanelIndex]) {
|
994
|
+
panels.push([row]);
|
995
|
+
} else {
|
996
|
+
panels[currentPanelIndex].push(row);
|
997
|
+
}
|
998
|
+
}
|
999
|
+
return panels;
|
1000
|
+
}, []);
|
1001
|
+
const componentEditAttributes = Object.entries(data.components).reduce(
|
1002
|
+
(acc, [uid, configuration]) => {
|
1003
|
+
acc[uid] = {
|
1004
|
+
layout: convertEditLayoutToFieldLayouts(
|
1005
|
+
configuration.layouts.edit,
|
1006
|
+
components[uid].attributes,
|
1007
|
+
configuration.metadatas,
|
1008
|
+
{ configurations: data.components, schemas: components }
|
1009
|
+
),
|
1010
|
+
settings: {
|
1011
|
+
...configuration.settings,
|
1012
|
+
icon: components[uid].info.icon,
|
1013
|
+
displayName: components[uid].info.displayName
|
1014
|
+
}
|
1015
|
+
};
|
1016
|
+
return acc;
|
1017
|
+
},
|
1018
|
+
{}
|
1019
|
+
);
|
1020
|
+
const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
|
1021
|
+
(acc, [attribute, metadata]) => {
|
1022
|
+
return {
|
1023
|
+
...acc,
|
1024
|
+
[attribute]: metadata.edit
|
1025
|
+
};
|
1026
|
+
},
|
1027
|
+
{}
|
1028
|
+
);
|
1029
|
+
return {
|
1030
|
+
layout: panelledEditAttributes,
|
1031
|
+
components: componentEditAttributes,
|
1032
|
+
metadatas: editMetadatas,
|
1033
|
+
settings: {
|
1034
|
+
...data.contentType.settings,
|
1035
|
+
displayName: schema?.info.displayName
|
1036
|
+
},
|
1037
|
+
options: {
|
1038
|
+
...schema?.options,
|
1039
|
+
...schema?.pluginOptions,
|
1040
|
+
...data.contentType.options
|
1041
|
+
}
|
1042
|
+
};
|
1043
|
+
};
|
1044
|
+
const convertEditLayoutToFieldLayouts = (rows, attributes = {}, metadatas, components, schemas = []) => {
|
1045
|
+
return rows.map(
|
1046
|
+
(row) => row.map((field) => {
|
1047
|
+
const attribute = attributes[field.name];
|
1048
|
+
if (!attribute) {
|
1049
|
+
return null;
|
1050
|
+
}
|
1051
|
+
const { edit: metadata } = metadatas[field.name];
|
1052
|
+
const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
|
1053
|
+
return {
|
1054
|
+
attribute,
|
1055
|
+
disabled: !metadata.editable,
|
1056
|
+
hint: metadata.description,
|
1057
|
+
label: metadata.label ?? "",
|
1058
|
+
name: field.name,
|
1059
|
+
// @ts-expect-error – mainField does exist on the metadata for a relation.
|
1060
|
+
mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
|
1061
|
+
schemas,
|
1062
|
+
components: components?.schemas ?? {}
|
1063
|
+
}),
|
1064
|
+
placeholder: metadata.placeholder ?? "",
|
1065
|
+
required: attribute.required ?? false,
|
1066
|
+
size: field.size,
|
1067
|
+
unique: "unique" in attribute ? attribute.unique : false,
|
1068
|
+
visible: metadata.visible ?? true,
|
1069
|
+
type: attribute.type
|
1070
|
+
};
|
1071
|
+
}).filter((field) => field !== null)
|
1072
|
+
);
|
1073
|
+
};
|
1074
|
+
const formatListLayout = (data, {
|
1075
|
+
schemas,
|
1076
|
+
schema,
|
1077
|
+
components
|
1078
|
+
}) => {
|
1079
|
+
const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
|
1080
|
+
(acc, [attribute, metadata]) => {
|
1081
|
+
return {
|
1082
|
+
...acc,
|
1083
|
+
[attribute]: metadata.list
|
1084
|
+
};
|
1085
|
+
},
|
1086
|
+
{}
|
1087
|
+
);
|
1088
|
+
const listAttributes = convertListLayoutToFieldLayouts(
|
1089
|
+
data.contentType.layouts.list,
|
1090
|
+
schema?.attributes,
|
1091
|
+
listMetadatas,
|
1092
|
+
{ configurations: data.components, schemas: components },
|
1093
|
+
schemas
|
1094
|
+
);
|
1095
|
+
return {
|
1096
|
+
layout: listAttributes,
|
1097
|
+
settings: { ...data.contentType.settings, displayName: schema?.info.displayName },
|
1098
|
+
metadatas: listMetadatas,
|
1099
|
+
options: {
|
1100
|
+
...schema?.options,
|
1101
|
+
...schema?.pluginOptions,
|
1102
|
+
...data.contentType.options
|
1103
|
+
}
|
1104
|
+
};
|
1105
|
+
};
|
1106
|
+
const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, components, schemas = []) => {
|
1107
|
+
return columns.map((name) => {
|
1108
|
+
const attribute = attributes[name];
|
1109
|
+
if (!attribute) {
|
1110
|
+
return null;
|
1111
|
+
}
|
1112
|
+
const metadata = metadatas[name];
|
1113
|
+
const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
|
1114
|
+
return {
|
1115
|
+
attribute,
|
1116
|
+
label: metadata.label ?? "",
|
1117
|
+
mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
|
1118
|
+
schemas,
|
1119
|
+
components: components?.schemas ?? {}
|
1120
|
+
}),
|
1121
|
+
name,
|
1122
|
+
searchable: metadata.searchable ?? true,
|
1123
|
+
sortable: metadata.sortable ?? true
|
1124
|
+
};
|
1125
|
+
}).filter((field) => field !== null);
|
1126
|
+
};
|
1127
|
+
const useDocument = (args, opts) => {
|
1128
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
1129
|
+
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
1130
|
+
const {
|
1131
|
+
currentData: data,
|
1132
|
+
isLoading: isLoadingDocument,
|
1133
|
+
isFetching: isFetchingDocument,
|
1134
|
+
error
|
1135
|
+
} = useGetDocumentQuery(args, {
|
1136
|
+
...opts,
|
1137
|
+
skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
|
1138
|
+
});
|
1139
|
+
const {
|
1140
|
+
components,
|
1141
|
+
schema,
|
1142
|
+
schemas,
|
1143
|
+
isLoading: isLoadingSchema
|
1144
|
+
} = useContentTypeSchema(args.model);
|
1145
|
+
React__namespace.useEffect(() => {
|
1146
|
+
if (error) {
|
1147
|
+
toggleNotification({
|
1148
|
+
type: "danger",
|
1149
|
+
message: formatAPIError(error)
|
1150
|
+
});
|
1151
|
+
}
|
1152
|
+
}, [toggleNotification, error, formatAPIError, args.collectionType]);
|
1153
|
+
const validationSchema = React__namespace.useMemo(() => {
|
1154
|
+
if (!schema) {
|
1155
|
+
return null;
|
1156
|
+
}
|
1157
|
+
return createYupSchema(schema.attributes, components);
|
1158
|
+
}, [schema, components]);
|
1159
|
+
const validate = React__namespace.useCallback(
|
1160
|
+
(document) => {
|
1161
|
+
if (!validationSchema) {
|
1162
|
+
throw new Error(
|
1163
|
+
"There is no validation schema generated, this is likely due to the schema not being loaded yet."
|
1164
|
+
);
|
1165
|
+
}
|
1166
|
+
try {
|
1167
|
+
validationSchema.validateSync(document, { abortEarly: false, strict: true });
|
1168
|
+
return null;
|
1169
|
+
} catch (error2) {
|
1170
|
+
if (error2 instanceof yup.ValidationError) {
|
1171
|
+
return strapiAdmin.getYupValidationErrors(error2);
|
1172
|
+
}
|
1173
|
+
throw error2;
|
1174
|
+
}
|
1175
|
+
},
|
1176
|
+
[validationSchema]
|
1177
|
+
);
|
1178
|
+
const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
|
1179
|
+
const hasError = !!error;
|
1180
|
+
return {
|
1181
|
+
components,
|
1182
|
+
document: data?.data,
|
1183
|
+
meta: data?.meta,
|
1184
|
+
isLoading,
|
1185
|
+
hasError,
|
1186
|
+
schema,
|
1187
|
+
schemas,
|
1188
|
+
validate
|
1189
|
+
};
|
1190
|
+
};
|
1191
|
+
const useDoc = () => {
|
1192
|
+
const { id, slug, collectionType, origin } = reactRouterDom.useParams();
|
1193
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
1194
|
+
const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
|
1195
|
+
if (!collectionType) {
|
1196
|
+
throw new Error("Could not find collectionType in url params");
|
1197
|
+
}
|
1198
|
+
if (!slug) {
|
841
1199
|
throw new Error("Could not find model in url params");
|
842
1200
|
}
|
1201
|
+
const document = useDocument(
|
1202
|
+
{ documentId: origin || id, model: slug, collectionType, params },
|
1203
|
+
{
|
1204
|
+
skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
|
1205
|
+
}
|
1206
|
+
);
|
1207
|
+
const returnId = origin || id === "create" ? void 0 : id;
|
843
1208
|
return {
|
844
1209
|
collectionType,
|
845
1210
|
model: slug,
|
846
|
-
id:
|
847
|
-
...
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
1211
|
+
id: returnId,
|
1212
|
+
...document
|
1213
|
+
};
|
1214
|
+
};
|
1215
|
+
const useContentManagerContext = () => {
|
1216
|
+
const {
|
1217
|
+
collectionType,
|
1218
|
+
model,
|
1219
|
+
id,
|
1220
|
+
components,
|
1221
|
+
isLoading: isLoadingDoc,
|
1222
|
+
schema,
|
1223
|
+
schemas
|
1224
|
+
} = useDoc();
|
1225
|
+
const layout = useDocumentLayout(model);
|
1226
|
+
const form = strapiAdmin.useForm("useContentManagerContext", (state) => state);
|
1227
|
+
const isSingleType = collectionType === SINGLE_TYPES;
|
1228
|
+
const slug = model;
|
1229
|
+
const isCreatingEntry = id === "create";
|
1230
|
+
useContentTypeSchema();
|
1231
|
+
const isLoading = isLoadingDoc || layout.isLoading;
|
1232
|
+
const error = layout.error;
|
1233
|
+
return {
|
1234
|
+
error,
|
1235
|
+
isLoading,
|
1236
|
+
// Base metadata
|
1237
|
+
model,
|
1238
|
+
collectionType,
|
1239
|
+
id,
|
1240
|
+
slug,
|
1241
|
+
isCreatingEntry,
|
1242
|
+
isSingleType,
|
1243
|
+
hasDraftAndPublish: schema?.options?.draftAndPublish ?? false,
|
1244
|
+
// All schema infos
|
1245
|
+
components,
|
1246
|
+
contentType: schema,
|
1247
|
+
contentTypes: schemas,
|
1248
|
+
// Form state
|
1249
|
+
form,
|
1250
|
+
// layout infos
|
1251
|
+
layout
|
853
1252
|
};
|
854
1253
|
};
|
855
1254
|
const prefixPluginTranslations = (trad, pluginId) => {
|
856
|
-
if (!pluginId) {
|
857
|
-
throw new TypeError("pluginId can't be empty");
|
858
|
-
}
|
859
1255
|
return Object.keys(trad).reduce((acc, current) => {
|
860
1256
|
acc[`${pluginId}.${current}`] = trad[current];
|
861
1257
|
return acc;
|
@@ -871,6 +1267,8 @@ const useDocumentActions = () => {
|
|
871
1267
|
const { formatMessage } = reactIntl.useIntl();
|
872
1268
|
const { trackUsage } = strapiAdmin.useTracking();
|
873
1269
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
1270
|
+
const navigate = reactRouterDom.useNavigate();
|
1271
|
+
const setCurrentStep = strapiAdmin.useGuidedTour("useDocumentActions", (state) => state.setCurrentStep);
|
874
1272
|
const [deleteDocument] = useDeleteDocumentMutation();
|
875
1273
|
const _delete = React__namespace.useCallback(
|
876
1274
|
async ({ collectionType, model, documentId, params }, trackerProperty) => {
|
@@ -1185,6 +1583,7 @@ const useDocumentActions = () => {
|
|
1185
1583
|
defaultMessage: "Saved document"
|
1186
1584
|
})
|
1187
1585
|
});
|
1586
|
+
setCurrentStep("contentManager.success");
|
1188
1587
|
return res.data;
|
1189
1588
|
} catch (err) {
|
1190
1589
|
toggleNotification({
|
@@ -1206,7 +1605,6 @@ const useDocumentActions = () => {
|
|
1206
1605
|
sourceId
|
1207
1606
|
});
|
1208
1607
|
if ("error" in res) {
|
1209
|
-
toggleNotification({ type: "danger", message: formatAPIError(res.error) });
|
1210
1608
|
return { error: res.error };
|
1211
1609
|
}
|
1212
1610
|
toggleNotification({
|
@@ -1225,7 +1623,7 @@ const useDocumentActions = () => {
|
|
1225
1623
|
throw err;
|
1226
1624
|
}
|
1227
1625
|
},
|
1228
|
-
[autoCloneDocument,
|
1626
|
+
[autoCloneDocument, formatMessage, toggleNotification]
|
1229
1627
|
);
|
1230
1628
|
const [cloneDocument] = useCloneDocumentMutation();
|
1231
1629
|
const clone = React__namespace.useCallback(
|
@@ -1251,6 +1649,7 @@ const useDocumentActions = () => {
|
|
1251
1649
|
defaultMessage: "Cloned document"
|
1252
1650
|
})
|
1253
1651
|
});
|
1652
|
+
navigate(`../../${res.data.data.documentId}`, { relative: "path" });
|
1254
1653
|
return res.data;
|
1255
1654
|
} catch (err) {
|
1256
1655
|
toggleNotification({
|
@@ -1261,7 +1660,7 @@ const useDocumentActions = () => {
|
|
1261
1660
|
throw err;
|
1262
1661
|
}
|
1263
1662
|
},
|
1264
|
-
[cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError]
|
1663
|
+
[cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError, navigate]
|
1265
1664
|
);
|
1266
1665
|
const [getDoc] = useLazyGetDocumentQuery();
|
1267
1666
|
const getDocument = React__namespace.useCallback(
|
@@ -1286,10 +1685,10 @@ const useDocumentActions = () => {
|
|
1286
1685
|
update
|
1287
1686
|
};
|
1288
1687
|
};
|
1289
|
-
const ProtectedHistoryPage =
|
1290
|
-
() => Promise.resolve().then(() => require("./History-
|
1688
|
+
const ProtectedHistoryPage = React__namespace.lazy(
|
1689
|
+
() => Promise.resolve().then(() => require("./History-DbdpigyF.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1291
1690
|
);
|
1292
|
-
const routes$
|
1691
|
+
const routes$2 = [
|
1293
1692
|
{
|
1294
1693
|
path: ":collectionType/:slug/:id/history",
|
1295
1694
|
Component: ProtectedHistoryPage
|
@@ -1299,32 +1698,45 @@ const routes$1 = [
|
|
1299
1698
|
Component: ProtectedHistoryPage
|
1300
1699
|
}
|
1301
1700
|
];
|
1701
|
+
const ProtectedPreviewPage = React__namespace.lazy(
|
1702
|
+
() => Promise.resolve().then(() => require("./Preview-COsm52rZ.js")).then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1703
|
+
);
|
1704
|
+
const routes$1 = [
|
1705
|
+
{
|
1706
|
+
path: ":collectionType/:slug/:id/preview",
|
1707
|
+
Component: ProtectedPreviewPage
|
1708
|
+
},
|
1709
|
+
{
|
1710
|
+
path: ":collectionType/:slug/preview",
|
1711
|
+
Component: ProtectedPreviewPage
|
1712
|
+
}
|
1713
|
+
];
|
1302
1714
|
const ProtectedEditViewPage = React.lazy(
|
1303
|
-
() => Promise.resolve().then(() => require("./EditViewPage-
|
1715
|
+
() => Promise.resolve().then(() => require("./EditViewPage-DoQm9llG.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1304
1716
|
);
|
1305
1717
|
const ProtectedListViewPage = React.lazy(
|
1306
|
-
() => Promise.resolve().then(() => require("./ListViewPage-
|
1718
|
+
() => Promise.resolve().then(() => require("./ListViewPage-CVIEfYWN.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1307
1719
|
);
|
1308
1720
|
const ProtectedListConfiguration = React.lazy(
|
1309
|
-
() => Promise.resolve().then(() => require("./ListConfigurationPage-
|
1721
|
+
() => Promise.resolve().then(() => require("./ListConfigurationPage-DRGhXnUA.js")).then((mod) => ({
|
1310
1722
|
default: mod.ProtectedListConfiguration
|
1311
1723
|
}))
|
1312
1724
|
);
|
1313
1725
|
const ProtectedEditConfigurationPage = React.lazy(
|
1314
|
-
() => Promise.resolve().then(() => require("./EditConfigurationPage-
|
1726
|
+
() => Promise.resolve().then(() => require("./EditConfigurationPage-Ds3BOL2z.js")).then((mod) => ({
|
1315
1727
|
default: mod.ProtectedEditConfigurationPage
|
1316
1728
|
}))
|
1317
1729
|
);
|
1318
1730
|
const ProtectedComponentConfigurationPage = React.lazy(
|
1319
|
-
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-
|
1731
|
+
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-Cr0ttPAZ.js")).then((mod) => ({
|
1320
1732
|
default: mod.ProtectedComponentConfigurationPage
|
1321
1733
|
}))
|
1322
1734
|
);
|
1323
1735
|
const NoPermissions = React.lazy(
|
1324
|
-
() => Promise.resolve().then(() => require("./NoPermissionsPage-
|
1736
|
+
() => Promise.resolve().then(() => require("./NoPermissionsPage-pVeCVj9a.js")).then((mod) => ({ default: mod.NoPermissions }))
|
1325
1737
|
);
|
1326
1738
|
const NoContentType = React.lazy(
|
1327
|
-
() => Promise.resolve().then(() => require("./NoContentTypePage-
|
1739
|
+
() => Promise.resolve().then(() => require("./NoContentTypePage-CTcfA2-Q.js")).then((mod) => ({ default: mod.NoContentType }))
|
1328
1740
|
);
|
1329
1741
|
const CollectionTypePages = () => {
|
1330
1742
|
const { collectionType } = reactRouterDom.useParams();
|
@@ -1336,7 +1748,7 @@ const CollectionTypePages = () => {
|
|
1336
1748
|
const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
|
1337
1749
|
const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
|
1338
1750
|
const LIST_RELATIVE_PATH = ":collectionType/:slug";
|
1339
|
-
const LIST_PATH = `/content-manager
|
1751
|
+
const LIST_PATH = `/content-manager/collection-types/:slug`;
|
1340
1752
|
const routes = [
|
1341
1753
|
{
|
1342
1754
|
path: LIST_RELATIVE_PATH,
|
@@ -1370,6 +1782,7 @@ const routes = [
|
|
1370
1782
|
path: "no-content-types",
|
1371
1783
|
Component: NoContentType
|
1372
1784
|
},
|
1785
|
+
...routes$2,
|
1373
1786
|
...routes$1
|
1374
1787
|
];
|
1375
1788
|
const DocumentActions = ({ actions: actions2 }) => {
|
@@ -1438,12 +1851,14 @@ const DocumentActionButton = (action) => {
|
|
1438
1851
|
/* @__PURE__ */ jsxRuntime.jsx(
|
1439
1852
|
designSystem.Button,
|
1440
1853
|
{
|
1441
|
-
flex:
|
1854
|
+
flex: "auto",
|
1442
1855
|
startIcon: action.icon,
|
1443
1856
|
disabled: action.disabled,
|
1444
1857
|
onClick: handleClick(action),
|
1445
1858
|
justifyContent: "center",
|
1446
1859
|
variant: action.variant || "default",
|
1860
|
+
paddingTop: "7px",
|
1861
|
+
paddingBottom: "7px",
|
1447
1862
|
children: action.label
|
1448
1863
|
}
|
1449
1864
|
),
|
@@ -1451,7 +1866,7 @@ const DocumentActionButton = (action) => {
|
|
1451
1866
|
DocumentActionConfirmDialog,
|
1452
1867
|
{
|
1453
1868
|
...action.dialog,
|
1454
|
-
variant: action.variant,
|
1869
|
+
variant: action.dialog?.variant ?? action.variant,
|
1455
1870
|
isOpen: dialogId === action.id,
|
1456
1871
|
onClose: handleClose
|
1457
1872
|
}
|
@@ -1508,9 +1923,9 @@ const DocumentActionsMenu = ({
|
|
1508
1923
|
disabled: isDisabled,
|
1509
1924
|
size: "S",
|
1510
1925
|
endIcon: null,
|
1511
|
-
paddingTop: "
|
1512
|
-
paddingLeft: "
|
1513
|
-
paddingRight: "
|
1926
|
+
paddingTop: "4px",
|
1927
|
+
paddingLeft: "7px",
|
1928
|
+
paddingRight: "7px",
|
1514
1929
|
variant,
|
1515
1930
|
children: [
|
1516
1931
|
/* @__PURE__ */ jsxRuntime.jsx(Icons.More, { "aria-hidden": true, focusable: false }),
|
@@ -1521,7 +1936,7 @@ const DocumentActionsMenu = ({
|
|
1521
1936
|
]
|
1522
1937
|
}
|
1523
1938
|
),
|
1524
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, {
|
1939
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1525
1940
|
actions2.map((action) => {
|
1526
1941
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
1527
1942
|
designSystem.Menu.Item,
|
@@ -1529,28 +1944,25 @@ const DocumentActionsMenu = ({
|
|
1529
1944
|
disabled: action.disabled,
|
1530
1945
|
onSelect: handleClick(action),
|
1531
1946
|
display: "block",
|
1532
|
-
children: /* @__PURE__ */ jsxRuntime.
|
1533
|
-
|
1534
|
-
|
1535
|
-
action.
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
}
|
1552
|
-
)
|
1553
|
-
] })
|
1947
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
1948
|
+
designSystem.Flex,
|
1949
|
+
{
|
1950
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1951
|
+
gap: 2,
|
1952
|
+
tag: "span",
|
1953
|
+
children: [
|
1954
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
1955
|
+
designSystem.Flex,
|
1956
|
+
{
|
1957
|
+
tag: "span",
|
1958
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1959
|
+
children: action.icon
|
1960
|
+
}
|
1961
|
+
),
|
1962
|
+
action.label
|
1963
|
+
]
|
1964
|
+
}
|
1965
|
+
) })
|
1554
1966
|
},
|
1555
1967
|
action.id
|
1556
1968
|
);
|
@@ -1630,11 +2042,11 @@ const DocumentActionConfirmDialog = ({
|
|
1630
2042
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
|
1631
2043
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: content }),
|
1632
2044
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
|
1633
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", children: formatMessage({
|
2045
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", fullWidth: true, children: formatMessage({
|
1634
2046
|
id: "app.components.Button.cancel",
|
1635
2047
|
defaultMessage: "Cancel"
|
1636
2048
|
}) }) }),
|
1637
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleConfirm, variant, children: formatMessage({
|
2049
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleConfirm, variant, fullWidth: true, children: formatMessage({
|
1638
2050
|
id: "app.components.Button.confirm",
|
1639
2051
|
defaultMessage: "Confirm"
|
1640
2052
|
}) })
|
@@ -1661,9 +2073,21 @@ const DocumentActionModal = ({
|
|
1661
2073
|
typeof Footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { onClose: handleClose }) : Footer
|
1662
2074
|
] }) });
|
1663
2075
|
};
|
1664
|
-
const
|
1665
|
-
|
1666
|
-
|
2076
|
+
const transformData = (data) => {
|
2077
|
+
if (Array.isArray(data)) {
|
2078
|
+
return data.map(transformData);
|
2079
|
+
}
|
2080
|
+
if (typeof data === "object" && data !== null) {
|
2081
|
+
if ("apiData" in data) {
|
2082
|
+
return data.apiData;
|
2083
|
+
}
|
2084
|
+
return mapValues__default.default(transformData)(data);
|
2085
|
+
}
|
2086
|
+
return data;
|
2087
|
+
};
|
2088
|
+
const PublishAction$1 = ({
|
2089
|
+
activeTab,
|
2090
|
+
documentId,
|
1667
2091
|
model,
|
1668
2092
|
collectionType,
|
1669
2093
|
meta,
|
@@ -1673,13 +2097,17 @@ const PublishAction$1 = ({
|
|
1673
2097
|
const navigate = reactRouterDom.useNavigate();
|
1674
2098
|
const { toggleNotification } = strapiAdmin.useNotification();
|
1675
2099
|
const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
|
2100
|
+
const isListView = reactRouterDom.useMatch(LIST_PATH) !== null;
|
1676
2101
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
1677
2102
|
const { formatMessage } = reactIntl.useIntl();
|
1678
|
-
const { canPublish
|
1679
|
-
"PublishAction",
|
1680
|
-
({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
|
1681
|
-
);
|
2103
|
+
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
1682
2104
|
const { publish } = useDocumentActions();
|
2105
|
+
const [
|
2106
|
+
countDraftRelations,
|
2107
|
+
{ isLoading: isLoadingDraftRelations, isError: isErrorDraftRelations }
|
2108
|
+
] = useLazyGetDraftRelationCountQuery();
|
2109
|
+
const [localCountOfDraftRelations, setLocalCountOfDraftRelations] = React__namespace.useState(0);
|
2110
|
+
const [serverCountOfDraftRelations, setServerCountOfDraftRelations] = React__namespace.useState(0);
|
1683
2111
|
const [{ query, rawQuery }] = strapiAdmin.useQueryParams();
|
1684
2112
|
const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
|
1685
2113
|
const modified = strapiAdmin.useForm("PublishAction", ({ modified: modified2 }) => modified2);
|
@@ -1688,10 +2116,105 @@ const PublishAction$1 = ({
|
|
1688
2116
|
const validate = strapiAdmin.useForm("PublishAction", (state) => state.validate);
|
1689
2117
|
const setErrors = strapiAdmin.useForm("PublishAction", (state) => state.setErrors);
|
1690
2118
|
const formValues = strapiAdmin.useForm("PublishAction", ({ values }) => values);
|
2119
|
+
React__namespace.useEffect(() => {
|
2120
|
+
if (isErrorDraftRelations) {
|
2121
|
+
toggleNotification({
|
2122
|
+
type: "danger",
|
2123
|
+
message: formatMessage({
|
2124
|
+
id: getTranslation("error.records.fetch-draft-relatons"),
|
2125
|
+
defaultMessage: "An error occurred while fetching draft relations on this document."
|
2126
|
+
})
|
2127
|
+
});
|
2128
|
+
}
|
2129
|
+
}, [isErrorDraftRelations, toggleNotification, formatMessage]);
|
2130
|
+
React__namespace.useEffect(() => {
|
2131
|
+
const localDraftRelations = /* @__PURE__ */ new Set();
|
2132
|
+
const extractDraftRelations = (data) => {
|
2133
|
+
const relations = data.connect || [];
|
2134
|
+
relations.forEach((relation) => {
|
2135
|
+
if (relation.status === "draft") {
|
2136
|
+
localDraftRelations.add(relation.id);
|
2137
|
+
}
|
2138
|
+
});
|
2139
|
+
};
|
2140
|
+
const traverseAndExtract = (data) => {
|
2141
|
+
Object.entries(data).forEach(([key, value]) => {
|
2142
|
+
if (key === "connect" && Array.isArray(value)) {
|
2143
|
+
extractDraftRelations({ connect: value });
|
2144
|
+
} else if (typeof value === "object" && value !== null) {
|
2145
|
+
traverseAndExtract(value);
|
2146
|
+
}
|
2147
|
+
});
|
2148
|
+
};
|
2149
|
+
if (!documentId || modified) {
|
2150
|
+
traverseAndExtract(formValues);
|
2151
|
+
setLocalCountOfDraftRelations(localDraftRelations.size);
|
2152
|
+
}
|
2153
|
+
}, [documentId, modified, formValues, setLocalCountOfDraftRelations]);
|
2154
|
+
React__namespace.useEffect(() => {
|
2155
|
+
if (!document || !document.documentId || isListView) {
|
2156
|
+
return;
|
2157
|
+
}
|
2158
|
+
const fetchDraftRelationsCount = async () => {
|
2159
|
+
const { data, error } = await countDraftRelations({
|
2160
|
+
collectionType,
|
2161
|
+
model,
|
2162
|
+
documentId,
|
2163
|
+
params
|
2164
|
+
});
|
2165
|
+
if (error) {
|
2166
|
+
throw error;
|
2167
|
+
}
|
2168
|
+
if (data) {
|
2169
|
+
setServerCountOfDraftRelations(data.data);
|
2170
|
+
}
|
2171
|
+
};
|
2172
|
+
fetchDraftRelationsCount();
|
2173
|
+
}, [isListView, document, documentId, countDraftRelations, collectionType, model, params]);
|
1691
2174
|
const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
|
1692
2175
|
if (!schema?.options?.draftAndPublish) {
|
1693
2176
|
return null;
|
1694
2177
|
}
|
2178
|
+
const performPublish = async () => {
|
2179
|
+
setSubmitting(true);
|
2180
|
+
try {
|
2181
|
+
const { errors } = await validate(true, {
|
2182
|
+
status: "published"
|
2183
|
+
});
|
2184
|
+
if (errors) {
|
2185
|
+
toggleNotification({
|
2186
|
+
type: "danger",
|
2187
|
+
message: formatMessage({
|
2188
|
+
id: "content-manager.validation.error",
|
2189
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2190
|
+
})
|
2191
|
+
});
|
2192
|
+
return;
|
2193
|
+
}
|
2194
|
+
const res = await publish(
|
2195
|
+
{
|
2196
|
+
collectionType,
|
2197
|
+
model,
|
2198
|
+
documentId,
|
2199
|
+
params
|
2200
|
+
},
|
2201
|
+
transformData(formValues)
|
2202
|
+
);
|
2203
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2204
|
+
navigate({
|
2205
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2206
|
+
search: rawQuery
|
2207
|
+
});
|
2208
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2209
|
+
setErrors(formatValidationErrors(res.error));
|
2210
|
+
}
|
2211
|
+
} finally {
|
2212
|
+
setSubmitting(false);
|
2213
|
+
}
|
2214
|
+
};
|
2215
|
+
const totalDraftRelations = localCountOfDraftRelations + serverCountOfDraftRelations;
|
2216
|
+
const enableDraftRelationsCount = false;
|
2217
|
+
const hasDraftRelations = enableDraftRelationsCount;
|
1695
2218
|
return {
|
1696
2219
|
/**
|
1697
2220
|
* Disabled when:
|
@@ -1701,49 +2224,36 @@ const PublishAction$1 = ({
|
|
1701
2224
|
* - the document is already published & not modified
|
1702
2225
|
* - the document is being created & not modified
|
1703
2226
|
* - the user doesn't have the permission to publish
|
1704
|
-
* - the user doesn't have the permission to create a new document
|
1705
|
-
* - the user doesn't have the permission to update the document
|
1706
2227
|
*/
|
1707
|
-
disabled: isCloning || isSubmitting || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish
|
2228
|
+
disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish,
|
1708
2229
|
label: formatMessage({
|
1709
2230
|
id: "app.utils.publish",
|
1710
2231
|
defaultMessage: "Publish"
|
1711
2232
|
}),
|
1712
2233
|
onClick: async () => {
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
documentId,
|
1731
|
-
params
|
1732
|
-
},
|
1733
|
-
formValues
|
1734
|
-
);
|
1735
|
-
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1736
|
-
navigate({
|
1737
|
-
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
1738
|
-
search: rawQuery
|
1739
|
-
});
|
1740
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1741
|
-
setErrors(formatValidationErrors(res.error));
|
2234
|
+
await performPublish();
|
2235
|
+
},
|
2236
|
+
dialog: hasDraftRelations ? {
|
2237
|
+
type: "dialog",
|
2238
|
+
variant: "danger",
|
2239
|
+
footer: null,
|
2240
|
+
title: formatMessage({
|
2241
|
+
id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.title`),
|
2242
|
+
defaultMessage: "Confirmation"
|
2243
|
+
}),
|
2244
|
+
content: formatMessage(
|
2245
|
+
{
|
2246
|
+
id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.message`),
|
2247
|
+
defaultMessage: "This entry is related to {count, plural, one {# draft entry} other {# draft entries}}. Publishing it could leave broken links in your app."
|
2248
|
+
},
|
2249
|
+
{
|
2250
|
+
count: totalDraftRelations
|
1742
2251
|
}
|
1743
|
-
|
1744
|
-
|
2252
|
+
),
|
2253
|
+
onConfirm: async () => {
|
2254
|
+
await performPublish();
|
1745
2255
|
}
|
1746
|
-
}
|
2256
|
+
} : void 0
|
1747
2257
|
};
|
1748
2258
|
};
|
1749
2259
|
PublishAction$1.type = "publish";
|
@@ -1759,10 +2269,6 @@ const UpdateAction = ({
|
|
1759
2269
|
const cloneMatch = reactRouterDom.useMatch(CLONE_PATH);
|
1760
2270
|
const isCloning = cloneMatch !== null;
|
1761
2271
|
const { formatMessage } = reactIntl.useIntl();
|
1762
|
-
const { canCreate, canUpdate } = useDocumentRBAC("UpdateAction", ({ canCreate: canCreate2, canUpdate: canUpdate2 }) => ({
|
1763
|
-
canCreate: canCreate2,
|
1764
|
-
canUpdate: canUpdate2
|
1765
|
-
}));
|
1766
2272
|
const { create, update, clone } = useDocumentActions();
|
1767
2273
|
const [{ query, rawQuery }] = strapiAdmin.useQueryParams();
|
1768
2274
|
const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
|
@@ -1779,10 +2285,8 @@ const UpdateAction = ({
|
|
1779
2285
|
* - the form is submitting
|
1780
2286
|
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
1781
2287
|
* - the active tab is the published tab
|
1782
|
-
* - the user doesn't have the permission to create a new document
|
1783
|
-
* - the user doesn't have the permission to update the document
|
1784
2288
|
*/
|
1785
|
-
disabled: isSubmitting || !modified && !isCloning || activeTab === "published"
|
2289
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
1786
2290
|
label: formatMessage({
|
1787
2291
|
id: "content-manager.containers.Edit.save",
|
1788
2292
|
defaultMessage: "Save"
|
@@ -1790,7 +2294,9 @@ const UpdateAction = ({
|
|
1790
2294
|
onClick: async () => {
|
1791
2295
|
setSubmitting(true);
|
1792
2296
|
try {
|
1793
|
-
const { errors } = await validate(
|
2297
|
+
const { errors } = await validate(true, {
|
2298
|
+
status: "draft"
|
2299
|
+
});
|
1794
2300
|
if (errors) {
|
1795
2301
|
toggleNotification({
|
1796
2302
|
type: "danger",
|
@@ -1808,13 +2314,16 @@ const UpdateAction = ({
|
|
1808
2314
|
documentId: cloneMatch.params.origin,
|
1809
2315
|
params
|
1810
2316
|
},
|
1811
|
-
document
|
2317
|
+
transformData(document)
|
1812
2318
|
);
|
1813
2319
|
if ("data" in res) {
|
1814
|
-
navigate(
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
2320
|
+
navigate(
|
2321
|
+
{
|
2322
|
+
pathname: `../${res.data.documentId}`,
|
2323
|
+
search: rawQuery
|
2324
|
+
},
|
2325
|
+
{ relative: "path" }
|
2326
|
+
);
|
1818
2327
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1819
2328
|
setErrors(formatValidationErrors(res.error));
|
1820
2329
|
}
|
@@ -1826,7 +2335,7 @@ const UpdateAction = ({
|
|
1826
2335
|
documentId,
|
1827
2336
|
params
|
1828
2337
|
},
|
1829
|
-
document
|
2338
|
+
transformData(document)
|
1830
2339
|
);
|
1831
2340
|
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1832
2341
|
setErrors(formatValidationErrors(res.error));
|
@@ -1839,13 +2348,16 @@ const UpdateAction = ({
|
|
1839
2348
|
model,
|
1840
2349
|
params
|
1841
2350
|
},
|
1842
|
-
document
|
2351
|
+
transformData(document)
|
1843
2352
|
);
|
1844
2353
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1845
|
-
navigate(
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
2354
|
+
navigate(
|
2355
|
+
{
|
2356
|
+
pathname: `../${res.data.documentId}`,
|
2357
|
+
search: rawQuery
|
2358
|
+
},
|
2359
|
+
{ replace: true, relative: "path" }
|
2360
|
+
);
|
1849
2361
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1850
2362
|
setErrors(formatValidationErrors(res.error));
|
1851
2363
|
}
|
@@ -1889,7 +2401,7 @@ const UnpublishAction$1 = ({
|
|
1889
2401
|
id: "app.utils.unpublish",
|
1890
2402
|
defaultMessage: "Unpublish"
|
1891
2403
|
}),
|
1892
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
2404
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Cross, {}),
|
1893
2405
|
onClick: async () => {
|
1894
2406
|
if (!documentId && collectionType !== SINGLE_TYPES || isDocumentModified) {
|
1895
2407
|
if (!documentId) {
|
@@ -2001,7 +2513,7 @@ const DiscardAction = ({
|
|
2001
2513
|
id: "content-manager.actions.discard.label",
|
2002
2514
|
defaultMessage: "Discard changes"
|
2003
2515
|
}),
|
2004
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
2516
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Cross, {}),
|
2005
2517
|
position: ["panel", "table-row"],
|
2006
2518
|
variant: "danger",
|
2007
2519
|
dialog: {
|
@@ -2029,11 +2541,6 @@ const DiscardAction = ({
|
|
2029
2541
|
};
|
2030
2542
|
};
|
2031
2543
|
DiscardAction.type = "discard";
|
2032
|
-
const StyledCrossCircle = styledComponents.styled(Icons.CrossCircle)`
|
2033
|
-
path {
|
2034
|
-
fill: currentColor;
|
2035
|
-
}
|
2036
|
-
`;
|
2037
2544
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2038
2545
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2039
2546
|
const RelativeTime = React__namespace.forwardRef(
|
@@ -2081,8 +2588,12 @@ const getDisplayName = ({
|
|
2081
2588
|
};
|
2082
2589
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2083
2590
|
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2084
|
-
const statusVariant = status === "draft" ? "
|
2085
|
-
|
2591
|
+
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2592
|
+
const { formatMessage } = reactIntl.useIntl();
|
2593
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps, size: "S", variant: statusVariant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
|
2594
|
+
id: `content-manager.containers.List.${status}`,
|
2595
|
+
defaultMessage: capitalise(status)
|
2596
|
+
}) }) });
|
2086
2597
|
};
|
2087
2598
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2088
2599
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2091,23 +2602,13 @@ const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
|
2091
2602
|
id: "content-manager.containers.edit.title.new",
|
2092
2603
|
defaultMessage: "Create an entry"
|
2093
2604
|
}) : documentTitle;
|
2094
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop:
|
2605
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2095
2606
|
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
2096
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
2097
|
-
designSystem.
|
2098
|
-
{
|
2099
|
-
|
2100
|
-
|
2101
|
-
paddingTop: 1,
|
2102
|
-
gap: "80px",
|
2103
|
-
alignItems: "flex-start",
|
2104
|
-
children: [
|
2105
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
|
2106
|
-
/* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
|
2107
|
-
]
|
2108
|
-
}
|
2109
|
-
),
|
2110
|
-
status ? /* @__PURE__ */ jsxRuntime.jsx(DocumentStatus, { status: isCloning ? "draft" : status }) : null
|
2607
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2608
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
|
2609
|
+
/* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
|
2610
|
+
] }),
|
2611
|
+
status ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 1, children: /* @__PURE__ */ jsxRuntime.jsx(DocumentStatus, { status: isCloning ? "draft" : status }) }) : null
|
2111
2612
|
] });
|
2112
2613
|
};
|
2113
2614
|
const HeaderToolbar = () => {
|
@@ -2190,12 +2691,12 @@ const Information = ({ activeTab }) => {
|
|
2190
2691
|
isDisplayed: !!publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME],
|
2191
2692
|
label: formatMessage({
|
2192
2693
|
id: "content-manager.containers.edit.information.last-published.label",
|
2193
|
-
defaultMessage: "
|
2694
|
+
defaultMessage: "Published"
|
2194
2695
|
}),
|
2195
2696
|
value: formatMessage(
|
2196
2697
|
{
|
2197
2698
|
id: "content-manager.containers.edit.information.last-published.value",
|
2198
|
-
defaultMessage: `
|
2699
|
+
defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
|
2199
2700
|
},
|
2200
2701
|
{
|
2201
2702
|
time: /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME]) }),
|
@@ -2208,12 +2709,12 @@ const Information = ({ activeTab }) => {
|
|
2208
2709
|
isDisplayed: !!createAndUpdateDocument?.[UPDATED_AT_ATTRIBUTE_NAME],
|
2209
2710
|
label: formatMessage({
|
2210
2711
|
id: "content-manager.containers.edit.information.last-draft.label",
|
2211
|
-
defaultMessage: "
|
2712
|
+
defaultMessage: "Updated"
|
2212
2713
|
}),
|
2213
2714
|
value: formatMessage(
|
2214
2715
|
{
|
2215
2716
|
id: "content-manager.containers.edit.information.last-draft.value",
|
2216
|
-
defaultMessage: `
|
2717
|
+
defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
|
2217
2718
|
},
|
2218
2719
|
{
|
2219
2720
|
time: /* @__PURE__ */ jsxRuntime.jsx(
|
@@ -2231,12 +2732,12 @@ const Information = ({ activeTab }) => {
|
|
2231
2732
|
isDisplayed: !!createAndUpdateDocument?.[CREATED_AT_ATTRIBUTE_NAME],
|
2232
2733
|
label: formatMessage({
|
2233
2734
|
id: "content-manager.containers.edit.information.document.label",
|
2234
|
-
defaultMessage: "
|
2735
|
+
defaultMessage: "Created"
|
2235
2736
|
}),
|
2236
2737
|
value: formatMessage(
|
2237
2738
|
{
|
2238
2739
|
id: "content-manager.containers.edit.information.document.value",
|
2239
|
-
defaultMessage: `
|
2740
|
+
defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
|
2240
2741
|
},
|
2241
2742
|
{
|
2242
2743
|
time: /* @__PURE__ */ jsxRuntime.jsx(
|
@@ -2274,25 +2775,77 @@ const Information = ({ activeTab }) => {
|
|
2274
2775
|
);
|
2275
2776
|
};
|
2276
2777
|
const HeaderActions = ({ actions: actions2 }) => {
|
2277
|
-
|
2278
|
-
|
2778
|
+
const [dialogId, setDialogId] = React__namespace.useState(null);
|
2779
|
+
const handleClick = (action) => async (e) => {
|
2780
|
+
if (!("options" in action)) {
|
2781
|
+
const { onClick = () => false, dialog, id } = action;
|
2782
|
+
const muteDialog = await onClick(e);
|
2783
|
+
if (dialog && !muteDialog) {
|
2784
|
+
e.preventDefault();
|
2785
|
+
setDialogId(id);
|
2786
|
+
}
|
2787
|
+
}
|
2788
|
+
};
|
2789
|
+
const handleClose = () => {
|
2790
|
+
setDialogId(null);
|
2791
|
+
};
|
2792
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 1, children: actions2.map((action) => {
|
2793
|
+
if (action.options) {
|
2279
2794
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
2280
2795
|
designSystem.SingleSelect,
|
2281
2796
|
{
|
2282
2797
|
size: "S",
|
2283
|
-
disabled: action.disabled,
|
2284
|
-
"aria-label": action.label,
|
2285
2798
|
onChange: action.onSelect,
|
2286
|
-
|
2799
|
+
"aria-label": action.label,
|
2800
|
+
...action,
|
2287
2801
|
children: action.options.map(({ label, ...option }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { ...option, children: label }, option.value))
|
2288
2802
|
},
|
2289
2803
|
action.id
|
2290
2804
|
);
|
2291
2805
|
} else {
|
2292
|
-
|
2806
|
+
if (action.type === "icon") {
|
2807
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React__namespace.Fragment, { children: [
|
2808
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
2809
|
+
designSystem.IconButton,
|
2810
|
+
{
|
2811
|
+
disabled: action.disabled,
|
2812
|
+
label: action.label,
|
2813
|
+
size: "S",
|
2814
|
+
onClick: handleClick(action),
|
2815
|
+
children: action.icon
|
2816
|
+
}
|
2817
|
+
),
|
2818
|
+
action.dialog ? /* @__PURE__ */ jsxRuntime.jsx(
|
2819
|
+
HeaderActionDialog,
|
2820
|
+
{
|
2821
|
+
...action.dialog,
|
2822
|
+
isOpen: dialogId === action.id,
|
2823
|
+
onClose: handleClose
|
2824
|
+
}
|
2825
|
+
) : null
|
2826
|
+
] }, action.id);
|
2827
|
+
}
|
2293
2828
|
}
|
2294
2829
|
}) });
|
2295
2830
|
};
|
2831
|
+
const HeaderActionDialog = ({
|
2832
|
+
onClose,
|
2833
|
+
onCancel,
|
2834
|
+
title,
|
2835
|
+
content: Content,
|
2836
|
+
isOpen
|
2837
|
+
}) => {
|
2838
|
+
const handleClose = async () => {
|
2839
|
+
if (onCancel) {
|
2840
|
+
await onCancel();
|
2841
|
+
}
|
2842
|
+
onClose();
|
2843
|
+
};
|
2844
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
|
2845
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
|
2846
|
+
typeof Content === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Content, { onClose: handleClose }) : Content
|
2847
|
+
] }) });
|
2848
|
+
};
|
2296
2849
|
const ConfigureTheViewAction = ({ collectionType, model }) => {
|
2297
2850
|
const navigate = reactRouterDom.useNavigate();
|
2298
2851
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2333,12 +2886,16 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2333
2886
|
const { delete: deleteAction } = useDocumentActions();
|
2334
2887
|
const { toggleNotification } = strapiAdmin.useNotification();
|
2335
2888
|
const setSubmitting = strapiAdmin.useForm("DeleteAction", (state) => state.setSubmitting);
|
2889
|
+
const isLocalized = document?.locale != null;
|
2336
2890
|
return {
|
2337
2891
|
disabled: !canDelete || !document,
|
2338
|
-
label: formatMessage(
|
2339
|
-
|
2340
|
-
|
2341
|
-
|
2892
|
+
label: formatMessage(
|
2893
|
+
{
|
2894
|
+
id: "content-manager.actions.delete.label",
|
2895
|
+
defaultMessage: "Delete entry{isLocalized, select, true { (all locales)} other {}}"
|
2896
|
+
},
|
2897
|
+
{ isLocalized }
|
2898
|
+
),
|
2342
2899
|
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {}),
|
2343
2900
|
dialog: {
|
2344
2901
|
type: "dialog",
|
@@ -2381,416 +2938,114 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2381
2938
|
});
|
2382
2939
|
if (!("error" in res)) {
|
2383
2940
|
navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });
|
2384
|
-
}
|
2385
|
-
} finally {
|
2386
|
-
if (!listViewPathMatch) {
|
2387
|
-
setSubmitting(false);
|
2388
|
-
}
|
2389
|
-
}
|
2390
|
-
}
|
2391
|
-
},
|
2392
|
-
variant: "danger",
|
2393
|
-
position: ["header", "table-row"]
|
2394
|
-
};
|
2395
|
-
};
|
2396
|
-
DeleteAction$1.type = "delete";
|
2397
|
-
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2398
|
-
const Panels = () => {
|
2399
|
-
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2400
|
-
const [
|
2401
|
-
{
|
2402
|
-
query: { status }
|
2403
|
-
}
|
2404
|
-
] = strapiAdmin.useQueryParams({
|
2405
|
-
status: "draft"
|
2406
|
-
});
|
2407
|
-
const { model, id, document, meta, collectionType } = useDoc();
|
2408
|
-
const plugins = strapiAdmin.useStrapiApp("Panels", (state) => state.plugins);
|
2409
|
-
const props = {
|
2410
|
-
activeTab: status,
|
2411
|
-
model,
|
2412
|
-
documentId: id,
|
2413
|
-
document: isCloning ? void 0 : document,
|
2414
|
-
meta: isCloning ? void 0 : meta,
|
2415
|
-
collectionType
|
2416
|
-
};
|
2417
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
2418
|
-
strapiAdmin.DescriptionComponentRenderer,
|
2419
|
-
{
|
2420
|
-
props,
|
2421
|
-
descriptions: plugins["content-manager"].apis.getEditViewSidePanels(),
|
2422
|
-
children: (panels) => panels.map(({ content, id: id2, ...description }) => /* @__PURE__ */ jsxRuntime.jsx(Panel, { ...description, children: content }, id2))
|
2423
|
-
}
|
2424
|
-
) });
|
2425
|
-
};
|
2426
|
-
const ActionsPanel = () => {
|
2427
|
-
const { formatMessage } = reactIntl.useIntl();
|
2428
|
-
return {
|
2429
|
-
title: formatMessage({
|
2430
|
-
id: "content-manager.containers.edit.panels.default.title",
|
2431
|
-
defaultMessage: "Document"
|
2432
|
-
}),
|
2433
|
-
content: /* @__PURE__ */ jsxRuntime.jsx(ActionsPanelContent, {})
|
2434
|
-
};
|
2435
|
-
};
|
2436
|
-
ActionsPanel.type = "actions";
|
2437
|
-
const ActionsPanelContent = () => {
|
2438
|
-
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2439
|
-
const [
|
2440
|
-
{
|
2441
|
-
query: { status = "draft" }
|
2442
|
-
}
|
2443
|
-
] = strapiAdmin.useQueryParams();
|
2444
|
-
const { model, id, document, meta, collectionType } = useDoc();
|
2445
|
-
const plugins = strapiAdmin.useStrapiApp("ActionsPanel", (state) => state.plugins);
|
2446
|
-
const props = {
|
2447
|
-
activeTab: status,
|
2448
|
-
model,
|
2449
|
-
documentId: id,
|
2450
|
-
document: isCloning ? void 0 : document,
|
2451
|
-
meta: isCloning ? void 0 : meta,
|
2452
|
-
collectionType
|
2453
|
-
};
|
2454
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, width: "100%", children: [
|
2455
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
2456
|
-
strapiAdmin.DescriptionComponentRenderer,
|
2457
|
-
{
|
2458
|
-
props,
|
2459
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2460
|
-
children: (actions2) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActions, { actions: actions2 })
|
2461
|
-
}
|
2462
|
-
),
|
2463
|
-
/* @__PURE__ */ jsxRuntime.jsx(InjectionZone, { area: "editView.right-links", slug: model })
|
2464
|
-
] });
|
2465
|
-
};
|
2466
|
-
const Panel = React__namespace.forwardRef(({ children, title }, ref) => {
|
2467
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
2468
|
-
designSystem.Flex,
|
2469
|
-
{
|
2470
|
-
ref,
|
2471
|
-
tag: "aside",
|
2472
|
-
"aria-labelledby": "additional-information",
|
2473
|
-
background: "neutral0",
|
2474
|
-
borderColor: "neutral150",
|
2475
|
-
hasRadius: true,
|
2476
|
-
paddingBottom: 4,
|
2477
|
-
paddingLeft: 4,
|
2478
|
-
paddingRight: 4,
|
2479
|
-
paddingTop: 4,
|
2480
|
-
shadow: "tableShadow",
|
2481
|
-
gap: 3,
|
2482
|
-
direction: "column",
|
2483
|
-
justifyContent: "stretch",
|
2484
|
-
alignItems: "flex-start",
|
2485
|
-
children: [
|
2486
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
|
2487
|
-
children
|
2488
|
-
]
|
2489
|
-
}
|
2490
|
-
);
|
2491
|
-
});
|
2492
|
-
const HOOKS = {
|
2493
|
-
/**
|
2494
|
-
* Hook that allows to mutate the displayed headers of the list view table
|
2495
|
-
* @constant
|
2496
|
-
* @type {string}
|
2497
|
-
*/
|
2498
|
-
INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
|
2499
|
-
/**
|
2500
|
-
* Hook that allows to mutate the CM's collection types links pre-set filters
|
2501
|
-
* @constant
|
2502
|
-
* @type {string}
|
2503
|
-
*/
|
2504
|
-
MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
|
2505
|
-
/**
|
2506
|
-
* Hook that allows to mutate the CM's edit view layout
|
2507
|
-
* @constant
|
2508
|
-
* @type {string}
|
2509
|
-
*/
|
2510
|
-
MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
|
2511
|
-
/**
|
2512
|
-
* Hook that allows to mutate the CM's single types links pre-set filters
|
2513
|
-
* @constant
|
2514
|
-
* @type {string}
|
2515
|
-
*/
|
2516
|
-
MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
|
2517
|
-
};
|
2518
|
-
const contentTypesApi = contentManagerApi.injectEndpoints({
|
2519
|
-
endpoints: (builder) => ({
|
2520
|
-
getContentTypeConfiguration: builder.query({
|
2521
|
-
query: (uid) => ({
|
2522
|
-
url: `/content-manager/content-types/${uid}/configuration`,
|
2523
|
-
method: "GET"
|
2524
|
-
}),
|
2525
|
-
transformResponse: (response) => response.data,
|
2526
|
-
providesTags: (_result, _error, uid) => [
|
2527
|
-
{ type: "ContentTypesConfiguration", id: uid },
|
2528
|
-
{ type: "ContentTypeSettings", id: "LIST" }
|
2529
|
-
]
|
2530
|
-
}),
|
2531
|
-
getAllContentTypeSettings: builder.query({
|
2532
|
-
query: () => "/content-manager/content-types-settings",
|
2533
|
-
transformResponse: (response) => response.data,
|
2534
|
-
providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
|
2535
|
-
}),
|
2536
|
-
updateContentTypeConfiguration: builder.mutation({
|
2537
|
-
query: ({ uid, ...body }) => ({
|
2538
|
-
url: `/content-manager/content-types/${uid}/configuration`,
|
2539
|
-
method: "PUT",
|
2540
|
-
data: body
|
2541
|
-
}),
|
2542
|
-
transformResponse: (response) => response.data,
|
2543
|
-
invalidatesTags: (_result, _error, { uid }) => [
|
2544
|
-
{ type: "ContentTypesConfiguration", id: uid },
|
2545
|
-
{ type: "ContentTypeSettings", id: "LIST" },
|
2546
|
-
// Is this necessary?
|
2547
|
-
{ type: "InitialData" }
|
2548
|
-
]
|
2549
|
-
})
|
2550
|
-
})
|
2551
|
-
});
|
2552
|
-
const {
|
2553
|
-
useGetContentTypeConfigurationQuery,
|
2554
|
-
useGetAllContentTypeSettingsQuery,
|
2555
|
-
useUpdateContentTypeConfigurationMutation
|
2556
|
-
} = contentTypesApi;
|
2557
|
-
const checkIfAttributeIsDisplayable = (attribute) => {
|
2558
|
-
const { type } = attribute;
|
2559
|
-
if (type === "relation") {
|
2560
|
-
return !attribute.relation.toLowerCase().includes("morph");
|
2561
|
-
}
|
2562
|
-
return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
|
2563
|
-
};
|
2564
|
-
const getMainField = (attribute, mainFieldName, { schemas, components }) => {
|
2565
|
-
if (!mainFieldName) {
|
2566
|
-
return void 0;
|
2567
|
-
}
|
2568
|
-
const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
|
2569
|
-
// @ts-expect-error – `targetModel` does exist on the attribute for a relation.
|
2570
|
-
schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
|
2571
|
-
);
|
2572
|
-
return {
|
2573
|
-
name: mainFieldName,
|
2574
|
-
type: mainFieldType ?? "string"
|
2575
|
-
};
|
2576
|
-
};
|
2577
|
-
const DEFAULT_SETTINGS = {
|
2578
|
-
bulkable: false,
|
2579
|
-
filterable: false,
|
2580
|
-
searchable: false,
|
2581
|
-
pagination: false,
|
2582
|
-
defaultSortBy: "",
|
2583
|
-
defaultSortOrder: "asc",
|
2584
|
-
mainField: "id",
|
2585
|
-
pageSize: 10
|
2586
|
-
};
|
2587
|
-
const useDocumentLayout = (model) => {
|
2588
|
-
const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
|
2589
|
-
const [{ query }] = strapiAdmin.useQueryParams();
|
2590
|
-
const runHookWaterfall = strapiAdmin.useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
|
2591
|
-
const { toggleNotification } = strapiAdmin.useNotification();
|
2592
|
-
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
2593
|
-
const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
|
2594
|
-
const {
|
2595
|
-
data,
|
2596
|
-
isLoading: isLoadingConfigs,
|
2597
|
-
error,
|
2598
|
-
isFetching: isFetchingConfigs
|
2599
|
-
} = useGetContentTypeConfigurationQuery(model);
|
2600
|
-
const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
|
2601
|
-
React__namespace.useEffect(() => {
|
2602
|
-
if (error) {
|
2603
|
-
toggleNotification({
|
2604
|
-
type: "danger",
|
2605
|
-
message: formatAPIError(error)
|
2606
|
-
});
|
2607
|
-
}
|
2608
|
-
}, [error, formatAPIError, toggleNotification]);
|
2609
|
-
const editLayout = React__namespace.useMemo(
|
2610
|
-
() => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
|
2611
|
-
layout: [],
|
2612
|
-
components: {},
|
2613
|
-
metadatas: {},
|
2614
|
-
options: {},
|
2615
|
-
settings: DEFAULT_SETTINGS
|
2616
|
-
},
|
2617
|
-
[data, isLoading, schemas, schema, components]
|
2618
|
-
);
|
2619
|
-
const listLayout = React__namespace.useMemo(() => {
|
2620
|
-
return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
|
2621
|
-
layout: [],
|
2622
|
-
metadatas: {},
|
2623
|
-
options: {},
|
2624
|
-
settings: DEFAULT_SETTINGS
|
2625
|
-
};
|
2626
|
-
}, [data, isLoading, schemas, schema, components]);
|
2627
|
-
const { layout: edit } = React__namespace.useMemo(
|
2628
|
-
() => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
|
2629
|
-
layout: editLayout,
|
2630
|
-
query
|
2631
|
-
}),
|
2632
|
-
[editLayout, query, runHookWaterfall]
|
2633
|
-
);
|
2634
|
-
return {
|
2635
|
-
error,
|
2636
|
-
isLoading,
|
2637
|
-
edit,
|
2638
|
-
list: listLayout
|
2639
|
-
};
|
2640
|
-
};
|
2641
|
-
const useDocLayout = () => {
|
2642
|
-
const { model } = useDoc();
|
2643
|
-
return useDocumentLayout(model);
|
2644
|
-
};
|
2645
|
-
const formatEditLayout = (data, {
|
2646
|
-
schemas,
|
2647
|
-
schema,
|
2648
|
-
components
|
2649
|
-
}) => {
|
2650
|
-
let currentPanelIndex = 0;
|
2651
|
-
const panelledEditAttributes = convertEditLayoutToFieldLayouts(
|
2652
|
-
data.contentType.layouts.edit,
|
2653
|
-
schema?.attributes,
|
2654
|
-
data.contentType.metadatas,
|
2655
|
-
{ configurations: data.components, schemas: components },
|
2656
|
-
schemas
|
2657
|
-
).reduce((panels, row) => {
|
2658
|
-
if (row.some((field) => field.type === "dynamiczone")) {
|
2659
|
-
panels.push([row]);
|
2660
|
-
currentPanelIndex += 2;
|
2661
|
-
} else {
|
2662
|
-
if (!panels[currentPanelIndex]) {
|
2663
|
-
panels.push([]);
|
2664
|
-
}
|
2665
|
-
panels[currentPanelIndex].push(row);
|
2666
|
-
}
|
2667
|
-
return panels;
|
2668
|
-
}, []);
|
2669
|
-
const componentEditAttributes = Object.entries(data.components).reduce(
|
2670
|
-
(acc, [uid, configuration]) => {
|
2671
|
-
acc[uid] = {
|
2672
|
-
layout: convertEditLayoutToFieldLayouts(
|
2673
|
-
configuration.layouts.edit,
|
2674
|
-
components[uid].attributes,
|
2675
|
-
configuration.metadatas
|
2676
|
-
),
|
2677
|
-
settings: {
|
2678
|
-
...configuration.settings,
|
2679
|
-
icon: components[uid].info.icon,
|
2680
|
-
displayName: components[uid].info.displayName
|
2681
|
-
}
|
2682
|
-
};
|
2683
|
-
return acc;
|
2684
|
-
},
|
2685
|
-
{}
|
2686
|
-
);
|
2687
|
-
const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
|
2688
|
-
(acc, [attribute, metadata]) => {
|
2689
|
-
return {
|
2690
|
-
...acc,
|
2691
|
-
[attribute]: metadata.edit
|
2692
|
-
};
|
2693
|
-
},
|
2694
|
-
{}
|
2695
|
-
);
|
2696
|
-
return {
|
2697
|
-
layout: panelledEditAttributes,
|
2698
|
-
components: componentEditAttributes,
|
2699
|
-
metadatas: editMetadatas,
|
2700
|
-
settings: {
|
2701
|
-
...data.contentType.settings,
|
2702
|
-
displayName: schema?.info.displayName
|
2941
|
+
}
|
2942
|
+
} finally {
|
2943
|
+
if (!listViewPathMatch) {
|
2944
|
+
setSubmitting(false);
|
2945
|
+
}
|
2946
|
+
}
|
2947
|
+
}
|
2703
2948
|
},
|
2704
|
-
|
2705
|
-
|
2706
|
-
...schema?.pluginOptions,
|
2707
|
-
...data.contentType.options
|
2708
|
-
}
|
2949
|
+
variant: "danger",
|
2950
|
+
position: ["header", "table-row"]
|
2709
2951
|
};
|
2710
2952
|
};
|
2711
|
-
|
2712
|
-
|
2713
|
-
|
2714
|
-
|
2715
|
-
|
2716
|
-
|
2717
|
-
}
|
2718
|
-
|
2719
|
-
|
2720
|
-
|
2721
|
-
|
2722
|
-
|
2723
|
-
|
2724
|
-
|
2725
|
-
|
2726
|
-
|
2727
|
-
|
2728
|
-
|
2729
|
-
|
2730
|
-
|
2731
|
-
|
2732
|
-
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
}
|
2738
|
-
}
|
2739
|
-
);
|
2953
|
+
DeleteAction$1.type = "delete";
|
2954
|
+
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2955
|
+
const Panels = () => {
|
2956
|
+
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2957
|
+
const [
|
2958
|
+
{
|
2959
|
+
query: { status }
|
2960
|
+
}
|
2961
|
+
] = strapiAdmin.useQueryParams({
|
2962
|
+
status: "draft"
|
2963
|
+
});
|
2964
|
+
const { model, id, document, meta, collectionType } = useDoc();
|
2965
|
+
const plugins = strapiAdmin.useStrapiApp("Panels", (state) => state.plugins);
|
2966
|
+
const props = {
|
2967
|
+
activeTab: status,
|
2968
|
+
model,
|
2969
|
+
documentId: id,
|
2970
|
+
document: isCloning ? void 0 : document,
|
2971
|
+
meta: isCloning ? void 0 : meta,
|
2972
|
+
collectionType
|
2973
|
+
};
|
2974
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
2975
|
+
strapiAdmin.DescriptionComponentRenderer,
|
2976
|
+
{
|
2977
|
+
props,
|
2978
|
+
descriptions: plugins["content-manager"].apis.getEditViewSidePanels(),
|
2979
|
+
children: (panels) => panels.map(({ content, id: id2, ...description }) => /* @__PURE__ */ jsxRuntime.jsx(Panel, { ...description, children: content }, id2))
|
2980
|
+
}
|
2981
|
+
) });
|
2740
2982
|
};
|
2741
|
-
const
|
2742
|
-
|
2743
|
-
schema,
|
2744
|
-
components
|
2745
|
-
}) => {
|
2746
|
-
const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
|
2747
|
-
(acc, [attribute, metadata]) => {
|
2748
|
-
return {
|
2749
|
-
...acc,
|
2750
|
-
[attribute]: metadata.list
|
2751
|
-
};
|
2752
|
-
},
|
2753
|
-
{}
|
2754
|
-
);
|
2755
|
-
const listAttributes = convertListLayoutToFieldLayouts(
|
2756
|
-
data.contentType.layouts.list,
|
2757
|
-
schema?.attributes,
|
2758
|
-
listMetadatas,
|
2759
|
-
{ configurations: data.components, schemas: components },
|
2760
|
-
schemas
|
2761
|
-
);
|
2983
|
+
const ActionsPanel = () => {
|
2984
|
+
const { formatMessage } = reactIntl.useIntl();
|
2762
2985
|
return {
|
2763
|
-
|
2764
|
-
|
2765
|
-
|
2766
|
-
|
2767
|
-
|
2768
|
-
...schema?.pluginOptions,
|
2769
|
-
...data.contentType.options
|
2770
|
-
}
|
2986
|
+
title: formatMessage({
|
2987
|
+
id: "content-manager.containers.edit.panels.default.title",
|
2988
|
+
defaultMessage: "Entry"
|
2989
|
+
}),
|
2990
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(ActionsPanelContent, {})
|
2771
2991
|
};
|
2772
2992
|
};
|
2773
|
-
|
2774
|
-
|
2775
|
-
|
2776
|
-
|
2777
|
-
|
2993
|
+
ActionsPanel.type = "actions";
|
2994
|
+
const ActionsPanelContent = () => {
|
2995
|
+
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2996
|
+
const [
|
2997
|
+
{
|
2998
|
+
query: { status = "draft" }
|
2778
2999
|
}
|
2779
|
-
|
2780
|
-
|
2781
|
-
|
2782
|
-
|
2783
|
-
|
2784
|
-
|
2785
|
-
|
2786
|
-
|
2787
|
-
|
2788
|
-
|
2789
|
-
|
2790
|
-
|
2791
|
-
|
2792
|
-
|
3000
|
+
] = strapiAdmin.useQueryParams();
|
3001
|
+
const { model, id, document, meta, collectionType } = useDoc();
|
3002
|
+
const plugins = strapiAdmin.useStrapiApp("ActionsPanel", (state) => state.plugins);
|
3003
|
+
const props = {
|
3004
|
+
activeTab: status,
|
3005
|
+
model,
|
3006
|
+
documentId: id,
|
3007
|
+
document: isCloning ? void 0 : document,
|
3008
|
+
meta: isCloning ? void 0 : meta,
|
3009
|
+
collectionType
|
3010
|
+
};
|
3011
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, width: "100%", children: [
|
3012
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
3013
|
+
strapiAdmin.DescriptionComponentRenderer,
|
3014
|
+
{
|
3015
|
+
props,
|
3016
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3017
|
+
children: (actions2) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActions, { actions: actions2 })
|
3018
|
+
}
|
3019
|
+
),
|
3020
|
+
/* @__PURE__ */ jsxRuntime.jsx(InjectionZone, { area: "editView.right-links", slug: model })
|
3021
|
+
] });
|
2793
3022
|
};
|
3023
|
+
const Panel = React__namespace.forwardRef(({ children, title }, ref) => {
|
3024
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
3025
|
+
designSystem.Flex,
|
3026
|
+
{
|
3027
|
+
ref,
|
3028
|
+
tag: "aside",
|
3029
|
+
"aria-labelledby": "additional-information",
|
3030
|
+
background: "neutral0",
|
3031
|
+
borderColor: "neutral150",
|
3032
|
+
hasRadius: true,
|
3033
|
+
paddingBottom: 4,
|
3034
|
+
paddingLeft: 4,
|
3035
|
+
paddingRight: 4,
|
3036
|
+
paddingTop: 4,
|
3037
|
+
shadow: "tableShadow",
|
3038
|
+
gap: 3,
|
3039
|
+
direction: "column",
|
3040
|
+
justifyContent: "stretch",
|
3041
|
+
alignItems: "flex-start",
|
3042
|
+
children: [
|
3043
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", textColor: "neutral600", children: title }),
|
3044
|
+
children
|
3045
|
+
]
|
3046
|
+
}
|
3047
|
+
);
|
3048
|
+
});
|
2794
3049
|
const ConfirmBulkActionDialog = ({
|
2795
3050
|
onToggleDialog,
|
2796
3051
|
isOpen = false,
|
@@ -2798,7 +3053,7 @@ const ConfirmBulkActionDialog = ({
|
|
2798
3053
|
endAction
|
2799
3054
|
}) => {
|
2800
3055
|
const { formatMessage } = reactIntl.useIntl();
|
2801
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, {
|
3056
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: isOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
|
2802
3057
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: formatMessage({
|
2803
3058
|
id: "app.components.ConfirmDialog.title",
|
2804
3059
|
defaultMessage: "Confirmation"
|
@@ -2829,6 +3084,7 @@ const ConfirmDialogPublishAll = ({
|
|
2829
3084
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler(getTranslation);
|
2830
3085
|
const { model, schema } = useDoc();
|
2831
3086
|
const [{ query }] = strapiAdmin.useQueryParams();
|
3087
|
+
const enableDraftRelationsCount = false;
|
2832
3088
|
const {
|
2833
3089
|
data: countDraftRelations = 0,
|
2834
3090
|
isLoading,
|
@@ -2840,7 +3096,7 @@ const ConfirmDialogPublishAll = ({
|
|
2840
3096
|
locale: query?.plugins?.i18n?.locale
|
2841
3097
|
},
|
2842
3098
|
{
|
2843
|
-
skip:
|
3099
|
+
skip: !enableDraftRelationsCount
|
2844
3100
|
}
|
2845
3101
|
);
|
2846
3102
|
React__namespace.useEffect(() => {
|
@@ -2919,7 +3175,14 @@ const formatErrorMessages = (errors, parentKey, formatMessage) => {
|
|
2919
3175
|
)
|
2920
3176
|
);
|
2921
3177
|
} else {
|
2922
|
-
messages.push(
|
3178
|
+
messages.push(
|
3179
|
+
...formatErrorMessages(
|
3180
|
+
// @ts-expect-error TODO: check why value is not compatible with FormErrors
|
3181
|
+
value,
|
3182
|
+
currentKey,
|
3183
|
+
formatMessage
|
3184
|
+
)
|
3185
|
+
);
|
2923
3186
|
}
|
2924
3187
|
} else {
|
2925
3188
|
messages.push(
|
@@ -3018,7 +3281,7 @@ const SelectedEntriesTableContent = ({
|
|
3018
3281
|
status: row.status
|
3019
3282
|
}
|
3020
3283
|
) }),
|
3021
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
3284
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
3022
3285
|
designSystem.IconButton,
|
3023
3286
|
{
|
3024
3287
|
tag: reactRouterDom.Link,
|
@@ -3041,9 +3304,10 @@ const SelectedEntriesTableContent = ({
|
|
3041
3304
|
),
|
3042
3305
|
target: "_blank",
|
3043
3306
|
marginLeft: "auto",
|
3044
|
-
|
3307
|
+
variant: "ghost",
|
3308
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Pencil, { width: "1.6rem", height: "1.6rem" })
|
3045
3309
|
}
|
3046
|
-
) })
|
3310
|
+
) }) })
|
3047
3311
|
] }, row.id)) })
|
3048
3312
|
] });
|
3049
3313
|
};
|
@@ -3080,7 +3344,13 @@ const SelectedEntriesModalContent = ({
|
|
3080
3344
|
);
|
3081
3345
|
const { rows, validationErrors } = React__namespace.useMemo(() => {
|
3082
3346
|
if (data.length > 0 && schema) {
|
3083
|
-
const validate = createYupSchema(
|
3347
|
+
const validate = createYupSchema(
|
3348
|
+
schema.attributes,
|
3349
|
+
components,
|
3350
|
+
// Since this is the "Publish" action, the validation
|
3351
|
+
// schema must enforce the rules for published entities
|
3352
|
+
{ status: "published" }
|
3353
|
+
);
|
3084
3354
|
const validationErrors2 = {};
|
3085
3355
|
const rows2 = data.map((entry) => {
|
3086
3356
|
try {
|
@@ -3430,7 +3700,7 @@ const TableActions = ({ document }) => {
|
|
3430
3700
|
strapiAdmin.DescriptionComponentRenderer,
|
3431
3701
|
{
|
3432
3702
|
props,
|
3433
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3703
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3434
3704
|
children: (actions2) => {
|
3435
3705
|
const tableRowActions = actions2.filter((action) => {
|
3436
3706
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3541,7 +3811,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3541
3811
|
}),
|
3542
3812
|
content: /* @__PURE__ */ jsxRuntime.jsx(AutoCloneFailureModalBody, { prohibitedFields }),
|
3543
3813
|
footer: ({ onClose }) => {
|
3544
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
3814
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
|
3545
3815
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onClose, variant: "tertiary", children: formatMessage({
|
3546
3816
|
id: "cancel",
|
3547
3817
|
defaultMessage: "Cancel"
|
@@ -3582,8 +3852,7 @@ class ContentManagerPlugin {
|
|
3582
3852
|
documentActions = [
|
3583
3853
|
...DEFAULT_ACTIONS,
|
3584
3854
|
...DEFAULT_TABLE_ROW_ACTIONS,
|
3585
|
-
...DEFAULT_HEADER_ACTIONS
|
3586
|
-
HistoryAction
|
3855
|
+
...DEFAULT_HEADER_ACTIONS
|
3587
3856
|
];
|
3588
3857
|
editViewSidePanels = [ActionsPanel];
|
3589
3858
|
headerActions = [];
|
@@ -3672,6 +3941,52 @@ const getPrintableType = (value) => {
|
|
3672
3941
|
}
|
3673
3942
|
return nativeType;
|
3674
3943
|
};
|
3944
|
+
const HistoryAction = ({ model, document }) => {
|
3945
|
+
const { formatMessage } = reactIntl.useIntl();
|
3946
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
3947
|
+
const navigate = reactRouterDom.useNavigate();
|
3948
|
+
const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
|
3949
|
+
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3950
|
+
return null;
|
3951
|
+
}
|
3952
|
+
return {
|
3953
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
|
3954
|
+
label: formatMessage({
|
3955
|
+
id: "content-manager.history.document-action",
|
3956
|
+
defaultMessage: "Content History"
|
3957
|
+
}),
|
3958
|
+
onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
|
3959
|
+
disabled: (
|
3960
|
+
/**
|
3961
|
+
* The user is creating a new document.
|
3962
|
+
* It hasn't been saved yet, so there's no history to go to
|
3963
|
+
*/
|
3964
|
+
!document || /**
|
3965
|
+
* The document has been created but the current dimension has never been saved.
|
3966
|
+
* For example, the user is creating a new locale in an existing document,
|
3967
|
+
* so there's no history for the document in that locale
|
3968
|
+
*/
|
3969
|
+
!document.id || /**
|
3970
|
+
* History is only available for content types created by the user.
|
3971
|
+
* These have the `api::` prefix, as opposed to the ones created by Strapi or plugins,
|
3972
|
+
* which start with `admin::` or `plugin::`
|
3973
|
+
*/
|
3974
|
+
!model.startsWith("api::")
|
3975
|
+
),
|
3976
|
+
position: "header"
|
3977
|
+
};
|
3978
|
+
};
|
3979
|
+
HistoryAction.type = "history";
|
3980
|
+
const historyAdmin = {
|
3981
|
+
bootstrap(app) {
|
3982
|
+
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
3983
|
+
addDocumentAction((actions2) => {
|
3984
|
+
const indexOfDeleteAction = actions2.findIndex((action) => action.type === "delete");
|
3985
|
+
actions2.splice(indexOfDeleteAction, 0, HistoryAction);
|
3986
|
+
return actions2;
|
3987
|
+
});
|
3988
|
+
}
|
3989
|
+
};
|
3675
3990
|
const initialState = {
|
3676
3991
|
collectionTypeLinks: [],
|
3677
3992
|
components: [],
|
@@ -3708,6 +4023,70 @@ const { setInitialData } = actions;
|
|
3708
4023
|
const reducer = toolkit.combineReducers({
|
3709
4024
|
app: reducer$1
|
3710
4025
|
});
|
4026
|
+
const previewApi = contentManagerApi.injectEndpoints({
|
4027
|
+
endpoints: (builder) => ({
|
4028
|
+
getPreviewUrl: builder.query({
|
4029
|
+
query({ query, params }) {
|
4030
|
+
return {
|
4031
|
+
url: `/content-manager/preview/url/${params.contentType}`,
|
4032
|
+
method: "GET",
|
4033
|
+
config: {
|
4034
|
+
params: query
|
4035
|
+
}
|
4036
|
+
};
|
4037
|
+
}
|
4038
|
+
})
|
4039
|
+
})
|
4040
|
+
});
|
4041
|
+
const { useGetPreviewUrlQuery } = previewApi;
|
4042
|
+
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4043
|
+
const { formatMessage } = reactIntl.useIntl();
|
4044
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
4045
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
4046
|
+
const { data, error } = useGetPreviewUrlQuery({
|
4047
|
+
params: {
|
4048
|
+
contentType: model
|
4049
|
+
},
|
4050
|
+
query: {
|
4051
|
+
documentId,
|
4052
|
+
locale: document?.locale,
|
4053
|
+
status: document?.status
|
4054
|
+
}
|
4055
|
+
});
|
4056
|
+
if (!data?.data?.url || error) {
|
4057
|
+
return null;
|
4058
|
+
}
|
4059
|
+
const handleClick = () => {
|
4060
|
+
trackUsage("willOpenPreview");
|
4061
|
+
};
|
4062
|
+
return {
|
4063
|
+
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4064
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
4065
|
+
designSystem.Button,
|
4066
|
+
{
|
4067
|
+
variant: "tertiary",
|
4068
|
+
tag: reactRouterDom.Link,
|
4069
|
+
to: { pathname: "preview", search: qs.stringify(query, { encode: false }) },
|
4070
|
+
onClick: handleClick,
|
4071
|
+
flex: "auto",
|
4072
|
+
children: formatMessage({
|
4073
|
+
id: "content-manager.preview.panel.button",
|
4074
|
+
defaultMessage: "Open preview"
|
4075
|
+
})
|
4076
|
+
}
|
4077
|
+
) })
|
4078
|
+
};
|
4079
|
+
};
|
4080
|
+
const FEATURE_ID = "preview";
|
4081
|
+
const previewAdmin = {
|
4082
|
+
bootstrap(app) {
|
4083
|
+
if (!window.strapi.future.isEnabled(FEATURE_ID)) {
|
4084
|
+
return;
|
4085
|
+
}
|
4086
|
+
const contentManagerPluginApis = app.getPlugin("content-manager").apis;
|
4087
|
+
contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
|
4088
|
+
}
|
4089
|
+
};
|
3711
4090
|
const index = {
|
3712
4091
|
register(app) {
|
3713
4092
|
const cm = new ContentManagerPlugin();
|
@@ -3727,7 +4106,7 @@ const index = {
|
|
3727
4106
|
app.router.addRoute({
|
3728
4107
|
path: "content-manager/*",
|
3729
4108
|
lazy: async () => {
|
3730
|
-
const { Layout } = await Promise.resolve().then(() => require("./layout-
|
4109
|
+
const { Layout } = await Promise.resolve().then(() => require("./layout-9fI2_QJt.js"));
|
3731
4110
|
return {
|
3732
4111
|
Component: Layout
|
3733
4112
|
};
|
@@ -3736,10 +4115,18 @@ const index = {
|
|
3736
4115
|
});
|
3737
4116
|
app.registerPlugin(cm.config);
|
3738
4117
|
},
|
4118
|
+
bootstrap(app) {
|
4119
|
+
if (typeof historyAdmin.bootstrap === "function") {
|
4120
|
+
historyAdmin.bootstrap(app);
|
4121
|
+
}
|
4122
|
+
if (typeof previewAdmin.bootstrap === "function") {
|
4123
|
+
previewAdmin.bootstrap(app);
|
4124
|
+
}
|
4125
|
+
},
|
3739
4126
|
async registerTrads({ locales }) {
|
3740
4127
|
const importedTrads = await Promise.all(
|
3741
4128
|
locales.map((locale) => {
|
3742
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-
|
4129
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-CHOp_xJv.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-9K52xZIr.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-B2Kyv8Z9.js")), "./translations/gu.json": () => Promise.resolve().then(() => require("./gu-BRmF601H.js")), "./translations/hi.json": () => Promise.resolve().then(() => require("./hi-CCJBptSq.js")), "./translations/hu.json": () => Promise.resolve().then(() => require("./hu-sNV_yLYy.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-B5Ser98A.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-DkBIs7vD.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-7sfIbjxE.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-woFZPmLk.js")), "./translations/ml.json": () => Promise.resolve().then(() => require("./ml-C2W8N8k1.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-BuFotyP_.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-bbEOHChV.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-uzwG-hk7.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-BiOz37D9.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CeXQuq50.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BT3ybNny.js")), "./translations/sa.json": () => Promise.resolve().then(() => require("./sa-CcvkYInH.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-CvY09Xjv.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-MYDuzgvT.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-D9_GfAjc.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-D9UH-O_R.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-C8EiqJY7.js")), "./translations/vi.json": () => Promise.resolve().then(() => require("./vi-CJlYDheJ.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-9kOncHGw.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CQQfszqR.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
|
3743
4130
|
return {
|
3744
4131
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
3745
4132
|
locale
|
@@ -3757,6 +4144,7 @@ const index = {
|
|
3757
4144
|
};
|
3758
4145
|
exports.ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD = ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD;
|
3759
4146
|
exports.BulkActionsRenderer = BulkActionsRenderer;
|
4147
|
+
exports.CLONE_PATH = CLONE_PATH;
|
3760
4148
|
exports.COLLECTION_TYPES = COLLECTION_TYPES;
|
3761
4149
|
exports.CREATOR_FIELDS = CREATOR_FIELDS;
|
3762
4150
|
exports.DEFAULT_SETTINGS = DEFAULT_SETTINGS;
|
@@ -3784,6 +4172,7 @@ exports.getMainField = getMainField;
|
|
3784
4172
|
exports.getTranslation = getTranslation;
|
3785
4173
|
exports.index = index;
|
3786
4174
|
exports.setInitialData = setInitialData;
|
4175
|
+
exports.useContentManagerContext = useContentManagerContext;
|
3787
4176
|
exports.useContentTypeSchema = useContentTypeSchema;
|
3788
4177
|
exports.useDoc = useDoc;
|
3789
4178
|
exports.useDocLayout = useDocLayout;
|
@@ -3795,5 +4184,6 @@ exports.useGetAllContentTypeSettingsQuery = useGetAllContentTypeSettingsQuery;
|
|
3795
4184
|
exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
|
3796
4185
|
exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
|
3797
4186
|
exports.useGetInitialDataQuery = useGetInitialDataQuery;
|
4187
|
+
exports.useGetPreviewUrlQuery = useGetPreviewUrlQuery;
|
3798
4188
|
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
|
3799
|
-
//# sourceMappingURL=index-
|
4189
|
+
//# sourceMappingURL=index-CJX65DLa.js.map
|