@strapi/content-manager 0.0.0-experimental.8c83c87960f2f5ddf95ae2f0acf849052f4a9ab4 → 0.0.0-experimental.8e4302929d7fe147203ed0266450d0a565c69660

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 (141) hide show
  1. package/dist/_chunks/{ComponentConfigurationPage-BgCLcjXO.mjs → ComponentConfigurationPage-D4H-v0et.mjs} +3 -3
  2. package/dist/_chunks/{ComponentConfigurationPage-BgCLcjXO.mjs.map → ComponentConfigurationPage-D4H-v0et.mjs.map} +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-DywpTZeV.js → ComponentConfigurationPage-DdkVGfXC.js} +3 -3
  4. package/dist/_chunks/{ComponentConfigurationPage-DywpTZeV.js.map → ComponentConfigurationPage-DdkVGfXC.js.map} +1 -1
  5. package/dist/_chunks/{EditConfigurationPage-BNjOAHNS.mjs → EditConfigurationPage-D1nvB7Br.mjs} +3 -3
  6. package/dist/_chunks/{EditConfigurationPage-BNjOAHNS.mjs.map → EditConfigurationPage-D1nvB7Br.mjs.map} +1 -1
  7. package/dist/_chunks/{EditConfigurationPage-CxRlP5if.js → EditConfigurationPage-LYEvR4fW.js} +3 -3
  8. package/dist/_chunks/{EditConfigurationPage-CxRlP5if.js.map → EditConfigurationPage-LYEvR4fW.js.map} +1 -1
  9. package/dist/_chunks/{EditViewPage-CD_hqc1J.mjs → EditViewPage-Bcnff6Vd.mjs} +11 -74
  10. package/dist/_chunks/EditViewPage-Bcnff6Vd.mjs.map +1 -0
  11. package/dist/_chunks/{EditViewPage-BRewdTqE.js → EditViewPage-DqelJ9UK.js} +13 -76
  12. package/dist/_chunks/EditViewPage-DqelJ9UK.js.map +1 -0
  13. package/dist/_chunks/{Form-C_Gwv8P_.js → Form-CnHfBeiB.js} +2 -2
  14. package/dist/_chunks/{Form-C_Gwv8P_.js.map → Form-CnHfBeiB.js.map} +1 -1
  15. package/dist/_chunks/{Form-Czi0cf_2.mjs → Form-CzPCJi3B.mjs} +2 -2
  16. package/dist/_chunks/{Form-Czi0cf_2.mjs.map → Form-CzPCJi3B.mjs.map} +1 -1
  17. package/dist/_chunks/{History-CIQHyi4T.mjs → History-CcmSn3Mj.mjs} +32 -8
  18. package/dist/_chunks/History-CcmSn3Mj.mjs.map +1 -0
  19. package/dist/_chunks/{History-C1TKAig-.js → History-zArjENzj.js} +43 -19
  20. package/dist/_chunks/History-zArjENzj.js.map +1 -0
  21. package/dist/_chunks/{Field-DwvmENVf.js → Input-CDHKQd7o.js} +1300 -1276
  22. package/dist/_chunks/Input-CDHKQd7o.js.map +1 -0
  23. package/dist/_chunks/{Field-BPkQ-3Ku.mjs → Input-aV8SSoTa.mjs} +1218 -1195
  24. package/dist/_chunks/Input-aV8SSoTa.mjs.map +1 -0
  25. package/dist/_chunks/{ListConfigurationPage-DcZsfyEL.mjs → ListConfigurationPage-BPvzENJJ.mjs} +2 -2
  26. package/dist/_chunks/{ListConfigurationPage-DcZsfyEL.mjs.map → ListConfigurationPage-BPvzENJJ.mjs.map} +1 -1
  27. package/dist/_chunks/{ListConfigurationPage-D-NGRLYu.js → ListConfigurationPage-ByZAO_9H.js} +2 -2
  28. package/dist/_chunks/{ListConfigurationPage-D-NGRLYu.js.map → ListConfigurationPage-ByZAO_9H.js.map} +1 -1
  29. package/dist/_chunks/{ListViewPage-xv5IQoZp.js → ListViewPage-BVKBeQAA.js} +13 -10
  30. package/dist/_chunks/{ListViewPage-xv5IQoZp.js.map → ListViewPage-BVKBeQAA.js.map} +1 -1
  31. package/dist/_chunks/{ListViewPage-C10McTK1.mjs → ListViewPage-HljQVnFH.mjs} +8 -5
  32. package/dist/_chunks/{ListViewPage-C10McTK1.mjs.map → ListViewPage-HljQVnFH.mjs.map} +1 -1
  33. package/dist/_chunks/{NoContentTypePage-Dzw5Yj5u.js → NoContentTypePage-BV5zfDxr.js} +2 -2
  34. package/dist/_chunks/{NoContentTypePage-Dzw5Yj5u.js.map → NoContentTypePage-BV5zfDxr.js.map} +1 -1
  35. package/dist/_chunks/{NoContentTypePage-CPc0Cd3S.mjs → NoContentTypePage-BfHaSM-K.mjs} +2 -2
  36. package/dist/_chunks/{NoContentTypePage-CPc0Cd3S.mjs.map → NoContentTypePage-BfHaSM-K.mjs.map} +1 -1
  37. package/dist/_chunks/{NoPermissionsPage-wfPBh2_0.mjs → NoPermissionsPage-D6ze2nQL.mjs} +2 -2
  38. package/dist/_chunks/{NoPermissionsPage-wfPBh2_0.mjs.map → NoPermissionsPage-D6ze2nQL.mjs.map} +1 -1
  39. package/dist/_chunks/{NoPermissionsPage-DAe5CDCC.js → NoPermissionsPage-vdNpc6jb.js} +2 -2
  40. package/dist/_chunks/{NoPermissionsPage-DAe5CDCC.js.map → NoPermissionsPage-vdNpc6jb.js.map} +1 -1
  41. package/dist/_chunks/{Preview-B7LyGT_b.js → Preview-DEHdENT1.js} +29 -14
  42. package/dist/_chunks/Preview-DEHdENT1.js.map +1 -0
  43. package/dist/_chunks/{Preview-BVFFm7uB.mjs → Preview-vfWOtPG5.mjs} +30 -15
  44. package/dist/_chunks/Preview-vfWOtPG5.mjs.map +1 -0
  45. package/dist/_chunks/{Relations-JPhWxk-s.mjs → Relations-B7_hbF0w.mjs} +6 -5
  46. package/dist/_chunks/Relations-B7_hbF0w.mjs.map +1 -0
  47. package/dist/_chunks/{Relations-BmYR1AjY.js → Relations-DcoOBejP.js} +6 -5
  48. package/dist/_chunks/Relations-DcoOBejP.js.map +1 -0
  49. package/dist/_chunks/{en-BK8Xyl5I.js → en-BR48D_RH.js} +9 -2
  50. package/dist/_chunks/{en-BK8Xyl5I.js.map → en-BR48D_RH.js.map} +1 -1
  51. package/dist/_chunks/{en-Dtk_ot79.mjs → en-D65uIF6Y.mjs} +9 -2
  52. package/dist/_chunks/{en-Dtk_ot79.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-C2Q_PLWj.js → index-CxLSGwnk.js} +433 -157
  58. package/dist/_chunks/index-CxLSGwnk.js.map +1 -0
  59. package/dist/_chunks/{index-DLIkNVnQ.mjs → index-EH8ZtHd5.mjs} +452 -176
  60. package/dist/_chunks/index-EH8ZtHd5.mjs.map +1 -0
  61. package/dist/_chunks/{layout-qE8qkNH_.mjs → layout-CxDMdJ13.mjs} +3 -3
  62. package/dist/_chunks/{layout-qE8qkNH_.mjs.map → layout-CxDMdJ13.mjs.map} +1 -1
  63. package/dist/_chunks/{layout-7AsWJzZJ.js → layout-DSeUTfMv.js} +3 -3
  64. package/dist/_chunks/{layout-7AsWJzZJ.js.map → layout-DSeUTfMv.js.map} +1 -1
  65. package/dist/_chunks/{relations-BjHH_1Am.mjs → relations-B8_Uu38Q.mjs} +17 -3
  66. package/dist/_chunks/relations-B8_Uu38Q.mjs.map +1 -0
  67. package/dist/_chunks/{relations-EifVzf_2.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 +2 -1
  74. package/dist/admin/index.js.map +1 -1
  75. package/dist/admin/index.mjs +6 -5
  76. package/dist/admin/src/content-manager.d.ts +3 -2
  77. package/dist/admin/src/exports.d.ts +1 -0
  78. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  79. package/dist/admin/src/hooks/useDocument.d.ts +19 -2
  80. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
  81. package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +1 -1
  82. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
  83. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
  84. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
  85. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +4 -1
  86. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +4 -1
  87. package/dist/admin/src/pages/EditView/components/FormLayout.d.ts +27 -0
  88. package/dist/admin/src/pages/EditView/utils/data.d.ts +1 -0
  89. package/dist/admin/src/preview/pages/Preview.d.ts +1 -1
  90. package/dist/admin/src/preview/services/preview.d.ts +1 -1
  91. package/dist/admin/src/services/api.d.ts +1 -1
  92. package/dist/admin/src/services/components.d.ts +2 -2
  93. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  94. package/dist/admin/src/services/documents.d.ts +16 -16
  95. package/dist/admin/src/services/init.d.ts +1 -1
  96. package/dist/admin/src/services/relations.d.ts +2 -2
  97. package/dist/admin/src/services/uid.d.ts +3 -3
  98. package/dist/server/index.js +156 -142
  99. package/dist/server/index.js.map +1 -1
  100. package/dist/server/index.mjs +157 -143
  101. package/dist/server/index.mjs.map +1 -1
  102. package/dist/server/src/controllers/utils/metadata.d.ts +1 -0
  103. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  104. package/dist/server/src/history/controllers/history-version.d.ts +1 -1
  105. package/dist/server/src/history/controllers/history-version.d.ts.map +1 -1
  106. package/dist/server/src/history/services/history.d.ts +3 -3
  107. package/dist/server/src/history/services/history.d.ts.map +1 -1
  108. package/dist/server/src/history/services/utils.d.ts +6 -10
  109. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  110. package/dist/server/src/index.d.ts +3 -2
  111. package/dist/server/src/index.d.ts.map +1 -1
  112. package/dist/server/src/preview/index.d.ts.map +1 -1
  113. package/dist/server/src/services/document-metadata.d.ts +4 -2
  114. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  115. package/dist/server/src/services/index.d.ts +3 -2
  116. package/dist/server/src/services/index.d.ts.map +1 -1
  117. package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
  118. package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
  119. package/dist/server/src/services/utils/populate.d.ts +2 -2
  120. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  121. package/package.json +8 -7
  122. package/dist/_chunks/EditViewPage-BRewdTqE.js.map +0 -1
  123. package/dist/_chunks/EditViewPage-CD_hqc1J.mjs.map +0 -1
  124. package/dist/_chunks/Field-BPkQ-3Ku.mjs.map +0 -1
  125. package/dist/_chunks/Field-DwvmENVf.js.map +0 -1
  126. package/dist/_chunks/History-C1TKAig-.js.map +0 -1
  127. package/dist/_chunks/History-CIQHyi4T.mjs.map +0 -1
  128. package/dist/_chunks/Preview-B7LyGT_b.js.map +0 -1
  129. package/dist/_chunks/Preview-BVFFm7uB.mjs.map +0 -1
  130. package/dist/_chunks/Relations-BmYR1AjY.js.map +0 -1
  131. package/dist/_chunks/Relations-JPhWxk-s.mjs.map +0 -1
  132. package/dist/_chunks/index-C2Q_PLWj.js.map +0 -1
  133. package/dist/_chunks/index-DLIkNVnQ.mjs.map +0 -1
  134. package/dist/_chunks/relations-BjHH_1Am.mjs.map +0 -1
  135. package/dist/_chunks/relations-EifVzf_2.js.map +0 -1
  136. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +0 -1
  137. package/dist/_chunks/useDebounce-DmuSJIF3.mjs +0 -29
  138. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +0 -1
  139. package/dist/admin/src/preview/constants.d.ts +0 -1
  140. package/dist/server/src/preview/constants.d.ts +0 -2
  141. package/dist/server/src/preview/constants.d.ts.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",
@@ -175,7 +283,8 @@ const contentManagerApi = adminApi.enhanceEndpoints({
175
283
  "InitialData",
176
284
  "HistoryVersion",
177
285
  "Relations",
178
- "UidAvailability"
286
+ "UidAvailability",
287
+ "RecentDocumentList"
179
288
  ]
180
289
  });
