@strapi/content-manager 0.0.0-experimental.da85533897155e719d784f0271223c866d2f69ab → 0.0.0-experimental.dad3c50630ca4fd9eccdcbe549ee632fc572e23d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -1
- package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DyDkPajU.js → ComponentConfigurationPage-BLWQy8ru.js} +5 -6
- package/dist/_chunks/{ComponentConfigurationPage-DyDkPajU.js.map → ComponentConfigurationPage-BLWQy8ru.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-9lRmRdIr.mjs → ComponentConfigurationPage-CtIa3aa2.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-9lRmRdIr.mjs.map → ComponentConfigurationPage-CtIa3aa2.mjs.map} +1 -1
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js → ComponentIcon-CRbtQEUV.js} +2 -3
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js.map → ComponentIcon-CRbtQEUV.js.map} +1 -1
- package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -1
- package/dist/_chunks/{EditConfigurationPage-Bk893vVY.mjs → EditConfigurationPage-DsPR2DVk.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-Bk893vVY.mjs.map → EditConfigurationPage-DsPR2DVk.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-DValmA0m.js → EditConfigurationPage-RQkymxCy.js} +5 -6
- package/dist/_chunks/{EditConfigurationPage-DValmA0m.js.map → EditConfigurationPage-RQkymxCy.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-Dk7Eaft4.js → EditViewPage-B-kExt8C.js} +50 -11
- package/dist/_chunks/EditViewPage-B-kExt8C.js.map +1 -0
- package/dist/_chunks/{EditViewPage-DiNFdFqP.mjs → EditViewPage-BPyVuPfM.mjs} +50 -10
- package/dist/_chunks/EditViewPage-BPyVuPfM.mjs.map +1 -0
- package/dist/_chunks/{Field-DH2OaqUP.js → Field-DPIsQRre.js} +250 -161
- package/dist/_chunks/Field-DPIsQRre.js.map +1 -0
- package/dist/_chunks/{Field-Dv_HTFTa.mjs → Field-Dltnt1km.mjs} +244 -155
- package/dist/_chunks/Field-Dltnt1km.mjs.map +1 -0
- package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
- package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
- package/dist/_chunks/{Form-B_dUDizM.js → Form-BFi4MXMT.js} +19 -12
- package/dist/_chunks/Form-BFi4MXMT.js.map +1 -0
- package/dist/_chunks/{Form-Dy6P4HgH.mjs → Form-C1IcWm1u.mjs} +17 -9
- package/dist/_chunks/Form-C1IcWm1u.mjs.map +1 -0
- package/dist/_chunks/{History-DrwsD1Vc.mjs → History-04ChQ4pl.mjs} +71 -104
- package/dist/_chunks/History-04ChQ4pl.mjs.map +1 -0
- package/dist/_chunks/{History-BT4w83Oa.js → History-wjcK4L0C.js} +70 -104
- package/dist/_chunks/History-wjcK4L0C.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-BxIP0jRy.mjs → ListConfigurationPage-BYqPYLSU.mjs} +7 -6
- package/dist/_chunks/ListConfigurationPage-BYqPYLSU.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-CuYrMcW3.js → ListConfigurationPage-CRbxIC3J.js} +7 -7
- package/dist/_chunks/ListConfigurationPage-CRbxIC3J.js.map +1 -0
- package/dist/_chunks/{ListViewPage-BvpwNur7.js → ListViewPage-D5NY9183.js} +88 -54
- package/dist/_chunks/ListViewPage-D5NY9183.js.map +1 -0
- package/dist/_chunks/{ListViewPage-5a1vw-OK.mjs → ListViewPage-FU2LBuhl.mjs} +83 -48
- package/dist/_chunks/ListViewPage-FU2LBuhl.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-UqEiWKkM.js → NoContentTypePage-BgQVE_Qb.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-UqEiWKkM.js.map → NoContentTypePage-BgQVE_Qb.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-Bm6tRcd3.mjs → NoContentTypePage-DCKUkwb8.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-Bm6tRcd3.mjs.map → NoContentTypePage-DCKUkwb8.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-C_vGRo8Q.js → NoPermissionsPage-C5jwn70o.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-C_vGRo8Q.js.map → NoPermissionsPage-C5jwn70o.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-BHPqn_tQ.mjs → NoPermissionsPage-jqve7C8l.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-BHPqn_tQ.mjs.map → NoPermissionsPage-jqve7C8l.mjs.map} +1 -1
- package/dist/_chunks/Preview-BMYN548c.mjs +294 -0
- package/dist/_chunks/Preview-BMYN548c.mjs.map +1 -0
- package/dist/_chunks/Preview-DaOihysv.js +312 -0
- package/dist/_chunks/Preview-DaOihysv.js.map +1 -0
- package/dist/_chunks/{Relations-CznVF6LS.js → Relations-CTGM7Hv5.js} +75 -42
- package/dist/_chunks/Relations-CTGM7Hv5.js.map +1 -0
- package/dist/_chunks/{Relations-C7fPyh5P.mjs → Relations-gscPkxjF.mjs} +75 -41
- package/dist/_chunks/Relations-gscPkxjF.mjs.map +1 -0
- package/dist/_chunks/{en-otD_UBJi.js → en-BzQmavmK.js} +32 -14
- package/dist/_chunks/{en-otD_UBJi.js.map → en-BzQmavmK.js.map} +1 -1
- package/dist/_chunks/{en-CbaIuYoB.mjs → en-CSxLmrh1.mjs} +32 -14
- package/dist/_chunks/{en-CbaIuYoB.mjs.map → en-CSxLmrh1.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/hooks-BAaaKPS_.js.map +1 -1
- package/dist/_chunks/{index-D9UmmBcM.js → index-Ca7YWlAA.js} +1063 -754
- package/dist/_chunks/index-Ca7YWlAA.js.map +1 -0
- package/dist/_chunks/{index-BJ6uTqLL.mjs → index-DqasUQ6Q.mjs} +1066 -757
- package/dist/_chunks/index-DqasUQ6Q.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-kfu5Wtix.js → layout-BW80JSCd.js} +7 -7
- package/dist/_chunks/{layout-kfu5Wtix.js.map → layout-BW80JSCd.js.map} +1 -1
- package/dist/_chunks/{layout-uomiIGbG.mjs → layout-W3clJSCy.mjs} +6 -5
- package/dist/_chunks/{layout-uomiIGbG.mjs.map → layout-W3clJSCy.mjs.map} +1 -1
- 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-DiDufGSA.mjs → relations-BlDkoeWh.mjs} +6 -7
- package/dist/_chunks/relations-BlDkoeWh.mjs.map +1 -0
- package/dist/_chunks/{relations-DKENrxko.js → relations-C9Usz9k5.js} +6 -7
- package/dist/_chunks/relations-C9Usz9k5.js.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/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
- package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
- package/dist/admin/index.js +3 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +5 -3
- package/dist/admin/src/content-manager.d.ts +3 -2
- package/dist/admin/src/exports.d.ts +2 -1
- 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/pages/EditView/EditViewPage.d.ts +9 -1
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +3 -3
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +4 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +4 -1
- 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/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 -20
- 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/server/index.js +594 -335
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +595 -335
- 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/utils/metadata.d.ts +16 -1
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
- package/dist/server/src/history/controllers/history-version.d.ts +1 -1
- package/dist/server/src/history/controllers/history-version.d.ts.map +1 -1
- package/dist/server/src/history/services/history.d.ts +3 -3
- 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 +6 -11
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +7 -6
- package/dist/server/src/index.d.ts.map +1 -1
- 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 +16 -0
- package/dist/server/src/preview/services/index.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview-config.d.ts +32 -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 +19 -0
- package/dist/server/src/preview/utils.d.ts.map +1 -0
- package/dist/server/src/register.d.ts.map +1 -1
- 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 +12 -10
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +7 -6
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/utils/populate.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 +17 -15
- package/dist/_chunks/EditViewPage-DiNFdFqP.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-Dk7Eaft4.js.map +0 -1
- package/dist/_chunks/Field-DH2OaqUP.js.map +0 -1
- package/dist/_chunks/Field-Dv_HTFTa.mjs.map +0 -1
- package/dist/_chunks/Form-B_dUDizM.js.map +0 -1
- package/dist/_chunks/Form-Dy6P4HgH.mjs.map +0 -1
- package/dist/_chunks/History-BT4w83Oa.js.map +0 -1
- package/dist/_chunks/History-DrwsD1Vc.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-BxIP0jRy.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-CuYrMcW3.js.map +0 -1
- package/dist/_chunks/ListViewPage-5a1vw-OK.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-BvpwNur7.js.map +0 -1
- package/dist/_chunks/Relations-C7fPyh5P.mjs.map +0 -1
- package/dist/_chunks/Relations-CznVF6LS.js.map +0 -1
- package/dist/_chunks/index-BJ6uTqLL.mjs.map +0 -1
- package/dist/_chunks/index-D9UmmBcM.js.map +0 -1
- package/dist/_chunks/relations-DKENrxko.js.map +0 -1
- package/dist/_chunks/relations-DiDufGSA.mjs.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
@@ -4,18 +4,18 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
5
5
|
const React = require("react");
|
6
6
|
const designSystem = require("@strapi/design-system");
|
7
|
+
const mapValues = require("lodash/fp/mapValues");
|
7
8
|
const reactIntl = require("react-intl");
|
8
9
|
const reactRouterDom = require("react-router-dom");
|
9
10
|
const styledComponents = require("styled-components");
|
10
11
|
const yup = require("yup");
|
12
|
+
const qs = require("qs");
|
11
13
|
const pipe = require("lodash/fp/pipe");
|
12
14
|
const dateFns = require("date-fns");
|
13
|
-
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) {
|
17
|
-
if (e && e.__esModule)
|
18
|
-
return e;
|
18
|
+
if (e && e.__esModule) return e;
|
19
19
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
20
20
|
if (e) {
|
21
21
|
for (const k in e) {
|
@@ -32,15 +32,23 @@ function _interopNamespace(e) {
|
|
32
32
|
return Object.freeze(n);
|
33
33
|
}
|
34
34
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
35
|
+
const mapValues__default = /* @__PURE__ */ _interopDefault(mapValues);
|
35
36
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
36
37
|
const pipe__default = /* @__PURE__ */ _interopDefault(pipe);
|
37
|
-
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
38
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
38
39
|
const v = glob[path];
|
39
40
|
if (v) {
|
40
41
|
return typeof v === "function" ? v() : Promise.resolve(v);
|
41
42
|
}
|
42
43
|
return new Promise((_, reject) => {
|
43
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
44
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
45
|
+
reject.bind(
|
46
|
+
null,
|
47
|
+
new Error(
|
48
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
49
|
+
)
|
50
|
+
)
|
51
|
+
);
|
44
52
|
});
|
45
53
|
};
|
46
54
|
const PLUGIN_ID = "content-manager";
|
@@ -121,6 +129,7 @@ const DocumentRBAC = ({ children, permissions }) => {
|
|
121
129
|
if (!slug) {
|
122
130
|
throw new Error("Cannot find the slug param in the URL");
|
123
131
|
}
|
132
|
+
const [{ rawQuery }] = strapiAdmin.useQueryParams();
|
124
133
|
const userPermissions = strapiAdmin.useAuth("DocumentRBAC", (state) => state.permissions);
|
125
134
|
const contentTypePermissions = React__namespace.useMemo(() => {
|
126
135
|
const contentTypePermissions2 = userPermissions.filter(
|
@@ -131,7 +140,14 @@ const DocumentRBAC = ({ children, permissions }) => {
|
|
131
140
|
return { ...acc, [action]: [permission] };
|
132
141
|
}, {});
|
133
142
|
}, [slug, userPermissions]);
|
134
|
-
const { isLoading, allowedActions } = strapiAdmin.useRBAC(
|
143
|
+
const { isLoading, allowedActions } = strapiAdmin.useRBAC(
|
144
|
+
contentTypePermissions,
|
145
|
+
permissions ?? void 0,
|
146
|
+
// TODO: useRBAC context should be typed and built differently
|
147
|
+
// We are passing raw query as context to the hook so that it can
|
148
|
+
// rely on the locale provided from DocumentRBAC for its permission calculations.
|
149
|
+
rawQuery
|
150
|
+
);
|
135
151
|
const canCreateFields = !isLoading && allowedActions.canCreate ? extractAndDedupeFields(contentTypePermissions.create) : [];
|
136
152
|
const canReadFields = !isLoading && allowedActions.canRead ? extractAndDedupeFields(contentTypePermissions.read) : [];
|
137
153
|
const canUpdateFields = !isLoading && allowedActions.canUpdate ? extractAndDedupeFields(contentTypePermissions.update) : [];
|
@@ -180,7 +196,8 @@ const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
|
|
180
196
|
"InitialData",
|
181
197
|
"HistoryVersion",
|
182
198
|
"Relations",
|
183
|
-
"UidAvailability"
|
199
|
+
"UidAvailability",
|
200
|
+
"RecentDocumentList"
|
184
201
|
]
|
185
202
|
});
|
186
203
|
const documentApi = contentManagerApi.injectEndpoints({
|
@@ -198,7 +215,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
198
215
|
if (error) {
|
199
216
|
return [];
|
200
217
|
}
|
201
|
-
return [{ type: "Document", id: `${model}_LIST` }];
|
218
|
+
return [{ type: "Document", id: `${model}_LIST` }, "RecentDocumentList"];
|
202
219
|
}
|
203
220
|
}),
|
204
221
|
cloneDocument: builder.mutation({
|
@@ -212,7 +229,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
212
229
|
}),
|
213
230
|
invalidatesTags: (_result, _error, { model }) => [
|
214
231
|
{ type: "Document", id: `${model}_LIST` },
|
215
|
-
{ type: "UidAvailability", id: model }
|
232
|
+
{ type: "UidAvailability", id: model },
|
233
|
+
"RecentDocumentList"
|
216
234
|
]
|
217
235
|
}),
|
218
236
|
/**
|
@@ -231,8 +249,21 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
231
249
|
invalidatesTags: (result, _error, { model }) => [
|
232
250
|
{ type: "Document", id: `${model}_LIST` },
|
233
251
|
"Relations",
|
234
|
-
{ type: "UidAvailability", id: model }
|
235
|
-
|
252
|
+
{ type: "UidAvailability", id: model },
|
253
|
+
"RecentDocumentList"
|
254
|
+
],
|
255
|
+
transformResponse: (response, meta, arg) => {
|
256
|
+
if (!("data" in response) && arg.model === "plugin::users-permissions.user") {
|
257
|
+
return {
|
258
|
+
data: response,
|
259
|
+
meta: {
|
260
|
+
availableStatus: [],
|
261
|
+
availableLocales: []
|
262
|
+
}
|
263
|
+
};
|
264
|
+
}
|
265
|
+
return response;
|
266
|
+
}
|
236
267
|
}),
|
237
268
|
deleteDocument: builder.mutation({
|
238
269
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -243,7 +274,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
243
274
|
}
|
244
275
|
}),
|
245
276
|
invalidatesTags: (_result, _error, { collectionType, model }) => [
|
246
|
-
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model }
|
277
|
+
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model },
|
278
|
+
"RecentDocumentList"
|
247
279
|
]
|
248
280
|
}),
|
249
281
|
deleteManyDocuments: builder.mutation({
|
@@ -255,7 +287,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
255
287
|
params
|
256
288
|
}
|
257
289
|
}),
|
258
|
-
invalidatesTags: (_res, _error, { model }) => [
|
290
|
+
invalidatesTags: (_res, _error, { model }) => [
|
291
|
+
{ type: "Document", id: `${model}_LIST` },
|
292
|
+
"RecentDocumentList"
|
293
|
+
]
|
259
294
|
}),
|
260
295
|
discardDocument: builder.mutation({
|
261
296
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -273,7 +308,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
273
308
|
},
|
274
309
|
{ type: "Document", id: `${model}_LIST` },
|
275
310
|
"Relations",
|
276
|
-
{ type: "UidAvailability", id: model }
|
311
|
+
{ type: "UidAvailability", id: model },
|
312
|
+
"RecentDocumentList"
|
277
313
|
];
|
278
314
|
}
|
279
315
|
}),
|
@@ -286,7 +322,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
286
322
|
url: `/content-manager/collection-types/${model}`,
|
287
323
|
method: "GET",
|
288
324
|
config: {
|
289
|
-
params
|
325
|
+
params: qs.stringify(params, { encode: true })
|
290
326
|
}
|
291
327
|
}),
|
292
328
|
providesTags: (result, _error, arg) => {
|
@@ -368,7 +404,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
368
404
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
369
405
|
},
|
370
406
|
{ type: "Document", id: `${model}_LIST` },
|
371
|
-
"Relations"
|
407
|
+
"Relations",
|
408
|
+
"RecentDocumentList"
|
372
409
|
];
|
373
410
|
}
|
374
411
|
}),
|
@@ -399,7 +436,9 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
399
436
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
400
437
|
},
|
401
438
|
"Relations",
|
402
|
-
{ type: "UidAvailability", id: model }
|
439
|
+
{ type: "UidAvailability", id: model },
|
440
|
+
"RecentDocumentList",
|
441
|
+
"RecentDocumentList"
|
403
442
|
];
|
404
443
|
},
|
405
444
|
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
@@ -429,7 +468,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
429
468
|
{
|
430
469
|
type: "Document",
|
431
470
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
432
|
-
}
|
471
|
+
},
|
472
|
+
"RecentDocumentList"
|
433
473
|
];
|
434
474
|
}
|
435
475
|
}),
|
@@ -442,7 +482,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
442
482
|
params
|
443
483
|
}
|
444
484
|
}),
|
445
|
-
invalidatesTags: (_res, _error, { model, documentIds }) =>
|
485
|
+
invalidatesTags: (_res, _error, { model, documentIds }) => [
|
486
|
+
...documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` })),
|
487
|
+
"RecentDocumentList"
|
488
|
+
]
|
446
489
|
})
|
447
490
|
})
|
448
491
|
});
|
@@ -465,8 +508,7 @@ const {
|
|
465
508
|
useUnpublishManyDocumentsMutation
|
466
509
|
} = documentApi;
|
467
510
|
const buildValidParams = (query) => {
|
468
|
-
if (!query)
|
469
|
-
return query;
|
511
|
+
if (!query) return query;
|
470
512
|
const { plugins: _, ...validQueryParams } = {
|
471
513
|
...query,
|
472
514
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -474,14 +516,29 @@ const buildValidParams = (query) => {
|
|
474
516
|
{}
|
475
517
|
)
|
476
518
|
};
|
477
|
-
if ("_q" in validQueryParams) {
|
478
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
479
|
-
}
|
480
519
|
return validQueryParams;
|
481
520
|
};
|
482
521
|
const isBaseQueryError = (error) => {
|
483
522
|
return error.name !== void 0;
|
484
523
|
};
|
524
|
+
const arrayValidator = (attribute, options) => ({
|
525
|
+
message: strapiAdmin.translatedErrors.required,
|
526
|
+
test(value) {
|
527
|
+
if (options.status === "draft") {
|
528
|
+
return true;
|
529
|
+
}
|
530
|
+
if (!attribute.required) {
|
531
|
+
return true;
|
532
|
+
}
|
533
|
+
if (!value) {
|
534
|
+
return false;
|
535
|
+
}
|
536
|
+
if (Array.isArray(value) && value.length === 0) {
|
537
|
+
return false;
|
538
|
+
}
|
539
|
+
return true;
|
540
|
+
}
|
541
|
+
});
|
485
542
|
const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
|
486
543
|
const createModelSchema = (attributes2) => yup__namespace.object().shape(
|
487
544
|
Object.entries(attributes2).reduce((acc, [name, attribute]) => {
|
@@ -489,6 +546,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
489
546
|
return acc;
|
490
547
|
}
|
491
548
|
const validations = [
|
549
|
+
addNullableValidation,
|
492
550
|
addRequiredValidation,
|
493
551
|
addMinLengthValidation,
|
494
552
|
addMaxLengthValidation,
|
@@ -505,12 +563,12 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
505
563
|
...acc,
|
506
564
|
[name]: transformSchema(
|
507
565
|
yup__namespace.array().of(createModelSchema(attributes3).nullable(false))
|
508
|
-
)
|
566
|
+
).test(arrayValidator(attribute, options))
|
509
567
|
};
|
510
568
|
} else {
|
511
569
|
return {
|
512
570
|
...acc,
|
513
|
-
[name]: transformSchema(createModelSchema(attributes3))
|
571
|
+
[name]: transformSchema(createModelSchema(attributes3).nullable())
|
514
572
|
};
|
515
573
|
}
|
516
574
|
}
|
@@ -532,7 +590,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
532
590
|
}
|
533
591
|
)
|
534
592
|
)
|
535
|
-
)
|
593
|
+
).test(arrayValidator(attribute, options))
|
536
594
|
};
|
537
595
|
case "relation":
|
538
596
|
return {
|
@@ -544,7 +602,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
544
602
|
} else if (Array.isArray(value)) {
|
545
603
|
return yup__namespace.array().of(
|
546
604
|
yup__namespace.object().shape({
|
547
|
-
id: yup__namespace.
|
605
|
+
id: yup__namespace.number().required()
|
548
606
|
})
|
549
607
|
);
|
550
608
|
} else if (typeof value === "object") {
|
@@ -630,17 +688,17 @@ const nullableSchema = (schema) => {
|
|
630
688
|
schema
|
631
689
|
);
|
632
690
|
};
|
691
|
+
const addNullableValidation = () => (schema) => {
|
692
|
+
return nullableSchema(schema);
|
693
|
+
};
|
633
694
|
const addRequiredValidation = (attribute, options) => (schema) => {
|
634
|
-
if (options.status === "draft") {
|
635
|
-
return
|
636
|
-
}
|
637
|
-
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
638
|
-
return schema.min(1, strapiAdmin.translatedErrors.required);
|
695
|
+
if (options.status === "draft" || !attribute.required) {
|
696
|
+
return schema;
|
639
697
|
}
|
640
|
-
if (attribute.required &&
|
698
|
+
if (attribute.required && "required" in schema) {
|
641
699
|
return schema.required(strapiAdmin.translatedErrors.required);
|
642
700
|
}
|
643
|
-
return
|
701
|
+
return schema;
|
644
702
|
};
|
645
703
|
const addMinLengthValidation = (attribute, options) => (schema) => {
|
646
704
|
if (options.status === "draft") {
|
@@ -668,31 +726,12 @@ const addMaxLengthValidation = (attribute) => (schema) => {
|
|
668
726
|
return schema;
|
669
727
|
};
|
670
728
|
const addMinValidation = (attribute, options) => (schema) => {
|
671
|
-
if ("
|
729
|
+
if (options.status === "draft") {
|
730
|
+
return schema;
|
731
|
+
}
|
732
|
+
if ("min" in attribute && "min" in schema) {
|
672
733
|
const min = toInteger(attribute.min);
|
673
|
-
if (
|
674
|
-
if (options.status !== "draft" && !attribute.required && "test" in schema && min) {
|
675
|
-
return schema.test(
|
676
|
-
"custom-min",
|
677
|
-
{
|
678
|
-
...strapiAdmin.translatedErrors.min,
|
679
|
-
values: {
|
680
|
-
min: attribute.min
|
681
|
-
}
|
682
|
-
},
|
683
|
-
(value) => {
|
684
|
-
if (!value) {
|
685
|
-
return true;
|
686
|
-
}
|
687
|
-
if (Array.isArray(value) && value.length === 0) {
|
688
|
-
return true;
|
689
|
-
}
|
690
|
-
return value.length >= min;
|
691
|
-
}
|
692
|
-
);
|
693
|
-
}
|
694
|
-
}
|
695
|
-
if ("min" in schema && min) {
|
734
|
+
if (min) {
|
696
735
|
return schema.min(min, {
|
697
736
|
...strapiAdmin.translatedErrors.min,
|
698
737
|
values: {
|
@@ -810,19 +849,115 @@ const extractContentTypeComponents = (attributes = {}, allComponents = {}) => {
|
|
810
849
|
}, {});
|
811
850
|
return componentsByKey;
|
812
851
|
};
|
813
|
-
const
|
852
|
+
const HOOKS = {
|
853
|
+
/**
|
854
|
+
* Hook that allows to mutate the displayed headers of the list view table
|
855
|
+
* @constant
|
856
|
+
* @type {string}
|
857
|
+
*/
|
858
|
+
INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
|
859
|
+
/**
|
860
|
+
* Hook that allows to mutate the CM's collection types links pre-set filters
|
861
|
+
* @constant
|
862
|
+
* @type {string}
|
863
|
+
*/
|
864
|
+
MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
|
865
|
+
/**
|
866
|
+
* Hook that allows to mutate the CM's edit view layout
|
867
|
+
* @constant
|
868
|
+
* @type {string}
|
869
|
+
*/
|
870
|
+
MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
|
871
|
+
/**
|
872
|
+
* Hook that allows to mutate the CM's single types links pre-set filters
|
873
|
+
* @constant
|
874
|
+
* @type {string}
|
875
|
+
*/
|
876
|
+
MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
|
877
|
+
};
|
878
|
+
const contentTypesApi = contentManagerApi.injectEndpoints({
|
879
|
+
endpoints: (builder) => ({
|
880
|
+
getContentTypeConfiguration: builder.query({
|
881
|
+
query: (uid) => ({
|
882
|
+
url: `/content-manager/content-types/${uid}/configuration`,
|
883
|
+
method: "GET"
|
884
|
+
}),
|
885
|
+
transformResponse: (response) => response.data,
|
886
|
+
providesTags: (_result, _error, uid) => [
|
887
|
+
{ type: "ContentTypesConfiguration", id: uid },
|
888
|
+
{ type: "ContentTypeSettings", id: "LIST" }
|
889
|
+
]
|
890
|
+
}),
|
891
|
+
getAllContentTypeSettings: builder.query({
|
892
|
+
query: () => "/content-manager/content-types-settings",
|
893
|
+
transformResponse: (response) => response.data,
|
894
|
+
providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
|
895
|
+
}),
|
896
|
+
updateContentTypeConfiguration: builder.mutation({
|
897
|
+
query: ({ uid, ...body }) => ({
|
898
|
+
url: `/content-manager/content-types/${uid}/configuration`,
|
899
|
+
method: "PUT",
|
900
|
+
data: body
|
901
|
+
}),
|
902
|
+
transformResponse: (response) => response.data,
|
903
|
+
invalidatesTags: (_result, _error, { uid }) => [
|
904
|
+
{ type: "ContentTypesConfiguration", id: uid },
|
905
|
+
{ type: "ContentTypeSettings", id: "LIST" },
|
906
|
+
// Is this necessary?
|
907
|
+
{ type: "InitialData" }
|
908
|
+
]
|
909
|
+
})
|
910
|
+
})
|
911
|
+
});
|
912
|
+
const {
|
913
|
+
useGetContentTypeConfigurationQuery,
|
914
|
+
useGetAllContentTypeSettingsQuery,
|
915
|
+
useUpdateContentTypeConfigurationMutation
|
916
|
+
} = contentTypesApi;
|
917
|
+
const checkIfAttributeIsDisplayable = (attribute) => {
|
918
|
+
const { type } = attribute;
|
919
|
+
if (type === "relation") {
|
920
|
+
return !attribute.relation.toLowerCase().includes("morph");
|
921
|
+
}
|
922
|
+
return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
|
923
|
+
};
|
924
|
+
const getMainField = (attribute, mainFieldName, { schemas, components }) => {
|
925
|
+
if (!mainFieldName) {
|
926
|
+
return void 0;
|
927
|
+
}
|
928
|
+
const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
|
929
|
+
// @ts-expect-error – `targetModel` does exist on the attribute for a relation.
|
930
|
+
schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
|
931
|
+
);
|
932
|
+
return {
|
933
|
+
name: mainFieldName,
|
934
|
+
type: mainFieldType ?? "string"
|
935
|
+
};
|
936
|
+
};
|
937
|
+
const DEFAULT_SETTINGS = {
|
938
|
+
bulkable: false,
|
939
|
+
filterable: false,
|
940
|
+
searchable: false,
|
941
|
+
pagination: false,
|
942
|
+
defaultSortBy: "",
|
943
|
+
defaultSortOrder: "asc",
|
944
|
+
mainField: "id",
|
945
|
+
pageSize: 10
|
946
|
+
};
|
947
|
+
const useDocumentLayout = (model) => {
|
948
|
+
const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
|
949
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
950
|
+
const runHookWaterfall = strapiAdmin.useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
|
814
951
|
const { toggleNotification } = strapiAdmin.useNotification();
|
815
952
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
953
|
+
const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
|
816
954
|
const {
|
817
|
-
|
818
|
-
isLoading:
|
819
|
-
|
820
|
-
|
821
|
-
} =
|
822
|
-
|
823
|
-
skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
|
824
|
-
});
|
825
|
-
const { components, schema, isLoading: isLoadingSchema } = useContentTypeSchema(args.model);
|
955
|
+
data,
|
956
|
+
isLoading: isLoadingConfigs,
|
957
|
+
error,
|
958
|
+
isFetching: isFetchingConfigs
|
959
|
+
} = useGetContentTypeConfigurationQuery(model);
|
960
|
+
const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
|
826
961
|
React__namespace.useEffect(() => {
|
827
962
|
if (error) {
|
828
963
|
toggleNotification({
|
@@ -830,84 +965,339 @@ const useDocument = (args, opts) => {
|
|
830
965
|
message: formatAPIError(error)
|
831
966
|
});
|
832
967
|
}
|
833
|
-
}, [
|
834
|
-
const
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
(document) => {
|
842
|
-
if (!validationSchema) {
|
843
|
-
throw new Error(
|
844
|
-
"There is no validation schema generated, this is likely due to the schema not being loaded yet."
|
845
|
-
);
|
846
|
-
}
|
847
|
-
try {
|
848
|
-
validationSchema.validateSync(document, { abortEarly: false, strict: true });
|
849
|
-
return null;
|
850
|
-
} catch (error2) {
|
851
|
-
if (error2 instanceof yup.ValidationError) {
|
852
|
-
return strapiAdmin.getYupValidationErrors(error2);
|
853
|
-
}
|
854
|
-
throw error2;
|
855
|
-
}
|
968
|
+
}, [error, formatAPIError, toggleNotification]);
|
969
|
+
const editLayout = React__namespace.useMemo(
|
970
|
+
() => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
|
971
|
+
layout: [],
|
972
|
+
components: {},
|
973
|
+
metadatas: {},
|
974
|
+
options: {},
|
975
|
+
settings: DEFAULT_SETTINGS
|
856
976
|
},
|
857
|
-
[
|
977
|
+
[data, isLoading, schemas, schema, components]
|
978
|
+
);
|
979
|
+
const listLayout = React__namespace.useMemo(() => {
|
980
|
+
return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
|
981
|
+
layout: [],
|
982
|
+
metadatas: {},
|
983
|
+
options: {},
|
984
|
+
settings: DEFAULT_SETTINGS
|
985
|
+
};
|
986
|
+
}, [data, isLoading, schemas, schema, components]);
|
987
|
+
const { layout: edit } = React__namespace.useMemo(
|
988
|
+
() => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
|
989
|
+
layout: editLayout,
|
990
|
+
query
|
991
|
+
}),
|
992
|
+
[editLayout, query, runHookWaterfall]
|
858
993
|
);
|
859
|
-
const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
|
860
994
|
return {
|
861
|
-
|
862
|
-
document: data?.data,
|
863
|
-
meta: data?.meta,
|
995
|
+
error,
|
864
996
|
isLoading,
|
865
|
-
|
866
|
-
|
867
|
-
};
|
868
|
-
};
|
869
|
-
const useDoc = () => {
|
870
|
-
const { id, slug, collectionType, origin } = reactRouterDom.useParams();
|
871
|
-
const [{ query }] = strapiAdmin.useQueryParams();
|
872
|
-
const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
|
873
|
-
if (!collectionType) {
|
874
|
-
throw new Error("Could not find collectionType in url params");
|
875
|
-
}
|
876
|
-
if (!slug) {
|
877
|
-
throw new Error("Could not find model in url params");
|
878
|
-
}
|
879
|
-
return {
|
880
|
-
collectionType,
|
881
|
-
model: slug,
|
882
|
-
id: origin || id === "create" ? void 0 : id,
|
883
|
-
...useDocument(
|
884
|
-
{ documentId: origin || id, model: slug, collectionType, params },
|
885
|
-
{
|
886
|
-
skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
|
887
|
-
}
|
888
|
-
)
|
997
|
+
edit,
|
998
|
+
list: listLayout
|
889
999
|
};
|
890
1000
|
};
|
891
|
-
const
|
892
|
-
|
893
|
-
|
894
|
-
}
|
895
|
-
return Object.keys(trad).reduce((acc, current) => {
|
896
|
-
acc[`${pluginId}.${current}`] = trad[current];
|
897
|
-
return acc;
|
898
|
-
}, {});
|
899
|
-
};
|
900
|
-
const getTranslation = (id) => `content-manager.${id}`;
|
901
|
-
const DEFAULT_UNEXPECTED_ERROR_MSG = {
|
902
|
-
id: "notification.error",
|
903
|
-
defaultMessage: "An error occurred, please try again"
|
1001
|
+
const useDocLayout = () => {
|
1002
|
+
const { model } = useDoc();
|
1003
|
+
return useDocumentLayout(model);
|
904
1004
|
};
|
905
|
-
const
|
906
|
-
|
1005
|
+
const formatEditLayout = (data, {
|
1006
|
+
schemas,
|
1007
|
+
schema,
|
1008
|
+
components
|
1009
|
+
}) => {
|
1010
|
+
let currentPanelIndex = 0;
|
1011
|
+
const panelledEditAttributes = convertEditLayoutToFieldLayouts(
|
1012
|
+
data.contentType.layouts.edit,
|
1013
|
+
schema?.attributes,
|
1014
|
+
data.contentType.metadatas,
|
1015
|
+
{ configurations: data.components, schemas: components },
|
1016
|
+
schemas
|
1017
|
+
).reduce((panels, row) => {
|
1018
|
+
if (row.some((field) => field.type === "dynamiczone")) {
|
1019
|
+
panels.push([row]);
|
1020
|
+
currentPanelIndex += 2;
|
1021
|
+
} else {
|
1022
|
+
if (!panels[currentPanelIndex]) {
|
1023
|
+
panels.push([row]);
|
1024
|
+
} else {
|
1025
|
+
panels[currentPanelIndex].push(row);
|
1026
|
+
}
|
1027
|
+
}
|
1028
|
+
return panels;
|
1029
|
+
}, []);
|
1030
|
+
const componentEditAttributes = Object.entries(data.components).reduce(
|
1031
|
+
(acc, [uid, configuration]) => {
|
1032
|
+
acc[uid] = {
|
1033
|
+
layout: convertEditLayoutToFieldLayouts(
|
1034
|
+
configuration.layouts.edit,
|
1035
|
+
components[uid].attributes,
|
1036
|
+
configuration.metadatas,
|
1037
|
+
{ configurations: data.components, schemas: components }
|
1038
|
+
),
|
1039
|
+
settings: {
|
1040
|
+
...configuration.settings,
|
1041
|
+
icon: components[uid].info.icon,
|
1042
|
+
displayName: components[uid].info.displayName
|
1043
|
+
}
|
1044
|
+
};
|
1045
|
+
return acc;
|
1046
|
+
},
|
1047
|
+
{}
|
1048
|
+
);
|
1049
|
+
const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
|
1050
|
+
(acc, [attribute, metadata]) => {
|
1051
|
+
return {
|
1052
|
+
...acc,
|
1053
|
+
[attribute]: metadata.edit
|
1054
|
+
};
|
1055
|
+
},
|
1056
|
+
{}
|
1057
|
+
);
|
1058
|
+
return {
|
1059
|
+
layout: panelledEditAttributes,
|
1060
|
+
components: componentEditAttributes,
|
1061
|
+
metadatas: editMetadatas,
|
1062
|
+
settings: {
|
1063
|
+
...data.contentType.settings,
|
1064
|
+
displayName: schema?.info.displayName
|
1065
|
+
},
|
1066
|
+
options: {
|
1067
|
+
...schema?.options,
|
1068
|
+
...schema?.pluginOptions,
|
1069
|
+
...data.contentType.options
|
1070
|
+
}
|
1071
|
+
};
|
1072
|
+
};
|
1073
|
+
const convertEditLayoutToFieldLayouts = (rows, attributes = {}, metadatas, components, schemas = []) => {
|
1074
|
+
return rows.map(
|
1075
|
+
(row) => row.map((field) => {
|
1076
|
+
const attribute = attributes[field.name];
|
1077
|
+
if (!attribute) {
|
1078
|
+
return null;
|
1079
|
+
}
|
1080
|
+
const { edit: metadata } = metadatas[field.name];
|
1081
|
+
const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
|
1082
|
+
return {
|
1083
|
+
attribute,
|
1084
|
+
disabled: !metadata.editable,
|
1085
|
+
hint: metadata.description,
|
1086
|
+
label: metadata.label ?? "",
|
1087
|
+
name: field.name,
|
1088
|
+
// @ts-expect-error – mainField does exist on the metadata for a relation.
|
1089
|
+
mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
|
1090
|
+
schemas,
|
1091
|
+
components: components?.schemas ?? {}
|
1092
|
+
}),
|
1093
|
+
placeholder: metadata.placeholder ?? "",
|
1094
|
+
required: attribute.required ?? false,
|
1095
|
+
size: field.size,
|
1096
|
+
unique: "unique" in attribute ? attribute.unique : false,
|
1097
|
+
visible: metadata.visible ?? true,
|
1098
|
+
type: attribute.type
|
1099
|
+
};
|
1100
|
+
}).filter((field) => field !== null)
|
1101
|
+
);
|
1102
|
+
};
|
1103
|
+
const formatListLayout = (data, {
|
1104
|
+
schemas,
|
1105
|
+
schema,
|
1106
|
+
components
|
1107
|
+
}) => {
|
1108
|
+
const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
|
1109
|
+
(acc, [attribute, metadata]) => {
|
1110
|
+
return {
|
1111
|
+
...acc,
|
1112
|
+
[attribute]: metadata.list
|
1113
|
+
};
|
1114
|
+
},
|
1115
|
+
{}
|
1116
|
+
);
|
1117
|
+
const listAttributes = convertListLayoutToFieldLayouts(
|
1118
|
+
data.contentType.layouts.list,
|
1119
|
+
schema?.attributes,
|
1120
|
+
listMetadatas,
|
1121
|
+
{ configurations: data.components, schemas: components },
|
1122
|
+
schemas
|
1123
|
+
);
|
1124
|
+
return {
|
1125
|
+
layout: listAttributes,
|
1126
|
+
settings: { ...data.contentType.settings, displayName: schema?.info.displayName },
|
1127
|
+
metadatas: listMetadatas,
|
1128
|
+
options: {
|
1129
|
+
...schema?.options,
|
1130
|
+
...schema?.pluginOptions,
|
1131
|
+
...data.contentType.options
|
1132
|
+
}
|
1133
|
+
};
|
1134
|
+
};
|
1135
|
+
const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, components, schemas = []) => {
|
1136
|
+
return columns.map((name) => {
|
1137
|
+
const attribute = attributes[name];
|
1138
|
+
if (!attribute) {
|
1139
|
+
return null;
|
1140
|
+
}
|
1141
|
+
const metadata = metadatas[name];
|
1142
|
+
const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
|
1143
|
+
return {
|
1144
|
+
attribute,
|
1145
|
+
label: metadata.label ?? "",
|
1146
|
+
mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
|
1147
|
+
schemas,
|
1148
|
+
components: components?.schemas ?? {}
|
1149
|
+
}),
|
1150
|
+
name,
|
1151
|
+
searchable: metadata.searchable ?? true,
|
1152
|
+
sortable: metadata.sortable ?? true
|
1153
|
+
};
|
1154
|
+
}).filter((field) => field !== null);
|
1155
|
+
};
|
1156
|
+
const useDocument = (args, opts) => {
|
1157
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
1158
|
+
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
1159
|
+
const {
|
1160
|
+
currentData: data,
|
1161
|
+
isLoading: isLoadingDocument,
|
1162
|
+
isFetching: isFetchingDocument,
|
1163
|
+
error
|
1164
|
+
} = useGetDocumentQuery(args, {
|
1165
|
+
...opts,
|
1166
|
+
skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
|
1167
|
+
});
|
1168
|
+
const {
|
1169
|
+
components,
|
1170
|
+
schema,
|
1171
|
+
schemas,
|
1172
|
+
isLoading: isLoadingSchema
|
1173
|
+
} = useContentTypeSchema(args.model);
|
1174
|
+
React__namespace.useEffect(() => {
|
1175
|
+
if (error) {
|
1176
|
+
toggleNotification({
|
1177
|
+
type: "danger",
|
1178
|
+
message: formatAPIError(error)
|
1179
|
+
});
|
1180
|
+
}
|
1181
|
+
}, [toggleNotification, error, formatAPIError, args.collectionType]);
|
1182
|
+
const validationSchema = React__namespace.useMemo(() => {
|
1183
|
+
if (!schema) {
|
1184
|
+
return null;
|
1185
|
+
}
|
1186
|
+
return createYupSchema(schema.attributes, components);
|
1187
|
+
}, [schema, components]);
|
1188
|
+
const validate = React__namespace.useCallback(
|
1189
|
+
(document) => {
|
1190
|
+
if (!validationSchema) {
|
1191
|
+
throw new Error(
|
1192
|
+
"There is no validation schema generated, this is likely due to the schema not being loaded yet."
|
1193
|
+
);
|
1194
|
+
}
|
1195
|
+
try {
|
1196
|
+
validationSchema.validateSync(document, { abortEarly: false, strict: true });
|
1197
|
+
return null;
|
1198
|
+
} catch (error2) {
|
1199
|
+
if (error2 instanceof yup.ValidationError) {
|
1200
|
+
return strapiAdmin.getYupValidationErrors(error2);
|
1201
|
+
}
|
1202
|
+
throw error2;
|
1203
|
+
}
|
1204
|
+
},
|
1205
|
+
[validationSchema]
|
1206
|
+
);
|
1207
|
+
const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
|
1208
|
+
const hasError = !!error;
|
1209
|
+
return {
|
1210
|
+
components,
|
1211
|
+
document: data?.data,
|
1212
|
+
meta: data?.meta,
|
1213
|
+
isLoading,
|
1214
|
+
hasError,
|
1215
|
+
schema,
|
1216
|
+
schemas,
|
1217
|
+
validate
|
1218
|
+
};
|
1219
|
+
};
|
1220
|
+
const useDoc = () => {
|
1221
|
+
const { id, slug, collectionType, origin } = reactRouterDom.useParams();
|
1222
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
1223
|
+
const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
|
1224
|
+
if (!collectionType) {
|
1225
|
+
throw new Error("Could not find collectionType in url params");
|
1226
|
+
}
|
1227
|
+
if (!slug) {
|
1228
|
+
throw new Error("Could not find model in url params");
|
1229
|
+
}
|
1230
|
+
const document = useDocument(
|
1231
|
+
{ documentId: origin || id, model: slug, collectionType, params },
|
1232
|
+
{
|
1233
|
+
skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
|
1234
|
+
}
|
1235
|
+
);
|
1236
|
+
const returnId = origin || id === "create" ? void 0 : id;
|
1237
|
+
return {
|
1238
|
+
collectionType,
|
1239
|
+
model: slug,
|
1240
|
+
id: returnId,
|
1241
|
+
...document
|
1242
|
+
};
|
1243
|
+
};
|
1244
|
+
const useContentManagerContext = () => {
|
1245
|
+
const {
|
1246
|
+
collectionType,
|
1247
|
+
model,
|
1248
|
+
id,
|
1249
|
+
components,
|
1250
|
+
isLoading: isLoadingDoc,
|
1251
|
+
schema,
|
1252
|
+
schemas
|
1253
|
+
} = useDoc();
|
1254
|
+
const layout = useDocumentLayout(model);
|
1255
|
+
const form = strapiAdmin.useForm("useContentManagerContext", (state) => state);
|
1256
|
+
const isSingleType = collectionType === SINGLE_TYPES;
|
1257
|
+
const slug = model;
|
1258
|
+
const isCreatingEntry = id === "create";
|
1259
|
+
useContentTypeSchema();
|
1260
|
+
const isLoading = isLoadingDoc || layout.isLoading;
|
1261
|
+
const error = layout.error;
|
1262
|
+
return {
|
1263
|
+
error,
|
1264
|
+
isLoading,
|
1265
|
+
// Base metadata
|
1266
|
+
model,
|
1267
|
+
collectionType,
|
1268
|
+
id,
|
1269
|
+
slug,
|
1270
|
+
isCreatingEntry,
|
1271
|
+
isSingleType,
|
1272
|
+
hasDraftAndPublish: schema?.options?.draftAndPublish ?? false,
|
1273
|
+
// All schema infos
|
1274
|
+
components,
|
1275
|
+
contentType: schema,
|
1276
|
+
contentTypes: schemas,
|
1277
|
+
// Form state
|
1278
|
+
form,
|
1279
|
+
// layout infos
|
1280
|
+
layout
|
1281
|
+
};
|
1282
|
+
};
|
1283
|
+
const prefixPluginTranslations = (trad, pluginId) => {
|
1284
|
+
return Object.keys(trad).reduce((acc, current) => {
|
1285
|
+
acc[`${pluginId}.${current}`] = trad[current];
|
1286
|
+
return acc;
|
1287
|
+
}, {});
|
1288
|
+
};
|
1289
|
+
const getTranslation = (id) => `content-manager.${id}`;
|
1290
|
+
const DEFAULT_UNEXPECTED_ERROR_MSG = {
|
1291
|
+
id: "notification.error",
|
1292
|
+
defaultMessage: "An error occurred, please try again"
|
1293
|
+
};
|
1294
|
+
const useDocumentActions = () => {
|
1295
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
907
1296
|
const { formatMessage } = reactIntl.useIntl();
|
908
1297
|
const { trackUsage } = strapiAdmin.useTracking();
|
909
1298
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
910
1299
|
const navigate = reactRouterDom.useNavigate();
|
1300
|
+
const setCurrentStep = strapiAdmin.useGuidedTour("useDocumentActions", (state) => state.setCurrentStep);
|
911
1301
|
const [deleteDocument] = useDeleteDocumentMutation();
|
912
1302
|
const _delete = React__namespace.useCallback(
|
913
1303
|
async ({ collectionType, model, documentId, params }, trackerProperty) => {
|
@@ -1222,6 +1612,7 @@ const useDocumentActions = () => {
|
|
1222
1612
|
defaultMessage: "Saved document"
|
1223
1613
|
})
|
1224
1614
|
});
|
1615
|
+
setCurrentStep("contentManager.success");
|
1225
1616
|
return res.data;
|
1226
1617
|
} catch (err) {
|
1227
1618
|
toggleNotification({
|
@@ -1323,10 +1714,10 @@ const useDocumentActions = () => {
|
|
1323
1714
|
update
|
1324
1715
|
};
|
1325
1716
|
};
|
1326
|
-
const ProtectedHistoryPage =
|
1327
|
-
() => Promise.resolve().then(() => require("./History-
|
1717
|
+
const ProtectedHistoryPage = React__namespace.lazy(
|
1718
|
+
() => Promise.resolve().then(() => require("./History-wjcK4L0C.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1328
1719
|
);
|
1329
|
-
const routes$
|
1720
|
+
const routes$2 = [
|
1330
1721
|
{
|
1331
1722
|
path: ":collectionType/:slug/:id/history",
|
1332
1723
|
Component: ProtectedHistoryPage
|
@@ -1336,32 +1727,45 @@ const routes$1 = [
|
|
1336
1727
|
Component: ProtectedHistoryPage
|
1337
1728
|
}
|
1338
1729
|
];
|
1339
|
-
const
|
1340
|
-
() => Promise.resolve().then(() => require("./
|
1730
|
+
const ProtectedPreviewPage = React__namespace.lazy(
|
1731
|
+
() => Promise.resolve().then(() => require("./Preview-DaOihysv.js")).then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1341
1732
|
);
|
1342
|
-
const
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1733
|
+
const routes$1 = [
|
1734
|
+
{
|
1735
|
+
path: ":collectionType/:slug/:id/preview",
|
1736
|
+
Component: ProtectedPreviewPage
|
1737
|
+
},
|
1738
|
+
{
|
1739
|
+
path: ":collectionType/:slug/preview",
|
1740
|
+
Component: ProtectedPreviewPage
|
1741
|
+
}
|
1742
|
+
];
|
1743
|
+
const ProtectedEditViewPage = React.lazy(
|
1744
|
+
() => Promise.resolve().then(() => require("./EditViewPage-B-kExt8C.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1745
|
+
);
|
1746
|
+
const ProtectedListViewPage = React.lazy(
|
1747
|
+
() => Promise.resolve().then(() => require("./ListViewPage-D5NY9183.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1748
|
+
);
|
1749
|
+
const ProtectedListConfiguration = React.lazy(
|
1750
|
+
() => Promise.resolve().then(() => require("./ListConfigurationPage-CRbxIC3J.js")).then((mod) => ({
|
1751
|
+
default: mod.ProtectedListConfiguration
|
1348
1752
|
}))
|
1349
1753
|
);
|
1350
1754
|
const ProtectedEditConfigurationPage = React.lazy(
|
1351
|
-
() => Promise.resolve().then(() => require("./EditConfigurationPage-
|
1755
|
+
() => Promise.resolve().then(() => require("./EditConfigurationPage-RQkymxCy.js")).then((mod) => ({
|
1352
1756
|
default: mod.ProtectedEditConfigurationPage
|
1353
1757
|
}))
|
1354
1758
|
);
|
1355
1759
|
const ProtectedComponentConfigurationPage = React.lazy(
|
1356
|
-
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-
|
1760
|
+
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-BLWQy8ru.js")).then((mod) => ({
|
1357
1761
|
default: mod.ProtectedComponentConfigurationPage
|
1358
1762
|
}))
|
1359
1763
|
);
|
1360
1764
|
const NoPermissions = React.lazy(
|
1361
|
-
() => Promise.resolve().then(() => require("./NoPermissionsPage-
|
1765
|
+
() => Promise.resolve().then(() => require("./NoPermissionsPage-C5jwn70o.js")).then((mod) => ({ default: mod.NoPermissions }))
|
1362
1766
|
);
|
1363
1767
|
const NoContentType = React.lazy(
|
1364
|
-
() => Promise.resolve().then(() => require("./NoContentTypePage-
|
1768
|
+
() => Promise.resolve().then(() => require("./NoContentTypePage-BgQVE_Qb.js")).then((mod) => ({ default: mod.NoContentType }))
|
1365
1769
|
);
|
1366
1770
|
const CollectionTypePages = () => {
|
1367
1771
|
const { collectionType } = reactRouterDom.useParams();
|
@@ -1373,7 +1777,7 @@ const CollectionTypePages = () => {
|
|
1373
1777
|
const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
|
1374
1778
|
const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
|
1375
1779
|
const LIST_RELATIVE_PATH = ":collectionType/:slug";
|
1376
|
-
const LIST_PATH = `/content-manager
|
1780
|
+
const LIST_PATH = `/content-manager/collection-types/:slug`;
|
1377
1781
|
const routes = [
|
1378
1782
|
{
|
1379
1783
|
path: LIST_RELATIVE_PATH,
|
@@ -1407,6 +1811,7 @@ const routes = [
|
|
1407
1811
|
path: "no-content-types",
|
1408
1812
|
Component: NoContentType
|
1409
1813
|
},
|
1814
|
+
...routes$2,
|
1410
1815
|
...routes$1
|
1411
1816
|
];
|
1412
1817
|
const DocumentActions = ({ actions: actions2 }) => {
|
@@ -1505,6 +1910,11 @@ const DocumentActionButton = (action) => {
|
|
1505
1910
|
) : null
|
1506
1911
|
] });
|
1507
1912
|
};
|
1913
|
+
const MenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
1914
|
+
&:hover {
|
1915
|
+
background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
|
1916
|
+
}
|
1917
|
+
`;
|
1508
1918
|
const DocumentActionsMenu = ({
|
1509
1919
|
actions: actions2,
|
1510
1920
|
children,
|
@@ -1560,51 +1970,35 @@ const DocumentActionsMenu = ({
|
|
1560
1970
|
]
|
1561
1971
|
}
|
1562
1972
|
),
|
1563
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, {
|
1973
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1564
1974
|
actions2.map((action) => {
|
1565
1975
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
1566
|
-
|
1976
|
+
MenuItem,
|
1567
1977
|
{
|
1568
1978
|
disabled: action.disabled,
|
1569
1979
|
onSelect: handleClick(action),
|
1570
1980
|
display: "block",
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
designSystem.Flex,
|
1593
|
-
{
|
1594
|
-
alignItems: "center",
|
1595
|
-
background: "alternative100",
|
1596
|
-
borderStyle: "solid",
|
1597
|
-
borderColor: "alternative200",
|
1598
|
-
borderWidth: "1px",
|
1599
|
-
height: 5,
|
1600
|
-
paddingLeft: 2,
|
1601
|
-
paddingRight: 2,
|
1602
|
-
hasRadius: true,
|
1603
|
-
color: "alternative600",
|
1604
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", fontWeight: "bold", lineHeight: 1, children: formatMessage({ id: "global.new", defaultMessage: "New" }) })
|
1605
|
-
}
|
1606
|
-
)
|
1607
|
-
] })
|
1981
|
+
isVariantDanger: action.variant === "danger",
|
1982
|
+
isDisabled: action.disabled,
|
1983
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
1984
|
+
designSystem.Flex,
|
1985
|
+
{
|
1986
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1987
|
+
gap: 2,
|
1988
|
+
tag: "span",
|
1989
|
+
children: [
|
1990
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
1991
|
+
designSystem.Flex,
|
1992
|
+
{
|
1993
|
+
tag: "span",
|
1994
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1995
|
+
children: action.icon
|
1996
|
+
}
|
1997
|
+
),
|
1998
|
+
action.label
|
1999
|
+
]
|
2000
|
+
}
|
2001
|
+
) })
|
1608
2002
|
},
|
1609
2003
|
action.id
|
1610
2004
|
);
|
@@ -1684,11 +2078,11 @@ const DocumentActionConfirmDialog = ({
|
|
1684
2078
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
|
1685
2079
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: content }),
|
1686
2080
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
|
1687
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", children: formatMessage({
|
2081
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", fullWidth: true, children: formatMessage({
|
1688
2082
|
id: "app.components.Button.cancel",
|
1689
2083
|
defaultMessage: "Cancel"
|
1690
2084
|
}) }) }),
|
1691
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleConfirm, variant, children: formatMessage({
|
2085
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleConfirm, variant, fullWidth: true, children: formatMessage({
|
1692
2086
|
id: "app.components.Button.confirm",
|
1693
2087
|
defaultMessage: "Confirm"
|
1694
2088
|
}) })
|
@@ -1715,6 +2109,18 @@ const DocumentActionModal = ({
|
|
1715
2109
|
typeof Footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { onClose: handleClose }) : Footer
|
1716
2110
|
] }) });
|
1717
2111
|
};
|
2112
|
+
const transformData = (data) => {
|
2113
|
+
if (Array.isArray(data)) {
|
2114
|
+
return data.map(transformData);
|
2115
|
+
}
|
2116
|
+
if (typeof data === "object" && data !== null) {
|
2117
|
+
if ("apiData" in data) {
|
2118
|
+
return data.apiData;
|
2119
|
+
}
|
2120
|
+
return mapValues__default.default(transformData)(data);
|
2121
|
+
}
|
2122
|
+
return data;
|
2123
|
+
};
|
1718
2124
|
const PublishAction$1 = ({
|
1719
2125
|
activeTab,
|
1720
2126
|
documentId,
|
@@ -1729,6 +2135,7 @@ const PublishAction$1 = ({
|
|
1729
2135
|
const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
|
1730
2136
|
const isListView = reactRouterDom.useMatch(LIST_PATH) !== null;
|
1731
2137
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2138
|
+
const { id } = reactRouterDom.useParams();
|
1732
2139
|
const { formatMessage } = reactIntl.useIntl();
|
1733
2140
|
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
1734
2141
|
const { publish } = useDocumentActions();
|
@@ -1782,24 +2189,25 @@ const PublishAction$1 = ({
|
|
1782
2189
|
}
|
1783
2190
|
}, [documentId, modified, formValues, setLocalCountOfDraftRelations]);
|
1784
2191
|
React__namespace.useEffect(() => {
|
1785
|
-
if (documentId
|
1786
|
-
|
1787
|
-
const { data, error } = await countDraftRelations({
|
1788
|
-
collectionType,
|
1789
|
-
model,
|
1790
|
-
documentId,
|
1791
|
-
params
|
1792
|
-
});
|
1793
|
-
if (error) {
|
1794
|
-
throw error;
|
1795
|
-
}
|
1796
|
-
if (data) {
|
1797
|
-
setServerCountOfDraftRelations(data.data);
|
1798
|
-
}
|
1799
|
-
};
|
1800
|
-
fetchDraftRelationsCount();
|
2192
|
+
if (!document || !document.documentId || isListView) {
|
2193
|
+
return;
|
1801
2194
|
}
|
1802
|
-
|
2195
|
+
const fetchDraftRelationsCount = async () => {
|
2196
|
+
const { data, error } = await countDraftRelations({
|
2197
|
+
collectionType,
|
2198
|
+
model,
|
2199
|
+
documentId,
|
2200
|
+
params
|
2201
|
+
});
|
2202
|
+
if (error) {
|
2203
|
+
throw error;
|
2204
|
+
}
|
2205
|
+
if (data) {
|
2206
|
+
setServerCountOfDraftRelations(data.data);
|
2207
|
+
}
|
2208
|
+
};
|
2209
|
+
fetchDraftRelationsCount();
|
2210
|
+
}, [isListView, document, documentId, countDraftRelations, collectionType, model, params]);
|
1803
2211
|
const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
|
1804
2212
|
if (!schema?.options?.draftAndPublish) {
|
1805
2213
|
return null;
|
@@ -1807,7 +2215,9 @@ const PublishAction$1 = ({
|
|
1807
2215
|
const performPublish = async () => {
|
1808
2216
|
setSubmitting(true);
|
1809
2217
|
try {
|
1810
|
-
const { errors } = await validate(
|
2218
|
+
const { errors } = await validate(true, {
|
2219
|
+
status: "published"
|
2220
|
+
});
|
1811
2221
|
if (errors) {
|
1812
2222
|
toggleNotification({
|
1813
2223
|
type: "danger",
|
@@ -1825,13 +2235,15 @@ const PublishAction$1 = ({
|
|
1825
2235
|
documentId,
|
1826
2236
|
params
|
1827
2237
|
},
|
1828
|
-
formValues
|
2238
|
+
transformData(formValues)
|
1829
2239
|
);
|
1830
2240
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
2241
|
+
if (id === "create") {
|
2242
|
+
navigate({
|
2243
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2244
|
+
search: rawQuery
|
2245
|
+
});
|
2246
|
+
}
|
1835
2247
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1836
2248
|
setErrors(formatValidationErrors(res.error));
|
1837
2249
|
}
|
@@ -1884,6 +2296,7 @@ const PublishAction$1 = ({
|
|
1884
2296
|
};
|
1885
2297
|
};
|
1886
2298
|
PublishAction$1.type = "publish";
|
2299
|
+
PublishAction$1.position = "panel";
|
1887
2300
|
const UpdateAction = ({
|
1888
2301
|
activeTab,
|
1889
2302
|
documentId,
|
@@ -1906,6 +2319,117 @@ const UpdateAction = ({
|
|
1906
2319
|
const validate = strapiAdmin.useForm("UpdateAction", (state) => state.validate);
|
1907
2320
|
const setErrors = strapiAdmin.useForm("UpdateAction", (state) => state.setErrors);
|
1908
2321
|
const resetForm = strapiAdmin.useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
|
2322
|
+
const handleUpdate = React__namespace.useCallback(async () => {
|
2323
|
+
setSubmitting(true);
|
2324
|
+
try {
|
2325
|
+
if (!modified) {
|
2326
|
+
return;
|
2327
|
+
}
|
2328
|
+
const { errors } = await validate(true, {
|
2329
|
+
status: "draft"
|
2330
|
+
});
|
2331
|
+
if (errors) {
|
2332
|
+
toggleNotification({
|
2333
|
+
type: "danger",
|
2334
|
+
message: formatMessage({
|
2335
|
+
id: "content-manager.validation.error",
|
2336
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2337
|
+
})
|
2338
|
+
});
|
2339
|
+
return;
|
2340
|
+
}
|
2341
|
+
if (isCloning) {
|
2342
|
+
const res = await clone(
|
2343
|
+
{
|
2344
|
+
model,
|
2345
|
+
documentId: cloneMatch.params.origin,
|
2346
|
+
params
|
2347
|
+
},
|
2348
|
+
transformData(document)
|
2349
|
+
);
|
2350
|
+
if ("data" in res) {
|
2351
|
+
navigate(
|
2352
|
+
{
|
2353
|
+
pathname: `../${res.data.documentId}`,
|
2354
|
+
search: rawQuery
|
2355
|
+
},
|
2356
|
+
{ relative: "path" }
|
2357
|
+
);
|
2358
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2359
|
+
setErrors(formatValidationErrors(res.error));
|
2360
|
+
}
|
2361
|
+
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2362
|
+
const res = await update(
|
2363
|
+
{
|
2364
|
+
collectionType,
|
2365
|
+
model,
|
2366
|
+
documentId,
|
2367
|
+
params
|
2368
|
+
},
|
2369
|
+
transformData(document)
|
2370
|
+
);
|
2371
|
+
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2372
|
+
setErrors(formatValidationErrors(res.error));
|
2373
|
+
} else {
|
2374
|
+
resetForm();
|
2375
|
+
}
|
2376
|
+
} else {
|
2377
|
+
const res = await create(
|
2378
|
+
{
|
2379
|
+
model,
|
2380
|
+
params
|
2381
|
+
},
|
2382
|
+
transformData(document)
|
2383
|
+
);
|
2384
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2385
|
+
navigate(
|
2386
|
+
{
|
2387
|
+
pathname: `../${res.data.documentId}`,
|
2388
|
+
search: rawQuery
|
2389
|
+
},
|
2390
|
+
{ replace: true, relative: "path" }
|
2391
|
+
);
|
2392
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2393
|
+
setErrors(formatValidationErrors(res.error));
|
2394
|
+
}
|
2395
|
+
}
|
2396
|
+
} finally {
|
2397
|
+
setSubmitting(false);
|
2398
|
+
}
|
2399
|
+
}, [
|
2400
|
+
clone,
|
2401
|
+
cloneMatch?.params.origin,
|
2402
|
+
collectionType,
|
2403
|
+
create,
|
2404
|
+
document,
|
2405
|
+
documentId,
|
2406
|
+
formatMessage,
|
2407
|
+
formatValidationErrors,
|
2408
|
+
isCloning,
|
2409
|
+
model,
|
2410
|
+
modified,
|
2411
|
+
navigate,
|
2412
|
+
params,
|
2413
|
+
rawQuery,
|
2414
|
+
resetForm,
|
2415
|
+
setErrors,
|
2416
|
+
setSubmitting,
|
2417
|
+
toggleNotification,
|
2418
|
+
update,
|
2419
|
+
validate
|
2420
|
+
]);
|
2421
|
+
React__namespace.useEffect(() => {
|
2422
|
+
const handleKeyDown = (e) => {
|
2423
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
2424
|
+
e.preventDefault();
|
2425
|
+
handleUpdate();
|
2426
|
+
}
|
2427
|
+
};
|
2428
|
+
window.addEventListener("keydown", handleKeyDown);
|
2429
|
+
return () => {
|
2430
|
+
window.removeEventListener("keydown", handleKeyDown);
|
2431
|
+
};
|
2432
|
+
}, [handleUpdate]);
|
1909
2433
|
return {
|
1910
2434
|
/**
|
1911
2435
|
* Disabled when:
|
@@ -1915,87 +2439,14 @@ const UpdateAction = ({
|
|
1915
2439
|
*/
|
1916
2440
|
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
1917
2441
|
label: formatMessage({
|
1918
|
-
id: "
|
2442
|
+
id: "global.save",
|
1919
2443
|
defaultMessage: "Save"
|
1920
2444
|
}),
|
1921
|
-
onClick:
|
1922
|
-
setSubmitting(true);
|
1923
|
-
try {
|
1924
|
-
if (activeTab !== "draft") {
|
1925
|
-
const { errors } = await validate();
|
1926
|
-
if (errors) {
|
1927
|
-
toggleNotification({
|
1928
|
-
type: "danger",
|
1929
|
-
message: formatMessage({
|
1930
|
-
id: "content-manager.validation.error",
|
1931
|
-
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
1932
|
-
})
|
1933
|
-
});
|
1934
|
-
return;
|
1935
|
-
}
|
1936
|
-
}
|
1937
|
-
if (isCloning) {
|
1938
|
-
const res = await clone(
|
1939
|
-
{
|
1940
|
-
model,
|
1941
|
-
documentId: cloneMatch.params.origin,
|
1942
|
-
params
|
1943
|
-
},
|
1944
|
-
document
|
1945
|
-
);
|
1946
|
-
if ("data" in res) {
|
1947
|
-
navigate(
|
1948
|
-
{
|
1949
|
-
pathname: `../${res.data.documentId}`,
|
1950
|
-
search: rawQuery
|
1951
|
-
},
|
1952
|
-
{ relative: "path" }
|
1953
|
-
);
|
1954
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1955
|
-
setErrors(formatValidationErrors(res.error));
|
1956
|
-
}
|
1957
|
-
} else if (documentId || collectionType === SINGLE_TYPES) {
|
1958
|
-
const res = await update(
|
1959
|
-
{
|
1960
|
-
collectionType,
|
1961
|
-
model,
|
1962
|
-
documentId,
|
1963
|
-
params
|
1964
|
-
},
|
1965
|
-
document
|
1966
|
-
);
|
1967
|
-
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1968
|
-
setErrors(formatValidationErrors(res.error));
|
1969
|
-
} else {
|
1970
|
-
resetForm();
|
1971
|
-
}
|
1972
|
-
} else {
|
1973
|
-
const res = await create(
|
1974
|
-
{
|
1975
|
-
model,
|
1976
|
-
params
|
1977
|
-
},
|
1978
|
-
document
|
1979
|
-
);
|
1980
|
-
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1981
|
-
navigate(
|
1982
|
-
{
|
1983
|
-
pathname: `../${res.data.documentId}`,
|
1984
|
-
search: rawQuery
|
1985
|
-
},
|
1986
|
-
{ replace: true, relative: "path" }
|
1987
|
-
);
|
1988
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1989
|
-
setErrors(formatValidationErrors(res.error));
|
1990
|
-
}
|
1991
|
-
}
|
1992
|
-
} finally {
|
1993
|
-
setSubmitting(false);
|
1994
|
-
}
|
1995
|
-
}
|
2445
|
+
onClick: handleUpdate
|
1996
2446
|
};
|
1997
2447
|
};
|
1998
2448
|
UpdateAction.type = "update";
|
2449
|
+
UpdateAction.position = "panel";
|
1999
2450
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
2000
2451
|
KEEP: "keep",
|
2001
2452
|
DISCARD: "discard"
|
@@ -2028,7 +2479,7 @@ const UnpublishAction$1 = ({
|
|
2028
2479
|
id: "app.utils.unpublish",
|
2029
2480
|
defaultMessage: "Unpublish"
|
2030
2481
|
}),
|
2031
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
2482
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Cross, {}),
|
2032
2483
|
onClick: async () => {
|
2033
2484
|
if (!documentId && collectionType !== SINGLE_TYPES || isDocumentModified) {
|
2034
2485
|
if (!documentId) {
|
@@ -2118,6 +2569,7 @@ const UnpublishAction$1 = ({
|
|
2118
2569
|
};
|
2119
2570
|
};
|
2120
2571
|
UnpublishAction$1.type = "unpublish";
|
2572
|
+
UnpublishAction$1.position = "panel";
|
2121
2573
|
const DiscardAction = ({
|
2122
2574
|
activeTab,
|
2123
2575
|
documentId,
|
@@ -2140,7 +2592,7 @@ const DiscardAction = ({
|
|
2140
2592
|
id: "content-manager.actions.discard.label",
|
2141
2593
|
defaultMessage: "Discard changes"
|
2142
2594
|
}),
|
2143
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
2595
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Cross, {}),
|
2144
2596
|
position: ["panel", "table-row"],
|
2145
2597
|
variant: "danger",
|
2146
2598
|
dialog: {
|
@@ -2168,11 +2620,7 @@ const DiscardAction = ({
|
|
2168
2620
|
};
|
2169
2621
|
};
|
2170
2622
|
DiscardAction.type = "discard";
|
2171
|
-
|
2172
|
-
path {
|
2173
|
-
fill: currentColor;
|
2174
|
-
}
|
2175
|
-
`;
|
2623
|
+
DiscardAction.position = "panel";
|
2176
2624
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2177
2625
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2178
2626
|
const RelativeTime = React__namespace.forwardRef(
|
@@ -2185,7 +2633,7 @@ const RelativeTime = React__namespace.forwardRef(
|
|
2185
2633
|
});
|
2186
2634
|
const unit = intervals.find((intervalUnit) => {
|
2187
2635
|
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
2188
|
-
});
|
2636
|
+
}) ?? "seconds";
|
2189
2637
|
const relativeTime = dateFns.isPast(timestamp) ? -interval[unit] : interval[unit];
|
2190
2638
|
const customInterval = customIntervals.find(
|
2191
2639
|
(custom) => interval[custom.unit] < custom.threshold
|
@@ -2219,19 +2667,29 @@ const getDisplayName = ({
|
|
2219
2667
|
return email ?? "";
|
2220
2668
|
};
|
2221
2669
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2222
|
-
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2223
|
-
const statusVariant = status === "draft" ? "
|
2224
|
-
|
2670
|
+
const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
|
2671
|
+
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2672
|
+
const { formatMessage } = reactIntl.useIntl();
|
2673
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps, size, variant: statusVariant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
|
2674
|
+
id: `content-manager.containers.List.${status}`,
|
2675
|
+
defaultMessage: capitalise(status)
|
2676
|
+
}) }) });
|
2225
2677
|
};
|
2226
2678
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2227
2679
|
const { formatMessage } = reactIntl.useIntl();
|
2228
2680
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2681
|
+
const params = reactRouterDom.useParams();
|
2229
2682
|
const title = isCreating ? formatMessage({
|
2230
2683
|
id: "content-manager.containers.edit.title.new",
|
2231
2684
|
defaultMessage: "Create an entry"
|
2232
2685
|
}) : documentTitle;
|
2233
2686
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2234
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
2687
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
2688
|
+
strapiAdmin.BackButton,
|
2689
|
+
{
|
2690
|
+
fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
|
2691
|
+
}
|
2692
|
+
),
|
2235
2693
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2236
2694
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
|
2237
2695
|
/* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
|
@@ -2282,7 +2740,7 @@ const HeaderToolbar = () => {
|
|
2282
2740
|
meta: isCloning ? void 0 : meta,
|
2283
2741
|
collectionType
|
2284
2742
|
},
|
2285
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2743
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2286
2744
|
children: (actions2) => {
|
2287
2745
|
const headerActions = actions2.filter((action) => {
|
2288
2746
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2319,12 +2777,12 @@ const Information = ({ activeTab }) => {
|
|
2319
2777
|
isDisplayed: !!publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME],
|
2320
2778
|
label: formatMessage({
|
2321
2779
|
id: "content-manager.containers.edit.information.last-published.label",
|
2322
|
-
defaultMessage: "
|
2780
|
+
defaultMessage: "Published"
|
2323
2781
|
}),
|
2324
2782
|
value: formatMessage(
|
2325
2783
|
{
|
2326
2784
|
id: "content-manager.containers.edit.information.last-published.value",
|
2327
|
-
defaultMessage: `
|
2785
|
+
defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
|
2328
2786
|
},
|
2329
2787
|
{
|
2330
2788
|
time: /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME]) }),
|
@@ -2337,12 +2795,12 @@ const Information = ({ activeTab }) => {
|
|
2337
2795
|
isDisplayed: !!createAndUpdateDocument?.[UPDATED_AT_ATTRIBUTE_NAME],
|
2338
2796
|
label: formatMessage({
|
2339
2797
|
id: "content-manager.containers.edit.information.last-draft.label",
|
2340
|
-
defaultMessage: "
|
2798
|
+
defaultMessage: "Updated"
|
2341
2799
|
}),
|
2342
2800
|
value: formatMessage(
|
2343
2801
|
{
|
2344
2802
|
id: "content-manager.containers.edit.information.last-draft.value",
|
2345
|
-
defaultMessage: `
|
2803
|
+
defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
|
2346
2804
|
},
|
2347
2805
|
{
|
2348
2806
|
time: /* @__PURE__ */ jsxRuntime.jsx(
|
@@ -2360,12 +2818,12 @@ const Information = ({ activeTab }) => {
|
|
2360
2818
|
isDisplayed: !!createAndUpdateDocument?.[CREATED_AT_ATTRIBUTE_NAME],
|
2361
2819
|
label: formatMessage({
|
2362
2820
|
id: "content-manager.containers.edit.information.document.label",
|
2363
|
-
defaultMessage: "
|
2821
|
+
defaultMessage: "Created"
|
2364
2822
|
}),
|
2365
2823
|
value: formatMessage(
|
2366
2824
|
{
|
2367
2825
|
id: "content-manager.containers.edit.information.document.value",
|
2368
|
-
defaultMessage: `
|
2826
|
+
defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
|
2369
2827
|
},
|
2370
2828
|
{
|
2371
2829
|
time: /* @__PURE__ */ jsxRuntime.jsx(
|
@@ -2403,25 +2861,77 @@ const Information = ({ activeTab }) => {
|
|
2403
2861
|
);
|
2404
2862
|
};
|
2405
2863
|
const HeaderActions = ({ actions: actions2 }) => {
|
2406
|
-
|
2407
|
-
|
2864
|
+
const [dialogId, setDialogId] = React__namespace.useState(null);
|
2865
|
+
const handleClick = (action) => async (e) => {
|
2866
|
+
if (!("options" in action)) {
|
2867
|
+
const { onClick = () => false, dialog, id } = action;
|
2868
|
+
const muteDialog = await onClick(e);
|
2869
|
+
if (dialog && !muteDialog) {
|
2870
|
+
e.preventDefault();
|
2871
|
+
setDialogId(id);
|
2872
|
+
}
|
2873
|
+
}
|
2874
|
+
};
|
2875
|
+
const handleClose = () => {
|
2876
|
+
setDialogId(null);
|
2877
|
+
};
|
2878
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 1, children: actions2.map((action) => {
|
2879
|
+
if (action.options) {
|
2408
2880
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
2409
2881
|
designSystem.SingleSelect,
|
2410
2882
|
{
|
2411
2883
|
size: "S",
|
2412
|
-
disabled: action.disabled,
|
2413
|
-
"aria-label": action.label,
|
2414
2884
|
onChange: action.onSelect,
|
2415
|
-
|
2885
|
+
"aria-label": action.label,
|
2886
|
+
...action,
|
2416
2887
|
children: action.options.map(({ label, ...option }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { ...option, children: label }, option.value))
|
2417
2888
|
},
|
2418
2889
|
action.id
|
2419
2890
|
);
|
2420
2891
|
} else {
|
2421
|
-
|
2892
|
+
if (action.type === "icon") {
|
2893
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React__namespace.Fragment, { children: [
|
2894
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
2895
|
+
designSystem.IconButton,
|
2896
|
+
{
|
2897
|
+
disabled: action.disabled,
|
2898
|
+
label: action.label,
|
2899
|
+
size: "S",
|
2900
|
+
onClick: handleClick(action),
|
2901
|
+
children: action.icon
|
2902
|
+
}
|
2903
|
+
),
|
2904
|
+
action.dialog ? /* @__PURE__ */ jsxRuntime.jsx(
|
2905
|
+
HeaderActionDialog,
|
2906
|
+
{
|
2907
|
+
...action.dialog,
|
2908
|
+
isOpen: dialogId === action.id,
|
2909
|
+
onClose: handleClose
|
2910
|
+
}
|
2911
|
+
) : null
|
2912
|
+
] }, action.id);
|
2913
|
+
}
|
2422
2914
|
}
|
2423
2915
|
}) });
|
2424
2916
|
};
|
2917
|
+
const HeaderActionDialog = ({
|
2918
|
+
onClose,
|
2919
|
+
onCancel,
|
2920
|
+
title,
|
2921
|
+
content: Content,
|
2922
|
+
isOpen
|
2923
|
+
}) => {
|
2924
|
+
const handleClose = async () => {
|
2925
|
+
if (onCancel) {
|
2926
|
+
await onCancel();
|
2927
|
+
}
|
2928
|
+
onClose();
|
2929
|
+
};
|
2930
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
|
2931
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
|
2932
|
+
typeof Content === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Content, { onClose: handleClose }) : Content
|
2933
|
+
] }) });
|
2934
|
+
};
|
2425
2935
|
const ConfigureTheViewAction = ({ collectionType, model }) => {
|
2426
2936
|
const navigate = reactRouterDom.useNavigate();
|
2427
2937
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2438,6 +2948,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2438
2948
|
};
|
2439
2949
|
};
|
2440
2950
|
ConfigureTheViewAction.type = "configure-the-view";
|
2951
|
+
ConfigureTheViewAction.position = "header";
|
2441
2952
|
const EditTheModelAction = ({ model }) => {
|
2442
2953
|
const navigate = reactRouterDom.useNavigate();
|
2443
2954
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2454,6 +2965,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2454
2965
|
};
|
2455
2966
|
};
|
2456
2967
|
EditTheModelAction.type = "edit-the-model";
|
2968
|
+
EditTheModelAction.position = "header";
|
2457
2969
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2458
2970
|
const navigate = reactRouterDom.useNavigate();
|
2459
2971
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2462,12 +2974,16 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2462
2974
|
const { delete: deleteAction } = useDocumentActions();
|
2463
2975
|
const { toggleNotification } = strapiAdmin.useNotification();
|
2464
2976
|
const setSubmitting = strapiAdmin.useForm("DeleteAction", (state) => state.setSubmitting);
|
2977
|
+
const isLocalized = document?.locale != null;
|
2465
2978
|
return {
|
2466
2979
|
disabled: !canDelete || !document,
|
2467
|
-
label: formatMessage(
|
2468
|
-
|
2469
|
-
|
2470
|
-
|
2980
|
+
label: formatMessage(
|
2981
|
+
{
|
2982
|
+
id: "content-manager.actions.delete.label",
|
2983
|
+
defaultMessage: "Delete entry{isLocalized, select, true { (all locales)} other {}}"
|
2984
|
+
},
|
2985
|
+
{ isLocalized }
|
2986
|
+
),
|
2471
2987
|
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {}),
|
2472
2988
|
dialog: {
|
2473
2989
|
type: "dialog",
|
@@ -2505,421 +3021,120 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2505
3021
|
model,
|
2506
3022
|
collectionType,
|
2507
3023
|
params: {
|
2508
|
-
locale: "*"
|
2509
|
-
}
|
2510
|
-
});
|
2511
|
-
if (!("error" in res)) {
|
2512
|
-
navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });
|
2513
|
-
}
|
2514
|
-
} finally {
|
2515
|
-
if (!listViewPathMatch) {
|
2516
|
-
setSubmitting(false);
|
2517
|
-
}
|
2518
|
-
}
|
2519
|
-
}
|
2520
|
-
},
|
2521
|
-
variant: "danger",
|
2522
|
-
position: ["header", "table-row"]
|
2523
|
-
};
|
2524
|
-
};
|
2525
|
-
DeleteAction$1.type = "delete";
|
2526
|
-
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2527
|
-
const Panels = () => {
|
2528
|
-
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2529
|
-
const [
|
2530
|
-
{
|
2531
|
-
query: { status }
|
2532
|
-
}
|
2533
|
-
] = strapiAdmin.useQueryParams({
|
2534
|
-
status: "draft"
|
2535
|
-
});
|
2536
|
-
const { model, id, document, meta, collectionType } = useDoc();
|
2537
|
-
const plugins = strapiAdmin.useStrapiApp("Panels", (state) => state.plugins);
|
2538
|
-
const props = {
|
2539
|
-
activeTab: status,
|
2540
|
-
model,
|
2541
|
-
documentId: id,
|
2542
|
-
document: isCloning ? void 0 : document,
|
2543
|
-
meta: isCloning ? void 0 : meta,
|
2544
|
-
collectionType
|
2545
|
-
};
|
2546
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
2547
|
-
strapiAdmin.DescriptionComponentRenderer,
|
2548
|
-
{
|
2549
|
-
props,
|
2550
|
-
descriptions: plugins["content-manager"].apis.getEditViewSidePanels(),
|
2551
|
-
children: (panels) => panels.map(({ content, id: id2, ...description }) => /* @__PURE__ */ jsxRuntime.jsx(Panel, { ...description, children: content }, id2))
|
2552
|
-
}
|
2553
|
-
) });
|
2554
|
-
};
|
2555
|
-
const ActionsPanel = () => {
|
2556
|
-
const { formatMessage } = reactIntl.useIntl();
|
2557
|
-
return {
|
2558
|
-
title: formatMessage({
|
2559
|
-
id: "content-manager.containers.edit.panels.default.title",
|
2560
|
-
defaultMessage: "Document"
|
2561
|
-
}),
|
2562
|
-
content: /* @__PURE__ */ jsxRuntime.jsx(ActionsPanelContent, {})
|
2563
|
-
};
|
2564
|
-
};
|
2565
|
-
ActionsPanel.type = "actions";
|
2566
|
-
const ActionsPanelContent = () => {
|
2567
|
-
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2568
|
-
const [
|
2569
|
-
{
|
2570
|
-
query: { status = "draft" }
|
2571
|
-
}
|
2572
|
-
] = strapiAdmin.useQueryParams();
|
2573
|
-
const { model, id, document, meta, collectionType } = useDoc();
|
2574
|
-
const plugins = strapiAdmin.useStrapiApp("ActionsPanel", (state) => state.plugins);
|
2575
|
-
const props = {
|
2576
|
-
activeTab: status,
|
2577
|
-
model,
|
2578
|
-
documentId: id,
|
2579
|
-
document: isCloning ? void 0 : document,
|
2580
|
-
meta: isCloning ? void 0 : meta,
|
2581
|
-
collectionType
|
2582
|
-
};
|
2583
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, width: "100%", children: [
|
2584
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
2585
|
-
strapiAdmin.DescriptionComponentRenderer,
|
2586
|
-
{
|
2587
|
-
props,
|
2588
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2589
|
-
children: (actions2) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActions, { actions: actions2 })
|
2590
|
-
}
|
2591
|
-
),
|
2592
|
-
/* @__PURE__ */ jsxRuntime.jsx(InjectionZone, { area: "editView.right-links", slug: model })
|
2593
|
-
] });
|
2594
|
-
};
|
2595
|
-
const Panel = React__namespace.forwardRef(({ children, title }, ref) => {
|
2596
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
2597
|
-
designSystem.Flex,
|
2598
|
-
{
|
2599
|
-
ref,
|
2600
|
-
tag: "aside",
|
2601
|
-
"aria-labelledby": "additional-information",
|
2602
|
-
background: "neutral0",
|
2603
|
-
borderColor: "neutral150",
|
2604
|
-
hasRadius: true,
|
2605
|
-
paddingBottom: 4,
|
2606
|
-
paddingLeft: 4,
|
2607
|
-
paddingRight: 4,
|
2608
|
-
paddingTop: 4,
|
2609
|
-
shadow: "tableShadow",
|
2610
|
-
gap: 3,
|
2611
|
-
direction: "column",
|
2612
|
-
justifyContent: "stretch",
|
2613
|
-
alignItems: "flex-start",
|
2614
|
-
children: [
|
2615
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
|
2616
|
-
children
|
2617
|
-
]
|
2618
|
-
}
|
2619
|
-
);
|
2620
|
-
});
|
2621
|
-
const HOOKS = {
|
2622
|
-
/**
|
2623
|
-
* Hook that allows to mutate the displayed headers of the list view table
|
2624
|
-
* @constant
|
2625
|
-
* @type {string}
|
2626
|
-
*/
|
2627
|
-
INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
|
2628
|
-
/**
|
2629
|
-
* Hook that allows to mutate the CM's collection types links pre-set filters
|
2630
|
-
* @constant
|
2631
|
-
* @type {string}
|
2632
|
-
*/
|
2633
|
-
MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
|
2634
|
-
/**
|
2635
|
-
* Hook that allows to mutate the CM's edit view layout
|
2636
|
-
* @constant
|
2637
|
-
* @type {string}
|
2638
|
-
*/
|
2639
|
-
MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
|
2640
|
-
/**
|
2641
|
-
* Hook that allows to mutate the CM's single types links pre-set filters
|
2642
|
-
* @constant
|
2643
|
-
* @type {string}
|
2644
|
-
*/
|
2645
|
-
MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
|
2646
|
-
};
|
2647
|
-
const contentTypesApi = contentManagerApi.injectEndpoints({
|
2648
|
-
endpoints: (builder) => ({
|
2649
|
-
getContentTypeConfiguration: builder.query({
|
2650
|
-
query: (uid) => ({
|
2651
|
-
url: `/content-manager/content-types/${uid}/configuration`,
|
2652
|
-
method: "GET"
|
2653
|
-
}),
|
2654
|
-
transformResponse: (response) => response.data,
|
2655
|
-
providesTags: (_result, _error, uid) => [
|
2656
|
-
{ type: "ContentTypesConfiguration", id: uid },
|
2657
|
-
{ type: "ContentTypeSettings", id: "LIST" }
|
2658
|
-
]
|
2659
|
-
}),
|
2660
|
-
getAllContentTypeSettings: builder.query({
|
2661
|
-
query: () => "/content-manager/content-types-settings",
|
2662
|
-
transformResponse: (response) => response.data,
|
2663
|
-
providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
|
2664
|
-
}),
|
2665
|
-
updateContentTypeConfiguration: builder.mutation({
|
2666
|
-
query: ({ uid, ...body }) => ({
|
2667
|
-
url: `/content-manager/content-types/${uid}/configuration`,
|
2668
|
-
method: "PUT",
|
2669
|
-
data: body
|
2670
|
-
}),
|
2671
|
-
transformResponse: (response) => response.data,
|
2672
|
-
invalidatesTags: (_result, _error, { uid }) => [
|
2673
|
-
{ type: "ContentTypesConfiguration", id: uid },
|
2674
|
-
{ type: "ContentTypeSettings", id: "LIST" },
|
2675
|
-
// Is this necessary?
|
2676
|
-
{ type: "InitialData" }
|
2677
|
-
]
|
2678
|
-
})
|
2679
|
-
})
|
2680
|
-
});
|
2681
|
-
const {
|
2682
|
-
useGetContentTypeConfigurationQuery,
|
2683
|
-
useGetAllContentTypeSettingsQuery,
|
2684
|
-
useUpdateContentTypeConfigurationMutation
|
2685
|
-
} = contentTypesApi;
|
2686
|
-
const checkIfAttributeIsDisplayable = (attribute) => {
|
2687
|
-
const { type } = attribute;
|
2688
|
-
if (type === "relation") {
|
2689
|
-
return !attribute.relation.toLowerCase().includes("morph");
|
2690
|
-
}
|
2691
|
-
return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
|
2692
|
-
};
|
2693
|
-
const getMainField = (attribute, mainFieldName, { schemas, components }) => {
|
2694
|
-
if (!mainFieldName) {
|
2695
|
-
return void 0;
|
2696
|
-
}
|
2697
|
-
const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
|
2698
|
-
// @ts-expect-error – `targetModel` does exist on the attribute for a relation.
|
2699
|
-
schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
|
2700
|
-
);
|
2701
|
-
return {
|
2702
|
-
name: mainFieldName,
|
2703
|
-
type: mainFieldType ?? "string"
|
2704
|
-
};
|
2705
|
-
};
|
2706
|
-
const DEFAULT_SETTINGS = {
|
2707
|
-
bulkable: false,
|
2708
|
-
filterable: false,
|
2709
|
-
searchable: false,
|
2710
|
-
pagination: false,
|
2711
|
-
defaultSortBy: "",
|
2712
|
-
defaultSortOrder: "asc",
|
2713
|
-
mainField: "id",
|
2714
|
-
pageSize: 10
|
2715
|
-
};
|
2716
|
-
const useDocumentLayout = (model) => {
|
2717
|
-
const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
|
2718
|
-
const [{ query }] = strapiAdmin.useQueryParams();
|
2719
|
-
const runHookWaterfall = strapiAdmin.useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
|
2720
|
-
const { toggleNotification } = strapiAdmin.useNotification();
|
2721
|
-
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
2722
|
-
const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
|
2723
|
-
const {
|
2724
|
-
data,
|
2725
|
-
isLoading: isLoadingConfigs,
|
2726
|
-
error,
|
2727
|
-
isFetching: isFetchingConfigs
|
2728
|
-
} = useGetContentTypeConfigurationQuery(model);
|
2729
|
-
const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
|
2730
|
-
React__namespace.useEffect(() => {
|
2731
|
-
if (error) {
|
2732
|
-
toggleNotification({
|
2733
|
-
type: "danger",
|
2734
|
-
message: formatAPIError(error)
|
2735
|
-
});
|
2736
|
-
}
|
2737
|
-
}, [error, formatAPIError, toggleNotification]);
|
2738
|
-
const editLayout = React__namespace.useMemo(
|
2739
|
-
() => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
|
2740
|
-
layout: [],
|
2741
|
-
components: {},
|
2742
|
-
metadatas: {},
|
2743
|
-
options: {},
|
2744
|
-
settings: DEFAULT_SETTINGS
|
2745
|
-
},
|
2746
|
-
[data, isLoading, schemas, schema, components]
|
2747
|
-
);
|
2748
|
-
const listLayout = React__namespace.useMemo(() => {
|
2749
|
-
return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
|
2750
|
-
layout: [],
|
2751
|
-
metadatas: {},
|
2752
|
-
options: {},
|
2753
|
-
settings: DEFAULT_SETTINGS
|
2754
|
-
};
|
2755
|
-
}, [data, isLoading, schemas, schema, components]);
|
2756
|
-
const { layout: edit } = React__namespace.useMemo(
|
2757
|
-
() => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
|
2758
|
-
layout: editLayout,
|
2759
|
-
query
|
2760
|
-
}),
|
2761
|
-
[editLayout, query, runHookWaterfall]
|
2762
|
-
);
|
2763
|
-
return {
|
2764
|
-
error,
|
2765
|
-
isLoading,
|
2766
|
-
edit,
|
2767
|
-
list: listLayout
|
2768
|
-
};
|
2769
|
-
};
|
2770
|
-
const useDocLayout = () => {
|
2771
|
-
const { model } = useDoc();
|
2772
|
-
return useDocumentLayout(model);
|
2773
|
-
};
|
2774
|
-
const formatEditLayout = (data, {
|
2775
|
-
schemas,
|
2776
|
-
schema,
|
2777
|
-
components
|
2778
|
-
}) => {
|
2779
|
-
let currentPanelIndex = 0;
|
2780
|
-
const panelledEditAttributes = convertEditLayoutToFieldLayouts(
|
2781
|
-
data.contentType.layouts.edit,
|
2782
|
-
schema?.attributes,
|
2783
|
-
data.contentType.metadatas,
|
2784
|
-
{ configurations: data.components, schemas: components },
|
2785
|
-
schemas
|
2786
|
-
).reduce((panels, row) => {
|
2787
|
-
if (row.some((field) => field.type === "dynamiczone")) {
|
2788
|
-
panels.push([row]);
|
2789
|
-
currentPanelIndex += 2;
|
2790
|
-
} else {
|
2791
|
-
if (!panels[currentPanelIndex]) {
|
2792
|
-
panels.push([]);
|
2793
|
-
}
|
2794
|
-
panels[currentPanelIndex].push(row);
|
2795
|
-
}
|
2796
|
-
return panels;
|
2797
|
-
}, []);
|
2798
|
-
const componentEditAttributes = Object.entries(data.components).reduce(
|
2799
|
-
(acc, [uid, configuration]) => {
|
2800
|
-
acc[uid] = {
|
2801
|
-
layout: convertEditLayoutToFieldLayouts(
|
2802
|
-
configuration.layouts.edit,
|
2803
|
-
components[uid].attributes,
|
2804
|
-
configuration.metadatas
|
2805
|
-
),
|
2806
|
-
settings: {
|
2807
|
-
...configuration.settings,
|
2808
|
-
icon: components[uid].info.icon,
|
2809
|
-
displayName: components[uid].info.displayName
|
3024
|
+
locale: "*"
|
3025
|
+
}
|
3026
|
+
});
|
3027
|
+
if (!("error" in res)) {
|
3028
|
+
navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });
|
3029
|
+
}
|
3030
|
+
} finally {
|
3031
|
+
if (!listViewPathMatch) {
|
3032
|
+
setSubmitting(false);
|
3033
|
+
}
|
2810
3034
|
}
|
2811
|
-
}
|
2812
|
-
return acc;
|
2813
|
-
},
|
2814
|
-
{}
|
2815
|
-
);
|
2816
|
-
const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
|
2817
|
-
(acc, [attribute, metadata]) => {
|
2818
|
-
return {
|
2819
|
-
...acc,
|
2820
|
-
[attribute]: metadata.edit
|
2821
|
-
};
|
2822
|
-
},
|
2823
|
-
{}
|
2824
|
-
);
|
2825
|
-
return {
|
2826
|
-
layout: panelledEditAttributes,
|
2827
|
-
components: componentEditAttributes,
|
2828
|
-
metadatas: editMetadatas,
|
2829
|
-
settings: {
|
2830
|
-
...data.contentType.settings,
|
2831
|
-
displayName: schema?.info.displayName
|
3035
|
+
}
|
2832
3036
|
},
|
2833
|
-
|
2834
|
-
|
2835
|
-
...schema?.pluginOptions,
|
2836
|
-
...data.contentType.options
|
2837
|
-
}
|
3037
|
+
variant: "danger",
|
3038
|
+
position: ["header", "table-row"]
|
2838
3039
|
};
|
2839
3040
|
};
|
2840
|
-
|
2841
|
-
|
2842
|
-
|
2843
|
-
|
2844
|
-
|
2845
|
-
|
2846
|
-
|
2847
|
-
|
2848
|
-
|
2849
|
-
|
2850
|
-
|
2851
|
-
|
2852
|
-
|
2853
|
-
|
2854
|
-
|
2855
|
-
|
2856
|
-
|
2857
|
-
|
2858
|
-
|
2859
|
-
|
2860
|
-
|
2861
|
-
|
2862
|
-
|
2863
|
-
|
2864
|
-
|
2865
|
-
|
2866
|
-
|
2867
|
-
|
2868
|
-
|
3041
|
+
DeleteAction$1.type = "delete";
|
3042
|
+
DeleteAction$1.position = ["header", "table-row"];
|
3043
|
+
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
3044
|
+
const Panels = () => {
|
3045
|
+
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
3046
|
+
const [
|
3047
|
+
{
|
3048
|
+
query: { status }
|
3049
|
+
}
|
3050
|
+
] = strapiAdmin.useQueryParams({
|
3051
|
+
status: "draft"
|
3052
|
+
});
|
3053
|
+
const { model, id, document, meta, collectionType } = useDoc();
|
3054
|
+
const plugins = strapiAdmin.useStrapiApp("Panels", (state) => state.plugins);
|
3055
|
+
const props = {
|
3056
|
+
activeTab: status,
|
3057
|
+
model,
|
3058
|
+
documentId: id,
|
3059
|
+
document: isCloning ? void 0 : document,
|
3060
|
+
meta: isCloning ? void 0 : meta,
|
3061
|
+
collectionType
|
3062
|
+
};
|
3063
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
3064
|
+
strapiAdmin.DescriptionComponentRenderer,
|
3065
|
+
{
|
3066
|
+
props,
|
3067
|
+
descriptions: plugins["content-manager"].apis.getEditViewSidePanels(),
|
3068
|
+
children: (panels) => panels.map(({ content, id: id2, ...description }) => /* @__PURE__ */ jsxRuntime.jsx(Panel, { ...description, children: content }, id2))
|
3069
|
+
}
|
3070
|
+
) });
|
2869
3071
|
};
|
2870
|
-
const
|
2871
|
-
|
2872
|
-
schema,
|
2873
|
-
components
|
2874
|
-
}) => {
|
2875
|
-
const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
|
2876
|
-
(acc, [attribute, metadata]) => {
|
2877
|
-
return {
|
2878
|
-
...acc,
|
2879
|
-
[attribute]: metadata.list
|
2880
|
-
};
|
2881
|
-
},
|
2882
|
-
{}
|
2883
|
-
);
|
2884
|
-
const listAttributes = convertListLayoutToFieldLayouts(
|
2885
|
-
data.contentType.layouts.list,
|
2886
|
-
schema?.attributes,
|
2887
|
-
listMetadatas,
|
2888
|
-
{ configurations: data.components, schemas: components },
|
2889
|
-
schemas
|
2890
|
-
);
|
3072
|
+
const ActionsPanel = () => {
|
3073
|
+
const { formatMessage } = reactIntl.useIntl();
|
2891
3074
|
return {
|
2892
|
-
|
2893
|
-
|
2894
|
-
|
2895
|
-
|
2896
|
-
|
2897
|
-
...schema?.pluginOptions,
|
2898
|
-
...data.contentType.options
|
2899
|
-
}
|
3075
|
+
title: formatMessage({
|
3076
|
+
id: "content-manager.containers.edit.panels.default.title",
|
3077
|
+
defaultMessage: "Entry"
|
3078
|
+
}),
|
3079
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(ActionsPanelContent, {})
|
2900
3080
|
};
|
2901
3081
|
};
|
2902
|
-
|
2903
|
-
|
2904
|
-
|
2905
|
-
|
2906
|
-
|
3082
|
+
ActionsPanel.type = "actions";
|
3083
|
+
const ActionsPanelContent = () => {
|
3084
|
+
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
3085
|
+
const [
|
3086
|
+
{
|
3087
|
+
query: { status = "draft" }
|
2907
3088
|
}
|
2908
|
-
|
2909
|
-
|
2910
|
-
|
2911
|
-
|
2912
|
-
|
2913
|
-
|
2914
|
-
|
2915
|
-
|
2916
|
-
|
2917
|
-
|
2918
|
-
|
2919
|
-
|
2920
|
-
|
2921
|
-
|
3089
|
+
] = strapiAdmin.useQueryParams();
|
3090
|
+
const { model, id, document, meta, collectionType } = useDoc();
|
3091
|
+
const plugins = strapiAdmin.useStrapiApp("ActionsPanel", (state) => state.plugins);
|
3092
|
+
const props = {
|
3093
|
+
activeTab: status,
|
3094
|
+
model,
|
3095
|
+
documentId: id,
|
3096
|
+
document: isCloning ? void 0 : document,
|
3097
|
+
meta: isCloning ? void 0 : meta,
|
3098
|
+
collectionType
|
3099
|
+
};
|
3100
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, width: "100%", children: [
|
3101
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
3102
|
+
strapiAdmin.DescriptionComponentRenderer,
|
3103
|
+
{
|
3104
|
+
props,
|
3105
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
|
3106
|
+
children: (actions2) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActions, { actions: actions2 })
|
3107
|
+
}
|
3108
|
+
),
|
3109
|
+
/* @__PURE__ */ jsxRuntime.jsx(InjectionZone, { area: "editView.right-links", slug: model })
|
3110
|
+
] });
|
2922
3111
|
};
|
3112
|
+
const Panel = React__namespace.forwardRef(({ children, title }, ref) => {
|
3113
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
3114
|
+
designSystem.Flex,
|
3115
|
+
{
|
3116
|
+
ref,
|
3117
|
+
tag: "aside",
|
3118
|
+
"aria-labelledby": "additional-information",
|
3119
|
+
background: "neutral0",
|
3120
|
+
borderColor: "neutral150",
|
3121
|
+
hasRadius: true,
|
3122
|
+
paddingBottom: 4,
|
3123
|
+
paddingLeft: 4,
|
3124
|
+
paddingRight: 4,
|
3125
|
+
paddingTop: 4,
|
3126
|
+
shadow: "tableShadow",
|
3127
|
+
gap: 3,
|
3128
|
+
direction: "column",
|
3129
|
+
justifyContent: "stretch",
|
3130
|
+
alignItems: "flex-start",
|
3131
|
+
children: [
|
3132
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", textColor: "neutral600", children: title }),
|
3133
|
+
children
|
3134
|
+
]
|
3135
|
+
}
|
3136
|
+
);
|
3137
|
+
});
|
2923
3138
|
const ConfirmBulkActionDialog = ({
|
2924
3139
|
onToggleDialog,
|
2925
3140
|
isOpen = false,
|
@@ -3164,18 +3379,10 @@ const SelectedEntriesTableContent = ({
|
|
3164
3379
|
search: row.locale && `?plugins[i18n][locale]=${row.locale}`
|
3165
3380
|
},
|
3166
3381
|
state: { from: pathname },
|
3167
|
-
label: formatMessage(
|
3168
|
-
|
3169
|
-
|
3170
|
-
|
3171
|
-
{
|
3172
|
-
id: "content-manager.components.ListViewHelperPluginTable.row-line",
|
3173
|
-
defaultMessage: "item line {number}"
|
3174
|
-
},
|
3175
|
-
{ number: index2 + 1 }
|
3176
|
-
)
|
3177
|
-
}
|
3178
|
-
),
|
3382
|
+
label: formatMessage({
|
3383
|
+
id: "content-manager.bulk-publish.edit",
|
3384
|
+
defaultMessage: "Edit"
|
3385
|
+
}),
|
3179
3386
|
target: "_blank",
|
3180
3387
|
marginLeft: "auto",
|
3181
3388
|
variant: "ghost",
|
@@ -3349,8 +3556,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3349
3556
|
const refetchList = () => {
|
3350
3557
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3351
3558
|
};
|
3352
|
-
if (!showPublishButton)
|
3353
|
-
return null;
|
3559
|
+
if (!showPublishButton) return null;
|
3354
3560
|
return {
|
3355
3561
|
actionType: "publish",
|
3356
3562
|
variant: "tertiary",
|
@@ -3418,8 +3624,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3418
3624
|
selectRow([]);
|
3419
3625
|
}
|
3420
3626
|
};
|
3421
|
-
if (!hasDeletePermission)
|
3422
|
-
return null;
|
3627
|
+
if (!hasDeletePermission) return null;
|
3423
3628
|
return {
|
3424
3629
|
variant: "danger-light",
|
3425
3630
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3468,8 +3673,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3468
3673
|
}
|
3469
3674
|
};
|
3470
3675
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3471
|
-
if (!showUnpublishButton)
|
3472
|
-
return null;
|
3676
|
+
if (!showUnpublishButton) return null;
|
3473
3677
|
return {
|
3474
3678
|
variant: "tertiary",
|
3475
3679
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3574,7 +3778,7 @@ const TableActions = ({ document }) => {
|
|
3574
3778
|
strapiAdmin.DescriptionComponentRenderer,
|
3575
3779
|
{
|
3576
3780
|
props,
|
3577
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3781
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
|
3578
3782
|
children: (actions2) => {
|
3579
3783
|
const tableRowActions = actions2.filter((action) => {
|
3580
3784
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3633,6 +3837,7 @@ const EditAction = ({ documentId }) => {
|
|
3633
3837
|
};
|
3634
3838
|
};
|
3635
3839
|
EditAction.type = "edit";
|
3840
|
+
EditAction.position = "table-row";
|
3636
3841
|
const StyledPencil = styledComponents.styled(Icons.Pencil)`
|
3637
3842
|
path {
|
3638
3843
|
fill: currentColor;
|
@@ -3709,6 +3914,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3709
3914
|
};
|
3710
3915
|
};
|
3711
3916
|
CloneAction.type = "clone";
|
3917
|
+
CloneAction.position = "table-row";
|
3712
3918
|
const StyledDuplicate = styledComponents.styled(Icons.Duplicate)`
|
3713
3919
|
path {
|
3714
3920
|
fill: currentColor;
|
@@ -3795,7 +4001,14 @@ class ContentManagerPlugin {
|
|
3795
4001
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3796
4002
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3797
4003
|
getBulkActions: () => this.bulkActions,
|
3798
|
-
getDocumentActions: () =>
|
4004
|
+
getDocumentActions: (position) => {
|
4005
|
+
if (position) {
|
4006
|
+
return this.documentActions.filter(
|
4007
|
+
(action) => action.position == void 0 || [action.position].flat().includes(position)
|
4008
|
+
);
|
4009
|
+
}
|
4010
|
+
return this.documentActions;
|
4011
|
+
},
|
3799
4012
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3800
4013
|
getHeaderActions: () => this.headerActions
|
3801
4014
|
}
|
@@ -3805,10 +4018,8 @@ class ContentManagerPlugin {
|
|
3805
4018
|
const getPrintableType = (value) => {
|
3806
4019
|
const nativeType = typeof value;
|
3807
4020
|
if (nativeType === "object") {
|
3808
|
-
if (value === null)
|
3809
|
-
|
3810
|
-
if (Array.isArray(value))
|
3811
|
-
return "array";
|
4021
|
+
if (value === null) return "null";
|
4022
|
+
if (Array.isArray(value)) return "array";
|
3812
4023
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3813
4024
|
return value.constructor.name;
|
3814
4025
|
}
|
@@ -3819,17 +4030,27 @@ const HistoryAction = ({ model, document }) => {
|
|
3819
4030
|
const { formatMessage } = reactIntl.useIntl();
|
3820
4031
|
const [{ query }] = strapiAdmin.useQueryParams();
|
3821
4032
|
const navigate = reactRouterDom.useNavigate();
|
4033
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
4034
|
+
const { pathname } = reactRouterDom.useLocation();
|
3822
4035
|
const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
|
3823
4036
|
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3824
4037
|
return null;
|
3825
4038
|
}
|
4039
|
+
const handleOnClick = () => {
|
4040
|
+
const destination = { pathname: "history", search: pluginsQueryParams };
|
4041
|
+
trackUsage("willNavigate", {
|
4042
|
+
from: pathname,
|
4043
|
+
to: `${pathname}/${destination.pathname}`
|
4044
|
+
});
|
4045
|
+
navigate(destination);
|
4046
|
+
};
|
3826
4047
|
return {
|
3827
4048
|
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
|
3828
4049
|
label: formatMessage({
|
3829
4050
|
id: "content-manager.history.document-action",
|
3830
4051
|
defaultMessage: "Content History"
|
3831
4052
|
}),
|
3832
|
-
onClick:
|
4053
|
+
onClick: handleOnClick,
|
3833
4054
|
disabled: (
|
3834
4055
|
/**
|
3835
4056
|
* The user is creating a new document.
|
@@ -3851,6 +4072,7 @@ const HistoryAction = ({ model, document }) => {
|
|
3851
4072
|
};
|
3852
4073
|
};
|
3853
4074
|
HistoryAction.type = "history";
|
4075
|
+
HistoryAction.position = "header";
|
3854
4076
|
const historyAdmin = {
|
3855
4077
|
bootstrap(app) {
|
3856
4078
|
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
@@ -3897,6 +4119,88 @@ const { setInitialData } = actions;
|
|
3897
4119
|
const reducer = toolkit.combineReducers({
|
3898
4120
|
app: reducer$1
|
3899
4121
|
});
|
4122
|
+
const previewApi = contentManagerApi.injectEndpoints({
|
4123
|
+
endpoints: (builder) => ({
|
4124
|
+
getPreviewUrl: builder.query({
|
4125
|
+
query({ query, params }) {
|
4126
|
+
return {
|
4127
|
+
url: `/content-manager/preview/url/${params.contentType}`,
|
4128
|
+
method: "GET",
|
4129
|
+
config: {
|
4130
|
+
params: query
|
4131
|
+
}
|
4132
|
+
};
|
4133
|
+
}
|
4134
|
+
})
|
4135
|
+
})
|
4136
|
+
});
|
4137
|
+
const { useGetPreviewUrlQuery } = previewApi;
|
4138
|
+
const ConditionalTooltip = ({ isShown, label, children }) => {
|
4139
|
+
if (isShown) {
|
4140
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { label, children });
|
4141
|
+
}
|
4142
|
+
return children;
|
4143
|
+
};
|
4144
|
+
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4145
|
+
const { formatMessage } = reactIntl.useIntl();
|
4146
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
4147
|
+
const { pathname } = reactRouterDom.useLocation();
|
4148
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
4149
|
+
const isModified = strapiAdmin.useForm("PreviewSidePanel", (state) => state.modified);
|
4150
|
+
const { data, error } = useGetPreviewUrlQuery({
|
4151
|
+
params: {
|
4152
|
+
contentType: model
|
4153
|
+
},
|
4154
|
+
query: {
|
4155
|
+
documentId,
|
4156
|
+
locale: document?.locale,
|
4157
|
+
status: document?.status
|
4158
|
+
}
|
4159
|
+
});
|
4160
|
+
if (!data?.data?.url || error) {
|
4161
|
+
return null;
|
4162
|
+
}
|
4163
|
+
const trackNavigation = () => {
|
4164
|
+
const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
|
4165
|
+
trackUsage("willNavigate", { from: pathname, to: destinationPathname });
|
4166
|
+
};
|
4167
|
+
return {
|
4168
|
+
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4169
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(
|
4170
|
+
ConditionalTooltip,
|
4171
|
+
{
|
4172
|
+
label: formatMessage({
|
4173
|
+
id: "content-manager.preview.panel.button-disabled-tooltip",
|
4174
|
+
defaultMessage: "Please save to open the preview"
|
4175
|
+
}),
|
4176
|
+
isShown: isModified,
|
4177
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
4178
|
+
designSystem.Button,
|
4179
|
+
{
|
4180
|
+
variant: "tertiary",
|
4181
|
+
tag: reactRouterDom.Link,
|
4182
|
+
to: { pathname: "preview", search: qs.stringify(query, { encode: false }) },
|
4183
|
+
onClick: trackNavigation,
|
4184
|
+
width: "100%",
|
4185
|
+
disabled: isModified,
|
4186
|
+
pointerEvents: isModified ? "none" : void 0,
|
4187
|
+
tabIndex: isModified ? -1 : void 0,
|
4188
|
+
children: formatMessage({
|
4189
|
+
id: "content-manager.preview.panel.button",
|
4190
|
+
defaultMessage: "Open preview"
|
4191
|
+
})
|
4192
|
+
}
|
4193
|
+
) })
|
4194
|
+
}
|
4195
|
+
)
|
4196
|
+
};
|
4197
|
+
};
|
4198
|
+
const previewAdmin = {
|
4199
|
+
bootstrap(app) {
|
4200
|
+
const contentManagerPluginApis = app.getPlugin("content-manager").apis;
|
4201
|
+
contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
|
4202
|
+
}
|
4203
|
+
};
|
3900
4204
|
const index = {
|
3901
4205
|
register(app) {
|
3902
4206
|
const cm = new ContentManagerPlugin();
|
@@ -3916,7 +4220,7 @@ const index = {
|
|
3916
4220
|
app.router.addRoute({
|
3917
4221
|
path: "content-manager/*",
|
3918
4222
|
lazy: async () => {
|
3919
|
-
const { Layout } = await Promise.resolve().then(() => require("./layout-
|
4223
|
+
const { Layout } = await Promise.resolve().then(() => require("./layout-BW80JSCd.js"));
|
3920
4224
|
return {
|
3921
4225
|
Component: Layout
|
3922
4226
|
};
|
@@ -3929,11 +4233,14 @@ const index = {
|
|
3929
4233
|
if (typeof historyAdmin.bootstrap === "function") {
|
3930
4234
|
historyAdmin.bootstrap(app);
|
3931
4235
|
}
|
4236
|
+
if (typeof previewAdmin.bootstrap === "function") {
|
4237
|
+
previewAdmin.bootstrap(app);
|
4238
|
+
}
|
3932
4239
|
},
|
3933
4240
|
async registerTrads({ locales }) {
|
3934
4241
|
const importedTrads = await Promise.all(
|
3935
4242
|
locales.map((locale) => {
|
3936
|
-
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-
|
4243
|
+
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-BzQmavmK.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`, 3).then(({ default: data }) => {
|
3937
4244
|
return {
|
3938
4245
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
3939
4246
|
locale
|
@@ -3979,6 +4286,7 @@ exports.getMainField = getMainField;
|
|
3979
4286
|
exports.getTranslation = getTranslation;
|
3980
4287
|
exports.index = index;
|
3981
4288
|
exports.setInitialData = setInitialData;
|
4289
|
+
exports.useContentManagerContext = useContentManagerContext;
|
3982
4290
|
exports.useContentTypeSchema = useContentTypeSchema;
|
3983
4291
|
exports.useDoc = useDoc;
|
3984
4292
|
exports.useDocLayout = useDocLayout;
|
@@ -3990,5 +4298,6 @@ exports.useGetAllContentTypeSettingsQuery = useGetAllContentTypeSettingsQuery;
|
|
3990
4298
|
exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
|
3991
4299
|
exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
|
3992
4300
|
exports.useGetInitialDataQuery = useGetInitialDataQuery;
|
4301
|
+
exports.useGetPreviewUrlQuery = useGetPreviewUrlQuery;
|
3993
4302
|
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
|
3994
|
-
//# sourceMappingURL=index-
|
4303
|
+
//# sourceMappingURL=index-Ca7YWlAA.js.map
|