@strapi/content-manager 0.0.0-experimental.0af49f5c5ec496b0fad61ac9bfd4d0127b89d8d3 → 0.0.0-experimental.0e4ee97541bf8b600fc5272e0fee2b733aaf283b

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 (94) hide show
  1. package/dist/_chunks/{ComponentConfigurationPage-CtIa3aa2.mjs → ComponentConfigurationPage-D4H-v0et.mjs} +3 -3
  2. package/dist/_chunks/{ComponentConfigurationPage-CtIa3aa2.mjs.map → ComponentConfigurationPage-D4H-v0et.mjs.map} +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-BLWQy8ru.js → ComponentConfigurationPage-DdkVGfXC.js} +3 -3
  4. package/dist/_chunks/{ComponentConfigurationPage-BLWQy8ru.js.map → ComponentConfigurationPage-DdkVGfXC.js.map} +1 -1
  5. package/dist/_chunks/{EditConfigurationPage-DsPR2DVk.mjs → EditConfigurationPage-D1nvB7Br.mjs} +3 -3
  6. package/dist/_chunks/{EditConfigurationPage-DsPR2DVk.mjs.map → EditConfigurationPage-D1nvB7Br.mjs.map} +1 -1
  7. package/dist/_chunks/{EditConfigurationPage-RQkymxCy.js → EditConfigurationPage-LYEvR4fW.js} +3 -3
  8. package/dist/_chunks/{EditConfigurationPage-RQkymxCy.js.map → EditConfigurationPage-LYEvR4fW.js.map} +1 -1
  9. package/dist/_chunks/{EditViewPage-BPyVuPfM.mjs → EditViewPage-Bcnff6Vd.mjs} +11 -74
  10. package/dist/_chunks/EditViewPage-Bcnff6Vd.mjs.map +1 -0
  11. package/dist/_chunks/{EditViewPage-B-kExt8C.js → EditViewPage-DqelJ9UK.js} +13 -76
  12. package/dist/_chunks/EditViewPage-DqelJ9UK.js.map +1 -0
  13. package/dist/_chunks/{Form-BFi4MXMT.js → Form-CnHfBeiB.js} +2 -2
  14. package/dist/_chunks/{Form-BFi4MXMT.js.map → Form-CnHfBeiB.js.map} +1 -1
  15. package/dist/_chunks/{Form-C1IcWm1u.mjs → Form-CzPCJi3B.mjs} +2 -2
  16. package/dist/_chunks/{Form-C1IcWm1u.mjs.map → Form-CzPCJi3B.mjs.map} +1 -1
  17. package/dist/_chunks/{History-04ChQ4pl.mjs → History-CcmSn3Mj.mjs} +4 -4
  18. package/dist/_chunks/{History-04ChQ4pl.mjs.map → History-CcmSn3Mj.mjs.map} +1 -1
  19. package/dist/_chunks/{History-wjcK4L0C.js → History-zArjENzj.js} +15 -15
  20. package/dist/_chunks/{History-wjcK4L0C.js.map → History-zArjENzj.js.map} +1 -1
  21. package/dist/_chunks/{Field-DPIsQRre.js → Input-CDHKQd7o.js} +1150 -1182
  22. package/dist/_chunks/Input-CDHKQd7o.js.map +1 -0
  23. package/dist/_chunks/{Field-Dltnt1km.mjs → Input-aV8SSoTa.mjs} +1193 -1225
  24. package/dist/_chunks/Input-aV8SSoTa.mjs.map +1 -0
  25. package/dist/_chunks/{ListConfigurationPage-BYqPYLSU.mjs → ListConfigurationPage-BPvzENJJ.mjs} +2 -2
  26. package/dist/_chunks/{ListConfigurationPage-BYqPYLSU.mjs.map → ListConfigurationPage-BPvzENJJ.mjs.map} +1 -1
  27. package/dist/_chunks/{ListConfigurationPage-CRbxIC3J.js → ListConfigurationPage-ByZAO_9H.js} +2 -2
  28. package/dist/_chunks/{ListConfigurationPage-CRbxIC3J.js.map → ListConfigurationPage-ByZAO_9H.js.map} +1 -1
  29. package/dist/_chunks/{ListViewPage-D5NY9183.js → ListViewPage-BVKBeQAA.js} +13 -10
  30. package/dist/_chunks/{ListViewPage-D5NY9183.js.map → ListViewPage-BVKBeQAA.js.map} +1 -1
  31. package/dist/_chunks/{ListViewPage-FU2LBuhl.mjs → ListViewPage-HljQVnFH.mjs} +8 -5
  32. package/dist/_chunks/{ListViewPage-FU2LBuhl.mjs.map → ListViewPage-HljQVnFH.mjs.map} +1 -1
  33. package/dist/_chunks/{NoContentTypePage-BgQVE_Qb.js → NoContentTypePage-BV5zfDxr.js} +2 -2
  34. package/dist/_chunks/{NoContentTypePage-BgQVE_Qb.js.map → NoContentTypePage-BV5zfDxr.js.map} +1 -1
  35. package/dist/_chunks/{NoContentTypePage-DCKUkwb8.mjs → NoContentTypePage-BfHaSM-K.mjs} +2 -2
  36. package/dist/_chunks/{NoContentTypePage-DCKUkwb8.mjs.map → NoContentTypePage-BfHaSM-K.mjs.map} +1 -1
  37. package/dist/_chunks/{NoPermissionsPage-jqve7C8l.mjs → NoPermissionsPage-D6ze2nQL.mjs} +2 -2
  38. package/dist/_chunks/{NoPermissionsPage-jqve7C8l.mjs.map → NoPermissionsPage-D6ze2nQL.mjs.map} +1 -1
  39. package/dist/_chunks/{NoPermissionsPage-C5jwn70o.js → NoPermissionsPage-vdNpc6jb.js} +2 -2
  40. package/dist/_chunks/{NoPermissionsPage-C5jwn70o.js.map → NoPermissionsPage-vdNpc6jb.js.map} +1 -1
  41. package/dist/_chunks/{Preview-DaOihysv.js → Preview-DEHdENT1.js} +8 -15
  42. package/dist/_chunks/Preview-DEHdENT1.js.map +1 -0
  43. package/dist/_chunks/{Preview-BMYN548c.mjs → Preview-vfWOtPG5.mjs} +8 -15
  44. package/dist/_chunks/Preview-vfWOtPG5.mjs.map +1 -0
  45. package/dist/_chunks/{Relations-gscPkxjF.mjs → Relations-B7_hbF0w.mjs} +6 -5
  46. package/dist/_chunks/Relations-B7_hbF0w.mjs.map +1 -0
  47. package/dist/_chunks/{Relations-CTGM7Hv5.js → Relations-DcoOBejP.js} +6 -5
  48. package/dist/_chunks/Relations-DcoOBejP.js.map +1 -0
  49. package/dist/_chunks/{en-BzQmavmK.js → en-BR48D_RH.js} +3 -1
  50. package/dist/_chunks/{en-BzQmavmK.js.map → en-BR48D_RH.js.map} +1 -1
  51. package/dist/_chunks/{en-CSxLmrh1.mjs → en-D65uIF6Y.mjs} +3 -1
  52. package/dist/_chunks/{en-CSxLmrh1.mjs.map → en-D65uIF6Y.mjs.map} +1 -1
  53. package/dist/_chunks/{fr-B2Kyv8Z9.js → fr-C43IbhA_.js} +4 -1
  54. package/dist/_chunks/{fr-B2Kyv8Z9.js.map → fr-C43IbhA_.js.map} +1 -1
  55. package/dist/_chunks/{fr--pg5jUbt.mjs → fr-DBseuRuB.mjs} +4 -1
  56. package/dist/_chunks/{fr--pg5jUbt.mjs.map → fr-DBseuRuB.mjs.map} +1 -1
  57. package/dist/_chunks/{index-Ca7YWlAA.js → index-CxLSGwnk.js} +254 -57
  58. package/dist/_chunks/index-CxLSGwnk.js.map +1 -0
  59. package/dist/_chunks/{index-DqasUQ6Q.mjs → index-EH8ZtHd5.mjs} +273 -76
  60. package/dist/_chunks/index-EH8ZtHd5.mjs.map +1 -0
  61. package/dist/_chunks/{layout-W3clJSCy.mjs → layout-CxDMdJ13.mjs} +3 -3
  62. package/dist/_chunks/{layout-W3clJSCy.mjs.map → layout-CxDMdJ13.mjs.map} +1 -1
  63. package/dist/_chunks/{layout-BW80JSCd.js → layout-DSeUTfMv.js} +3 -3
  64. package/dist/_chunks/{layout-BW80JSCd.js.map → layout-DSeUTfMv.js.map} +1 -1
  65. package/dist/_chunks/{relations-BlDkoeWh.mjs → relations-B8_Uu38Q.mjs} +17 -3
  66. package/dist/_chunks/relations-B8_Uu38Q.mjs.map +1 -0
  67. package/dist/_chunks/{relations-C9Usz9k5.js → relations-S5nNKdN3.js} +16 -2
  68. package/dist/_chunks/relations-S5nNKdN3.js.map +1 -0
  69. package/dist/_chunks/{useDebounce-CtcjDB3L.js → usePrev-B9w_-eYc.js} +1 -14
  70. package/dist/_chunks/usePrev-B9w_-eYc.js.map +1 -0
  71. package/dist/_chunks/usePrev-DH6iah0A.mjs +16 -0
  72. package/dist/_chunks/usePrev-DH6iah0A.mjs.map +1 -0
  73. package/dist/admin/index.js +1 -1
  74. package/dist/admin/index.mjs +5 -5
  75. package/dist/admin/src/hooks/useDocument.d.ts +19 -2
  76. package/dist/admin/src/pages/EditView/components/FormLayout.d.ts +27 -0
  77. package/dist/admin/src/pages/EditView/utils/data.d.ts +1 -0
  78. package/dist/admin/src/preview/pages/Preview.d.ts +1 -1
  79. package/package.json +6 -7
  80. package/dist/_chunks/EditViewPage-B-kExt8C.js.map +0 -1
  81. package/dist/_chunks/EditViewPage-BPyVuPfM.mjs.map +0 -1
  82. package/dist/_chunks/Field-DPIsQRre.js.map +0 -1
  83. package/dist/_chunks/Field-Dltnt1km.mjs.map +0 -1
  84. package/dist/_chunks/Preview-BMYN548c.mjs.map +0 -1
  85. package/dist/_chunks/Preview-DaOihysv.js.map +0 -1
  86. package/dist/_chunks/Relations-CTGM7Hv5.js.map +0 -1
  87. package/dist/_chunks/Relations-gscPkxjF.mjs.map +0 -1
  88. package/dist/_chunks/index-Ca7YWlAA.js.map +0 -1
  89. package/dist/_chunks/index-DqasUQ6Q.mjs.map +0 -1
  90. package/dist/_chunks/relations-BlDkoeWh.mjs.map +0 -1
  91. package/dist/_chunks/relations-C9Usz9k5.js.map +0 -1
  92. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +0 -1
  93. package/dist/_chunks/useDebounce-DmuSJIF3.mjs +0 -29
  94. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +0 -1