181
290
  const documentApi = contentManagerApi.injectEndpoints({
@@ -193,7 +302,7 @@ const documentApi = contentManagerApi.injectEndpoints({
193
302
  if (error) {
194
303
  return [];
195
304
  }
196
- return [{ type: "Document", id: `${model}_LIST` }];
305
+ return [{ type: "Document", id: `${model}_LIST` }, "RecentDocumentList"];
197
306
  }
198
307
  }),
199
308
  cloneDocument: builder.mutation({
@@ -207,7 +316,8 @@ const documentApi = contentManagerApi.injectEndpoints({
207
316
  }),
208
317
  invalidatesTags: (_result, _error, { model }) => [
209
318
  { type: "Document", id: `${model}_LIST` },
210
- { type: "UidAvailability", id: model }
319
+ { type: "UidAvailability", id: model },
320
+ "RecentDocumentList"
211
321
  ]
212
322
  }),
213
323
  /**
@@ -226,8 +336,21 @@ const documentApi = contentManagerApi.injectEndpoints({
226
336
  invalidatesTags: (result, _error, { model }) => [
227
337
  { type: "Document", id: `${model}_LIST` },
228
338
  "Relations",
229
- { type: "UidAvailability", id: model }
230
- ]
339
+ { type: "UidAvailability", id: model },
340
+ "RecentDocumentList"
341
+ ],
342
+ transformResponse: (response, meta, arg) => {
343
+ if (!("data" in response) && arg.model === "plugin::users-permissions.user") {
344
+ return {
345
+ data: response,
346
+ meta: {
347
+ availableStatus: [],
348
+ availableLocales: []
349
+ }
350
+ };
351
+ }
352
+ return response;
353
+ }
231
354
  }),
232
355
  deleteDocument: builder.mutation({
233
356
  query: ({ collectionType, model, documentId, params }) => ({
@@ -238,7 +361,8 @@ const documentApi = contentManagerApi.injectEndpoints({
238
361
  }
239
362
  }),
240
363
  invalidatesTags: (_result, _error, { collectionType, model }) => [
241
- { type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model }
364
+ { type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model },
365
+ "RecentDocumentList"
242
366
  ]
243
367
  }),
244
368
  deleteManyDocuments: builder.mutation({
@@ -250,7 +374,10 @@ const documentApi = contentManagerApi.injectEndpoints({
250
374
  params
251
375
  }
252
376
  }),
253
- invalidatesTags: (_res, _error, { model }) => [{ type: "Document", id: `${model}_LIST` }]
377
+ invalidatesTags: (_res, _error, { model }) => [
378
+ { type: "Document", id: `${model}_LIST` },
379
+ "RecentDocumentList"
380
+ ]
254
381
  }),
255
382
  discardDocument: builder.mutation({
256
383
  query: ({ collectionType, model, documentId, params }) => ({
@@ -268,7 +395,8 @@ const documentApi = contentManagerApi.injectEndpoints({
268
395
  },
269
396
  { type: "Document", id: `${model}_LIST` },
270
397
  "Relations",
271
- { type: "UidAvailability", id: model }
398
+ { type: "UidAvailability", id: model },
399
+ "RecentDocumentList"
272
400
  ];
273
401
  }
274
402
  }),
@@ -363,7 +491,8 @@ const documentApi = contentManagerApi.injectEndpoints({
363
491
  id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
364
492
  },
365
493
  { type: "Document", id: `${model}_LIST` },
366
- "Relations"
494
+ "Relations",
495
+ "RecentDocumentList"
367
496
  ];
368
497
  }
369
498
  }),
@@ -394,7 +523,9 @@ const documentApi = contentManagerApi.injectEndpoints({
394
523
  id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
395
524
  },
396
525
  "Relations",
397
- { type: "UidAvailability", id: model }
526
+ { type: "UidAvailability", id: model },
527
+ "RecentDocumentList",
528
+ "RecentDocumentList"
398
529
  ];
399
530
  },
400
531
  async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
@@ -424,7 +555,8 @@ const documentApi = contentManagerApi.injectEndpoints({
424
555
  {
425
556
  type: "Document",
426
557
  id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
427
- }
558
+ },
559
+ "RecentDocumentList"
428
560
  ];
429
561
  }
430
562
  }),
@@ -437,7 +569,10 @@ const documentApi = contentManagerApi.injectEndpoints({
437
569
  params
438
570
  }
439
571
  }),
440
- invalidatesTags: (_res, _error, { model, documentIds }) => documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` }))
572
+ invalidatesTags: (_res, _error, { model, documentIds }) => [
573
+ ...documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` })),
574
+ "RecentDocumentList"
575
+ ]
441
576
  })
442
577
  })
443
578
  });
@@ -1108,6 +1243,7 @@ const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, co
1108
1243
  const useDocument = (args, opts) => {
1109
1244
  const { toggleNotification } = useNotification();
1110
1245
  const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
1246
+ const { formatMessage } = useIntl();
1111
1247
  const {
1112
1248
  currentData: data,
1113
1249
  isLoading: isLoadingDocument,
@@ -1117,12 +1253,27 @@ const useDocument = (args, opts) => {
1117
1253
  ...opts,
1118
1254
  skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
1119
1255
  });
1256
+ const document = data?.data;
1257
+ const meta = data?.meta;
1120
1258
  const {
1121
1259
  components,
1122
1260
  schema,
1123
1261
  schemas,
1124
1262
  isLoading: isLoadingSchema
1125
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
+ };
1126
1277
  React.useEffect(() => {
1127
1278
  if (error) {
1128
1279
  toggleNotification({
@@ -1138,14 +1289,14 @@ const useDocument = (args, opts) => {
1138
1289
  return createYupSchema(schema.attributes, components);
1139
1290
  }, [schema, components]);
1140
1291
  const validate = React.useCallback(
1141
- (document) => {
1292
+ (document2) => {
1142
1293
  if (!validationSchema) {
1143
1294
  throw new Error(
1144
1295
  "There is no validation schema generated, this is likely due to the schema not being loaded yet."
1145
1296
  );
1146
1297
  }
1147
1298
  try {
1148
- validationSchema.validateSync(document, { abortEarly: false, strict: true });
1299
+ validationSchema.validateSync(document2, { abortEarly: false, strict: true });
1149
1300
  return null;
1150
1301
  } catch (error2) {
1151
1302
  if (error2 instanceof ValidationError) {
@@ -1156,17 +1307,29 @@ const useDocument = (args, opts) => {
1156
1307
  },
1157
1308
  [validationSchema]
1158
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
+ );
1159
1320
  const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
1160
1321
  const hasError = !!error;
1161
1322
  return {
1162
1323
  components,
1163
- document: data?.data,
1164
- meta: data?.meta,
1324
+ document,
1325
+ meta,
1165
1326
  isLoading,
1166
1327
  hasError,
1167
1328
  schema,
1168
1329
  schemas,
1169
- validate
1330
+ validate,
1331
+ getTitle,
1332
+ getInitialFormValues
1170
1333
  };
1171
1334
  };
1172
1335
  const useDoc = () => {
@@ -1667,7 +1830,7 @@ const useDocumentActions = () => {
1667
1830
  };
1668
1831
  };
1669
1832
  const ProtectedHistoryPage = React.lazy(
1670
- () => import("./History-CIQHyi4T.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1833
+ () => import("./History-CcmSn3Mj.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1671
1834
  );
1672
1835
  const routes$2 = [
1673
1836
  {
@@ -1680,7 +1843,7 @@ const routes$2 = [
1680
1843
  }
1681
1844
  ];
1682
1845
  const ProtectedPreviewPage = React.lazy(
1683
- () => import("./Preview-BVFFm7uB.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
1846
+ () => import("./Preview-vfWOtPG5.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
1684
1847
  );
1685
1848
  const routes$1 = [
1686
1849
  {
@@ -1693,31 +1856,31 @@ const routes$1 = [
1693
1856
  }
1694
1857
  ];
1695
1858
  const ProtectedEditViewPage = lazy(
1696
- () => import("./EditViewPage-CD_hqc1J.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1859
+ () => import("./EditViewPage-Bcnff6Vd.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1697
1860
  );
1698
1861
  const ProtectedListViewPage = lazy(
1699
- () => import("./ListViewPage-C10McTK1.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1862
+ () => import("./ListViewPage-HljQVnFH.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1700
1863
  );
1701
1864
  const ProtectedListConfiguration = lazy(
1702
- () => import("./ListConfigurationPage-DcZsfyEL.mjs").then((mod) => ({
1865
+ () => import("./ListConfigurationPage-BPvzENJJ.mjs").then((mod) => ({
1703
1866
  default: mod.ProtectedListConfiguration
1704
1867
  }))
1705
1868
  );
1706
1869
  const ProtectedEditConfigurationPage = lazy(
1707
- () => import("./EditConfigurationPage-BNjOAHNS.mjs").then((mod) => ({
1870
+ () => import("./EditConfigurationPage-D1nvB7Br.mjs").then((mod) => ({
1708
1871
  default: mod.ProtectedEditConfigurationPage
1709
1872
  }))
1710
1873
  );
1711
1874
  const ProtectedComponentConfigurationPage = lazy(
1712
- () => import("./ComponentConfigurationPage-BgCLcjXO.mjs").then((mod) => ({
1875
+ () => import("./ComponentConfigurationPage-D4H-v0et.mjs").then((mod) => ({
1713
1876
  default: mod.ProtectedComponentConfigurationPage
1714
1877
  }))
1715
1878
  );
1716
1879
  const NoPermissions = lazy(
1717
- () => import("./NoPermissionsPage-wfPBh2_0.mjs").then((mod) => ({ default: mod.NoPermissions }))
1880
+ () => import("./NoPermissionsPage-D6ze2nQL.mjs").then((mod) => ({ default: mod.NoPermissions }))
1718
1881
  );
1719
1882
  const NoContentType = lazy(
1720
- () => import("./NoContentTypePage-CPc0Cd3S.mjs").then((mod) => ({ default: mod.NoContentType }))
1883
+ () => import("./NoContentTypePage-BfHaSM-K.mjs").then((mod) => ({ default: mod.NoContentType }))
1721
1884
  );
1722
1885
  const CollectionTypePages = () => {
1723
1886
  const { collectionType } = useParams();
@@ -2248,6 +2411,7 @@ const PublishAction$1 = ({
2248
2411
  };
2249
2412
  };
2250
2413
  PublishAction$1.type = "publish";
2414
+ PublishAction$1.position = "panel";
2251
2415
  const UpdateAction = ({
2252
2416
  activeTab,
2253
2417
  documentId,
@@ -2270,6 +2434,117 @@ const UpdateAction = ({
2270
2434
  const validate = useForm("UpdateAction", (state) => state.validate);
2271
2435
  const setErrors = useForm("UpdateAction", (state) => state.setErrors);
2272
2436
  const resetForm = useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
2437
+ const handleUpdate = React.useCallback(async () => {
2438
+ setSubmitting(true);
2439
+ try {
2440
+ if (!modified) {
2441
+ return;
2442
+ }
2443
+ const { errors } = await validate(true, {
2444
+ status: "draft"
2445
+ });
2446
+ if (errors) {
2447
+ toggleNotification({
2448
+ type: "danger",
2449
+ message: formatMessage({
2450
+ id: "content-manager.validation.error",
2451
+ defaultMessage: "There are validation errors in your document. Please fix them before saving."
2452
+ })
2453
+ });
2454
+ return;
2455
+ }
2456
+ if (isCloning) {
2457
+ const res = await clone(
2458
+ {
2459
+ model,
2460
+ documentId: cloneMatch.params.origin,
2461
+ params
2462
+ },
2463
+ transformData(document)
2464
+ );
2465
+ if ("data" in res) {
2466
+ navigate(
2467
+ {
2468
+ pathname: `../${res.data.documentId}`,
2469
+ search: rawQuery
2470
+ },
2471
+ { relative: "path" }
2472
+ );
2473
+ } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2474
+ setErrors(formatValidationErrors(res.error));
2475
+ }
2476
+ } else if (documentId || collectionType === SINGLE_TYPES) {
2477
+ const res = await update(
2478
+ {
2479
+ collectionType,
2480
+ model,
2481
+ documentId,
2482
+ params
2483
+ },
2484
+ transformData(document)
2485
+ );
2486
+ if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2487
+ setErrors(formatValidationErrors(res.error));
2488
+ } else {
2489
+ resetForm();
2490
+ }
2491
+ } else {
2492
+ const res = await create(
2493
+ {
2494
+ model,
2495
+ params
2496
+ },
2497
+ transformData(document)
2498
+ );
2499
+ if ("data" in res && collectionType !== SINGLE_TYPES) {
2500
+ navigate(
2501
+ {
2502
+ pathname: `../${res.data.documentId}`,
2503
+ search: rawQuery
2504
+ },
2505
+ { replace: true, relative: "path" }
2506
+ );
2507
+ } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2508
+ setErrors(formatValidationErrors(res.error));
2509
+ }
2510
+ }
2511
+ } finally {
2512
+ setSubmitting(false);
2513
+ }
2514
+ }, [
2515
+ clone,
2516
+ cloneMatch?.params.origin,
2517
+ collectionType,
2518
+ create,
2519
+ document,
2520
+ documentId,
2521
+ formatMessage,
2522
+ formatValidationErrors,
2523
+ isCloning,
2524
+ model,
2525
+ modified,
2526
+ navigate,
2527
+ params,
2528
+ rawQuery,
2529
+ resetForm,
2530
+ setErrors,
2531
+ setSubmitting,
2532
+ toggleNotification,
2533
+ update,
2534
+ validate
2535
+ ]);
2536
+ React.useEffect(() => {
2537
+ const handleKeyDown = (e) => {
2538
+ if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
2539
+ e.preventDefault();
2540
+ handleUpdate();
2541
+ }
2542
+ };
2543
+ window.addEventListener("keydown", handleKeyDown);
2544
+ return () => {
2545
+ window.removeEventListener("keydown", handleKeyDown);
2546
+ };
2547
+ }, [handleUpdate]);
2273
2548
  return {
2274
2549
  /**
2275
2550
  * Disabled when:
@@ -2282,84 +2557,11 @@ const UpdateAction = ({
2282
2557
  id: "global.save",
2283
2558
  defaultMessage: "Save"
2284
2559
  }),
2285
- onClick: async () => {
2286
- setSubmitting(true);
2287
- try {
2288
- const { errors } = await validate(true, {
2289
- status: "draft"
2290
- });
2291
- if (errors) {
2292
- toggleNotification({
2293
- type: "danger",
2294
- message: formatMessage({
2295
- id: "content-manager.validation.error",
2296
- defaultMessage: "There are validation errors in your document. Please fix them before saving."
2297
- })
2298
- });
2299
- return;
2300
- }
2301
- if (isCloning) {
2302
- const res = await clone(
2303
- {
2304
- model,
2305
- documentId: cloneMatch.params.origin,
2306
- params
2307
- },
2308
- transformData(document)
2309
- );
2310
- if ("data" in res) {
2311
- navigate(
2312
- {
2313
- pathname: `../${res.data.documentId}`,
2314
- search: rawQuery
2315
- },
2316
- { relative: "path" }
2317
- );
2318
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2319
- setErrors(formatValidationErrors(res.error));
2320
- }
2321
- } else if (documentId || collectionType === SINGLE_TYPES) {
2322
- const res = await update(
2323
- {
2324
- collectionType,
2325
- model,
2326
- documentId,
2327
- params
2328
- },
2329
- transformData(document)
2330
- );
2331
- if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2332
- setErrors(formatValidationErrors(res.error));
2333
- } else {
2334
- resetForm();
2335
- }
2336
- } else {
2337
- const res = await create(
2338
- {
2339
- model,
2340
- params
2341
- },
2342
- transformData(document)
2343
- );
2344
- if ("data" in res && collectionType !== SINGLE_TYPES) {
2345
- navigate(
2346
- {
2347
- pathname: `../${res.data.documentId}`,
2348
- search: rawQuery
2349
- },
2350
- { replace: true, relative: "path" }
2351
- );
2352
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2353
- setErrors(formatValidationErrors(res.error));
2354
- }
2355
- }
2356
- } finally {
2357
- setSubmitting(false);
2358
- }
2359
- }
2560
+ onClick: handleUpdate
2360
2561
  };
2361
2562
  };
2362
2563
  UpdateAction.type = "update";
2564
+ UpdateAction.position = "panel";
2363
2565
  const UNPUBLISH_DRAFT_OPTIONS = {
2364
2566
  KEEP: "keep",
2365
2567
  DISCARD: "discard"
@@ -2482,6 +2684,7 @@ const UnpublishAction$1 = ({
2482
2684
  };
2483
2685
  };
2484
2686
  UnpublishAction$1.type = "unpublish";
2687
+ UnpublishAction$1.position = "panel";
2485
2688
  const DiscardAction = ({
2486
2689
  activeTab,
2487
2690
  documentId,
@@ -2532,6 +2735,7 @@ const DiscardAction = ({
2532
2735
  };
2533
2736
  };
2534
2737
  DiscardAction.type = "discard";
2738
+ DiscardAction.position = "panel";
2535
2739
  const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
2536
2740
  const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
2537
2741
  const RelativeTime = React.forwardRef(
@@ -2651,7 +2855,7 @@ const HeaderToolbar = () => {
2651
2855
  meta: isCloning ? void 0 : meta,
2652
2856
  collectionType
2653
2857
  },
2654
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
2858
+ descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
2655
2859
  children: (actions2) => {
2656
2860
  const headerActions = actions2.filter((action) => {
2657
2861
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -2859,6 +3063,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
2859
3063
  };
2860
3064
  };
2861
3065
  ConfigureTheViewAction.type = "configure-the-view";
3066
+ ConfigureTheViewAction.position = "header";
2862
3067
  const EditTheModelAction = ({ model }) => {
2863
3068
  const navigate = useNavigate();
2864
3069
  const { formatMessage } = useIntl();
@@ -2875,6 +3080,7 @@ const EditTheModelAction = ({ model }) => {
2875
3080
  };
2876
3081
  };
2877
3082
  EditTheModelAction.type = "edit-the-model";
3083
+ EditTheModelAction.position = "header";
2878
3084
  const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2879
3085
  const navigate = useNavigate();
2880
3086
  const { formatMessage } = useIntl();
@@ -2948,6 +3154,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2948
3154
  };
2949
3155
  };
2950
3156
  DeleteAction$1.type = "delete";
3157
+ DeleteAction$1.position = ["header", "table-row"];
2951
3158
  const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
2952
3159
  const Panels = () => {
2953
3160
  const isCloning = useMatch(CLONE_PATH) !== null;
@@ -3010,7 +3217,7 @@ const ActionsPanelContent = () => {
3010
3217
  DescriptionComponentRenderer,
3011
3218
  {
3012
3219
  props,
3013
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
3220
+ descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
3014
3221
  children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
3015
3222
  }
3016
3223
  ),
@@ -3068,7 +3275,7 @@ const ConfirmBulkActionDialog = ({
3068
3275
  ] })
3069
3276
  ] }) });
3070
3277
  };
3071
- const BoldChunk$1 = (chunks) => /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: chunks });
3278
+ const BoldChunk = (chunks) => /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: chunks });
3072
3279
  const ConfirmDialogPublishAll = ({
3073
3280
  isOpen,
3074
3281
  onToggleDialog,
@@ -3117,7 +3324,7 @@ const ConfirmDialogPublishAll = ({
3117
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. "
3118
3325
  },
3119
3326
  {
3120
- b: BoldChunk$1,
3327
+ b: BoldChunk,
3121
3328
  count: countDraftRelations,
3122
3329
  entities: selectedEntries.length
3123
3330
  }
@@ -3156,6 +3363,16 @@ const ConfirmDialogPublishAll = ({
3156
3363
  const TypographyMaxWidth = styled(Typography)`
3157
3364
  max-width: 300px;
3158
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
+ `;
3159
3376
  const formatErrorMessages = (errors, parentKey, formatMessage) => {
3160
3377
  const messages = [];
3161
3378
  Object.entries(errors).forEach(([key, value]) => {
@@ -3260,7 +3477,7 @@ const SelectedEntriesTableContent = ({
3260
3477
  )
3261
3478
  ] }),
3262
3479
  /* @__PURE__ */ jsx(Table.Loading, {}),
3263
- /* @__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: [
3264
3481
  /* @__PURE__ */ jsx(Table.CheckboxCell, { id: row.id }),
3265
3482
  /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Typography, { children: row.id }) }),
