@strapi/content-manager 0.0.0-next.959c5589d0d3efa25d7ca014656d9ff48c173399 → 0.0.0-next.a28002c793bc4de2a8b3c6c5b9c2336c5a6db7a9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -1
- package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-gsCd80MU.js → ComponentConfigurationPage-DquE3cSt.js} +4 -5
- package/dist/_chunks/{ComponentConfigurationPage-gsCd80MU.js.map → ComponentConfigurationPage-DquE3cSt.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-CIjXcRAB.mjs → ComponentConfigurationPage-xgUutqCq.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-CIjXcRAB.mjs.map → ComponentConfigurationPage-xgUutqCq.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-BglmD_BF.mjs → EditConfigurationPage-BxxS_VjE.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-BglmD_BF.mjs.map → EditConfigurationPage-BxxS_VjE.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-DHDQKBzw.js → EditConfigurationPage-DBZcYu4y.js} +4 -5
- package/dist/_chunks/{EditConfigurationPage-DHDQKBzw.js.map → EditConfigurationPage-DBZcYu4y.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-CiwVPMaK.mjs → EditViewPage-CxbLxtSZ.mjs} +38 -8
- package/dist/_chunks/EditViewPage-CxbLxtSZ.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-C4iTxUPU.js → EditViewPage-eVQAzqrX.js} +38 -9
- package/dist/_chunks/EditViewPage-eVQAzqrX.js.map +1 -0
- package/dist/_chunks/{Field-DhXEK8y1.js → Field-B1V9AyU1.js} +189 -129
- package/dist/_chunks/Field-B1V9AyU1.js.map +1 -0
- package/dist/_chunks/{Field-DIjL1b5d.mjs → Field-CZwQcrmw.mjs} +187 -127
- package/dist/_chunks/Field-CZwQcrmw.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-CmNesrvR.mjs → Form-3kEYdc-J.mjs} +3 -3
- package/dist/_chunks/{Form-CmNesrvR.mjs.map → Form-3kEYdc-J.mjs.map} +1 -1
- package/dist/_chunks/{Form-CwmJ4sWe.js → Form-DDb5-H01.js} +5 -6
- package/dist/_chunks/{Form-CwmJ4sWe.js.map → Form-DDb5-H01.js.map} +1 -1
- package/dist/_chunks/{History-BLCCNgCt.js → History-COpTRR4s.js} +50 -97
- package/dist/_chunks/History-COpTRR4s.js.map +1 -0
- package/dist/_chunks/{History-D-99Wh30.mjs → History-DXZrV891.mjs} +50 -96
- package/dist/_chunks/History-DXZrV891.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-JPWZz7Kg.mjs → ListConfigurationPage-B1BlI0vS.mjs} +6 -5
- package/dist/_chunks/ListConfigurationPage-B1BlI0vS.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DxWpeZrO.js → ListConfigurationPage-D5zn8EA8.js} +6 -6
- package/dist/_chunks/ListConfigurationPage-D5zn8EA8.js.map +1 -0
- package/dist/_chunks/{ListViewPage-DSK3f0ST.mjs → ListViewPage-CfHJAt9S.mjs} +63 -51
- package/dist/_chunks/ListViewPage-CfHJAt9S.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-CIQekSFz.js → ListViewPage-OqGWxoXp.js} +64 -53
- package/dist/_chunks/ListViewPage-OqGWxoXp.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-D99LU1YP.mjs → NoContentTypePage-B1vde0d2.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-D99LU1YP.mjs.map → NoContentTypePage-B1vde0d2.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-C5cxKvC2.js → NoContentTypePage-BwuxzVhz.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-C5cxKvC2.js.map → NoContentTypePage-BwuxzVhz.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DBrBw-0y.mjs → NoPermissionsPage-BZx6YZ0-.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DBrBw-0y.mjs.map → NoPermissionsPage-BZx6YZ0-.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-Oy4tmUrW.js → NoPermissionsPage-CM4q9eyp.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-Oy4tmUrW.js.map → NoPermissionsPage-CM4q9eyp.js.map} +1 -1
- package/dist/_chunks/Preview-DZWvwEHg.js +312 -0
- package/dist/_chunks/Preview-DZWvwEHg.js.map +1 -0
- package/dist/_chunks/Preview-DeD_aLg6.mjs +294 -0
- package/dist/_chunks/Preview-DeD_aLg6.mjs.map +1 -0
- package/dist/_chunks/{Relations-eG-9p_qS.js → Relations-DXVAOSqj.js} +10 -10
- package/dist/_chunks/Relations-DXVAOSqj.js.map +1 -0
- package/dist/_chunks/{Relations-BBmhcWFV.mjs → Relations-i1BqMPqp.mjs} +9 -8
- package/dist/_chunks/Relations-i1BqMPqp.mjs.map +1 -0
- package/dist/_chunks/{en-Bm0D0IWz.js → en-BzQmavmK.js} +21 -4
- package/dist/_chunks/{en-Bm0D0IWz.js.map → en-BzQmavmK.js.map} +1 -1
- package/dist/_chunks/{en-DKV44jRb.mjs → en-CSxLmrh1.mjs} +21 -4
- package/dist/_chunks/{en-DKV44jRb.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-BIWDoFLK.js → index-D9vDl-4J.js} +363 -193
- package/dist/_chunks/index-D9vDl-4J.js.map +1 -0
- package/dist/_chunks/{index-BrUzbQ30.mjs → index-Rej95OkL.mjs} +366 -195
- package/dist/_chunks/index-Rej95OkL.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-lMc9i1-Z.js → layout-B4X3h5C4.js} +5 -6
- package/dist/_chunks/{layout-lMc9i1-Z.js.map → layout-B4X3h5C4.js.map} +1 -1
- package/dist/_chunks/{layout-_5-cXs34.mjs → layout-CKw8rE38.mjs} +4 -4
- package/dist/_chunks/{layout-_5-cXs34.mjs.map → layout-CKw8rE38.mjs.map} +1 -1
- package/dist/_chunks/objects-BcXOv6_9.js.map +1 -1
- package/dist/_chunks/objects-D6yBsdmx.mjs.map +1 -1
- package/dist/_chunks/{relations-BRHithi8.js → relations-CvZ0Uu8l.js} +6 -3
- package/dist/_chunks/relations-CvZ0Uu8l.js.map +1 -0
- package/dist/_chunks/{relations-B_VLk-DD.mjs → relations-GpHbwwdj.mjs} +6 -3
- package/dist/_chunks/relations-GpHbwwdj.mjs.map +1 -0
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -1
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -1
- 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 +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +5 -4
- package/dist/admin/src/content-manager.d.ts +3 -2
- package/dist/admin/src/exports.d.ts +1 -0
- package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
- package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +3 -3
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +4 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +4 -1
- package/dist/admin/src/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 +1 -1
- 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 +16 -19
- package/dist/admin/src/services/init.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +2 -2
- package/dist/admin/src/services/uid.d.ts +3 -3
- package/dist/server/index.js +516 -312
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +517 -312
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts +1 -0
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
- package/dist/server/src/history/controllers/history-version.d.ts +1 -1
- package/dist/server/src/history/controllers/history-version.d.ts.map +1 -1
- package/dist/server/src/history/services/history.d.ts +3 -3
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +6 -11
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +3 -2
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/preview/controllers/index.d.ts +2 -0
- package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/preview.d.ts +13 -0
- package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
- package/dist/server/src/preview/index.d.ts.map +1 -1
- 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 +4 -2
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +3 -2
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
- package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
- package/dist/server/src/services/utils/populate.d.ts +2 -2
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/dist/shared/contracts/index.d.ts +1 -0
- package/dist/shared/contracts/index.d.ts.map +1 -1
- package/dist/shared/contracts/preview.d.ts +27 -0
- package/dist/shared/contracts/preview.d.ts.map +1 -0
- package/dist/shared/index.js +4 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +4 -0
- package/dist/shared/index.mjs.map +1 -1
- package/package.json +13 -12
- package/dist/_chunks/EditViewPage-C4iTxUPU.js.map +0 -1
- package/dist/_chunks/EditViewPage-CiwVPMaK.mjs.map +0 -1
- package/dist/_chunks/Field-DIjL1b5d.mjs.map +0 -1
- package/dist/_chunks/Field-DhXEK8y1.js.map +0 -1
- package/dist/_chunks/History-BLCCNgCt.js.map +0 -1
- package/dist/_chunks/History-D-99Wh30.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DxWpeZrO.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-JPWZz7Kg.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-CIQekSFz.js.map +0 -1
- package/dist/_chunks/ListViewPage-DSK3f0ST.mjs.map +0 -1
- package/dist/_chunks/Relations-BBmhcWFV.mjs.map +0 -1
- package/dist/_chunks/Relations-eG-9p_qS.js.map +0 -1
- package/dist/_chunks/index-BIWDoFLK.js.map +0 -1
- package/dist/_chunks/index-BrUzbQ30.mjs.map +0 -1
- package/dist/_chunks/relations-BRHithi8.js.map +0 -1
- package/dist/_chunks/relations-B_VLk-DD.mjs.map +0 -1
- package/dist/admin/src/preview/constants.d.ts +0 -1
- package/dist/server/src/preview/constants.d.ts +0 -2
- package/dist/server/src/preview/constants.d.ts.map +0 -1
@@ -3,24 +3,31 @@ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useStrapiApp, createContext, useQueryParams, useAuth, useRBAC, Page, adminApi, translatedErrors, useNotification, useAPIErrorHandler, getYupValidationErrors, useForm, useTracking, useGuidedTour, BackButton, DescriptionComponentRenderer, useTable, Table } from "@strapi/admin/strapi-admin";
|
4
4
|
import * as React from "react";
|
5
5
|
import { lazy } from "react";
|
6
|
-
import {
|
6
|
+
import { Menu, Button, VisuallyHidden, Flex, Dialog, Modal, Typography, Radio, Status, Box, SingleSelect, SingleSelectOption, IconButton, Loader, Tooltip, LinkButton } from "@strapi/design-system";
|
7
7
|
import mapValues from "lodash/fp/mapValues";
|
8
8
|
import { useIntl } from "react-intl";
|
9
9
|
import { useParams, useNavigate, Navigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
|
10
|
+
import { styled } from "styled-components";
|
10
11
|
import * as yup from "yup";
|
11
12
|
import { ValidationError } from "yup";
|
13
|
+
import { stringify } from "qs";
|
12
14
|
import pipe from "lodash/fp/pipe";
|
13
15
|
import { intervalToDuration, isPast } from "date-fns";
|
14
|
-
import { styled } from "styled-components";
|
15
|
-
import { stringify } from "qs";
|
16
16
|
import { createSlice, combineReducers } from "@reduxjs/toolkit";
|
17
|
-
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
17
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
18
18
|
const v = glob[path];
|
19
19
|
if (v) {
|
20
20
|
return typeof v === "function" ? v() : Promise.resolve(v);
|
21
21
|
}
|
22
22
|
return new Promise((_, reject) => {
|
23
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
23
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
24
|
+
reject.bind(
|
25
|
+
null,
|
26
|
+
new Error(
|
27
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
28
|
+
)
|
29
|
+
)
|
30
|
+
);
|
24
31
|
});
|
25
32
|
};
|
26
33
|
const PLUGIN_ID = "content-manager";
|
@@ -168,7 +175,8 @@ const contentManagerApi = adminApi.enhanceEndpoints({
|
|
168
175
|
"InitialData",
|
169
176
|
"HistoryVersion",
|
170
177
|
"Relations",
|
171
|
-
"UidAvailability"
|
178
|
+
"UidAvailability",
|
179
|
+
"RecentDocumentList"
|
172
180
|
]
|
173
181
|
});
|
174
182
|
const documentApi = contentManagerApi.injectEndpoints({
|
@@ -186,7 +194,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
186
194
|
if (error) {
|
187
195
|
return [];
|
188
196
|
}
|
189
|
-
return [{ type: "Document", id: `${model}_LIST` }];
|
197
|
+
return [{ type: "Document", id: `${model}_LIST` }, "RecentDocumentList"];
|
190
198
|
}
|
191
199
|
}),
|
192
200
|
cloneDocument: builder.mutation({
|
@@ -200,7 +208,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
200
208
|
}),
|
201
209
|
invalidatesTags: (_result, _error, { model }) => [
|
202
210
|
{ type: "Document", id: `${model}_LIST` },
|
203
|
-
{ type: "UidAvailability", id: model }
|
211
|
+
{ type: "UidAvailability", id: model },
|
212
|
+
"RecentDocumentList"
|
204
213
|
]
|
205
214
|
}),
|
206
215
|
/**
|
@@ -219,8 +228,21 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
219
228
|
invalidatesTags: (result, _error, { model }) => [
|
220
229
|
{ type: "Document", id: `${model}_LIST` },
|
221
230
|
"Relations",
|
222
|
-
{ type: "UidAvailability", id: model }
|
223
|
-
|
231
|
+
{ type: "UidAvailability", id: model },
|
232
|
+
"RecentDocumentList"
|
233
|
+
],
|
234
|
+
transformResponse: (response, meta, arg) => {
|
235
|
+
if (!("data" in response) && arg.model === "plugin::users-permissions.user") {
|
236
|
+
return {
|
237
|
+
data: response,
|
238
|
+
meta: {
|
239
|
+
availableStatus: [],
|
240
|
+
availableLocales: []
|
241
|
+
}
|
242
|
+
};
|
243
|
+
}
|
244
|
+
return response;
|
245
|
+
}
|
224
246
|
}),
|
225
247
|
deleteDocument: builder.mutation({
|
226
248
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -231,7 +253,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
231
253
|
}
|
232
254
|
}),
|
233
255
|
invalidatesTags: (_result, _error, { collectionType, model }) => [
|
234
|
-
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model }
|
256
|
+
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model },
|
257
|
+
"RecentDocumentList"
|
235
258
|
]
|
236
259
|
}),
|
237
260
|
deleteManyDocuments: builder.mutation({
|
@@ -243,7 +266,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
243
266
|
params
|
244
267
|
}
|
245
268
|
}),
|
246
|
-
invalidatesTags: (_res, _error, { model }) => [
|
269
|
+
invalidatesTags: (_res, _error, { model }) => [
|
270
|
+
{ type: "Document", id: `${model}_LIST` },
|
271
|
+
"RecentDocumentList"
|
272
|
+
]
|
247
273
|
}),
|
248
274
|
discardDocument: builder.mutation({
|
249
275
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -261,7 +287,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
261
287
|
},
|
262
288
|
{ type: "Document", id: `${model}_LIST` },
|
263
289
|
"Relations",
|
264
|
-
{ type: "UidAvailability", id: model }
|
290
|
+
{ type: "UidAvailability", id: model },
|
291
|
+
"RecentDocumentList"
|
265
292
|
];
|
266
293
|
}
|
267
294
|
}),
|
@@ -271,10 +298,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
271
298
|
*/
|
272
299
|
getAllDocuments: builder.query({
|
273
300
|
query: ({ model, params }) => ({
|
274
|
-
url: `/content-manager/collection-types/${model}
|
301
|
+
url: `/content-manager/collection-types/${model}`,
|
275
302
|
method: "GET",
|
276
303
|
config: {
|
277
|
-
params
|
304
|
+
params: stringify(params, { encode: true })
|
278
305
|
}
|
279
306
|
}),
|
280
307
|
providesTags: (result, _error, arg) => {
|
@@ -356,7 +383,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
356
383
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
357
384
|
},
|
358
385
|
{ type: "Document", id: `${model}_LIST` },
|
359
|
-
"Relations"
|
386
|
+
"Relations",
|
387
|
+
"RecentDocumentList"
|
360
388
|
];
|
361
389
|
}
|
362
390
|
}),
|
@@ -387,7 +415,9 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
387
415
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
388
416
|
},
|
389
417
|
"Relations",
|
390
|
-
{ type: "UidAvailability", id: model }
|
418
|
+
{ type: "UidAvailability", id: model },
|
419
|
+
"RecentDocumentList",
|
420
|
+
"RecentDocumentList"
|
391
421
|
];
|
392
422
|
},
|
393
423
|
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
@@ -417,7 +447,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
417
447
|
{
|
418
448
|
type: "Document",
|
419
449
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
420
|
-
}
|
450
|
+
},
|
451
|
+
"RecentDocumentList"
|
421
452
|
];
|
422
453
|
}
|
423
454
|
}),
|
@@ -430,7 +461,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
430
461
|
params
|
431
462
|
}
|
432
463
|
}),
|
433
|
-
invalidatesTags: (_res, _error, { model, documentIds }) =>
|
464
|
+
invalidatesTags: (_res, _error, { model, documentIds }) => [
|
465
|
+
...documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` })),
|
466
|
+
"RecentDocumentList"
|
467
|
+
]
|
434
468
|
})
|
435
469
|
})
|
436
470
|
});
|
@@ -453,8 +487,7 @@ const {
|
|
453
487
|
useUnpublishManyDocumentsMutation
|
454
488
|
} = documentApi;
|
455
489
|
const buildValidParams = (query) => {
|
456
|
-
if (!query)
|
457
|
-
return query;
|
490
|
+
if (!query) return query;
|
458
491
|
const { plugins: _, ...validQueryParams } = {
|
459
492
|
...query,
|
460
493
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -462,9 +495,6 @@ const buildValidParams = (query) => {
|
|
462
495
|
{}
|
463
496
|
)
|
464
497
|
};
|
465
|
-
if ("_q" in validQueryParams) {
|
466
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
467
|
-
}
|
468
498
|
return validQueryParams;
|
469
499
|
};
|
470
500
|
const isBaseQueryError = (error) => {
|
@@ -1663,10 +1693,10 @@ const useDocumentActions = () => {
|
|
1663
1693
|
update
|
1664
1694
|
};
|
1665
1695
|
};
|
1666
|
-
const ProtectedHistoryPage = lazy(
|
1667
|
-
() => import("./History-
|
1696
|
+
const ProtectedHistoryPage = React.lazy(
|
1697
|
+
() => import("./History-DXZrV891.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1668
1698
|
);
|
1669
|
-
const routes$
|
1699
|
+
const routes$2 = [
|
1670
1700
|
{
|
1671
1701
|
path: ":collectionType/:slug/:id/history",
|
1672
1702
|
Component: ProtectedHistoryPage
|
@@ -1676,32 +1706,45 @@ const routes$1 = [
|
|
1676
1706
|
Component: ProtectedHistoryPage
|
1677
1707
|
}
|
1678
1708
|
];
|
1709
|
+
const ProtectedPreviewPage = React.lazy(
|
1710
|
+
() => import("./Preview-DeD_aLg6.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1711
|
+
);
|
1712
|
+
const routes$1 = [
|
1713
|
+
{
|
1714
|
+
path: ":collectionType/:slug/:id/preview",
|
1715
|
+
Component: ProtectedPreviewPage
|
1716
|
+
},
|
1717
|
+
{
|
1718
|
+
path: ":collectionType/:slug/preview",
|
1719
|
+
Component: ProtectedPreviewPage
|
1720
|
+
}
|
1721
|
+
];
|
1679
1722
|
const ProtectedEditViewPage = lazy(
|
1680
|
-
() => import("./EditViewPage-
|
1723
|
+
() => import("./EditViewPage-CxbLxtSZ.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1681
1724
|
);
|
1682
1725
|
const ProtectedListViewPage = lazy(
|
1683
|
-
() => import("./ListViewPage-
|
1726
|
+
() => import("./ListViewPage-CfHJAt9S.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1684
1727
|
);
|
1685
1728
|
const ProtectedListConfiguration = lazy(
|
1686
|
-
() => import("./ListConfigurationPage-
|
1729
|
+
() => import("./ListConfigurationPage-B1BlI0vS.mjs").then((mod) => ({
|
1687
1730
|
default: mod.ProtectedListConfiguration
|
1688
1731
|
}))
|
1689
1732
|
);
|
1690
1733
|
const ProtectedEditConfigurationPage = lazy(
|
1691
|
-
() => import("./EditConfigurationPage-
|
1734
|
+
() => import("./EditConfigurationPage-BxxS_VjE.mjs").then((mod) => ({
|
1692
1735
|
default: mod.ProtectedEditConfigurationPage
|
1693
1736
|
}))
|
1694
1737
|
);
|
1695
1738
|
const ProtectedComponentConfigurationPage = lazy(
|
1696
|
-
() => import("./ComponentConfigurationPage-
|
1739
|
+
() => import("./ComponentConfigurationPage-xgUutqCq.mjs").then((mod) => ({
|
1697
1740
|
default: mod.ProtectedComponentConfigurationPage
|
1698
1741
|
}))
|
1699
1742
|
);
|
1700
1743
|
const NoPermissions = lazy(
|
1701
|
-
() => import("./NoPermissionsPage-
|
1744
|
+
() => import("./NoPermissionsPage-BZx6YZ0-.mjs").then((mod) => ({ default: mod.NoPermissions }))
|
1702
1745
|
);
|
1703
1746
|
const NoContentType = lazy(
|
1704
|
-
() => import("./NoContentTypePage-
|
1747
|
+
() => import("./NoContentTypePage-B1vde0d2.mjs").then((mod) => ({ default: mod.NoContentType }))
|
1705
1748
|
);
|
1706
1749
|
const CollectionTypePages = () => {
|
1707
1750
|
const { collectionType } = useParams();
|
@@ -1713,7 +1756,7 @@ const CollectionTypePages = () => {
|
|
1713
1756
|
const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
|
1714
1757
|
const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
|
1715
1758
|
const LIST_RELATIVE_PATH = ":collectionType/:slug";
|
1716
|
-
const LIST_PATH = `/content-manager
|
1759
|
+
const LIST_PATH = `/content-manager/collection-types/:slug`;
|
1717
1760
|
const routes = [
|
1718
1761
|
{
|
1719
1762
|
path: LIST_RELATIVE_PATH,
|
@@ -1747,6 +1790,7 @@ const routes = [
|
|
1747
1790
|
path: "no-content-types",
|
1748
1791
|
Component: NoContentType
|
1749
1792
|
},
|
1793
|
+
...routes$2,
|
1750
1794
|
...routes$1
|
1751
1795
|
];
|
1752
1796
|
const DocumentActions = ({ actions: actions2 }) => {
|
@@ -1845,6 +1889,11 @@ const DocumentActionButton = (action) => {
|
|
1845
1889
|
) : null
|
1846
1890
|
] });
|
1847
1891
|
};
|
1892
|
+
const MenuItem = styled(Menu.Item)`
|
1893
|
+
&:hover {
|
1894
|
+
background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
|
1895
|
+
}
|
1896
|
+
`;
|
1848
1897
|
const DocumentActionsMenu = ({
|
1849
1898
|
actions: actions2,
|
1850
1899
|
children,
|
@@ -1903,48 +1952,32 @@ const DocumentActionsMenu = ({
|
|
1903
1952
|
/* @__PURE__ */ jsxs(Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1904
1953
|
actions2.map((action) => {
|
1905
1954
|
return /* @__PURE__ */ jsx(
|
1906
|
-
|
1955
|
+
MenuItem,
|
1907
1956
|
{
|
1908
1957
|
disabled: action.disabled,
|
1909
1958
|
onSelect: handleClick(action),
|
1910
1959
|
display: "block",
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
Flex,
|
1933
|
-
{
|
1934
|
-
alignItems: "center",
|
1935
|
-
background: "alternative100",
|
1936
|
-
borderStyle: "solid",
|
1937
|
-
borderColor: "alternative200",
|
1938
|
-
borderWidth: "1px",
|
1939
|
-
height: 5,
|
1940
|
-
paddingLeft: 2,
|
1941
|
-
paddingRight: 2,
|
1942
|
-
hasRadius: true,
|
1943
|
-
color: "alternative600",
|
1944
|
-
children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", fontWeight: "bold", lineHeight: 1, children: formatMessage({ id: "global.new", defaultMessage: "New" }) })
|
1945
|
-
}
|
1946
|
-
)
|
1947
|
-
] })
|
1960
|
+
isVariantDanger: action.variant === "danger",
|
1961
|
+
isDisabled: action.disabled,
|
1962
|
+
children: /* @__PURE__ */ jsx(Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxs(
|
1963
|
+
Flex,
|
1964
|
+
{
|
1965
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1966
|
+
gap: 2,
|
1967
|
+
tag: "span",
|
1968
|
+
children: [
|
1969
|
+
/* @__PURE__ */ jsx(
|
1970
|
+
Flex,
|
1971
|
+
{
|
1972
|
+
tag: "span",
|
1973
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1974
|
+
children: action.icon
|
1975
|
+
}
|
1976
|
+
),
|
1977
|
+
action.label
|
1978
|
+
]
|
1979
|
+
}
|
1980
|
+
) })
|
1948
1981
|
},
|
1949
1982
|
action.id
|
1950
1983
|
);
|
@@ -2081,6 +2114,7 @@ const PublishAction$1 = ({
|
|
2081
2114
|
const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
|
2082
2115
|
const isListView = useMatch(LIST_PATH) !== null;
|
2083
2116
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2117
|
+
const { id } = useParams();
|
2084
2118
|
const { formatMessage } = useIntl();
|
2085
2119
|
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
2086
2120
|
const { publish } = useDocumentActions();
|
@@ -2183,10 +2217,12 @@ const PublishAction$1 = ({
|
|
2183
2217
|
transformData(formValues)
|
2184
2218
|
);
|
2185
2219
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2186
|
-
|
2187
|
-
|
2188
|
-
|
2189
|
-
|
2220
|
+
if (id === "create") {
|
2221
|
+
navigate({
|
2222
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2223
|
+
search: rawQuery
|
2224
|
+
});
|
2225
|
+
}
|
2190
2226
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2191
2227
|
setErrors(formatValidationErrors(res.error));
|
2192
2228
|
}
|
@@ -2239,6 +2275,7 @@ const PublishAction$1 = ({
|
|
2239
2275
|
};
|
2240
2276
|
};
|
2241
2277
|
PublishAction$1.type = "publish";
|
2278
|
+
PublishAction$1.position = "panel";
|
2242
2279
|
const UpdateAction = ({
|
2243
2280
|
activeTab,
|
2244
2281
|
documentId,
|
@@ -2261,96 +2298,134 @@ const UpdateAction = ({
|
|
2261
2298
|
const validate = useForm("UpdateAction", (state) => state.validate);
|
2262
2299
|
const setErrors = useForm("UpdateAction", (state) => state.setErrors);
|
2263
2300
|
const resetForm = useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
|
2272
|
-
|
2273
|
-
|
2274
|
-
|
2275
|
-
|
2276
|
-
|
2277
|
-
|
2278
|
-
|
2279
|
-
|
2280
|
-
status: "draft"
|
2301
|
+
const handleUpdate = React.useCallback(async () => {
|
2302
|
+
setSubmitting(true);
|
2303
|
+
try {
|
2304
|
+
if (!modified) {
|
2305
|
+
return;
|
2306
|
+
}
|
2307
|
+
const { errors } = await validate(true, {
|
2308
|
+
status: "draft"
|
2309
|
+
});
|
2310
|
+
if (errors) {
|
2311
|
+
toggleNotification({
|
2312
|
+
type: "danger",
|
2313
|
+
message: formatMessage({
|
2314
|
+
id: "content-manager.validation.error",
|
2315
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2316
|
+
})
|
2281
2317
|
});
|
2282
|
-
|
2283
|
-
|
2284
|
-
|
2285
|
-
|
2286
|
-
|
2287
|
-
|
2288
|
-
|
2289
|
-
|
2290
|
-
|
2291
|
-
|
2292
|
-
|
2293
|
-
|
2294
|
-
|
2295
|
-
model,
|
2296
|
-
documentId: cloneMatch.params.origin,
|
2297
|
-
params
|
2298
|
-
},
|
2299
|
-
transformData(document)
|
2300
|
-
);
|
2301
|
-
if ("data" in res) {
|
2302
|
-
navigate(
|
2303
|
-
{
|
2304
|
-
pathname: `../${res.data.documentId}`,
|
2305
|
-
search: rawQuery
|
2306
|
-
},
|
2307
|
-
{ relative: "path" }
|
2308
|
-
);
|
2309
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2310
|
-
setErrors(formatValidationErrors(res.error));
|
2311
|
-
}
|
2312
|
-
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2313
|
-
const res = await update(
|
2318
|
+
return;
|
2319
|
+
}
|
2320
|
+
if (isCloning) {
|
2321
|
+
const res = await clone(
|
2322
|
+
{
|
2323
|
+
model,
|
2324
|
+
documentId: cloneMatch.params.origin,
|
2325
|
+
params
|
2326
|
+
},
|
2327
|
+
transformData(document)
|
2328
|
+
);
|
2329
|
+
if ("data" in res) {
|
2330
|
+
navigate(
|
2314
2331
|
{
|
2315
|
-
|
2316
|
-
|
2317
|
-
documentId,
|
2318
|
-
params
|
2332
|
+
pathname: `../${res.data.documentId}`,
|
2333
|
+
search: rawQuery
|
2319
2334
|
},
|
2320
|
-
|
2335
|
+
{ relative: "path" }
|
2321
2336
|
);
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
2326
|
-
|
2337
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2338
|
+
setErrors(formatValidationErrors(res.error));
|
2339
|
+
}
|
2340
|
+
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2341
|
+
const res = await update(
|
2342
|
+
{
|
2343
|
+
collectionType,
|
2344
|
+
model,
|
2345
|
+
documentId,
|
2346
|
+
params
|
2347
|
+
},
|
2348
|
+
transformData(document)
|
2349
|
+
);
|
2350
|
+
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2351
|
+
setErrors(formatValidationErrors(res.error));
|
2327
2352
|
} else {
|
2328
|
-
|
2353
|
+
resetForm();
|
2354
|
+
}
|
2355
|
+
} else {
|
2356
|
+
const res = await create(
|
2357
|
+
{
|
2358
|
+
model,
|
2359
|
+
params
|
2360
|
+
},
|
2361
|
+
transformData(document)
|
2362
|
+
);
|
2363
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2364
|
+
navigate(
|
2329
2365
|
{
|
2330
|
-
|
2331
|
-
|
2366
|
+
pathname: `../${res.data.documentId}`,
|
2367
|
+
search: rawQuery
|
2332
2368
|
},
|
2333
|
-
|
2369
|
+
{ replace: true, relative: "path" }
|
2334
2370
|
);
|
2335
|
-
|
2336
|
-
|
2337
|
-
{
|
2338
|
-
pathname: `../${res.data.documentId}`,
|
2339
|
-
search: rawQuery
|
2340
|
-
},
|
2341
|
-
{ replace: true, relative: "path" }
|
2342
|
-
);
|
2343
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2344
|
-
setErrors(formatValidationErrors(res.error));
|
2345
|
-
}
|
2371
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2372
|
+
setErrors(formatValidationErrors(res.error));
|
2346
2373
|
}
|
2347
|
-
} finally {
|
2348
|
-
setSubmitting(false);
|
2349
2374
|
}
|
2375
|
+
} finally {
|
2376
|
+
setSubmitting(false);
|
2350
2377
|
}
|
2378
|
+
}, [
|
2379
|
+
clone,
|
2380
|
+
cloneMatch?.params.origin,
|
2381
|
+
collectionType,
|
2382
|
+
create,
|
2383
|
+
document,
|
2384
|
+
documentId,
|
2385
|
+
formatMessage,
|
2386
|
+
formatValidationErrors,
|
2387
|
+
isCloning,
|
2388
|
+
model,
|
2389
|
+
modified,
|
2390
|
+
navigate,
|
2391
|
+
params,
|
2392
|
+
rawQuery,
|
2393
|
+
resetForm,
|
2394
|
+
setErrors,
|
2395
|
+
setSubmitting,
|
2396
|
+
toggleNotification,
|
2397
|
+
update,
|
2398
|
+
validate
|
2399
|
+
]);
|
2400
|
+
React.useEffect(() => {
|
2401
|
+
const handleKeyDown = (e) => {
|
2402
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
2403
|
+
e.preventDefault();
|
2404
|
+
handleUpdate();
|
2405
|
+
}
|
2406
|
+
};
|
2407
|
+
window.addEventListener("keydown", handleKeyDown);
|
2408
|
+
return () => {
|
2409
|
+
window.removeEventListener("keydown", handleKeyDown);
|
2410
|
+
};
|
2411
|
+
}, [handleUpdate]);
|
2412
|
+
return {
|
2413
|
+
/**
|
2414
|
+
* Disabled when:
|
2415
|
+
* - the form is submitting
|
2416
|
+
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
2417
|
+
* - the active tab is the published tab
|
2418
|
+
*/
|
2419
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
2420
|
+
label: formatMessage({
|
2421
|
+
id: "global.save",
|
2422
|
+
defaultMessage: "Save"
|
2423
|
+
}),
|
2424
|
+
onClick: handleUpdate
|
2351
2425
|
};
|
2352
2426
|
};
|
2353
2427
|
UpdateAction.type = "update";
|
2428
|
+
UpdateAction.position = "panel";
|
2354
2429
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
2355
2430
|
KEEP: "keep",
|
2356
2431
|
DISCARD: "discard"
|
@@ -2473,6 +2548,7 @@ const UnpublishAction$1 = ({
|
|
2473
2548
|
};
|
2474
2549
|
};
|
2475
2550
|
UnpublishAction$1.type = "unpublish";
|
2551
|
+
UnpublishAction$1.position = "panel";
|
2476
2552
|
const DiscardAction = ({
|
2477
2553
|
activeTab,
|
2478
2554
|
documentId,
|
@@ -2523,6 +2599,7 @@ const DiscardAction = ({
|
|
2523
2599
|
};
|
2524
2600
|
};
|
2525
2601
|
DiscardAction.type = "discard";
|
2602
|
+
DiscardAction.position = "panel";
|
2526
2603
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2527
2604
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2528
2605
|
const RelativeTime = React.forwardRef(
|
@@ -2535,7 +2612,7 @@ const RelativeTime = React.forwardRef(
|
|
2535
2612
|
});
|
2536
2613
|
const unit = intervals.find((intervalUnit) => {
|
2537
2614
|
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
2538
|
-
});
|
2615
|
+
}) ?? "seconds";
|
2539
2616
|
const relativeTime = isPast(timestamp) ? -interval[unit] : interval[unit];
|
2540
2617
|
const customInterval = customIntervals.find(
|
2541
2618
|
(custom) => interval[custom.unit] < custom.threshold
|
@@ -2569,19 +2646,29 @@ const getDisplayName = ({
|
|
2569
2646
|
return email ?? "";
|
2570
2647
|
};
|
2571
2648
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2572
|
-
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2649
|
+
const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
|
2573
2650
|
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2574
|
-
|
2651
|
+
const { formatMessage } = useIntl();
|
2652
|
+
return /* @__PURE__ */ jsx(Status, { ...restProps, size, variant: statusVariant, children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
|
2653
|
+
id: `content-manager.containers.List.${status}`,
|
2654
|
+
defaultMessage: capitalise(status)
|
2655
|
+
}) }) });
|
2575
2656
|
};
|
2576
2657
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2577
2658
|
const { formatMessage } = useIntl();
|
2578
2659
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2660
|
+
const params = useParams();
|
2579
2661
|
const title = isCreating ? formatMessage({
|
2580
2662
|
id: "content-manager.containers.edit.title.new",
|
2581
2663
|
defaultMessage: "Create an entry"
|
2582
2664
|
}) : documentTitle;
|
2583
2665
|
return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2584
|
-
/* @__PURE__ */ jsx(
|
2666
|
+
/* @__PURE__ */ jsx(
|
2667
|
+
BackButton,
|
2668
|
+
{
|
2669
|
+
fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
|
2670
|
+
}
|
2671
|
+
),
|
2585
2672
|
/* @__PURE__ */ jsxs(Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2586
2673
|
/* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
|
2587
2674
|
/* @__PURE__ */ jsx(HeaderToolbar, {})
|
@@ -2632,7 +2719,7 @@ const HeaderToolbar = () => {
|
|
2632
2719
|
meta: isCloning ? void 0 : meta,
|
2633
2720
|
collectionType
|
2634
2721
|
},
|
2635
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2722
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2636
2723
|
children: (actions2) => {
|
2637
2724
|
const headerActions = actions2.filter((action) => {
|
2638
2725
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2840,6 +2927,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2840
2927
|
};
|
2841
2928
|
};
|
2842
2929
|
ConfigureTheViewAction.type = "configure-the-view";
|
2930
|
+
ConfigureTheViewAction.position = "header";
|
2843
2931
|
const EditTheModelAction = ({ model }) => {
|
2844
2932
|
const navigate = useNavigate();
|
2845
2933
|
const { formatMessage } = useIntl();
|
@@ -2856,6 +2944,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2856
2944
|
};
|
2857
2945
|
};
|
2858
2946
|
EditTheModelAction.type = "edit-the-model";
|
2947
|
+
EditTheModelAction.position = "header";
|
2859
2948
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2860
2949
|
const navigate = useNavigate();
|
2861
2950
|
const { formatMessage } = useIntl();
|
@@ -2929,6 +3018,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2929
3018
|
};
|
2930
3019
|
};
|
2931
3020
|
DeleteAction$1.type = "delete";
|
3021
|
+
DeleteAction$1.position = ["header", "table-row"];
|
2932
3022
|
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2933
3023
|
const Panels = () => {
|
2934
3024
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
@@ -2991,7 +3081,7 @@ const ActionsPanelContent = () => {
|
|
2991
3081
|
DescriptionComponentRenderer,
|
2992
3082
|
{
|
2993
3083
|
props,
|
2994
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3084
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
|
2995
3085
|
children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
|
2996
3086
|
}
|
2997
3087
|
),
|
@@ -3268,18 +3358,10 @@ const SelectedEntriesTableContent = ({
|
|
3268
3358
|
search: row.locale && `?plugins[i18n][locale]=${row.locale}`
|
3269
3359
|
},
|
3270
3360
|
state: { from: pathname },
|
3271
|
-
label: formatMessage(
|
3272
|
-
|
3273
|
-
|
3274
|
-
|
3275
|
-
{
|
3276
|
-
id: "content-manager.components.ListViewHelperPluginTable.row-line",
|
3277
|
-
defaultMessage: "item line {number}"
|
3278
|
-
},
|
3279
|
-
{ number: index2 + 1 }
|
3280
|
-
)
|
3281
|
-
}
|
3282
|
-
),
|
3361
|
+
label: formatMessage({
|
3362
|
+
id: "content-manager.bulk-publish.edit",
|
3363
|
+
defaultMessage: "Edit"
|
3364
|
+
}),
|
3283
3365
|
target: "_blank",
|
3284
3366
|
marginLeft: "auto",
|
3285
3367
|
variant: "ghost",
|
@@ -3453,8 +3535,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3453
3535
|
const refetchList = () => {
|
3454
3536
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3455
3537
|
};
|
3456
|
-
if (!showPublishButton)
|
3457
|
-
return null;
|
3538
|
+
if (!showPublishButton) return null;
|
3458
3539
|
return {
|
3459
3540
|
actionType: "publish",
|
3460
3541
|
variant: "tertiary",
|
@@ -3522,8 +3603,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3522
3603
|
selectRow([]);
|
3523
3604
|
}
|
3524
3605
|
};
|
3525
|
-
if (!hasDeletePermission)
|
3526
|
-
return null;
|
3606
|
+
if (!hasDeletePermission) return null;
|
3527
3607
|
return {
|
3528
3608
|
variant: "danger-light",
|
3529
3609
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3572,8 +3652,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3572
3652
|
}
|
3573
3653
|
};
|
3574
3654
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3575
|
-
if (!showUnpublishButton)
|
3576
|
-
return null;
|
3655
|
+
if (!showUnpublishButton) return null;
|
3577
3656
|
return {
|
3578
3657
|
variant: "tertiary",
|
3579
3658
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3678,7 +3757,7 @@ const TableActions = ({ document }) => {
|
|
3678
3757
|
DescriptionComponentRenderer,
|
3679
3758
|
{
|
3680
3759
|
props,
|
3681
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3760
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
|
3682
3761
|
children: (actions2) => {
|
3683
3762
|
const tableRowActions = actions2.filter((action) => {
|
3684
3763
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3737,6 +3816,7 @@ const EditAction = ({ documentId }) => {
|
|
3737
3816
|
};
|
3738
3817
|
};
|
3739
3818
|
EditAction.type = "edit";
|
3819
|
+
EditAction.position = "table-row";
|
3740
3820
|
const StyledPencil = styled(Pencil)`
|
3741
3821
|
path {
|
3742
3822
|
fill: currentColor;
|
@@ -3813,6 +3893,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3813
3893
|
};
|
3814
3894
|
};
|
3815
3895
|
CloneAction.type = "clone";
|
3896
|
+
CloneAction.position = "table-row";
|
3816
3897
|
const StyledDuplicate = styled(Duplicate)`
|
3817
3898
|
path {
|
3818
3899
|
fill: currentColor;
|
@@ -3899,7 +3980,14 @@ class ContentManagerPlugin {
|
|
3899
3980
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3900
3981
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3901
3982
|
getBulkActions: () => this.bulkActions,
|
3902
|
-
getDocumentActions: () =>
|
3983
|
+
getDocumentActions: (position) => {
|
3984
|
+
if (position) {
|
3985
|
+
return this.documentActions.filter(
|
3986
|
+
(action) => action.position == void 0 || [action.position].flat().includes(position)
|
3987
|
+
);
|
3988
|
+
}
|
3989
|
+
return this.documentActions;
|
3990
|
+
},
|
3903
3991
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3904
3992
|
getHeaderActions: () => this.headerActions
|
3905
3993
|
}
|
@@ -3909,10 +3997,8 @@ class ContentManagerPlugin {
|
|
3909
3997
|
const getPrintableType = (value) => {
|
3910
3998
|
const nativeType = typeof value;
|
3911
3999
|
if (nativeType === "object") {
|
3912
|
-
if (value === null)
|
3913
|
-
|
3914
|
-
if (Array.isArray(value))
|
3915
|
-
return "array";
|
4000
|
+
if (value === null) return "null";
|
4001
|
+
if (Array.isArray(value)) return "array";
|
3916
4002
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3917
4003
|
return value.constructor.name;
|
3918
4004
|
}
|
@@ -3923,17 +4009,27 @@ const HistoryAction = ({ model, document }) => {
|
|
3923
4009
|
const { formatMessage } = useIntl();
|
3924
4010
|
const [{ query }] = useQueryParams();
|
3925
4011
|
const navigate = useNavigate();
|
4012
|
+
const { trackUsage } = useTracking();
|
4013
|
+
const { pathname } = useLocation();
|
3926
4014
|
const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
|
3927
4015
|
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3928
4016
|
return null;
|
3929
4017
|
}
|
4018
|
+
const handleOnClick = () => {
|
4019
|
+
const destination = { pathname: "history", search: pluginsQueryParams };
|
4020
|
+
trackUsage("willNavigate", {
|
4021
|
+
from: pathname,
|
4022
|
+
to: `${pathname}/${destination.pathname}`
|
4023
|
+
});
|
4024
|
+
navigate(destination);
|
4025
|
+
};
|
3930
4026
|
return {
|
3931
4027
|
icon: /* @__PURE__ */ jsx(ClockCounterClockwise, {}),
|
3932
4028
|
label: formatMessage({
|
3933
4029
|
id: "content-manager.history.document-action",
|
3934
4030
|
defaultMessage: "Content History"
|
3935
4031
|
}),
|
3936
|
-
onClick:
|
4032
|
+
onClick: handleOnClick,
|
3937
4033
|
disabled: (
|
3938
4034
|
/**
|
3939
4035
|
* The user is creating a new document.
|
@@ -3955,6 +4051,7 @@ const HistoryAction = ({ model, document }) => {
|
|
3955
4051
|
};
|
3956
4052
|
};
|
3957
4053
|
HistoryAction.type = "history";
|
4054
|
+
HistoryAction.position = "header";
|
3958
4055
|
const historyAdmin = {
|
3959
4056
|
bootstrap(app) {
|
3960
4057
|
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
@@ -4001,13 +4098,86 @@ const { setInitialData } = actions;
|
|
4001
4098
|
const reducer = combineReducers({
|
4002
4099
|
app: reducer$1
|
4003
4100
|
});
|
4004
|
-
const
|
4101
|
+
const previewApi = contentManagerApi.injectEndpoints({
|
4102
|
+
endpoints: (builder) => ({
|
4103
|
+
getPreviewUrl: builder.query({
|
4104
|
+
query({ query, params }) {
|
4105
|
+
return {
|
4106
|
+
url: `/content-manager/preview/url/${params.contentType}`,
|
4107
|
+
method: "GET",
|
4108
|
+
config: {
|
4109
|
+
params: query
|
4110
|
+
}
|
4111
|
+
};
|
4112
|
+
}
|
4113
|
+
})
|
4114
|
+
})
|
4115
|
+
});
|
4116
|
+
const { useGetPreviewUrlQuery } = previewApi;
|
4117
|
+
const ConditionalTooltip = ({ isShown, label, children }) => {
|
4118
|
+
if (isShown) {
|
4119
|
+
return /* @__PURE__ */ jsx(Tooltip, { label, children });
|
4120
|
+
}
|
4121
|
+
return children;
|
4122
|
+
};
|
4123
|
+
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4124
|
+
const { formatMessage } = useIntl();
|
4125
|
+
const { trackUsage } = useTracking();
|
4126
|
+
const { pathname } = useLocation();
|
4127
|
+
const [{ query }] = useQueryParams();
|
4128
|
+
const isModified = useForm("PreviewSidePanel", (state) => state.modified);
|
4129
|
+
const { data, error } = useGetPreviewUrlQuery({
|
4130
|
+
params: {
|
4131
|
+
contentType: model
|
4132
|
+
},
|
4133
|
+
query: {
|
4134
|
+
documentId,
|
4135
|
+
locale: document?.locale,
|
4136
|
+
status: document?.status
|
4137
|
+
}
|
4138
|
+
});
|
4139
|
+
if (!data?.data?.url || error) {
|
4140
|
+
return null;
|
4141
|
+
}
|
4142
|
+
const trackNavigation = () => {
|
4143
|
+
const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
|
4144
|
+
trackUsage("willNavigate", { from: pathname, to: destinationPathname });
|
4145
|
+
};
|
4146
|
+
return {
|
4147
|
+
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4148
|
+
content: /* @__PURE__ */ jsx(
|
4149
|
+
ConditionalTooltip,
|
4150
|
+
{
|
4151
|
+
label: formatMessage({
|
4152
|
+
id: "content-manager.preview.panel.button-disabled-tooltip",
|
4153
|
+
defaultMessage: "Please save to open the preview"
|
4154
|
+
}),
|
4155
|
+
isShown: isModified,
|
4156
|
+
children: /* @__PURE__ */ jsx(Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsx(
|
4157
|
+
Button,
|
4158
|
+
{
|
4159
|
+
variant: "tertiary",
|
4160
|
+
tag: Link,
|
4161
|
+
to: { pathname: "preview", search: stringify(query, { encode: false }) },
|
4162
|
+
onClick: trackNavigation,
|
4163
|
+
width: "100%",
|
4164
|
+
disabled: isModified,
|
4165
|
+
pointerEvents: isModified ? "none" : void 0,
|
4166
|
+
tabIndex: isModified ? -1 : void 0,
|
4167
|
+
children: formatMessage({
|
4168
|
+
id: "content-manager.preview.panel.button",
|
4169
|
+
defaultMessage: "Open preview"
|
4170
|
+
})
|
4171
|
+
}
|
4172
|
+
) })
|
4173
|
+
}
|
4174
|
+
)
|
4175
|
+
};
|
4176
|
+
};
|
4005
4177
|
const previewAdmin = {
|
4006
4178
|
bootstrap(app) {
|
4007
|
-
|
4008
|
-
|
4009
|
-
}
|
4010
|
-
console.log("Bootstrapping preview admin");
|
4179
|
+
const contentManagerPluginApis = app.getPlugin("content-manager").apis;
|
4180
|
+
contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
|
4011
4181
|
}
|
4012
4182
|
};
|
4013
4183
|
const index = {
|
@@ -4029,7 +4199,7 @@ const index = {
|
|
4029
4199
|
app.router.addRoute({
|
4030
4200
|
path: "content-manager/*",
|
4031
4201
|
lazy: async () => {
|
4032
|
-
const { Layout } = await import("./layout-
|
4202
|
+
const { Layout } = await import("./layout-CKw8rE38.mjs");
|
4033
4203
|
return {
|
4034
4204
|
Component: Layout
|
4035
4205
|
};
|
@@ -4049,7 +4219,7 @@ const index = {
|
|
4049
4219
|
async registerTrads({ locales }) {
|
4050
4220
|
const importedTrads = await Promise.all(
|
4051
4221
|
locales.map((locale) => {
|
4052
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-
|
4222
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-CSxLmrh1.mjs"), "./translations/es.json": () => import("./es-D34tqjMw.mjs"), "./translations/eu.json": () => import("./eu-CdALomew.mjs"), "./translations/fr.json": () => import("./fr--pg5jUbt.mjs"), "./translations/gu.json": () => import("./gu-CNpaMDpH.mjs"), "./translations/hi.json": () => import("./hi-Dwvd04m3.mjs"), "./translations/hu.json": () => import("./hu-CeYvaaO0.mjs"), "./translations/id.json": () => import("./id-BtwA9WJT.mjs"), "./translations/it.json": () => import("./it-BrVPqaf1.mjs"), "./translations/ja.json": () => import("./ja-BHqhDq4V.mjs"), "./translations/ko.json": () => import("./ko-HVQRlfUI.mjs"), "./translations/ml.json": () => import("./ml-BihZwQit.mjs"), "./translations/ms.json": () => import("./ms-m_WjyWx7.mjs"), "./translations/nl.json": () => import("./nl-D4R9gHx5.mjs"), "./translations/pl.json": () => import("./pl-sbx9mSt_.mjs"), "./translations/pt-BR.json": () => import("./pt-BR-C71iDxnh.mjs"), "./translations/pt.json": () => import("./pt-BsaFvS8-.mjs"), "./translations/ru.json": () => import("./ru-BE6A4Exp.mjs"), "./translations/sa.json": () => import("./sa-Dag0k-Z8.mjs"), "./translations/sk.json": () => import("./sk-BFg-R8qJ.mjs"), "./translations/sv.json": () => import("./sv-CUnfWGsh.mjs"), "./translations/th.json": () => import("./th-BqbI8lIT.mjs"), "./translations/tr.json": () => import("./tr-CgeK3wJM.mjs"), "./translations/uk.json": () => import("./uk-CR-zDhAY.mjs"), "./translations/vi.json": () => import("./vi-DUXIk_fw.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-BPQcRIyH.mjs"), "./translations/zh.json": () => import("./zh-BWZspA60.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
4053
4223
|
return {
|
4054
4224
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4055
4225
|
locale
|
@@ -4076,9 +4246,10 @@ export {
|
|
4076
4246
|
HOOKS as H,
|
4077
4247
|
InjectionZone as I,
|
4078
4248
|
useDocument as J,
|
4079
|
-
|
4080
|
-
|
4081
|
-
|
4249
|
+
useGetPreviewUrlQuery as K,
|
4250
|
+
index as L,
|
4251
|
+
useContentManagerContext as M,
|
4252
|
+
useDocumentActions as N,
|
4082
4253
|
Panels as P,
|
4083
4254
|
RelativeTime as R,
|
4084
4255
|
SINGLE_TYPES as S,
|
@@ -4110,4 +4281,4 @@ export {
|
|
4110
4281
|
capitalise as y,
|
4111
4282
|
useUpdateContentTypeConfigurationMutation as z
|
4112
4283
|
};
|
4113
|
-
//# sourceMappingURL=index-
|
4284
|
+
//# sourceMappingURL=index-Rej95OkL.mjs.map
|