@strapi/content-manager 0.0.0-experimental.f6c00790e260ea5a9b6b86abac5fea02b05d569c → 0.0.0-experimental.f74ae50eea1ce95176f088dba837e95b60fa2a4d

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 (80) hide show
  1. package/dist/_chunks/{ComponentConfigurationPage-CnL10QYC.mjs → ComponentConfigurationPage-7-qB29e7.mjs} +3 -3
  2. package/dist/_chunks/{ComponentConfigurationPage-CnL10QYC.mjs.map → ComponentConfigurationPage-7-qB29e7.mjs.map} +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-G4EIirP8.js → ComponentConfigurationPage-DP7AC0UU.js} +3 -3
  4. package/dist/_chunks/{ComponentConfigurationPage-G4EIirP8.js.map → ComponentConfigurationPage-DP7AC0UU.js.map} +1 -1
  5. package/dist/_chunks/{EditConfigurationPage-I2kKh9dx.mjs → EditConfigurationPage-CI4XoymK.mjs} +3 -3
  6. package/dist/_chunks/{EditConfigurationPage-I2kKh9dx.mjs.map → EditConfigurationPage-CI4XoymK.mjs.map} +1 -1
  7. package/dist/_chunks/{EditConfigurationPage-B2AA1kVF.js → EditConfigurationPage-DITVliEI.js} +3 -3
  8. package/dist/_chunks/{EditConfigurationPage-B2AA1kVF.js.map → EditConfigurationPage-DITVliEI.js.map} +1 -1
  9. package/dist/_chunks/{EditViewPage-CHgoNwlc.js → EditViewPage-CUS2EAhB.js} +8 -4
  10. package/dist/_chunks/EditViewPage-CUS2EAhB.js.map +1 -0
  11. package/dist/_chunks/{EditViewPage-zFjJK0s8.mjs → EditViewPage-Dzpno8xI.mjs} +8 -4
  12. package/dist/_chunks/EditViewPage-Dzpno8xI.mjs.map +1 -0
  13. package/dist/_chunks/{Field-DPAzUS1M.mjs → Field-B_jG_EV9.mjs} +31 -19
  14. package/dist/_chunks/{Field-DPAzUS1M.mjs.map → Field-B_jG_EV9.mjs.map} +1 -1
  15. package/dist/_chunks/{Field-9DePZh-0.js → Field-CtUU1Fg8.js} +31 -19
  16. package/dist/_chunks/{Field-9DePZh-0.js.map → Field-CtUU1Fg8.js.map} +1 -1
  17. package/dist/_chunks/{Form-CEkENbkF.mjs → Form-BXHao2mZ.mjs} +2 -2
  18. package/dist/_chunks/{Form-CEkENbkF.mjs.map → Form-BXHao2mZ.mjs.map} +1 -1
  19. package/dist/_chunks/{Form-DPm-KZ1A.js → Form-DTqO0ymI.js} +2 -2
  20. package/dist/_chunks/{Form-DPm-KZ1A.js.map → Form-DTqO0ymI.js.map} +1 -1
  21. package/dist/_chunks/{History-utls71em.mjs → History-2Ah2CQ4T.mjs} +4 -4
  22. package/dist/_chunks/{History-utls71em.mjs.map → History-2Ah2CQ4T.mjs.map} +1 -1
  23. package/dist/_chunks/{History-DXSbTWez.js → History-C_uSGzO5.js} +4 -4
  24. package/dist/_chunks/{History-DXSbTWez.js.map → History-C_uSGzO5.js.map} +1 -1
  25. package/dist/_chunks/{ListConfigurationPage-CuMXWWqb.mjs → ListConfigurationPage-BjSJlaoC.mjs} +2 -2
  26. package/dist/_chunks/{ListConfigurationPage-CuMXWWqb.mjs.map → ListConfigurationPage-BjSJlaoC.mjs.map} +1 -1
  27. package/dist/_chunks/{ListConfigurationPage-D5C7ACZ_.js → ListConfigurationPage-nyuP7OSy.js} +2 -2
  28. package/dist/_chunks/{ListConfigurationPage-D5C7ACZ_.js.map → ListConfigurationPage-nyuP7OSy.js.map} +1 -1
  29. package/dist/_chunks/{ListViewPage-CdKd-PS_.mjs → ListViewPage-B75x3nz2.mjs} +4 -4
  30. package/dist/_chunks/{ListViewPage-CdKd-PS_.mjs.map → ListViewPage-B75x3nz2.mjs.map} +1 -1
  31. package/dist/_chunks/{ListViewPage-DfuwH1tt.js → ListViewPage-DHgHD8Xg.js} +4 -4
  32. package/dist/_chunks/{ListViewPage-DfuwH1tt.js.map → ListViewPage-DHgHD8Xg.js.map} +1 -1
  33. package/dist/_chunks/{NoContentTypePage-BIxlkWWi.js → NoContentTypePage-CDUKdZ7d.js} +2 -2
  34. package/dist/_chunks/{NoContentTypePage-BIxlkWWi.js.map → NoContentTypePage-CDUKdZ7d.js.map} +1 -1
  35. package/dist/_chunks/{NoContentTypePage-DkToTT7u.mjs → NoContentTypePage-DUacQSyF.mjs} +2 -2
  36. package/dist/_chunks/{NoContentTypePage-DkToTT7u.mjs.map → NoContentTypePage-DUacQSyF.mjs.map} +1 -1
  37. package/dist/_chunks/{NoPermissionsPage-DlWi4BAH.mjs → NoPermissionsPage-SFllMekk.mjs} +2 -2
  38. package/dist/_chunks/{NoPermissionsPage-DlWi4BAH.mjs.map → NoPermissionsPage-SFllMekk.mjs.map} +1 -1
  39. package/dist/_chunks/{NoPermissionsPage-Bu4GWYb-.js → NoPermissionsPage-zwIZydDI.js} +2 -2
  40. package/dist/_chunks/{NoPermissionsPage-Bu4GWYb-.js.map → NoPermissionsPage-zwIZydDI.js.map} +1 -1
  41. package/dist/_chunks/{Relations-QP5yn9_z.mjs → Relations-D2NRW8fC.mjs} +13 -9
  42. package/dist/_chunks/Relations-D2NRW8fC.mjs.map +1 -0
  43. package/dist/_chunks/{Relations-CFjTESWQ.js → Relations-NFLaRNPr.js} +13 -9
  44. package/dist/_chunks/Relations-NFLaRNPr.js.map +1 -0
  45. package/dist/_chunks/{en-BVzUkPxZ.js → en-BlhnxQfj.js} +2 -2
  46. package/dist/_chunks/{en-BVzUkPxZ.js.map → en-BlhnxQfj.js.map} +1 -1
  47. package/dist/_chunks/{en-CPTj6CjC.mjs → en-C8YBvRrK.mjs} +2 -2
  48. package/dist/_chunks/{en-CPTj6CjC.mjs.map → en-C8YBvRrK.mjs.map} +1 -1
  49. package/dist/_chunks/{index-BHfS6_D5.mjs → index-C9HxCo5R.mjs} +873 -820
  50. package/dist/_chunks/index-C9HxCo5R.mjs.map +1 -0
  51. package/dist/_chunks/{index-DXiHxy70.js → index-ovJRE1FM.js} +871 -818
  52. package/dist/_chunks/index-ovJRE1FM.js.map +1 -0
  53. package/dist/_chunks/{layout-DX_52HSH.mjs → layout-DaUjDiWQ.mjs} +3 -3
  54. package/dist/_chunks/{layout-DX_52HSH.mjs.map → layout-DaUjDiWQ.mjs.map} +1 -1
  55. package/dist/_chunks/{layout-bE-WUnQ0.js → layout-UNWstw_s.js} +3 -3
  56. package/dist/_chunks/{layout-bE-WUnQ0.js.map → layout-UNWstw_s.js.map} +1 -1
  57. package/dist/_chunks/{relations-SCVAL_aJ.mjs → relations-D8iFAeRu.mjs} +2 -2
  58. package/dist/_chunks/{relations-SCVAL_aJ.mjs.map → relations-D8iFAeRu.mjs.map} +1 -1
  59. package/dist/_chunks/{relations-D706vblp.js → relations-NN3coOG5.js} +2 -2
  60. package/dist/_chunks/{relations-D706vblp.js.map → relations-NN3coOG5.js.map} +1 -1
  61. package/dist/admin/index.js +2 -1
  62. package/dist/admin/index.js.map +1 -1
  63. package/dist/admin/index.mjs +3 -2
  64. package/dist/admin/src/exports.d.ts +1 -1
  65. package/dist/admin/src/hooks/useDocument.d.ts +32 -1
  66. package/dist/admin/src/pages/EditView/components/Header.d.ts +1 -0
  67. package/dist/server/index.js +13 -6
  68. package/dist/server/index.js.map +1 -1
  69. package/dist/server/index.mjs +13 -6
  70. package/dist/server/index.mjs.map +1 -1
  71. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  72. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  73. package/package.json +10 -10
  74. package/dist/_chunks/EditViewPage-CHgoNwlc.js.map +0 -1
  75. package/dist/_chunks/EditViewPage-zFjJK0s8.mjs.map +0 -1
  76. package/dist/_chunks/Relations-CFjTESWQ.js.map +0 -1
  77. package/dist/_chunks/Relations-QP5yn9_z.mjs.map +0 -1
  78. package/dist/_chunks/index-BHfS6_D5.mjs.map +0 -1
  79. package/dist/_chunks/index-DXiHxy70.js.map +0 -1
  80. package/strapi-server.js +0 -3