@@ -1,17 +1,18 @@
1
- import { More, Cross, WarningCircle, ListPlus, Pencil, Trash, Check, CrossCircle, CheckCircle, ArrowsCounterClockwise, ChevronRight, Duplicate, ClockCounterClockwise, Feather } from "@strapi/icons";
1
+ import { More, Cross, WarningCircle, ListPlus, Pencil, Trash, Check, CheckCircle, ArrowsCounterClockwise, CrossCircle, ChevronRight, Duplicate, ClockCounterClockwise, Feather } from "@strapi/icons";
2
2
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
3
3
  import { useStrapiApp, createContext, useQueryParams, useAuth, useRBAC, Page, adminApi, translatedErrors, useNotification, useAPIErrorHandler, getYupValidationErrors, useForm, useTracking, useGuidedTour, BackButton, DescriptionComponentRenderer, useTable, Table } from "@strapi/admin/strapi-admin";
4
4
  import * as React from "react";
5
5
  import { lazy } from "react";
6
- import { Menu, Button, VisuallyHidden, Flex, Dialog, Modal, Typography, Radio, Status, Box, SingleSelect, SingleSelectOption, IconButton, Loader, Tooltip, LinkButton } from "@strapi/design-system";
6
+ import { Menu, Button, VisuallyHidden, Flex, Dialog, Modal, Typography, Radio, Status, Box, SingleSelect, SingleSelectOption, IconButton, RawTable, Loader, Tbody, Tr, Td, Tooltip, LinkButton } from "@strapi/design-system";
7
7
  import mapValues from "lodash/fp/mapValues";
