@strapi/content-manager 5.0.0-rc.8 → 5.0.0-rc.9
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-BOKmq7mz.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-DL1MHO8i.js.map → ComponentConfigurationPage-BOKmq7mz.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-D0dyDTwq.mjs → ComponentConfigurationPage-BwnO0su2.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-D0dyDTwq.mjs.map → ComponentConfigurationPage-BwnO0su2.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-13b7S5Cq.mjs → EditConfigurationPage-DJDSIf3D.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-13b7S5Cq.mjs.map → EditConfigurationPage-DJDSIf3D.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CMaOf-A-.js → EditConfigurationPage-N3OaN53v.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CMaOf-A-.js.map → EditConfigurationPage-N3OaN53v.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-C3tIZ8F5.mjs → EditViewPage-IZbGSeL3.mjs} +19 -8
- package/dist/_chunks/EditViewPage-IZbGSeL3.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-BSVmMpRd.js → EditViewPage-l9qOdDUI.js} +19 -8
- package/dist/_chunks/EditViewPage-l9qOdDUI.js.map +1 -0
- package/dist/_chunks/{Field-DUCVth4C.js → Field-CWjyW47-.js} +89 -30
- package/dist/_chunks/Field-CWjyW47-.js.map +1 -0
- package/dist/_chunks/{Field-BvuT8cGL.mjs → Field-D3mNj-iY.mjs} +90 -31
- package/dist/_chunks/Field-D3mNj-iY.mjs.map +1 -0
- package/dist/_chunks/{Form-Cpl4W1ak.js → Form-DFXXFrJV.js} +22 -11
- package/dist/_chunks/Form-DFXXFrJV.js.map +1 -0
- package/dist/_chunks/{Form-BZmDNVr9.mjs → Form-Ddy3XYS-.mjs} +22 -11
- package/dist/_chunks/Form-Ddy3XYS-.mjs.map +1 -0
- package/dist/_chunks/{History-Cq_Hrzuu.mjs → History-BEFrLZfz.mjs} +4 -4
- package/dist/_chunks/{History-Cq_Hrzuu.mjs.map → History-BEFrLZfz.mjs.map} +1 -1
- package/dist/_chunks/{History-D4U2YISB.js → History-pesEeFFT.js} +4 -4
- package/dist/_chunks/{History-D4U2YISB.js.map → History-pesEeFFT.js.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-Bny6CdWe.js → ListConfigurationPage-BIoi-Sog.js} +14 -4
- package/dist/_chunks/ListConfigurationPage-BIoi-Sog.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-W-KQHmBv.mjs → ListConfigurationPage-CB_lBFVX.mjs} +14 -4
- package/dist/_chunks/ListConfigurationPage-CB_lBFVX.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-O8F1pBJo.js → ListViewPage-C6FK36UI.js} +3 -3
- package/dist/_chunks/{ListViewPage-O8F1pBJo.js.map → ListViewPage-C6FK36UI.js.map} +1 -1
- package/dist/_chunks/{ListViewPage-HBBnJa8K.mjs → ListViewPage-DBbH7Esr.mjs} +3 -3
- package/dist/_chunks/{ListViewPage-HBBnJa8K.mjs.map → ListViewPage-DBbH7Esr.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-B-gIhHWM.mjs → NoContentTypePage-BU9Omzp4.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-B-gIhHWM.mjs.map → NoContentTypePage-BU9Omzp4.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-CQWChGPw.js → NoContentTypePage-Dod8M_xM.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-CQWChGPw.js.map → NoContentTypePage-Dod8M_xM.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-XhOPl8wx.mjs → NoPermissionsPage-B88W05rh.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-XhOPl8wx.mjs.map → NoPermissionsPage-B88W05rh.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CY46zxnM.js → NoPermissionsPage-CMLH3uMk.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CY46zxnM.js.map → NoPermissionsPage-CMLH3uMk.js.map} +1 -1
- package/dist/_chunks/{Relations-vFZ6Wasg.mjs → Relations-BBJRxopY.mjs} +4 -4
- package/dist/_chunks/{Relations-vFZ6Wasg.mjs.map → Relations-BBJRxopY.mjs.map} +1 -1
- package/dist/_chunks/{Relations-C4gGfZRv.js → Relations-OXbsEvNt.js} +4 -4
- package/dist/_chunks/{Relations-C4gGfZRv.js.map → Relations-OXbsEvNt.js.map} +1 -1
- package/dist/_chunks/{index-Dpxg3ctD.mjs → index-BgiNQ7Q9.mjs} +79 -36
- package/dist/_chunks/index-BgiNQ7Q9.mjs.map +1 -0
- package/dist/_chunks/{index-5EMXLEM_.js → index-Bj8wwbdx.js} +78 -35
- package/dist/_chunks/index-Bj8wwbdx.js.map +1 -0
- package/dist/_chunks/{layout-P3eKO1Qy.js → layout-DBvOIgWG.js} +6 -6
- package/dist/_chunks/layout-DBvOIgWG.js.map +1 -0
- package/dist/_chunks/{layout-C0INpKap.mjs → layout-LOFMsdWo.mjs} +6 -6
- package/dist/_chunks/layout-LOFMsdWo.mjs.map +1 -0
- package/dist/_chunks/{relations-B1y0K6LE.js → relations-BLilXMyN.js} +2 -2
- package/dist/_chunks/{relations-B1y0K6LE.js.map → relations-BLilXMyN.js.map} +1 -1
- package/dist/_chunks/{relations-FBRRBWeO.mjs → relations-BTQKCDqX.mjs} +2 -2
- package/dist/_chunks/{relations-FBRRBWeO.mjs.map → relations-BTQKCDqX.mjs.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +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/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-BvuT8cGL.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
@@ -475,7 +475,7 @@ const buildValidParams = (query) => {
|
|
475
475
|
const isBaseQueryError = (error) => {
|
476
476
|
return error.name !== void 0;
|
477
477
|
};
|
478
|
-
const createYupSchema = (attributes = {}, components = {}) => {
|
478
|
+
const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
|
479
479
|
const createModelSchema = (attributes2) => yup__namespace.object().shape(
|
480
480
|
Object.entries(attributes2).reduce((acc, [name, attribute]) => {
|
481
481
|
if (DOCUMENT_META_FIELDS.includes(name)) {
|
@@ -488,7 +488,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
|
|
488
488
|
addMinValidation,
|
489
489
|
addMaxValidation,
|
490
490
|
addRegexValidation
|
491
|
-
].map((fn) => fn(attribute));
|
491
|
+
].map((fn) => fn(attribute, options));
|
492
492
|
const transformSchema = pipe__default.default(...validations);
|
493
493
|
switch (attribute.type) {
|
494
494
|
case "component": {
|
@@ -615,13 +615,7 @@ const createAttributeSchema = (attribute) => {
|
|
615
615
|
return yup__namespace.mixed();
|
616
616
|
}
|
617
617
|
};
|
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
|
-
}
|
618
|
+
const nullableSchema = (schema) => {
|
625
619
|
return schema?.nullable ? schema.nullable() : (
|
626
620
|
// In some cases '.nullable' will not be available on the schema.
|
627
621
|
// e.g. when the schema has been built using yup.lazy (e.g. for relations).
|
@@ -629,7 +623,22 @@ const addRequiredValidation = (attribute) => (schema) => {
|
|
629
623
|
schema
|
630
624
|
);
|
631
625
|
};
|
632
|
-
const
|
626
|
+
const addRequiredValidation = (attribute, options) => (schema) => {
|
627
|
+
if (options.status === "draft") {
|
628
|
+
return nullableSchema(schema);
|
629
|
+
}
|
630
|
+
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
631
|
+
return schema.min(1, strapiAdmin.translatedErrors.required);
|
632
|
+
}
|
633
|
+
if (attribute.required && attribute.type !== "relation") {
|
634
|
+
return schema.required(strapiAdmin.translatedErrors.required);
|
635
|
+
}
|
636
|
+
return nullableSchema(schema);
|
637
|
+
};
|
638
|
+
const addMinLengthValidation = (attribute, options) => (schema) => {
|
639
|
+
if (options.status === "draft") {
|
640
|
+
return schema;
|
641
|
+
}
|
633
642
|
if ("minLength" in attribute && attribute.minLength && Number.isInteger(attribute.minLength) && "min" in schema) {
|
634
643
|
return schema.min(attribute.minLength, {
|
635
644
|
...strapiAdmin.translatedErrors.minLength,
|
@@ -651,11 +660,11 @@ const addMaxLengthValidation = (attribute) => (schema) => {
|
|
651
660
|
}
|
652
661
|
return schema;
|
653
662
|
};
|
654
|
-
const addMinValidation = (attribute) => (schema) => {
|
663
|
+
const addMinValidation = (attribute, options) => (schema) => {
|
655
664
|
if ("min" in attribute) {
|
656
665
|
const min = toInteger(attribute.min);
|
657
666
|
if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
|
658
|
-
if (!attribute.required && "test" in schema && min) {
|
667
|
+
if (options.status !== "draft" && !attribute.required && "test" in schema && min) {
|
659
668
|
return schema.test(
|
660
669
|
"custom-min",
|
661
670
|
{
|
@@ -1306,7 +1315,7 @@ const useDocumentActions = () => {
|
|
1306
1315
|
};
|
1307
1316
|
};
|
1308
1317
|
const ProtectedHistoryPage = React.lazy(
|
1309
|
-
() => Promise.resolve().then(() => require("./History-
|
1318
|
+
() => Promise.resolve().then(() => require("./History-pesEeFFT.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1310
1319
|
);
|
1311
1320
|
const routes$1 = [
|
1312
1321
|
{
|
@@ -1319,31 +1328,31 @@ const routes$1 = [
|
|
1319
1328
|
}
|
1320
1329
|
];
|
1321
1330
|
const ProtectedEditViewPage = React.lazy(
|
1322
|
-
() => Promise.resolve().then(() => require("./EditViewPage-
|
1331
|
+
() => Promise.resolve().then(() => require("./EditViewPage-l9qOdDUI.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1323
1332
|
);
|
1324
1333
|
const ProtectedListViewPage = React.lazy(
|
1325
|
-
() => Promise.resolve().then(() => require("./ListViewPage-
|
1334
|
+
() => Promise.resolve().then(() => require("./ListViewPage-C6FK36UI.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1326
1335
|
);
|
1327
1336
|
const ProtectedListConfiguration = React.lazy(
|
1328
|
-
() => Promise.resolve().then(() => require("./ListConfigurationPage-
|
1337
|
+
() => Promise.resolve().then(() => require("./ListConfigurationPage-BIoi-Sog.js")).then((mod) => ({
|
1329
1338
|
default: mod.ProtectedListConfiguration
|
1330
1339
|
}))
|
1331
1340
|
);
|
1332
1341
|
const ProtectedEditConfigurationPage = React.lazy(
|
1333
|
-
() => Promise.resolve().then(() => require("./EditConfigurationPage-
|
1342
|
+
() => Promise.resolve().then(() => require("./EditConfigurationPage-N3OaN53v.js")).then((mod) => ({
|
1334
1343
|
default: mod.ProtectedEditConfigurationPage
|
1335
1344
|
}))
|
1336
1345
|
);
|
1337
1346
|
const ProtectedComponentConfigurationPage = React.lazy(
|
1338
|
-
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-
|
1347
|
+
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-BOKmq7mz.js")).then((mod) => ({
|
1339
1348
|
default: mod.ProtectedComponentConfigurationPage
|
1340
1349
|
}))
|
1341
1350
|
);
|
1342
1351
|
const NoPermissions = React.lazy(
|
1343
|
-
() => Promise.resolve().then(() => require("./NoPermissionsPage-
|
1352
|
+
() => Promise.resolve().then(() => require("./NoPermissionsPage-CMLH3uMk.js")).then((mod) => ({ default: mod.NoPermissions }))
|
1344
1353
|
);
|
1345
1354
|
const NoContentType = React.lazy(
|
1346
|
-
() => Promise.resolve().then(() => require("./NoContentTypePage-
|
1355
|
+
() => Promise.resolve().then(() => require("./NoContentTypePage-Dod8M_xM.js")).then((mod) => ({ default: mod.NoContentType }))
|
1347
1356
|
);
|
1348
1357
|
const CollectionTypePages = () => {
|
1349
1358
|
const { collectionType } = reactRouterDom.useParams();
|
@@ -1463,6 +1472,8 @@ const DocumentActionButton = (action) => {
|
|
1463
1472
|
onClick: handleClick(action),
|
1464
1473
|
justifyContent: "center",
|
1465
1474
|
variant: action.variant || "default",
|
1475
|
+
paddingTop: "7px",
|
1476
|
+
paddingBottom: "7px",
|
1466
1477
|
children: action.label
|
1467
1478
|
}
|
1468
1479
|
),
|
@@ -1522,7 +1533,7 @@ const DocumentActionsMenu = ({
|
|
1522
1533
|
};
|
1523
1534
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { open: isOpen, onOpenChange: setIsOpen, children: [
|
1524
1535
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
1525
|
-
|
1536
|
+
StyledMoreButton,
|
1526
1537
|
{
|
1527
1538
|
disabled: isDisabled,
|
1528
1539
|
size: "S",
|
@@ -1556,7 +1567,14 @@ const DocumentActionsMenu = ({
|
|
1556
1567
|
gap: 2,
|
1557
1568
|
tag: "span",
|
1558
1569
|
children: [
|
1559
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
1570
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
1571
|
+
designSystem.Flex,
|
1572
|
+
{
|
1573
|
+
tag: "span",
|
1574
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1575
|
+
children: action.icon
|
1576
|
+
}
|
1577
|
+
),
|
1560
1578
|
action.label
|
1561
1579
|
]
|
1562
1580
|
}
|
@@ -1619,6 +1637,23 @@ const convertActionVariantToColor = (variant = "secondary") => {
|
|
1619
1637
|
return "primary600";
|
1620
1638
|
}
|
1621
1639
|
};
|
1640
|
+
const convertActionVariantToIconColor = (variant = "secondary") => {
|
1641
|
+
switch (variant) {
|
1642
|
+
case "danger":
|
1643
|
+
return "danger600";
|
1644
|
+
case "secondary":
|
1645
|
+
return "neutral500";
|
1646
|
+
case "success":
|
1647
|
+
return "success600";
|
1648
|
+
default:
|
1649
|
+
return "primary600";
|
1650
|
+
}
|
1651
|
+
};
|
1652
|
+
const StyledMoreButton = styledComponents.styled(designSystem.Menu.Trigger)`
|
1653
|
+
& > span {
|
1654
|
+
display: flex;
|
1655
|
+
}
|
1656
|
+
`;
|
1622
1657
|
const DocumentActionConfirmDialog = ({
|
1623
1658
|
onClose,
|
1624
1659
|
onCancel,
|
@@ -1890,16 +1925,18 @@ const UpdateAction = ({
|
|
1890
1925
|
onClick: async () => {
|
1891
1926
|
setSubmitting(true);
|
1892
1927
|
try {
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1928
|
+
if (activeTab !== "draft") {
|
1929
|
+
const { errors } = await validate();
|
1930
|
+
if (errors) {
|
1931
|
+
toggleNotification({
|
1932
|
+
type: "danger",
|
1933
|
+
message: formatMessage({
|
1934
|
+
id: "content-manager.validation.error",
|
1935
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
1936
|
+
})
|
1937
|
+
});
|
1938
|
+
return;
|
1939
|
+
}
|
1903
1940
|
}
|
1904
1941
|
if (isCloning) {
|
1905
1942
|
const res = await clone(
|
@@ -3183,7 +3220,13 @@ const SelectedEntriesModalContent = ({
|
|
3183
3220
|
);
|
3184
3221
|
const { rows, validationErrors } = React__namespace.useMemo(() => {
|
3185
3222
|
if (data.length > 0 && schema) {
|
3186
|
-
const validate = createYupSchema(
|
3223
|
+
const validate = createYupSchema(
|
3224
|
+
schema.attributes,
|
3225
|
+
components,
|
3226
|
+
// Since this is the "Publish" action, the validation
|
3227
|
+
// schema must enforce the rules for published entities
|
3228
|
+
{ status: "published" }
|
3229
|
+
);
|
3187
3230
|
const validationErrors2 = {};
|
3188
3231
|
const rows2 = data.map((entry) => {
|
3189
3232
|
try {
|
@@ -3875,7 +3918,7 @@ const index = {
|
|
3875
3918
|
app.router.addRoute({
|
3876
3919
|
path: "content-manager/*",
|
3877
3920
|
lazy: async () => {
|
3878
|
-
const { Layout } = await Promise.resolve().then(() => require("./layout-
|
3921
|
+
const { Layout } = await Promise.resolve().then(() => require("./layout-DBvOIgWG.js"));
|
3879
3922
|
return {
|
3880
3923
|
Component: Layout
|
3881
3924
|
};
|
@@ -3949,4 +3992,4 @@ exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
|
|
3949
3992
|
exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
|
3950
3993
|
exports.useGetInitialDataQuery = useGetInitialDataQuery;
|
3951
3994
|
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
|
3952
|
-
//# sourceMappingURL=index-
|
3995
|
+
//# sourceMappingURL=index-Bj8wwbdx.js.map
|