@@ -31,7 +31,9 @@ type UseDocument = (args: UseDocumentArgs, opts?: UseDocumentOpts) => {
31
31
  * This is the schema of the content type, it is not the same as the layout.
32
32
  */
33
33
  schema?: Schema;
34
+ schemas?: Schema[];
34
35
  validate: (document: Document) => null | FormErrors;
36
+ hasError?: boolean;
35
37
  };
36
38
  /**
37
39
  * @alpha
@@ -78,10 +80,39 @@ declare const useDoc: () => {
78
80
  * This is the schema of the content type, it is not the same as the layout.
79
81
  */
80
82
  schema?: ContentType | undefined;
83
+ schemas?: ContentType[] | undefined;
81
84
  validate: (document: Document) => null | FormErrors;
85
+ hasError?: boolean | undefined;
82
86
  collectionType: string;
83
87
  model: string;
84
88
  id: string | undefined;
85
89
  };
86
- export { useDocument, useDoc };
90
+ /**
91
+ * @public
92
+ * @experimental
93
+ * Content manager context hooks for plugin development.
94
+ * Make sure to use this hook inside the content manager.
95
+ */
96
+ declare const useContentManagerContext: () => {
97
+ error: import("@reduxjs/toolkit").SerializedError | import("../utils/api").BaseQueryError | undefined;
98
+ isLoading: boolean;
99
+ model: string;
100
+ collectionType: string;
101
+ id: string | undefined;
102
+ slug: string;
103
+ isCreatingEntry: boolean;
104
+ isSingleType: boolean;
105
+ hasDraftAndPublish: boolean;
106
+ components: ComponentsDictionary;
107
+ contentType: ContentType | undefined;
108
+ contentTypes: ContentType[] | undefined;
109
+ form: import("@strapi/admin/strapi-admin").FormContextValue<import("@strapi/admin/strapi-admin").FormValues>;
110
+ layout: {
111
+ error?: import("@reduxjs/toolkit").SerializedError | import("../utils/api").BaseQueryError | undefined;
112
+ isLoading: boolean;
113
+ edit: import("./useDocumentLayout").EditLayout;
114
+ list: import("./useDocumentLayout").ListLayout;
115
+ };
116
+ };
117
+ export { useDocument, useDoc, useContentManagerContext };
87
118
  export type { UseDocument, UseDocumentArgs, Document, Schema, ComponentsDictionary };
