@strapi/content-manager 0.0.0-experimental.d954d57341a6623992a0d211daaec8e245c3517d → 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/LICENSE +18 -3
- package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -1
- package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-WRPUXGd6.js → ComponentConfigurationPage-BLWQy8ru.js} +5 -6
- package/dist/_chunks/{ComponentConfigurationPage-WRPUXGd6.js.map → ComponentConfigurationPage-BLWQy8ru.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-gdUj_t-O.mjs → ComponentConfigurationPage-CtIa3aa2.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-gdUj_t-O.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-BwuIPOJG.mjs → EditConfigurationPage-DsPR2DVk.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-BwuIPOJG.mjs.map → EditConfigurationPage-DsPR2DVk.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-C1vjMBgy.js → EditConfigurationPage-RQkymxCy.js} +5 -6
- package/dist/_chunks/{EditConfigurationPage-C1vjMBgy.js.map → EditConfigurationPage-RQkymxCy.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-DbcGfyqK.js → EditViewPage-B-kExt8C.js} +63 -13
- package/dist/_chunks/EditViewPage-B-kExt8C.js.map +1 -0
- package/dist/_chunks/{EditViewPage-0MiFkXa8.mjs → EditViewPage-BPyVuPfM.mjs} +63 -12
- package/dist/_chunks/EditViewPage-BPyVuPfM.mjs.map +1 -0
- package/dist/_chunks/{Field-BG1xu38N.js → Field-DPIsQRre.js} +680 -261
- package/dist/_chunks/Field-DPIsQRre.js.map +1 -0
- package/dist/_chunks/{Field-BDMSCcy5.mjs → Field-Dltnt1km.mjs} +676 -257
- 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-9BnFyUjy.js → Form-BFi4MXMT.js} +43 -22
- package/dist/_chunks/Form-BFi4MXMT.js.map +1 -0
- package/dist/_chunks/{Form-CPVWavB8.mjs → Form-C1IcWm1u.mjs} +41 -19
- package/dist/_chunks/Form-C1IcWm1u.mjs.map +1 -0
- package/dist/_chunks/{History-BVpd8LP3.mjs → History-04ChQ4pl.mjs} +108 -116
- package/dist/_chunks/History-04ChQ4pl.mjs.map +1 -0
- package/dist/_chunks/{History-BWWxLt2Z.js → History-wjcK4L0C.js} +107 -116
- package/dist/_chunks/History-wjcK4L0C.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DozVMKcR.mjs → ListConfigurationPage-BYqPYLSU.mjs} +25 -12
- package/dist/_chunks/ListConfigurationPage-BYqPYLSU.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-6swzjdAZ.js → ListConfigurationPage-CRbxIC3J.js} +25 -13
- package/dist/_chunks/ListConfigurationPage-CRbxIC3J.js.map +1 -0
- package/dist/_chunks/{ListViewPage-BlzfjS2Q.js → ListViewPage-D5NY9183.js} +121 -81
- package/dist/_chunks/ListViewPage-D5NY9183.js.map +1 -0
- package/dist/_chunks/{ListViewPage-Ds0ulgfG.mjs → ListViewPage-FU2LBuhl.mjs} +118 -77
- package/dist/_chunks/ListViewPage-FU2LBuhl.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-D2nCCWEl.js → NoContentTypePage-BgQVE_Qb.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-D2nCCWEl.js.map → NoContentTypePage-BgQVE_Qb.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-BH11kaKt.mjs → NoContentTypePage-DCKUkwb8.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-BH11kaKt.mjs.map → NoContentTypePage-DCKUkwb8.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DN_JlsU2.js → NoPermissionsPage-C5jwn70o.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DN_JlsU2.js.map → NoPermissionsPage-C5jwn70o.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-BT2Tn0D_.mjs → NoPermissionsPage-jqve7C8l.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-BT2Tn0D_.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-CcgFTcWo.js → Relations-CTGM7Hv5.js} +76 -43
- package/dist/_chunks/Relations-CTGM7Hv5.js.map +1 -0
- package/dist/_chunks/{Relations-Dnag3fhV.mjs → Relations-gscPkxjF.mjs} +76 -42
- package/dist/_chunks/Relations-gscPkxjF.mjs.map +1 -0
- package/dist/_chunks/{en-fbKQxLGn.js → en-BzQmavmK.js} +37 -18
- package/dist/_chunks/{en-fbKQxLGn.js.map → en-BzQmavmK.js.map} +1 -1
- package/dist/_chunks/{en-Ux26r5pl.mjs → en-CSxLmrh1.mjs} +37 -18
- package/dist/_chunks/{en-Ux26r5pl.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-CWpLBSt0.js → index-Ca7YWlAA.js} +1271 -746
- package/dist/_chunks/index-Ca7YWlAA.js.map +1 -0
- package/dist/_chunks/{index-JNNNKUHs.mjs → index-DqasUQ6Q.mjs} +1288 -763
- 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--iHdZzRk.js → layout-BW80JSCd.js} +27 -15
- package/dist/_chunks/layout-BW80JSCd.js.map +1 -0
- package/dist/_chunks/{layout-DC503LnF.mjs → layout-W3clJSCy.mjs} +28 -15
- package/dist/_chunks/layout-W3clJSCy.mjs.map +1 -0
- package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
- package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
- package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
- package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
- package/dist/_chunks/{relations-CTje5t-a.mjs → relations-BlDkoeWh.mjs} +6 -7
- package/dist/_chunks/relations-BlDkoeWh.mjs.map +1 -0
- package/dist/_chunks/{relations-BbHizA5K.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/index.d.ts +3 -0
- package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
- package/dist/admin/src/hooks/useDocument.d.ts +32 -1
- package/dist/admin/src/index.d.ts +1 -0
- package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +2 -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 +5 -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/FormInputs/Relations.d.ts +20 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +4 -48
- package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
- package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
- package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
- package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
- package/dist/admin/src/preview/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/admin/src/utils/validation.d.ts +4 -1
- package/dist/server/index.js +765 -437
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +766 -437
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/relations.d.ts.map +1 -1
- package/dist/server/src/controllers/uid.d.ts.map +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts +16 -1
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/dimensions.d.ts +4 -2
- package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -1
- package/dist/server/src/history/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 +8 -12
- 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/policies/hasPermissions.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/permission-checker.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-0MiFkXa8.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-DbcGfyqK.js.map +0 -1
- package/dist/_chunks/Field-BDMSCcy5.mjs.map +0 -1
- package/dist/_chunks/Field-BG1xu38N.js.map +0 -1
- package/dist/_chunks/Form-9BnFyUjy.js.map +0 -1
- package/dist/_chunks/Form-CPVWavB8.mjs.map +0 -1
- package/dist/_chunks/History-BVpd8LP3.mjs.map +0 -1
- package/dist/_chunks/History-BWWxLt2Z.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-6swzjdAZ.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DozVMKcR.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-BlzfjS2Q.js.map +0 -1
- package/dist/_chunks/ListViewPage-Ds0ulgfG.mjs.map +0 -1
- package/dist/_chunks/Relations-CcgFTcWo.js.map +0 -1
- package/dist/_chunks/Relations-Dnag3fhV.mjs.map +0 -1
- package/dist/_chunks/index-CWpLBSt0.js.map +0 -1
- package/dist/_chunks/index-JNNNKUHs.mjs.map +0 -1
- package/dist/_chunks/layout--iHdZzRk.js.map +0 -1
- package/dist/_chunks/layout-DC503LnF.mjs.map +0 -1
- package/dist/_chunks/relations-BbHizA5K.js.map +0 -1
- package/dist/_chunks/relations-CTje5t-a.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
@@ -2,20 +2,20 @@
|
|
2
2
|
const Icons = require("@strapi/icons");
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
4
4
|
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
5
|
-
const qs = require("qs");
|
6
|
-
const reactIntl = require("react-intl");
|
7
|
-
const reactRouterDom = require("react-router-dom");
|
8
5
|
const React = require("react");
|
9
6
|
const designSystem = require("@strapi/design-system");
|
7
|
+
const mapValues = require("lodash/fp/mapValues");
|
8
|
+
const reactIntl = require("react-intl");
|
9
|
+
const reactRouterDom = require("react-router-dom");
|
10
10
|
const styledComponents = require("styled-components");
|
11
11
|
const yup = require("yup");
|
12
|
+
const qs = require("qs");
|
12
13
|
const pipe = require("lodash/fp/pipe");
|
13
14
|
const dateFns = require("date-fns");
|
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";
|
@@ -70,42 +78,6 @@ const useInjectionZone = (area) => {
|
|
70
78
|
const [page, position] = area.split(".");
|
71
79
|
return contentManagerPlugin.getInjectedComponents(page, position);
|
72
80
|
};
|
73
|
-
const HistoryAction = ({ model, document }) => {
|
74
|
-
const { formatMessage } = reactIntl.useIntl();
|
75
|
-
const [{ query }] = strapiAdmin.useQueryParams();
|
76
|
-
const navigate = reactRouterDom.useNavigate();
|
77
|
-
const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
|
78
|
-
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
79
|
-
return null;
|
80
|
-
}
|
81
|
-
return {
|
82
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
|
83
|
-
label: formatMessage({
|
84
|
-
id: "content-manager.history.document-action",
|
85
|
-
defaultMessage: "Content History"
|
86
|
-
}),
|
87
|
-
onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
|
88
|
-
disabled: (
|
89
|
-
/**
|
90
|
-
* The user is creating a new document.
|
91
|
-
* It hasn't been saved yet, so there's no history to go to
|
92
|
-
*/
|
93
|
-
!document || /**
|
94
|
-
* The document has been created but the current dimension has never been saved.
|
95
|
-
* For example, the user is creating a new locale in an existing document,
|
96
|
-
* so there's no history for the document in that locale
|
97
|
-
*/
|
98
|
-
!document.id || /**
|
99
|
-
* History is only available for content types created by the user.
|
100
|
-
* These have the `api::` prefix, as opposed to the ones created by Strapi or plugins,
|
101
|
-
* which start with `admin::` or `plugin::`
|
102
|
-
*/
|
103
|
-
!model.startsWith("api::")
|
104
|
-
),
|
105
|
-
position: "header"
|
106
|
-
};
|
107
|
-
};
|
108
|
-
HistoryAction.type = "history";
|
109
81
|
const ID = "id";
|
110
82
|
const CREATED_BY_ATTRIBUTE_NAME = "createdBy";
|
111
83
|
const UPDATED_BY_ATTRIBUTE_NAME = "updatedBy";
|
@@ -157,6 +129,7 @@ const DocumentRBAC = ({ children, permissions }) => {
|
|
157
129
|
if (!slug) {
|
158
130
|
throw new Error("Cannot find the slug param in the URL");
|
159
131
|
}
|
132
|
+
const [{ rawQuery }] = strapiAdmin.useQueryParams();
|
160
133
|
const userPermissions = strapiAdmin.useAuth("DocumentRBAC", (state) => state.permissions);
|
161
134
|
const contentTypePermissions = React__namespace.useMemo(() => {
|
162
135
|
const contentTypePermissions2 = userPermissions.filter(
|
@@ -167,7 +140,14 @@ const DocumentRBAC = ({ children, permissions }) => {
|
|
167
140
|
return { ...acc, [action]: [permission] };
|
168
141
|
}, {});
|
169
142
|
}, [slug, userPermissions]);
|
170
|
-
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
|
+
);
|
171
151
|
const canCreateFields = !isLoading && allowedActions.canCreate ? extractAndDedupeFields(contentTypePermissions.create) : [];
|
172
152
|
const canReadFields = !isLoading && allowedActions.canRead ? extractAndDedupeFields(contentTypePermissions.read) : [];
|
173
153
|
const canUpdateFields = !isLoading && allowedActions.canUpdate ? extractAndDedupeFields(contentTypePermissions.update) : [];
|
@@ -215,10 +195,13 @@ const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
|
|
215
195
|
"Document",
|
216
196
|
"InitialData",
|
217
197
|
"HistoryVersion",
|
218
|
-
"Relations"
|
198
|
+
"Relations",
|
199
|
+
"UidAvailability",
|
200
|
+
"RecentDocumentList"
|
219
201
|
]
|
220
202
|
});
|
221
203
|
const documentApi = contentManagerApi.injectEndpoints({
|
204
|
+
overrideExisting: true,
|
222
205
|
endpoints: (builder) => ({
|
223
206
|
autoCloneDocument: builder.mutation({
|
224
207
|
query: ({ model, sourceId, query }) => ({
|
@@ -228,7 +211,12 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
228
211
|
params: query
|
229
212
|
}
|
230
213
|
}),
|
231
|
-
invalidatesTags: (_result,
|
214
|
+
invalidatesTags: (_result, error, { model }) => {
|
215
|
+
if (error) {
|
216
|
+
return [];
|
217
|
+
}
|
218
|
+
return [{ type: "Document", id: `${model}_LIST` }, "RecentDocumentList"];
|
219
|
+
}
|
232
220
|
}),
|
233
221
|
cloneDocument: builder.mutation({
|
234
222
|
query: ({ model, sourceId, data, params }) => ({
|
@@ -239,7 +227,11 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
239
227
|
params
|
240
228
|
}
|
241
229
|
}),
|
242
|
-
invalidatesTags: (_result, _error, { model }) => [
|
230
|
+
invalidatesTags: (_result, _error, { model }) => [
|
231
|
+
{ type: "Document", id: `${model}_LIST` },
|
232
|
+
{ type: "UidAvailability", id: model },
|
233
|
+
"RecentDocumentList"
|
234
|
+
]
|
243
235
|
}),
|
244
236
|
/**
|
245
237
|
* Creates a new collection-type document. This should ONLY be used for collection-types.
|
@@ -256,8 +248,22 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
256
248
|
}),
|
257
249
|
invalidatesTags: (result, _error, { model }) => [
|
258
250
|
{ type: "Document", id: `${model}_LIST` },
|
259
|
-
"Relations"
|
260
|
-
|
251
|
+
"Relations",
|
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
|
+
}
|
261
267
|
}),
|
262
268
|
deleteDocument: builder.mutation({
|
263
269
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -268,7 +274,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
268
274
|
}
|
269
275
|
}),
|
270
276
|
invalidatesTags: (_result, _error, { collectionType, model }) => [
|
271
|
-
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model }
|
277
|
+
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model },
|
278
|
+
"RecentDocumentList"
|
272
279
|
]
|
273
280
|
}),
|
274
281
|
deleteManyDocuments: builder.mutation({
|
@@ -280,7 +287,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
280
287
|
params
|
281
288
|
}
|
282
289
|
}),
|
283
|
-
invalidatesTags: (_res, _error, { model }) => [
|
290
|
+
invalidatesTags: (_res, _error, { model }) => [
|
291
|
+
{ type: "Document", id: `${model}_LIST` },
|
292
|
+
"RecentDocumentList"
|
293
|
+
]
|
284
294
|
}),
|
285
295
|
discardDocument: builder.mutation({
|
286
296
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -297,7 +307,9 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
297
307
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
298
308
|
},
|
299
309
|
{ type: "Document", id: `${model}_LIST` },
|
300
|
-
"Relations"
|
310
|
+
"Relations",
|
311
|
+
{ type: "UidAvailability", id: model },
|
312
|
+
"RecentDocumentList"
|
301
313
|
];
|
302
314
|
}
|
303
315
|
}),
|
@@ -310,11 +322,12 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
310
322
|
url: `/content-manager/collection-types/${model}`,
|
311
323
|
method: "GET",
|
312
324
|
config: {
|
313
|
-
params
|
325
|
+
params: qs.stringify(params, { encode: true })
|
314
326
|
}
|
315
327
|
}),
|
316
328
|
providesTags: (result, _error, arg) => {
|
317
329
|
return [
|
330
|
+
{ type: "Document", id: `ALL_LIST` },
|
318
331
|
{ type: "Document", id: `${arg.model}_LIST` },
|
319
332
|
...result?.results.map(({ documentId }) => ({
|
320
333
|
type: "Document",
|
@@ -353,6 +366,11 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
353
366
|
{
|
354
367
|
type: "Document",
|
355
368
|
id: collectionType !== SINGLE_TYPES ? `${model}_${result && "documentId" in result ? result.documentId : documentId}` : model
|
369
|
+
},
|
370
|
+
// Make it easy to invalidate all individual documents queries for a model
|
371
|
+
{
|
372
|
+
type: "Document",
|
373
|
+
id: `${model}_ALL_ITEMS`
|
356
374
|
}
|
357
375
|
];
|
358
376
|
}
|
@@ -386,7 +404,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
386
404
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
387
405
|
},
|
388
406
|
{ type: "Document", id: `${model}_LIST` },
|
389
|
-
"Relations"
|
407
|
+
"Relations",
|
408
|
+
"RecentDocumentList"
|
390
409
|
];
|
391
410
|
}
|
392
411
|
}),
|
@@ -416,8 +435,23 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
416
435
|
type: "Document",
|
417
436
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
418
437
|
},
|
419
|
-
"Relations"
|
438
|
+
"Relations",
|
439
|
+
{ type: "UidAvailability", id: model },
|
440
|
+
"RecentDocumentList",
|
441
|
+
"RecentDocumentList"
|
420
442
|
];
|
443
|
+
},
|
444
|
+
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
445
|
+
const patchResult = dispatch(
|
446
|
+
documentApi.util.updateQueryData("getDocument", patch, (draft) => {
|
447
|
+
Object.assign(draft.data, data);
|
448
|
+
})
|
449
|
+
);
|
450
|
+
try {
|
451
|
+
await queryFulfilled;
|
452
|
+
} catch {
|
453
|
+
patchResult.undo();
|
454
|
+
}
|
421
455
|
}
|
422
456
|
}),
|
423
457
|
unpublishDocument: builder.mutation({
|
@@ -434,7 +468,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
434
468
|
{
|
435
469
|
type: "Document",
|
436
470
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
437
|
-
}
|
471
|
+
},
|
472
|
+
"RecentDocumentList"
|
438
473
|
];
|
439
474
|
}
|
440
475
|
}),
|
@@ -447,7 +482,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
447
482
|
params
|
448
483
|
}
|
449
484
|
}),
|
450
|
-
invalidatesTags: (_res, _error, { model, documentIds }) =>
|
485
|
+
invalidatesTags: (_res, _error, { model, documentIds }) => [
|
486
|
+
...documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` })),
|
487
|
+
"RecentDocumentList"
|
488
|
+
]
|
451
489
|
})
|
452
490
|
})
|
453
491
|
});
|
@@ -470,8 +508,7 @@ const {
|
|
470
508
|
useUnpublishManyDocumentsMutation
|
471
509
|
} = documentApi;
|
472
510
|
const buildValidParams = (query) => {
|
473
|
-
if (!query)
|
474
|
-
return query;
|
511
|
+
if (!query) return query;
|
475
512
|
const { plugins: _, ...validQueryParams } = {
|
476
513
|
...query,
|
477
514
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -479,28 +516,44 @@ const buildValidParams = (query) => {
|
|
479
516
|
{}
|
480
517
|
)
|
481
518
|
};
|
482
|
-
if ("_q" in validQueryParams) {
|
483
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
484
|
-
}
|
485
519
|
return validQueryParams;
|
486
520
|
};
|
487
521
|
const isBaseQueryError = (error) => {
|
488
522
|
return error.name !== void 0;
|
489
523
|
};
|
490
|
-
const
|
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
|
+
});
|
542
|
+
const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
|
491
543
|
const createModelSchema = (attributes2) => yup__namespace.object().shape(
|
492
544
|
Object.entries(attributes2).reduce((acc, [name, attribute]) => {
|
493
545
|
if (DOCUMENT_META_FIELDS.includes(name)) {
|
494
546
|
return acc;
|
495
547
|
}
|
496
548
|
const validations = [
|
549
|
+
addNullableValidation,
|
497
550
|
addRequiredValidation,
|
498
551
|
addMinLengthValidation,
|
499
552
|
addMaxLengthValidation,
|
500
553
|
addMinValidation,
|
501
554
|
addMaxValidation,
|
502
555
|
addRegexValidation
|
503
|
-
].map((fn) => fn(attribute));
|
556
|
+
].map((fn) => fn(attribute, options));
|
504
557
|
const transformSchema = pipe__default.default(...validations);
|
505
558
|
switch (attribute.type) {
|
506
559
|
case "component": {
|
@@ -510,12 +563,12 @@ const createYupSchema = (attributes = {}, components = {}) => {
|
|
510
563
|
...acc,
|
511
564
|
[name]: transformSchema(
|
512
565
|
yup__namespace.array().of(createModelSchema(attributes3).nullable(false))
|
513
|
-
)
|
566
|
+
).test(arrayValidator(attribute, options))
|
514
567
|
};
|
515
568
|
} else {
|
516
569
|
return {
|
517
570
|
...acc,
|
518
|
-
[name]: transformSchema(createModelSchema(attributes3))
|
571
|
+
[name]: transformSchema(createModelSchema(attributes3).nullable())
|
519
572
|
};
|
520
573
|
}
|
521
574
|
}
|
@@ -537,7 +590,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
|
|
537
590
|
}
|
538
591
|
)
|
539
592
|
)
|
540
|
-
)
|
593
|
+
).test(arrayValidator(attribute, options))
|
541
594
|
};
|
542
595
|
case "relation":
|
543
596
|
return {
|
@@ -549,7 +602,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
|
|
549
602
|
} else if (Array.isArray(value)) {
|
550
603
|
return yup__namespace.array().of(
|
551
604
|
yup__namespace.object().shape({
|
552
|
-
id: yup__namespace.
|
605
|
+
id: yup__namespace.number().required()
|
553
606
|
})
|
554
607
|
);
|
555
608
|
} else if (typeof value === "object") {
|
@@ -601,6 +654,14 @@ const createAttributeSchema = (attribute) => {
|
|
601
654
|
if (!value || typeof value === "string" && value.length === 0) {
|
602
655
|
return true;
|
603
656
|
}
|
657
|
+
if (typeof value === "object") {
|
658
|
+
try {
|
659
|
+
JSON.stringify(value);
|
660
|
+
return true;
|
661
|
+
} catch (err) {
|
662
|
+
return false;
|
663
|
+
}
|
664
|
+
}
|
604
665
|
try {
|
605
666
|
JSON.parse(value);
|
606
667
|
return true;
|
@@ -619,13 +680,7 @@ const createAttributeSchema = (attribute) => {
|
|
619
680
|
return yup__namespace.mixed();
|
620
681
|
}
|
621
682
|
};
|
622
|
-
const
|
623
|
-
if (attribute.required) {
|
624
|
-
return schema.required({
|
625
|
-
id: strapiAdmin.translatedErrors.required.id,
|
626
|
-
defaultMessage: "This field is required."
|
627
|
-
});
|
628
|
-
}
|
683
|
+
const nullableSchema = (schema) => {
|
629
684
|
return schema?.nullable ? schema.nullable() : (
|
630
685
|
// In some cases '.nullable' will not be available on the schema.
|
631
686
|
// e.g. when the schema has been built using yup.lazy (e.g. for relations).
|
@@ -633,7 +688,22 @@ const addRequiredValidation = (attribute) => (schema) => {
|
|
633
688
|
schema
|
634
689
|
);
|
635
690
|
};
|
636
|
-
const
|
691
|
+
const addNullableValidation = () => (schema) => {
|
692
|
+
return nullableSchema(schema);
|
693
|
+
};
|
694
|
+
const addRequiredValidation = (attribute, options) => (schema) => {
|
695
|
+
if (options.status === "draft" || !attribute.required) {
|
696
|
+
return schema;
|
697
|
+
}
|
698
|
+
if (attribute.required && "required" in schema) {
|
699
|
+
return schema.required(strapiAdmin.translatedErrors.required);
|
700
|
+
}
|
701
|
+
return schema;
|
702
|
+
};
|
703
|
+
const addMinLengthValidation = (attribute, options) => (schema) => {
|
704
|
+
if (options.status === "draft") {
|
705
|
+
return schema;
|
706
|
+
}
|
637
707
|
if ("minLength" in attribute && attribute.minLength && Number.isInteger(attribute.minLength) && "min" in schema) {
|
638
708
|
return schema.min(attribute.minLength, {
|
639
709
|
...strapiAdmin.translatedErrors.minLength,
|
@@ -655,10 +725,13 @@ const addMaxLengthValidation = (attribute) => (schema) => {
|
|
655
725
|
}
|
656
726
|
return schema;
|
657
727
|
};
|
658
|
-
const addMinValidation = (attribute) => (schema) => {
|
659
|
-
if ("
|
728
|
+
const addMinValidation = (attribute, options) => (schema) => {
|
729
|
+
if (options.status === "draft") {
|
730
|
+
return schema;
|
731
|
+
}
|
732
|
+
if ("min" in attribute && "min" in schema) {
|
660
733
|
const min = toInteger(attribute.min);
|
661
|
-
if (
|
734
|
+
if (min) {
|
662
735
|
return schema.min(min, {
|
663
736
|
...strapiAdmin.translatedErrors.min,
|
664
737
|
values: {
|
@@ -776,16 +849,115 @@ const extractContentTypeComponents = (attributes = {}, allComponents = {}) => {
|
|
776
849
|
}, {});
|
777
850
|
return componentsByKey;
|
778
851
|
};
|
779
|
-
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);
|
780
951
|
const { toggleNotification } = strapiAdmin.useNotification();
|
781
952
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
953
|
+
const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
|
782
954
|
const {
|
783
|
-
|
784
|
-
isLoading:
|
785
|
-
|
786
|
-
|
787
|
-
} =
|
788
|
-
const
|
955
|
+
data,
|
956
|
+
isLoading: isLoadingConfigs,
|
957
|
+
error,
|
958
|
+
isFetching: isFetchingConfigs
|
959
|
+
} = useGetContentTypeConfigurationQuery(model);
|
960
|
+
const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
|
789
961
|
React__namespace.useEffect(() => {
|
790
962
|
if (error) {
|
791
963
|
toggleNotification({
|
@@ -793,39 +965,255 @@ const useDocument = (args, opts) => {
|
|
793
965
|
message: formatAPIError(error)
|
794
966
|
});
|
795
967
|
}
|
796
|
-
}, [
|
797
|
-
const
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
(document) => {
|
805
|
-
if (!validationSchema) {
|
806
|
-
throw new Error(
|
807
|
-
"There is no validation schema generated, this is likely due to the schema not being loaded yet."
|
808
|
-
);
|
809
|
-
}
|
810
|
-
try {
|
811
|
-
validationSchema.validateSync(document, { abortEarly: false, strict: true });
|
812
|
-
return null;
|
813
|
-
} catch (error2) {
|
814
|
-
if (error2 instanceof yup.ValidationError) {
|
815
|
-
return strapiAdmin.getYupValidationErrors(error2);
|
816
|
-
}
|
817
|
-
throw error2;
|
818
|
-
}
|
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
|
819
976
|
},
|
820
|
-
[
|
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]
|
821
993
|
);
|
822
|
-
const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
|
823
994
|
return {
|
824
|
-
|
825
|
-
document: data?.data,
|
826
|
-
meta: data?.meta,
|
995
|
+
error,
|
827
996
|
isLoading,
|
997
|
+
edit,
|
998
|
+
list: listLayout
|
999
|
+
};
|
1000
|
+
};
|
1001
|
+
const useDocLayout = () => {
|
1002
|
+
const { model } = useDoc();
|
1003
|
+
return useDocumentLayout(model);
|
1004
|
+
};
|
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,
|
828
1215
|
schema,
|
1216
|
+
schemas,
|
829
1217
|
validate
|
830
1218
|
};
|
831
1219
|
};
|
@@ -839,22 +1227,60 @@ const useDoc = () => {
|
|
839
1227
|
if (!slug) {
|
840
1228
|
throw new Error("Could not find model in url params");
|
841
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;
|
842
1237
|
return {
|
843
1238
|
collectionType,
|
844
1239
|
model: slug,
|
845
|
-
id:
|
846
|
-
...
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
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
|
852
1281
|
};
|
853
1282
|
};
|
854
1283
|
const prefixPluginTranslations = (trad, pluginId) => {
|
855
|
-
if (!pluginId) {
|
856
|
-
throw new TypeError("pluginId can't be empty");
|
857
|
-
}
|
858
1284
|
return Object.keys(trad).reduce((acc, current) => {
|
859
1285
|
acc[`${pluginId}.${current}`] = trad[current];
|
860
1286
|
return acc;
|
@@ -870,6 +1296,8 @@ const useDocumentActions = () => {
|
|
870
1296
|
const { formatMessage } = reactIntl.useIntl();
|
871
1297
|
const { trackUsage } = strapiAdmin.useTracking();
|
872
1298
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
1299
|
+
const navigate = reactRouterDom.useNavigate();
|
1300
|
+
const setCurrentStep = strapiAdmin.useGuidedTour("useDocumentActions", (state) => state.setCurrentStep);
|
873
1301
|
const [deleteDocument] = useDeleteDocumentMutation();
|
874
1302
|
const _delete = React__namespace.useCallback(
|
875
1303
|
async ({ collectionType, model, documentId, params }, trackerProperty) => {
|
@@ -1184,6 +1612,7 @@ const useDocumentActions = () => {
|
|
1184
1612
|
defaultMessage: "Saved document"
|
1185
1613
|
})
|
1186
1614
|
});
|
1615
|
+
setCurrentStep("contentManager.success");
|
1187
1616
|
return res.data;
|
1188
1617
|
} catch (err) {
|
1189
1618
|
toggleNotification({
|
@@ -1205,7 +1634,6 @@ const useDocumentActions = () => {
|
|
1205
1634
|
sourceId
|
1206
1635
|
});
|
1207
1636
|
if ("error" in res) {
|
1208
|
-
toggleNotification({ type: "danger", message: formatAPIError(res.error) });
|
1209
1637
|
return { error: res.error };
|
1210
1638
|
}
|
1211
1639
|
toggleNotification({
|
@@ -1224,7 +1652,7 @@ const useDocumentActions = () => {
|
|
1224
1652
|
throw err;
|
1225
1653
|
}
|
1226
1654
|
},
|
1227
|
-
[autoCloneDocument,
|
1655
|
+
[autoCloneDocument, formatMessage, toggleNotification]
|
1228
1656
|
);
|
1229
1657
|
const [cloneDocument] = useCloneDocumentMutation();
|
1230
1658
|
const clone = React__namespace.useCallback(
|
@@ -1250,6 +1678,7 @@ const useDocumentActions = () => {
|
|
1250
1678
|
defaultMessage: "Cloned document"
|
1251
1679
|
})
|
1252
1680
|
});
|
1681
|
+
navigate(`../../${res.data.data.documentId}`, { relative: "path" });
|
1253
1682
|
return res.data;
|
1254
1683
|
} catch (err) {
|
1255
1684
|
toggleNotification({
|
@@ -1260,7 +1689,7 @@ const useDocumentActions = () => {
|
|
1260
1689
|
throw err;
|
1261
1690
|
}
|
1262
1691
|
},
|
1263
|
-
[cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError]
|
1692
|
+
[cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError, navigate]
|
1264
1693
|
);
|
1265
1694
|
const [getDoc] = useLazyGetDocumentQuery();
|
1266
1695
|
const getDocument = React__namespace.useCallback(
|
@@ -1285,10 +1714,10 @@ const useDocumentActions = () => {
|
|
1285
1714
|
update
|
1286
1715
|
};
|
1287
1716
|
};
|
1288
|
-
const ProtectedHistoryPage =
|
1289
|
-
() => Promise.resolve().then(() => require("./History-
|
1717
|
+
const ProtectedHistoryPage = React__namespace.lazy(
|
1718
|
+
() => Promise.resolve().then(() => require("./History-wjcK4L0C.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1290
1719
|
);
|
1291
|
-
const routes$
|
1720
|
+
const routes$2 = [
|
1292
1721
|
{
|
1293
1722
|
path: ":collectionType/:slug/:id/history",
|
1294
1723
|
Component: ProtectedHistoryPage
|
@@ -1298,32 +1727,45 @@ const routes$1 = [
|
|
1298
1727
|
Component: ProtectedHistoryPage
|
1299
1728
|
}
|
1300
1729
|
];
|
1730
|
+
const ProtectedPreviewPage = React__namespace.lazy(
|
1731
|
+
() => Promise.resolve().then(() => require("./Preview-DaOihysv.js")).then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1732
|
+
);
|
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
|
+
];
|
1301
1743
|
const ProtectedEditViewPage = React.lazy(
|
1302
|
-
() => Promise.resolve().then(() => require("./EditViewPage-
|
1744
|
+
() => Promise.resolve().then(() => require("./EditViewPage-B-kExt8C.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1303
1745
|
);
|
1304
1746
|
const ProtectedListViewPage = React.lazy(
|
1305
|
-
() => Promise.resolve().then(() => require("./ListViewPage-
|
1747
|
+
() => Promise.resolve().then(() => require("./ListViewPage-D5NY9183.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1306
1748
|
);
|
1307
1749
|
const ProtectedListConfiguration = React.lazy(
|
1308
|
-
() => Promise.resolve().then(() => require("./ListConfigurationPage-
|
1750
|
+
() => Promise.resolve().then(() => require("./ListConfigurationPage-CRbxIC3J.js")).then((mod) => ({
|
1309
1751
|
default: mod.ProtectedListConfiguration
|
1310
1752
|
}))
|
1311
1753
|
);
|
1312
1754
|
const ProtectedEditConfigurationPage = React.lazy(
|
1313
|
-
() => Promise.resolve().then(() => require("./EditConfigurationPage-
|
1755
|
+
() => Promise.resolve().then(() => require("./EditConfigurationPage-RQkymxCy.js")).then((mod) => ({
|
1314
1756
|
default: mod.ProtectedEditConfigurationPage
|
1315
1757
|
}))
|
1316
1758
|
);
|
1317
1759
|
const ProtectedComponentConfigurationPage = React.lazy(
|
1318
|
-
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-
|
1760
|
+
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-BLWQy8ru.js")).then((mod) => ({
|
1319
1761
|
default: mod.ProtectedComponentConfigurationPage
|
1320
1762
|
}))
|
1321
1763
|
);
|
1322
1764
|
const NoPermissions = React.lazy(
|
1323
|
-
() => Promise.resolve().then(() => require("./NoPermissionsPage-
|
1765
|
+
() => Promise.resolve().then(() => require("./NoPermissionsPage-C5jwn70o.js")).then((mod) => ({ default: mod.NoPermissions }))
|
1324
1766
|
);
|
1325
1767
|
const NoContentType = React.lazy(
|
1326
|
-
() => Promise.resolve().then(() => require("./NoContentTypePage-
|
1768
|
+
() => Promise.resolve().then(() => require("./NoContentTypePage-BgQVE_Qb.js")).then((mod) => ({ default: mod.NoContentType }))
|
1327
1769
|
);
|
1328
1770
|
const CollectionTypePages = () => {
|
1329
1771
|
const { collectionType } = reactRouterDom.useParams();
|
@@ -1335,7 +1777,7 @@ const CollectionTypePages = () => {
|
|
1335
1777
|
const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
|
1336
1778
|
const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
|
1337
1779
|
const LIST_RELATIVE_PATH = ":collectionType/:slug";
|
1338
|
-
const LIST_PATH = `/content-manager
|
1780
|
+
const LIST_PATH = `/content-manager/collection-types/:slug`;
|
1339
1781
|
const routes = [
|
1340
1782
|
{
|
1341
1783
|
path: LIST_RELATIVE_PATH,
|
@@ -1369,6 +1811,7 @@ const routes = [
|
|
1369
1811
|
path: "no-content-types",
|
1370
1812
|
Component: NoContentType
|
1371
1813
|
},
|
1814
|
+
...routes$2,
|
1372
1815
|
...routes$1
|
1373
1816
|
];
|
1374
1817
|
const DocumentActions = ({ actions: actions2 }) => {
|
@@ -1437,12 +1880,14 @@ const DocumentActionButton = (action) => {
|
|
1437
1880
|
/* @__PURE__ */ jsxRuntime.jsx(
|
1438
1881
|
designSystem.Button,
|
1439
1882
|
{
|
1440
|
-
flex:
|
1883
|
+
flex: "auto",
|
1441
1884
|
startIcon: action.icon,
|
1442
1885
|
disabled: action.disabled,
|
1443
1886
|
onClick: handleClick(action),
|
1444
1887
|
justifyContent: "center",
|
1445
1888
|
variant: action.variant || "default",
|
1889
|
+
paddingTop: "7px",
|
1890
|
+
paddingBottom: "7px",
|
1446
1891
|
children: action.label
|
1447
1892
|
}
|
1448
1893
|
),
|
@@ -1450,7 +1895,7 @@ const DocumentActionButton = (action) => {
|
|
1450
1895
|
DocumentActionConfirmDialog,
|
1451
1896
|
{
|
1452
1897
|
...action.dialog,
|
1453
|
-
variant: action.variant,
|
1898
|
+
variant: action.dialog?.variant ?? action.variant,
|
1454
1899
|
isOpen: dialogId === action.id,
|
1455
1900
|
onClose: handleClose
|
1456
1901
|
}
|
@@ -1465,6 +1910,11 @@ const DocumentActionButton = (action) => {
|
|
1465
1910
|
) : null
|
1466
1911
|
] });
|
1467
1912
|
};
|
1913
|
+
const MenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
1914
|
+
&:hover {
|
1915
|
+
background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
|
1916
|
+
}
|
1917
|
+
`;
|
1468
1918
|
const DocumentActionsMenu = ({
|
1469
1919
|
actions: actions2,
|
1470
1920
|
children,
|
@@ -1507,9 +1957,9 @@ const DocumentActionsMenu = ({
|
|
1507
1957
|
disabled: isDisabled,
|
1508
1958
|
size: "S",
|
1509
1959
|
endIcon: null,
|
1510
|
-
paddingTop: "
|
1511
|
-
paddingLeft: "
|
1512
|
-
paddingRight: "
|
1960
|
+
paddingTop: "4px",
|
1961
|
+
paddingLeft: "7px",
|
1962
|
+
paddingRight: "7px",
|
1513
1963
|
variant,
|
1514
1964
|
children: [
|
1515
1965
|
/* @__PURE__ */ jsxRuntime.jsx(Icons.More, { "aria-hidden": true, focusable: false }),
|
@@ -1520,36 +1970,35 @@ const DocumentActionsMenu = ({
|
|
1520
1970
|
]
|
1521
1971
|
}
|
1522
1972
|
),
|
1523
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, {
|
1973
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1524
1974
|
actions2.map((action) => {
|
1525
1975
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
1526
|
-
|
1976
|
+
MenuItem,
|
1527
1977
|
{
|
1528
1978
|
disabled: action.disabled,
|
1529
1979
|
onSelect: handleClick(action),
|
1530
1980
|
display: "block",
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
] })
|
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
|
+
) })
|
1553
2002
|
},
|
1554
2003
|
action.id
|
1555
2004
|
);
|
@@ -1591,6 +2040,18 @@ const convertActionVariantToColor = (variant = "secondary") => {
|
|
1591
2040
|
return "primary600";
|
1592
2041
|
}
|
1593
2042
|
};
|
2043
|
+
const convertActionVariantToIconColor = (variant = "secondary") => {
|
2044
|
+
switch (variant) {
|
2045
|
+
case "danger":
|
2046
|
+
return "danger600";
|
2047
|
+
case "secondary":
|
2048
|
+
return "neutral500";
|
2049
|
+
case "success":
|
2050
|
+
return "success600";
|
2051
|
+
default:
|
2052
|
+
return "primary600";
|
2053
|
+
}
|
2054
|
+
};
|
1594
2055
|
const DocumentActionConfirmDialog = ({
|
1595
2056
|
onClose,
|
1596
2057
|
onCancel,
|
@@ -1617,11 +2078,11 @@ const DocumentActionConfirmDialog = ({
|
|
1617
2078
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
|
1618
2079
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: content }),
|
1619
2080
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
|
1620
|
-
/* @__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({
|
1621
2082
|
id: "app.components.Button.cancel",
|
1622
2083
|
defaultMessage: "Cancel"
|
1623
2084
|
}) }) }),
|
1624
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleConfirm, variant, children: formatMessage({
|
2085
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleConfirm, variant, fullWidth: true, children: formatMessage({
|
1625
2086
|
id: "app.components.Button.confirm",
|
1626
2087
|
defaultMessage: "Confirm"
|
1627
2088
|
}) })
|
@@ -1648,6 +2109,18 @@ const DocumentActionModal = ({
|
|
1648
2109
|
typeof Footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { onClose: handleClose }) : Footer
|
1649
2110
|
] }) });
|
1650
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
|
+
};
|
1651
2124
|
const PublishAction$1 = ({
|
1652
2125
|
activeTab,
|
1653
2126
|
documentId,
|
@@ -1660,13 +2133,18 @@ const PublishAction$1 = ({
|
|
1660
2133
|
const navigate = reactRouterDom.useNavigate();
|
1661
2134
|
const { toggleNotification } = strapiAdmin.useNotification();
|
1662
2135
|
const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
|
2136
|
+
const isListView = reactRouterDom.useMatch(LIST_PATH) !== null;
|
1663
2137
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2138
|
+
const { id } = reactRouterDom.useParams();
|
1664
2139
|
const { formatMessage } = reactIntl.useIntl();
|
1665
|
-
const { canPublish
|
1666
|
-
"PublishAction",
|
1667
|
-
({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
|
1668
|
-
);
|
2140
|
+
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
1669
2141
|
const { publish } = useDocumentActions();
|
2142
|
+
const [
|
2143
|
+
countDraftRelations,
|
2144
|
+
{ isLoading: isLoadingDraftRelations, isError: isErrorDraftRelations }
|
2145
|
+
] = useLazyGetDraftRelationCountQuery();
|
2146
|
+
const [localCountOfDraftRelations, setLocalCountOfDraftRelations] = React__namespace.useState(0);
|
2147
|
+
const [serverCountOfDraftRelations, setServerCountOfDraftRelations] = React__namespace.useState(0);
|
1670
2148
|
const [{ query, rawQuery }] = strapiAdmin.useQueryParams();
|
1671
2149
|
const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
|
1672
2150
|
const modified = strapiAdmin.useForm("PublishAction", ({ modified: modified2 }) => modified2);
|
@@ -1675,10 +2153,107 @@ const PublishAction$1 = ({
|
|
1675
2153
|
const validate = strapiAdmin.useForm("PublishAction", (state) => state.validate);
|
1676
2154
|
const setErrors = strapiAdmin.useForm("PublishAction", (state) => state.setErrors);
|
1677
2155
|
const formValues = strapiAdmin.useForm("PublishAction", ({ values }) => values);
|
2156
|
+
React__namespace.useEffect(() => {
|
2157
|
+
if (isErrorDraftRelations) {
|
2158
|
+
toggleNotification({
|
2159
|
+
type: "danger",
|
2160
|
+
message: formatMessage({
|
2161
|
+
id: getTranslation("error.records.fetch-draft-relatons"),
|
2162
|
+
defaultMessage: "An error occurred while fetching draft relations on this document."
|
2163
|
+
})
|
2164
|
+
});
|
2165
|
+
}
|
2166
|
+
}, [isErrorDraftRelations, toggleNotification, formatMessage]);
|
2167
|
+
React__namespace.useEffect(() => {
|
2168
|
+
const localDraftRelations = /* @__PURE__ */ new Set();
|
2169
|
+
const extractDraftRelations = (data) => {
|
2170
|
+
const relations = data.connect || [];
|
2171
|
+
relations.forEach((relation) => {
|
2172
|
+
if (relation.status === "draft") {
|
2173
|
+
localDraftRelations.add(relation.id);
|
2174
|
+
}
|
2175
|
+
});
|
2176
|
+
};
|
2177
|
+
const traverseAndExtract = (data) => {
|
2178
|
+
Object.entries(data).forEach(([key, value]) => {
|
2179
|
+
if (key === "connect" && Array.isArray(value)) {
|
2180
|
+
extractDraftRelations({ connect: value });
|
2181
|
+
} else if (typeof value === "object" && value !== null) {
|
2182
|
+
traverseAndExtract(value);
|
2183
|
+
}
|
2184
|
+
});
|
2185
|
+
};
|
2186
|
+
if (!documentId || modified) {
|
2187
|
+
traverseAndExtract(formValues);
|
2188
|
+
setLocalCountOfDraftRelations(localDraftRelations.size);
|
2189
|
+
}
|
2190
|
+
}, [documentId, modified, formValues, setLocalCountOfDraftRelations]);
|
2191
|
+
React__namespace.useEffect(() => {
|
2192
|
+
if (!document || !document.documentId || isListView) {
|
2193
|
+
return;
|
2194
|
+
}
|
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]);
|
1678
2211
|
const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
|
1679
2212
|
if (!schema?.options?.draftAndPublish) {
|
1680
2213
|
return null;
|
1681
2214
|
}
|
2215
|
+
const performPublish = async () => {
|
2216
|
+
setSubmitting(true);
|
2217
|
+
try {
|
2218
|
+
const { errors } = await validate(true, {
|
2219
|
+
status: "published"
|
2220
|
+
});
|
2221
|
+
if (errors) {
|
2222
|
+
toggleNotification({
|
2223
|
+
type: "danger",
|
2224
|
+
message: formatMessage({
|
2225
|
+
id: "content-manager.validation.error",
|
2226
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2227
|
+
})
|
2228
|
+
});
|
2229
|
+
return;
|
2230
|
+
}
|
2231
|
+
const res = await publish(
|
2232
|
+
{
|
2233
|
+
collectionType,
|
2234
|
+
model,
|
2235
|
+
documentId,
|
2236
|
+
params
|
2237
|
+
},
|
2238
|
+
transformData(formValues)
|
2239
|
+
);
|
2240
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2241
|
+
if (id === "create") {
|
2242
|
+
navigate({
|
2243
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2244
|
+
search: rawQuery
|
2245
|
+
});
|
2246
|
+
}
|
2247
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2248
|
+
setErrors(formatValidationErrors(res.error));
|
2249
|
+
}
|
2250
|
+
} finally {
|
2251
|
+
setSubmitting(false);
|
2252
|
+
}
|
2253
|
+
};
|
2254
|
+
const totalDraftRelations = localCountOfDraftRelations + serverCountOfDraftRelations;
|
2255
|
+
const enableDraftRelationsCount = false;
|
2256
|
+
const hasDraftRelations = enableDraftRelationsCount;
|
1682
2257
|
return {
|
1683
2258
|
/**
|
1684
2259
|
* Disabled when:
|
@@ -1688,52 +2263,40 @@ const PublishAction$1 = ({
|
|
1688
2263
|
* - the document is already published & not modified
|
1689
2264
|
* - the document is being created & not modified
|
1690
2265
|
* - the user doesn't have the permission to publish
|
1691
|
-
* - the user doesn't have the permission to create a new document
|
1692
|
-
* - the user doesn't have the permission to update the document
|
1693
2266
|
*/
|
1694
|
-
disabled: isCloning || isSubmitting || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish
|
2267
|
+
disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish,
|
1695
2268
|
label: formatMessage({
|
1696
2269
|
id: "app.utils.publish",
|
1697
2270
|
defaultMessage: "Publish"
|
1698
2271
|
}),
|
1699
2272
|
onClick: async () => {
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
documentId,
|
1718
|
-
params
|
1719
|
-
},
|
1720
|
-
formValues
|
1721
|
-
);
|
1722
|
-
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1723
|
-
navigate({
|
1724
|
-
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
1725
|
-
search: rawQuery
|
1726
|
-
});
|
1727
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1728
|
-
setErrors(formatValidationErrors(res.error));
|
2273
|
+
await performPublish();
|
2274
|
+
},
|
2275
|
+
dialog: hasDraftRelations ? {
|
2276
|
+
type: "dialog",
|
2277
|
+
variant: "danger",
|
2278
|
+
footer: null,
|
2279
|
+
title: formatMessage({
|
2280
|
+
id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.title`),
|
2281
|
+
defaultMessage: "Confirmation"
|
2282
|
+
}),
|
2283
|
+
content: formatMessage(
|
2284
|
+
{
|
2285
|
+
id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.message`),
|
2286
|
+
defaultMessage: "This entry is related to {count, plural, one {# draft entry} other {# draft entries}}. Publishing it could leave broken links in your app."
|
2287
|
+
},
|
2288
|
+
{
|
2289
|
+
count: totalDraftRelations
|
1729
2290
|
}
|
1730
|
-
|
1731
|
-
|
2291
|
+
),
|
2292
|
+
onConfirm: async () => {
|
2293
|
+
await performPublish();
|
1732
2294
|
}
|
1733
|
-
}
|
2295
|
+
} : void 0
|
1734
2296
|
};
|
1735
2297
|
};
|
1736
2298
|
PublishAction$1.type = "publish";
|
2299
|
+
PublishAction$1.position = "panel";
|
1737
2300
|
const UpdateAction = ({
|
1738
2301
|
activeTab,
|
1739
2302
|
documentId,
|
@@ -1746,10 +2309,6 @@ const UpdateAction = ({
|
|
1746
2309
|
const cloneMatch = reactRouterDom.useMatch(CLONE_PATH);
|
1747
2310
|
const isCloning = cloneMatch !== null;
|
1748
2311
|
const { formatMessage } = reactIntl.useIntl();
|
1749
|
-
const { canCreate, canUpdate } = useDocumentRBAC("UpdateAction", ({ canCreate: canCreate2, canUpdate: canUpdate2 }) => ({
|
1750
|
-
canCreate: canCreate2,
|
1751
|
-
canUpdate: canUpdate2
|
1752
|
-
}));
|
1753
2312
|
const { create, update, clone } = useDocumentActions();
|
1754
2313
|
const [{ query, rawQuery }] = strapiAdmin.useQueryParams();
|
1755
2314
|
const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
|
@@ -1760,90 +2319,134 @@ const UpdateAction = ({
|
|
1760
2319
|
const validate = strapiAdmin.useForm("UpdateAction", (state) => state.validate);
|
1761
2320
|
const setErrors = strapiAdmin.useForm("UpdateAction", (state) => state.setErrors);
|
1762
2321
|
const resetForm = strapiAdmin.useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
|
1763
|
-
|
1764
|
-
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
}
|
1789
|
-
|
1790
|
-
|
1791
|
-
if (
|
1792
|
-
|
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(
|
1793
2352
|
{
|
1794
|
-
|
1795
|
-
documentId: cloneMatch.params.origin,
|
1796
|
-
params
|
1797
|
-
},
|
1798
|
-
document
|
1799
|
-
);
|
1800
|
-
if ("data" in res) {
|
1801
|
-
navigate({
|
1802
|
-
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2353
|
+
pathname: `../${res.data.documentId}`,
|
1803
2354
|
search: rawQuery
|
1804
|
-
});
|
1805
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1806
|
-
setErrors(formatValidationErrors(res.error));
|
1807
|
-
}
|
1808
|
-
} else if (documentId || collectionType === SINGLE_TYPES) {
|
1809
|
-
const res = await update(
|
1810
|
-
{
|
1811
|
-
collectionType,
|
1812
|
-
model,
|
1813
|
-
documentId,
|
1814
|
-
params
|
1815
2355
|
},
|
1816
|
-
|
2356
|
+
{ relative: "path" }
|
1817
2357
|
);
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
|
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));
|
1823
2373
|
} else {
|
1824
|
-
|
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(
|
1825
2386
|
{
|
1826
|
-
|
1827
|
-
|
2387
|
+
pathname: `../${res.data.documentId}`,
|
2388
|
+
search: rawQuery
|
1828
2389
|
},
|
1829
|
-
|
2390
|
+
{ replace: true, relative: "path" }
|
1830
2391
|
);
|
1831
|
-
|
1832
|
-
|
1833
|
-
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
1834
|
-
search: rawQuery
|
1835
|
-
});
|
1836
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1837
|
-
setErrors(formatValidationErrors(res.error));
|
1838
|
-
}
|
2392
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2393
|
+
setErrors(formatValidationErrors(res.error));
|
1839
2394
|
}
|
1840
|
-
} finally {
|
1841
|
-
setSubmitting(false);
|
1842
2395
|
}
|
2396
|
+
} finally {
|
2397
|
+
setSubmitting(false);
|
1843
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]);
|
2433
|
+
return {
|
2434
|
+
/**
|
2435
|
+
* Disabled when:
|
2436
|
+
* - the form is submitting
|
2437
|
+
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
2438
|
+
* - the active tab is the published tab
|
2439
|
+
*/
|
2440
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
2441
|
+
label: formatMessage({
|
2442
|
+
id: "global.save",
|
2443
|
+
defaultMessage: "Save"
|
2444
|
+
}),
|
2445
|
+
onClick: handleUpdate
|
1844
2446
|
};
|
1845
2447
|
};
|
1846
2448
|
UpdateAction.type = "update";
|
2449
|
+
UpdateAction.position = "panel";
|
1847
2450
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
1848
2451
|
KEEP: "keep",
|
1849
2452
|
DISCARD: "discard"
|
@@ -1876,7 +2479,7 @@ const UnpublishAction$1 = ({
|
|
1876
2479
|
id: "app.utils.unpublish",
|
1877
2480
|
defaultMessage: "Unpublish"
|
1878
2481
|
}),
|
1879
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
2482
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Cross, {}),
|
1880
2483
|
onClick: async () => {
|
1881
2484
|
if (!documentId && collectionType !== SINGLE_TYPES || isDocumentModified) {
|
1882
2485
|
if (!documentId) {
|
@@ -1966,6 +2569,7 @@ const UnpublishAction$1 = ({
|
|
1966
2569
|
};
|
1967
2570
|
};
|
1968
2571
|
UnpublishAction$1.type = "unpublish";
|
2572
|
+
UnpublishAction$1.position = "panel";
|
1969
2573
|
const DiscardAction = ({
|
1970
2574
|
activeTab,
|
1971
2575
|
documentId,
|
@@ -1988,7 +2592,7 @@ const DiscardAction = ({
|
|
1988
2592
|
id: "content-manager.actions.discard.label",
|
1989
2593
|
defaultMessage: "Discard changes"
|
1990
2594
|
}),
|
1991
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
2595
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Cross, {}),
|
1992
2596
|
position: ["panel", "table-row"],
|
1993
2597
|
variant: "danger",
|
1994
2598
|
dialog: {
|
@@ -2016,11 +2620,7 @@ const DiscardAction = ({
|
|
2016
2620
|
};
|
2017
2621
|
};
|
2018
2622
|
DiscardAction.type = "discard";
|
2019
|
-
|
2020
|
-
path {
|
2021
|
-
fill: currentColor;
|
2022
|
-
}
|
2023
|
-
`;
|
2623
|
+
DiscardAction.position = "panel";
|
2024
2624
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2025
2625
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2026
2626
|
const RelativeTime = React__namespace.forwardRef(
|
@@ -2033,7 +2633,7 @@ const RelativeTime = React__namespace.forwardRef(
|
|
2033
2633
|
});
|
2034
2634
|
const unit = intervals.find((intervalUnit) => {
|
2035
2635
|
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
2036
|
-
});
|
2636
|
+
}) ?? "seconds";
|
2037
2637
|
const relativeTime = dateFns.isPast(timestamp) ? -interval[unit] : interval[unit];
|
2038
2638
|
const customInterval = customIntervals.find(
|
2039
2639
|
(custom) => interval[custom.unit] < custom.threshold
|
@@ -2067,34 +2667,34 @@ const getDisplayName = ({
|
|
2067
2667
|
return email ?? "";
|
2068
2668
|
};
|
2069
2669
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2070
|
-
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2071
|
-
const statusVariant = status === "draft" ? "
|
2072
|
-
|
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
|
+
}) }) });
|
2073
2677
|
};
|
2074
2678
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2075
2679
|
const { formatMessage } = reactIntl.useIntl();
|
2076
2680
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2681
|
+
const params = reactRouterDom.useParams();
|
2077
2682
|
const title = isCreating ? formatMessage({
|
2078
2683
|
id: "content-manager.containers.edit.title.new",
|
2079
2684
|
defaultMessage: "Create an entry"
|
2080
2685
|
}) : documentTitle;
|
2081
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop:
|
2082
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
2083
|
-
|
2084
|
-
designSystem.Flex,
|
2686
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2687
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
2688
|
+
strapiAdmin.BackButton,
|
2085
2689
|
{
|
2086
|
-
|
2087
|
-
justifyContent: "space-between",
|
2088
|
-
paddingTop: 1,
|
2089
|
-
gap: "80px",
|
2090
|
-
alignItems: "flex-start",
|
2091
|
-
children: [
|
2092
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
|
2093
|
-
/* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
|
2094
|
-
]
|
2690
|
+
fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
|
2095
2691
|
}
|
2096
2692
|
),
|
2097
|
-
|
2693
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2694
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
|
2695
|
+
/* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
|
2696
|
+
] }),
|
2697
|
+
status ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 1, children: /* @__PURE__ */ jsxRuntime.jsx(DocumentStatus, { status: isCloning ? "draft" : status }) }) : null
|
2098
2698
|
] });
|
2099
2699
|
};
|
2100
2700
|
const HeaderToolbar = () => {
|
@@ -2140,7 +2740,7 @@ const HeaderToolbar = () => {
|
|
2140
2740
|
meta: isCloning ? void 0 : meta,
|
2141
2741
|
collectionType
|
2142
2742
|
},
|
2143
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2743
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2144
2744
|
children: (actions2) => {
|
2145
2745
|
const headerActions = actions2.filter((action) => {
|
2146
2746
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2177,12 +2777,12 @@ const Information = ({ activeTab }) => {
|
|
2177
2777
|
isDisplayed: !!publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME],
|
2178
2778
|
label: formatMessage({
|
2179
2779
|
id: "content-manager.containers.edit.information.last-published.label",
|
2180
|
-
defaultMessage: "
|
2780
|
+
defaultMessage: "Published"
|
2181
2781
|
}),
|
2182
2782
|
value: formatMessage(
|
2183
2783
|
{
|
2184
2784
|
id: "content-manager.containers.edit.information.last-published.value",
|
2185
|
-
defaultMessage: `
|
2785
|
+
defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
|
2186
2786
|
},
|
2187
2787
|
{
|
2188
2788
|
time: /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME]) }),
|
@@ -2195,12 +2795,12 @@ const Information = ({ activeTab }) => {
|
|
2195
2795
|
isDisplayed: !!createAndUpdateDocument?.[UPDATED_AT_ATTRIBUTE_NAME],
|
2196
2796
|
label: formatMessage({
|
2197
2797
|
id: "content-manager.containers.edit.information.last-draft.label",
|
2198
|
-
defaultMessage: "
|
2798
|
+
defaultMessage: "Updated"
|
2199
2799
|
}),
|
2200
2800
|
value: formatMessage(
|
2201
2801
|
{
|
2202
2802
|
id: "content-manager.containers.edit.information.last-draft.value",
|
2203
|
-
defaultMessage: `
|
2803
|
+
defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
|
2204
2804
|
},
|
2205
2805
|
{
|
2206
2806
|
time: /* @__PURE__ */ jsxRuntime.jsx(
|
@@ -2218,12 +2818,12 @@ const Information = ({ activeTab }) => {
|
|
2218
2818
|
isDisplayed: !!createAndUpdateDocument?.[CREATED_AT_ATTRIBUTE_NAME],
|
2219
2819
|
label: formatMessage({
|
2220
2820
|
id: "content-manager.containers.edit.information.document.label",
|
2221
|
-
defaultMessage: "
|
2821
|
+
defaultMessage: "Created"
|
2222
2822
|
}),
|
2223
2823
|
value: formatMessage(
|
2224
2824
|
{
|
2225
2825
|
id: "content-manager.containers.edit.information.document.value",
|
2226
|
-
defaultMessage: `
|
2826
|
+
defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
|
2227
2827
|
},
|
2228
2828
|
{
|
2229
2829
|
time: /* @__PURE__ */ jsxRuntime.jsx(
|
@@ -2261,25 +2861,77 @@ const Information = ({ activeTab }) => {
|
|
2261
2861
|
);
|
2262
2862
|
};
|
2263
2863
|
const HeaderActions = ({ actions: actions2 }) => {
|
2264
|
-
|
2265
|
-
|
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) {
|
2266
2880
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
2267
2881
|
designSystem.SingleSelect,
|
2268
2882
|
{
|
2269
2883
|
size: "S",
|
2270
|
-
disabled: action.disabled,
|
2271
|
-
"aria-label": action.label,
|
2272
2884
|
onChange: action.onSelect,
|
2273
|
-
|
2885
|
+
"aria-label": action.label,
|
2886
|
+
...action,
|
2274
2887
|
children: action.options.map(({ label, ...option }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { ...option, children: label }, option.value))
|
2275
2888
|
},
|
2276
2889
|
action.id
|
2277
2890
|
);
|
2278
2891
|
} else {
|
2279
|
-
|
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
|
+
}
|
2280
2914
|
}
|
2281
2915
|
}) });
|
2282
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
|
+
};
|
2283
2935
|
const ConfigureTheViewAction = ({ collectionType, model }) => {
|
2284
2936
|
const navigate = reactRouterDom.useNavigate();
|
2285
2937
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2296,6 +2948,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2296
2948
|
};
|
2297
2949
|
};
|
2298
2950
|
ConfigureTheViewAction.type = "configure-the-view";
|
2951
|
+
ConfigureTheViewAction.position = "header";
|
2299
2952
|
const EditTheModelAction = ({ model }) => {
|
2300
2953
|
const navigate = reactRouterDom.useNavigate();
|
2301
2954
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2312,6 +2965,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2312
2965
|
};
|
2313
2966
|
};
|
2314
2967
|
EditTheModelAction.type = "edit-the-model";
|
2968
|
+
EditTheModelAction.position = "header";
|
2315
2969
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2316
2970
|
const navigate = reactRouterDom.useNavigate();
|
2317
2971
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2320,12 +2974,16 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2320
2974
|
const { delete: deleteAction } = useDocumentActions();
|
2321
2975
|
const { toggleNotification } = strapiAdmin.useNotification();
|
2322
2976
|
const setSubmitting = strapiAdmin.useForm("DeleteAction", (state) => state.setSubmitting);
|
2977
|
+
const isLocalized = document?.locale != null;
|
2323
2978
|
return {
|
2324
2979
|
disabled: !canDelete || !document,
|
2325
|
-
label: formatMessage(
|
2326
|
-
|
2327
|
-
|
2328
|
-
|
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
|
+
),
|
2329
2987
|
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {}),
|
2330
2988
|
dialog: {
|
2331
2989
|
type: "dialog",
|
@@ -2381,403 +3039,102 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2381
3039
|
};
|
2382
3040
|
};
|
2383
3041
|
DeleteAction$1.type = "delete";
|
3042
|
+
DeleteAction$1.position = ["header", "table-row"];
|
2384
3043
|
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2385
3044
|
const Panels = () => {
|
2386
3045
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2387
3046
|
const [
|
2388
3047
|
{
|
2389
|
-
query: { status }
|
2390
|
-
}
|
2391
|
-
] = strapiAdmin.useQueryParams({
|
2392
|
-
status: "draft"
|
2393
|
-
});
|
2394
|
-
const { model, id, document, meta, collectionType } = useDoc();
|
2395
|
-
const plugins = strapiAdmin.useStrapiApp("Panels", (state) => state.plugins);
|
2396
|
-
const props = {
|
2397
|
-
activeTab: status,
|
2398
|
-
model,
|
2399
|
-
documentId: id,
|
2400
|
-
document: isCloning ? void 0 : document,
|
2401
|
-
meta: isCloning ? void 0 : meta,
|
2402
|
-
collectionType
|
2403
|
-
};
|
2404
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
2405
|
-
strapiAdmin.DescriptionComponentRenderer,
|
2406
|
-
{
|
2407
|
-
props,
|
2408
|
-
descriptions: plugins["content-manager"].apis.getEditViewSidePanels(),
|
2409
|
-
children: (panels) => panels.map(({ content, id: id2, ...description }) => /* @__PURE__ */ jsxRuntime.jsx(Panel, { ...description, children: content }, id2))
|
2410
|
-
}
|
2411
|
-
) });
|
2412
|
-
};
|
2413
|
-
const ActionsPanel = () => {
|
2414
|
-
const { formatMessage } = reactIntl.useIntl();
|
2415
|
-
return {
|
2416
|
-
title: formatMessage({
|
2417
|
-
id: "content-manager.containers.edit.panels.default.title",
|
2418
|
-
defaultMessage: "Document"
|
2419
|
-
}),
|
2420
|
-
content: /* @__PURE__ */ jsxRuntime.jsx(ActionsPanelContent, {})
|
2421
|
-
};
|
2422
|
-
};
|
2423
|
-
ActionsPanel.type = "actions";
|
2424
|
-
const ActionsPanelContent = () => {
|
2425
|
-
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2426
|
-
const [
|
2427
|
-
{
|
2428
|
-
query: { status = "draft" }
|
2429
|
-
}
|
2430
|
-
] = strapiAdmin.useQueryParams();
|
2431
|
-
const { model, id, document, meta, collectionType } = useDoc();
|
2432
|
-
const plugins = strapiAdmin.useStrapiApp("ActionsPanel", (state) => state.plugins);
|
2433
|
-
const props = {
|
2434
|
-
activeTab: status,
|
2435
|
-
model,
|
2436
|
-
documentId: id,
|
2437
|
-
document: isCloning ? void 0 : document,
|
2438
|
-
meta: isCloning ? void 0 : meta,
|
2439
|
-
collectionType
|
2440
|
-
};
|
2441
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, width: "100%", children: [
|
2442
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
2443
|
-
strapiAdmin.DescriptionComponentRenderer,
|
2444
|
-
{
|
2445
|
-
props,
|
2446
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2447
|
-
children: (actions2) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActions, { actions: actions2 })
|
2448
|
-
}
|
2449
|
-
),
|
2450
|
-
/* @__PURE__ */ jsxRuntime.jsx(InjectionZone, { area: "editView.right-links", slug: model })
|
2451
|
-
] });
|
2452
|
-
};
|
2453
|
-
const Panel = React__namespace.forwardRef(({ children, title }, ref) => {
|
2454
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
2455
|
-
designSystem.Flex,
|
2456
|
-
{
|
2457
|
-
ref,
|
2458
|
-
tag: "aside",
|
2459
|
-
"aria-labelledby": "additional-information",
|
2460
|
-
background: "neutral0",
|
2461
|
-
borderColor: "neutral150",
|
2462
|
-
hasRadius: true,
|
2463
|
-
paddingBottom: 4,
|
2464
|
-
paddingLeft: 4,
|
2465
|
-
paddingRight: 4,
|
2466
|
-
paddingTop: 4,
|
2467
|
-
shadow: "tableShadow",
|
2468
|
-
gap: 3,
|
2469
|
-
direction: "column",
|
2470
|
-
justifyContent: "stretch",
|
2471
|
-
alignItems: "flex-start",
|
2472
|
-
children: [
|
2473
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
|
2474
|
-
children
|
2475
|
-
]
|
2476
|
-
}
|
2477
|
-
);
|
2478
|
-
});
|
2479
|
-
const HOOKS = {
|
2480
|
-
/**
|
2481
|
-
* Hook that allows to mutate the displayed headers of the list view table
|
2482
|
-
* @constant
|
2483
|
-
* @type {string}
|
2484
|
-
*/
|
2485
|
-
INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
|
2486
|
-
/**
|
2487
|
-
* Hook that allows to mutate the CM's collection types links pre-set filters
|
2488
|
-
* @constant
|
2489
|
-
* @type {string}
|
2490
|
-
*/
|
2491
|
-
MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
|
2492
|
-
/**
|
2493
|
-
* Hook that allows to mutate the CM's edit view layout
|
2494
|
-
* @constant
|
2495
|
-
* @type {string}
|
2496
|
-
*/
|
2497
|
-
MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
|
2498
|
-
/**
|
2499
|
-
* Hook that allows to mutate the CM's single types links pre-set filters
|
2500
|
-
* @constant
|
2501
|
-
* @type {string}
|
2502
|
-
*/
|
2503
|
-
MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
|
2504
|
-
};
|
2505
|
-
const contentTypesApi = contentManagerApi.injectEndpoints({
|
2506
|
-
endpoints: (builder) => ({
|
2507
|
-
getContentTypeConfiguration: builder.query({
|
2508
|
-
query: (uid) => ({
|
2509
|
-
url: `/content-manager/content-types/${uid}/configuration`,
|
2510
|
-
method: "GET"
|
2511
|
-
}),
|
2512
|
-
transformResponse: (response) => response.data,
|
2513
|
-
providesTags: (_result, _error, uid) => [
|
2514
|
-
{ type: "ContentTypesConfiguration", id: uid },
|
2515
|
-
{ type: "ContentTypeSettings", id: "LIST" }
|
2516
|
-
]
|
2517
|
-
}),
|
2518
|
-
getAllContentTypeSettings: builder.query({
|
2519
|
-
query: () => "/content-manager/content-types-settings",
|
2520
|
-
transformResponse: (response) => response.data,
|
2521
|
-
providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
|
2522
|
-
}),
|
2523
|
-
updateContentTypeConfiguration: builder.mutation({
|
2524
|
-
query: ({ uid, ...body }) => ({
|
2525
|
-
url: `/content-manager/content-types/${uid}/configuration`,
|
2526
|
-
method: "PUT",
|
2527
|
-
data: body
|
2528
|
-
}),
|
2529
|
-
transformResponse: (response) => response.data,
|
2530
|
-
invalidatesTags: (_result, _error, { uid }) => [
|
2531
|
-
{ type: "ContentTypesConfiguration", id: uid },
|
2532
|
-
{ type: "ContentTypeSettings", id: "LIST" },
|
2533
|
-
// Is this necessary?
|
2534
|
-
{ type: "InitialData" }
|
2535
|
-
]
|
2536
|
-
})
|
2537
|
-
})
|
2538
|
-
});
|
2539
|
-
const {
|
2540
|
-
useGetContentTypeConfigurationQuery,
|
2541
|
-
useGetAllContentTypeSettingsQuery,
|
2542
|
-
useUpdateContentTypeConfigurationMutation
|
2543
|
-
} = contentTypesApi;
|
2544
|
-
const checkIfAttributeIsDisplayable = (attribute) => {
|
2545
|
-
const { type } = attribute;
|
2546
|
-
if (type === "relation") {
|
2547
|
-
return !attribute.relation.toLowerCase().includes("morph");
|
2548
|
-
}
|
2549
|
-
return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
|
2550
|
-
};
|
2551
|
-
const getMainField = (attribute, mainFieldName, { schemas, components }) => {
|
2552
|
-
if (!mainFieldName) {
|
2553
|
-
return void 0;
|
2554
|
-
}
|
2555
|
-
const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
|
2556
|
-
// @ts-expect-error – `targetModel` does exist on the attribute for a relation.
|
2557
|
-
schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
|
2558
|
-
);
|
2559
|
-
return {
|
2560
|
-
name: mainFieldName,
|
2561
|
-
type: mainFieldType ?? "string"
|
2562
|
-
};
|
2563
|
-
};
|
2564
|
-
const DEFAULT_SETTINGS = {
|
2565
|
-
bulkable: false,
|
2566
|
-
filterable: false,
|
2567
|
-
searchable: false,
|
2568
|
-
pagination: false,
|
2569
|
-
defaultSortBy: "",
|
2570
|
-
defaultSortOrder: "asc",
|
2571
|
-
mainField: "id",
|
2572
|
-
pageSize: 10
|
2573
|
-
};
|
2574
|
-
const useDocumentLayout = (model) => {
|
2575
|
-
const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
|
2576
|
-
const [{ query }] = strapiAdmin.useQueryParams();
|
2577
|
-
const runHookWaterfall = strapiAdmin.useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
|
2578
|
-
const { toggleNotification } = strapiAdmin.useNotification();
|
2579
|
-
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
2580
|
-
const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
|
2581
|
-
const {
|
2582
|
-
data,
|
2583
|
-
isLoading: isLoadingConfigs,
|
2584
|
-
error,
|
2585
|
-
isFetching: isFetchingConfigs
|
2586
|
-
} = useGetContentTypeConfigurationQuery(model);
|
2587
|
-
const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
|
2588
|
-
React__namespace.useEffect(() => {
|
2589
|
-
if (error) {
|
2590
|
-
toggleNotification({
|
2591
|
-
type: "danger",
|
2592
|
-
message: formatAPIError(error)
|
2593
|
-
});
|
2594
|
-
}
|
2595
|
-
}, [error, formatAPIError, toggleNotification]);
|
2596
|
-
const editLayout = React__namespace.useMemo(
|
2597
|
-
() => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
|
2598
|
-
layout: [],
|
2599
|
-
components: {},
|
2600
|
-
metadatas: {},
|
2601
|
-
options: {},
|
2602
|
-
settings: DEFAULT_SETTINGS
|
2603
|
-
},
|
2604
|
-
[data, isLoading, schemas, schema, components]
|
2605
|
-
);
|
2606
|
-
const listLayout = React__namespace.useMemo(() => {
|
2607
|
-
return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
|
2608
|
-
layout: [],
|
2609
|
-
metadatas: {},
|
2610
|
-
options: {},
|
2611
|
-
settings: DEFAULT_SETTINGS
|
2612
|
-
};
|
2613
|
-
}, [data, isLoading, schemas, schema, components]);
|
2614
|
-
const { layout: edit } = React__namespace.useMemo(
|
2615
|
-
() => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
|
2616
|
-
layout: editLayout,
|
2617
|
-
query
|
2618
|
-
}),
|
2619
|
-
[editLayout, query, runHookWaterfall]
|
2620
|
-
);
|
2621
|
-
return {
|
2622
|
-
error,
|
2623
|
-
isLoading,
|
2624
|
-
edit,
|
2625
|
-
list: listLayout
|
2626
|
-
};
|
2627
|
-
};
|
2628
|
-
const useDocLayout = () => {
|
2629
|
-
const { model } = useDoc();
|
2630
|
-
return useDocumentLayout(model);
|
2631
|
-
};
|
2632
|
-
const formatEditLayout = (data, {
|
2633
|
-
schemas,
|
2634
|
-
schema,
|
2635
|
-
components
|
2636
|
-
}) => {
|
2637
|
-
let currentPanelIndex = 0;
|
2638
|
-
const panelledEditAttributes = convertEditLayoutToFieldLayouts(
|
2639
|
-
data.contentType.layouts.edit,
|
2640
|
-
schema?.attributes,
|
2641
|
-
data.contentType.metadatas,
|
2642
|
-
{ configurations: data.components, schemas: components },
|
2643
|
-
schemas
|
2644
|
-
).reduce((panels, row) => {
|
2645
|
-
if (row.some((field) => field.type === "dynamiczone")) {
|
2646
|
-
panels.push([row]);
|
2647
|
-
currentPanelIndex += 2;
|
2648
|
-
} else {
|
2649
|
-
if (!panels[currentPanelIndex]) {
|
2650
|
-
panels.push([]);
|
2651
|
-
}
|
2652
|
-
panels[currentPanelIndex].push(row);
|
2653
|
-
}
|
2654
|
-
return panels;
|
2655
|
-
}, []);
|
2656
|
-
const componentEditAttributes = Object.entries(data.components).reduce(
|
2657
|
-
(acc, [uid, configuration]) => {
|
2658
|
-
acc[uid] = {
|
2659
|
-
layout: convertEditLayoutToFieldLayouts(
|
2660
|
-
configuration.layouts.edit,
|
2661
|
-
components[uid].attributes,
|
2662
|
-
configuration.metadatas
|
2663
|
-
),
|
2664
|
-
settings: {
|
2665
|
-
...configuration.settings,
|
2666
|
-
icon: components[uid].info.icon,
|
2667
|
-
displayName: components[uid].info.displayName
|
2668
|
-
}
|
2669
|
-
};
|
2670
|
-
return acc;
|
2671
|
-
},
|
2672
|
-
{}
|
2673
|
-
);
|
2674
|
-
const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
|
2675
|
-
(acc, [attribute, metadata]) => {
|
2676
|
-
return {
|
2677
|
-
...acc,
|
2678
|
-
[attribute]: metadata.edit
|
2679
|
-
};
|
2680
|
-
},
|
2681
|
-
{}
|
2682
|
-
);
|
2683
|
-
return {
|
2684
|
-
layout: panelledEditAttributes,
|
2685
|
-
components: componentEditAttributes,
|
2686
|
-
metadatas: editMetadatas,
|
2687
|
-
settings: {
|
2688
|
-
...data.contentType.settings,
|
2689
|
-
displayName: schema?.info.displayName
|
2690
|
-
},
|
2691
|
-
options: {
|
2692
|
-
...schema?.options,
|
2693
|
-
...schema?.pluginOptions,
|
2694
|
-
...data.contentType.options
|
3048
|
+
query: { status }
|
2695
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
|
2696
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
|
+
) });
|
2697
3071
|
};
|
2698
|
-
const
|
2699
|
-
|
2700
|
-
(row) => row.map((field) => {
|
2701
|
-
const attribute = attributes[field.name];
|
2702
|
-
if (!attribute) {
|
2703
|
-
return null;
|
2704
|
-
}
|
2705
|
-
const { edit: metadata } = metadatas[field.name];
|
2706
|
-
const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
|
2707
|
-
return {
|
2708
|
-
attribute,
|
2709
|
-
disabled: !metadata.editable,
|
2710
|
-
hint: metadata.description,
|
2711
|
-
label: metadata.label ?? "",
|
2712
|
-
name: field.name,
|
2713
|
-
// @ts-expect-error – mainField does exist on the metadata for a relation.
|
2714
|
-
mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
|
2715
|
-
schemas,
|
2716
|
-
components: components?.schemas ?? {}
|
2717
|
-
}),
|
2718
|
-
placeholder: metadata.placeholder ?? "",
|
2719
|
-
required: attribute.required ?? false,
|
2720
|
-
size: field.size,
|
2721
|
-
unique: "unique" in attribute ? attribute.unique : false,
|
2722
|
-
visible: metadata.visible ?? true,
|
2723
|
-
type: attribute.type
|
2724
|
-
};
|
2725
|
-
}).filter((field) => field !== null)
|
2726
|
-
);
|
2727
|
-
};
|
2728
|
-
const formatListLayout = (data, {
|
2729
|
-
schemas,
|
2730
|
-
schema,
|
2731
|
-
components
|
2732
|
-
}) => {
|
2733
|
-
const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
|
2734
|
-
(acc, [attribute, metadata]) => {
|
2735
|
-
return {
|
2736
|
-
...acc,
|
2737
|
-
[attribute]: metadata.list
|
2738
|
-
};
|
2739
|
-
},
|
2740
|
-
{}
|
2741
|
-
);
|
2742
|
-
const listAttributes = convertListLayoutToFieldLayouts(
|
2743
|
-
data.contentType.layouts.list,
|
2744
|
-
schema?.attributes,
|
2745
|
-
listMetadatas,
|
2746
|
-
{ configurations: data.components, schemas: components },
|
2747
|
-
schemas
|
2748
|
-
);
|
3072
|
+
const ActionsPanel = () => {
|
3073
|
+
const { formatMessage } = reactIntl.useIntl();
|
2749
3074
|
return {
|
2750
|
-
|
2751
|
-
|
2752
|
-
|
2753
|
-
|
2754
|
-
|
2755
|
-
...schema?.pluginOptions,
|
2756
|
-
...data.contentType.options
|
2757
|
-
}
|
3075
|
+
title: formatMessage({
|
3076
|
+
id: "content-manager.containers.edit.panels.default.title",
|
3077
|
+
defaultMessage: "Entry"
|
3078
|
+
}),
|
3079
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(ActionsPanelContent, {})
|
2758
3080
|
};
|
2759
3081
|
};
|
2760
|
-
|
2761
|
-
|
2762
|
-
|
2763
|
-
|
2764
|
-
|
3082
|
+
ActionsPanel.type = "actions";
|
3083
|
+
const ActionsPanelContent = () => {
|
3084
|
+
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
3085
|
+
const [
|
3086
|
+
{
|
3087
|
+
query: { status = "draft" }
|
2765
3088
|
}
|
2766
|
-
|
2767
|
-
|
2768
|
-
|
2769
|
-
|
2770
|
-
|
2771
|
-
|
2772
|
-
|
2773
|
-
|
2774
|
-
|
2775
|
-
|
2776
|
-
|
2777
|
-
|
2778
|
-
|
2779
|
-
|
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
|
+
] });
|
2780
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
|
+
});
|
2781
3138
|
const ConfirmBulkActionDialog = ({
|
2782
3139
|
onToggleDialog,
|
2783
3140
|
isOpen = false,
|
@@ -2785,7 +3142,7 @@ const ConfirmBulkActionDialog = ({
|
|
2785
3142
|
endAction
|
2786
3143
|
}) => {
|
2787
3144
|
const { formatMessage } = reactIntl.useIntl();
|
2788
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, {
|
3145
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: isOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
|
2789
3146
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: formatMessage({
|
2790
3147
|
id: "app.components.ConfirmDialog.title",
|
2791
3148
|
defaultMessage: "Confirmation"
|
@@ -2816,6 +3173,7 @@ const ConfirmDialogPublishAll = ({
|
|
2816
3173
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler(getTranslation);
|
2817
3174
|
const { model, schema } = useDoc();
|
2818
3175
|
const [{ query }] = strapiAdmin.useQueryParams();
|
3176
|
+
const enableDraftRelationsCount = false;
|
2819
3177
|
const {
|
2820
3178
|
data: countDraftRelations = 0,
|
2821
3179
|
isLoading,
|
@@ -2827,7 +3185,7 @@ const ConfirmDialogPublishAll = ({
|
|
2827
3185
|
locale: query?.plugins?.i18n?.locale
|
2828
3186
|
},
|
2829
3187
|
{
|
2830
|
-
skip:
|
3188
|
+
skip: !enableDraftRelationsCount
|
2831
3189
|
}
|
2832
3190
|
);
|
2833
3191
|
React__namespace.useEffect(() => {
|
@@ -2906,7 +3264,14 @@ const formatErrorMessages = (errors, parentKey, formatMessage) => {
|
|
2906
3264
|
)
|
2907
3265
|
);
|
2908
3266
|
} else {
|
2909
|
-
messages.push(
|
3267
|
+
messages.push(
|
3268
|
+
...formatErrorMessages(
|
3269
|
+
// @ts-expect-error TODO: check why value is not compatible with FormErrors
|
3270
|
+
value,
|
3271
|
+
currentKey,
|
3272
|
+
formatMessage
|
3273
|
+
)
|
3274
|
+
);
|
2910
3275
|
}
|
2911
3276
|
} else {
|
2912
3277
|
messages.push(
|
@@ -3005,7 +3370,7 @@ const SelectedEntriesTableContent = ({
|
|
3005
3370
|
status: row.status
|
3006
3371
|
}
|
3007
3372
|
) }),
|
3008
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
3373
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
3009
3374
|
designSystem.IconButton,
|
3010
3375
|
{
|
3011
3376
|
tag: reactRouterDom.Link,
|
@@ -3014,23 +3379,16 @@ const SelectedEntriesTableContent = ({
|
|
3014
3379
|
search: row.locale && `?plugins[i18n][locale]=${row.locale}`
|
3015
3380
|
},
|
3016
3381
|
state: { from: pathname },
|
3017
|
-
label: formatMessage(
|
3018
|
-
|
3019
|
-
|
3020
|
-
|
3021
|
-
{
|
3022
|
-
id: "content-manager.components.ListViewHelperPluginTable.row-line",
|
3023
|
-
defaultMessage: "item line {number}"
|
3024
|
-
},
|
3025
|
-
{ number: index2 + 1 }
|
3026
|
-
)
|
3027
|
-
}
|
3028
|
-
),
|
3382
|
+
label: formatMessage({
|
3383
|
+
id: "content-manager.bulk-publish.edit",
|
3384
|
+
defaultMessage: "Edit"
|
3385
|
+
}),
|
3029
3386
|
target: "_blank",
|
3030
3387
|
marginLeft: "auto",
|
3031
|
-
|
3388
|
+
variant: "ghost",
|
3389
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Pencil, { width: "1.6rem", height: "1.6rem" })
|
3032
3390
|
}
|
3033
|
-
) })
|
3391
|
+
) }) })
|
3034
3392
|
] }, row.id)) })
|
3035
3393
|
] });
|
3036
3394
|
};
|
@@ -3067,7 +3425,13 @@ const SelectedEntriesModalContent = ({
|
|
3067
3425
|
);
|
3068
3426
|
const { rows, validationErrors } = React__namespace.useMemo(() => {
|
3069
3427
|
if (data.length > 0 && schema) {
|
3070
|
-
const validate = createYupSchema(
|
3428
|
+
const validate = createYupSchema(
|
3429
|
+
schema.attributes,
|
3430
|
+
components,
|
3431
|
+
// Since this is the "Publish" action, the validation
|
3432
|
+
// schema must enforce the rules for published entities
|
3433
|
+
{ status: "published" }
|
3434
|
+
);
|
3071
3435
|
const validationErrors2 = {};
|
3072
3436
|
const rows2 = data.map((entry) => {
|
3073
3437
|
try {
|
@@ -3192,8 +3556,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3192
3556
|
const refetchList = () => {
|
3193
3557
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3194
3558
|
};
|
3195
|
-
if (!showPublishButton)
|
3196
|
-
return null;
|
3559
|
+
if (!showPublishButton) return null;
|
3197
3560
|
return {
|
3198
3561
|
actionType: "publish",
|
3199
3562
|
variant: "tertiary",
|
@@ -3261,8 +3624,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3261
3624
|
selectRow([]);
|
3262
3625
|
}
|
3263
3626
|
};
|
3264
|
-
if (!hasDeletePermission)
|
3265
|
-
return null;
|
3627
|
+
if (!hasDeletePermission) return null;
|
3266
3628
|
return {
|
3267
3629
|
variant: "danger-light",
|
3268
3630
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3311,8 +3673,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3311
3673
|
}
|
3312
3674
|
};
|
3313
3675
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3314
|
-
if (!showUnpublishButton)
|
3315
|
-
return null;
|
3676
|
+
if (!showUnpublishButton) return null;
|
3316
3677
|
return {
|
3317
3678
|
variant: "tertiary",
|
3318
3679
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3417,7 +3778,7 @@ const TableActions = ({ document }) => {
|
|
3417
3778
|
strapiAdmin.DescriptionComponentRenderer,
|
3418
3779
|
{
|
3419
3780
|
props,
|
3420
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3781
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
|
3421
3782
|
children: (actions2) => {
|
3422
3783
|
const tableRowActions = actions2.filter((action) => {
|
3423
3784
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3476,6 +3837,7 @@ const EditAction = ({ documentId }) => {
|
|
3476
3837
|
};
|
3477
3838
|
};
|
3478
3839
|
EditAction.type = "edit";
|
3840
|
+
EditAction.position = "table-row";
|
3479
3841
|
const StyledPencil = styledComponents.styled(Icons.Pencil)`
|
3480
3842
|
path {
|
3481
3843
|
fill: currentColor;
|
@@ -3528,7 +3890,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3528
3890
|
}),
|
3529
3891
|
content: /* @__PURE__ */ jsxRuntime.jsx(AutoCloneFailureModalBody, { prohibitedFields }),
|
3530
3892
|
footer: ({ onClose }) => {
|
3531
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
3893
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
|
3532
3894
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onClose, variant: "tertiary", children: formatMessage({
|
3533
3895
|
id: "cancel",
|
3534
3896
|
defaultMessage: "Cancel"
|
@@ -3552,6 +3914,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3552
3914
|
};
|
3553
3915
|
};
|
3554
3916
|
CloneAction.type = "clone";
|
3917
|
+
CloneAction.position = "table-row";
|
3555
3918
|
const StyledDuplicate = styledComponents.styled(Icons.Duplicate)`
|
3556
3919
|
path {
|
3557
3920
|
fill: currentColor;
|
@@ -3569,8 +3932,7 @@ class ContentManagerPlugin {
|
|
3569
3932
|
documentActions = [
|
3570
3933
|
...DEFAULT_ACTIONS,
|
3571
3934
|
...DEFAULT_TABLE_ROW_ACTIONS,
|
3572
|
-
...DEFAULT_HEADER_ACTIONS
|
3573
|
-
HistoryAction
|
3935
|
+
...DEFAULT_HEADER_ACTIONS
|
3574
3936
|
];
|
3575
3937
|
editViewSidePanels = [ActionsPanel];
|
3576
3938
|
headerActions = [];
|
@@ -3639,7 +4001,14 @@ class ContentManagerPlugin {
|
|
3639
4001
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3640
4002
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3641
4003
|
getBulkActions: () => this.bulkActions,
|
3642
|
-
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
|
+
},
|
3643
4012
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3644
4013
|
getHeaderActions: () => this.headerActions
|
3645
4014
|
}
|
@@ -3649,16 +4018,71 @@ class ContentManagerPlugin {
|
|
3649
4018
|
const getPrintableType = (value) => {
|
3650
4019
|
const nativeType = typeof value;
|
3651
4020
|
if (nativeType === "object") {
|
3652
|
-
if (value === null)
|
3653
|
-
|
3654
|
-
if (Array.isArray(value))
|
3655
|
-
return "array";
|
4021
|
+
if (value === null) return "null";
|
4022
|
+
if (Array.isArray(value)) return "array";
|
3656
4023
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3657
4024
|
return value.constructor.name;
|
3658
4025
|
}
|
3659
4026
|
}
|
3660
4027
|
return nativeType;
|
3661
4028
|
};
|
4029
|
+
const HistoryAction = ({ model, document }) => {
|
4030
|
+
const { formatMessage } = reactIntl.useIntl();
|
4031
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
4032
|
+
const navigate = reactRouterDom.useNavigate();
|
4033
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
4034
|
+
const { pathname } = reactRouterDom.useLocation();
|
4035
|
+
const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
|
4036
|
+
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
4037
|
+
return null;
|
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
|
+
};
|
4047
|
+
return {
|
4048
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
|
4049
|
+
label: formatMessage({
|
4050
|
+
id: "content-manager.history.document-action",
|
4051
|
+
defaultMessage: "Content History"
|
4052
|
+
}),
|
4053
|
+
onClick: handleOnClick,
|
4054
|
+
disabled: (
|
4055
|
+
/**
|
4056
|
+
* The user is creating a new document.
|
4057
|
+
* It hasn't been saved yet, so there's no history to go to
|
4058
|
+
*/
|
4059
|
+
!document || /**
|
4060
|
+
* The document has been created but the current dimension has never been saved.
|
4061
|
+
* For example, the user is creating a new locale in an existing document,
|
4062
|
+
* so there's no history for the document in that locale
|
4063
|
+
*/
|
4064
|
+
!document.id || /**
|
4065
|
+
* History is only available for content types created by the user.
|
4066
|
+
* These have the `api::` prefix, as opposed to the ones created by Strapi or plugins,
|
4067
|
+
* which start with `admin::` or `plugin::`
|
4068
|
+
*/
|
4069
|
+
!model.startsWith("api::")
|
4070
|
+
),
|
4071
|
+
position: "header"
|
4072
|
+
};
|
4073
|
+
};
|
4074
|
+
HistoryAction.type = "history";
|
4075
|
+
HistoryAction.position = "header";
|
4076
|
+
const historyAdmin = {
|
4077
|
+
bootstrap(app) {
|
4078
|
+
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
4079
|
+
addDocumentAction((actions2) => {
|
4080
|
+
const indexOfDeleteAction = actions2.findIndex((action) => action.type === "delete");
|
4081
|
+
actions2.splice(indexOfDeleteAction, 0, HistoryAction);
|
4082
|
+
return actions2;
|
4083
|
+
});
|
4084
|
+
}
|
4085
|
+
};
|
3662
4086
|
const initialState = {
|
3663
4087
|
collectionTypeLinks: [],
|
3664
4088
|
components: [],
|
@@ -3695,6 +4119,88 @@ const { setInitialData } = actions;
|
|
3695
4119
|
const reducer = toolkit.combineReducers({
|
3696
4120
|
app: reducer$1
|
3697
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
|
+
};
|
3698
4204
|
const index = {
|
3699
4205
|
register(app) {
|
3700
4206
|
const cm = new ContentManagerPlugin();
|
@@ -3709,15 +4215,32 @@ const index = {
|
|
3709
4215
|
defaultMessage: "Content Manager"
|
3710
4216
|
},
|
3711
4217
|
permissions: [],
|
3712
|
-
Component: () => Promise.resolve().then(() => require("./layout--iHdZzRk.js")).then((mod) => ({ default: mod.Layout })),
|
3713
4218
|
position: 1
|
3714
4219
|
});
|
4220
|
+
app.router.addRoute({
|
4221
|
+
path: "content-manager/*",
|
4222
|
+
lazy: async () => {
|
4223
|
+
const { Layout } = await Promise.resolve().then(() => require("./layout-BW80JSCd.js"));
|
4224
|
+
return {
|
4225
|
+
Component: Layout
|
4226
|
+
};
|
4227
|
+
},
|
4228
|
+
children: routes
|
4229
|
+
});
|
3715
4230
|
app.registerPlugin(cm.config);
|
3716
4231
|
},
|
4232
|
+
bootstrap(app) {
|
4233
|
+
if (typeof historyAdmin.bootstrap === "function") {
|
4234
|
+
historyAdmin.bootstrap(app);
|
4235
|
+
}
|
4236
|
+
if (typeof previewAdmin.bootstrap === "function") {
|
4237
|
+
previewAdmin.bootstrap(app);
|
4238
|
+
}
|
4239
|
+
},
|
3717
4240
|
async registerTrads({ locales }) {
|
3718
4241
|
const importedTrads = await Promise.all(
|
3719
4242
|
locales.map((locale) => {
|
3720
|
-
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 }) => {
|
3721
4244
|
return {
|
3722
4245
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
3723
4246
|
locale
|
@@ -3735,6 +4258,7 @@ const index = {
|
|
3735
4258
|
};
|
3736
4259
|
exports.ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD = ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD;
|
3737
4260
|
exports.BulkActionsRenderer = BulkActionsRenderer;
|
4261
|
+
exports.CLONE_PATH = CLONE_PATH;
|
3738
4262
|
exports.COLLECTION_TYPES = COLLECTION_TYPES;
|
3739
4263
|
exports.CREATOR_FIELDS = CREATOR_FIELDS;
|
3740
4264
|
exports.DEFAULT_SETTINGS = DEFAULT_SETTINGS;
|
@@ -3761,8 +4285,8 @@ exports.getDisplayName = getDisplayName;
|
|
3761
4285
|
exports.getMainField = getMainField;
|
3762
4286
|
exports.getTranslation = getTranslation;
|
3763
4287
|
exports.index = index;
|
3764
|
-
exports.routes = routes;
|
3765
4288
|
exports.setInitialData = setInitialData;
|
4289
|
+
exports.useContentManagerContext = useContentManagerContext;
|
3766
4290
|
exports.useContentTypeSchema = useContentTypeSchema;
|
3767
4291
|
exports.useDoc = useDoc;
|
3768
4292
|
exports.useDocLayout = useDocLayout;
|
@@ -3774,5 +4298,6 @@ exports.useGetAllContentTypeSettingsQuery = useGetAllContentTypeSettingsQuery;
|
|
3774
4298
|
exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
|
3775
4299
|
exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
|
3776
4300
|
exports.useGetInitialDataQuery = useGetInitialDataQuery;
|
4301
|
+
exports.useGetPreviewUrlQuery = useGetPreviewUrlQuery;
|
3777
4302
|
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
|
3778
|
-
//# sourceMappingURL=index-
|
4303
|
+
//# sourceMappingURL=index-Ca7YWlAA.js.map
|