@strapi/content-manager 5.0.0-rc.1 → 5.0.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{ComponentConfigurationPage-D8RyVgJC.js → ComponentConfigurationPage-D_M8iBw5.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-D8RyVgJC.js.map → ComponentConfigurationPage-D_M8iBw5.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DLuACgva.mjs → ComponentConfigurationPage-qemkOlnj.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-DLuACgva.mjs.map → ComponentConfigurationPage-qemkOlnj.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-fOm5AebB.js → EditConfigurationPage-BePwPuHy.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-fOm5AebB.js.map → EditConfigurationPage-BePwPuHy.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CuCAsHWR.mjs → EditConfigurationPage-CjUrEewK.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CuCAsHWR.mjs.map → EditConfigurationPage-CjUrEewK.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-Or0fpTwh.js → EditViewPage-B-RJeiJD.js} +19 -8
- package/dist/_chunks/EditViewPage-B-RJeiJD.js.map +1 -0
- package/dist/_chunks/{EditViewPage-BqDlT9w0.mjs → EditViewPage-De8GyU8P.mjs} +19 -8
- package/dist/_chunks/EditViewPage-De8GyU8P.mjs.map +1 -0
- package/dist/_chunks/{Field-Bix2HU_O.js → Field-dq8Tg1M_.js} +99 -33
- package/dist/_chunks/Field-dq8Tg1M_.js.map +1 -0
- package/dist/_chunks/{Field-OfBJ6x59.mjs → Field-pb2o8uBe.mjs} +101 -35
- package/dist/_chunks/Field-pb2o8uBe.mjs.map +1 -0
- package/dist/_chunks/{Form-Bv5ABnqE.js → Form-DGIf4jQU.js} +22 -11
- package/dist/_chunks/Form-DGIf4jQU.js.map +1 -0
- package/dist/_chunks/{Form-DyMXqj_v.mjs → Form-DJn0Dxha.mjs} +22 -11
- package/dist/_chunks/Form-DJn0Dxha.mjs.map +1 -0
- package/dist/_chunks/{History-rvLnluF0.mjs → History-BowL3JKP.mjs} +4 -4
- package/dist/_chunks/{History-rvLnluF0.mjs.map → History-BowL3JKP.mjs.map} +1 -1
- package/dist/_chunks/{History-fnln26gA.js → History-Dh2NEHnR.js} +4 -4
- package/dist/_chunks/{History-fnln26gA.js.map → History-Dh2NEHnR.js.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-DdKfJRdq.mjs → ListConfigurationPage-BpVOB-hn.mjs} +14 -4
- package/dist/_chunks/ListConfigurationPage-BpVOB-hn.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-BtCBP_L_.js → ListConfigurationPage-BxYCWz9e.js} +14 -4
- package/dist/_chunks/ListConfigurationPage-BxYCWz9e.js.map +1 -0
- package/dist/_chunks/{ListViewPage-CGZWD2qn.js → ListViewPage-4XsciqHZ.js} +9 -4
- package/dist/_chunks/ListViewPage-4XsciqHZ.js.map +1 -0
- package/dist/_chunks/{ListViewPage-B8cPO1bK.mjs → ListViewPage-CXFUjZQC.mjs} +10 -5
- package/dist/_chunks/ListViewPage-CXFUjZQC.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-oJxX0WCQ.js → NoContentTypePage-C8OpoHeU.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-oJxX0WCQ.js.map → NoContentTypePage-C8OpoHeU.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-CVqYTeML.mjs → NoContentTypePage-DuhOTp3x.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-CVqYTeML.mjs.map → NoContentTypePage-DuhOTp3x.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-mlXqh8p6.mjs → NoPermissionsPage-DVz3mzDz.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-mlXqh8p6.mjs.map → NoPermissionsPage-DVz3mzDz.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-BB11jqM_.js → NoPermissionsPage-y_r7DVA2.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-BB11jqM_.js.map → NoPermissionsPage-y_r7DVA2.js.map} +1 -1
- package/dist/_chunks/{Relations-DWscdjKO.mjs → Relations-CVNLrn1Y.mjs} +4 -4
- package/dist/_chunks/{Relations-DWscdjKO.mjs.map → Relations-CVNLrn1Y.mjs.map} +1 -1
- package/dist/_chunks/{Relations-6xIumgbN.js → Relations-DPFCAa7b.js} +4 -4
- package/dist/_chunks/{Relations-6xIumgbN.js.map → Relations-DPFCAa7b.js.map} +1 -1
- package/dist/_chunks/{index-BzUwgKUj.js → index-C3fJE-1-.js} +140 -71
- package/dist/_chunks/index-C3fJE-1-.js.map +1 -0
- package/dist/_chunks/{index-JSJrqmB9.mjs → index-DiMrfcfy.mjs} +158 -89
- package/dist/_chunks/index-DiMrfcfy.mjs.map +1 -0
- package/dist/_chunks/{layout-U4xJd8Oi.js → layout-C788OmNr.js} +19 -7
- package/dist/_chunks/layout-C788OmNr.js.map +1 -0
- package/dist/_chunks/{layout-Dewoec1b.mjs → layout-ls3gxfpH.mjs} +20 -8
- package/dist/_chunks/layout-ls3gxfpH.mjs.map +1 -0
- package/dist/_chunks/{relations-DMxeUp5V.mjs → relations-CLcOmGO0.mjs} +2 -2
- package/dist/_chunks/{relations-DMxeUp5V.mjs.map → relations-CLcOmGO0.mjs.map} +1 -1
- package/dist/_chunks/{relations-BifGhhuo.js → relations-DYeotliT.js} +2 -2
- package/dist/_chunks/{relations-BifGhhuo.js.map → relations-DYeotliT.js.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +4 -4
- package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
- 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/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/components.d.ts +2 -2
- package/dist/admin/src/services/contentTypes.d.ts +3 -3
- package/dist/admin/src/services/documents.d.ts +16 -16
- package/dist/admin/src/services/init.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +2 -2
- package/dist/admin/src/services/uid.d.ts +3 -3
- package/dist/admin/src/utils/validation.d.ts +4 -1
- package/dist/server/index.js +155 -103
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +156 -104
- 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/relations.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/policies/hasPermissions.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/permission-checker.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/_chunks/EditViewPage-BqDlT9w0.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-Or0fpTwh.js.map +0 -1
- package/dist/_chunks/Field-Bix2HU_O.js.map +0 -1
- package/dist/_chunks/Field-OfBJ6x59.mjs.map +0 -1
- package/dist/_chunks/Form-Bv5ABnqE.js.map +0 -1
- package/dist/_chunks/Form-DyMXqj_v.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-BtCBP_L_.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DdKfJRdq.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-B8cPO1bK.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-CGZWD2qn.js.map +0 -1
- package/dist/_chunks/index-BzUwgKUj.js.map +0 -1
- package/dist/_chunks/index-JSJrqmB9.mjs.map +0 -1
- package/dist/_chunks/layout-Dewoec1b.mjs.map +0 -1
- package/dist/_chunks/layout-U4xJd8Oi.js.map +0 -1
@@ -3,9 +3,9 @@ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useStrapiApp, createContext, useAuth, useRBAC, Page, adminApi, translatedErrors, useNotification, useAPIErrorHandler, getYupValidationErrors, useQueryParams, useTracking, useForm, BackButton, DescriptionComponentRenderer, useTable, Table } from "@strapi/admin/strapi-admin";
|
4
4
|
import * as React from "react";
|
5
5
|
import { lazy } from "react";
|
6
|
-
import {
|
6
|
+
import { Menu, Button, VisuallyHidden, Flex, Typography, Dialog, Modal, Radio, Status, Box, SingleSelect, SingleSelectOption, Loader, IconButton, Tooltip, LinkButton } from "@strapi/design-system";
|
7
7
|
import { useIntl } from "react-intl";
|
8
|
-
import { useParams,
|
8
|
+
import { useParams, useNavigate, Navigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
|
9
9
|
import { styled } from "styled-components";
|
10
10
|
import * as yup from "yup";
|
11
11
|
import { ValidationError } from "yup";
|
@@ -158,7 +158,8 @@ const contentManagerApi = adminApi.enhanceEndpoints({
|
|
158
158
|
"Document",
|
159
159
|
"InitialData",
|
160
160
|
"HistoryVersion",
|
161
|
-
"Relations"
|
161
|
+
"Relations",
|
162
|
+
"UidAvailability"
|
162
163
|
]
|
163
164
|
});
|
164
165
|
const documentApi = contentManagerApi.injectEndpoints({
|
@@ -172,7 +173,12 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
172
173
|
params: query
|
173
174
|
}
|
174
175
|
}),
|
175
|
-
invalidatesTags: (_result,
|
176
|
+
invalidatesTags: (_result, error, { model }) => {
|
177
|
+
if (error) {
|
178
|
+
return [];
|
179
|
+
}
|
180
|
+
return [{ type: "Document", id: `${model}_LIST` }];
|
181
|
+
}
|
176
182
|
}),
|
177
183
|
cloneDocument: builder.mutation({
|
178
184
|
query: ({ model, sourceId, data, params }) => ({
|
@@ -183,7 +189,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
183
189
|
params
|
184
190
|
}
|
185
191
|
}),
|
186
|
-
invalidatesTags: (_result, _error, { model }) => [
|
192
|
+
invalidatesTags: (_result, _error, { model }) => [
|
193
|
+
{ type: "Document", id: `${model}_LIST` },
|
194
|
+
{ type: "UidAvailability", id: model }
|
195
|
+
]
|
187
196
|
}),
|
188
197
|
/**
|
189
198
|
* Creates a new collection-type document. This should ONLY be used for collection-types.
|
@@ -200,7 +209,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
200
209
|
}),
|
201
210
|
invalidatesTags: (result, _error, { model }) => [
|
202
211
|
{ type: "Document", id: `${model}_LIST` },
|
203
|
-
"Relations"
|
212
|
+
"Relations",
|
213
|
+
{ type: "UidAvailability", id: model }
|
204
214
|
]
|
205
215
|
}),
|
206
216
|
deleteDocument: builder.mutation({
|
@@ -241,7 +251,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
241
251
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
242
252
|
},
|
243
253
|
{ type: "Document", id: `${model}_LIST` },
|
244
|
-
"Relations"
|
254
|
+
"Relations",
|
255
|
+
{ type: "UidAvailability", id: model }
|
245
256
|
];
|
246
257
|
}
|
247
258
|
}),
|
@@ -259,6 +270,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
259
270
|
}),
|
260
271
|
providesTags: (result, _error, arg) => {
|
261
272
|
return [
|
273
|
+
{ type: "Document", id: `ALL_LIST` },
|
262
274
|
{ type: "Document", id: `${arg.model}_LIST` },
|
263
275
|
...result?.results.map(({ documentId }) => ({
|
264
276
|
type: "Document",
|
@@ -297,6 +309,11 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
297
309
|
{
|
298
310
|
type: "Document",
|
299
311
|
id: collectionType !== SINGLE_TYPES ? `${model}_${result && "documentId" in result ? result.documentId : documentId}` : model
|
312
|
+
},
|
313
|
+
// Make it easy to invalidate all individual documents queries for a model
|
314
|
+
{
|
315
|
+
type: "Document",
|
316
|
+
id: `${model}_ALL_ITEMS`
|
300
317
|
}
|
301
318
|
];
|
302
319
|
}
|
@@ -360,8 +377,21 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
360
377
|
type: "Document",
|
361
378
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
362
379
|
},
|
363
|
-
"Relations"
|
380
|
+
"Relations",
|
381
|
+
{ type: "UidAvailability", id: model }
|
364
382
|
];
|
383
|
+
},
|
384
|
+
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
385
|
+
const patchResult = dispatch(
|
386
|
+
documentApi.util.updateQueryData("getDocument", patch, (draft) => {
|
387
|
+
Object.assign(draft.data, data);
|
388
|
+
})
|
389
|
+
);
|
390
|
+
try {
|
391
|
+
await queryFulfilled;
|
392
|
+
} catch {
|
393
|
+
patchResult.undo();
|
394
|
+
}
|
365
395
|
}
|
366
396
|
}),
|
367
397
|
unpublishDocument: builder.mutation({
|
@@ -431,7 +461,7 @@ const buildValidParams = (query) => {
|
|
431
461
|
const isBaseQueryError = (error) => {
|
432
462
|
return error.name !== void 0;
|
433
463
|
};
|
434
|
-
const createYupSchema = (attributes = {}, components = {}) => {
|
464
|
+
const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
|
435
465
|
const createModelSchema = (attributes2) => yup.object().shape(
|
436
466
|
Object.entries(attributes2).reduce((acc, [name, attribute]) => {
|
437
467
|
if (DOCUMENT_META_FIELDS.includes(name)) {
|
@@ -444,7 +474,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
|
|
444
474
|
addMinValidation,
|
445
475
|
addMaxValidation,
|
446
476
|
addRegexValidation
|
447
|
-
].map((fn) => fn(attribute));
|
477
|
+
].map((fn) => fn(attribute, options));
|
448
478
|
const transformSchema = pipe(...validations);
|
449
479
|
switch (attribute.type) {
|
450
480
|
case "component": {
|
@@ -545,6 +575,14 @@ const createAttributeSchema = (attribute) => {
|
|
545
575
|
if (!value || typeof value === "string" && value.length === 0) {
|
546
576
|
return true;
|
547
577
|
}
|
578
|
+
if (typeof value === "object") {
|
579
|
+
try {
|
580
|
+
JSON.stringify(value);
|
581
|
+
return true;
|
582
|
+
} catch (err) {
|
583
|
+
return false;
|
584
|
+
}
|
585
|
+
}
|
548
586
|
try {
|
549
587
|
JSON.parse(value);
|
550
588
|
return true;
|
@@ -563,13 +601,7 @@ const createAttributeSchema = (attribute) => {
|
|
563
601
|
return yup.mixed();
|
564
602
|
}
|
565
603
|
};
|
566
|
-
const
|
567
|
-
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
568
|
-
return schema.min(1, translatedErrors.required);
|
569
|
-
}
|
570
|
-
if (attribute.required && attribute.type !== "relation") {
|
571
|
-
return schema.required(translatedErrors.required);
|
572
|
-
}
|
604
|
+
const nullableSchema = (schema) => {
|
573
605
|
return schema?.nullable ? schema.nullable() : (
|
574
606
|
// In some cases '.nullable' will not be available on the schema.
|
575
607
|
// e.g. when the schema has been built using yup.lazy (e.g. for relations).
|
@@ -577,7 +609,22 @@ const addRequiredValidation = (attribute) => (schema) => {
|
|
577
609
|
schema
|
578
610
|
);
|
579
611
|
};
|
580
|
-
const
|
612
|
+
const addRequiredValidation = (attribute, options) => (schema) => {
|
613
|
+
if (options.status === "draft") {
|
614
|
+
return nullableSchema(schema);
|
615
|
+
}
|
616
|
+
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
617
|
+
return schema.min(1, translatedErrors.required);
|
618
|
+
}
|
619
|
+
if (attribute.required && attribute.type !== "relation") {
|
620
|
+
return schema.required(translatedErrors.required);
|
621
|
+
}
|
622
|
+
return nullableSchema(schema);
|
623
|
+
};
|
624
|
+
const addMinLengthValidation = (attribute, options) => (schema) => {
|
625
|
+
if (options.status === "draft") {
|
626
|
+
return schema;
|
627
|
+
}
|
581
628
|
if ("minLength" in attribute && attribute.minLength && Number.isInteger(attribute.minLength) && "min" in schema) {
|
582
629
|
return schema.min(attribute.minLength, {
|
583
630
|
...translatedErrors.minLength,
|
@@ -599,11 +646,11 @@ const addMaxLengthValidation = (attribute) => (schema) => {
|
|
599
646
|
}
|
600
647
|
return schema;
|
601
648
|
};
|
602
|
-
const addMinValidation = (attribute) => (schema) => {
|
649
|
+
const addMinValidation = (attribute, options) => (schema) => {
|
603
650
|
if ("min" in attribute) {
|
604
651
|
const min = toInteger(attribute.min);
|
605
652
|
if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
|
606
|
-
if (!attribute.required && "test" in schema && min) {
|
653
|
+
if (options.status !== "draft" && !attribute.required && "test" in schema && min) {
|
607
654
|
return schema.test(
|
608
655
|
"custom-min",
|
609
656
|
{
|
@@ -839,6 +886,7 @@ const useDocumentActions = () => {
|
|
839
886
|
const { formatMessage } = useIntl();
|
840
887
|
const { trackUsage } = useTracking();
|
841
888
|
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
|
889
|
+
const navigate = useNavigate();
|
842
890
|
const [deleteDocument] = useDeleteDocumentMutation();
|
843
891
|
const _delete = React.useCallback(
|
844
892
|
async ({ collectionType, model, documentId, params }, trackerProperty) => {
|
@@ -1174,7 +1222,6 @@ const useDocumentActions = () => {
|
|
1174
1222
|
sourceId
|
1175
1223
|
});
|
1176
1224
|
if ("error" in res) {
|
1177
|
-
toggleNotification({ type: "danger", message: formatAPIError(res.error) });
|
1178
1225
|
return { error: res.error };
|
1179
1226
|
}
|
1180
1227
|
toggleNotification({
|
@@ -1193,7 +1240,7 @@ const useDocumentActions = () => {
|
|
1193
1240
|
throw err;
|
1194
1241
|
}
|
1195
1242
|
},
|
1196
|
-
[autoCloneDocument,
|
1243
|
+
[autoCloneDocument, formatMessage, toggleNotification]
|
1197
1244
|
);
|
1198
1245
|
const [cloneDocument] = useCloneDocumentMutation();
|
1199
1246
|
const clone = React.useCallback(
|
@@ -1219,6 +1266,7 @@ const useDocumentActions = () => {
|
|
1219
1266
|
defaultMessage: "Cloned document"
|
1220
1267
|
})
|
1221
1268
|
});
|
1269
|
+
navigate(`../../${res.data.data.documentId}`, { relative: "path" });
|
1222
1270
|
return res.data;
|
1223
1271
|
} catch (err) {
|
1224
1272
|
toggleNotification({
|
@@ -1229,7 +1277,7 @@ const useDocumentActions = () => {
|
|
1229
1277
|
throw err;
|
1230
1278
|
}
|
1231
1279
|
},
|
1232
|
-
[cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError]
|
1280
|
+
[cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError, navigate]
|
1233
1281
|
);
|
1234
1282
|
const [getDoc] = useLazyGetDocumentQuery();
|
1235
1283
|
const getDocument = React.useCallback(
|
@@ -1255,7 +1303,7 @@ const useDocumentActions = () => {
|
|
1255
1303
|
};
|
1256
1304
|
};
|
1257
1305
|
const ProtectedHistoryPage = lazy(
|
1258
|
-
() => import("./History-
|
1306
|
+
() => import("./History-BowL3JKP.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1259
1307
|
);
|
1260
1308
|
const routes$1 = [
|
1261
1309
|
{
|
@@ -1268,31 +1316,31 @@ const routes$1 = [
|
|
1268
1316
|
}
|
1269
1317
|
];
|
1270
1318
|
const ProtectedEditViewPage = lazy(
|
1271
|
-
() => import("./EditViewPage-
|
1319
|
+
() => import("./EditViewPage-De8GyU8P.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1272
1320
|
);
|
1273
1321
|
const ProtectedListViewPage = lazy(
|
1274
|
-
() => import("./ListViewPage-
|
1322
|
+
() => import("./ListViewPage-CXFUjZQC.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1275
1323
|
);
|
1276
1324
|
const ProtectedListConfiguration = lazy(
|
1277
|
-
() => import("./ListConfigurationPage-
|
1325
|
+
() => import("./ListConfigurationPage-BpVOB-hn.mjs").then((mod) => ({
|
1278
1326
|
default: mod.ProtectedListConfiguration
|
1279
1327
|
}))
|
1280
1328
|
);
|
1281
1329
|
const ProtectedEditConfigurationPage = lazy(
|
1282
|
-
() => import("./EditConfigurationPage-
|
1330
|
+
() => import("./EditConfigurationPage-CjUrEewK.mjs").then((mod) => ({
|
1283
1331
|
default: mod.ProtectedEditConfigurationPage
|
1284
1332
|
}))
|
1285
1333
|
);
|
1286
1334
|
const ProtectedComponentConfigurationPage = lazy(
|
1287
|
-
() => import("./ComponentConfigurationPage-
|
1335
|
+
() => import("./ComponentConfigurationPage-qemkOlnj.mjs").then((mod) => ({
|
1288
1336
|
default: mod.ProtectedComponentConfigurationPage
|
1289
1337
|
}))
|
1290
1338
|
);
|
1291
1339
|
const NoPermissions = lazy(
|
1292
|
-
() => import("./NoPermissionsPage-
|
1340
|
+
() => import("./NoPermissionsPage-DVz3mzDz.mjs").then((mod) => ({ default: mod.NoPermissions }))
|
1293
1341
|
);
|
1294
1342
|
const NoContentType = lazy(
|
1295
|
-
() => import("./NoContentTypePage-
|
1343
|
+
() => import("./NoContentTypePage-DuhOTp3x.mjs").then((mod) => ({ default: mod.NoContentType }))
|
1296
1344
|
);
|
1297
1345
|
const CollectionTypePages = () => {
|
1298
1346
|
const { collectionType } = useParams();
|
@@ -1406,12 +1454,14 @@ const DocumentActionButton = (action) => {
|
|
1406
1454
|
/* @__PURE__ */ jsx(
|
1407
1455
|
Button,
|
1408
1456
|
{
|
1409
|
-
flex:
|
1457
|
+
flex: "auto",
|
1410
1458
|
startIcon: action.icon,
|
1411
1459
|
disabled: action.disabled,
|
1412
1460
|
onClick: handleClick(action),
|
1413
1461
|
justifyContent: "center",
|
1414
1462
|
variant: action.variant || "default",
|
1463
|
+
paddingTop: "7px",
|
1464
|
+
paddingBottom: "7px",
|
1415
1465
|
children: action.label
|
1416
1466
|
}
|
1417
1467
|
),
|
@@ -1471,14 +1521,14 @@ const DocumentActionsMenu = ({
|
|
1471
1521
|
};
|
1472
1522
|
return /* @__PURE__ */ jsxs(Menu.Root, { open: isOpen, onOpenChange: setIsOpen, children: [
|
1473
1523
|
/* @__PURE__ */ jsxs(
|
1474
|
-
|
1524
|
+
StyledMoreButton,
|
1475
1525
|
{
|
1476
1526
|
disabled: isDisabled,
|
1477
1527
|
size: "S",
|
1478
1528
|
endIcon: null,
|
1479
|
-
paddingTop: "
|
1480
|
-
paddingLeft: "
|
1481
|
-
paddingRight: "
|
1529
|
+
paddingTop: "4px",
|
1530
|
+
paddingLeft: "7px",
|
1531
|
+
paddingRight: "7px",
|
1482
1532
|
variant,
|
1483
1533
|
children: [
|
1484
1534
|
/* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
|
@@ -1498,10 +1548,25 @@ const DocumentActionsMenu = ({
|
|
1498
1548
|
onSelect: handleClick(action),
|
1499
1549
|
display: "block",
|
1500
1550
|
children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", gap: 4, children: [
|
1501
|
-
/* @__PURE__ */ jsxs(
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1551
|
+
/* @__PURE__ */ jsxs(
|
1552
|
+
Flex,
|
1553
|
+
{
|
1554
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1555
|
+
gap: 2,
|
1556
|
+
tag: "span",
|
1557
|
+
children: [
|
1558
|
+
/* @__PURE__ */ jsx(
|
1559
|
+
Flex,
|
1560
|
+
{
|
1561
|
+
tag: "span",
|
1562
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1563
|
+
children: action.icon
|
1564
|
+
}
|
1565
|
+
),
|
1566
|
+
action.label
|
1567
|
+
]
|
1568
|
+
}
|
1569
|
+
),
|
1505
1570
|
action.id.startsWith("HistoryAction") && /* @__PURE__ */ jsx(
|
1506
1571
|
Flex,
|
1507
1572
|
{
|
@@ -1572,6 +1637,11 @@ const convertActionVariantToIconColor = (variant = "secondary") => {
|
|
1572
1637
|
return "primary600";
|
1573
1638
|
}
|
1574
1639
|
};
|
1640
|
+
const StyledMoreButton = styled(Menu.Trigger)`
|
1641
|
+
& > span {
|
1642
|
+
display: flex;
|
1643
|
+
}
|
1644
|
+
`;
|
1575
1645
|
const DocumentActionConfirmDialog = ({
|
1576
1646
|
onClose,
|
1577
1647
|
onCancel,
|
@@ -1625,8 +1695,8 @@ const DocumentActionModal = ({
|
|
1625
1695
|
};
|
1626
1696
|
return /* @__PURE__ */ jsx(Modal.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(Modal.Content, { children: [
|
1627
1697
|
/* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: title }) }),
|
1628
|
-
|
1629
|
-
|
1698
|
+
typeof Content === "function" ? /* @__PURE__ */ jsx(Content, { onClose: handleClose }) : /* @__PURE__ */ jsx(Modal.Body, { children: Content }),
|
1699
|
+
typeof Footer === "function" ? /* @__PURE__ */ jsx(Footer, { onClose: handleClose }) : Footer
|
1630
1700
|
] }) });
|
1631
1701
|
};
|
1632
1702
|
const PublishAction$1 = ({
|
@@ -1641,12 +1711,10 @@ const PublishAction$1 = ({
|
|
1641
1711
|
const navigate = useNavigate();
|
1642
1712
|
const { toggleNotification } = useNotification();
|
1643
1713
|
const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
|
1714
|
+
const isListView = useMatch(LIST_PATH) !== null;
|
1644
1715
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
1645
1716
|
const { formatMessage } = useIntl();
|
1646
|
-
const { canPublish
|
1647
|
-
"PublishAction",
|
1648
|
-
({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
|
1649
|
-
);
|
1717
|
+
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
1650
1718
|
const { publish } = useDocumentActions();
|
1651
1719
|
const [
|
1652
1720
|
countDraftRelations,
|
@@ -1698,7 +1766,7 @@ const PublishAction$1 = ({
|
|
1698
1766
|
}
|
1699
1767
|
}, [documentId, modified, formValues, setLocalCountOfDraftRelations]);
|
1700
1768
|
React.useEffect(() => {
|
1701
|
-
if (documentId) {
|
1769
|
+
if (documentId && !isListView) {
|
1702
1770
|
const fetchDraftRelationsCount = async () => {
|
1703
1771
|
const { data, error } = await countDraftRelations({
|
1704
1772
|
collectionType,
|
@@ -1715,7 +1783,7 @@ const PublishAction$1 = ({
|
|
1715
1783
|
};
|
1716
1784
|
fetchDraftRelationsCount();
|
1717
1785
|
}
|
1718
|
-
}, [documentId, countDraftRelations, collectionType, model, params]);
|
1786
|
+
}, [isListView, documentId, countDraftRelations, collectionType, model, params]);
|
1719
1787
|
const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
|
1720
1788
|
if (!schema?.options?.draftAndPublish) {
|
1721
1789
|
return null;
|
@@ -1766,10 +1834,8 @@ const PublishAction$1 = ({
|
|
1766
1834
|
* - the document is already published & not modified
|
1767
1835
|
* - the document is being created & not modified
|
1768
1836
|
* - the user doesn't have the permission to publish
|
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
1837
|
*/
|
1772
|
-
disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish
|
1838
|
+
disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish,
|
1773
1839
|
label: formatMessage({
|
1774
1840
|
id: "app.utils.publish",
|
1775
1841
|
defaultMessage: "Publish"
|
@@ -1816,10 +1882,6 @@ const UpdateAction = ({
|
|
1816
1882
|
const cloneMatch = useMatch(CLONE_PATH);
|
1817
1883
|
const isCloning = cloneMatch !== null;
|
1818
1884
|
const { formatMessage } = useIntl();
|
1819
|
-
const { canCreate, canUpdate } = useDocumentRBAC("UpdateAction", ({ canCreate: canCreate2, canUpdate: canUpdate2 }) => ({
|
1820
|
-
canCreate: canCreate2,
|
1821
|
-
canUpdate: canUpdate2
|
1822
|
-
}));
|
1823
1885
|
const { create, update, clone } = useDocumentActions();
|
1824
1886
|
const [{ query, rawQuery }] = useQueryParams();
|
1825
1887
|
const params = React.useMemo(() => buildValidParams(query), [query]);
|
@@ -1836,10 +1898,8 @@ const UpdateAction = ({
|
|
1836
1898
|
* - the form is submitting
|
1837
1899
|
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
1838
1900
|
* - the active tab is the published tab
|
1839
|
-
* - the user doesn't have the permission to create a new document
|
1840
|
-
* - the user doesn't have the permission to update the document
|
1841
1901
|
*/
|
1842
|
-
disabled: isSubmitting || !modified && !isCloning || activeTab === "published"
|
1902
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
1843
1903
|
label: formatMessage({
|
1844
1904
|
id: "content-manager.containers.Edit.save",
|
1845
1905
|
defaultMessage: "Save"
|
@@ -1847,16 +1907,18 @@ const UpdateAction = ({
|
|
1847
1907
|
onClick: async () => {
|
1848
1908
|
setSubmitting(true);
|
1849
1909
|
try {
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1910
|
+
if (activeTab !== "draft") {
|
1911
|
+
const { errors } = await validate();
|
1912
|
+
if (errors) {
|
1913
|
+
toggleNotification({
|
1914
|
+
type: "danger",
|
1915
|
+
message: formatMessage({
|
1916
|
+
id: "content-manager.validation.error",
|
1917
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
1918
|
+
})
|
1919
|
+
});
|
1920
|
+
return;
|
1921
|
+
}
|
1860
1922
|
}
|
1861
1923
|
if (isCloning) {
|
1862
1924
|
const res = await clone(
|
@@ -3140,7 +3202,13 @@ const SelectedEntriesModalContent = ({
|
|
3140
3202
|
);
|
3141
3203
|
const { rows, validationErrors } = React.useMemo(() => {
|
3142
3204
|
if (data.length > 0 && schema) {
|
3143
|
-
const validate = createYupSchema(
|
3205
|
+
const validate = createYupSchema(
|
3206
|
+
schema.attributes,
|
3207
|
+
components,
|
3208
|
+
// Since this is the "Publish" action, the validation
|
3209
|
+
// schema must enforce the rules for published entities
|
3210
|
+
{ status: "published" }
|
3211
|
+
);
|
3144
3212
|
const validationErrors2 = {};
|
3145
3213
|
const rows2 = data.map((entry) => {
|
3146
3214
|
try {
|
@@ -3490,7 +3558,7 @@ const TableActions = ({ document }) => {
|
|
3490
3558
|
DescriptionComponentRenderer,
|
3491
3559
|
{
|
3492
3560
|
props,
|
3493
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3561
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3494
3562
|
children: (actions2) => {
|
3495
3563
|
const tableRowActions = actions2.filter((action) => {
|
3496
3564
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3601,7 +3669,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3601
3669
|
}),
|
3602
3670
|
content: /* @__PURE__ */ jsx(AutoCloneFailureModalBody, { prohibitedFields }),
|
3603
3671
|
footer: ({ onClose }) => {
|
3604
|
-
return /* @__PURE__ */ jsxs(
|
3672
|
+
return /* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
3605
3673
|
/* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "tertiary", children: formatMessage({
|
3606
3674
|
id: "cancel",
|
3607
3675
|
defaultMessage: "Cancel"
|
@@ -3832,7 +3900,7 @@ const index = {
|
|
3832
3900
|
app.router.addRoute({
|
3833
3901
|
path: "content-manager/*",
|
3834
3902
|
lazy: async () => {
|
3835
|
-
const { Layout } = await import("./layout-
|
3903
|
+
const { Layout } = await import("./layout-ls3gxfpH.mjs");
|
3836
3904
|
return {
|
3837
3905
|
Component: Layout
|
3838
3906
|
};
|
@@ -3870,13 +3938,14 @@ export {
|
|
3870
3938
|
BulkActionsRenderer as B,
|
3871
3939
|
COLLECTION_TYPES as C,
|
3872
3940
|
DocumentStatus as D,
|
3873
|
-
|
3874
|
-
|
3875
|
-
|
3941
|
+
extractContentTypeComponents as E,
|
3942
|
+
DEFAULT_SETTINGS as F,
|
3943
|
+
convertEditLayoutToFieldLayouts as G,
|
3876
3944
|
HOOKS as H,
|
3877
3945
|
InjectionZone as I,
|
3878
|
-
|
3879
|
-
|
3946
|
+
useDocument as J,
|
3947
|
+
index as K,
|
3948
|
+
useDocumentActions as L,
|
3880
3949
|
Panels as P,
|
3881
3950
|
RelativeTime as R,
|
3882
3951
|
SINGLE_TYPES as S,
|
@@ -3894,18 +3963,18 @@ export {
|
|
3894
3963
|
PERMISSIONS as k,
|
3895
3964
|
DocumentRBAC as l,
|
3896
3965
|
DOCUMENT_META_FIELDS as m,
|
3897
|
-
|
3898
|
-
|
3899
|
-
|
3900
|
-
|
3901
|
-
|
3966
|
+
CLONE_PATH as n,
|
3967
|
+
useDocLayout as o,
|
3968
|
+
useGetContentTypeConfigurationQuery as p,
|
3969
|
+
CREATOR_FIELDS as q,
|
3970
|
+
getMainField as r,
|
3902
3971
|
setInitialData as s,
|
3903
|
-
|
3972
|
+
getDisplayName as t,
|
3904
3973
|
useContentTypeSchema as u,
|
3905
|
-
|
3906
|
-
|
3907
|
-
|
3908
|
-
|
3909
|
-
|
3974
|
+
checkIfAttributeIsDisplayable as v,
|
3975
|
+
useGetAllDocumentsQuery as w,
|
3976
|
+
convertListLayoutToFieldLayouts as x,
|
3977
|
+
capitalise as y,
|
3978
|
+
useUpdateContentTypeConfigurationMutation as z
|
3910
3979
|
};
|
3911
|
-
//# sourceMappingURL=index-
|
3980
|
+
//# sourceMappingURL=index-DiMrfcfy.mjs.map
|