@strapi/content-manager 0.0.0-experimental.826f263c58b6886b849d3f03b81f7a530bc51c91 → 0.0.0-experimental.93a73ca8c7b85667fe8e46c0cb6627506570a02f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -3
- package/dist/_chunks/{ComponentConfigurationPage-CR5XdR33.mjs → ComponentConfigurationPage-B3yDbeU1.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-CR5XdR33.mjs.map → ComponentConfigurationPage-B3yDbeU1.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DJcn1DrO.js → ComponentConfigurationPage-KXSuLnQD.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-DJcn1DrO.js.map → ComponentConfigurationPage-KXSuLnQD.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-tDtWj7R2.js → EditConfigurationPage-BQ17--5R.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-tDtWj7R2.js.map → EditConfigurationPage-BQ17--5R.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-DmCIb4kD.mjs → EditConfigurationPage-D7PrLO8j.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-DmCIb4kD.mjs.map → EditConfigurationPage-D7PrLO8j.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-DvaV7U9b.mjs → EditViewPage-B7VgwJaG.mjs} +57 -46
- package/dist/_chunks/EditViewPage-B7VgwJaG.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-CoQEnFlC.js → EditViewPage-BgjdnGz2.js} +56 -45
- package/dist/_chunks/EditViewPage-BgjdnGz2.js.map +1 -0
- package/dist/_chunks/{Field-ZdrmmQ4Y.js → Field-CdK7ZLmv.js} +504 -165
- package/dist/_chunks/Field-CdK7ZLmv.js.map +1 -0
- package/dist/_chunks/{Field-Cz_J9551.mjs → Field-tHCw4lGA.mjs} +505 -166
- package/dist/_chunks/Field-tHCw4lGA.mjs.map +1 -0
- package/dist/_chunks/{Form-Dxmihyw8.mjs → Form-BJxdTv3Q.mjs} +40 -30
- package/dist/_chunks/Form-BJxdTv3Q.mjs.map +1 -0
- package/dist/_chunks/{Form-Bpig5rch.js → Form-C_0KTVvV.js} +38 -28
- package/dist/_chunks/Form-C_0KTVvV.js.map +1 -0
- package/dist/_chunks/{History-BZP8n7KT.mjs → History-DR2txJLE.mjs} +141 -37
- package/dist/_chunks/History-DR2txJLE.mjs.map +1 -0
- package/dist/_chunks/{History-BfX6XmZK.js → History-nuEzM5qm.js} +140 -36
- package/dist/_chunks/History-nuEzM5qm.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-B3CXj8PY.js → ListConfigurationPage-CnB86Psm.js} +57 -46
- package/dist/_chunks/ListConfigurationPage-CnB86Psm.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DxKuVkKz.mjs → ListConfigurationPage-voFVtXu6.mjs} +58 -48
- package/dist/_chunks/ListConfigurationPage-voFVtXu6.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-D5D3tVPq.mjs → ListViewPage-B_GaWgRH.mjs} +67 -70
- package/dist/_chunks/ListViewPage-B_GaWgRH.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-Bk9VO__I.js → ListViewPage-SXIXm-RM.js} +65 -68
- package/dist/_chunks/ListViewPage-SXIXm-RM.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-DsB2F7Z1.js → NoContentTypePage-BzsQ3hLZ.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-DsB2F7Z1.js.map → NoContentTypePage-BzsQ3hLZ.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-DnMeuQCj.mjs → NoContentTypePage-CYiGpsbj.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-DnMeuQCj.mjs.map → NoContentTypePage-CYiGpsbj.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-OyoME_Tf.mjs → NoPermissionsPage-B5baIHal.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-OyoME_Tf.mjs.map → NoPermissionsPage-B5baIHal.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-BQDM64_b.js → NoPermissionsPage-IGkId4C5.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-BQDM64_b.js.map → NoPermissionsPage-IGkId4C5.js.map} +1 -1
- package/dist/_chunks/{Relations-BOYZmuWy.mjs → Relations-CIYDdKU-.mjs} +4 -4
- package/dist/_chunks/Relations-CIYDdKU-.mjs.map +1 -0
- package/dist/_chunks/{Relations-B6B3A3mb.js → Relations-Dhuurpx2.js} +4 -4
- package/dist/_chunks/Relations-Dhuurpx2.js.map +1 -0
- package/dist/_chunks/{en-Dzv55oQw.mjs → en-BrCTWlZv.mjs} +8 -4
- package/dist/_chunks/{en-Dzv55oQw.mjs.map → en-BrCTWlZv.mjs.map} +1 -1
- package/dist/_chunks/{en-BN1bvFK7.js → en-uOUIxfcQ.js} +8 -4
- package/dist/_chunks/{en-BN1bvFK7.js.map → en-uOUIxfcQ.js.map} +1 -1
- package/dist/_chunks/{index-VHviNMeW.mjs → index-C9TJPyni.mjs} +467 -428
- package/dist/_chunks/index-C9TJPyni.mjs.map +1 -0
- package/dist/_chunks/{index-DzN3kBgx.js → index-CdT0kHZ8.js} +437 -398
- package/dist/_chunks/index-CdT0kHZ8.js.map +1 -0
- package/dist/_chunks/{layout-CPn1PM6x.mjs → layout-BNqvLR_b.mjs} +39 -22
- package/dist/_chunks/layout-BNqvLR_b.mjs.map +1 -0
- package/dist/_chunks/{layout-b91XRlD2.js → layout-C6dxWYT7.js} +37 -20
- package/dist/_chunks/layout-C6dxWYT7.js.map +1 -0
- package/dist/_chunks/{relations-BsqxS6tR.mjs → relations-CkKqKw65.mjs} +2 -2
- package/dist/_chunks/{relations-BsqxS6tR.mjs.map → relations-CkKqKw65.mjs.map} +1 -1
- package/dist/_chunks/{relations-CA7IYmcP.js → relations-DtFaDnP1.js} +2 -2
- package/dist/_chunks/{relations-CA7IYmcP.js.map → relations-DtFaDnP1.js.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +8 -8
- package/dist/admin/src/history/components/VersionInputRenderer.d.ts +1 -1
- package/dist/admin/src/history/index.d.ts +3 -0
- package/dist/admin/src/index.d.ts +1 -0
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +8 -3
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +4 -0
- 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 +12 -32
- package/dist/admin/src/pages/ListView/components/BulkActions/Actions.d.ts +3 -30
- package/dist/admin/src/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.d.ts +2 -2
- package/dist/server/index.js +137 -87
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +138 -88
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/uid.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/dimensions.d.ts +4 -2
- package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +1 -1
- package/dist/server/src/history/services/utils.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.map +1 -1
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/_chunks/EditViewPage-CoQEnFlC.js.map +0 -1
- package/dist/_chunks/EditViewPage-DvaV7U9b.mjs.map +0 -1
- package/dist/_chunks/Field-Cz_J9551.mjs.map +0 -1
- package/dist/_chunks/Field-ZdrmmQ4Y.js.map +0 -1
- package/dist/_chunks/Form-Bpig5rch.js.map +0 -1
- package/dist/_chunks/Form-Dxmihyw8.mjs.map +0 -1
- package/dist/_chunks/History-BZP8n7KT.mjs.map +0 -1
- package/dist/_chunks/History-BfX6XmZK.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-B3CXj8PY.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DxKuVkKz.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-Bk9VO__I.js.map +0 -1
- package/dist/_chunks/ListViewPage-D5D3tVPq.mjs.map +0 -1
- package/dist/_chunks/Relations-B6B3A3mb.js.map +0 -1
- package/dist/_chunks/Relations-BOYZmuWy.mjs.map +0 -1
- package/dist/_chunks/index-DzN3kBgx.js.map +0 -1
- package/dist/_chunks/index-VHviNMeW.mjs.map +0 -1
- package/dist/_chunks/layout-CPn1PM6x.mjs.map +0 -1
- package/dist/_chunks/layout-b91XRlD2.js.map +0 -1
@@ -1,17 +1,17 @@
|
|
1
|
-
import {
|
1
|
+
import { CrossCircle, More, WarningCircle, ListPlus, Pencil, Trash, Check, CheckCircle, ArrowsCounterClockwise, ChevronRight, Duplicate, ClockCounterClockwise, Feather } from "@strapi/icons";
|
2
2
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
3
|
-
import { useStrapiApp,
|
4
|
-
import { stringify } from "qs";
|
5
|
-
import { useIntl } from "react-intl";
|
6
|
-
import { useNavigate, useParams, Navigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
|
3
|
+
import { useStrapiApp, createContext, useAuth, useRBAC, Page, adminApi, translatedErrors, useNotification, useAPIErrorHandler, getYupValidationErrors, useQueryParams, useTracking, useForm, BackButton, DescriptionComponentRenderer, useTable, Table } from "@strapi/admin/strapi-admin";
|
7
4
|
import * as React from "react";
|
8
5
|
import { lazy } from "react";
|
9
|
-
import { Menu, VisuallyHidden, Flex, Typography, Dialog,
|
6
|
+
import { Menu, Button, VisuallyHidden, Flex, Typography, Dialog, Modal, Radio, Status, Box, SingleSelect, SingleSelectOption, Loader, IconButton, Tooltip, LinkButton } from "@strapi/design-system";
|
7
|
+
import { useIntl } from "react-intl";
|
8
|
+
import { useParams, Navigate, useNavigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
|
10
9
|
import { styled } from "styled-components";
|
11
10
|
import * as yup from "yup";
|
12
11
|
import { ValidationError } from "yup";
|
13
12
|
import pipe from "lodash/fp/pipe";
|
14
13
|
import { intervalToDuration, isPast } from "date-fns";
|
14
|
+
import { stringify } from "qs";
|
15
15
|
import { createSlice, combineReducers } from "@reduxjs/toolkit";
|
16
16
|
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
17
17
|
const v = glob[path];
|
@@ -49,42 +49,6 @@ const useInjectionZone = (area) => {
|
|
49
49
|
const [page, position] = area.split(".");
|
50
50
|
return contentManagerPlugin.getInjectedComponents(page, position);
|
51
51
|
};
|
52
|
-
const HistoryAction = ({ model, document }) => {
|
53
|
-
const { formatMessage } = useIntl();
|
54
|
-
const [{ query }] = useQueryParams();
|
55
|
-
const navigate = useNavigate();
|
56
|
-
const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
|
57
|
-
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
58
|
-
return null;
|
59
|
-
}
|
60
|
-
return {
|
61
|
-
icon: /* @__PURE__ */ jsx(ClockCounterClockwise, {}),
|
62
|
-
label: formatMessage({
|
63
|
-
id: "content-manager.history.document-action",
|
64
|
-
defaultMessage: "Content History"
|
65
|
-
}),
|
66
|
-
onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
|
67
|
-
disabled: (
|
68
|
-
/**
|
69
|
-
* The user is creating a new document.
|
70
|
-
* It hasn't been saved yet, so there's no history to go to
|
71
|
-
*/
|
72
|
-
!document || /**
|
73
|
-
* The document has been created but the current dimension has never been saved.
|
74
|
-
* For example, the user is creating a new locale in an existing document,
|
75
|
-
* so there's no history for the document in that locale
|
76
|
-
*/
|
77
|
-
!document.id || /**
|
78
|
-
* History is only available for content types created by the user.
|
79
|
-
* These have the `api::` prefix, as opposed to the ones created by Strapi or plugins,
|
80
|
-
* which start with `admin::` or `plugin::`
|
81
|
-
*/
|
82
|
-
!model.startsWith("api::")
|
83
|
-
),
|
84
|
-
position: "header"
|
85
|
-
};
|
86
|
-
};
|
87
|
-
HistoryAction.type = "history";
|
88
52
|
const ID = "id";
|
89
53
|
const CREATED_BY_ATTRIBUTE_NAME = "createdBy";
|
90
54
|
const UPDATED_BY_ATTRIBUTE_NAME = "updatedBy";
|
@@ -198,6 +162,7 @@ const contentManagerApi = adminApi.enhanceEndpoints({
|
|
198
162
|
]
|
199
163
|
});
|
200
164
|
const documentApi = contentManagerApi.injectEndpoints({
|
165
|
+
overrideExisting: true,
|
201
166
|
endpoints: (builder) => ({
|
202
167
|
autoCloneDocument: builder.mutation({
|
203
168
|
query: ({ model, sourceId, query }) => ({
|
@@ -207,7 +172,12 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
207
172
|
params: query
|
208
173
|
}
|
209
174
|
}),
|
210
|
-
invalidatesTags: (_result,
|
175
|
+
invalidatesTags: (_result, error, { model }) => {
|
176
|
+
if (error) {
|
177
|
+
return [];
|
178
|
+
}
|
179
|
+
return [{ type: "Document", id: `${model}_LIST` }];
|
180
|
+
}
|
211
181
|
}),
|
212
182
|
cloneDocument: builder.mutation({
|
213
183
|
query: ({ model, sourceId, data, params }) => ({
|
@@ -294,6 +264,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
294
264
|
}),
|
295
265
|
providesTags: (result, _error, arg) => {
|
296
266
|
return [
|
267
|
+
{ type: "Document", id: `ALL_LIST` },
|
297
268
|
{ type: "Document", id: `${arg.model}_LIST` },
|
298
269
|
...result?.results.map(({ documentId }) => ({
|
299
270
|
type: "Document",
|
@@ -332,6 +303,11 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
332
303
|
{
|
333
304
|
type: "Document",
|
334
305
|
id: collectionType !== SINGLE_TYPES ? `${model}_${result && "documentId" in result ? result.documentId : documentId}` : model
|
306
|
+
},
|
307
|
+
// Make it easy to invalidate all individual documents queries for a model
|
308
|
+
{
|
309
|
+
type: "Document",
|
310
|
+
id: `${model}_ALL_ITEMS`
|
335
311
|
}
|
336
312
|
];
|
337
313
|
}
|
@@ -397,6 +373,18 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
397
373
|
},
|
398
374
|
"Relations"
|
399
375
|
];
|
376
|
+
},
|
377
|
+
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
378
|
+
const patchResult = dispatch(
|
379
|
+
documentApi.util.updateQueryData("getDocument", patch, (draft) => {
|
380
|
+
Object.assign(draft.data, data);
|
381
|
+
})
|
382
|
+
);
|
383
|
+
try {
|
384
|
+
await queryFulfilled;
|
385
|
+
} catch {
|
386
|
+
patchResult.undo();
|
387
|
+
}
|
400
388
|
}
|
401
389
|
}),
|
402
390
|
unpublishDocument: builder.mutation({
|
@@ -580,6 +568,14 @@ const createAttributeSchema = (attribute) => {
|
|
580
568
|
if (!value || typeof value === "string" && value.length === 0) {
|
581
569
|
return true;
|
582
570
|
}
|
571
|
+
if (typeof value === "object") {
|
572
|
+
try {
|
573
|
+
JSON.stringify(value);
|
574
|
+
return true;
|
575
|
+
} catch (err) {
|
576
|
+
return false;
|
577
|
+
}
|
578
|
+
}
|
583
579
|
try {
|
584
580
|
JSON.parse(value);
|
585
581
|
return true;
|
@@ -599,11 +595,11 @@ const createAttributeSchema = (attribute) => {
|
|
599
595
|
}
|
600
596
|
};
|
601
597
|
const addRequiredValidation = (attribute) => (schema) => {
|
602
|
-
if (attribute.required) {
|
603
|
-
return schema.required
|
604
|
-
|
605
|
-
|
606
|
-
|
598
|
+
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
599
|
+
return schema.min(1, translatedErrors.required);
|
600
|
+
}
|
601
|
+
if (attribute.required && attribute.type !== "relation") {
|
602
|
+
return schema.required(translatedErrors.required);
|
607
603
|
}
|
608
604
|
return schema?.nullable ? schema.nullable() : (
|
609
605
|
// In some cases '.nullable' will not be available on the schema.
|
@@ -637,6 +633,28 @@ const addMaxLengthValidation = (attribute) => (schema) => {
|
|
637
633
|
const addMinValidation = (attribute) => (schema) => {
|
638
634
|
if ("min" in attribute) {
|
639
635
|
const min = toInteger(attribute.min);
|
636
|
+
if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
|
637
|
+
if (!attribute.required && "test" in schema && min) {
|
638
|
+
return schema.test(
|
639
|
+
"custom-min",
|
640
|
+
{
|
641
|
+
...translatedErrors.min,
|
642
|
+
values: {
|
643
|
+
min: attribute.min
|
644
|
+
}
|
645
|
+
},
|
646
|
+
(value) => {
|
647
|
+
if (!value) {
|
648
|
+
return true;
|
649
|
+
}
|
650
|
+
if (Array.isArray(value) && value.length === 0) {
|
651
|
+
return true;
|
652
|
+
}
|
653
|
+
return value.length >= min;
|
654
|
+
}
|
655
|
+
);
|
656
|
+
}
|
657
|
+
}
|
640
658
|
if ("min" in schema && min) {
|
641
659
|
return schema.min(min, {
|
642
660
|
...translatedErrors.min,
|
@@ -763,7 +781,10 @@ const useDocument = (args, opts) => {
|
|
763
781
|
isLoading: isLoadingDocument,
|
764
782
|
isFetching: isFetchingDocument,
|
765
783
|
error
|
766
|
-
} = useGetDocumentQuery(args,
|
784
|
+
} = useGetDocumentQuery(args, {
|
785
|
+
...opts,
|
786
|
+
skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
|
787
|
+
});
|
767
788
|
const { components, schema, isLoading: isLoadingSchema } = useContentTypeSchema(args.model);
|
768
789
|
React.useEffect(() => {
|
769
790
|
if (error) {
|
@@ -927,12 +948,13 @@ const useDocumentActions = () => {
|
|
927
948
|
);
|
928
949
|
const [discardDocument] = useDiscardDocumentMutation();
|
929
950
|
const discard = React.useCallback(
|
930
|
-
async ({ collectionType, model, documentId }) => {
|
951
|
+
async ({ collectionType, model, documentId, params }) => {
|
931
952
|
try {
|
932
953
|
const res = await discardDocument({
|
933
954
|
collectionType,
|
934
955
|
model,
|
935
|
-
documentId
|
956
|
+
documentId,
|
957
|
+
params
|
936
958
|
});
|
937
959
|
if ("error" in res) {
|
938
960
|
toggleNotification({
|
@@ -1183,7 +1205,6 @@ const useDocumentActions = () => {
|
|
1183
1205
|
sourceId
|
1184
1206
|
});
|
1185
1207
|
if ("error" in res) {
|
1186
|
-
toggleNotification({ type: "danger", message: formatAPIError(res.error) });
|
1187
1208
|
return { error: res.error };
|
1188
1209
|
}
|
1189
1210
|
toggleNotification({
|
@@ -1264,7 +1285,7 @@ const useDocumentActions = () => {
|
|
1264
1285
|
};
|
1265
1286
|
};
|
1266
1287
|
const ProtectedHistoryPage = lazy(
|
1267
|
-
() => import("./History-
|
1288
|
+
() => import("./History-DR2txJLE.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1268
1289
|
);
|
1269
1290
|
const routes$1 = [
|
1270
1291
|
{
|
@@ -1277,31 +1298,31 @@ const routes$1 = [
|
|
1277
1298
|
}
|
1278
1299
|
];
|
1279
1300
|
const ProtectedEditViewPage = lazy(
|
1280
|
-
() => import("./EditViewPage-
|
1301
|
+
() => import("./EditViewPage-B7VgwJaG.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1281
1302
|
);
|
1282
1303
|
const ProtectedListViewPage = lazy(
|
1283
|
-
() => import("./ListViewPage-
|
1304
|
+
() => import("./ListViewPage-B_GaWgRH.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1284
1305
|
);
|
1285
1306
|
const ProtectedListConfiguration = lazy(
|
1286
|
-
() => import("./ListConfigurationPage-
|
1307
|
+
() => import("./ListConfigurationPage-voFVtXu6.mjs").then((mod) => ({
|
1287
1308
|
default: mod.ProtectedListConfiguration
|
1288
1309
|
}))
|
1289
1310
|
);
|
1290
1311
|
const ProtectedEditConfigurationPage = lazy(
|
1291
|
-
() => import("./EditConfigurationPage-
|
1312
|
+
() => import("./EditConfigurationPage-D7PrLO8j.mjs").then((mod) => ({
|
1292
1313
|
default: mod.ProtectedEditConfigurationPage
|
1293
1314
|
}))
|
1294
1315
|
);
|
1295
1316
|
const ProtectedComponentConfigurationPage = lazy(
|
1296
|
-
() => import("./ComponentConfigurationPage-
|
1317
|
+
() => import("./ComponentConfigurationPage-B3yDbeU1.mjs").then((mod) => ({
|
1297
1318
|
default: mod.ProtectedComponentConfigurationPage
|
1298
1319
|
}))
|
1299
1320
|
);
|
1300
1321
|
const NoPermissions = lazy(
|
1301
|
-
() => import("./NoPermissionsPage-
|
1322
|
+
() => import("./NoPermissionsPage-B5baIHal.mjs").then((mod) => ({ default: mod.NoPermissions }))
|
1302
1323
|
);
|
1303
1324
|
const NoContentType = lazy(
|
1304
|
-
() => import("./NoContentTypePage-
|
1325
|
+
() => import("./NoContentTypePage-CYiGpsbj.mjs").then((mod) => ({ default: mod.NoContentType }))
|
1305
1326
|
);
|
1306
1327
|
const CollectionTypePages = () => {
|
1307
1328
|
const { collectionType } = useParams();
|
@@ -1415,12 +1436,14 @@ const DocumentActionButton = (action) => {
|
|
1415
1436
|
/* @__PURE__ */ jsx(
|
1416
1437
|
Button,
|
1417
1438
|
{
|
1418
|
-
flex:
|
1439
|
+
flex: "auto",
|
1419
1440
|
startIcon: action.icon,
|
1420
1441
|
disabled: action.disabled,
|
1421
1442
|
onClick: handleClick(action),
|
1422
1443
|
justifyContent: "center",
|
1423
1444
|
variant: action.variant || "default",
|
1445
|
+
paddingTop: "7px",
|
1446
|
+
paddingBottom: "7px",
|
1424
1447
|
children: action.label
|
1425
1448
|
}
|
1426
1449
|
),
|
@@ -1428,7 +1451,7 @@ const DocumentActionButton = (action) => {
|
|
1428
1451
|
DocumentActionConfirmDialog,
|
1429
1452
|
{
|
1430
1453
|
...action.dialog,
|
1431
|
-
variant: action.variant,
|
1454
|
+
variant: action.dialog?.variant ?? action.variant,
|
1432
1455
|
isOpen: dialogId === action.id,
|
1433
1456
|
onClose: handleClose
|
1434
1457
|
}
|
@@ -1480,14 +1503,14 @@ const DocumentActionsMenu = ({
|
|
1480
1503
|
};
|
1481
1504
|
return /* @__PURE__ */ jsxs(Menu.Root, { open: isOpen, onOpenChange: setIsOpen, children: [
|
1482
1505
|
/* @__PURE__ */ jsxs(
|
1483
|
-
|
1506
|
+
StyledMoreButton,
|
1484
1507
|
{
|
1485
1508
|
disabled: isDisabled,
|
1486
1509
|
size: "S",
|
1487
1510
|
endIcon: null,
|
1488
|
-
paddingTop: "
|
1489
|
-
paddingLeft: "
|
1490
|
-
paddingRight: "
|
1511
|
+
paddingTop: "4px",
|
1512
|
+
paddingLeft: "7px",
|
1513
|
+
paddingRight: "7px",
|
1491
1514
|
variant,
|
1492
1515
|
children: [
|
1493
1516
|
/* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
|
@@ -1507,10 +1530,25 @@ const DocumentActionsMenu = ({
|
|
1507
1530
|
onSelect: handleClick(action),
|
1508
1531
|
display: "block",
|
1509
1532
|
children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", gap: 4, children: [
|
1510
|
-
/* @__PURE__ */ jsxs(
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1533
|
+
/* @__PURE__ */ jsxs(
|
1534
|
+
Flex,
|
1535
|
+
{
|
1536
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1537
|
+
gap: 2,
|
1538
|
+
tag: "span",
|
1539
|
+
children: [
|
1540
|
+
/* @__PURE__ */ jsx(
|
1541
|
+
Flex,
|
1542
|
+
{
|
1543
|
+
tag: "span",
|
1544
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1545
|
+
children: action.icon
|
1546
|
+
}
|
1547
|
+
),
|
1548
|
+
action.label
|
1549
|
+
]
|
1550
|
+
}
|
1551
|
+
),
|
1514
1552
|
action.id.startsWith("HistoryAction") && /* @__PURE__ */ jsx(
|
1515
1553
|
Flex,
|
1516
1554
|
{
|
@@ -1569,6 +1607,23 @@ const convertActionVariantToColor = (variant = "secondary") => {
|
|
1569
1607
|
return "primary600";
|
1570
1608
|
}
|
1571
1609
|
};
|
1610
|
+
const convertActionVariantToIconColor = (variant = "secondary") => {
|
1611
|
+
switch (variant) {
|
1612
|
+
case "danger":
|
1613
|
+
return "danger600";
|
1614
|
+
case "secondary":
|
1615
|
+
return "neutral500";
|
1616
|
+
case "success":
|
1617
|
+
return "success600";
|
1618
|
+
default:
|
1619
|
+
return "primary600";
|
1620
|
+
}
|
1621
|
+
};
|
1622
|
+
const StyledMoreButton = styled(Menu.Trigger)`
|
1623
|
+
& > span {
|
1624
|
+
display: flex;
|
1625
|
+
}
|
1626
|
+
`;
|
1572
1627
|
const DocumentActionConfirmDialog = ({
|
1573
1628
|
onClose,
|
1574
1629
|
onCancel,
|
@@ -1591,22 +1646,20 @@ const DocumentActionConfirmDialog = ({
|
|
1591
1646
|
}
|
1592
1647
|
onClose();
|
1593
1648
|
};
|
1594
|
-
return /* @__PURE__ */
|
1595
|
-
/* @__PURE__ */ jsx(
|
1596
|
-
/* @__PURE__ */ jsx(
|
1597
|
-
|
1598
|
-
{
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1608
|
-
)
|
1609
|
-
] });
|
1649
|
+
return /* @__PURE__ */ jsx(Dialog.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(Dialog.Content, { children: [
|
1650
|
+
/* @__PURE__ */ jsx(Dialog.Header, { children: title }),
|
1651
|
+
/* @__PURE__ */ jsx(Dialog.Body, { children: content }),
|
1652
|
+
/* @__PURE__ */ jsxs(Dialog.Footer, { children: [
|
1653
|
+
/* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", children: formatMessage({
|
1654
|
+
id: "app.components.Button.cancel",
|
1655
|
+
defaultMessage: "Cancel"
|
1656
|
+
}) }) }),
|
1657
|
+
/* @__PURE__ */ jsx(Button, { onClick: handleConfirm, variant, children: formatMessage({
|
1658
|
+
id: "app.components.Button.confirm",
|
1659
|
+
defaultMessage: "Confirm"
|
1660
|
+
}) })
|
1661
|
+
] })
|
1662
|
+
] }) });
|
1610
1663
|
};
|
1611
1664
|
const DocumentActionModal = ({
|
1612
1665
|
isOpen,
|
@@ -1616,34 +1669,17 @@ const DocumentActionModal = ({
|
|
1616
1669
|
content: Content,
|
1617
1670
|
onModalClose
|
1618
1671
|
}) => {
|
1619
|
-
const id = React.useId();
|
1620
|
-
if (!isOpen) {
|
1621
|
-
return null;
|
1622
|
-
}
|
1623
1672
|
const handleClose = () => {
|
1624
1673
|
if (onClose) {
|
1625
1674
|
onClose();
|
1626
1675
|
}
|
1627
1676
|
onModalClose();
|
1628
1677
|
};
|
1629
|
-
return /* @__PURE__ */
|
1630
|
-
/* @__PURE__ */ jsx(
|
1631
|
-
|
1632
|
-
/* @__PURE__ */ jsx(
|
1633
|
-
|
1634
|
-
{
|
1635
|
-
paddingTop: 4,
|
1636
|
-
paddingBottom: 4,
|
1637
|
-
paddingLeft: 5,
|
1638
|
-
paddingRight: 5,
|
1639
|
-
borderWidth: "1px 0 0 0",
|
1640
|
-
borderStyle: "solid",
|
1641
|
-
borderColor: "neutral150",
|
1642
|
-
background: "neutral100",
|
1643
|
-
children: typeof Footer === "function" ? /* @__PURE__ */ jsx(Footer, { onClose: handleClose }) : Footer
|
1644
|
-
}
|
1645
|
-
)
|
1646
|
-
] });
|
1678
|
+
return /* @__PURE__ */ jsx(Modal.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(Modal.Content, { children: [
|
1679
|
+
/* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: title }) }),
|
1680
|
+
typeof Content === "function" ? /* @__PURE__ */ jsx(Content, { onClose: handleClose }) : /* @__PURE__ */ jsx(Modal.Body, { children: Content }),
|
1681
|
+
typeof Footer === "function" ? /* @__PURE__ */ jsx(Footer, { onClose: handleClose }) : Footer
|
1682
|
+
] }) });
|
1647
1683
|
};
|
1648
1684
|
const PublishAction$1 = ({
|
1649
1685
|
activeTab,
|
@@ -1664,6 +1700,12 @@ const PublishAction$1 = ({
|
|
1664
1700
|
({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
|
1665
1701
|
);
|
1666
1702
|
const { publish } = useDocumentActions();
|
1703
|
+
const [
|
1704
|
+
countDraftRelations,
|
1705
|
+
{ isLoading: isLoadingDraftRelations, isError: isErrorDraftRelations }
|
1706
|
+
] = useLazyGetDraftRelationCountQuery();
|
1707
|
+
const [localCountOfDraftRelations, setLocalCountOfDraftRelations] = React.useState(0);
|
1708
|
+
const [serverCountOfDraftRelations, setServerCountOfDraftRelations] = React.useState(0);
|
1667
1709
|
const [{ query, rawQuery }] = useQueryParams();
|
1668
1710
|
const params = React.useMemo(() => buildValidParams(query), [query]);
|
1669
1711
|
const modified = useForm("PublishAction", ({ modified: modified2 }) => modified2);
|
@@ -1672,10 +1714,101 @@ const PublishAction$1 = ({
|
|
1672
1714
|
const validate = useForm("PublishAction", (state) => state.validate);
|
1673
1715
|
const setErrors = useForm("PublishAction", (state) => state.setErrors);
|
1674
1716
|
const formValues = useForm("PublishAction", ({ values }) => values);
|
1717
|
+
React.useEffect(() => {
|
1718
|
+
if (isErrorDraftRelations) {
|
1719
|
+
toggleNotification({
|
1720
|
+
type: "danger",
|
1721
|
+
message: formatMessage({
|
1722
|
+
id: getTranslation("error.records.fetch-draft-relatons"),
|
1723
|
+
defaultMessage: "An error occurred while fetching draft relations on this document."
|
1724
|
+
})
|
1725
|
+
});
|
1726
|
+
}
|
1727
|
+
}, [isErrorDraftRelations, toggleNotification, formatMessage]);
|
1728
|
+
React.useEffect(() => {
|
1729
|
+
const localDraftRelations = /* @__PURE__ */ new Set();
|
1730
|
+
const extractDraftRelations = (data) => {
|
1731
|
+
const relations = data.connect || [];
|
1732
|
+
relations.forEach((relation) => {
|
1733
|
+
if (relation.status === "draft") {
|
1734
|
+
localDraftRelations.add(relation.id);
|
1735
|
+
}
|
1736
|
+
});
|
1737
|
+
};
|
1738
|
+
const traverseAndExtract = (data) => {
|
1739
|
+
Object.entries(data).forEach(([key, value]) => {
|
1740
|
+
if (key === "connect" && Array.isArray(value)) {
|
1741
|
+
extractDraftRelations({ connect: value });
|
1742
|
+
} else if (typeof value === "object" && value !== null) {
|
1743
|
+
traverseAndExtract(value);
|
1744
|
+
}
|
1745
|
+
});
|
1746
|
+
};
|
1747
|
+
if (!documentId || modified) {
|
1748
|
+
traverseAndExtract(formValues);
|
1749
|
+
setLocalCountOfDraftRelations(localDraftRelations.size);
|
1750
|
+
}
|
1751
|
+
}, [documentId, modified, formValues, setLocalCountOfDraftRelations]);
|
1752
|
+
React.useEffect(() => {
|
1753
|
+
if (documentId) {
|
1754
|
+
const fetchDraftRelationsCount = async () => {
|
1755
|
+
const { data, error } = await countDraftRelations({
|
1756
|
+
collectionType,
|
1757
|
+
model,
|
1758
|
+
documentId,
|
1759
|
+
params
|
1760
|
+
});
|
1761
|
+
if (error) {
|
1762
|
+
throw error;
|
1763
|
+
}
|
1764
|
+
if (data) {
|
1765
|
+
setServerCountOfDraftRelations(data.data);
|
1766
|
+
}
|
1767
|
+
};
|
1768
|
+
fetchDraftRelationsCount();
|
1769
|
+
}
|
1770
|
+
}, [documentId, countDraftRelations, collectionType, model, params]);
|
1675
1771
|
const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
|
1676
1772
|
if (!schema?.options?.draftAndPublish) {
|
1677
1773
|
return null;
|
1678
1774
|
}
|
1775
|
+
const performPublish = async () => {
|
1776
|
+
setSubmitting(true);
|
1777
|
+
try {
|
1778
|
+
const { errors } = await validate();
|
1779
|
+
if (errors) {
|
1780
|
+
toggleNotification({
|
1781
|
+
type: "danger",
|
1782
|
+
message: formatMessage({
|
1783
|
+
id: "content-manager.validation.error",
|
1784
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
1785
|
+
})
|
1786
|
+
});
|
1787
|
+
return;
|
1788
|
+
}
|
1789
|
+
const res = await publish(
|
1790
|
+
{
|
1791
|
+
collectionType,
|
1792
|
+
model,
|
1793
|
+
documentId,
|
1794
|
+
params
|
1795
|
+
},
|
1796
|
+
formValues
|
1797
|
+
);
|
1798
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1799
|
+
navigate({
|
1800
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
1801
|
+
search: rawQuery
|
1802
|
+
});
|
1803
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1804
|
+
setErrors(formatValidationErrors(res.error));
|
1805
|
+
}
|
1806
|
+
} finally {
|
1807
|
+
setSubmitting(false);
|
1808
|
+
}
|
1809
|
+
};
|
1810
|
+
const totalDraftRelations = localCountOfDraftRelations + serverCountOfDraftRelations;
|
1811
|
+
const hasDraftRelations = totalDraftRelations > 0;
|
1679
1812
|
return {
|
1680
1813
|
/**
|
1681
1814
|
* Disabled when:
|
@@ -1685,49 +1818,39 @@ const PublishAction$1 = ({
|
|
1685
1818
|
* - the document is already published & not modified
|
1686
1819
|
* - the document is being created & not modified
|
1687
1820
|
* - the user doesn't have the permission to publish
|
1688
|
-
* - the user doesn't have the permission to create a new document
|
1689
|
-
* - the user doesn't have the permission to update the document
|
1690
1821
|
*/
|
1691
|
-
disabled: isCloning || isSubmitting || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish
|
1822
|
+
disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish,
|
1692
1823
|
label: formatMessage({
|
1693
1824
|
id: "app.utils.publish",
|
1694
1825
|
defaultMessage: "Publish"
|
1695
1826
|
}),
|
1696
1827
|
onClick: async () => {
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
formValues
|
1718
|
-
);
|
1719
|
-
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1720
|
-
navigate({
|
1721
|
-
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
1722
|
-
search: rawQuery
|
1723
|
-
});
|
1724
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1725
|
-
setErrors(formatValidationErrors(res.error));
|
1828
|
+
if (hasDraftRelations) {
|
1829
|
+
return;
|
1830
|
+
}
|
1831
|
+
await performPublish();
|
1832
|
+
},
|
1833
|
+
dialog: hasDraftRelations ? {
|
1834
|
+
type: "dialog",
|
1835
|
+
variant: "danger",
|
1836
|
+
footer: null,
|
1837
|
+
title: formatMessage({
|
1838
|
+
id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.title`),
|
1839
|
+
defaultMessage: "Confirmation"
|
1840
|
+
}),
|
1841
|
+
content: formatMessage(
|
1842
|
+
{
|
1843
|
+
id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.message`),
|
1844
|
+
defaultMessage: "This entry is related to {count, plural, one {# draft entry} other {# draft entries}}. Publishing it could leave broken links in your app."
|
1845
|
+
},
|
1846
|
+
{
|
1847
|
+
count: totalDraftRelations
|
1726
1848
|
}
|
1727
|
-
|
1728
|
-
|
1849
|
+
),
|
1850
|
+
onConfirm: async () => {
|
1851
|
+
await performPublish();
|
1729
1852
|
}
|
1730
|
-
}
|
1853
|
+
} : void 0
|
1731
1854
|
};
|
1732
1855
|
};
|
1733
1856
|
PublishAction$1.type = "publish";
|
@@ -1743,7 +1866,7 @@ const UpdateAction = ({
|
|
1743
1866
|
const cloneMatch = useMatch(CLONE_PATH);
|
1744
1867
|
const isCloning = cloneMatch !== null;
|
1745
1868
|
const { formatMessage } = useIntl();
|
1746
|
-
|
1869
|
+
useDocumentRBAC("UpdateAction", ({ canCreate: canCreate2, canUpdate: canUpdate2 }) => ({
|
1747
1870
|
canCreate: canCreate2,
|
1748
1871
|
canUpdate: canUpdate2
|
1749
1872
|
}));
|
@@ -1763,10 +1886,8 @@ const UpdateAction = ({
|
|
1763
1886
|
* - the form is submitting
|
1764
1887
|
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
1765
1888
|
* - the active tab is the published tab
|
1766
|
-
* - the user doesn't have the permission to create a new document
|
1767
|
-
* - the user doesn't have the permission to update the document
|
1768
1889
|
*/
|
1769
|
-
disabled: isSubmitting || !modified && !isCloning || activeTab === "published"
|
1890
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
1770
1891
|
label: formatMessage({
|
1771
1892
|
id: "content-manager.containers.Edit.save",
|
1772
1893
|
defaultMessage: "Save"
|
@@ -1795,10 +1916,13 @@ const UpdateAction = ({
|
|
1795
1916
|
document
|
1796
1917
|
);
|
1797
1918
|
if ("data" in res) {
|
1798
|
-
navigate(
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1919
|
+
navigate(
|
1920
|
+
{
|
1921
|
+
pathname: `../${res.data.documentId}`,
|
1922
|
+
search: rawQuery
|
1923
|
+
},
|
1924
|
+
{ relative: "path" }
|
1925
|
+
);
|
1802
1926
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1803
1927
|
setErrors(formatValidationErrors(res.error));
|
1804
1928
|
}
|
@@ -1826,10 +1950,13 @@ const UpdateAction = ({
|
|
1826
1950
|
document
|
1827
1951
|
);
|
1828
1952
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1829
|
-
navigate(
|
1830
|
-
|
1831
|
-
|
1832
|
-
|
1953
|
+
navigate(
|
1954
|
+
{
|
1955
|
+
pathname: `../${res.data.documentId}`,
|
1956
|
+
search: rawQuery
|
1957
|
+
},
|
1958
|
+
{ replace: true, relative: "path" }
|
1959
|
+
);
|
1833
1960
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1834
1961
|
setErrors(formatValidationErrors(res.error));
|
1835
1962
|
}
|
@@ -1861,10 +1988,8 @@ const UnpublishAction$1 = ({
|
|
1861
1988
|
const { toggleNotification } = useNotification();
|
1862
1989
|
const [shouldKeepDraft, setShouldKeepDraft] = React.useState(true);
|
1863
1990
|
const isDocumentModified = document?.status === "modified";
|
1864
|
-
const handleChange = (
|
1865
|
-
|
1866
|
-
setShouldKeepDraft(e.target.value === UNPUBLISH_DRAFT_OPTIONS.KEEP);
|
1867
|
-
}
|
1991
|
+
const handleChange = (value) => {
|
1992
|
+
setShouldKeepDraft(value === UNPUBLISH_DRAFT_OPTIONS.KEEP);
|
1868
1993
|
};
|
1869
1994
|
if (!schema?.options?.draftAndPublish) {
|
1870
1995
|
return null;
|
@@ -1914,40 +2039,24 @@ const UnpublishAction$1 = ({
|
|
1914
2039
|
}) })
|
1915
2040
|
] }),
|
1916
2041
|
/* @__PURE__ */ jsxs(
|
1917
|
-
|
2042
|
+
Radio.Group,
|
1918
2043
|
{
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
2044
|
+
defaultValue: UNPUBLISH_DRAFT_OPTIONS.KEEP,
|
2045
|
+
name: "discard-options",
|
2046
|
+
"aria-label": formatMessage({
|
2047
|
+
id: "content-manager.actions.unpublish.dialog.radio-label",
|
2048
|
+
defaultMessage: "Choose an option to unpublish the document."
|
2049
|
+
}),
|
2050
|
+
onValueChange: handleChange,
|
1925
2051
|
children: [
|
1926
|
-
/* @__PURE__ */ jsx(
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
id: "content-manager.actions.unpublish.dialog.option.keep-draft",
|
1935
|
-
defaultMessage: "Keep draft"
|
1936
|
-
})
|
1937
|
-
}
|
1938
|
-
),
|
1939
|
-
/* @__PURE__ */ jsx(
|
1940
|
-
Radio,
|
1941
|
-
{
|
1942
|
-
checked: !shouldKeepDraft,
|
1943
|
-
value: UNPUBLISH_DRAFT_OPTIONS.DISCARD,
|
1944
|
-
name: "discard-options",
|
1945
|
-
children: formatMessage({
|
1946
|
-
id: "content-manager.actions.unpublish.dialog.option.replace-draft",
|
1947
|
-
defaultMessage: "Replace draft"
|
1948
|
-
})
|
1949
|
-
}
|
1950
|
-
)
|
2052
|
+
/* @__PURE__ */ jsx(Radio.Item, { checked: shouldKeepDraft, value: UNPUBLISH_DRAFT_OPTIONS.KEEP, children: formatMessage({
|
2053
|
+
id: "content-manager.actions.unpublish.dialog.option.keep-draft",
|
2054
|
+
defaultMessage: "Keep draft"
|
2055
|
+
}) }),
|
2056
|
+
/* @__PURE__ */ jsx(Radio.Item, { checked: !shouldKeepDraft, value: UNPUBLISH_DRAFT_OPTIONS.DISCARD, children: formatMessage({
|
2057
|
+
id: "content-manager.actions.unpublish.dialog.option.replace-draft",
|
2058
|
+
defaultMessage: "Replace draft"
|
2059
|
+
}) })
|
1951
2060
|
]
|
1952
2061
|
}
|
1953
2062
|
)
|
@@ -2093,23 +2202,13 @@ const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
|
2093
2202
|
id: "content-manager.containers.edit.title.new",
|
2094
2203
|
defaultMessage: "Create an entry"
|
2095
2204
|
}) : documentTitle;
|
2096
|
-
return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop:
|
2205
|
+
return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2097
2206
|
/* @__PURE__ */ jsx(BackButton, {}),
|
2098
|
-
/* @__PURE__ */ jsxs(
|
2099
|
-
|
2100
|
-
{
|
2101
|
-
|
2102
|
-
|
2103
|
-
paddingTop: 1,
|
2104
|
-
gap: "80px",
|
2105
|
-
alignItems: "flex-start",
|
2106
|
-
children: [
|
2107
|
-
/* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
|
2108
|
-
/* @__PURE__ */ jsx(HeaderToolbar, {})
|
2109
|
-
]
|
2110
|
-
}
|
2111
|
-
),
|
2112
|
-
status ? /* @__PURE__ */ jsx(DocumentStatus, { status: isCloning ? "draft" : status }) : null
|
2207
|
+
/* @__PURE__ */ jsxs(Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2208
|
+
/* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
|
2209
|
+
/* @__PURE__ */ jsx(HeaderToolbar, {})
|
2210
|
+
] }),
|
2211
|
+
status ? /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(DocumentStatus, { status: isCloning ? "draft" : status }) }) : null
|
2113
2212
|
] });
|
2114
2213
|
};
|
2115
2214
|
const HeaderToolbar = () => {
|
@@ -2800,30 +2899,23 @@ const ConfirmBulkActionDialog = ({
|
|
2800
2899
|
endAction
|
2801
2900
|
}) => {
|
2802
2901
|
const { formatMessage } = useIntl();
|
2803
|
-
return /* @__PURE__ */ jsxs(
|
2804
|
-
Dialog,
|
2805
|
-
|
2806
|
-
|
2807
|
-
|
2808
|
-
|
2809
|
-
|
2810
|
-
|
2811
|
-
|
2812
|
-
|
2813
|
-
|
2814
|
-
|
2815
|
-
|
2816
|
-
|
2817
|
-
|
2818
|
-
|
2819
|
-
|
2820
|
-
}) }),
|
2821
|
-
endAction
|
2822
|
-
}
|
2823
|
-
)
|
2824
|
-
]
|
2825
|
-
}
|
2826
|
-
);
|
2902
|
+
return /* @__PURE__ */ jsx(Dialog.Root, { open: isOpen, children: /* @__PURE__ */ jsxs(Dialog.Content, { children: [
|
2903
|
+
/* @__PURE__ */ jsx(Dialog.Header, { children: formatMessage({
|
2904
|
+
id: "app.components.ConfirmDialog.title",
|
2905
|
+
defaultMessage: "Confirmation"
|
2906
|
+
}) }),
|
2907
|
+
/* @__PURE__ */ jsx(Dialog.Body, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
2908
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
|
2909
|
+
dialogBody
|
2910
|
+
] }) }),
|
2911
|
+
/* @__PURE__ */ jsxs(Dialog.Footer, { children: [
|
2912
|
+
/* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { fullWidth: true, onClick: onToggleDialog, variant: "tertiary", children: formatMessage({
|
2913
|
+
id: "app.components.Button.cancel",
|
2914
|
+
defaultMessage: "Cancel"
|
2915
|
+
}) }) }),
|
2916
|
+
endAction
|
2917
|
+
] })
|
2918
|
+
] }) });
|
2827
2919
|
};
|
2828
2920
|
const BoldChunk$1 = (chunks) => /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: chunks });
|
2829
2921
|
const ConfirmDialogPublishAll = ({
|
@@ -2928,16 +3020,30 @@ const formatErrorMessages = (errors, parentKey, formatMessage) => {
|
|
2928
3020
|
)
|
2929
3021
|
);
|
2930
3022
|
} else {
|
2931
|
-
messages.push(
|
3023
|
+
messages.push(
|
3024
|
+
...formatErrorMessages(
|
3025
|
+
// @ts-expect-error TODO: check why value is not compatible with FormErrors
|
3026
|
+
value,
|
3027
|
+
currentKey,
|
3028
|
+
formatMessage
|
3029
|
+
)
|
3030
|
+
);
|
2932
3031
|
}
|
3032
|
+
} else {
|
3033
|
+
messages.push(
|
3034
|
+
formatMessage(
|
3035
|
+
{
|
3036
|
+
id: `${value}.withField`,
|
3037
|
+
defaultMessage: value
|
3038
|
+
},
|
3039
|
+
{ field: currentKey }
|
3040
|
+
)
|
3041
|
+
);
|
2933
3042
|
}
|
2934
3043
|
});
|
2935
3044
|
return messages;
|
2936
3045
|
};
|
2937
|
-
const EntryValidationText = ({
|
2938
|
-
validationErrors,
|
2939
|
-
isPublished = false
|
2940
|
-
}) => {
|
3046
|
+
const EntryValidationText = ({ validationErrors, status }) => {
|
2941
3047
|
const { formatMessage } = useIntl();
|
2942
3048
|
if (validationErrors) {
|
2943
3049
|
const validationErrorsMessages = formatErrorMessages(validationErrors, "", formatMessage).join(
|
@@ -2948,7 +3054,7 @@ const EntryValidationText = ({
|
|
2948
3054
|
/* @__PURE__ */ jsx(Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
2949
3055
|
] });
|
2950
3056
|
}
|
2951
|
-
if (
|
3057
|
+
if (status === "published") {
|
2952
3058
|
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
2953
3059
|
/* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
2954
3060
|
/* @__PURE__ */ jsx(Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
@@ -2957,6 +3063,15 @@ const EntryValidationText = ({
|
|
2957
3063
|
}) })
|
2958
3064
|
] });
|
2959
3065
|
}
|
3066
|
+
if (status === "modified") {
|
3067
|
+
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
3068
|
+
/* @__PURE__ */ jsx(ArrowsCounterClockwise, { fill: "alternative600" }),
|
3069
|
+
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
3070
|
+
id: "content-manager.bulk-publish.modified",
|
3071
|
+
defaultMessage: "Ready to publish changes"
|
3072
|
+
}) })
|
3073
|
+
] });
|
3074
|
+
}
|
2960
3075
|
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
2961
3076
|
/* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
2962
3077
|
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
@@ -3008,7 +3123,7 @@ const SelectedEntriesTableContent = ({
|
|
3008
3123
|
EntryValidationText,
|
3009
3124
|
{
|
3010
3125
|
validationErrors: validationErrors[row.documentId],
|
3011
|
-
|
3126
|
+
status: row.status
|
3012
3127
|
}
|
3013
3128
|
) }),
|
3014
3129
|
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(
|
@@ -3149,7 +3264,7 @@ const SelectedEntriesModalContent = ({
|
|
3149
3264
|
);
|
3150
3265
|
};
|
3151
3266
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
3152
|
-
/* @__PURE__ */ jsxs(
|
3267
|
+
/* @__PURE__ */ jsxs(Modal.Body, { children: [
|
3153
3268
|
/* @__PURE__ */ jsx(Typography, { children: getFormattedCountMessage() }),
|
3154
3269
|
/* @__PURE__ */ jsx(Box, { marginTop: 5, children: /* @__PURE__ */ jsx(
|
3155
3270
|
SelectedEntriesTableContent,
|
@@ -3161,27 +3276,24 @@ const SelectedEntriesModalContent = ({
|
|
3161
3276
|
}
|
3162
3277
|
) })
|
3163
3278
|
] }),
|
3164
|
-
/* @__PURE__ */
|
3165
|
-
|
3166
|
-
|
3167
|
-
|
3168
|
-
|
3169
|
-
|
3170
|
-
}) }),
|
3171
|
-
|
3172
|
-
|
3173
|
-
|
3174
|
-
|
3175
|
-
|
3176
|
-
|
3177
|
-
|
3178
|
-
|
3179
|
-
|
3180
|
-
|
3181
|
-
|
3182
|
-
] })
|
3183
|
-
}
|
3184
|
-
),
|
3279
|
+
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
3280
|
+
/* @__PURE__ */ jsx(Button, { onClick: toggleModal, variant: "tertiary", children: formatMessage({
|
3281
|
+
id: "app.components.Button.cancel",
|
3282
|
+
defaultMessage: "Cancel"
|
3283
|
+
}) }),
|
3284
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
3285
|
+
/* @__PURE__ */ jsx(Button, { onClick: refetch, variant: "tertiary", loading: isFetching, children: formatMessage({ id: "app.utils.refresh", defaultMessage: "Refresh" }) }),
|
3286
|
+
/* @__PURE__ */ jsx(
|
3287
|
+
Button,
|
3288
|
+
{
|
3289
|
+
onClick: toggleDialog,
|
3290
|
+
disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount || selectedEntriesPublished === selectedEntries.length || isLoading,
|
3291
|
+
loading: isSubmittingForm,
|
3292
|
+
children: formatMessage({ id: "app.utils.publish", defaultMessage: "Publish" })
|
3293
|
+
}
|
3294
|
+
)
|
3295
|
+
] })
|
3296
|
+
] }),
|
3185
3297
|
/* @__PURE__ */ jsx(
|
3186
3298
|
ConfirmDialogPublishAll,
|
3187
3299
|
{
|
@@ -3246,143 +3358,10 @@ const BulkActionsRenderer = () => {
|
|
3246
3358
|
documents: selectedRows
|
3247
3359
|
},
|
3248
3360
|
descriptions: plugins["content-manager"].apis.getBulkActions(),
|
3249
|
-
children: (actions2) => actions2.map((action) => /* @__PURE__ */ jsx(
|
3361
|
+
children: (actions2) => actions2.map((action) => /* @__PURE__ */ jsx(DocumentActionButton, { ...action }, action.id))
|
3250
3362
|
}
|
3251
3363
|
) });
|
3252
3364
|
};
|
3253
|
-
const BulkActionAction = (action) => {
|
3254
|
-
const [dialogId, setDialogId] = React.useState(null);
|
3255
|
-
const { toggleNotification } = useNotification();
|
3256
|
-
const handleClick = (action2) => (e) => {
|
3257
|
-
const { onClick, dialog, id } = action2;
|
3258
|
-
if (onClick) {
|
3259
|
-
onClick(e);
|
3260
|
-
}
|
3261
|
-
if (dialog) {
|
3262
|
-
switch (dialog.type) {
|
3263
|
-
case "notification":
|
3264
|
-
toggleNotification({
|
3265
|
-
title: dialog.title,
|
3266
|
-
message: dialog.content,
|
3267
|
-
type: dialog.status,
|
3268
|
-
timeout: dialog.timeout,
|
3269
|
-
onClose: dialog.onClose
|
3270
|
-
});
|
3271
|
-
break;
|
3272
|
-
case "dialog":
|
3273
|
-
case "modal": {
|
3274
|
-
e.preventDefault();
|
3275
|
-
setDialogId(id);
|
3276
|
-
}
|
3277
|
-
}
|
3278
|
-
}
|
3279
|
-
};
|
3280
|
-
const handleClose = () => {
|
3281
|
-
setDialogId(null);
|
3282
|
-
if (action.dialog?.type === "modal" && action.dialog?.onClose) {
|
3283
|
-
action.dialog.onClose();
|
3284
|
-
}
|
3285
|
-
};
|
3286
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
3287
|
-
/* @__PURE__ */ jsx(
|
3288
|
-
Button,
|
3289
|
-
{
|
3290
|
-
disabled: action.disabled,
|
3291
|
-
startIcon: action.icon,
|
3292
|
-
variant: action.variant,
|
3293
|
-
onClick: handleClick(action),
|
3294
|
-
children: action.label
|
3295
|
-
}
|
3296
|
-
),
|
3297
|
-
action.dialog?.type === "dialog" ? /* @__PURE__ */ jsx(
|
3298
|
-
BulkActionConfirmDialog,
|
3299
|
-
{
|
3300
|
-
...action.dialog,
|
3301
|
-
variant: action.variant,
|
3302
|
-
isOpen: dialogId === action.id,
|
3303
|
-
onClose: handleClose
|
3304
|
-
}
|
3305
|
-
) : null,
|
3306
|
-
action.dialog?.type === "modal" ? /* @__PURE__ */ jsx(
|
3307
|
-
BulkActionModal,
|
3308
|
-
{
|
3309
|
-
...action.dialog,
|
3310
|
-
onModalClose: handleClose,
|
3311
|
-
isOpen: dialogId === action.id
|
3312
|
-
}
|
3313
|
-
) : null
|
3314
|
-
] });
|
3315
|
-
};
|
3316
|
-
const BulkActionConfirmDialog = ({
|
3317
|
-
onClose,
|
3318
|
-
onCancel,
|
3319
|
-
onConfirm,
|
3320
|
-
title,
|
3321
|
-
content,
|
3322
|
-
confirmButton,
|
3323
|
-
isOpen,
|
3324
|
-
variant = "secondary"
|
3325
|
-
}) => {
|
3326
|
-
const { formatMessage } = useIntl();
|
3327
|
-
const handleClose = async () => {
|
3328
|
-
if (onCancel) {
|
3329
|
-
await onCancel();
|
3330
|
-
}
|
3331
|
-
onClose();
|
3332
|
-
};
|
3333
|
-
const handleConfirm = async () => {
|
3334
|
-
if (onConfirm) {
|
3335
|
-
await onConfirm();
|
3336
|
-
}
|
3337
|
-
onClose();
|
3338
|
-
};
|
3339
|
-
return /* @__PURE__ */ jsxs(Dialog, { isOpen, title, onClose: handleClose, children: [
|
3340
|
-
/* @__PURE__ */ jsx(DialogBody, { icon: /* @__PURE__ */ jsx(WarningCircle, {}), children: content }),
|
3341
|
-
/* @__PURE__ */ jsx(
|
3342
|
-
DialogFooter,
|
3343
|
-
{
|
3344
|
-
startAction: /* @__PURE__ */ jsx(Button, { onClick: handleClose, variant: "tertiary", children: formatMessage({
|
3345
|
-
id: "app.components.Button.cancel",
|
3346
|
-
defaultMessage: "Cancel"
|
3347
|
-
}) }),
|
3348
|
-
endAction: /* @__PURE__ */ jsx(
|
3349
|
-
Button,
|
3350
|
-
{
|
3351
|
-
onClick: handleConfirm,
|
3352
|
-
variant: variant === "danger-light" ? variant : "secondary",
|
3353
|
-
startIcon: variant === "danger-light" ? /* @__PURE__ */ jsx(Trash, {}) : /* @__PURE__ */ jsx(Check, {}),
|
3354
|
-
children: confirmButton ? confirmButton : formatMessage({
|
3355
|
-
id: "app.components.Button.confirm",
|
3356
|
-
defaultMessage: "Confirm"
|
3357
|
-
})
|
3358
|
-
}
|
3359
|
-
)
|
3360
|
-
}
|
3361
|
-
)
|
3362
|
-
] });
|
3363
|
-
};
|
3364
|
-
const BulkActionModal = ({
|
3365
|
-
isOpen,
|
3366
|
-
title,
|
3367
|
-
onClose,
|
3368
|
-
content: Content,
|
3369
|
-
onModalClose
|
3370
|
-
}) => {
|
3371
|
-
const id = React.useId();
|
3372
|
-
if (!isOpen) {
|
3373
|
-
return null;
|
3374
|
-
}
|
3375
|
-
const handleClose = () => {
|
3376
|
-
if (onClose) {
|
3377
|
-
onClose();
|
3378
|
-
}
|
3379
|
-
onModalClose();
|
3380
|
-
};
|
3381
|
-
return /* @__PURE__ */ jsxs(ModalLayout, { borderRadius: "4px", overflow: "hidden", onClose: handleClose, labelledBy: id, children: [
|
3382
|
-
/* @__PURE__ */ jsx(ModalHeader, { children: /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", textColor: "neutral800", tag: "h2", id, children: title }) }),
|
3383
|
-
/* @__PURE__ */ jsx(Content, { onClose: handleClose })
|
3384
|
-
] });
|
3385
|
-
};
|
3386
3365
|
const DeleteAction = ({ documents, model }) => {
|
3387
3366
|
const { formatMessage } = useIntl();
|
3388
3367
|
const { schema: contentType } = useDoc();
|
@@ -3415,6 +3394,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3415
3394
|
defaultMessage: "Confirmation"
|
3416
3395
|
}),
|
3417
3396
|
content: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
3397
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
|
3418
3398
|
/* @__PURE__ */ jsx(Typography, { id: "confirm-description", textAlign: "center", children: formatMessage({
|
3419
3399
|
id: "popUpWarning.bodyMessage.contentType.delete.all",
|
3420
3400
|
defaultMessage: "Are you sure you want to delete these entries?"
|
@@ -3451,7 +3431,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3451
3431
|
selectRow([]);
|
3452
3432
|
}
|
3453
3433
|
};
|
3454
|
-
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published");
|
3434
|
+
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3455
3435
|
if (!showUnpublishButton)
|
3456
3436
|
return null;
|
3457
3437
|
return {
|
@@ -3464,6 +3444,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3464
3444
|
defaultMessage: "Confirmation"
|
3465
3445
|
}),
|
3466
3446
|
content: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
3447
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
|
3467
3448
|
/* @__PURE__ */ jsx(Typography, { id: "confirm-description", textAlign: "center", children: formatMessage({
|
3468
3449
|
id: "popUpWarning.bodyMessage.contentType.unpublish.all",
|
3469
3450
|
defaultMessage: "Are you sure you want to unpublish these entries?"
|
@@ -3709,8 +3690,7 @@ class ContentManagerPlugin {
|
|
3709
3690
|
documentActions = [
|
3710
3691
|
...DEFAULT_ACTIONS,
|
3711
3692
|
...DEFAULT_TABLE_ROW_ACTIONS,
|
3712
|
-
...DEFAULT_HEADER_ACTIONS
|
3713
|
-
HistoryAction
|
3693
|
+
...DEFAULT_HEADER_ACTIONS
|
3714
3694
|
];
|
3715
3695
|
editViewSidePanels = [ActionsPanel];
|
3716
3696
|
headerActions = [];
|
@@ -3799,6 +3779,52 @@ const getPrintableType = (value) => {
|
|
3799
3779
|
}
|
3800
3780
|
return nativeType;
|
3801
3781
|
};
|
3782
|
+
const HistoryAction = ({ model, document }) => {
|
3783
|
+
const { formatMessage } = useIntl();
|
3784
|
+
const [{ query }] = useQueryParams();
|
3785
|
+
const navigate = useNavigate();
|
3786
|
+
const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
|
3787
|
+
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3788
|
+
return null;
|
3789
|
+
}
|
3790
|
+
return {
|
3791
|
+
icon: /* @__PURE__ */ jsx(ClockCounterClockwise, {}),
|
3792
|
+
label: formatMessage({
|
3793
|
+
id: "content-manager.history.document-action",
|
3794
|
+
defaultMessage: "Content History"
|
3795
|
+
}),
|
3796
|
+
onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
|
3797
|
+
disabled: (
|
3798
|
+
/**
|
3799
|
+
* The user is creating a new document.
|
3800
|
+
* It hasn't been saved yet, so there's no history to go to
|
3801
|
+
*/
|
3802
|
+
!document || /**
|
3803
|
+
* The document has been created but the current dimension has never been saved.
|
3804
|
+
* For example, the user is creating a new locale in an existing document,
|
3805
|
+
* so there's no history for the document in that locale
|
3806
|
+
*/
|
3807
|
+
!document.id || /**
|
3808
|
+
* History is only available for content types created by the user.
|
3809
|
+
* These have the `api::` prefix, as opposed to the ones created by Strapi or plugins,
|
3810
|
+
* which start with `admin::` or `plugin::`
|
3811
|
+
*/
|
3812
|
+
!model.startsWith("api::")
|
3813
|
+
),
|
3814
|
+
position: "header"
|
3815
|
+
};
|
3816
|
+
};
|
3817
|
+
HistoryAction.type = "history";
|
3818
|
+
const historyAdmin = {
|
3819
|
+
bootstrap(app) {
|
3820
|
+
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
3821
|
+
addDocumentAction((actions2) => {
|
3822
|
+
const indexOfDeleteAction = actions2.findIndex((action) => action.type === "delete");
|
3823
|
+
actions2.splice(indexOfDeleteAction, 0, HistoryAction);
|
3824
|
+
return actions2;
|
3825
|
+
});
|
3826
|
+
}
|
3827
|
+
};
|
3802
3828
|
const initialState = {
|
3803
3829
|
collectionTypeLinks: [],
|
3804
3830
|
components: [],
|
@@ -3849,15 +3875,29 @@ const index = {
|
|
3849
3875
|
defaultMessage: "Content Manager"
|
3850
3876
|
},
|
3851
3877
|
permissions: [],
|
3852
|
-
Component: () => import("./layout-CPn1PM6x.mjs").then((mod) => ({ default: mod.Layout })),
|
3853
3878
|
position: 1
|
3854
3879
|
});
|
3880
|
+
app.router.addRoute({
|
3881
|
+
path: "content-manager/*",
|
3882
|
+
lazy: async () => {
|
3883
|
+
const { Layout } = await import("./layout-BNqvLR_b.mjs");
|
3884
|
+
return {
|
3885
|
+
Component: Layout
|
3886
|
+
};
|
3887
|
+
},
|
3888
|
+
children: routes
|
3889
|
+
});
|
3855
3890
|
app.registerPlugin(cm.config);
|
3856
3891
|
},
|
3892
|
+
bootstrap(app) {
|
3893
|
+
if (typeof historyAdmin.bootstrap === "function") {
|
3894
|
+
historyAdmin.bootstrap(app);
|
3895
|
+
}
|
3896
|
+
},
|
3857
3897
|
async registerTrads({ locales }) {
|
3858
3898
|
const importedTrads = await Promise.all(
|
3859
3899
|
locales.map((locale) => {
|
3860
|
-
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-
|
3900
|
+
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-BrCTWlZv.mjs"), "./translations/es.json": () => import("./es-CeXiYflN.mjs"), "./translations/eu.json": () => import("./eu-CdALomew.mjs"), "./translations/fr.json": () => import("./fr-CD9VFbPM.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-CtsUxOvk.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`).then(({ default: data }) => {
|
3861
3901
|
return {
|
3862
3902
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
3863
3903
|
locale
|
@@ -3878,43 +3918,42 @@ export {
|
|
3878
3918
|
BulkActionsRenderer as B,
|
3879
3919
|
COLLECTION_TYPES as C,
|
3880
3920
|
DocumentStatus as D,
|
3881
|
-
|
3882
|
-
|
3883
|
-
|
3921
|
+
DEFAULT_SETTINGS as E,
|
3922
|
+
convertEditLayoutToFieldLayouts as F,
|
3923
|
+
useDocument as G,
|
3884
3924
|
HOOKS as H,
|
3885
3925
|
InjectionZone as I,
|
3886
|
-
|
3887
|
-
|
3888
|
-
useDocumentActions as L,
|
3926
|
+
index as J,
|
3927
|
+
useDocumentActions as K,
|
3889
3928
|
Panels as P,
|
3890
3929
|
RelativeTime as R,
|
3891
3930
|
SINGLE_TYPES as S,
|
3892
3931
|
TableActions as T,
|
3893
|
-
|
3894
|
-
|
3895
|
-
|
3896
|
-
|
3897
|
-
|
3898
|
-
|
3932
|
+
useGetInitialDataQuery as a,
|
3933
|
+
useGetAllContentTypeSettingsQuery as b,
|
3934
|
+
useDoc as c,
|
3935
|
+
buildValidParams as d,
|
3936
|
+
contentManagerApi as e,
|
3937
|
+
useDocumentRBAC as f,
|
3899
3938
|
getTranslation as g,
|
3900
|
-
|
3901
|
-
|
3902
|
-
|
3903
|
-
|
3904
|
-
|
3905
|
-
|
3906
|
-
|
3939
|
+
useDocumentLayout as h,
|
3940
|
+
createYupSchema as i,
|
3941
|
+
Header as j,
|
3942
|
+
PERMISSIONS as k,
|
3943
|
+
DocumentRBAC as l,
|
3944
|
+
DOCUMENT_META_FIELDS as m,
|
3945
|
+
useDocLayout as n,
|
3907
3946
|
useGetContentTypeConfigurationQuery as o,
|
3908
3947
|
CREATOR_FIELDS as p,
|
3909
3948
|
getMainField as q,
|
3910
|
-
|
3949
|
+
getDisplayName as r,
|
3911
3950
|
setInitialData as s,
|
3912
|
-
|
3913
|
-
|
3914
|
-
|
3915
|
-
|
3916
|
-
|
3917
|
-
|
3918
|
-
|
3919
|
-
};
|
3920
|
-
//# sourceMappingURL=index-
|
3951
|
+
checkIfAttributeIsDisplayable as t,
|
3952
|
+
useContentTypeSchema as u,
|
3953
|
+
useGetAllDocumentsQuery as v,
|
3954
|
+
convertListLayoutToFieldLayouts as w,
|
3955
|
+
capitalise as x,
|
3956
|
+
useUpdateContentTypeConfigurationMutation as y,
|
3957
|
+
extractContentTypeComponents as z
|
3958
|
+
};
|
3959
|
+
//# sourceMappingURL=index-C9TJPyni.mjs.map
|