@strapi/content-manager 5.0.0-rc.29 → 5.0.0-rc.30
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-Q3MBki6o.mjs → ComponentConfigurationPage-DfFSZQxe.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-Q3MBki6o.mjs.map → ComponentConfigurationPage-DfFSZQxe.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DA2b7951.js → ComponentConfigurationPage-FqfsxQ1j.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-DA2b7951.js.map → ComponentConfigurationPage-FqfsxQ1j.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-DcTgCayV.js → EditConfigurationPage-Cn0e8t3I.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-DcTgCayV.js.map → EditConfigurationPage-Cn0e8t3I.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-DtC0dCd4.mjs → EditConfigurationPage-DdPNAbl3.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-DtC0dCd4.mjs.map → EditConfigurationPage-DdPNAbl3.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-BUTIgX0k.mjs → EditViewPage-B82x_x1b.mjs} +10 -4
- package/dist/_chunks/EditViewPage-B82x_x1b.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-CHTPxX7w.js → EditViewPage-DlxEHhUt.js} +10 -4
- package/dist/_chunks/EditViewPage-DlxEHhUt.js.map +1 -0
- package/dist/_chunks/{Field-BACD32AC.js → Field-COL25JiC.js} +34 -6
- package/dist/_chunks/Field-COL25JiC.js.map +1 -0
- package/dist/_chunks/{Field-CHz1D7f2.mjs → Field-DufHXW17.mjs} +34 -6
- package/dist/_chunks/Field-DufHXW17.mjs.map +1 -0
- package/dist/_chunks/{Form-CfZc-7D2.js → Form-BssUwrTO.js} +3 -3
- package/dist/_chunks/Form-BssUwrTO.js.map +1 -0
- package/dist/_chunks/{Form-QYM4wJ96.mjs → Form-u_kAOhwB.mjs} +3 -3
- package/dist/_chunks/Form-u_kAOhwB.mjs.map +1 -0
- package/dist/_chunks/{History-uzOvP0v7.js → History-C9t9UqpO.js} +4 -4
- package/dist/_chunks/{History-uzOvP0v7.js.map → History-C9t9UqpO.js.map} +1 -1
- package/dist/_chunks/{History-DnYsXm6Y.mjs → History-DRwA3oMM.mjs} +4 -4
- package/dist/_chunks/{History-DnYsXm6Y.mjs.map → History-DRwA3oMM.mjs.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-Bt0pWaEe.js → ListConfigurationPage-BXYPohh-.js} +2 -2
- package/dist/_chunks/{ListConfigurationPage-Bt0pWaEe.js.map → ListConfigurationPage-BXYPohh-.js.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-gDyBUhVg.mjs → ListConfigurationPage-BxfQJzPk.mjs} +2 -2
- package/dist/_chunks/{ListConfigurationPage-gDyBUhVg.mjs.map → ListConfigurationPage-BxfQJzPk.mjs.map} +1 -1
- package/dist/_chunks/{ListViewPage-BbIAk2tn.mjs → ListViewPage-CELx2ysp.mjs} +3 -3
- package/dist/_chunks/{ListViewPage-BbIAk2tn.mjs.map → ListViewPage-CELx2ysp.mjs.map} +1 -1
- package/dist/_chunks/{ListViewPage-wFTl4mhg.js → ListViewPage-D2VD8Szg.js} +3 -3
- package/dist/_chunks/{ListViewPage-wFTl4mhg.js.map → ListViewPage-D2VD8Szg.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-C00E-YlW.js → NoContentTypePage-BV9IjJSM.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-C00E-YlW.js.map → NoContentTypePage-BV9IjJSM.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-D1lqRImn.mjs → NoContentTypePage-DtJ9jcfk.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-D1lqRImn.mjs.map → NoContentTypePage-DtJ9jcfk.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-Dw6EuQRg.mjs → NoPermissionsPage-DWleVYK7.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-Dw6EuQRg.mjs.map → NoPermissionsPage-DWleVYK7.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CoPjjrjk.js → NoPermissionsPage-Dp8NpF9I.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CoPjjrjk.js.map → NoPermissionsPage-Dp8NpF9I.js.map} +1 -1
- package/dist/_chunks/{Relations-BIwBQsRs.mjs → Relations-BTcf5xaw.mjs} +3 -3
- package/dist/_chunks/{Relations-BIwBQsRs.mjs.map → Relations-BTcf5xaw.mjs.map} +1 -1
- package/dist/_chunks/{Relations-CcvUrZ05.js → Relations-DR7EUgyC.js} +3 -3
- package/dist/_chunks/{Relations-CcvUrZ05.js.map → Relations-DR7EUgyC.js.map} +1 -1
- package/dist/_chunks/{index-DtUjHZAE.js → index-BdMf2lfT.js} +59 -57
- package/dist/_chunks/index-BdMf2lfT.js.map +1 -0
- package/dist/_chunks/{index-1E1riyM7.mjs → index-wnqzm4Q8.mjs} +59 -57
- package/dist/_chunks/index-wnqzm4Q8.mjs.map +1 -0
- package/dist/_chunks/{layout-Bn9hdVmT.mjs → layout-2CfjL0T9.mjs} +3 -3
- package/dist/_chunks/{layout-Bn9hdVmT.mjs.map → layout-2CfjL0T9.mjs.map} +1 -1
- package/dist/_chunks/{layout-DQUYYv3O.js → layout-B2MyZU-_.js} +3 -3
- package/dist/_chunks/{layout-DQUYYv3O.js.map → layout-B2MyZU-_.js.map} +1 -1
- package/dist/_chunks/{relations-Cg5peQZL.js → relations-BH7JJGGe.js} +2 -2
- package/dist/_chunks/{relations-Cg5peQZL.js.map → relations-BH7JJGGe.js.map} +1 -1
- package/dist/_chunks/{relations-BvUTlaYl.mjs → relations-C0w0GcXi.mjs} +2 -2
- package/dist/_chunks/{relations-BvUTlaYl.mjs.map → relations-C0w0GcXi.mjs.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/package.json +6 -6
- package/dist/_chunks/EditViewPage-BUTIgX0k.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-CHTPxX7w.js.map +0 -1
- package/dist/_chunks/Field-BACD32AC.js.map +0 -1
- package/dist/_chunks/Field-CHz1D7f2.mjs.map +0 -1
- package/dist/_chunks/Form-CfZc-7D2.js.map +0 -1
- package/dist/_chunks/Form-QYM4wJ96.mjs.map +0 -1
- package/dist/_chunks/index-1E1riyM7.mjs.map +0 -1
- package/dist/_chunks/index-DtUjHZAE.js.map +0 -1
@@ -469,6 +469,24 @@ const buildValidParams = (query) => {
|
|
469
469
|
const isBaseQueryError = (error) => {
|
470
470
|
return error.name !== void 0;
|
471
471
|
};
|
472
|
+
const arrayValidator = (attribute, options) => ({
|
473
|
+
message: translatedErrors.required,
|
474
|
+
test(value) {
|
475
|
+
if (options.status === "draft") {
|
476
|
+
return true;
|
477
|
+
}
|
478
|
+
if (!attribute.required) {
|
479
|
+
return true;
|
480
|
+
}
|
481
|
+
if (!value) {
|
482
|
+
return false;
|
483
|
+
}
|
484
|
+
if (Array.isArray(value) && value.length === 0) {
|
485
|
+
return false;
|
486
|
+
}
|
487
|
+
return true;
|
488
|
+
}
|
489
|
+
});
|
472
490
|
const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
|
473
491
|
const createModelSchema = (attributes2) => yup.object().shape(
|
474
492
|
Object.entries(attributes2).reduce((acc, [name, attribute]) => {
|
@@ -476,6 +494,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
476
494
|
return acc;
|
477
495
|
}
|
478
496
|
const validations = [
|
497
|
+
addNullableValidation,
|
479
498
|
addRequiredValidation,
|
480
499
|
addMinLengthValidation,
|
481
500
|
addMaxLengthValidation,
|
@@ -492,12 +511,12 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
492
511
|
...acc,
|
493
512
|
[name]: transformSchema(
|
494
513
|
yup.array().of(createModelSchema(attributes3).nullable(false))
|
495
|
-
)
|
514
|
+
).test(arrayValidator(attribute, options))
|
496
515
|
};
|
497
516
|
} else {
|
498
517
|
return {
|
499
518
|
...acc,
|
500
|
-
[name]: transformSchema(createModelSchema(attributes3))
|
519
|
+
[name]: transformSchema(createModelSchema(attributes3).nullable())
|
501
520
|
};
|
502
521
|
}
|
503
522
|
}
|
@@ -519,7 +538,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
519
538
|
}
|
520
539
|
)
|
521
540
|
)
|
522
|
-
)
|
541
|
+
).test(arrayValidator(attribute, options))
|
523
542
|
};
|
524
543
|
case "relation":
|
525
544
|
return {
|
@@ -617,17 +636,17 @@ const nullableSchema = (schema) => {
|
|
617
636
|
schema
|
618
637
|
);
|
619
638
|
};
|
639
|
+
const addNullableValidation = () => (schema) => {
|
640
|
+
return nullableSchema(schema);
|
641
|
+
};
|
620
642
|
const addRequiredValidation = (attribute, options) => (schema) => {
|
621
|
-
if (options.status === "draft") {
|
622
|
-
return
|
623
|
-
}
|
624
|
-
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
625
|
-
return schema.min(1, translatedErrors.required);
|
643
|
+
if (options.status === "draft" || !attribute.required) {
|
644
|
+
return schema;
|
626
645
|
}
|
627
|
-
if (attribute.required &&
|
646
|
+
if (attribute.required && "required" in schema) {
|
628
647
|
return schema.required(translatedErrors.required);
|
629
648
|
}
|
630
|
-
return
|
649
|
+
return schema;
|
631
650
|
};
|
632
651
|
const addMinLengthValidation = (attribute, options) => (schema) => {
|
633
652
|
if (options.status === "draft") {
|
@@ -655,31 +674,12 @@ const addMaxLengthValidation = (attribute) => (schema) => {
|
|
655
674
|
return schema;
|
656
675
|
};
|
657
676
|
const addMinValidation = (attribute, options) => (schema) => {
|
658
|
-
if ("
|
677
|
+
if (options.status === "draft") {
|
678
|
+
return schema;
|
679
|
+
}
|
680
|
+
if ("min" in attribute && "min" in schema) {
|
659
681
|
const min = toInteger(attribute.min);
|
660
|
-
if (
|
661
|
-
if (options.status !== "draft" && !attribute.required && "test" in schema && min) {
|
662
|
-
return schema.test(
|
663
|
-
"custom-min",
|
664
|
-
{
|
665
|
-
...translatedErrors.min,
|
666
|
-
values: {
|
667
|
-
min: attribute.min
|
668
|
-
}
|
669
|
-
},
|
670
|
-
(value) => {
|
671
|
-
if (!value) {
|
672
|
-
return true;
|
673
|
-
}
|
674
|
-
if (Array.isArray(value) && value.length === 0) {
|
675
|
-
return true;
|
676
|
-
}
|
677
|
-
return value.length >= min;
|
678
|
-
}
|
679
|
-
);
|
680
|
-
}
|
681
|
-
}
|
682
|
-
if ("min" in schema && min) {
|
682
|
+
if (min) {
|
683
683
|
return schema.min(min, {
|
684
684
|
...translatedErrors.min,
|
685
685
|
values: {
|
@@ -1665,7 +1665,7 @@ const useDocumentActions = () => {
|
|
1665
1665
|
};
|
1666
1666
|
};
|
1667
1667
|
const ProtectedHistoryPage = lazy(
|
1668
|
-
() => import("./History-
|
1668
|
+
() => import("./History-DRwA3oMM.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1669
1669
|
);
|
1670
1670
|
const routes$1 = [
|
1671
1671
|
{
|
@@ -1678,31 +1678,31 @@ const routes$1 = [
|
|
1678
1678
|
}
|
1679
1679
|
];
|
1680
1680
|
const ProtectedEditViewPage = lazy(
|
1681
|
-
() => import("./EditViewPage-
|
1681
|
+
() => import("./EditViewPage-B82x_x1b.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1682
1682
|
);
|
1683
1683
|
const ProtectedListViewPage = lazy(
|
1684
|
-
() => import("./ListViewPage-
|
1684
|
+
() => import("./ListViewPage-CELx2ysp.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1685
1685
|
);
|
1686
1686
|
const ProtectedListConfiguration = lazy(
|
1687
|
-
() => import("./ListConfigurationPage-
|
1687
|
+
() => import("./ListConfigurationPage-BxfQJzPk.mjs").then((mod) => ({
|
1688
1688
|
default: mod.ProtectedListConfiguration
|
1689
1689
|
}))
|
1690
1690
|
);
|
1691
1691
|
const ProtectedEditConfigurationPage = lazy(
|
1692
|
-
() => import("./EditConfigurationPage-
|
1692
|
+
() => import("./EditConfigurationPage-DdPNAbl3.mjs").then((mod) => ({
|
1693
1693
|
default: mod.ProtectedEditConfigurationPage
|
1694
1694
|
}))
|
1695
1695
|
);
|
1696
1696
|
const ProtectedComponentConfigurationPage = lazy(
|
1697
|
-
() => import("./ComponentConfigurationPage-
|
1697
|
+
() => import("./ComponentConfigurationPage-DfFSZQxe.mjs").then((mod) => ({
|
1698
1698
|
default: mod.ProtectedComponentConfigurationPage
|
1699
1699
|
}))
|
1700
1700
|
);
|
1701
1701
|
const NoPermissions = lazy(
|
1702
|
-
() => import("./NoPermissionsPage-
|
1702
|
+
() => import("./NoPermissionsPage-DWleVYK7.mjs").then((mod) => ({ default: mod.NoPermissions }))
|
1703
1703
|
);
|
1704
1704
|
const NoContentType = lazy(
|
1705
|
-
() => import("./NoContentTypePage-
|
1705
|
+
() => import("./NoContentTypePage-DtJ9jcfk.mjs").then((mod) => ({ default: mod.NoContentType }))
|
1706
1706
|
);
|
1707
1707
|
const CollectionTypePages = () => {
|
1708
1708
|
const { collectionType } = useParams();
|
@@ -2149,7 +2149,9 @@ const PublishAction$1 = ({
|
|
2149
2149
|
const performPublish = async () => {
|
2150
2150
|
setSubmitting(true);
|
2151
2151
|
try {
|
2152
|
-
const { errors } = await validate(
|
2152
|
+
const { errors } = await validate(true, {
|
2153
|
+
status: "published"
|
2154
|
+
});
|
2153
2155
|
if (errors) {
|
2154
2156
|
toggleNotification({
|
2155
2157
|
type: "danger",
|
@@ -2263,18 +2265,18 @@ const UpdateAction = ({
|
|
2263
2265
|
onClick: async () => {
|
2264
2266
|
setSubmitting(true);
|
2265
2267
|
try {
|
2266
|
-
|
2267
|
-
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
|
2272
|
-
|
2273
|
-
|
2274
|
-
|
2275
|
-
})
|
2276
|
-
|
2277
|
-
|
2268
|
+
const { errors } = await validate(true, {
|
2269
|
+
status: "draft"
|
2270
|
+
});
|
2271
|
+
if (errors) {
|
2272
|
+
toggleNotification({
|
2273
|
+
type: "danger",
|
2274
|
+
message: formatMessage({
|
2275
|
+
id: "content-manager.validation.error",
|
2276
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2277
|
+
})
|
2278
|
+
});
|
2279
|
+
return;
|
2278
2280
|
}
|
2279
2281
|
if (isCloning) {
|
2280
2282
|
const res = await clone(
|
@@ -4007,7 +4009,7 @@ const index = {
|
|
4007
4009
|
app.router.addRoute({
|
4008
4010
|
path: "content-manager/*",
|
4009
4011
|
lazy: async () => {
|
4010
|
-
const { Layout } = await import("./layout-
|
4012
|
+
const { Layout } = await import("./layout-2CfjL0T9.mjs");
|
4011
4013
|
return {
|
4012
4014
|
Component: Layout
|
4013
4015
|
};
|
@@ -4085,4 +4087,4 @@ export {
|
|
4085
4087
|
capitalise as y,
|
4086
4088
|
useUpdateContentTypeConfigurationMutation as z
|
4087
4089
|
};
|
4088
|
-
//# sourceMappingURL=index-
|
4090
|
+
//# sourceMappingURL=index-wnqzm4Q8.mjs.map
|