@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.
Files changed (89) hide show
  1. package/dist/_chunks/{ComponentConfigurationPage-DL1MHO8i.js → ComponentConfigurationPage-D_M8iBw5.js} +3 -3
  2. package/dist/_chunks/{ComponentConfigurationPage-DL1MHO8i.js.map → ComponentConfigurationPage-D_M8iBw5.js.map} +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-D0dyDTwq.mjs → ComponentConfigurationPage-qemkOlnj.mjs} +3 -3
  4. package/dist/_chunks/{ComponentConfigurationPage-D0dyDTwq.mjs.map → ComponentConfigurationPage-qemkOlnj.mjs.map} +1 -1
  5. package/dist/_chunks/{EditConfigurationPage-CMaOf-A-.js → EditConfigurationPage-BePwPuHy.js} +3 -3
  6. package/dist/_chunks/{EditConfigurationPage-CMaOf-A-.js.map → EditConfigurationPage-BePwPuHy.js.map} +1 -1
  7. package/dist/_chunks/{EditConfigurationPage-13b7S5Cq.mjs → EditConfigurationPage-CjUrEewK.mjs} +3 -3
  8. package/dist/_chunks/{EditConfigurationPage-13b7S5Cq.mjs.map → EditConfigurationPage-CjUrEewK.mjs.map} +1 -1
  9. package/dist/_chunks/{EditViewPage-BSVmMpRd.js → EditViewPage-B-RJeiJD.js} +19 -8
  10. package/dist/_chunks/EditViewPage-B-RJeiJD.js.map +1 -0
  11. package/dist/_chunks/{EditViewPage-C3tIZ8F5.mjs → EditViewPage-De8GyU8P.mjs} +19 -8
  12. package/dist/_chunks/EditViewPage-De8GyU8P.mjs.map +1 -0
  13. package/dist/_chunks/{Field-DUCVth4C.js → Field-dq8Tg1M_.js} +99 -33
  14. package/dist/_chunks/Field-dq8Tg1M_.js.map +1 -0
  15. package/dist/_chunks/{Field-BvuT8cGL.mjs → Field-pb2o8uBe.mjs} +101 -35
  16. package/dist/_chunks/{Field-BvuT8cGL.mjs.map → Field-pb2o8uBe.mjs.map} +1 -1
  17. package/dist/_chunks/{Form-Cpl4W1ak.js → Form-DGIf4jQU.js} +22 -11
  18. package/dist/_chunks/Form-DGIf4jQU.js.map +1 -0
  19. package/dist/_chunks/{Form-BZmDNVr9.mjs → Form-DJn0Dxha.mjs} +22 -11
  20. package/dist/_chunks/Form-DJn0Dxha.mjs.map +1 -0
  21. package/dist/_chunks/{History-Cq_Hrzuu.mjs → History-BowL3JKP.mjs} +4 -4
  22. package/dist/_chunks/{History-Cq_Hrzuu.mjs.map → History-BowL3JKP.mjs.map} +1 -1
  23. package/dist/_chunks/{History-D4U2YISB.js → History-Dh2NEHnR.js} +4 -4
  24. package/dist/_chunks/{History-D4U2YISB.js.map → History-Dh2NEHnR.js.map} +1 -1
  25. package/dist/_chunks/{ListConfigurationPage-W-KQHmBv.mjs → ListConfigurationPage-BpVOB-hn.mjs} +14 -4
  26. package/dist/_chunks/ListConfigurationPage-BpVOB-hn.mjs.map +1 -0
  27. package/dist/_chunks/{ListConfigurationPage-Bny6CdWe.js → ListConfigurationPage-BxYCWz9e.js} +14 -4
  28. package/dist/_chunks/ListConfigurationPage-BxYCWz9e.js.map +1 -0
  29. package/dist/_chunks/{ListViewPage-O8F1pBJo.js → ListViewPage-4XsciqHZ.js} +3 -3
  30. package/dist/_chunks/{ListViewPage-O8F1pBJo.js.map → ListViewPage-4XsciqHZ.js.map} +1 -1
  31. package/dist/_chunks/{ListViewPage-HBBnJa8K.mjs → ListViewPage-CXFUjZQC.mjs} +3 -3
  32. package/dist/_chunks/{ListViewPage-HBBnJa8K.mjs.map → ListViewPage-CXFUjZQC.mjs.map} +1 -1
  33. package/dist/_chunks/{NoContentTypePage-CQWChGPw.js → NoContentTypePage-C8OpoHeU.js} +2 -2
  34. package/dist/_chunks/{NoContentTypePage-CQWChGPw.js.map → NoContentTypePage-C8OpoHeU.js.map} +1 -1
  35. package/dist/_chunks/{NoContentTypePage-B-gIhHWM.mjs → NoContentTypePage-DuhOTp3x.mjs} +2 -2
  36. package/dist/_chunks/{NoContentTypePage-B-gIhHWM.mjs.map → NoContentTypePage-DuhOTp3x.mjs.map} +1 -1
  37. package/dist/_chunks/{NoPermissionsPage-XhOPl8wx.mjs → NoPermissionsPage-DVz3mzDz.mjs} +2 -2
  38. package/dist/_chunks/{NoPermissionsPage-XhOPl8wx.mjs.map → NoPermissionsPage-DVz3mzDz.mjs.map} +1 -1
  39. package/dist/_chunks/{NoPermissionsPage-CY46zxnM.js → NoPermissionsPage-y_r7DVA2.js} +2 -2
  40. package/dist/_chunks/{NoPermissionsPage-CY46zxnM.js.map → NoPermissionsPage-y_r7DVA2.js.map} +1 -1
  41. package/dist/_chunks/{Relations-vFZ6Wasg.mjs → Relations-CVNLrn1Y.mjs} +4 -4
  42. package/dist/_chunks/{Relations-vFZ6Wasg.mjs.map → Relations-CVNLrn1Y.mjs.map} +1 -1
  43. package/dist/_chunks/{Relations-C4gGfZRv.js → Relations-DPFCAa7b.js} +4 -4
  44. package/dist/_chunks/{Relations-C4gGfZRv.js.map → Relations-DPFCAa7b.js.map} +1 -1
  45. package/dist/_chunks/{index-5EMXLEM_.js → index-C3fJE-1-.js} +101 -54
  46. package/dist/_chunks/index-C3fJE-1-.js.map +1 -0
  47. package/dist/_chunks/{index-Dpxg3ctD.mjs → index-DiMrfcfy.mjs} +119 -72
  48. package/dist/_chunks/index-DiMrfcfy.mjs.map +1 -0
  49. package/dist/_chunks/{layout-P3eKO1Qy.js → layout-C788OmNr.js} +6 -6
  50. package/dist/_chunks/layout-C788OmNr.js.map +1 -0
  51. package/dist/_chunks/{layout-C0INpKap.mjs → layout-ls3gxfpH.mjs} +6 -6
  52. package/dist/_chunks/layout-ls3gxfpH.mjs.map +1 -0
  53. package/dist/_chunks/{relations-FBRRBWeO.mjs → relations-CLcOmGO0.mjs} +2 -2
  54. package/dist/_chunks/{relations-FBRRBWeO.mjs.map → relations-CLcOmGO0.mjs.map} +1 -1
  55. package/dist/_chunks/{relations-B1y0K6LE.js → relations-DYeotliT.js} +2 -2
  56. package/dist/_chunks/{relations-B1y0K6LE.js.map → relations-DYeotliT.js.map} +1 -1
  57. package/dist/admin/index.js +1 -1
  58. package/dist/admin/index.mjs +4 -4
  59. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  60. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
  61. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
  62. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +10 -22
  63. package/dist/admin/src/services/api.d.ts +1 -1
  64. package/dist/admin/src/services/components.d.ts +2 -2
  65. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  66. package/dist/admin/src/services/documents.d.ts +16 -16
  67. package/dist/admin/src/services/init.d.ts +1 -1
  68. package/dist/admin/src/services/relations.d.ts +2 -2
  69. package/dist/admin/src/services/uid.d.ts +3 -3
  70. package/dist/admin/src/utils/validation.d.ts +4 -1
  71. package/dist/server/index.js +29 -18
  72. package/dist/server/index.js.map +1 -1
  73. package/dist/server/index.mjs +29 -18
  74. package/dist/server/index.mjs.map +1 -1
  75. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  76. package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
  77. package/dist/server/src/services/permission-checker.d.ts.map +1 -1
  78. package/package.json +8 -8
  79. package/dist/_chunks/EditViewPage-BSVmMpRd.js.map +0 -1
  80. package/dist/_chunks/EditViewPage-C3tIZ8F5.mjs.map +0 -1
  81. package/dist/_chunks/Field-DUCVth4C.js.map +0 -1
  82. package/dist/_chunks/Form-BZmDNVr9.mjs.map +0 -1
  83. package/dist/_chunks/Form-Cpl4W1ak.js.map +0 -1
  84. package/dist/_chunks/ListConfigurationPage-Bny6CdWe.js.map +0 -1
  85. package/dist/_chunks/ListConfigurationPage-W-KQHmBv.mjs.map +0 -1
  86. package/dist/_chunks/index-5EMXLEM_.js.map +0 -1
  87. package/dist/_chunks/index-Dpxg3ctD.mjs.map +0 -1
  88. package/dist/_chunks/layout-C0INpKap.mjs.map +0 -1
  89. package/dist/_chunks/layout-P3eKO1Qy.js.map +0 -1
