@strapi/content-manager 0.0.0-experimental.cb311d9fcfbd8e441f790aea232f0a39bdd90e16 → 0.0.0-experimental.d834c9e658d1fb037e6da1105150593521c667cc
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-DL1MHO8i.js → ComponentConfigurationPage-D_M8iBw5.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-DL1MHO8i.js.map → ComponentConfigurationPage-D_M8iBw5.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-D0dyDTwq.mjs → ComponentConfigurationPage-qemkOlnj.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-D0dyDTwq.mjs.map → ComponentConfigurationPage-qemkOlnj.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CMaOf-A-.js → EditConfigurationPage-BePwPuHy.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CMaOf-A-.js.map → EditConfigurationPage-BePwPuHy.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-13b7S5Cq.mjs → EditConfigurationPage-CjUrEewK.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-13b7S5Cq.mjs.map → EditConfigurationPage-CjUrEewK.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-BSVmMpRd.js → EditViewPage-B-RJeiJD.js} +19 -8
- package/dist/_chunks/EditViewPage-B-RJeiJD.js.map +1 -0
- package/dist/_chunks/{EditViewPage-C3tIZ8F5.mjs → EditViewPage-De8GyU8P.mjs} +19 -8
- package/dist/_chunks/EditViewPage-De8GyU8P.mjs.map +1 -0
- package/dist/_chunks/{Field-DUCVth4C.js → Field-dq8Tg1M_.js} +99 -33
- package/dist/_chunks/Field-dq8Tg1M_.js.map +1 -0
- package/dist/_chunks/{Field-BvuT8cGL.mjs → Field-pb2o8uBe.mjs} +101 -35
- package/dist/_chunks/{Field-BvuT8cGL.mjs.map → Field-pb2o8uBe.mjs.map} +1 -1
- package/dist/_chunks/{Form-Cpl4W1ak.js → Form-DGIf4jQU.js} +22 -11
- package/dist/_chunks/Form-DGIf4jQU.js.map +1 -0
- package/dist/_chunks/{Form-BZmDNVr9.mjs → Form-DJn0Dxha.mjs} +22 -11
- package/dist/_chunks/Form-DJn0Dxha.mjs.map +1 -0
- package/dist/_chunks/{History-Cq_Hrzuu.mjs → History-BowL3JKP.mjs} +4 -4
- package/dist/_chunks/{History-Cq_Hrzuu.mjs.map → History-BowL3JKP.mjs.map} +1 -1
- package/dist/_chunks/{History-D4U2YISB.js → History-Dh2NEHnR.js} +4 -4
- package/dist/_chunks/{History-D4U2YISB.js.map → History-Dh2NEHnR.js.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-W-KQHmBv.mjs → ListConfigurationPage-BpVOB-hn.mjs} +14 -4
- package/dist/_chunks/ListConfigurationPage-BpVOB-hn.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-Bny6CdWe.js → ListConfigurationPage-BxYCWz9e.js} +14 -4
- package/dist/_chunks/ListConfigurationPage-BxYCWz9e.js.map +1 -0
- package/dist/_chunks/{ListViewPage-O8F1pBJo.js → ListViewPage-4XsciqHZ.js} +3 -3
- package/dist/_chunks/{ListViewPage-O8F1pBJo.js.map → ListViewPage-4XsciqHZ.js.map} +1 -1
- package/dist/_chunks/{ListViewPage-HBBnJa8K.mjs → ListViewPage-CXFUjZQC.mjs} +3 -3
- package/dist/_chunks/{ListViewPage-HBBnJa8K.mjs.map → ListViewPage-CXFUjZQC.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-CQWChGPw.js → NoContentTypePage-C8OpoHeU.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-CQWChGPw.js.map → NoContentTypePage-C8OpoHeU.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-B-gIhHWM.mjs → NoContentTypePage-DuhOTp3x.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-B-gIhHWM.mjs.map → NoContentTypePage-DuhOTp3x.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-XhOPl8wx.mjs → NoPermissionsPage-DVz3mzDz.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-XhOPl8wx.mjs.map → NoPermissionsPage-DVz3mzDz.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CY46zxnM.js → NoPermissionsPage-y_r7DVA2.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CY46zxnM.js.map → NoPermissionsPage-y_r7DVA2.js.map} +1 -1
- package/dist/_chunks/{Relations-vFZ6Wasg.mjs → Relations-CVNLrn1Y.mjs} +4 -4
- package/dist/_chunks/{Relations-vFZ6Wasg.mjs.map → Relations-CVNLrn1Y.mjs.map} +1 -1
- package/dist/_chunks/{Relations-C4gGfZRv.js → Relations-DPFCAa7b.js} +4 -4
- package/dist/_chunks/{Relations-C4gGfZRv.js.map → Relations-DPFCAa7b.js.map} +1 -1
- package/dist/_chunks/{index-5EMXLEM_.js → index-C3fJE-1-.js} +101 -54
- package/dist/_chunks/index-C3fJE-1-.js.map +1 -0
- package/dist/_chunks/{index-Dpxg3ctD.mjs → index-DiMrfcfy.mjs} +119 -72
- package/dist/_chunks/index-DiMrfcfy.mjs.map +1 -0
- package/dist/_chunks/{layout-P3eKO1Qy.js → layout-C788OmNr.js} +6 -6
- package/dist/_chunks/layout-C788OmNr.js.map +1 -0
- package/dist/_chunks/{layout-C0INpKap.mjs → layout-ls3gxfpH.mjs} +6 -6
- package/dist/_chunks/layout-ls3gxfpH.mjs.map +1 -0
- package/dist/_chunks/{relations-FBRRBWeO.mjs → relations-CLcOmGO0.mjs} +2 -2
- package/dist/_chunks/{relations-FBRRBWeO.mjs.map → relations-CLcOmGO0.mjs.map} +1 -1
- package/dist/_chunks/{relations-B1y0K6LE.js → relations-DYeotliT.js} +2 -2
- package/dist/_chunks/{relations-B1y0K6LE.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 +29 -18
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +29 -18
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/relations.d.ts.map +1 -1
- package/dist/server/src/policies/hasPermissions.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-BSVmMpRd.js.map +0 -1
- package/dist/_chunks/EditViewPage-C3tIZ8F5.mjs.map +0 -1
- package/dist/_chunks/Field-DUCVth4C.js.map +0 -1
- package/dist/_chunks/Form-BZmDNVr9.mjs.map +0 -1
- package/dist/_chunks/Form-Cpl4W1ak.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-Bny6CdWe.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-W-KQHmBv.mjs.map +0 -1
- package/dist/_chunks/index-5EMXLEM_.js.map +0 -1
- package/dist/_chunks/index-Dpxg3ctD.mjs.map +0 -1
- package/dist/_chunks/layout-C0INpKap.mjs.map +0 -1
- package/dist/_chunks/layout-P3eKO1Qy.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({
|
@@ -209,7 +210,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
209
210
|
params
|
210
211
|
}
|
211
212
|
}),
|
212
|
-
invalidatesTags: (_result, _error, { model }) => [
|
213
|
+
invalidatesTags: (_result, _error, { model }) => [
|
214
|
+
{ type: "Document", id: `${model}_LIST` },
|
215
|
+
{ type: "UidAvailability", id: model }
|
216
|
+
]
|
213
217
|
}),
|
214
218
|
/**
|
215
219
|
* Creates a new collection-type document. This should ONLY be used for collection-types.
|
@@ -226,7 +230,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
226
230
|
}),
|
227
231
|
invalidatesTags: (result, _error, { model }) => [
|
228
232
|
{ type: "Document", id: `${model}_LIST` },
|
229
|
-
"Relations"
|
233
|
+
"Relations",
|
234
|
+
{ type: "UidAvailability", id: model }
|
230
235
|
]
|
231
236
|
}),
|
232
237
|
deleteDocument: builder.mutation({
|
@@ -267,7 +272,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
267
272
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
268
273
|
},
|
269
274
|
{ type: "Document", id: `${model}_LIST` },
|
270
|
-
"Relations"
|
275
|
+
"Relations",
|
276
|
+
{ type: "UidAvailability", id: model }
|
271
277
|
];
|
272
278
|
}
|
273
279
|
}),
|
@@ -392,7 +398,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
392
398
|
type: "Document",
|
393
399
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
394
400
|
},
|
395
|
-
"Relations"
|
401
|
+
"Relations",
|
402
|
+
{ type: "UidAvailability", id: model }
|
396
403
|
];
|
397
404
|
},
|
398
405
|
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
@@ -475,7 +482,7 @@ const buildValidParams = (query) => {
|
|
475
482
|
const isBaseQueryError = (error) => {
|
476
483
|
return error.name !== void 0;
|
477
484
|
};
|
478
|
-
const createYupSchema = (attributes = {}, components = {}) => {
|
485
|
+
const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
|
479
486
|
const createModelSchema = (attributes2) => yup__namespace.object().shape(
|
480
487
|
Object.entries(attributes2).reduce((acc, [name, attribute]) => {
|
481
488
|
if (DOCUMENT_META_FIELDS.includes(name)) {
|
@@ -488,7 +495,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
|
|
488
495
|
addMinValidation,
|
489
496
|
addMaxValidation,
|
490
497
|
addRegexValidation
|
491
|
-
].map((fn) => fn(attribute));
|
498
|
+
].map((fn) => fn(attribute, options));
|
492
499
|
const transformSchema = pipe__default.default(...validations);
|
493
500
|
switch (attribute.type) {
|
494
501
|
case "component": {
|
@@ -615,13 +622,7 @@ const createAttributeSchema = (attribute) => {
|
|
615
622
|
return yup__namespace.mixed();
|
616
623
|
}
|
617
624
|
};
|
618
|
-
const
|
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);
|
624
|
-
}
|
625
|
+
const nullableSchema = (schema) => {
|
625
626
|
return schema?.nullable ? schema.nullable() : (
|
626
627
|
// In some cases '.nullable' will not be available on the schema.
|
627
628
|
// e.g. when the schema has been built using yup.lazy (e.g. for relations).
|
@@ -629,7 +630,22 @@ const addRequiredValidation = (attribute) => (schema) => {
|
|
629
630
|
schema
|
630
631
|
);
|
631
632
|
};
|
632
|
-
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
|
+
}
|
633
649
|
if ("minLength" in attribute && attribute.minLength && Number.isInteger(attribute.minLength) && "min" in schema) {
|
634
650
|
return schema.min(attribute.minLength, {
|
635
651
|
...strapiAdmin.translatedErrors.minLength,
|
@@ -651,11 +667,11 @@ const addMaxLengthValidation = (attribute) => (schema) => {
|
|
651
667
|
}
|
652
668
|
return schema;
|
653
669
|
};
|
654
|
-
const addMinValidation = (attribute) => (schema) => {
|
670
|
+
const addMinValidation = (attribute, options) => (schema) => {
|
655
671
|
if ("min" in attribute) {
|
656
672
|
const min = toInteger(attribute.min);
|
657
673
|
if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
|
658
|
-
if (!attribute.required && "test" in schema && min) {
|
674
|
+
if (options.status !== "draft" && !attribute.required && "test" in schema && min) {
|
659
675
|
return schema.test(
|
660
676
|
"custom-min",
|
661
677
|
{
|
@@ -891,6 +907,7 @@ const useDocumentActions = () => {
|
|
891
907
|
const { formatMessage } = reactIntl.useIntl();
|
892
908
|
const { trackUsage } = strapiAdmin.useTracking();
|
893
909
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
910
|
+
const navigate = reactRouterDom.useNavigate();
|
894
911
|
const [deleteDocument] = useDeleteDocumentMutation();
|
895
912
|
const _delete = React__namespace.useCallback(
|
896
913
|
async ({ collectionType, model, documentId, params }, trackerProperty) => {
|
@@ -1244,7 +1261,7 @@ const useDocumentActions = () => {
|
|
1244
1261
|
throw err;
|
1245
1262
|
}
|
1246
1263
|
},
|
1247
|
-
[autoCloneDocument,
|
1264
|
+
[autoCloneDocument, formatMessage, toggleNotification]
|
1248
1265
|
);
|
1249
1266
|
const [cloneDocument] = useCloneDocumentMutation();
|
1250
1267
|
const clone = React__namespace.useCallback(
|
@@ -1270,6 +1287,7 @@ const useDocumentActions = () => {
|
|
1270
1287
|
defaultMessage: "Cloned document"
|
1271
1288
|
})
|
1272
1289
|
});
|
1290
|
+
navigate(`../../${res.data.data.documentId}`, { relative: "path" });
|
1273
1291
|
return res.data;
|
1274
1292
|
} catch (err) {
|
1275
1293
|
toggleNotification({
|
@@ -1280,7 +1298,7 @@ const useDocumentActions = () => {
|
|
1280
1298
|
throw err;
|
1281
1299
|
}
|
1282
1300
|
},
|
1283
|
-
[cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError]
|
1301
|
+
[cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError, navigate]
|
1284
1302
|
);
|
1285
1303
|
const [getDoc] = useLazyGetDocumentQuery();
|
1286
1304
|
const getDocument = React__namespace.useCallback(
|
@@ -1306,7 +1324,7 @@ const useDocumentActions = () => {
|
|
1306
1324
|
};
|
1307
1325
|
};
|
1308
1326
|
const ProtectedHistoryPage = React.lazy(
|
1309
|
-
() => Promise.resolve().then(() => require("./History-
|
1327
|
+
() => Promise.resolve().then(() => require("./History-Dh2NEHnR.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1310
1328
|
);
|
1311
1329
|
const routes$1 = [
|
1312
1330
|
{
|
@@ -1319,31 +1337,31 @@ const routes$1 = [
|
|
1319
1337
|
}
|
1320
1338
|
];
|
1321
1339
|
const ProtectedEditViewPage = React.lazy(
|
1322
|
-
() => Promise.resolve().then(() => require("./EditViewPage-
|
1340
|
+
() => Promise.resolve().then(() => require("./EditViewPage-B-RJeiJD.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1323
1341
|
);
|
1324
1342
|
const ProtectedListViewPage = React.lazy(
|
1325
|
-
() => Promise.resolve().then(() => require("./ListViewPage-
|
1343
|
+
() => Promise.resolve().then(() => require("./ListViewPage-4XsciqHZ.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1326
1344
|
);
|
1327
1345
|
const ProtectedListConfiguration = React.lazy(
|
1328
|
-
() => Promise.resolve().then(() => require("./ListConfigurationPage-
|
1346
|
+
() => Promise.resolve().then(() => require("./ListConfigurationPage-BxYCWz9e.js")).then((mod) => ({
|
1329
1347
|
default: mod.ProtectedListConfiguration
|
1330
1348
|
}))
|
1331
1349
|
);
|
1332
1350
|
const ProtectedEditConfigurationPage = React.lazy(
|
1333
|
-
() => Promise.resolve().then(() => require("./EditConfigurationPage-
|
1351
|
+
() => Promise.resolve().then(() => require("./EditConfigurationPage-BePwPuHy.js")).then((mod) => ({
|
1334
1352
|
default: mod.ProtectedEditConfigurationPage
|
1335
1353
|
}))
|
1336
1354
|
);
|
1337
1355
|
const ProtectedComponentConfigurationPage = React.lazy(
|
1338
|
-
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-
|
1356
|
+
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-D_M8iBw5.js")).then((mod) => ({
|
1339
1357
|
default: mod.ProtectedComponentConfigurationPage
|
1340
1358
|
}))
|
1341
1359
|
);
|
1342
1360
|
const NoPermissions = React.lazy(
|
1343
|
-
() => Promise.resolve().then(() => require("./NoPermissionsPage-
|
1361
|
+
() => Promise.resolve().then(() => require("./NoPermissionsPage-y_r7DVA2.js")).then((mod) => ({ default: mod.NoPermissions }))
|
1344
1362
|
);
|
1345
1363
|
const NoContentType = React.lazy(
|
1346
|
-
() => Promise.resolve().then(() => require("./NoContentTypePage-
|
1364
|
+
() => Promise.resolve().then(() => require("./NoContentTypePage-C8OpoHeU.js")).then((mod) => ({ default: mod.NoContentType }))
|
1347
1365
|
);
|
1348
1366
|
const CollectionTypePages = () => {
|
1349
1367
|
const { collectionType } = reactRouterDom.useParams();
|
@@ -1463,6 +1481,8 @@ const DocumentActionButton = (action) => {
|
|
1463
1481
|
onClick: handleClick(action),
|
1464
1482
|
justifyContent: "center",
|
1465
1483
|
variant: action.variant || "default",
|
1484
|
+
paddingTop: "7px",
|
1485
|
+
paddingBottom: "7px",
|
1466
1486
|
children: action.label
|
1467
1487
|
}
|
1468
1488
|
),
|
@@ -1522,7 +1542,7 @@ const DocumentActionsMenu = ({
|
|
1522
1542
|
};
|
1523
1543
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { open: isOpen, onOpenChange: setIsOpen, children: [
|
1524
1544
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
1525
|
-
|
1545
|
+
StyledMoreButton,
|
1526
1546
|
{
|
1527
1547
|
disabled: isDisabled,
|
1528
1548
|
size: "S",
|
@@ -1556,7 +1576,14 @@ const DocumentActionsMenu = ({
|
|
1556
1576
|
gap: 2,
|
1557
1577
|
tag: "span",
|
1558
1578
|
children: [
|
1559
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
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
|
+
),
|
1560
1587
|
action.label
|
1561
1588
|
]
|
1562
1589
|
}
|
@@ -1619,6 +1646,23 @@ const convertActionVariantToColor = (variant = "secondary") => {
|
|
1619
1646
|
return "primary600";
|
1620
1647
|
}
|
1621
1648
|
};
|
1649
|
+
const convertActionVariantToIconColor = (variant = "secondary") => {
|
1650
|
+
switch (variant) {
|
1651
|
+
case "danger":
|
1652
|
+
return "danger600";
|
1653
|
+
case "secondary":
|
1654
|
+
return "neutral500";
|
1655
|
+
case "success":
|
1656
|
+
return "success600";
|
1657
|
+
default:
|
1658
|
+
return "primary600";
|
1659
|
+
}
|
1660
|
+
};
|
1661
|
+
const StyledMoreButton = styledComponents.styled(designSystem.Menu.Trigger)`
|
1662
|
+
& > span {
|
1663
|
+
display: flex;
|
1664
|
+
}
|
1665
|
+
`;
|
1622
1666
|
const DocumentActionConfirmDialog = ({
|
1623
1667
|
onClose,
|
1624
1668
|
onCancel,
|
@@ -1688,12 +1732,10 @@ const PublishAction$1 = ({
|
|
1688
1732
|
const navigate = reactRouterDom.useNavigate();
|
1689
1733
|
const { toggleNotification } = strapiAdmin.useNotification();
|
1690
1734
|
const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
|
1735
|
+
const isListView = reactRouterDom.useMatch(LIST_PATH) !== null;
|
1691
1736
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
1692
1737
|
const { formatMessage } = reactIntl.useIntl();
|
1693
|
-
const { canPublish
|
1694
|
-
"PublishAction",
|
1695
|
-
({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
|
1696
|
-
);
|
1738
|
+
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
1697
1739
|
const { publish } = useDocumentActions();
|
1698
1740
|
const [
|
1699
1741
|
countDraftRelations,
|
@@ -1745,7 +1787,7 @@ const PublishAction$1 = ({
|
|
1745
1787
|
}
|
1746
1788
|
}, [documentId, modified, formValues, setLocalCountOfDraftRelations]);
|
1747
1789
|
React__namespace.useEffect(() => {
|
1748
|
-
if (documentId) {
|
1790
|
+
if (documentId && !isListView) {
|
1749
1791
|
const fetchDraftRelationsCount = async () => {
|
1750
1792
|
const { data, error } = await countDraftRelations({
|
1751
1793
|
collectionType,
|
@@ -1762,7 +1804,7 @@ const PublishAction$1 = ({
|
|
1762
1804
|
};
|
1763
1805
|
fetchDraftRelationsCount();
|
1764
1806
|
}
|
1765
|
-
}, [documentId, countDraftRelations, collectionType, model, params]);
|
1807
|
+
}, [isListView, documentId, countDraftRelations, collectionType, model, params]);
|
1766
1808
|
const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
|
1767
1809
|
if (!schema?.options?.draftAndPublish) {
|
1768
1810
|
return null;
|
@@ -1861,10 +1903,6 @@ const UpdateAction = ({
|
|
1861
1903
|
const cloneMatch = reactRouterDom.useMatch(CLONE_PATH);
|
1862
1904
|
const isCloning = cloneMatch !== null;
|
1863
1905
|
const { formatMessage } = reactIntl.useIntl();
|
1864
|
-
useDocumentRBAC("UpdateAction", ({ canCreate: canCreate2, canUpdate: canUpdate2 }) => ({
|
1865
|
-
canCreate: canCreate2,
|
1866
|
-
canUpdate: canUpdate2
|
1867
|
-
}));
|
1868
1906
|
const { create, update, clone } = useDocumentActions();
|
1869
1907
|
const [{ query, rawQuery }] = strapiAdmin.useQueryParams();
|
1870
1908
|
const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
|
@@ -1890,16 +1928,18 @@ const UpdateAction = ({
|
|
1890
1928
|
onClick: async () => {
|
1891
1929
|
setSubmitting(true);
|
1892
1930
|
try {
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1931
|
+
if (activeTab !== "draft") {
|
1932
|
+
const { errors } = await validate();
|
1933
|
+
if (errors) {
|
1934
|
+
toggleNotification({
|
1935
|
+
type: "danger",
|
1936
|
+
message: formatMessage({
|
1937
|
+
id: "content-manager.validation.error",
|
1938
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
1939
|
+
})
|
1940
|
+
});
|
1941
|
+
return;
|
1942
|
+
}
|
1903
1943
|
}
|
1904
1944
|
if (isCloning) {
|
1905
1945
|
const res = await clone(
|
@@ -3183,7 +3223,13 @@ const SelectedEntriesModalContent = ({
|
|
3183
3223
|
);
|
3184
3224
|
const { rows, validationErrors } = React__namespace.useMemo(() => {
|
3185
3225
|
if (data.length > 0 && schema) {
|
3186
|
-
const validate = createYupSchema(
|
3226
|
+
const validate = createYupSchema(
|
3227
|
+
schema.attributes,
|
3228
|
+
components,
|
3229
|
+
// Since this is the "Publish" action, the validation
|
3230
|
+
// schema must enforce the rules for published entities
|
3231
|
+
{ status: "published" }
|
3232
|
+
);
|
3187
3233
|
const validationErrors2 = {};
|
3188
3234
|
const rows2 = data.map((entry) => {
|
3189
3235
|
try {
|
@@ -3533,7 +3579,7 @@ const TableActions = ({ document }) => {
|
|
3533
3579
|
strapiAdmin.DescriptionComponentRenderer,
|
3534
3580
|
{
|
3535
3581
|
props,
|
3536
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3582
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3537
3583
|
children: (actions2) => {
|
3538
3584
|
const tableRowActions = actions2.filter((action) => {
|
3539
3585
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3644,7 +3690,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3644
3690
|
}),
|
3645
3691
|
content: /* @__PURE__ */ jsxRuntime.jsx(AutoCloneFailureModalBody, { prohibitedFields }),
|
3646
3692
|
footer: ({ onClose }) => {
|
3647
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
3693
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
|
3648
3694
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onClose, variant: "tertiary", children: formatMessage({
|
3649
3695
|
id: "cancel",
|
3650
3696
|
defaultMessage: "Cancel"
|
@@ -3875,7 +3921,7 @@ const index = {
|
|
3875
3921
|
app.router.addRoute({
|
3876
3922
|
path: "content-manager/*",
|
3877
3923
|
lazy: async () => {
|
3878
|
-
const { Layout } = await Promise.resolve().then(() => require("./layout-
|
3924
|
+
const { Layout } = await Promise.resolve().then(() => require("./layout-C788OmNr.js"));
|
3879
3925
|
return {
|
3880
3926
|
Component: Layout
|
3881
3927
|
};
|
@@ -3910,6 +3956,7 @@ const index = {
|
|
3910
3956
|
};
|
3911
3957
|
exports.ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD = ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD;
|
3912
3958
|
exports.BulkActionsRenderer = BulkActionsRenderer;
|
3959
|
+
exports.CLONE_PATH = CLONE_PATH;
|
3913
3960
|
exports.COLLECTION_TYPES = COLLECTION_TYPES;
|
3914
3961
|
exports.CREATOR_FIELDS = CREATOR_FIELDS;
|
3915
3962
|
exports.DEFAULT_SETTINGS = DEFAULT_SETTINGS;
|
@@ -3949,4 +3996,4 @@ exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
|
|
3949
3996
|
exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
|
3950
3997
|
exports.useGetInitialDataQuery = useGetInitialDataQuery;
|
3951
3998
|
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
|
3952
|
-
//# sourceMappingURL=index-
|
3999
|
+
//# sourceMappingURL=index-C3fJE-1-.js.map
|