8
8
  import { useIntl } from "react-intl";
9
9
  import { useParams, useNavigate, Navigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
10
10
  import { styled } from "styled-components";
11
11
  import * as yup from "yup";
12
12
  import { ValidationError } from "yup";
13
- import { stringify } from "qs";
13
+ import { generateNKeysBetween } from "fractional-indexing";
14
14
  import pipe from "lodash/fp/pipe";
15
+ import { stringify } from "qs";
15
16
  import { intervalToDuration, isPast } from "date-fns";
16
17
  import { createSlice, combineReducers } from "@reduxjs/toolkit";
17
18
  const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
@@ -166,6 +167,113 @@ const extractAndDedupeFields = (permissions = []) => permissions.flatMap((permis
166
167
  (field, index2, arr) => arr.indexOf(field) === index2 && typeof field === "string"
167
168
  );
168
169
  const removeNumericalStrings = (arr) => arr.filter((item) => isNaN(Number(item)));
170
+ const BLOCK_LIST_ATTRIBUTE_KEYS = ["__component", "__temp_key__"];
171
+ const traverseData = (predicate, transform) => (schema, components = {}) => (data = {}) => {
172
+ const traverse = (datum, attributes) => {
173
+ return Object.entries(datum).reduce((acc, [key, value]) => {
174
+ const attribute = attributes[key];
175
+ if (BLOCK_LIST_ATTRIBUTE_KEYS.includes(key) || value === null || value === void 0) {
176
+ acc[key] = value;
177
+ return acc;
178
+ }
179
+ if (attribute.type === "component") {
180
+ if (attribute.repeatable) {
181
+ const componentValue = predicate(attribute, value) ? transform(value, attribute) : value;
182
+ acc[key] = componentValue.map(
183
+ (componentData) => traverse(componentData, components[attribute.component]?.attributes ?? {})
184
+ );
185
+ } else {
186
+ const componentValue = predicate(attribute, value) ? transform(value, attribute) : value;
187
+ acc[key] = traverse(componentValue, components[attribute.component]?.attributes ?? {});
188
+ }
189
+ } else if (attribute.type === "dynamiczone") {
190
+ const dynamicZoneValue = predicate(attribute, value) ? transform(value, attribute) : value;
191
+ acc[key] = dynamicZoneValue.map(
192
+ (componentData) => traverse(componentData, components[componentData.__component]?.attributes ?? {})
193
+ );
194
+ } else if (predicate(attribute, value)) {
195
+ acc[key] = transform(value, attribute);
196
+ } else {
197
+ acc[key] = value;
198
+ }
199
+ return acc;
200
+ }, {});
201
+ };
202
+ return traverse(data, schema.attributes);
203
+ };
204
+ const removeProhibitedFields = (prohibitedFields) => traverseData(
205
+ (attribute) => prohibitedFields.includes(attribute.type),
206
+ () => ""
207
+ );
208
+ const prepareRelations = traverseData(
209
+ (attribute) => attribute.type === "relation",
210
+ () => ({
211
+ connect: [],
212
+ disconnect: []
213
+ })
214
+ );
215
+ const prepareTempKeys = traverseData(
216
+ (attribute) => attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone",
217
+ (data) => {
218
+ if (Array.isArray(data) && data.length > 0) {
219
+ const keys = generateNKeysBetween(void 0, void 0, data.length);
220
+ return data.map((datum, index2) => ({
221
+ ...datum,
222
+ __temp_key__: keys[index2]
223
+ }));
224
+ }
225
+ return data;
226
+ }
227
+ );
228
+ const removeFieldsThatDontExistOnSchema = (schema) => (data) => {
229
+ const schemaKeys = Object.keys(schema.attributes);
230
+ const dataKeys = Object.keys(data);
231
+ const keysToRemove = dataKeys.filter((key) => !schemaKeys.includes(key));
232
+ const revisedData = [...keysToRemove, ...DOCUMENT_META_FIELDS].reduce((acc, key) => {
233
+ delete acc[key];
234
+ return acc;
235
+ }, structuredClone(data));
236
+ return revisedData;
237
+ };
238
+ const removeNullValues = (data) => {
239
+ return Object.entries(data).reduce((acc, [key, value]) => {
240
+ if (value === null) {
241
+ return acc;
242
+ }
243
+ acc[key] = value;
244
+ return acc;
245
+ }, {});
246
+ };
247
+ const transformDocument = (schema, components = {}) => (document) => {
248
+ const transformations = pipe(
249
+ removeFieldsThatDontExistOnSchema(schema),
250
+ removeProhibitedFields(["password"])(schema, components),
251
+ removeNullValues,
252
+ prepareRelations(schema, components),
253
+ prepareTempKeys(schema, components)
254
+ );
255
+ return transformations(document);
256
+ };
257
+ const createDefaultForm = (contentType, components = {}) => {
258
+ const traverseSchema = (attributes) => {
259
+ return Object.entries(attributes).reduce((acc, [key, attribute]) => {
260
+ if ("default" in attribute) {
261
+ acc[key] = attribute.default;
262
+ } else if (attribute.type === "component" && attribute.required) {
263
+ const defaultComponentForm = traverseSchema(components[attribute.component].attributes);
264
+ if (attribute.repeatable) {
265
+ acc[key] = attribute.min ? [...Array(attribute.min).fill(defaultComponentForm)] : [];
266
+ } else {
267
+ acc[key] = defaultComponentForm;
268
+ }
269
+ } else if (attribute.type === "dynamiczone" && attribute.required) {
270
+ acc[key] = [];
271
+ }
272
+ return acc;
273
+ }, {});
274
+ };
275
+ return traverseSchema(contentType.attributes);
276
+ };
169
277
  const contentManagerApi = adminApi.enhanceEndpoints({
170
278
  addTagTypes: [
171
279
  "ComponentConfiguration",
@@ -1135,6 +1243,7 @@ const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, co
1135
1243
  const useDocument = (args, opts) => {
1136
1244
  const { toggleNotification } = useNotification();
1137
1245
  const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
1246
+ const { formatMessage } = useIntl();
1138
1247
  const {
1139
1248
  currentData: data,
1140
1249
  isLoading: isLoadingDocument,
@@ -1144,12 +1253,27 @@ const useDocument = (args, opts) => {
1144
1253
  ...opts,
1145
1254
  skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
1146
1255
  });
1256
+ const document = data?.data;
1257
+ const meta = data?.meta;
1147
1258
  const {
1148
1259
  components,
1149
1260
  schema,
1150
1261
  schemas,
1151
1262
  isLoading: isLoadingSchema
1152
1263
  } = useContentTypeSchema(args.model);
1264
+ const isSingleType = schema?.kind === "singleType";
1265
+ const getTitle = (mainField) => {
1266
+ if (mainField !== "id" && document?.[mainField]) {
1267
+ return document[mainField];
1268
+ }
1269
+ if (isSingleType && schema?.info.displayName) {
1270
+ return schema.info.displayName;
1271
+ }
1272
+ return formatMessage({
1273
+ id: "content-manager.containers.untitled",
1274
+ defaultMessage: "Untitled"
1275
+ });
1276
+ };
1153
1277
  React.useEffect(() => {
1154
1278
  if (error) {
1155
1279
  toggleNotification({
@@ -1165,14 +1289,14 @@ const useDocument = (args, opts) => {
1165
1289
  return createYupSchema(schema.attributes, components);
1166
1290
  }, [schema, components]);
1167
1291
  const validate = React.useCallback(
1168
- (document) => {
1292
+ (document2) => {
1169
1293
  if (!validationSchema) {
1170
1294
  throw new Error(
1171
1295
  "There is no validation schema generated, this is likely due to the schema not being loaded yet."
1172
1296
  );
1173
1297
  }
1174
1298
  try {
1175
- validationSchema.validateSync(document, { abortEarly: false, strict: true });
1299
+ validationSchema.validateSync(document2, { abortEarly: false, strict: true });
1176
1300
  return null;
1177
1301
  } catch (error2) {
1178
1302
  if (error2 instanceof ValidationError) {
@@ -1183,17 +1307,29 @@ const useDocument = (args, opts) => {
1183
1307
  },
1184
1308
  [validationSchema]
1185
1309
  );
1310
+ const getInitialFormValues = React.useCallback(
1311
+ (isCreatingDocument = false) => {
1312
+ if (!document && !isCreatingDocument && !isSingleType || !schema) {
1313
+ return void 0;
1314
+ }
1315
+ const form = document?.id ? document : createDefaultForm(schema, components);
1316
+ return transformDocument(schema, components)(form);
1317
+ },
1318
+ [document, isSingleType, schema, components]
1319
+ );
1186
1320
  const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
1187
1321
  const hasError = !!error;
1188
1322
  return {
1189
1323
  components,
1190
- document: data?.data,
1191
- meta: data?.meta,
1324
+ document,
1325
+ meta,
1192
1326
  isLoading,
1193
1327
  hasError,
1194
1328
  schema,
1195
1329
  schemas,
1196
- validate
1330
+ validate,
1331
+ getTitle,
1332
+ getInitialFormValues
1197
1333
  };
1198
1334
  };
1199
1335
  const useDoc = () => {
@@ -1694,7 +1830,7 @@ const useDocumentActions = () => {
1694
1830
  };
1695
1831
  };
1696
1832
  const ProtectedHistoryPage = React.lazy(
1697
- () => import("./History-04ChQ4pl.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1833
+ () => import("./History-CcmSn3Mj.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1698
1834
  );
1699
1835
  const routes$2 = [
1700
1836
  {
@@ -1707,7 +1843,7 @@ const routes$2 = [
1707
1843
  }
1708
1844
  ];
1709
1845
  const ProtectedPreviewPage = React.lazy(
1710
- () => import("./Preview-BMYN548c.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
1846
+ () => import("./Preview-vfWOtPG5.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
1711
1847
  );
1712
1848
  const routes$1 = [
1713
1849
  {
@@ -1720,31 +1856,31 @@ const routes$1 = [
1720
1856
  }
1721
1857
  ];
1722
1858
  const ProtectedEditViewPage = lazy(
1723
- () => import("./EditViewPage-BPyVuPfM.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1859
+ () => import("./EditViewPage-Bcnff6Vd.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1724
1860
  );
1725
1861
  const ProtectedListViewPage = lazy(
1726
- () => import("./ListViewPage-FU2LBuhl.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1862
+ () => import("./ListViewPage-HljQVnFH.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1727
1863
  );
1728
1864
  const ProtectedListConfiguration = lazy(
1729
- () => import("./ListConfigurationPage-BYqPYLSU.mjs").then((mod) => ({
1865
+ () => import("./ListConfigurationPage-BPvzENJJ.mjs").then((mod) => ({
1730
1866
  default: mod.ProtectedListConfiguration
1731
1867
  }))
1732
1868
  );
1733
1869
  const ProtectedEditConfigurationPage = lazy(
1734
- () => import("./EditConfigurationPage-DsPR2DVk.mjs").then((mod) => ({
1870
+ () => import("./EditConfigurationPage-D1nvB7Br.mjs").then((mod) => ({
1735
1871
  default: mod.ProtectedEditConfigurationPage
1736
1872
  }))
1737
1873
  );
1738
1874
  const ProtectedComponentConfigurationPage = lazy(
1739
- () => import("./ComponentConfigurationPage-CtIa3aa2.mjs").then((mod) => ({
1875
+ () => import("./ComponentConfigurationPage-D4H-v0et.mjs").then((mod) => ({
1740
1876
  default: mod.ProtectedComponentConfigurationPage
1741
1877
  }))
1742
1878
  );
1743
1879
  const NoPermissions = lazy(
1744
- () => import("./NoPermissionsPage-jqve7C8l.mjs").then((mod) => ({ default: mod.NoPermissions }))
1880
+ () => import("./NoPermissionsPage-D6ze2nQL.mjs").then((mod) => ({ default: mod.NoPermissions }))
1745
1881
  );
1746
1882
  const NoContentType = lazy(
1747
- () => import("./NoContentTypePage-DCKUkwb8.mjs").then((mod) => ({ default: mod.NoContentType }))
1883
+ () => import("./NoContentTypePage-BfHaSM-K.mjs").then((mod) => ({ default: mod.NoContentType }))
1748
1884
  );
1749
1885
  const CollectionTypePages = () => {
1750
1886
  const { collectionType } = useParams();
@@ -3139,7 +3275,7 @@ const ConfirmBulkActionDialog = ({
3139
3275
  ] })
3140
3276
  ] }) });
3141
3277
  };
3142
- const BoldChunk$1 = (chunks) => /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: chunks });
3278
+ const BoldChunk = (chunks) => /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: chunks });
3143
3279
  const ConfirmDialogPublishAll = ({
3144
3280
  isOpen,
3145
3281
  onToggleDialog,
@@ -3188,7 +3324,7 @@ const ConfirmDialogPublishAll = ({
3188
3324
  defaultMessage: "<b>{count} {count, plural, one { relation } other { relations } } out of {entities} { entities, plural, one { entry } other { entries } } {count, plural, one { is } other { are } }</b> not published yet and might lead to unexpected behavior. "
3189
3325
  },
3190
3326
  {
3191
- b: BoldChunk$1,
3327
+ b: BoldChunk,
3192
3328
  count: countDraftRelations,
3193
3329
  entities: selectedEntries.length
3194
3330
  }
@@ -3227,6 +3363,16 @@ const ConfirmDialogPublishAll = ({
3227
3363
  const TypographyMaxWidth = styled(Typography)`
3228
3364
  max-width: 300px;
3229
3365
  `;
3366
+ const TableComponent = styled(RawTable)`
3367
+ width: 100%;
3368
+ table-layout: fixed;
3369
+ td:first-child {
3370
+ border-right: 1px solid ${({ theme }) => theme.colors.neutral150};
3371
+ }
3372
+ td:first-of-type {
3373
+ padding: ${({ theme }) => theme.spaces[4]};
3374
+ }
3375
+ `;
3230
3376
  const formatErrorMessages = (errors, parentKey, formatMessage) => {
3231
3377
  const messages = [];
3232
3378
  Object.entries(errors).forEach(([key, value]) => {
@@ -3331,7 +3477,7 @@ const SelectedEntriesTableContent = ({
3331
3477
  )
3332
3478
  ] }),
3333
3479
  /* @__PURE__ */ jsx(Table.Loading, {}),
3334
- /* @__PURE__ */ jsx(Table.Body, { children: rowsToDisplay.map((row, index2) => /* @__PURE__ */ jsxs(Table.Row, { children: [
3480
+ /* @__PURE__ */ jsx(Table.Body, { children: rowsToDisplay.map((row) => /* @__PURE__ */ jsxs(Table.Row, { children: [
3335
3481
  /* @__PURE__ */ jsx(Table.CheckboxCell, { id: row.id }),
3336
3482
  /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Typography, { children: row.id }) }),
3337
3483
  shouldDisplayMainField && /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Typography, { children: row[mainField] }) }),
@@ -3371,7 +3517,73 @@ const SelectedEntriesTableContent = ({
3371
3517
  ] }, row.id)) })
3372
3518
  ] });
3373
3519
  };
3374
- const BoldChunk = (chunks) => /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: chunks });
3520
+ const PublicationStatusSummary = ({ count, icon, message }) => {
3521
+ return /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", flex: 1, gap: 3, children: [
3522
+ /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
3523
+ icon,
3524
+ /* @__PURE__ */ jsx(Typography, { children: message })
3525
+ ] }),
3526
+ /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: count })
3527
+ ] });
3528
+ };
3529
+ const PublicationStatusGrid = ({
3530
+ entriesReadyToPublishCount,
3531
+ entriesPublishedCount,
3532
+ entriesModifiedCount,
3533
+ entriesWithErrorsCount
3534
+ }) => {
3535
+ const { formatMessage } = useIntl();
3536
+ return /* @__PURE__ */ jsx(Box, { hasRadius: true, borderColor: "neutral150", children: /* @__PURE__ */ jsx(TableComponent, { colCount: 2, rowCount: 2, children: /* @__PURE__ */ jsxs(Tbody, { children: [
3537
+ /* @__PURE__ */ jsxs(Tr, { children: [
3538
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
3539
+ PublicationStatusSummary,
3540
+ {
3541
+ count: entriesReadyToPublishCount,
3542
+ icon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
3543
+ message: formatMessage({
3544
+ id: "app.utils.ready-to-publish",
3545
+ defaultMessage: "Ready to publish"
3546
+ })
3547
+ }
3548
+ ) }),
3549
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
3550
+ PublicationStatusSummary,
3551
+ {
3552
+ count: entriesPublishedCount,
3553
+ icon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
3554
+ message: formatMessage({
3555
+ id: "app.utils.already-published",
3556
+ defaultMessage: "Already published"
3557
+ })
3558
+ }
3559
+ ) })
3560
+ ] }),
3561
+ /* @__PURE__ */ jsxs(Tr, { children: [
3562
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
3563
+ PublicationStatusSummary,
3564
+ {
3565
+ count: entriesModifiedCount,
3566
+ icon: /* @__PURE__ */ jsx(ArrowsCounterClockwise, { fill: "alternative600" }),
3567
+ message: formatMessage({
3568
+ id: "content-manager.bulk-publish.modified",
3569
+ defaultMessage: "Ready to publish changes"
3570
+ })
3571
+ }
3572
+ ) }),
3573
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
3574
+ PublicationStatusSummary,
3575
+ {
3576
+ count: entriesWithErrorsCount,
3577
+ icon: /* @__PURE__ */ jsx(CrossCircle, { fill: "danger600" }),
3578
+ message: formatMessage({
3579
+ id: "content-manager.bulk-publish.waiting-for-action",
3580
+ defaultMessage: "Waiting for action"
3581
+ })
3582
+ }
3583
+ ) })
3584
+ ] })
3585
+ ] }) }) });
3586
+ };
3375
3587
  const SelectedEntriesModalContent = ({
3376
3588
  listViewSelectedEntries,
3377
3589
  toggleModal,
@@ -3430,7 +3642,6 @@ const SelectedEntriesModalContent = ({
3430
3642
  validationErrors: {}
3431
3643
  };
3432
3644
  }, [components, data, schema]);
3433
- const [publishedCount, setPublishedCount] = React.useState(0);
3434
3645
  const [isDialogOpen, setIsDialogOpen] = React.useState(false);
3435
3646
  const { publishMany: bulkPublishAction } = useDocumentActions();
3436
3647
  const [, { isLoading: isSubmittingForm }] = usePublishManyDocumentsMutation();
@@ -3442,53 +3653,36 @@ const SelectedEntriesModalContent = ({
3442
3653
  const selectedEntriesWithErrorsCount = selectedEntries.filter(
3443
3654
  ({ documentId }) => validationErrors[documentId]
3444
3655
  ).length;
3445
- const selectedEntriesPublished = selectedEntries.filter(
3656
+ const selectedEntriesPublishedCount = selectedEntries.filter(
3446
3657
  ({ status }) => status === "published"
3447
3658
  ).length;
3448
- const selectedEntriesWithNoErrorsCount = selectedEntries.length - selectedEntriesWithErrorsCount - selectedEntriesPublished;
3659
+ const selectedEntriesModifiedCount = selectedEntries.filter(
3660
+ ({ status, documentId }) => status === "modified" && !validationErrors[documentId]
3661
+ ).length;
3662
+ const selectedEntriesWithNoErrorsCount = selectedEntries.length - selectedEntriesWithErrorsCount - selectedEntriesPublishedCount;
3449
3663
  const toggleDialog = () => setIsDialogOpen((prev) => !prev);
3450
3664
  const handleConfirmBulkPublish = async () => {
3451
3665
  toggleDialog();
3452
3666
  const res = await bulkPublishAction({ model, documentIds: entriesToPublish, params });
3453
3667
  if (!("error" in res)) {
3454
- setPublishedCount(res.count);
3455
3668
  const unpublishedEntries = rows.filter((row) => {
3456
3669
  return !entriesToPublish.includes(row.documentId);
3457
3670
  });
3458
3671
  setListViewSelectedDocuments(unpublishedEntries);
3459
3672
  }
3460
3673
  };
3461
- const getFormattedCountMessage = () => {
3462
- if (publishedCount) {
3463
- return formatMessage(
3464
- {
3465
- id: getTranslation("containers.list.selectedEntriesModal.publishedCount"),
3466
- defaultMessage: "<b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} published. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action."
3467
- },
3468
- {
3469
- publishedCount,
3470
- withErrorsCount: selectedEntriesWithErrorsCount,
3471
- b: BoldChunk
3472
- }
3473
- );
3474
- }
3475
- return formatMessage(
3476
- {
3477
- id: getTranslation("containers.list.selectedEntriesModal.selectedCount"),
3478
- defaultMessage: "<b>{alreadyPublishedCount}</b> {alreadyPublishedCount, plural, =0 {entries} one {entry} other {entries}} already published. <b>{readyToPublishCount}</b> {readyToPublishCount, plural, =0 {entries} one {entry} other {entries}} ready to publish. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action."
3479
- },
3480
- {
3481
- readyToPublishCount: selectedEntriesWithNoErrorsCount,
3482
- withErrorsCount: selectedEntriesWithErrorsCount,
3483
- alreadyPublishedCount: selectedEntriesPublished,
3484
- b: BoldChunk
3485
- }
3486
- );
3487
- };
3488
3674
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3489
3675
  /* @__PURE__ */ jsxs(Modal.Body, { children: [
3490
- /* @__PURE__ */ jsx(Typography, { children: getFormattedCountMessage() }),
3491
- /* @__PURE__ */ jsx(Box, { marginTop: 5, children: /* @__PURE__ */ jsx(
3676
+ /* @__PURE__ */ jsx(
3677
+ PublicationStatusGrid,
3678
+ {
3679
+ entriesReadyToPublishCount: selectedEntriesWithNoErrorsCount - selectedEntriesModifiedCount,
3680
+ entriesPublishedCount: selectedEntriesPublishedCount,
3681
+ entriesModifiedCount: selectedEntriesModifiedCount,
3682
+ entriesWithErrorsCount: selectedEntriesWithErrorsCount
3683
+ }
3684
+ ),
3685
+ /* @__PURE__ */ jsx(Box, { marginTop: 7, children: /* @__PURE__ */ jsx(
3492
3686
  SelectedEntriesTableContent,
3493
3687
  {
3494
3688
  isPublishing: isSubmittingForm,
@@ -3509,7 +3703,7 @@ const SelectedEntriesModalContent = ({
3509
3703
  Button,
3510
3704
  {
3511
3705
  onClick: toggleDialog,
3512
- disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount || selectedEntriesPublished === selectedEntries.length || isLoading,
3706
+ disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount || selectedEntriesPublishedCount === selectedEntries.length || isLoading,
3513
3707
  loading: isSubmittingForm,
3514
3708
  children: formatMessage({ id: "app.utils.publish", defaultMessage: "Publish" })
3515
3709
  }
@@ -4199,7 +4393,7 @@ const index = {
4199
4393
  app.router.addRoute({
4200
4394
  path: "content-manager/*",
4201
4395
  lazy: async () => {
4202
- const { Layout } = await import("./layout-W3clJSCy.mjs");
4396
+ const { Layout } = await import("./layout-CxDMdJ13.mjs");
4203
4397
  return {
4204
4398
  Component: Layout
4205
4399
  };
@@ -4219,7 +4413,7 @@ const index = {
4219
4413
  async registerTrads({ locales }) {
4220
4414
  const importedTrads = await Promise.all(
4221
4415
  locales.map((locale) => {
4222
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-CSxLmrh1.mjs"), "./translations/es.json": () => import("./es-D34tqjMw.mjs"), "./translations/eu.json": () => import("./eu-CdALomew.mjs"), "./translations/fr.json": () => import("./fr--pg5jUbt.mjs"), "./translations/gu.json": () => import("./gu-CNpaMDpH.mjs"), "./translations/hi.json": () => import("./hi-Dwvd04m3.mjs"), "./translations/hu.json": () => import("./hu-CeYvaaO0.mjs"), "./translations/id.json": () => import("./id-BtwA9WJT.mjs"), "./translations/it.json": () => import("./it-BrVPqaf1.mjs"), "./translations/ja.json": () => import("./ja-BHqhDq4V.mjs"), "./translations/ko.json": () => import("./ko-HVQRlfUI.mjs"), "./translations/ml.json": () => import("./ml-BihZwQit.mjs"), "./translations/ms.json": () => import("./ms-m_WjyWx7.mjs"), "./translations/nl.json": () => import("./nl-D4R9gHx5.mjs"), "./translations/pl.json": () => import("./pl-sbx9mSt_.mjs"), "./translations/pt-BR.json": () => import("./pt-BR-C71iDxnh.mjs"), "./translations/pt.json": () => import("./pt-BsaFvS8-.mjs"), "./translations/ru.json": () => import("./ru-BE6A4Exp.mjs"), "./translations/sa.json": () => import("./sa-Dag0k-Z8.mjs"), "./translations/sk.json": () => import("./sk-BFg-R8qJ.mjs"), "./translations/sv.json": () => import("./sv-CUnfWGsh.mjs"), "./translations/th.json": () => import("./th-BqbI8lIT.mjs"), "./translations/tr.json": () => import("./tr-CgeK3wJM.mjs"), "./translations/uk.json": () => import("./uk-CR-zDhAY.mjs"), "./translations/vi.json": () => import("./vi-DUXIk_fw.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-BPQcRIyH.mjs"), "./translations/zh.json": () => import("./zh-BWZspA60.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
4416
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-D65uIF6Y.mjs"), "./translations/es.json": () => import("./es-D34tqjMw.mjs"), "./translations/eu.json": () => import("./eu-CdALomew.mjs"), "./translations/fr.json": () => import("./fr-DBseuRuB.mjs"), "./translations/gu.json": () => import("./gu-CNpaMDpH.mjs"), "./translations/hi.json": () => import("./hi-Dwvd04m3.mjs"), "./translations/hu.json": () => import("./hu-CeYvaaO0.mjs"), "./translations/id.json": () => import("./id-BtwA9WJT.mjs"), "./translations/it.json": () => import("./it-BrVPqaf1.mjs"), "./translations/ja.json": () => import("./ja-BHqhDq4V.mjs"), "./translations/ko.json": () => import("./ko-HVQRlfUI.mjs"), "./translations/ml.json": () => import("./ml-BihZwQit.mjs"), "./translations/ms.json": () => import("./ms-m_WjyWx7.mjs"), "./translations/nl.json": () => import("./nl-D4R9gHx5.mjs"), "./translations/pl.json": () => import("./pl-sbx9mSt_.mjs"), "./translations/pt-BR.json": () => import("./pt-BR-C71iDxnh.mjs"), "./translations/pt.json": () => import("./pt-BsaFvS8-.mjs"), "./translations/ru.json": () => import("./ru-BE6A4Exp.mjs"), "./translations/sa.json": () => import("./sa-Dag0k-Z8.mjs"), "./translations/sk.json": () => import("./sk-BFg-R8qJ.mjs"), "./translations/sv.json": () => import("./sv-CUnfWGsh.mjs"), "./translations/th.json": () => import("./th-BqbI8lIT.mjs"), "./translations/tr.json": () => import("./tr-CgeK3wJM.mjs"), "./translations/uk.json": () => import("./uk-CR-zDhAY.mjs"), "./translations/vi.json": () => import("./vi-DUXIk_fw.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-BPQcRIyH.mjs"), "./translations/zh.json": () => import("./zh-BWZspA60.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
4223
4417
  return {
4224
4418
  data: prefixPluginTranslations(data, PLUGIN_ID),
4225
4419
  locale
@@ -4236,24 +4430,27 @@ const index = {
4236
4430
  }
4237
4431
  };
4238
4432
  export {
4239
- ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD as A,
4433
+ useUpdateContentTypeConfigurationMutation as A,
4240
4434
  BulkActionsRenderer as B,
4241
4435
  COLLECTION_TYPES as C,
4242
4436
  DocumentStatus as D,
4243
- extractContentTypeComponents as E,
4244
- DEFAULT_SETTINGS as F,
4245
- convertEditLayoutToFieldLayouts as G,
4437
+ ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD as E,
4438
+ extractContentTypeComponents as F,
4439
+ DEFAULT_SETTINGS as G,
4246
4440
  HOOKS as H,
4247
4441
  InjectionZone as I,
4248
- useDocument as J,
4249
- useGetPreviewUrlQuery as K,
4250
- index as L,
4251
- useContentManagerContext as M,
4252
- useDocumentActions as N,
4442
+ convertEditLayoutToFieldLayouts as J,
4443
+ removeFieldsThatDontExistOnSchema as K,
4444
+ prepareTempKeys as L,
4445
+ useDocument as M,
4446
+ useGetPreviewUrlQuery as N,
4447
+ index as O,
4253
4448
  Panels as P,
4449
+ useContentManagerContext as Q,
4254
4450
  RelativeTime as R,
4255
4451
  SINGLE_TYPES as S,
4256
4452
  TableActions as T,
4453
+ useDocumentActions as U,
4257
4454
  useGetInitialDataQuery as a,
4258
4455
  useGetAllContentTypeSettingsQuery as b,
4259
4456
  useDoc as c,
@@ -4266,19 +4463,19 @@ export {
4266
4463
  Header as j,
4267
4464
  PERMISSIONS as k,
4268
4465
  DocumentRBAC as l,
4269
- DOCUMENT_META_FIELDS as m,
4270
- CLONE_PATH as n,
4271
- useDocLayout as o,
4466
+ useDocLayout as m,
4467
+ createDefaultForm as n,
4468
+ CLONE_PATH as o,
4272
4469
  useGetContentTypeConfigurationQuery as p,
4273
4470
  CREATOR_FIELDS as q,
4274
4471
  getMainField as r,
4275
4472
  setInitialData as s,
4276
- getDisplayName as t,
4473
+ transformDocument as t,
4277
4474
  useContentTypeSchema as u,
4278
- checkIfAttributeIsDisplayable as v,
4279
- useGetAllDocumentsQuery as w,
4280
- convertListLayoutToFieldLayouts as x,
4281
- capitalise as y,
4282
- useUpdateContentTypeConfigurationMutation as z
4475
+ getDisplayName as v,
4476
+ checkIfAttributeIsDisplayable as w,
4477
+ useGetAllDocumentsQuery as x,
4478
+ convertListLayoutToFieldLayouts as y,
4479
+ capitalise as z
4283
4480
  };
4284
- //# sourceMappingURL=index-DqasUQ6Q.mjs.map
4481
+ //# sourceMappingURL=index-EH8ZtHd5.mjs.map