@@ -3,9 +3,9 @@ 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
- import { useParams, Navigate, useNavigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
8
+ import { useParams, useNavigate, Navigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
9
9
  import { styled } from "styled-components";
10
10
  import * as yup from "yup";
11
11
  import { ValidationError } from "yup";
@@ -158,7 +158,8 @@ const contentManagerApi = adminApi.enhanceEndpoints({
158
158
  "Document",
159
159
  "InitialData",
160
160
  "HistoryVersion",
161
- "Relations"
161
+ "Relations",
162
+ "UidAvailability"
162
163
  ]
163
164
  });
164
165
  const documentApi = contentManagerApi.injectEndpoints({
@@ -188,7 +189,10 @@ const documentApi = contentManagerApi.injectEndpoints({
188
189
  params
189
190
  }
190
191
  }),
191
- invalidatesTags: (_result, _error, { model }) => [{ type: "Document", id: `${model}_LIST` }]
192
+ invalidatesTags: (_result, _error, { model }) => [
193
+ { type: "Document", id: `${model}_LIST` },
194
+ { type: "UidAvailability", id: model }
195
+ ]
192
196
  }),
193
197
  /**
194
198
  * Creates a new collection-type document. This should ONLY be used for collection-types.
@@ -205,7 +209,8 @@ const documentApi = contentManagerApi.injectEndpoints({
205
209
  }),
206
210
  invalidatesTags: (result, _error, { model }) => [
207
211
  { type: "Document", id: `${model}_LIST` },
208
- "Relations"
212
+ "Relations",
213
+ { type: "UidAvailability", id: model }
209
214
  ]
210
215
  }),
211
216
  deleteDocument: builder.mutation({
@@ -246,7 +251,8 @@ const documentApi = contentManagerApi.injectEndpoints({
246
251
  id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
247
252
  },
248
253
  { type: "Document", id: `${model}_LIST` },
249
- "Relations"
254
+ "Relations",
255
+ { type: "UidAvailability", id: model }
250
256
  ];
251
257
  }
252
258
  }),
@@ -371,7 +377,8 @@ const documentApi = contentManagerApi.injectEndpoints({
371
377
  type: "Document",
372
378
  id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
373
379
  },
374
- "Relations"
380
+ "Relations",
381
+ { type: "UidAvailability", id: model }
375
382
  ];
376
383
  },
377
384
  async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
@@ -454,7 +461,7 @@ const buildValidParams = (query) => {
454
461
  const isBaseQueryError = (error) => {
455
462
  return error.name !== void 0;
456
463
  };
457
- const createYupSchema = (attributes = {}, components = {}) => {
464
+ const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
458
465
  const createModelSchema = (attributes2) => yup.object().shape(
459
466
  Object.entries(attributes2).reduce((acc, [name, attribute]) => {
460
467
  if (DOCUMENT_META_FIELDS.includes(name)) {
@@ -467,7 +474,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
467
474
  addMinValidation,
468
475
  addMaxValidation,
469
476
  addRegexValidation
470
- ].map((fn) => fn(attribute));
477
+ ].map((fn) => fn(attribute, options));
471
478
  const transformSchema = pipe(...validations);
472
479
  switch (attribute.type) {
473
480
  case "component": {
@@ -594,13 +601,7 @@ const createAttributeSchema = (attribute) => {
594
601
  return yup.mixed();
595
602
  }
596
603
  };
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
- }
604
+ const nullableSchema = (schema) => {
604
605
  return schema?.nullable ? schema.nullable() : (
605
606
  // In some cases '.nullable' will not be available on the schema.
606
607
  // e.g. when the schema has been built using yup.lazy (e.g. for relations).
@@ -608,7 +609,22 @@ const addRequiredValidation = (attribute) => (schema) => {
608
609
  schema
609
610
  );
610
611
  };
611
- const addMinLengthValidation = (attribute) => (schema) => {
612
+ const addRequiredValidation = (attribute, options) => (schema) => {
613
+ if (options.status === "draft") {
614
+ return nullableSchema(schema);
615
+ }
616
+ if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
617
+ return schema.min(1, translatedErrors.required);
618
+ }
619
+ if (attribute.required && attribute.type !== "relation") {
620
+ return schema.required(translatedErrors.required);
621
+ }
622
+ return nullableSchema(schema);
623
+ };
624
+ const addMinLengthValidation = (attribute, options) => (schema) => {
625
+ if (options.status === "draft") {
626
+ return schema;
627
+ }
612
628
  if ("minLength" in attribute && attribute.minLength && Number.isInteger(attribute.minLength) && "min" in schema) {
613
629
  return schema.min(attribute.minLength, {
614
630
  ...translatedErrors.minLength,
@@ -630,11 +646,11 @@ const addMaxLengthValidation = (attribute) => (schema) => {
630
646
  }
631
647
  return schema;
632
648
  };
633
- const addMinValidation = (attribute) => (schema) => {
649
+ const addMinValidation = (attribute, options) => (schema) => {
634
650
  if ("min" in attribute) {
635
651
  const min = toInteger(attribute.min);
636
652
  if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
637
- if (!attribute.required && "test" in schema && min) {
653
+ if (options.status !== "draft" && !attribute.required && "test" in schema && min) {
638
654
  return schema.test(
639
655
  "custom-min",
640
656
  {
@@ -870,6 +886,7 @@ const useDocumentActions = () => {
870
886
  const { formatMessage } = useIntl();
871
887
  const { trackUsage } = useTracking();
872
888
  const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
889
+ const navigate = useNavigate();
873
890
  const [deleteDocument] = useDeleteDocumentMutation();
874
891
  const _delete = React.useCallback(
875
892
  async ({ collectionType, model, documentId, params }, trackerProperty) => {
@@ -1223,7 +1240,7 @@ const useDocumentActions = () => {
1223
1240
  throw err;
1224
1241
  }
1225
1242
  },
1226
- [autoCloneDocument, formatAPIError, formatMessage, toggleNotification]
1243
+ [autoCloneDocument, formatMessage, toggleNotification]
1227
1244
  );
1228
1245
  const [cloneDocument] = useCloneDocumentMutation();
1229
1246
  const clone = React.useCallback(
@@ -1249,6 +1266,7 @@ const useDocumentActions = () => {
1249
1266
  defaultMessage: "Cloned document"
1250
1267
  })
1251
1268
  });
1269
+ navigate(`../../${res.data.data.documentId}`, { relative: "path" });
1252
1270
  return res.data;
1253
1271
  } catch (err) {
1254
1272
  toggleNotification({
@@ -1259,7 +1277,7 @@ const useDocumentActions = () => {
1259
1277
  throw err;
1260
1278
  }
1261
1279
  },
1262
- [cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError]
1280
+ [cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError, navigate]
1263
1281
  );
1264
1282
  const [getDoc] = useLazyGetDocumentQuery();
1265
1283
  const getDocument = React.useCallback(
@@ -1285,7 +1303,7 @@ const useDocumentActions = () => {
1285
1303
  };
1286
1304
  };
1287
1305
  const ProtectedHistoryPage = lazy(
1288
- () => import("./History-Cq_Hrzuu.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1306
+ () => import("./History-BowL3JKP.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1289
1307
  );
1290
1308
  const routes$1 = [
1291
1309
  {
@@ -1298,31 +1316,31 @@ const routes$1 = [
1298
1316
  }
1299
1317
  ];
1300
1318
  const ProtectedEditViewPage = lazy(
1301
- () => import("./EditViewPage-C3tIZ8F5.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1319
+ () => import("./EditViewPage-De8GyU8P.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1302
1320
  );
1303
1321
  const ProtectedListViewPage = lazy(
1304
- () => import("./ListViewPage-HBBnJa8K.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1322
+ () => import("./ListViewPage-CXFUjZQC.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1305
1323
  );
1306
1324
  const ProtectedListConfiguration = lazy(
1307
- () => import("./ListConfigurationPage-W-KQHmBv.mjs").then((mod) => ({
1325
+ () => import("./ListConfigurationPage-BpVOB-hn.mjs").then((mod) => ({
1308
1326
  default: mod.ProtectedListConfiguration
1309
1327
  }))
1310
1328
  );
1311
1329
  const ProtectedEditConfigurationPage = lazy(
1312
- () => import("./EditConfigurationPage-13b7S5Cq.mjs").then((mod) => ({
1330
+ () => import("./EditConfigurationPage-CjUrEewK.mjs").then((mod) => ({
1313
1331
  default: mod.ProtectedEditConfigurationPage
1314
1332
  }))
1315
1333
  );
1316
1334
  const ProtectedComponentConfigurationPage = lazy(
1317
- () => import("./ComponentConfigurationPage-D0dyDTwq.mjs").then((mod) => ({
1335
+ () => import("./ComponentConfigurationPage-qemkOlnj.mjs").then((mod) => ({
1318
1336
  default: mod.ProtectedComponentConfigurationPage
1319
1337
  }))
1320
1338
  );
1321
1339
  const NoPermissions = lazy(
1322
- () => import("./NoPermissionsPage-XhOPl8wx.mjs").then((mod) => ({ default: mod.NoPermissions }))
1340
+ () => import("./NoPermissionsPage-DVz3mzDz.mjs").then((mod) => ({ default: mod.NoPermissions }))
1323
1341
  );
1324
1342
  const NoContentType = lazy(
1325
- () => import("./NoContentTypePage-B-gIhHWM.mjs").then((mod) => ({ default: mod.NoContentType }))
1343
+ () => import("./NoContentTypePage-DuhOTp3x.mjs").then((mod) => ({ default: mod.NoContentType }))
1326
1344
  );
1327
1345
  const CollectionTypePages = () => {
1328
1346
  const { collectionType } = useParams();
@@ -1442,6 +1460,8 @@ const DocumentActionButton = (action) => {
1442
1460
  onClick: handleClick(action),
1443
1461
  justifyContent: "center",
1444
1462
  variant: action.variant || "default",
1463
+ paddingTop: "7px",
1464
+ paddingBottom: "7px",
1445
1465
  children: action.label
1446
1466
  }
1447
1467
  ),
@@ -1501,7 +1521,7 @@ const DocumentActionsMenu = ({
1501
1521
  };
1502
1522
  return /* @__PURE__ */ jsxs(Menu.Root, { open: isOpen, onOpenChange: setIsOpen, children: [
1503
1523
  /* @__PURE__ */ jsxs(
1504
- Menu.Trigger,
1524
+ StyledMoreButton,
1505
1525
  {
1506
1526
  disabled: isDisabled,
1507
1527
  size: "S",
@@ -1535,7 +1555,14 @@ const DocumentActionsMenu = ({
1535
1555
  gap: 2,
1536
1556
  tag: "span",
1537
1557
  children: [
1538
- /* @__PURE__ */ jsx("span", { children: action.icon }),
1558
+ /* @__PURE__ */ jsx(
1559
+ Flex,
1560
+ {
1561
+ tag: "span",
1562
+ color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
1563
+ children: action.icon
1564
+ }
1565
+ ),
1539
1566
  action.label
1540
1567
  ]
1541
1568
  }
@@ -1598,6 +1625,23 @@ const convertActionVariantToColor = (variant = "secondary") => {
1598
1625
  return "primary600";
1599
1626
  }
1600
1627
  };
1628
+ const convertActionVariantToIconColor = (variant = "secondary") => {
1629
+ switch (variant) {
1630
+ case "danger":
1631
+ return "danger600";
1632
+ case "secondary":
1633
+ return "neutral500";
1634
+ case "success":
1635
+ return "success600";
1636
+ default:
1637
+ return "primary600";
1638
+ }
1639
+ };
1640
+ const StyledMoreButton = styled(Menu.Trigger)`
1641
+ & > span {
1642
+ display: flex;
1643
+ }
1644
+ `;
1601
1645
  const DocumentActionConfirmDialog = ({
1602
1646
  onClose,
1603
1647
  onCancel,
@@ -1667,12 +1711,10 @@ const PublishAction$1 = ({
1667
1711
  const navigate = useNavigate();
1668
1712
  const { toggleNotification } = useNotification();
1669
1713
  const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
1714
+ const isListView = useMatch(LIST_PATH) !== null;
1670
1715
  const isCloning = useMatch(CLONE_PATH) !== null;
1671
1716
  const { formatMessage } = useIntl();
1672
- const { canPublish, canCreate, canUpdate } = useDocumentRBAC(
1673
- "PublishAction",
1674
- ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
1675
- );
1717
+ const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
1676
1718
  const { publish } = useDocumentActions();
1677
1719
  const [
1678
1720
  countDraftRelations,
@@ -1724,7 +1766,7 @@ const PublishAction$1 = ({
1724
1766
  }
1725
1767
  }, [documentId, modified, formValues, setLocalCountOfDraftRelations]);
1726
1768
  React.useEffect(() => {
1727
- if (documentId) {
1769
+ if (documentId && !isListView) {
1728
1770
  const fetchDraftRelationsCount = async () => {
1729
1771
  const { data, error } = await countDraftRelations({
1730
1772
  collectionType,
@@ -1741,7 +1783,7 @@ const PublishAction$1 = ({
1741
1783
  };
1742
1784
  fetchDraftRelationsCount();
1743
1785
  }
1744
- }, [documentId, countDraftRelations, collectionType, model, params]);
1786
+ }, [isListView, documentId, countDraftRelations, collectionType, model, params]);
1745
1787
  const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
1746
1788
  if (!schema?.options?.draftAndPublish) {
1747
1789
  return null;
@@ -1840,10 +1882,6 @@ const UpdateAction = ({
1840
1882
  const cloneMatch = useMatch(CLONE_PATH);
1841
1883
  const isCloning = cloneMatch !== null;
1842
1884
  const { formatMessage } = useIntl();
1843
- useDocumentRBAC("UpdateAction", ({ canCreate: canCreate2, canUpdate: canUpdate2 }) => ({
1844
- canCreate: canCreate2,
1845
- canUpdate: canUpdate2
1846
- }));
1847
1885
  const { create, update, clone } = useDocumentActions();
1848
1886
  const [{ query, rawQuery }] = useQueryParams();
1849
1887
  const params = React.useMemo(() => buildValidParams(query), [query]);
@@ -1869,16 +1907,18 @@ const UpdateAction = ({
1869
1907
  onClick: async () => {
1870
1908
  setSubmitting(true);
1871
1909
  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;
1910
+ if (activeTab !== "draft") {
1911
+ const { errors } = await validate();
1912
+ if (errors) {
1913
+ toggleNotification({
1914
+ type: "danger",
1915
+ message: formatMessage({
1916
+ id: "content-manager.validation.error",
1917
+ defaultMessage: "There are validation errors in your document. Please fix them before saving."
1918
+ })
1919
+ });
1920
+ return;
1921
+ }
1882
1922
  }
1883
1923
  if (isCloning) {
1884
1924
  const res = await clone(
@@ -3162,7 +3202,13 @@ const SelectedEntriesModalContent = ({
3162
3202
  );
3163
3203
  const { rows, validationErrors } = React.useMemo(() => {
3164
3204
  if (data.length > 0 && schema) {
3165
- const validate = createYupSchema(schema.attributes, components);
3205
+ const validate = createYupSchema(
3206
+ schema.attributes,
3207
+ components,
3208
+ // Since this is the "Publish" action, the validation
3209
+ // schema must enforce the rules for published entities
3210
+ { status: "published" }
3211
+ );
3166
3212
  const validationErrors2 = {};
3167
3213
  const rows2 = data.map((entry) => {
3168
3214
  try {
@@ -3512,7 +3558,7 @@ const TableActions = ({ document }) => {
3512
3558
  DescriptionComponentRenderer,
3513
3559
  {
3514
3560
  props,
3515
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
3561
+ descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
3516
3562
  children: (actions2) => {
3517
3563
  const tableRowActions = actions2.filter((action) => {
3518
3564
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -3623,7 +3669,7 @@ const CloneAction = ({ model, documentId }) => {
3623
3669
  }),
3624
3670
  content: /* @__PURE__ */ jsx(AutoCloneFailureModalBody, { prohibitedFields }),
3625
3671
  footer: ({ onClose }) => {
3626
- return /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", children: [
3672
+ return /* @__PURE__ */ jsxs(Modal.Footer, { children: [
3627
3673
  /* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "tertiary", children: formatMessage({
3628
3674
  id: "cancel",
3629
3675
  defaultMessage: "Cancel"
@@ -3854,7 +3900,7 @@ const index = {
3854
3900
  app.router.addRoute({
3855
3901
  path: "content-manager/*",
3856
3902
  lazy: async () => {
3857
- const { Layout } = await import("./layout-C0INpKap.mjs");
3903
+ const { Layout } = await import("./layout-ls3gxfpH.mjs");
3858
3904
  return {
3859
3905
  Component: Layout
3860
3906
  };
@@ -3892,13 +3938,14 @@ export {
3892
3938
  BulkActionsRenderer as B,
3893
3939
  COLLECTION_TYPES as C,
3894
3940
  DocumentStatus as D,
3895
- DEFAULT_SETTINGS as E,
3896
- convertEditLayoutToFieldLayouts as F,
3897
- useDocument as G,
3941
+ extractContentTypeComponents as E,
3942
+ DEFAULT_SETTINGS as F,
3943
+ convertEditLayoutToFieldLayouts as G,
3898
3944
  HOOKS as H,
3899
3945
  InjectionZone as I,
3900
- index as J,
3901
- useDocumentActions as K,
3946
+ useDocument as J,
3947
+ index as K,
3948
+ useDocumentActions as L,
3902
3949
  Panels as P,
3903
3950
  RelativeTime as R,
3904
3951
  SINGLE_TYPES as S,
@@ -3916,18 +3963,18 @@ export {
3916
3963
  PERMISSIONS as k,
3917
3964
  DocumentRBAC as l,
3918
3965
  DOCUMENT_META_FIELDS as m,
3919
- useDocLayout as n,
3920
- useGetContentTypeConfigurationQuery as o,
3921
- CREATOR_FIELDS as p,
3922
- getMainField as q,
3923
- getDisplayName as r,
3966
+ CLONE_PATH as n,
3967
+ useDocLayout as o,
3968
+ useGetContentTypeConfigurationQuery as p,
3969
+ CREATOR_FIELDS as q,
3970
+ getMainField as r,
3924
3971
  setInitialData as s,
3925
- checkIfAttributeIsDisplayable as t,
3972
+ getDisplayName as t,
3926
3973
  useContentTypeSchema as u,
3927
- useGetAllDocumentsQuery as v,
3928
- convertListLayoutToFieldLayouts as w,
3929
- capitalise as x,
3930
- useUpdateContentTypeConfigurationMutation as y,
3931
- extractContentTypeComponents as z
3974
+ checkIfAttributeIsDisplayable as v,
3975
+ useGetAllDocumentsQuery as w,
3976
+ convertListLayoutToFieldLayouts as x,
3977
+ capitalise as y,
3978
+ useUpdateContentTypeConfigurationMutation as z
3932
3979
  };
3933
- //# sourceMappingURL=index-Dpxg3ctD.mjs.map
3980
+ //# sourceMappingURL=index-DiMrfcfy.mjs.map