3266
3483
  shouldDisplayMainField && /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Typography, { children: row[mainField] }) }),
@@ -3300,7 +3517,73 @@ const SelectedEntriesTableContent = ({
3300
3517
  ] }, row.id)) })
3301
3518
  ] });
3302
3519
  };
3303
- 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
+ };
3304
3587
  const SelectedEntriesModalContent = ({
3305
3588
  listViewSelectedEntries,
3306
3589
  toggleModal,
@@ -3359,7 +3642,6 @@ const SelectedEntriesModalContent = ({
3359
3642
  validationErrors: {}
3360
3643
  };
3361
3644
  }, [components, data, schema]);
3362
- const [publishedCount, setPublishedCount] = React.useState(0);
3363
3645
  const [isDialogOpen, setIsDialogOpen] = React.useState(false);
3364
3646
  const { publishMany: bulkPublishAction } = useDocumentActions();
3365
3647
  const [, { isLoading: isSubmittingForm }] = usePublishManyDocumentsMutation();
@@ -3371,53 +3653,36 @@ const SelectedEntriesModalContent = ({
3371
3653
  const selectedEntriesWithErrorsCount = selectedEntries.filter(
3372
3654
  ({ documentId }) => validationErrors[documentId]
3373
3655
  ).length;
3374
- const selectedEntriesPublished = selectedEntries.filter(
3656
+ const selectedEntriesPublishedCount = selectedEntries.filter(
3375
3657
  ({ status }) => status === "published"
3376
3658
  ).length;
3377
- 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;
3378
3663
  const toggleDialog = () => setIsDialogOpen((prev) => !prev);
3379
3664
  const handleConfirmBulkPublish = async () => {
3380
3665
  toggleDialog();
3381
3666
  const res = await bulkPublishAction({ model, documentIds: entriesToPublish, params });
3382
3667
  if (!("error" in res)) {
3383
- setPublishedCount(res.count);
3384
3668
  const unpublishedEntries = rows.filter((row) => {
3385
3669
  return !entriesToPublish.includes(row.documentId);
3386
3670
  });
3387
3671
  setListViewSelectedDocuments(unpublishedEntries);
3388
3672
  }
3389
3673
  };
3390
- const getFormattedCountMessage = () => {
3391
- if (publishedCount) {
3392
- return formatMessage(
3393
- {
3394
- id: getTranslation("containers.list.selectedEntriesModal.publishedCount"),
3395
- 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."
3396
- },
3397
- {
3398
- publishedCount,
3399
- withErrorsCount: selectedEntriesWithErrorsCount,
3400
- b: BoldChunk
3401
- }
3402
- );
3403
- }
3404
- return formatMessage(
3405
- {
3406
- id: getTranslation("containers.list.selectedEntriesModal.selectedCount"),
3407
- 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."
3408
- },
3409
- {
3410
- readyToPublishCount: selectedEntriesWithNoErrorsCount,
3411
- withErrorsCount: selectedEntriesWithErrorsCount,
3412
- alreadyPublishedCount: selectedEntriesPublished,
3413
- b: BoldChunk
3414
- }
3415
- );
3416
- };
3417
3674
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3418
3675
  /* @__PURE__ */ jsxs(Modal.Body, { children: [
3419
- /* @__PURE__ */ jsx(Typography, { children: getFormattedCountMessage() }),
3420
- /* @__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(
3421
3686
  SelectedEntriesTableContent,
3422
3687
  {
3423
3688
  isPublishing: isSubmittingForm,
@@ -3438,7 +3703,7 @@ const SelectedEntriesModalContent = ({
3438
3703
  Button,
3439
3704
  {
3440
3705
  onClick: toggleDialog,
3441
- disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount || selectedEntriesPublished === selectedEntries.length || isLoading,
3706
+ disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount || selectedEntriesPublishedCount === selectedEntries.length || isLoading,
3442
3707
  loading: isSubmittingForm,
3443
3708
  children: formatMessage({ id: "app.utils.publish", defaultMessage: "Publish" })
3444
3709
  }
@@ -3686,7 +3951,7 @@ const TableActions = ({ document }) => {
3686
3951
  DescriptionComponentRenderer,
3687
3952
  {
3688
3953
  props,
3689
- descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
3954
+ descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
3690
3955
  children: (actions2) => {
3691
3956
  const tableRowActions = actions2.filter((action) => {
3692
3957
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -3745,6 +4010,7 @@ const EditAction = ({ documentId }) => {
3745
4010
  };
3746
4011
  };
3747
4012
  EditAction.type = "edit";
4013
+ EditAction.position = "table-row";
3748
4014
  const StyledPencil = styled(Pencil)`
3749
4015
  path {
3750
4016
  fill: currentColor;
@@ -3821,6 +4087,7 @@ const CloneAction = ({ model, documentId }) => {
3821
4087
  };
3822
4088
  };
3823
4089
  CloneAction.type = "clone";
4090
+ CloneAction.position = "table-row";
3824
4091
  const StyledDuplicate = styled(Duplicate)`
3825
4092
  path {
3826
4093
  fill: currentColor;
@@ -3907,7 +4174,14 @@ class ContentManagerPlugin {
3907
4174
  addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
3908
4175
  addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
3909
4176
  getBulkActions: () => this.bulkActions,
3910
- getDocumentActions: () => this.documentActions,
4177
+ getDocumentActions: (position) => {
4178
+ if (position) {
4179
+ return this.documentActions.filter(
4180
+ (action) => action.position == void 0 || [action.position].flat().includes(position)
4181
+ );
4182
+ }
4183
+ return this.documentActions;
4184
+ },
3911
4185
  getEditViewSidePanels: () => this.editViewSidePanels,
3912
4186
  getHeaderActions: () => this.headerActions
3913
4187
  }
@@ -3971,6 +4245,7 @@ const HistoryAction = ({ model, document }) => {
3971
4245
  };
3972
4246
  };
3973
4247
  HistoryAction.type = "history";
4248
+ HistoryAction.position = "header";
3974
4249
  const historyAdmin = {
3975
4250
  bootstrap(app) {
3976
4251
  const { addDocumentAction } = app.getPlugin("content-manager").apis;
@@ -4064,7 +4339,7 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
4064
4339
  };
4065
4340
  return {
4066
4341
  title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
4067
- content: /* @__PURE__ */ jsx(Flex, { gap: 2, width: "100%", children: /* @__PURE__ */ jsx(
4342
+ content: /* @__PURE__ */ jsx(
4068
4343
  ConditionalTooltip,
4069
4344
  {
4070
4345
  label: formatMessage({
@@ -4072,31 +4347,29 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
4072
4347
  defaultMessage: "Please save to open the preview"
4073
4348
  }),
4074
4349
  isShown: isModified,
4075
- children: /* @__PURE__ */ jsx(
4350
+ children: /* @__PURE__ */ jsx(Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsx(
4076
4351
  Button,
4077
4352
  {
4078
4353
  variant: "tertiary",
4079
4354
  tag: Link,
4080
4355
  to: { pathname: "preview", search: stringify(query, { encode: false }) },
4081
4356
  onClick: trackNavigation,
4082
- flex: "auto",
4357
+ width: "100%",
4083
4358
  disabled: isModified,
4359
+ pointerEvents: isModified ? "none" : void 0,
4360
+ tabIndex: isModified ? -1 : void 0,
4084
4361
  children: formatMessage({
4085
4362
  id: "content-manager.preview.panel.button",
4086
4363
  defaultMessage: "Open preview"
4087
4364
  })
4088
4365
  }
4089
- )
4366
+ ) })
4090
4367
  }
4091
- ) })
4368
+ )
4092
4369
  };
4093
4370
  };
4094
- const FEATURE_ID = "preview";
4095
4371
  const previewAdmin = {
4096
4372
  bootstrap(app) {
4097
- if (!window.strapi.future.isEnabled(FEATURE_ID)) {
4098
- return;
4099
- }
4100
4373
  const contentManagerPluginApis = app.getPlugin("content-manager").apis;
4101
4374
  contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
4102
4375
  }
@@ -4120,7 +4393,7 @@ const index = {
4120
4393
  app.router.addRoute({
4121
4394
  path: "content-manager/*",
4122
4395
  lazy: async () => {
4123
- const { Layout } = await import("./layout-qE8qkNH_.mjs");
4396
+ const { Layout } = await import("./layout-CxDMdJ13.mjs");
4124
4397
  return {
4125
4398
  Component: Layout
4126
4399
  };
@@ -4140,7 +4413,7 @@ const index = {
4140
4413
  async registerTrads({ locales }) {
4141
4414
  const importedTrads = await Promise.all(
4142
4415
  locales.map((locale) => {
4143
- 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-Dtk_ot79.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 }) => {
4144
4417
  return {
4145
4418
  data: prefixPluginTranslations(data, PLUGIN_ID),
4146
4419
  locale
@@ -4157,24 +4430,27 @@ const index = {
4157
4430
  }
4158
4431
  };
4159
4432
  export {
4160
- ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD as A,
4433
+ useUpdateContentTypeConfigurationMutation as A,
4161
4434
  BulkActionsRenderer as B,
4162
4435
  COLLECTION_TYPES as C,
4163
4436
  DocumentStatus as D,
4164
- extractContentTypeComponents as E,
4165
- DEFAULT_SETTINGS as F,
4166
- convertEditLayoutToFieldLayouts as G,
4437
+ ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD as E,
4438
+ extractContentTypeComponents as F,
4439
+ DEFAULT_SETTINGS as G,
4167
4440
  HOOKS as H,
4168
4441
  InjectionZone as I,
4169
- useDocument as J,
4170
- useGetPreviewUrlQuery as K,
4171
- index as L,
4172
- useContentManagerContext as M,
4173
- 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,
4174
4448
  Panels as P,
4449
+ useContentManagerContext as Q,
4175
4450
  RelativeTime as R,
4176
4451
  SINGLE_TYPES as S,
4177
4452
  TableActions as T,
4453
+ useDocumentActions as U,
4178
4454
  useGetInitialDataQuery as a,
4179
4455
  useGetAllContentTypeSettingsQuery as b,
4180
4456
  useDoc as c,
@@ -4187,19 +4463,19 @@ export {
4187
4463
  Header as j,
4188
4464
  PERMISSIONS as k,
4189
4465
  DocumentRBAC as l,
4190
- DOCUMENT_META_FIELDS as m,
4191
- CLONE_PATH as n,
4192
- useDocLayout as o,
4466
+ useDocLayout as m,
4467
+ createDefaultForm as n,
4468
+ CLONE_PATH as o,
4193
4469
  useGetContentTypeConfigurationQuery as p,
4194
4470
  CREATOR_FIELDS as q,
4195
4471
  getMainField as r,
4196
4472
  setInitialData as s,
4197
- getDisplayName as t,
4473
+ transformDocument as t,
4198
4474
  useContentTypeSchema as u,
4199
- checkIfAttributeIsDisplayable as v,
4200
- useGetAllDocumentsQuery as w,
4201
- convertListLayoutToFieldLayouts as x,
4202
- capitalise as y,
4203
- useUpdateContentTypeConfigurationMutation as z
4475
+ getDisplayName as v,
4476
+ checkIfAttributeIsDisplayable as w,
4477
+ useGetAllDocumentsQuery as x,
4478
+ convertListLayoutToFieldLayouts as y,
4479
+ capitalise as z
4204
4480
  };
4205
- //# sourceMappingURL=index-DLIkNVnQ.mjs.map
4481
+ //# sourceMappingURL=index-EH8ZtHd5.mjs.map