@strapi/content-manager 5.0.0-rc.1 → 5.0.0-rc.10
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-BEJqMzZA.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-D8RyVgJC.js.map → ComponentConfigurationPage-BEJqMzZA.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DLuACgva.mjs → ComponentConfigurationPage-C1B5XNIM.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-DLuACgva.mjs.map → ComponentConfigurationPage-C1B5XNIM.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CuCAsHWR.mjs → EditConfigurationPage-D2DPoQ3j.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CuCAsHWR.mjs.map → EditConfigurationPage-D2DPoQ3j.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-fOm5AebB.js → EditConfigurationPage-DOyPS5Tv.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-fOm5AebB.js.map → EditConfigurationPage-DOyPS5Tv.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-BqDlT9w0.mjs → EditViewPage-Ymi21g_V.mjs} +19 -8
- package/dist/_chunks/EditViewPage-Ymi21g_V.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-Or0fpTwh.js → EditViewPage-fuASFJIx.js} +19 -8
- package/dist/_chunks/EditViewPage-fuASFJIx.js.map +1 -0
- package/dist/_chunks/{Field-OfBJ6x59.mjs → Field-BOo2Rz0Z.mjs} +101 -35
- package/dist/_chunks/Field-BOo2Rz0Z.mjs.map +1 -0
- package/dist/_chunks/{Field-Bix2HU_O.js → Field-Ce4O31Zm.js} +99 -33
- package/dist/_chunks/Field-Ce4O31Zm.js.map +1 -0
- package/dist/_chunks/{Form-Bv5ABnqE.js → Form-CCGDm2PL.js} +22 -11
- package/dist/_chunks/Form-CCGDm2PL.js.map +1 -0
- package/dist/_chunks/{Form-DyMXqj_v.mjs → Form-D2_h3W-h.mjs} +22 -11
- package/dist/_chunks/Form-D2_h3W-h.mjs.map +1 -0
- package/dist/_chunks/{History-fnln26gA.js → History-CARFXr5U.js} +4 -4
- package/dist/_chunks/{History-fnln26gA.js.map → History-CARFXr5U.js.map} +1 -1
- package/dist/_chunks/{History-rvLnluF0.mjs → History-KY23tw1N.mjs} +4 -4
- package/dist/_chunks/{History-rvLnluF0.mjs.map → History-KY23tw1N.mjs.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-DdKfJRdq.mjs → ListConfigurationPage-BrwfEo-f.mjs} +14 -4
- package/dist/_chunks/ListConfigurationPage-BrwfEo-f.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-BtCBP_L_.js → ListConfigurationPage-fZjkRyi9.js} +14 -4
- package/dist/_chunks/ListConfigurationPage-fZjkRyi9.js.map +1 -0
- package/dist/_chunks/{ListViewPage-CGZWD2qn.js → ListViewPage-CY6a70Y-.js} +9 -4
- package/dist/_chunks/ListViewPage-CY6a70Y-.js.map +1 -0
- package/dist/_chunks/{ListViewPage-B8cPO1bK.mjs → ListViewPage-CjkCjT3z.mjs} +10 -5
- package/dist/_chunks/ListViewPage-CjkCjT3z.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-CVqYTeML.mjs → NoContentTypePage-C8XPPlCu.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-CVqYTeML.mjs.map → NoContentTypePage-C8XPPlCu.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-oJxX0WCQ.js → NoContentTypePage-DId86YmW.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-oJxX0WCQ.js.map → NoContentTypePage-DId86YmW.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-BB11jqM_.js → NoPermissionsPage-CT9LmH-v.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-BB11jqM_.js.map → NoPermissionsPage-CT9LmH-v.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-mlXqh8p6.mjs → NoPermissionsPage-gwaMeI0N.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-mlXqh8p6.mjs.map → NoPermissionsPage-gwaMeI0N.mjs.map} +1 -1
- package/dist/_chunks/{Relations-DWscdjKO.mjs → Relations-BHyHGiTJ.mjs} +4 -4
- package/dist/_chunks/{Relations-DWscdjKO.mjs.map → Relations-BHyHGiTJ.mjs.map} +1 -1
- package/dist/_chunks/{Relations-6xIumgbN.js → Relations-Zqwo0Moa.js} +4 -4
- package/dist/_chunks/{Relations-6xIumgbN.js.map → Relations-Zqwo0Moa.js.map} +1 -1
- package/dist/_chunks/{index-BzUwgKUj.js → index-9nr_f9vB.js} +137 -69
- package/dist/_chunks/index-9nr_f9vB.js.map +1 -0
- package/dist/_chunks/{index-JSJrqmB9.mjs → index-CS6TpAQJ.mjs} +155 -87
- package/dist/_chunks/index-CS6TpAQJ.mjs.map +1 -0
- package/dist/_chunks/{layout-Dewoec1b.mjs → layout-2aGdWAdb.mjs} +20 -8
- package/dist/_chunks/layout-2aGdWAdb.mjs.map +1 -0
- package/dist/_chunks/{layout-U4xJd8Oi.js → layout-BssHa4-L.js} +19 -7
- package/dist/_chunks/layout-BssHa4-L.js.map +1 -0
- package/dist/_chunks/{relations-BifGhhuo.js → relations-BuxzjpZ_.js} +2 -2
- package/dist/_chunks/{relations-BifGhhuo.js.map → relations-BuxzjpZ_.js.map} +1 -1
- package/dist/_chunks/{relations-DMxeUp5V.mjs → relations-DBOO7qaP.mjs} +2 -2
- package/dist/_chunks/{relations-DMxeUp5V.mjs.map → relations-DBOO7qaP.mjs.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
@@ -179,7 +179,8 @@ const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
|
|
179
179
|
"Document",
|
180
180
|
"InitialData",
|
181
181
|
"HistoryVersion",
|
182
|
-
"Relations"
|
182
|
+
"Relations",
|
183
|
+
"UidAvailability"
|
183
184
|
]
|
184
185
|
});
|
185
186
|
const documentApi = contentManagerApi.injectEndpoints({
|
@@ -193,7 +194,12 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
193
194
|
params: query
|
194
195
|
}
|
195
196
|
}),
|
196
|
-
invalidatesTags: (_result,
|
197
|
+
invalidatesTags: (_result, error, { model }) => {
|
198
|
+
if (error) {
|
199
|
+
return [];
|
200
|
+
}
|
201
|
+
return [{ type: "Document", id: `${model}_LIST` }];
|
202
|
+
}
|
197
203
|
}),
|
198
204
|
cloneDocument: builder.mutation({
|
199
205
|
query: ({ model, sourceId, data, params }) => ({
|
@@ -204,7 +210,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
204
210
|
params
|
205
211
|
}
|
206
212
|
}),
|
207
|
-
invalidatesTags: (_result, _error, { model }) => [
|
213
|
+
invalidatesTags: (_result, _error, { model }) => [
|
214
|
+
{ type: "Document", id: `${model}_LIST` },
|
215
|
+
{ type: "UidAvailability", id: model }
|
216
|
+
]
|
208
217
|
}),
|
209
218
|
/**
|
210
219
|
* Creates a new collection-type document. This should ONLY be used for collection-types.
|
@@ -221,7 +230,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
221
230
|
}),
|
222
231
|
invalidatesTags: (result, _error, { model }) => [
|
223
232
|
{ type: "Document", id: `${model}_LIST` },
|
224
|
-
"Relations"
|
233
|
+
"Relations",
|
234
|
+
{ type: "UidAvailability", id: model }
|
225
235
|
]
|
226
236
|
}),
|
227
237
|
deleteDocument: builder.mutation({
|
@@ -262,7 +272,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
262
272
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
263
273
|
},
|
264
274
|
{ type: "Document", id: `${model}_LIST` },
|
265
|
-
"Relations"
|
275
|
+
"Relations",
|
276
|
+
{ type: "UidAvailability", id: model }
|
266
277
|
];
|
267
278
|
}
|
268
279
|
}),
|
@@ -280,6 +291,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
280
291
|
}),
|
281
292
|
providesTags: (result, _error, arg) => {
|
282
293
|
return [
|
294
|
+
{ type: "Document", id: `ALL_LIST` },
|
283
295
|
{ type: "Document", id: `${arg.model}_LIST` },
|
284
296
|
...result?.results.map(({ documentId }) => ({
|
285
297
|
type: "Document",
|
@@ -318,6 +330,11 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
318
330
|
{
|
319
331
|
type: "Document",
|
320
332
|
id: collectionType !== SINGLE_TYPES ? `${model}_${result && "documentId" in result ? result.documentId : documentId}` : model
|
333
|
+
},
|
334
|
+
// Make it easy to invalidate all individual documents queries for a model
|
335
|
+
{
|
336
|
+
type: "Document",
|
337
|
+
id: `${model}_ALL_ITEMS`
|
321
338
|
}
|
322
339
|
];
|
323
340
|
}
|
@@ -381,8 +398,21 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
381
398
|
type: "Document",
|
382
399
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
383
400
|
},
|
384
|
-
"Relations"
|
401
|
+
"Relations",
|
402
|
+
{ type: "UidAvailability", id: model }
|
385
403
|
];
|
404
|
+
},
|
405
|
+
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
406
|
+
const patchResult = dispatch(
|
407
|
+
documentApi.util.updateQueryData("getDocument", patch, (draft) => {
|
408
|
+
Object.assign(draft.data, data);
|
409
|
+
})
|
410
|
+
);
|
411
|
+
try {
|
412
|
+
await queryFulfilled;
|
413
|
+
} catch {
|
414
|
+
patchResult.undo();
|
415
|
+
}
|
386
416
|
}
|
387
417
|
}),
|
388
418
|
unpublishDocument: builder.mutation({
|
@@ -452,7 +482,7 @@ const buildValidParams = (query) => {
|
|
452
482
|
const isBaseQueryError = (error) => {
|
453
483
|
return error.name !== void 0;
|
454
484
|
};
|
455
|
-
const createYupSchema = (attributes = {}, components = {}) => {
|
485
|
+
const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
|
456
486
|
const createModelSchema = (attributes2) => yup__namespace.object().shape(
|
457
487
|
Object.entries(attributes2).reduce((acc, [name, attribute]) => {
|
458
488
|
if (DOCUMENT_META_FIELDS.includes(name)) {
|
@@ -465,7 +495,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
|
|
465
495
|
addMinValidation,
|
466
496
|
addMaxValidation,
|
467
497
|
addRegexValidation
|
468
|
-
].map((fn) => fn(attribute));
|
498
|
+
].map((fn) => fn(attribute, options));
|
469
499
|
const transformSchema = pipe__default.default(...validations);
|
470
500
|
switch (attribute.type) {
|
471
501
|
case "component": {
|
@@ -566,6 +596,14 @@ const createAttributeSchema = (attribute) => {
|
|
566
596
|
if (!value || typeof value === "string" && value.length === 0) {
|
567
597
|
return true;
|
568
598
|
}
|
599
|
+
if (typeof value === "object") {
|
600
|
+
try {
|
601
|
+
JSON.stringify(value);
|
602
|
+
return true;
|
603
|
+
} catch (err) {
|
604
|
+
return false;
|
605
|
+
}
|
606
|
+
}
|
569
607
|
try {
|
570
608
|
JSON.parse(value);
|
571
609
|
return true;
|
@@ -584,13 +622,7 @@ const createAttributeSchema = (attribute) => {
|
|
584
622
|
return yup__namespace.mixed();
|
585
623
|
}
|
586
624
|
};
|
587
|
-
const
|
588
|
-
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
589
|
-
return schema.min(1, strapiAdmin.translatedErrors.required);
|
590
|
-
}
|
591
|
-
if (attribute.required && attribute.type !== "relation") {
|
592
|
-
return schema.required(strapiAdmin.translatedErrors.required);
|
593
|
-
}
|
625
|
+
const nullableSchema = (schema) => {
|
594
626
|
return schema?.nullable ? schema.nullable() : (
|
595
627
|
// In some cases '.nullable' will not be available on the schema.
|
596
628
|
// e.g. when the schema has been built using yup.lazy (e.g. for relations).
|
@@ -598,7 +630,22 @@ const addRequiredValidation = (attribute) => (schema) => {
|
|
598
630
|
schema
|
599
631
|
);
|
600
632
|
};
|
601
|
-
const
|
633
|
+
const addRequiredValidation = (attribute, options) => (schema) => {
|
634
|
+
if (options.status === "draft") {
|
635
|
+
return nullableSchema(schema);
|
636
|
+
}
|
637
|
+
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
638
|
+
return schema.min(1, strapiAdmin.translatedErrors.required);
|
639
|
+
}
|
640
|
+
if (attribute.required && attribute.type !== "relation") {
|
641
|
+
return schema.required(strapiAdmin.translatedErrors.required);
|
642
|
+
}
|
643
|
+
return nullableSchema(schema);
|
644
|
+
};
|
645
|
+
const addMinLengthValidation = (attribute, options) => (schema) => {
|
646
|
+
if (options.status === "draft") {
|
647
|
+
return schema;
|
648
|
+
}
|
602
649
|
if ("minLength" in attribute && attribute.minLength && Number.isInteger(attribute.minLength) && "min" in schema) {
|
603
650
|
return schema.min(attribute.minLength, {
|
604
651
|
...strapiAdmin.translatedErrors.minLength,
|
@@ -620,11 +667,11 @@ const addMaxLengthValidation = (attribute) => (schema) => {
|
|
620
667
|
}
|
621
668
|
return schema;
|
622
669
|
};
|
623
|
-
const addMinValidation = (attribute) => (schema) => {
|
670
|
+
const addMinValidation = (attribute, options) => (schema) => {
|
624
671
|
if ("min" in attribute) {
|
625
672
|
const min = toInteger(attribute.min);
|
626
673
|
if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
|
627
|
-
if (!attribute.required && "test" in schema && min) {
|
674
|
+
if (options.status !== "draft" && !attribute.required && "test" in schema && min) {
|
628
675
|
return schema.test(
|
629
676
|
"custom-min",
|
630
677
|
{
|
@@ -860,6 +907,7 @@ const useDocumentActions = () => {
|
|
860
907
|
const { formatMessage } = reactIntl.useIntl();
|
861
908
|
const { trackUsage } = strapiAdmin.useTracking();
|
862
909
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
910
|
+
const navigate = reactRouterDom.useNavigate();
|
863
911
|
const [deleteDocument] = useDeleteDocumentMutation();
|
864
912
|
const _delete = React__namespace.useCallback(
|
865
913
|
async ({ collectionType, model, documentId, params }, trackerProperty) => {
|
@@ -1195,7 +1243,6 @@ const useDocumentActions = () => {
|
|
1195
1243
|
sourceId
|
1196
1244
|
});
|
1197
1245
|
if ("error" in res) {
|
1198
|
-
toggleNotification({ type: "danger", message: formatAPIError(res.error) });
|
1199
1246
|
return { error: res.error };
|
1200
1247
|
}
|
1201
1248
|
toggleNotification({
|
@@ -1214,7 +1261,7 @@ const useDocumentActions = () => {
|
|
1214
1261
|
throw err;
|
1215
1262
|
}
|
1216
1263
|
},
|
1217
|
-
[autoCloneDocument,
|
1264
|
+
[autoCloneDocument, formatMessage, toggleNotification]
|
1218
1265
|
);
|
1219
1266
|
const [cloneDocument] = useCloneDocumentMutation();
|
1220
1267
|
const clone = React__namespace.useCallback(
|
@@ -1240,6 +1287,7 @@ const useDocumentActions = () => {
|
|
1240
1287
|
defaultMessage: "Cloned document"
|
1241
1288
|
})
|
1242
1289
|
});
|
1290
|
+
navigate(`../../${res.data.data.documentId}`, { relative: "path" });
|
1243
1291
|
return res.data;
|
1244
1292
|
} catch (err) {
|
1245
1293
|
toggleNotification({
|
@@ -1250,7 +1298,7 @@ const useDocumentActions = () => {
|
|
1250
1298
|
throw err;
|
1251
1299
|
}
|
1252
1300
|
},
|
1253
|
-
[cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError]
|
1301
|
+
[cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError, navigate]
|
1254
1302
|
);
|
1255
1303
|
const [getDoc] = useLazyGetDocumentQuery();
|
1256
1304
|
const getDocument = React__namespace.useCallback(
|
@@ -1276,7 +1324,7 @@ const useDocumentActions = () => {
|
|
1276
1324
|
};
|
1277
1325
|
};
|
1278
1326
|
const ProtectedHistoryPage = React.lazy(
|
1279
|
-
() => Promise.resolve().then(() => require("./History-
|
1327
|
+
() => Promise.resolve().then(() => require("./History-CARFXr5U.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1280
1328
|
);
|
1281
1329
|
const routes$1 = [
|
1282
1330
|
{
|
@@ -1289,31 +1337,31 @@ const routes$1 = [
|
|
1289
1337
|
}
|
1290
1338
|
];
|
1291
1339
|
const ProtectedEditViewPage = React.lazy(
|
1292
|
-
() => Promise.resolve().then(() => require("./EditViewPage-
|
1340
|
+
() => Promise.resolve().then(() => require("./EditViewPage-fuASFJIx.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1293
1341
|
);
|
1294
1342
|
const ProtectedListViewPage = React.lazy(
|
1295
|
-
() => Promise.resolve().then(() => require("./ListViewPage-
|
1343
|
+
() => Promise.resolve().then(() => require("./ListViewPage-CY6a70Y-.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1296
1344
|
);
|
1297
1345
|
const ProtectedListConfiguration = React.lazy(
|
1298
|
-
() => Promise.resolve().then(() => require("./ListConfigurationPage-
|
1346
|
+
() => Promise.resolve().then(() => require("./ListConfigurationPage-fZjkRyi9.js")).then((mod) => ({
|
1299
1347
|
default: mod.ProtectedListConfiguration
|
1300
1348
|
}))
|
1301
1349
|
);
|
1302
1350
|
const ProtectedEditConfigurationPage = React.lazy(
|
1303
|
-
() => Promise.resolve().then(() => require("./EditConfigurationPage-
|
1351
|
+
() => Promise.resolve().then(() => require("./EditConfigurationPage-DOyPS5Tv.js")).then((mod) => ({
|
1304
1352
|
default: mod.ProtectedEditConfigurationPage
|
1305
1353
|
}))
|
1306
1354
|
);
|
1307
1355
|
const ProtectedComponentConfigurationPage = React.lazy(
|
1308
|
-
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-
|
1356
|
+
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-BEJqMzZA.js")).then((mod) => ({
|
1309
1357
|
default: mod.ProtectedComponentConfigurationPage
|
1310
1358
|
}))
|
1311
1359
|
);
|
1312
1360
|
const NoPermissions = React.lazy(
|
1313
|
-
() => Promise.resolve().then(() => require("./NoPermissionsPage-
|
1361
|
+
() => Promise.resolve().then(() => require("./NoPermissionsPage-CT9LmH-v.js")).then((mod) => ({ default: mod.NoPermissions }))
|
1314
1362
|
);
|
1315
1363
|
const NoContentType = React.lazy(
|
1316
|
-
() => Promise.resolve().then(() => require("./NoContentTypePage-
|
1364
|
+
() => Promise.resolve().then(() => require("./NoContentTypePage-DId86YmW.js")).then((mod) => ({ default: mod.NoContentType }))
|
1317
1365
|
);
|
1318
1366
|
const CollectionTypePages = () => {
|
1319
1367
|
const { collectionType } = reactRouterDom.useParams();
|
@@ -1427,12 +1475,14 @@ const DocumentActionButton = (action) => {
|
|
1427
1475
|
/* @__PURE__ */ jsxRuntime.jsx(
|
1428
1476
|
designSystem.Button,
|
1429
1477
|
{
|
1430
|
-
flex:
|
1478
|
+
flex: "auto",
|
1431
1479
|
startIcon: action.icon,
|
1432
1480
|
disabled: action.disabled,
|
1433
1481
|
onClick: handleClick(action),
|
1434
1482
|
justifyContent: "center",
|
1435
1483
|
variant: action.variant || "default",
|
1484
|
+
paddingTop: "7px",
|
1485
|
+
paddingBottom: "7px",
|
1436
1486
|
children: action.label
|
1437
1487
|
}
|
1438
1488
|
),
|
@@ -1492,14 +1542,14 @@ const DocumentActionsMenu = ({
|
|
1492
1542
|
};
|
1493
1543
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { open: isOpen, onOpenChange: setIsOpen, children: [
|
1494
1544
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
1495
|
-
|
1545
|
+
StyledMoreButton,
|
1496
1546
|
{
|
1497
1547
|
disabled: isDisabled,
|
1498
1548
|
size: "S",
|
1499
1549
|
endIcon: null,
|
1500
|
-
paddingTop: "
|
1501
|
-
paddingLeft: "
|
1502
|
-
paddingRight: "
|
1550
|
+
paddingTop: "4px",
|
1551
|
+
paddingLeft: "7px",
|
1552
|
+
paddingRight: "7px",
|
1503
1553
|
variant,
|
1504
1554
|
children: [
|
1505
1555
|
/* @__PURE__ */ jsxRuntime.jsx(Icons.More, { "aria-hidden": true, focusable: false }),
|
@@ -1519,10 +1569,25 @@ const DocumentActionsMenu = ({
|
|
1519
1569
|
onSelect: handleClick(action),
|
1520
1570
|
display: "block",
|
1521
1571
|
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: [
|
1522
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1572
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
1573
|
+
designSystem.Flex,
|
1574
|
+
{
|
1575
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1576
|
+
gap: 2,
|
1577
|
+
tag: "span",
|
1578
|
+
children: [
|
1579
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
1580
|
+
designSystem.Flex,
|
1581
|
+
{
|
1582
|
+
tag: "span",
|
1583
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1584
|
+
children: action.icon
|
1585
|
+
}
|
1586
|
+
),
|
1587
|
+
action.label
|
1588
|
+
]
|
1589
|
+
}
|
1590
|
+
),
|
1526
1591
|
action.id.startsWith("HistoryAction") && /* @__PURE__ */ jsxRuntime.jsx(
|
1527
1592
|
designSystem.Flex,
|
1528
1593
|
{
|
@@ -1593,6 +1658,11 @@ const convertActionVariantToIconColor = (variant = "secondary") => {
|
|
1593
1658
|
return "primary600";
|
1594
1659
|
}
|
1595
1660
|
};
|
1661
|
+
const StyledMoreButton = styledComponents.styled(designSystem.Menu.Trigger)`
|
1662
|
+
& > span {
|
1663
|
+
display: flex;
|
1664
|
+
}
|
1665
|
+
`;
|
1596
1666
|
const DocumentActionConfirmDialog = ({
|
1597
1667
|
onClose,
|
1598
1668
|
onCancel,
|
@@ -1646,8 +1716,8 @@ const DocumentActionModal = ({
|
|
1646
1716
|
};
|
1647
1717
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { children: [
|
1648
1718
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Title, { children: title }) }),
|
1649
|
-
|
1650
|
-
|
1719
|
+
typeof Content === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Content, { onClose: handleClose }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: Content }),
|
1720
|
+
typeof Footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { onClose: handleClose }) : Footer
|
1651
1721
|
] }) });
|
1652
1722
|
};
|
1653
1723
|
const PublishAction$1 = ({
|
@@ -1664,10 +1734,7 @@ const PublishAction$1 = ({
|
|
1664
1734
|
const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
|
1665
1735
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
1666
1736
|
const { formatMessage } = reactIntl.useIntl();
|
1667
|
-
const { canPublish
|
1668
|
-
"PublishAction",
|
1669
|
-
({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
|
1670
|
-
);
|
1737
|
+
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
1671
1738
|
const { publish } = useDocumentActions();
|
1672
1739
|
const [
|
1673
1740
|
countDraftRelations,
|
@@ -1787,10 +1854,8 @@ const PublishAction$1 = ({
|
|
1787
1854
|
* - the document is already published & not modified
|
1788
1855
|
* - the document is being created & not modified
|
1789
1856
|
* - the user doesn't have the permission to publish
|
1790
|
-
* - the user doesn't have the permission to create a new document
|
1791
|
-
* - the user doesn't have the permission to update the document
|
1792
1857
|
*/
|
1793
|
-
disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish
|
1858
|
+
disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish,
|
1794
1859
|
label: formatMessage({
|
1795
1860
|
id: "app.utils.publish",
|
1796
1861
|
defaultMessage: "Publish"
|
@@ -1837,10 +1902,6 @@ const UpdateAction = ({
|
|
1837
1902
|
const cloneMatch = reactRouterDom.useMatch(CLONE_PATH);
|
1838
1903
|
const isCloning = cloneMatch !== null;
|
1839
1904
|
const { formatMessage } = reactIntl.useIntl();
|
1840
|
-
const { canCreate, canUpdate } = useDocumentRBAC("UpdateAction", ({ canCreate: canCreate2, canUpdate: canUpdate2 }) => ({
|
1841
|
-
canCreate: canCreate2,
|
1842
|
-
canUpdate: canUpdate2
|
1843
|
-
}));
|
1844
1905
|
const { create, update, clone } = useDocumentActions();
|
1845
1906
|
const [{ query, rawQuery }] = strapiAdmin.useQueryParams();
|
1846
1907
|
const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
|
@@ -1857,10 +1918,8 @@ const UpdateAction = ({
|
|
1857
1918
|
* - the form is submitting
|
1858
1919
|
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
1859
1920
|
* - the active tab is the published tab
|
1860
|
-
* - the user doesn't have the permission to create a new document
|
1861
|
-
* - the user doesn't have the permission to update the document
|
1862
1921
|
*/
|
1863
|
-
disabled: isSubmitting || !modified && !isCloning || activeTab === "published"
|
1922
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
1864
1923
|
label: formatMessage({
|
1865
1924
|
id: "content-manager.containers.Edit.save",
|
1866
1925
|
defaultMessage: "Save"
|
@@ -1868,16 +1927,18 @@ const UpdateAction = ({
|
|
1868
1927
|
onClick: async () => {
|
1869
1928
|
setSubmitting(true);
|
1870
1929
|
try {
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
|
1930
|
+
if (activeTab !== "draft") {
|
1931
|
+
const { errors } = await validate();
|
1932
|
+
if (errors) {
|
1933
|
+
toggleNotification({
|
1934
|
+
type: "danger",
|
1935
|
+
message: formatMessage({
|
1936
|
+
id: "content-manager.validation.error",
|
1937
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
1938
|
+
})
|
1939
|
+
});
|
1940
|
+
return;
|
1941
|
+
}
|
1881
1942
|
}
|
1882
1943
|
if (isCloning) {
|
1883
1944
|
const res = await clone(
|
@@ -3161,7 +3222,13 @@ const SelectedEntriesModalContent = ({
|
|
3161
3222
|
);
|
3162
3223
|
const { rows, validationErrors } = React__namespace.useMemo(() => {
|
3163
3224
|
if (data.length > 0 && schema) {
|
3164
|
-
const validate = createYupSchema(
|
3225
|
+
const validate = createYupSchema(
|
3226
|
+
schema.attributes,
|
3227
|
+
components,
|
3228
|
+
// Since this is the "Publish" action, the validation
|
3229
|
+
// schema must enforce the rules for published entities
|
3230
|
+
{ status: "published" }
|
3231
|
+
);
|
3165
3232
|
const validationErrors2 = {};
|
3166
3233
|
const rows2 = data.map((entry) => {
|
3167
3234
|
try {
|
@@ -3511,7 +3578,7 @@ const TableActions = ({ document }) => {
|
|
3511
3578
|
strapiAdmin.DescriptionComponentRenderer,
|
3512
3579
|
{
|
3513
3580
|
props,
|
3514
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3581
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3515
3582
|
children: (actions2) => {
|
3516
3583
|
const tableRowActions = actions2.filter((action) => {
|
3517
3584
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3622,7 +3689,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3622
3689
|
}),
|
3623
3690
|
content: /* @__PURE__ */ jsxRuntime.jsx(AutoCloneFailureModalBody, { prohibitedFields }),
|
3624
3691
|
footer: ({ onClose }) => {
|
3625
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
3692
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
|
3626
3693
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onClose, variant: "tertiary", children: formatMessage({
|
3627
3694
|
id: "cancel",
|
3628
3695
|
defaultMessage: "Cancel"
|
@@ -3853,7 +3920,7 @@ const index = {
|
|
3853
3920
|
app.router.addRoute({
|
3854
3921
|
path: "content-manager/*",
|
3855
3922
|
lazy: async () => {
|
3856
|
-
const { Layout } = await Promise.resolve().then(() => require("./layout-
|
3923
|
+
const { Layout } = await Promise.resolve().then(() => require("./layout-BssHa4-L.js"));
|
3857
3924
|
return {
|
3858
3925
|
Component: Layout
|
3859
3926
|
};
|
@@ -3888,6 +3955,7 @@ const index = {
|
|
3888
3955
|
};
|
3889
3956
|
exports.ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD = ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD;
|
3890
3957
|
exports.BulkActionsRenderer = BulkActionsRenderer;
|
3958
|
+
exports.CLONE_PATH = CLONE_PATH;
|
3891
3959
|
exports.COLLECTION_TYPES = COLLECTION_TYPES;
|
3892
3960
|
exports.CREATOR_FIELDS = CREATOR_FIELDS;
|
3893
3961
|
exports.DEFAULT_SETTINGS = DEFAULT_SETTINGS;
|
@@ -3927,4 +3995,4 @@ exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
|
|
3927
3995
|
exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
|
3928
3996
|
exports.useGetInitialDataQuery = useGetInitialDataQuery;
|
3929
3997
|
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
|
3930
|
-
//# sourceMappingURL=index-
|
3998
|
+
//# sourceMappingURL=index-9nr_f9vB.js.map
|