@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.
Files changed (82) hide show
  1. package/dist/_chunks/{ComponentConfigurationPage-DL1MHO8i.js → ComponentConfigurationPage-BOKmq7mz.js} +3 -3
  2. package/dist/_chunks/{ComponentConfigurationPage-DL1MHO8i.js.map → ComponentConfigurationPage-BOKmq7mz.js.map} +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-D0dyDTwq.mjs → ComponentConfigurationPage-BwnO0su2.mjs} +3 -3
  4. package/dist/_chunks/{ComponentConfigurationPage-D0dyDTwq.mjs.map → ComponentConfigurationPage-BwnO0su2.mjs.map} +1 -1
  5. package/dist/_chunks/{EditConfigurationPage-13b7S5Cq.mjs → EditConfigurationPage-DJDSIf3D.mjs} +3 -3
  6. package/dist/_chunks/{EditConfigurationPage-13b7S5Cq.mjs.map → EditConfigurationPage-DJDSIf3D.mjs.map} +1 -1
  7. package/dist/_chunks/{EditConfigurationPage-CMaOf-A-.js → EditConfigurationPage-N3OaN53v.js} +3 -3
  8. package/dist/_chunks/{EditConfigurationPage-CMaOf-A-.js.map → EditConfigurationPage-N3OaN53v.js.map} +1 -1
  9. package/dist/_chunks/{EditViewPage-C3tIZ8F5.mjs → EditViewPage-IZbGSeL3.mjs} +19 -8
  10. package/dist/_chunks/EditViewPage-IZbGSeL3.mjs.map +1 -0
  11. package/dist/_chunks/{EditViewPage-BSVmMpRd.js → EditViewPage-l9qOdDUI.js} +19 -8
  12. package/dist/_chunks/EditViewPage-l9qOdDUI.js.map +1 -0
  13. package/dist/_chunks/{Field-DUCVth4C.js → Field-CWjyW47-.js} +89 -30
  14. package/dist/_chunks/Field-CWjyW47-.js.map +1 -0
  15. package/dist/_chunks/{Field-BvuT8cGL.mjs → Field-D3mNj-iY.mjs} +90 -31
  16. package/dist/_chunks/Field-D3mNj-iY.mjs.map +1 -0
  17. package/dist/_chunks/{Form-Cpl4W1ak.js → Form-DFXXFrJV.js} +22 -11
  18. package/dist/_chunks/Form-DFXXFrJV.js.map +1 -0
  19. package/dist/_chunks/{Form-BZmDNVr9.mjs → Form-Ddy3XYS-.mjs} +22 -11
  20. package/dist/_chunks/Form-Ddy3XYS-.mjs.map +1 -0
  21. package/dist/_chunks/{History-Cq_Hrzuu.mjs → History-BEFrLZfz.mjs} +4 -4
  22. package/dist/_chunks/{History-Cq_Hrzuu.mjs.map → History-BEFrLZfz.mjs.map} +1 -1
  23. package/dist/_chunks/{History-D4U2YISB.js → History-pesEeFFT.js} +4 -4
  24. package/dist/_chunks/{History-D4U2YISB.js.map → History-pesEeFFT.js.map} +1 -1
  25. package/dist/_chunks/{ListConfigurationPage-Bny6CdWe.js → ListConfigurationPage-BIoi-Sog.js} +14 -4
  26. package/dist/_chunks/ListConfigurationPage-BIoi-Sog.js.map +1 -0
  27. package/dist/_chunks/{ListConfigurationPage-W-KQHmBv.mjs → ListConfigurationPage-CB_lBFVX.mjs} +14 -4
  28. package/dist/_chunks/ListConfigurationPage-CB_lBFVX.mjs.map +1 -0
  29. package/dist/_chunks/{ListViewPage-O8F1pBJo.js → ListViewPage-C6FK36UI.js} +3 -3
  30. package/dist/_chunks/{ListViewPage-O8F1pBJo.js.map → ListViewPage-C6FK36UI.js.map} +1 -1
  31. package/dist/_chunks/{ListViewPage-HBBnJa8K.mjs → ListViewPage-DBbH7Esr.mjs} +3 -3
  32. package/dist/_chunks/{ListViewPage-HBBnJa8K.mjs.map → ListViewPage-DBbH7Esr.mjs.map} +1 -1
  33. package/dist/_chunks/{NoContentTypePage-B-gIhHWM.mjs → NoContentTypePage-BU9Omzp4.mjs} +2 -2
  34. package/dist/_chunks/{NoContentTypePage-B-gIhHWM.mjs.map → NoContentTypePage-BU9Omzp4.mjs.map} +1 -1
  35. package/dist/_chunks/{NoContentTypePage-CQWChGPw.js → NoContentTypePage-Dod8M_xM.js} +2 -2
  36. package/dist/_chunks/{NoContentTypePage-CQWChGPw.js.map → NoContentTypePage-Dod8M_xM.js.map} +1 -1
  37. package/dist/_chunks/{NoPermissionsPage-XhOPl8wx.mjs → NoPermissionsPage-B88W05rh.mjs} +2 -2
  38. package/dist/_chunks/{NoPermissionsPage-XhOPl8wx.mjs.map → NoPermissionsPage-B88W05rh.mjs.map} +1 -1
  39. package/dist/_chunks/{NoPermissionsPage-CY46zxnM.js → NoPermissionsPage-CMLH3uMk.js} +2 -2
  40. package/dist/_chunks/{NoPermissionsPage-CY46zxnM.js.map → NoPermissionsPage-CMLH3uMk.js.map} +1 -1
  41. package/dist/_chunks/{Relations-vFZ6Wasg.mjs → Relations-BBJRxopY.mjs} +4 -4
  42. package/dist/_chunks/{Relations-vFZ6Wasg.mjs.map → Relations-BBJRxopY.mjs.map} +1 -1
  43. package/dist/_chunks/{Relations-C4gGfZRv.js → Relations-OXbsEvNt.js} +4 -4
  44. package/dist/_chunks/{Relations-C4gGfZRv.js.map → Relations-OXbsEvNt.js.map} +1 -1
  45. package/dist/_chunks/{index-Dpxg3ctD.mjs → index-BgiNQ7Q9.mjs} +79 -36
  46. package/dist/_chunks/index-BgiNQ7Q9.mjs.map +1 -0
  47. package/dist/_chunks/{index-5EMXLEM_.js → index-Bj8wwbdx.js} +78 -35
  48. package/dist/_chunks/index-Bj8wwbdx.js.map +1 -0
  49. package/dist/_chunks/{layout-P3eKO1Qy.js → layout-DBvOIgWG.js} +6 -6
  50. package/dist/_chunks/layout-DBvOIgWG.js.map +1 -0
  51. package/dist/_chunks/{layout-C0INpKap.mjs → layout-LOFMsdWo.mjs} +6 -6
  52. package/dist/_chunks/layout-LOFMsdWo.mjs.map +1 -0
  53. package/dist/_chunks/{relations-B1y0K6LE.js → relations-BLilXMyN.js} +2 -2
  54. package/dist/_chunks/{relations-B1y0K6LE.js.map → relations-BLilXMyN.js.map} +1 -1
  55. package/dist/_chunks/{relations-FBRRBWeO.mjs → relations-BTQKCDqX.mjs} +2 -2
  56. package/dist/_chunks/{relations-FBRRBWeO.mjs.map → relations-BTQKCDqX.mjs.map} +1 -1
  57. package/dist/admin/index.js +1 -1
  58. package/dist/admin/index.mjs +1 -1
  59. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
  60. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
  61. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +10 -22
  62. package/dist/admin/src/utils/validation.d.ts +4 -1
  63. package/dist/server/index.js +29 -18
  64. package/dist/server/index.js.map +1 -1
  65. package/dist/server/index.mjs +29 -18
  66. package/dist/server/index.mjs.map +1 -1
  67. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  68. package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
  69. package/dist/server/src/services/permission-checker.d.ts.map +1 -1
  70. package/package.json +8 -8
  71. package/dist/_chunks/EditViewPage-BSVmMpRd.js.map +0 -1
  72. package/dist/_chunks/EditViewPage-C3tIZ8F5.mjs.map +0 -1
  73. package/dist/_chunks/Field-BvuT8cGL.mjs.map +0 -1
  74. package/dist/_chunks/Field-DUCVth4C.js.map +0 -1
  75. package/dist/_chunks/Form-BZmDNVr9.mjs.map +0 -1
  76. package/dist/_chunks/Form-Cpl4W1ak.js.map +0 -1
  77. package/dist/_chunks/ListConfigurationPage-Bny6CdWe.js.map +0 -1
  78. package/dist/_chunks/ListConfigurationPage-W-KQHmBv.mjs.map +0 -1
  79. package/dist/_chunks/index-5EMXLEM_.js.map +0 -1
  80. package/dist/_chunks/index-Dpxg3ctD.mjs.map +0 -1
  81. package/dist/_chunks/layout-C0INpKap.mjs.map +0 -1
  82. package/dist/_chunks/layout-P3eKO1Qy.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 { Button, Menu, VisuallyHidden, Flex, Typography, Dialog, Modal, Radio, Status, Box, SingleSelect, SingleSelectOption, Loader, IconButton, Tooltip, LinkButton } from "@strapi/design-system";
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";
@@ -454,7 +454,7 @@ const buildValidParams = (query) => {
454
454
  const isBaseQueryError = (error) => {
455
455
  return error.name !== void 0;
456
456
  };
457
- const createYupSchema = (attributes = {}, components = {}) => {
457
+ const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
458
458
  const createModelSchema = (attributes2) => yup.object().shape(
459
459
  Object.entries(attributes2).reduce((acc, [name, attribute]) => {
460
460
  if (DOCUMENT_META_FIELDS.includes(name)) {
@@ -467,7 +467,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
467
467
  addMinValidation,
468
468
  addMaxValidation,
469
469
  addRegexValidation
470
- ].map((fn) => fn(attribute));
470
+ ].map((fn) => fn(attribute, options));
471
471
  const transformSchema = pipe(...validations);
472
472
  switch (attribute.type) {
473
473
  case "component": {
@@ -594,13 +594,7 @@ const createAttributeSchema = (attribute) => {
594
594
  return yup.mixed();
595
595
  }
596
596
  };
597
- const addRequiredValidation = (attribute) => (schema) => {
598
- if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
599
- return schema.min(1, translatedErrors.required);
600
- }
601
- if (attribute.required && attribute.type !== "relation") {
602
- return schema.required(translatedErrors.required);
603
- }
597
+ const nullableSchema = (schema) => {
604
598
  return schema?.nullable ? schema.nullable() : (
605
599
  // In some cases '.nullable' will not be available on the schema.
606
600
  // e.g. when the schema has been built using yup.lazy (e.g. for relations).
@@ -608,7 +602,22 @@ const addRequiredValidation = (attribute) => (schema) => {
608
602
  schema
609
603
  );
610
604
  };
611
- const addMinLengthValidation = (attribute) => (schema) => {
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
+ }
612
621
  if ("minLength" in attribute && attribute.minLength && Number.isInteger(attribute.minLength) && "min" in schema) {
613
622
  return schema.min(attribute.minLength, {
614
623
  ...translatedErrors.minLength,
@@ -630,11 +639,11 @@ const addMaxLengthValidation = (attribute) => (schema) => {
630
639
  }
631
640
  return schema;
632
641
  };
633
- const addMinValidation = (attribute) => (schema) => {
642
+ const addMinValidation = (attribute, options) => (schema) => {
634
643
  if ("min" in attribute) {
635
644
  const min = toInteger(attribute.min);
636
645
  if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
637
- if (!attribute.required && "test" in schema && min) {
646
+ if (options.status !== "draft" && !attribute.required && "test" in schema && min) {
638
647
  return schema.test(
639
648
  "custom-min",
640
649
  {
@@ -1285,7 +1294,7 @@ const useDocumentActions = () => {
1285
1294
  };
1286
1295
  };
1287
1296
  const ProtectedHistoryPage = lazy(
1288
- () => import("./History-Cq_Hrzuu.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1297
+ () => import("./History-BEFrLZfz.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1289
1298
  );
1290
1299
  const routes$1 = [
1291
1300
  {
@@ -1298,31 +1307,31 @@ const routes$1 = [
1298
1307
  }
1299
1308
  ];
1300
1309
  const ProtectedEditViewPage = lazy(
1301
- () => import("./EditViewPage-C3tIZ8F5.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1310
+ () => import("./EditViewPage-IZbGSeL3.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1302
1311
  );
1303
1312
  const ProtectedListViewPage = lazy(
1304
- () => import("./ListViewPage-HBBnJa8K.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1313
+ () => import("./ListViewPage-DBbH7Esr.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1305
1314
  );
1306
1315
  const ProtectedListConfiguration = lazy(
1307
- () => import("./ListConfigurationPage-W-KQHmBv.mjs").then((mod) => ({
1316
+ () => import("./ListConfigurationPage-CB_lBFVX.mjs").then((mod) => ({
1308
1317
  default: mod.ProtectedListConfiguration
1309
1318
  }))
1310
1319
  );
1311
1320
  const ProtectedEditConfigurationPage = lazy(
1312
- () => import("./EditConfigurationPage-13b7S5Cq.mjs").then((mod) => ({
1321
+ () => import("./EditConfigurationPage-DJDSIf3D.mjs").then((mod) => ({
1313
1322
  default: mod.ProtectedEditConfigurationPage
1314
1323
  }))
1315
1324
  );
1316
1325
  const ProtectedComponentConfigurationPage = lazy(
1317
- () => import("./ComponentConfigurationPage-D0dyDTwq.mjs").then((mod) => ({
1326
+ () => import("./ComponentConfigurationPage-BwnO0su2.mjs").then((mod) => ({
1318
1327
  default: mod.ProtectedComponentConfigurationPage
1319
1328
  }))
1320
1329
  );
1321
1330
  const NoPermissions = lazy(
1322
- () => import("./NoPermissionsPage-XhOPl8wx.mjs").then((mod) => ({ default: mod.NoPermissions }))
1331
+ () => import("./NoPermissionsPage-B88W05rh.mjs").then((mod) => ({ default: mod.NoPermissions }))
1323
1332
  );
1324
1333
  const NoContentType = lazy(
1325
- () => import("./NoContentTypePage-B-gIhHWM.mjs").then((mod) => ({ default: mod.NoContentType }))
1334
+ () => import("./NoContentTypePage-BU9Omzp4.mjs").then((mod) => ({ default: mod.NoContentType }))
1326
1335
  );
1327
1336
  const CollectionTypePages = () => {
1328
1337
  const { collectionType } = useParams();
@@ -1442,6 +1451,8 @@ const DocumentActionButton = (action) => {
1442
1451
  onClick: handleClick(action),
1443
1452
  justifyContent: "center",
1444
1453
  variant: action.variant || "default",
1454
+ paddingTop: "7px",
1455
+ paddingBottom: "7px",
1445
1456
  children: action.label
1446
1457
  }
1447
1458
  ),
@@ -1501,7 +1512,7 @@ const DocumentActionsMenu = ({
1501
1512
  };
1502
1513
  return /* @__PURE__ */ jsxs(Menu.Root, { open: isOpen, onOpenChange: setIsOpen, children: [
1503
1514
  /* @__PURE__ */ jsxs(
1504
- Menu.Trigger,
1515
+ StyledMoreButton,
1505
1516
  {
1506
1517
  disabled: isDisabled,
1507
1518
  size: "S",
@@ -1535,7 +1546,14 @@ const DocumentActionsMenu = ({
1535
1546
  gap: 2,
1536
1547
  tag: "span",
1537
1548
  children: [
1538
- /* @__PURE__ */ jsx("span", { children: action.icon }),
1549
+ /* @__PURE__ */ jsx(
1550
+ Flex,
1551
+ {
1552
+ tag: "span",
1553
+ color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
1554
+ children: action.icon
1555
+ }
1556
+ ),
1539
1557
  action.label
1540
1558
  ]
1541
1559
  }
@@ -1598,6 +1616,23 @@ const convertActionVariantToColor = (variant = "secondary") => {
1598
1616
  return "primary600";
1599
1617
  }
1600
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
+ `;
1601
1636
  const DocumentActionConfirmDialog = ({
1602
1637
  onClose,
1603
1638
  onCancel,
@@ -1869,16 +1904,18 @@ const UpdateAction = ({
1869
1904
  onClick: async () => {
1870
1905
  setSubmitting(true);
1871
1906
  try {
1872
- const { errors } = await validate();
1873
- if (errors) {
1874
- toggleNotification({
1875
- type: "danger",
1876
- message: formatMessage({
1877
- id: "content-manager.validation.error",
1878
- defaultMessage: "There are validation errors in your document. Please fix them before saving."
1879
- })
1880
- });
1881
- return;
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
+ }
1882
1919
  }
1883
1920
  if (isCloning) {
1884
1921
  const res = await clone(
@@ -3162,7 +3199,13 @@ const SelectedEntriesModalContent = ({
3162
3199
  );
3163
3200
  const { rows, validationErrors } = React.useMemo(() => {
3164
3201
  if (data.length > 0 && schema) {
3165
- const validate = createYupSchema(schema.attributes, components);
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
+ );
3166
3209
  const validationErrors2 = {};
3167
3210
  const rows2 = data.map((entry) => {
3168
3211
  try {
@@ -3854,7 +3897,7 @@ const index = {
3854
3897
  app.router.addRoute({
3855
3898
  path: "content-manager/*",
3856
3899
  lazy: async () => {
3857
- const { Layout } = await import("./layout-C0INpKap.mjs");
3900
+ const { Layout } = await import("./layout-LOFMsdWo.mjs");
3858
3901
  return {
3859
3902
  Component: Layout
3860
3903
  };
@@ -3930,4 +3973,4 @@ export {
3930
3973
  useUpdateContentTypeConfigurationMutation as y,
3931
3974
  extractContentTypeComponents as z
3932
3975
  };
3933
- //# sourceMappingURL=index-Dpxg3ctD.mjs.map
3976
+ //# sourceMappingURL=index-BgiNQ7Q9.mjs.map