@strapi/content-manager 5.0.0-rc.7 → 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-BNxtMIfV.js → ComponentConfigurationPage-BOKmq7mz.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-BNxtMIfV.js.map → ComponentConfigurationPage-BOKmq7mz.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-BWOQWCv2.mjs → ComponentConfigurationPage-BwnO0su2.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-BWOQWCv2.mjs.map → ComponentConfigurationPage-BwnO0su2.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-GTp-Ucnw.mjs → EditConfigurationPage-DJDSIf3D.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-GTp-Ucnw.mjs.map → EditConfigurationPage-DJDSIf3D.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-D340bYlT.js → EditConfigurationPage-N3OaN53v.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-D340bYlT.js.map → EditConfigurationPage-N3OaN53v.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-BVMS5hT-.mjs → EditViewPage-IZbGSeL3.mjs} +19 -8
- package/dist/_chunks/EditViewPage-IZbGSeL3.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-CXkmnAvI.js → EditViewPage-l9qOdDUI.js} +19 -8
- package/dist/_chunks/EditViewPage-l9qOdDUI.js.map +1 -0
- package/dist/_chunks/{Field-Ibi32diw.js → Field-CWjyW47-.js} +89 -30
- package/dist/_chunks/Field-CWjyW47-.js.map +1 -0
- package/dist/_chunks/{Field-nNgv5bpd.mjs → Field-D3mNj-iY.mjs} +90 -31
- package/dist/_chunks/Field-D3mNj-iY.mjs.map +1 -0
- package/dist/_chunks/{Form-Dhnh34ym.js → Form-DFXXFrJV.js} +22 -11
- package/dist/_chunks/Form-DFXXFrJV.js.map +1 -0
- package/dist/_chunks/{Form-DodJsI2A.mjs → Form-Ddy3XYS-.mjs} +22 -11
- package/dist/_chunks/Form-Ddy3XYS-.mjs.map +1 -0
- package/dist/_chunks/{History-CKCSQXz_.mjs → History-BEFrLZfz.mjs} +4 -4
- package/dist/_chunks/{History-CKCSQXz_.mjs.map → History-BEFrLZfz.mjs.map} +1 -1
- package/dist/_chunks/{History-C9auUkDi.js → History-pesEeFFT.js} +4 -4
- package/dist/_chunks/{History-C9auUkDi.js.map → History-pesEeFFT.js.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-Bg4rWUjX.js → ListConfigurationPage-BIoi-Sog.js} +14 -4
- package/dist/_chunks/ListConfigurationPage-BIoi-Sog.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-CKEC4ttG.mjs → ListConfigurationPage-CB_lBFVX.mjs} +14 -4
- package/dist/_chunks/ListConfigurationPage-CB_lBFVX.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-C2gIeYHG.js → ListViewPage-C6FK36UI.js} +3 -3
- package/dist/_chunks/{ListViewPage-C2gIeYHG.js.map → ListViewPage-C6FK36UI.js.map} +1 -1
- package/dist/_chunks/{ListViewPage-B7_WJUjG.mjs → ListViewPage-DBbH7Esr.mjs} +3 -3
- package/dist/_chunks/{ListViewPage-B7_WJUjG.mjs.map → ListViewPage-DBbH7Esr.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-Ckem6Ll6.mjs → NoContentTypePage-BU9Omzp4.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-Ckem6Ll6.mjs.map → NoContentTypePage-BU9Omzp4.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-DqgdUfyn.js → NoContentTypePage-Dod8M_xM.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-DqgdUfyn.js.map → NoContentTypePage-Dod8M_xM.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-BO-GEjA4.mjs → NoPermissionsPage-B88W05rh.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-BO-GEjA4.mjs.map → NoPermissionsPage-B88W05rh.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CF29Q-sW.js → NoPermissionsPage-CMLH3uMk.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CF29Q-sW.js.map → NoPermissionsPage-CMLH3uMk.js.map} +1 -1
- package/dist/_chunks/{Relations-DItV5eow.mjs → Relations-BBJRxopY.mjs} +4 -4
- package/dist/_chunks/{Relations-DItV5eow.mjs.map → Relations-BBJRxopY.mjs.map} +1 -1
- package/dist/_chunks/{Relations-C0uC9J4f.js → Relations-OXbsEvNt.js} +4 -4
- package/dist/_chunks/{Relations-C0uC9J4f.js.map → Relations-OXbsEvNt.js.map} +1 -1
- package/dist/_chunks/{index-DrNe6ctw.mjs → index-BgiNQ7Q9.mjs} +93 -37
- package/dist/_chunks/index-BgiNQ7Q9.mjs.map +1 -0
- package/dist/_chunks/{index-Dd0nXyJF.js → index-Bj8wwbdx.js} +92 -36
- package/dist/_chunks/index-Bj8wwbdx.js.map +1 -0
- package/dist/_chunks/{layout-CLLtt_5O.js → layout-DBvOIgWG.js} +6 -6
- package/dist/_chunks/layout-DBvOIgWG.js.map +1 -0
- package/dist/_chunks/{layout-B3ez7kvr.mjs → layout-LOFMsdWo.mjs} +6 -6
- package/dist/_chunks/layout-LOFMsdWo.mjs.map +1 -0
- package/dist/_chunks/{relations-bRxcNv1q.js → relations-BLilXMyN.js} +2 -2
- package/dist/_chunks/{relations-bRxcNv1q.js.map → relations-BLilXMyN.js.map} +1 -1
- package/dist/_chunks/{relations-B0hlsUU_.mjs → relations-BTQKCDqX.mjs} +2 -2
- package/dist/_chunks/{relations-B0hlsUU_.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-BVMS5hT-.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-CXkmnAvI.js.map +0 -1
- package/dist/_chunks/Field-Ibi32diw.js.map +0 -1
- package/dist/_chunks/Field-nNgv5bpd.mjs.map +0 -1
- package/dist/_chunks/Form-Dhnh34ym.js.map +0 -1
- package/dist/_chunks/Form-DodJsI2A.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-Bg4rWUjX.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-CKEC4ttG.mjs.map +0 -1
- package/dist/_chunks/index-Dd0nXyJF.js.map +0 -1
- package/dist/_chunks/index-DrNe6ctw.mjs.map +0 -1
- package/dist/_chunks/layout-B3ez7kvr.mjs.map +0 -1
- package/dist/_chunks/layout-CLLtt_5O.js.map +0 -1
@@ -3,7 +3,7 @@ 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
8
|
import { useParams, Navigate, useNavigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
|
9
9
|
import { styled } from "styled-components";
|
@@ -303,6 +303,11 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
303
303
|
{
|
304
304
|
type: "Document",
|
305
305
|
id: collectionType !== SINGLE_TYPES ? `${model}_${result && "documentId" in result ? result.documentId : documentId}` : model
|
306
|
+
},
|
307
|
+
// Make it easy to invalidate all individual documents queries for a model
|
308
|
+
{
|
309
|
+
type: "Document",
|
310
|
+
id: `${model}_ALL_ITEMS`
|
306
311
|
}
|
307
312
|
];
|
308
313
|
}
|
@@ -449,7 +454,7 @@ const buildValidParams = (query) => {
|
|
449
454
|
const isBaseQueryError = (error) => {
|
450
455
|
return error.name !== void 0;
|
451
456
|
};
|
452
|
-
const createYupSchema = (attributes = {}, components = {}) => {
|
457
|
+
const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
|
453
458
|
const createModelSchema = (attributes2) => yup.object().shape(
|
454
459
|
Object.entries(attributes2).reduce((acc, [name, attribute]) => {
|
455
460
|
if (DOCUMENT_META_FIELDS.includes(name)) {
|
@@ -462,7 +467,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
|
|
462
467
|
addMinValidation,
|
463
468
|
addMaxValidation,
|
464
469
|
addRegexValidation
|
465
|
-
].map((fn) => fn(attribute));
|
470
|
+
].map((fn) => fn(attribute, options));
|
466
471
|
const transformSchema = pipe(...validations);
|
467
472
|
switch (attribute.type) {
|
468
473
|
case "component": {
|
@@ -563,6 +568,14 @@ const createAttributeSchema = (attribute) => {
|
|
563
568
|
if (!value || typeof value === "string" && value.length === 0) {
|
564
569
|
return true;
|
565
570
|
}
|
571
|
+
if (typeof value === "object") {
|
572
|
+
try {
|
573
|
+
JSON.stringify(value);
|
574
|
+
return true;
|
575
|
+
} catch (err) {
|
576
|
+
return false;
|
577
|
+
}
|
578
|
+
}
|
566
579
|
try {
|
567
580
|
JSON.parse(value);
|
568
581
|
return true;
|
@@ -581,13 +594,7 @@ const createAttributeSchema = (attribute) => {
|
|
581
594
|
return yup.mixed();
|
582
595
|
}
|
583
596
|
};
|
584
|
-
const
|
585
|
-
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
586
|
-
return schema.min(1, translatedErrors.required);
|
587
|
-
}
|
588
|
-
if (attribute.required && attribute.type !== "relation") {
|
589
|
-
return schema.required(translatedErrors.required);
|
590
|
-
}
|
597
|
+
const nullableSchema = (schema) => {
|
591
598
|
return schema?.nullable ? schema.nullable() : (
|
592
599
|
// In some cases '.nullable' will not be available on the schema.
|
593
600
|
// e.g. when the schema has been built using yup.lazy (e.g. for relations).
|
@@ -595,7 +602,22 @@ const addRequiredValidation = (attribute) => (schema) => {
|
|
595
602
|
schema
|
596
603
|
);
|
597
604
|
};
|
598
|
-
const
|
605
|
+
const addRequiredValidation = (attribute, options) => (schema) => {
|
606
|
+
if (options.status === "draft") {
|
607
|
+
return nullableSchema(schema);
|
608
|
+
}
|
609
|
+
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
610
|
+
return schema.min(1, translatedErrors.required);
|
611
|
+
}
|
612
|
+
if (attribute.required && attribute.type !== "relation") {
|
613
|
+
return schema.required(translatedErrors.required);
|
614
|
+
}
|
615
|
+
return nullableSchema(schema);
|
616
|
+
};
|
617
|
+
const addMinLengthValidation = (attribute, options) => (schema) => {
|
618
|
+
if (options.status === "draft") {
|
619
|
+
return schema;
|
620
|
+
}
|
599
621
|
if ("minLength" in attribute && attribute.minLength && Number.isInteger(attribute.minLength) && "min" in schema) {
|
600
622
|
return schema.min(attribute.minLength, {
|
601
623
|
...translatedErrors.minLength,
|
@@ -617,11 +639,11 @@ const addMaxLengthValidation = (attribute) => (schema) => {
|
|
617
639
|
}
|
618
640
|
return schema;
|
619
641
|
};
|
620
|
-
const addMinValidation = (attribute) => (schema) => {
|
642
|
+
const addMinValidation = (attribute, options) => (schema) => {
|
621
643
|
if ("min" in attribute) {
|
622
644
|
const min = toInteger(attribute.min);
|
623
645
|
if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
|
624
|
-
if (!attribute.required && "test" in schema && min) {
|
646
|
+
if (options.status !== "draft" && !attribute.required && "test" in schema && min) {
|
625
647
|
return schema.test(
|
626
648
|
"custom-min",
|
627
649
|
{
|
@@ -1272,7 +1294,7 @@ const useDocumentActions = () => {
|
|
1272
1294
|
};
|
1273
1295
|
};
|
1274
1296
|
const ProtectedHistoryPage = lazy(
|
1275
|
-
() => import("./History-
|
1297
|
+
() => import("./History-BEFrLZfz.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1276
1298
|
);
|
1277
1299
|
const routes$1 = [
|
1278
1300
|
{
|
@@ -1285,31 +1307,31 @@ const routes$1 = [
|
|
1285
1307
|
}
|
1286
1308
|
];
|
1287
1309
|
const ProtectedEditViewPage = lazy(
|
1288
|
-
() => import("./EditViewPage-
|
1310
|
+
() => import("./EditViewPage-IZbGSeL3.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1289
1311
|
);
|
1290
1312
|
const ProtectedListViewPage = lazy(
|
1291
|
-
() => import("./ListViewPage-
|
1313
|
+
() => import("./ListViewPage-DBbH7Esr.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1292
1314
|
);
|
1293
1315
|
const ProtectedListConfiguration = lazy(
|
1294
|
-
() => import("./ListConfigurationPage-
|
1316
|
+
() => import("./ListConfigurationPage-CB_lBFVX.mjs").then((mod) => ({
|
1295
1317
|
default: mod.ProtectedListConfiguration
|
1296
1318
|
}))
|
1297
1319
|
);
|
1298
1320
|
const ProtectedEditConfigurationPage = lazy(
|
1299
|
-
() => import("./EditConfigurationPage-
|
1321
|
+
() => import("./EditConfigurationPage-DJDSIf3D.mjs").then((mod) => ({
|
1300
1322
|
default: mod.ProtectedEditConfigurationPage
|
1301
1323
|
}))
|
1302
1324
|
);
|
1303
1325
|
const ProtectedComponentConfigurationPage = lazy(
|
1304
|
-
() => import("./ComponentConfigurationPage-
|
1326
|
+
() => import("./ComponentConfigurationPage-BwnO0su2.mjs").then((mod) => ({
|
1305
1327
|
default: mod.ProtectedComponentConfigurationPage
|
1306
1328
|
}))
|
1307
1329
|
);
|
1308
1330
|
const NoPermissions = lazy(
|
1309
|
-
() => import("./NoPermissionsPage-
|
1331
|
+
() => import("./NoPermissionsPage-B88W05rh.mjs").then((mod) => ({ default: mod.NoPermissions }))
|
1310
1332
|
);
|
1311
1333
|
const NoContentType = lazy(
|
1312
|
-
() => import("./NoContentTypePage-
|
1334
|
+
() => import("./NoContentTypePage-BU9Omzp4.mjs").then((mod) => ({ default: mod.NoContentType }))
|
1313
1335
|
);
|
1314
1336
|
const CollectionTypePages = () => {
|
1315
1337
|
const { collectionType } = useParams();
|
@@ -1423,12 +1445,14 @@ const DocumentActionButton = (action) => {
|
|
1423
1445
|
/* @__PURE__ */ jsx(
|
1424
1446
|
Button,
|
1425
1447
|
{
|
1426
|
-
flex:
|
1448
|
+
flex: "auto",
|
1427
1449
|
startIcon: action.icon,
|
1428
1450
|
disabled: action.disabled,
|
1429
1451
|
onClick: handleClick(action),
|
1430
1452
|
justifyContent: "center",
|
1431
1453
|
variant: action.variant || "default",
|
1454
|
+
paddingTop: "7px",
|
1455
|
+
paddingBottom: "7px",
|
1432
1456
|
children: action.label
|
1433
1457
|
}
|
1434
1458
|
),
|
@@ -1488,7 +1512,7 @@ const DocumentActionsMenu = ({
|
|
1488
1512
|
};
|
1489
1513
|
return /* @__PURE__ */ jsxs(Menu.Root, { open: isOpen, onOpenChange: setIsOpen, children: [
|
1490
1514
|
/* @__PURE__ */ jsxs(
|
1491
|
-
|
1515
|
+
StyledMoreButton,
|
1492
1516
|
{
|
1493
1517
|
disabled: isDisabled,
|
1494
1518
|
size: "S",
|
@@ -1522,7 +1546,14 @@ const DocumentActionsMenu = ({
|
|
1522
1546
|
gap: 2,
|
1523
1547
|
tag: "span",
|
1524
1548
|
children: [
|
1525
|
-
/* @__PURE__ */ jsx(
|
1549
|
+
/* @__PURE__ */ jsx(
|
1550
|
+
Flex,
|
1551
|
+
{
|
1552
|
+
tag: "span",
|
1553
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1554
|
+
children: action.icon
|
1555
|
+
}
|
1556
|
+
),
|
1526
1557
|
action.label
|
1527
1558
|
]
|
1528
1559
|
}
|
@@ -1585,6 +1616,23 @@ const convertActionVariantToColor = (variant = "secondary") => {
|
|
1585
1616
|
return "primary600";
|
1586
1617
|
}
|
1587
1618
|
};
|
1619
|
+
const convertActionVariantToIconColor = (variant = "secondary") => {
|
1620
|
+
switch (variant) {
|
1621
|
+
case "danger":
|
1622
|
+
return "danger600";
|
1623
|
+
case "secondary":
|
1624
|
+
return "neutral500";
|
1625
|
+
case "success":
|
1626
|
+
return "success600";
|
1627
|
+
default:
|
1628
|
+
return "primary600";
|
1629
|
+
}
|
1630
|
+
};
|
1631
|
+
const StyledMoreButton = styled(Menu.Trigger)`
|
1632
|
+
& > span {
|
1633
|
+
display: flex;
|
1634
|
+
}
|
1635
|
+
`;
|
1588
1636
|
const DocumentActionConfirmDialog = ({
|
1589
1637
|
onClose,
|
1590
1638
|
onCancel,
|
@@ -1856,16 +1904,18 @@ const UpdateAction = ({
|
|
1856
1904
|
onClick: async () => {
|
1857
1905
|
setSubmitting(true);
|
1858
1906
|
try {
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1907
|
+
if (activeTab !== "draft") {
|
1908
|
+
const { errors } = await validate();
|
1909
|
+
if (errors) {
|
1910
|
+
toggleNotification({
|
1911
|
+
type: "danger",
|
1912
|
+
message: formatMessage({
|
1913
|
+
id: "content-manager.validation.error",
|
1914
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
1915
|
+
})
|
1916
|
+
});
|
1917
|
+
return;
|
1918
|
+
}
|
1869
1919
|
}
|
1870
1920
|
if (isCloning) {
|
1871
1921
|
const res = await clone(
|
@@ -3149,7 +3199,13 @@ const SelectedEntriesModalContent = ({
|
|
3149
3199
|
);
|
3150
3200
|
const { rows, validationErrors } = React.useMemo(() => {
|
3151
3201
|
if (data.length > 0 && schema) {
|
3152
|
-
const validate = createYupSchema(
|
3202
|
+
const validate = createYupSchema(
|
3203
|
+
schema.attributes,
|
3204
|
+
components,
|
3205
|
+
// Since this is the "Publish" action, the validation
|
3206
|
+
// schema must enforce the rules for published entities
|
3207
|
+
{ status: "published" }
|
3208
|
+
);
|
3153
3209
|
const validationErrors2 = {};
|
3154
3210
|
const rows2 = data.map((entry) => {
|
3155
3211
|
try {
|
@@ -3841,7 +3897,7 @@ const index = {
|
|
3841
3897
|
app.router.addRoute({
|
3842
3898
|
path: "content-manager/*",
|
3843
3899
|
lazy: async () => {
|
3844
|
-
const { Layout } = await import("./layout-
|
3900
|
+
const { Layout } = await import("./layout-LOFMsdWo.mjs");
|
3845
3901
|
return {
|
3846
3902
|
Component: Layout
|
3847
3903
|
};
|
@@ -3917,4 +3973,4 @@ export {
|
|
3917
3973
|
useUpdateContentTypeConfigurationMutation as y,
|
3918
3974
|
extractContentTypeComponents as z
|
3919
3975
|
};
|
3920
|
-
//# sourceMappingURL=index-
|
3976
|
+
//# sourceMappingURL=index-BgiNQ7Q9.mjs.map
|