@@ -28,6 +28,7 @@ interface HeaderActionDescription {
28
28
  }>;
29
29
  onSelect?: (value: string) => void;
30
30
  value?: string;
31
+ customizeContent?: (value: string) => React.ReactNode;
31
32
  }
32
33
  declare const DEFAULT_HEADER_ACTIONS: DocumentActionComponent[];
33
34
  export { Header, DEFAULT_HEADER_ACTIONS };
@@ -1924,11 +1924,17 @@ const collectionTypes = {
1924
1924
  }
1925
1925
  const isUpdate = !isCreate;
1926
1926
  if (isUpdate) {
1927
- document = await documentManager2.findOne(id, model, { populate, locale });
1928
- if (!document) {
1927
+ const documentExists = documentManager2.exists(model, id);
1928
+ if (!documentExists) {
1929
1929
  throw new strapiUtils.errors.NotFoundError("Document not found");
1930
1930
  }
1931
- if (permissionChecker2.can.update(document)) {
1931
+ document = await documentManager2.findOne(id, model, { populate, locale });
1932
+ if (!document) {
1933
+ if (permissionChecker2.cannot.create({ locale }) || permissionChecker2.cannot.publish({ locale })) {
1934
+ throw new strapiUtils.errors.ForbiddenError();
1935
+ }
1936
+ document = await updateDocument(ctx);
1937
+ } else if (permissionChecker2.can.update(document)) {
1932
1938
  await updateDocument(ctx);
1933
1939
  }
1934
1940
  }
@@ -2549,8 +2555,9 @@ const relations = {
2549
2555
  } else {
2550
2556
  where.id = id;
2551
2557
  }
2552
- if (status) {
2553
- where[`${alias}.published_at`] = getPublishedAtClause(status, targetUid);
2558
+ const publishedAt = getPublishedAtClause(status, targetUid);
2559
+ if (!fp.isEmpty(publishedAt)) {
2560
+ where[`${alias}.published_at`] = publishedAt;
2554
2561
  }
2555
2562
  if (filterByLocale) {
2556
2563
  where[`${alias}.locale`] = locale;
@@ -2694,7 +2701,7 @@ const singleTypes = {
2694
2701
  permissionChecker2,
2695
2702
  model,
2696
2703
  // @ts-expect-error - fix types
2697
- { id: document.documentId, locale, publishedAt: null },
2704
+ { documentId: document.documentId, locale, publishedAt: null },
2698
2705
  { availableLocales: true, availableStatus: false }
2699
2706
  );
2700
2707
  ctx.body = { data: {}, meta };