@strapi/content-manager 0.0.0-experimental.59ce88771272039a9d868fba2f7b503edf715c6a → 0.0.0-experimental.5e04dee5c96cd68273df3b3cadf4635e19dc2afc
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-gdUj_t-O.mjs → ComponentConfigurationPage-B3yDbeU1.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-gdUj_t-O.mjs.map → ComponentConfigurationPage-B3yDbeU1.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-WRPUXGd6.js → ComponentConfigurationPage-KXSuLnQD.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-WRPUXGd6.js.map → ComponentConfigurationPage-KXSuLnQD.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-C1vjMBgy.js → EditConfigurationPage-BQ17--5R.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-C1vjMBgy.js.map → EditConfigurationPage-BQ17--5R.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-BwuIPOJG.mjs → EditConfigurationPage-D7PrLO8j.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-BwuIPOJG.mjs.map → EditConfigurationPage-D7PrLO8j.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-0MiFkXa8.mjs → EditViewPage-B7VgwJaG.mjs} +18 -7
- package/dist/_chunks/EditViewPage-B7VgwJaG.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-DbcGfyqK.js → EditViewPage-BgjdnGz2.js} +18 -7
- package/dist/_chunks/EditViewPage-BgjdnGz2.js.map +1 -0
- package/dist/_chunks/{Field-BG1xu38N.js → Field-CdK7ZLmv.js} +434 -83
- package/dist/_chunks/Field-CdK7ZLmv.js.map +1 -0
- package/dist/_chunks/{Field-BDMSCcy5.mjs → Field-tHCw4lGA.mjs} +435 -84
- package/dist/_chunks/Field-tHCw4lGA.mjs.map +1 -0
- package/dist/_chunks/{Form-CPVWavB8.mjs → Form-BJxdTv3Q.mjs} +26 -12
- package/dist/_chunks/Form-BJxdTv3Q.mjs.map +1 -0
- package/dist/_chunks/{Form-9BnFyUjy.js → Form-C_0KTVvV.js} +26 -12
- package/dist/_chunks/Form-C_0KTVvV.js.map +1 -0
- package/dist/_chunks/{History-BVpd8LP3.mjs → History-DR2txJLE.mjs} +44 -19
- package/dist/_chunks/History-DR2txJLE.mjs.map +1 -0
- package/dist/_chunks/{History-BWWxLt2Z.js → History-nuEzM5qm.js} +44 -19
- package/dist/_chunks/History-nuEzM5qm.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-6swzjdAZ.js → ListConfigurationPage-CnB86Psm.js} +20 -8
- package/dist/_chunks/ListConfigurationPage-CnB86Psm.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DozVMKcR.mjs → ListConfigurationPage-voFVtXu6.mjs} +20 -8
- package/dist/_chunks/ListConfigurationPage-voFVtXu6.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-Ds0ulgfG.mjs → ListViewPage-B_GaWgRH.mjs} +22 -8
- package/dist/_chunks/ListViewPage-B_GaWgRH.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-BlzfjS2Q.js → ListViewPage-SXIXm-RM.js} +21 -7
- package/dist/_chunks/ListViewPage-SXIXm-RM.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-D2nCCWEl.js → NoContentTypePage-BzsQ3hLZ.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-D2nCCWEl.js.map → NoContentTypePage-BzsQ3hLZ.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-BH11kaKt.mjs → NoContentTypePage-CYiGpsbj.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-BH11kaKt.mjs.map → NoContentTypePage-CYiGpsbj.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-BT2Tn0D_.mjs → NoPermissionsPage-B5baIHal.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-BT2Tn0D_.mjs.map → NoPermissionsPage-B5baIHal.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DN_JlsU2.js → NoPermissionsPage-IGkId4C5.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DN_JlsU2.js.map → NoPermissionsPage-IGkId4C5.js.map} +1 -1
- package/dist/_chunks/{Relations-Dnag3fhV.mjs → Relations-CIYDdKU-.mjs} +4 -4
- package/dist/_chunks/Relations-CIYDdKU-.mjs.map +1 -0
- package/dist/_chunks/{Relations-CcgFTcWo.js → Relations-Dhuurpx2.js} +4 -4
- package/dist/_chunks/Relations-Dhuurpx2.js.map +1 -0
- package/dist/_chunks/{en-Ux26r5pl.mjs → en-BrCTWlZv.mjs} +5 -4
- package/dist/_chunks/{en-Ux26r5pl.mjs.map → en-BrCTWlZv.mjs.map} +1 -1
- package/dist/_chunks/{en-fbKQxLGn.js → en-uOUIxfcQ.js} +5 -4
- package/dist/_chunks/{en-fbKQxLGn.js.map → en-uOUIxfcQ.js.map} +1 -1
- package/dist/_chunks/{index-JNNNKUHs.mjs → index-C9TJPyni.mjs} +351 -151
- package/dist/_chunks/index-C9TJPyni.mjs.map +1 -0
- package/dist/_chunks/{index-CWpLBSt0.js → index-CdT0kHZ8.js} +336 -136
- package/dist/_chunks/index-CdT0kHZ8.js.map +1 -0
- package/dist/_chunks/{layout-DC503LnF.mjs → layout-BNqvLR_b.mjs} +25 -13
- package/dist/_chunks/layout-BNqvLR_b.mjs.map +1 -0
- package/dist/_chunks/{layout--iHdZzRk.js → layout-C6dxWYT7.js} +23 -11
- package/dist/_chunks/layout-C6dxWYT7.js.map +1 -0
- package/dist/_chunks/{relations-CTje5t-a.mjs → relations-CkKqKw65.mjs} +2 -2
- package/dist/_chunks/{relations-CTje5t-a.mjs.map → relations-CkKqKw65.mjs.map} +1 -1
- package/dist/_chunks/{relations-BbHizA5K.js → relations-DtFaDnP1.js} +2 -2
- package/dist/_chunks/{relations-BbHizA5K.js.map → relations-DtFaDnP1.js.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +4 -4
- 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 +1 -0
- 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 +10 -22
- package/dist/server/index.js +137 -90
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +138 -91
- 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-0MiFkXa8.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-DbcGfyqK.js.map +0 -1
- package/dist/_chunks/Field-BDMSCcy5.mjs.map +0 -1
- package/dist/_chunks/Field-BG1xu38N.js.map +0 -1
- package/dist/_chunks/Form-9BnFyUjy.js.map +0 -1
- package/dist/_chunks/Form-CPVWavB8.mjs.map +0 -1
- package/dist/_chunks/History-BVpd8LP3.mjs.map +0 -1
- package/dist/_chunks/History-BWWxLt2Z.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-6swzjdAZ.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DozVMKcR.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-BlzfjS2Q.js.map +0 -1
- package/dist/_chunks/ListViewPage-Ds0ulgfG.mjs.map +0 -1
- package/dist/_chunks/Relations-CcgFTcWo.js.map +0 -1
- package/dist/_chunks/Relations-Dnag3fhV.mjs.map +0 -1
- package/dist/_chunks/index-CWpLBSt0.js.map +0 -1
- package/dist/_chunks/index-JNNNKUHs.mjs.map +0 -1
- package/dist/_chunks/layout--iHdZzRk.js.map +0 -1
- package/dist/_chunks/layout-DC503LnF.mjs.map +0 -1
@@ -2,15 +2,15 @@
|
|
2
2
|
const Icons = require("@strapi/icons");
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
4
4
|
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
5
|
-
const qs = require("qs");
|
6
|
-
const reactIntl = require("react-intl");
|
7
|
-
const reactRouterDom = require("react-router-dom");
|
8
5
|
const React = require("react");
|
9
6
|
const designSystem = require("@strapi/design-system");
|
7
|
+
const reactIntl = require("react-intl");
|
8
|
+
const reactRouterDom = require("react-router-dom");
|
10
9
|
const styledComponents = require("styled-components");
|
11
10
|
const yup = require("yup");
|
12
11
|
const pipe = require("lodash/fp/pipe");
|
13
12
|
const dateFns = require("date-fns");
|
13
|
+
const qs = require("qs");
|
14
14
|
const toolkit = require("@reduxjs/toolkit");
|
15
15
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
16
16
|
function _interopNamespace(e) {
|
@@ -70,42 +70,6 @@ const useInjectionZone = (area) => {
|
|
70
70
|
const [page, position] = area.split(".");
|
71
71
|
return contentManagerPlugin.getInjectedComponents(page, position);
|
72
72
|
};
|
73
|
-
const HistoryAction = ({ model, document }) => {
|
74
|
-
const { formatMessage } = reactIntl.useIntl();
|
75
|
-
const [{ query }] = strapiAdmin.useQueryParams();
|
76
|
-
const navigate = reactRouterDom.useNavigate();
|
77
|
-
const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
|
78
|
-
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
79
|
-
return null;
|
80
|
-
}
|
81
|
-
return {
|
82
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
|
83
|
-
label: formatMessage({
|
84
|
-
id: "content-manager.history.document-action",
|
85
|
-
defaultMessage: "Content History"
|
86
|
-
}),
|
87
|
-
onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
|
88
|
-
disabled: (
|
89
|
-
/**
|
90
|
-
* The user is creating a new document.
|
91
|
-
* It hasn't been saved yet, so there's no history to go to
|
92
|
-
*/
|
93
|
-
!document || /**
|
94
|
-
* The document has been created but the current dimension has never been saved.
|
95
|
-
* For example, the user is creating a new locale in an existing document,
|
96
|
-
* so there's no history for the document in that locale
|
97
|
-
*/
|
98
|
-
!document.id || /**
|
99
|
-
* History is only available for content types created by the user.
|
100
|
-
* These have the `api::` prefix, as opposed to the ones created by Strapi or plugins,
|
101
|
-
* which start with `admin::` or `plugin::`
|
102
|
-
*/
|
103
|
-
!model.startsWith("api::")
|
104
|
-
),
|
105
|
-
position: "header"
|
106
|
-
};
|
107
|
-
};
|
108
|
-
HistoryAction.type = "history";
|
109
73
|
const ID = "id";
|
110
74
|
const CREATED_BY_ATTRIBUTE_NAME = "createdBy";
|
111
75
|
const UPDATED_BY_ATTRIBUTE_NAME = "updatedBy";
|
@@ -219,6 +183,7 @@ const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
|
|
219
183
|
]
|
220
184
|
});
|
221
185
|
const documentApi = contentManagerApi.injectEndpoints({
|
186
|
+
overrideExisting: true,
|
222
187
|
endpoints: (builder) => ({
|
223
188
|
autoCloneDocument: builder.mutation({
|
224
189
|
query: ({ model, sourceId, query }) => ({
|
@@ -228,7 +193,12 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
228
193
|
params: query
|
229
194
|
}
|
230
195
|
}),
|
231
|
-
invalidatesTags: (_result,
|
196
|
+
invalidatesTags: (_result, error, { model }) => {
|
197
|
+
if (error) {
|
198
|
+
return [];
|
199
|
+
}
|
200
|
+
return [{ type: "Document", id: `${model}_LIST` }];
|
201
|
+
}
|
232
202
|
}),
|
233
203
|
cloneDocument: builder.mutation({
|
234
204
|
query: ({ model, sourceId, data, params }) => ({
|
@@ -315,6 +285,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
315
285
|
}),
|
316
286
|
providesTags: (result, _error, arg) => {
|
317
287
|
return [
|
288
|
+
{ type: "Document", id: `ALL_LIST` },
|
318
289
|
{ type: "Document", id: `${arg.model}_LIST` },
|
319
290
|
...result?.results.map(({ documentId }) => ({
|
320
291
|
type: "Document",
|
@@ -353,6 +324,11 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
353
324
|
{
|
354
325
|
type: "Document",
|
355
326
|
id: collectionType !== SINGLE_TYPES ? `${model}_${result && "documentId" in result ? result.documentId : documentId}` : model
|
327
|
+
},
|
328
|
+
// Make it easy to invalidate all individual documents queries for a model
|
329
|
+
{
|
330
|
+
type: "Document",
|
331
|
+
id: `${model}_ALL_ITEMS`
|
356
332
|
}
|
357
333
|
];
|
358
334
|
}
|
@@ -418,6 +394,18 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
418
394
|
},
|
419
395
|
"Relations"
|
420
396
|
];
|
397
|
+
},
|
398
|
+
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
399
|
+
const patchResult = dispatch(
|
400
|
+
documentApi.util.updateQueryData("getDocument", patch, (draft) => {
|
401
|
+
Object.assign(draft.data, data);
|
402
|
+
})
|
403
|
+
);
|
404
|
+
try {
|
405
|
+
await queryFulfilled;
|
406
|
+
} catch {
|
407
|
+
patchResult.undo();
|
408
|
+
}
|
421
409
|
}
|
422
410
|
}),
|
423
411
|
unpublishDocument: builder.mutation({
|
@@ -601,6 +589,14 @@ const createAttributeSchema = (attribute) => {
|
|
601
589
|
if (!value || typeof value === "string" && value.length === 0) {
|
602
590
|
return true;
|
603
591
|
}
|
592
|
+
if (typeof value === "object") {
|
593
|
+
try {
|
594
|
+
JSON.stringify(value);
|
595
|
+
return true;
|
596
|
+
} catch (err) {
|
597
|
+
return false;
|
598
|
+
}
|
599
|
+
}
|
604
600
|
try {
|
605
601
|
JSON.parse(value);
|
606
602
|
return true;
|
@@ -620,11 +616,11 @@ const createAttributeSchema = (attribute) => {
|
|
620
616
|
}
|
621
617
|
};
|
622
618
|
const addRequiredValidation = (attribute) => (schema) => {
|
623
|
-
if (attribute.required) {
|
624
|
-
return schema.required
|
625
|
-
|
626
|
-
|
627
|
-
|
619
|
+
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
620
|
+
return schema.min(1, strapiAdmin.translatedErrors.required);
|
621
|
+
}
|
622
|
+
if (attribute.required && attribute.type !== "relation") {
|
623
|
+
return schema.required(strapiAdmin.translatedErrors.required);
|
628
624
|
}
|
629
625
|
return schema?.nullable ? schema.nullable() : (
|
630
626
|
// In some cases '.nullable' will not be available on the schema.
|
@@ -658,6 +654,28 @@ const addMaxLengthValidation = (attribute) => (schema) => {
|
|
658
654
|
const addMinValidation = (attribute) => (schema) => {
|
659
655
|
if ("min" in attribute) {
|
660
656
|
const min = toInteger(attribute.min);
|
657
|
+
if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
|
658
|
+
if (!attribute.required && "test" in schema && min) {
|
659
|
+
return schema.test(
|
660
|
+
"custom-min",
|
661
|
+
{
|
662
|
+
...strapiAdmin.translatedErrors.min,
|
663
|
+
values: {
|
664
|
+
min: attribute.min
|
665
|
+
}
|
666
|
+
},
|
667
|
+
(value) => {
|
668
|
+
if (!value) {
|
669
|
+
return true;
|
670
|
+
}
|
671
|
+
if (Array.isArray(value) && value.length === 0) {
|
672
|
+
return true;
|
673
|
+
}
|
674
|
+
return value.length >= min;
|
675
|
+
}
|
676
|
+
);
|
677
|
+
}
|
678
|
+
}
|
661
679
|
if ("min" in schema && min) {
|
662
680
|
return schema.min(min, {
|
663
681
|
...strapiAdmin.translatedErrors.min,
|
@@ -784,7 +802,10 @@ const useDocument = (args, opts) => {
|
|
784
802
|
isLoading: isLoadingDocument,
|
785
803
|
isFetching: isFetchingDocument,
|
786
804
|
error
|
787
|
-
} = useGetDocumentQuery(args,
|
805
|
+
} = useGetDocumentQuery(args, {
|
806
|
+
...opts,
|
807
|
+
skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
|
808
|
+
});
|
788
809
|
const { components, schema, isLoading: isLoadingSchema } = useContentTypeSchema(args.model);
|
789
810
|
React__namespace.useEffect(() => {
|
790
811
|
if (error) {
|
@@ -1205,7 +1226,6 @@ const useDocumentActions = () => {
|
|
1205
1226
|
sourceId
|
1206
1227
|
});
|
1207
1228
|
if ("error" in res) {
|
1208
|
-
toggleNotification({ type: "danger", message: formatAPIError(res.error) });
|
1209
1229
|
return { error: res.error };
|
1210
1230
|
}
|
1211
1231
|
toggleNotification({
|
@@ -1286,7 +1306,7 @@ const useDocumentActions = () => {
|
|
1286
1306
|
};
|
1287
1307
|
};
|
1288
1308
|
const ProtectedHistoryPage = React.lazy(
|
1289
|
-
() => Promise.resolve().then(() => require("./History-
|
1309
|
+
() => Promise.resolve().then(() => require("./History-nuEzM5qm.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1290
1310
|
);
|
1291
1311
|
const routes$1 = [
|
1292
1312
|
{
|
@@ -1299,31 +1319,31 @@ const routes$1 = [
|
|
1299
1319
|
}
|
1300
1320
|
];
|
1301
1321
|
const ProtectedEditViewPage = React.lazy(
|
1302
|
-
() => Promise.resolve().then(() => require("./EditViewPage-
|
1322
|
+
() => Promise.resolve().then(() => require("./EditViewPage-BgjdnGz2.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1303
1323
|
);
|
1304
1324
|
const ProtectedListViewPage = React.lazy(
|
1305
|
-
() => Promise.resolve().then(() => require("./ListViewPage-
|
1325
|
+
() => Promise.resolve().then(() => require("./ListViewPage-SXIXm-RM.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1306
1326
|
);
|
1307
1327
|
const ProtectedListConfiguration = React.lazy(
|
1308
|
-
() => Promise.resolve().then(() => require("./ListConfigurationPage-
|
1328
|
+
() => Promise.resolve().then(() => require("./ListConfigurationPage-CnB86Psm.js")).then((mod) => ({
|
1309
1329
|
default: mod.ProtectedListConfiguration
|
1310
1330
|
}))
|
1311
1331
|
);
|
1312
1332
|
const ProtectedEditConfigurationPage = React.lazy(
|
1313
|
-
() => Promise.resolve().then(() => require("./EditConfigurationPage-
|
1333
|
+
() => Promise.resolve().then(() => require("./EditConfigurationPage-BQ17--5R.js")).then((mod) => ({
|
1314
1334
|
default: mod.ProtectedEditConfigurationPage
|
1315
1335
|
}))
|
1316
1336
|
);
|
1317
1337
|
const ProtectedComponentConfigurationPage = React.lazy(
|
1318
|
-
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-
|
1338
|
+
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-KXSuLnQD.js")).then((mod) => ({
|
1319
1339
|
default: mod.ProtectedComponentConfigurationPage
|
1320
1340
|
}))
|
1321
1341
|
);
|
1322
1342
|
const NoPermissions = React.lazy(
|
1323
|
-
() => Promise.resolve().then(() => require("./NoPermissionsPage-
|
1343
|
+
() => Promise.resolve().then(() => require("./NoPermissionsPage-IGkId4C5.js")).then((mod) => ({ default: mod.NoPermissions }))
|
1324
1344
|
);
|
1325
1345
|
const NoContentType = React.lazy(
|
1326
|
-
() => Promise.resolve().then(() => require("./NoContentTypePage-
|
1346
|
+
() => Promise.resolve().then(() => require("./NoContentTypePage-BzsQ3hLZ.js")).then((mod) => ({ default: mod.NoContentType }))
|
1327
1347
|
);
|
1328
1348
|
const CollectionTypePages = () => {
|
1329
1349
|
const { collectionType } = reactRouterDom.useParams();
|
@@ -1437,12 +1457,14 @@ const DocumentActionButton = (action) => {
|
|
1437
1457
|
/* @__PURE__ */ jsxRuntime.jsx(
|
1438
1458
|
designSystem.Button,
|
1439
1459
|
{
|
1440
|
-
flex:
|
1460
|
+
flex: "auto",
|
1441
1461
|
startIcon: action.icon,
|
1442
1462
|
disabled: action.disabled,
|
1443
1463
|
onClick: handleClick(action),
|
1444
1464
|
justifyContent: "center",
|
1445
1465
|
variant: action.variant || "default",
|
1466
|
+
paddingTop: "7px",
|
1467
|
+
paddingBottom: "7px",
|
1446
1468
|
children: action.label
|
1447
1469
|
}
|
1448
1470
|
),
|
@@ -1450,7 +1472,7 @@ const DocumentActionButton = (action) => {
|
|
1450
1472
|
DocumentActionConfirmDialog,
|
1451
1473
|
{
|
1452
1474
|
...action.dialog,
|
1453
|
-
variant: action.variant,
|
1475
|
+
variant: action.dialog?.variant ?? action.variant,
|
1454
1476
|
isOpen: dialogId === action.id,
|
1455
1477
|
onClose: handleClose
|
1456
1478
|
}
|
@@ -1502,14 +1524,14 @@ const DocumentActionsMenu = ({
|
|
1502
1524
|
};
|
1503
1525
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { open: isOpen, onOpenChange: setIsOpen, children: [
|
1504
1526
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
1505
|
-
|
1527
|
+
StyledMoreButton,
|
1506
1528
|
{
|
1507
1529
|
disabled: isDisabled,
|
1508
1530
|
size: "S",
|
1509
1531
|
endIcon: null,
|
1510
|
-
paddingTop: "
|
1511
|
-
paddingLeft: "
|
1512
|
-
paddingRight: "
|
1532
|
+
paddingTop: "4px",
|
1533
|
+
paddingLeft: "7px",
|
1534
|
+
paddingRight: "7px",
|
1513
1535
|
variant,
|
1514
1536
|
children: [
|
1515
1537
|
/* @__PURE__ */ jsxRuntime.jsx(Icons.More, { "aria-hidden": true, focusable: false }),
|
@@ -1529,10 +1551,25 @@ const DocumentActionsMenu = ({
|
|
1529
1551
|
onSelect: handleClick(action),
|
1530
1552
|
display: "block",
|
1531
1553
|
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: [
|
1532
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1554
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
1555
|
+
designSystem.Flex,
|
1556
|
+
{
|
1557
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1558
|
+
gap: 2,
|
1559
|
+
tag: "span",
|
1560
|
+
children: [
|
1561
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
1562
|
+
designSystem.Flex,
|
1563
|
+
{
|
1564
|
+
tag: "span",
|
1565
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1566
|
+
children: action.icon
|
1567
|
+
}
|
1568
|
+
),
|
1569
|
+
action.label
|
1570
|
+
]
|
1571
|
+
}
|
1572
|
+
),
|
1536
1573
|
action.id.startsWith("HistoryAction") && /* @__PURE__ */ jsxRuntime.jsx(
|
1537
1574
|
designSystem.Flex,
|
1538
1575
|
{
|
@@ -1591,6 +1628,23 @@ const convertActionVariantToColor = (variant = "secondary") => {
|
|
1591
1628
|
return "primary600";
|
1592
1629
|
}
|
1593
1630
|
};
|
1631
|
+
const convertActionVariantToIconColor = (variant = "secondary") => {
|
1632
|
+
switch (variant) {
|
1633
|
+
case "danger":
|
1634
|
+
return "danger600";
|
1635
|
+
case "secondary":
|
1636
|
+
return "neutral500";
|
1637
|
+
case "success":
|
1638
|
+
return "success600";
|
1639
|
+
default:
|
1640
|
+
return "primary600";
|
1641
|
+
}
|
1642
|
+
};
|
1643
|
+
const StyledMoreButton = styledComponents.styled(designSystem.Menu.Trigger)`
|
1644
|
+
& > span {
|
1645
|
+
display: flex;
|
1646
|
+
}
|
1647
|
+
`;
|
1594
1648
|
const DocumentActionConfirmDialog = ({
|
1595
1649
|
onClose,
|
1596
1650
|
onCancel,
|
@@ -1667,6 +1721,12 @@ const PublishAction$1 = ({
|
|
1667
1721
|
({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
|
1668
1722
|
);
|
1669
1723
|
const { publish } = useDocumentActions();
|
1724
|
+
const [
|
1725
|
+
countDraftRelations,
|
1726
|
+
{ isLoading: isLoadingDraftRelations, isError: isErrorDraftRelations }
|
1727
|
+
] = useLazyGetDraftRelationCountQuery();
|
1728
|
+
const [localCountOfDraftRelations, setLocalCountOfDraftRelations] = React__namespace.useState(0);
|
1729
|
+
const [serverCountOfDraftRelations, setServerCountOfDraftRelations] = React__namespace.useState(0);
|
1670
1730
|
const [{ query, rawQuery }] = strapiAdmin.useQueryParams();
|
1671
1731
|
const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
|
1672
1732
|
const modified = strapiAdmin.useForm("PublishAction", ({ modified: modified2 }) => modified2);
|
@@ -1675,10 +1735,101 @@ const PublishAction$1 = ({
|
|
1675
1735
|
const validate = strapiAdmin.useForm("PublishAction", (state) => state.validate);
|
1676
1736
|
const setErrors = strapiAdmin.useForm("PublishAction", (state) => state.setErrors);
|
1677
1737
|
const formValues = strapiAdmin.useForm("PublishAction", ({ values }) => values);
|
1738
|
+
React__namespace.useEffect(() => {
|
1739
|
+
if (isErrorDraftRelations) {
|
1740
|
+
toggleNotification({
|
1741
|
+
type: "danger",
|
1742
|
+
message: formatMessage({
|
1743
|
+
id: getTranslation("error.records.fetch-draft-relatons"),
|
1744
|
+
defaultMessage: "An error occurred while fetching draft relations on this document."
|
1745
|
+
})
|
1746
|
+
});
|
1747
|
+
}
|
1748
|
+
}, [isErrorDraftRelations, toggleNotification, formatMessage]);
|
1749
|
+
React__namespace.useEffect(() => {
|
1750
|
+
const localDraftRelations = /* @__PURE__ */ new Set();
|
1751
|
+
const extractDraftRelations = (data) => {
|
1752
|
+
const relations = data.connect || [];
|
1753
|
+
relations.forEach((relation) => {
|
1754
|
+
if (relation.status === "draft") {
|
1755
|
+
localDraftRelations.add(relation.id);
|
1756
|
+
}
|
1757
|
+
});
|
1758
|
+
};
|
1759
|
+
const traverseAndExtract = (data) => {
|
1760
|
+
Object.entries(data).forEach(([key, value]) => {
|
1761
|
+
if (key === "connect" && Array.isArray(value)) {
|
1762
|
+
extractDraftRelations({ connect: value });
|
1763
|
+
} else if (typeof value === "object" && value !== null) {
|
1764
|
+
traverseAndExtract(value);
|
1765
|
+
}
|
1766
|
+
});
|
1767
|
+
};
|
1768
|
+
if (!documentId || modified) {
|
1769
|
+
traverseAndExtract(formValues);
|
1770
|
+
setLocalCountOfDraftRelations(localDraftRelations.size);
|
1771
|
+
}
|
1772
|
+
}, [documentId, modified, formValues, setLocalCountOfDraftRelations]);
|
1773
|
+
React__namespace.useEffect(() => {
|
1774
|
+
if (documentId) {
|
1775
|
+
const fetchDraftRelationsCount = async () => {
|
1776
|
+
const { data, error } = await countDraftRelations({
|
1777
|
+
collectionType,
|
1778
|
+
model,
|
1779
|
+
documentId,
|
1780
|
+
params
|
1781
|
+
});
|
1782
|
+
if (error) {
|
1783
|
+
throw error;
|
1784
|
+
}
|
1785
|
+
if (data) {
|
1786
|
+
setServerCountOfDraftRelations(data.data);
|
1787
|
+
}
|
1788
|
+
};
|
1789
|
+
fetchDraftRelationsCount();
|
1790
|
+
}
|
1791
|
+
}, [documentId, countDraftRelations, collectionType, model, params]);
|
1678
1792
|
const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
|
1679
1793
|
if (!schema?.options?.draftAndPublish) {
|
1680
1794
|
return null;
|
1681
1795
|
}
|
1796
|
+
const performPublish = async () => {
|
1797
|
+
setSubmitting(true);
|
1798
|
+
try {
|
1799
|
+
const { errors } = await validate();
|
1800
|
+
if (errors) {
|
1801
|
+
toggleNotification({
|
1802
|
+
type: "danger",
|
1803
|
+
message: formatMessage({
|
1804
|
+
id: "content-manager.validation.error",
|
1805
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
1806
|
+
})
|
1807
|
+
});
|
1808
|
+
return;
|
1809
|
+
}
|
1810
|
+
const res = await publish(
|
1811
|
+
{
|
1812
|
+
collectionType,
|
1813
|
+
model,
|
1814
|
+
documentId,
|
1815
|
+
params
|
1816
|
+
},
|
1817
|
+
formValues
|
1818
|
+
);
|
1819
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1820
|
+
navigate({
|
1821
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
1822
|
+
search: rawQuery
|
1823
|
+
});
|
1824
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1825
|
+
setErrors(formatValidationErrors(res.error));
|
1826
|
+
}
|
1827
|
+
} finally {
|
1828
|
+
setSubmitting(false);
|
1829
|
+
}
|
1830
|
+
};
|
1831
|
+
const totalDraftRelations = localCountOfDraftRelations + serverCountOfDraftRelations;
|
1832
|
+
const hasDraftRelations = totalDraftRelations > 0;
|
1682
1833
|
return {
|
1683
1834
|
/**
|
1684
1835
|
* Disabled when:
|
@@ -1688,49 +1839,39 @@ const PublishAction$1 = ({
|
|
1688
1839
|
* - the document is already published & not modified
|
1689
1840
|
* - the document is being created & not modified
|
1690
1841
|
* - the user doesn't have the permission to publish
|
1691
|
-
* - the user doesn't have the permission to create a new document
|
1692
|
-
* - the user doesn't have the permission to update the document
|
1693
1842
|
*/
|
1694
|
-
disabled: isCloning || isSubmitting || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish
|
1843
|
+
disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish,
|
1695
1844
|
label: formatMessage({
|
1696
1845
|
id: "app.utils.publish",
|
1697
1846
|
defaultMessage: "Publish"
|
1698
1847
|
}),
|
1699
1848
|
onClick: async () => {
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
formValues
|
1721
|
-
);
|
1722
|
-
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1723
|
-
navigate({
|
1724
|
-
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
1725
|
-
search: rawQuery
|
1726
|
-
});
|
1727
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1728
|
-
setErrors(formatValidationErrors(res.error));
|
1849
|
+
if (hasDraftRelations) {
|
1850
|
+
return;
|
1851
|
+
}
|
1852
|
+
await performPublish();
|
1853
|
+
},
|
1854
|
+
dialog: hasDraftRelations ? {
|
1855
|
+
type: "dialog",
|
1856
|
+
variant: "danger",
|
1857
|
+
footer: null,
|
1858
|
+
title: formatMessage({
|
1859
|
+
id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.title`),
|
1860
|
+
defaultMessage: "Confirmation"
|
1861
|
+
}),
|
1862
|
+
content: formatMessage(
|
1863
|
+
{
|
1864
|
+
id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.message`),
|
1865
|
+
defaultMessage: "This entry is related to {count, plural, one {# draft entry} other {# draft entries}}. Publishing it could leave broken links in your app."
|
1866
|
+
},
|
1867
|
+
{
|
1868
|
+
count: totalDraftRelations
|
1729
1869
|
}
|
1730
|
-
|
1731
|
-
|
1870
|
+
),
|
1871
|
+
onConfirm: async () => {
|
1872
|
+
await performPublish();
|
1732
1873
|
}
|
1733
|
-
}
|
1874
|
+
} : void 0
|
1734
1875
|
};
|
1735
1876
|
};
|
1736
1877
|
PublishAction$1.type = "publish";
|
@@ -1746,7 +1887,7 @@ const UpdateAction = ({
|
|
1746
1887
|
const cloneMatch = reactRouterDom.useMatch(CLONE_PATH);
|
1747
1888
|
const isCloning = cloneMatch !== null;
|
1748
1889
|
const { formatMessage } = reactIntl.useIntl();
|
1749
|
-
|
1890
|
+
useDocumentRBAC("UpdateAction", ({ canCreate: canCreate2, canUpdate: canUpdate2 }) => ({
|
1750
1891
|
canCreate: canCreate2,
|
1751
1892
|
canUpdate: canUpdate2
|
1752
1893
|
}));
|
@@ -1766,10 +1907,8 @@ const UpdateAction = ({
|
|
1766
1907
|
* - the form is submitting
|
1767
1908
|
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
1768
1909
|
* - the active tab is the published tab
|
1769
|
-
* - the user doesn't have the permission to create a new document
|
1770
|
-
* - the user doesn't have the permission to update the document
|
1771
1910
|
*/
|
1772
|
-
disabled: isSubmitting || !modified && !isCloning || activeTab === "published"
|
1911
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
1773
1912
|
label: formatMessage({
|
1774
1913
|
id: "content-manager.containers.Edit.save",
|
1775
1914
|
defaultMessage: "Save"
|
@@ -1798,10 +1937,13 @@ const UpdateAction = ({
|
|
1798
1937
|
document
|
1799
1938
|
);
|
1800
1939
|
if ("data" in res) {
|
1801
|
-
navigate(
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1940
|
+
navigate(
|
1941
|
+
{
|
1942
|
+
pathname: `../${res.data.documentId}`,
|
1943
|
+
search: rawQuery
|
1944
|
+
},
|
1945
|
+
{ relative: "path" }
|
1946
|
+
);
|
1805
1947
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1806
1948
|
setErrors(formatValidationErrors(res.error));
|
1807
1949
|
}
|
@@ -1829,10 +1971,13 @@ const UpdateAction = ({
|
|
1829
1971
|
document
|
1830
1972
|
);
|
1831
1973
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1832
|
-
navigate(
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1974
|
+
navigate(
|
1975
|
+
{
|
1976
|
+
pathname: `../${res.data.documentId}`,
|
1977
|
+
search: rawQuery
|
1978
|
+
},
|
1979
|
+
{ replace: true, relative: "path" }
|
1980
|
+
);
|
1836
1981
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1837
1982
|
setErrors(formatValidationErrors(res.error));
|
1838
1983
|
}
|
@@ -2078,23 +2223,13 @@ const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
|
2078
2223
|
id: "content-manager.containers.edit.title.new",
|
2079
2224
|
defaultMessage: "Create an entry"
|
2080
2225
|
}) : documentTitle;
|
2081
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop:
|
2226
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2082
2227
|
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
2083
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
2084
|
-
designSystem.
|
2085
|
-
{
|
2086
|
-
|
2087
|
-
|
2088
|
-
paddingTop: 1,
|
2089
|
-
gap: "80px",
|
2090
|
-
alignItems: "flex-start",
|
2091
|
-
children: [
|
2092
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
|
2093
|
-
/* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
|
2094
|
-
]
|
2095
|
-
}
|
2096
|
-
),
|
2097
|
-
status ? /* @__PURE__ */ jsxRuntime.jsx(DocumentStatus, { status: isCloning ? "draft" : status }) : null
|
2228
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2229
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
|
2230
|
+
/* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
|
2231
|
+
] }),
|
2232
|
+
status ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 1, children: /* @__PURE__ */ jsxRuntime.jsx(DocumentStatus, { status: isCloning ? "draft" : status }) }) : null
|
2098
2233
|
] });
|
2099
2234
|
};
|
2100
2235
|
const HeaderToolbar = () => {
|
@@ -2785,7 +2920,7 @@ const ConfirmBulkActionDialog = ({
|
|
2785
2920
|
endAction
|
2786
2921
|
}) => {
|
2787
2922
|
const { formatMessage } = reactIntl.useIntl();
|
2788
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, {
|
2923
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: isOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
|
2789
2924
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: formatMessage({
|
2790
2925
|
id: "app.components.ConfirmDialog.title",
|
2791
2926
|
defaultMessage: "Confirmation"
|
@@ -2906,7 +3041,14 @@ const formatErrorMessages = (errors, parentKey, formatMessage) => {
|
|
2906
3041
|
)
|
2907
3042
|
);
|
2908
3043
|
} else {
|
2909
|
-
messages.push(
|
3044
|
+
messages.push(
|
3045
|
+
...formatErrorMessages(
|
3046
|
+
// @ts-expect-error TODO: check why value is not compatible with FormErrors
|
3047
|
+
value,
|
3048
|
+
currentKey,
|
3049
|
+
formatMessage
|
3050
|
+
)
|
3051
|
+
);
|
2910
3052
|
}
|
2911
3053
|
} else {
|
2912
3054
|
messages.push(
|
@@ -3569,8 +3711,7 @@ class ContentManagerPlugin {
|
|
3569
3711
|
documentActions = [
|
3570
3712
|
...DEFAULT_ACTIONS,
|
3571
3713
|
...DEFAULT_TABLE_ROW_ACTIONS,
|
3572
|
-
...DEFAULT_HEADER_ACTIONS
|
3573
|
-
HistoryAction
|
3714
|
+
...DEFAULT_HEADER_ACTIONS
|
3574
3715
|
];
|
3575
3716
|
editViewSidePanels = [ActionsPanel];
|
3576
3717
|
headerActions = [];
|
@@ -3659,6 +3800,52 @@ const getPrintableType = (value) => {
|
|
3659
3800
|
}
|
3660
3801
|
return nativeType;
|
3661
3802
|
};
|
3803
|
+
const HistoryAction = ({ model, document }) => {
|
3804
|
+
const { formatMessage } = reactIntl.useIntl();
|
3805
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
3806
|
+
const navigate = reactRouterDom.useNavigate();
|
3807
|
+
const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
|
3808
|
+
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3809
|
+
return null;
|
3810
|
+
}
|
3811
|
+
return {
|
3812
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
|
3813
|
+
label: formatMessage({
|
3814
|
+
id: "content-manager.history.document-action",
|
3815
|
+
defaultMessage: "Content History"
|
3816
|
+
}),
|
3817
|
+
onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
|
3818
|
+
disabled: (
|
3819
|
+
/**
|
3820
|
+
* The user is creating a new document.
|
3821
|
+
* It hasn't been saved yet, so there's no history to go to
|
3822
|
+
*/
|
3823
|
+
!document || /**
|
3824
|
+
* The document has been created but the current dimension has never been saved.
|
3825
|
+
* For example, the user is creating a new locale in an existing document,
|
3826
|
+
* so there's no history for the document in that locale
|
3827
|
+
*/
|
3828
|
+
!document.id || /**
|
3829
|
+
* History is only available for content types created by the user.
|
3830
|
+
* These have the `api::` prefix, as opposed to the ones created by Strapi or plugins,
|
3831
|
+
* which start with `admin::` or `plugin::`
|
3832
|
+
*/
|
3833
|
+
!model.startsWith("api::")
|
3834
|
+
),
|
3835
|
+
position: "header"
|
3836
|
+
};
|
3837
|
+
};
|
3838
|
+
HistoryAction.type = "history";
|
3839
|
+
const historyAdmin = {
|
3840
|
+
bootstrap(app) {
|
3841
|
+
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
3842
|
+
addDocumentAction((actions2) => {
|
3843
|
+
const indexOfDeleteAction = actions2.findIndex((action) => action.type === "delete");
|
3844
|
+
actions2.splice(indexOfDeleteAction, 0, HistoryAction);
|
3845
|
+
return actions2;
|
3846
|
+
});
|
3847
|
+
}
|
3848
|
+
};
|
3662
3849
|
const initialState = {
|
3663
3850
|
collectionTypeLinks: [],
|
3664
3851
|
components: [],
|
@@ -3709,15 +3896,29 @@ const index = {
|
|
3709
3896
|
defaultMessage: "Content Manager"
|
3710
3897
|
},
|
3711
3898
|
permissions: [],
|
3712
|
-
Component: () => Promise.resolve().then(() => require("./layout--iHdZzRk.js")).then((mod) => ({ default: mod.Layout })),
|
3713
3899
|
position: 1
|
3714
3900
|
});
|
3901
|
+
app.router.addRoute({
|
3902
|
+
path: "content-manager/*",
|
3903
|
+
lazy: async () => {
|
3904
|
+
const { Layout } = await Promise.resolve().then(() => require("./layout-C6dxWYT7.js"));
|
3905
|
+
return {
|
3906
|
+
Component: Layout
|
3907
|
+
};
|
3908
|
+
},
|
3909
|
+
children: routes
|
3910
|
+
});
|
3715
3911
|
app.registerPlugin(cm.config);
|
3716
3912
|
},
|
3913
|
+
bootstrap(app) {
|
3914
|
+
if (typeof historyAdmin.bootstrap === "function") {
|
3915
|
+
historyAdmin.bootstrap(app);
|
3916
|
+
}
|
3917
|
+
},
|
3717
3918
|
async registerTrads({ locales }) {
|
3718
3919
|
const importedTrads = await Promise.all(
|
3719
3920
|
locales.map((locale) => {
|
3720
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-
|
3921
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-uOUIxfcQ.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-EUonQTon.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-B7kGGg3E.js")), "./translations/gu.json": () => Promise.resolve().then(() => require("./gu-BRmF601H.js")), "./translations/hi.json": () => Promise.resolve().then(() => require("./hi-CCJBptSq.js")), "./translations/hu.json": () => Promise.resolve().then(() => require("./hu-sNV_yLYy.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-B5Ser98A.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-DkBIs7vD.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-CcFe8diO.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-woFZPmLk.js")), "./translations/ml.json": () => Promise.resolve().then(() => require("./ml-C2W8N8k1.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-BuFotyP_.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-bbEOHChV.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-uzwG-hk7.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-BiOz37D9.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CeXQuq50.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BT3ybNny.js")), "./translations/sa.json": () => Promise.resolve().then(() => require("./sa-CcvkYInH.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-CvY09Xjv.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-MYDuzgvT.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-D9_GfAjc.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-D9UH-O_R.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-C8EiqJY7.js")), "./translations/vi.json": () => Promise.resolve().then(() => require("./vi-CJlYDheJ.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-9kOncHGw.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CQQfszqR.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
|
3721
3922
|
return {
|
3722
3923
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
3723
3924
|
locale
|
@@ -3761,7 +3962,6 @@ exports.getDisplayName = getDisplayName;
|
|
3761
3962
|
exports.getMainField = getMainField;
|
3762
3963
|
exports.getTranslation = getTranslation;
|
3763
3964
|
exports.index = index;
|
3764
|
-
exports.routes = routes;
|
3765
3965
|
exports.setInitialData = setInitialData;
|
3766
3966
|
exports.useContentTypeSchema = useContentTypeSchema;
|
3767
3967
|
exports.useDoc = useDoc;
|
@@ -3775,4 +3975,4 @@ exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
|
|
3775
3975
|
exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
|
3776
3976
|
exports.useGetInitialDataQuery = useGetInitialDataQuery;
|
3777
3977
|
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
|
3778
|
-
//# sourceMappingURL=index-
|
3978
|
+
//# sourceMappingURL=index-CdT0kHZ8.js.map
|