@strapi/content-manager 5.45.1 → 5.46.1

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 (145) hide show
  1. package/dist/admin/constants/hooks.js +5 -0
  2. package/dist/admin/constants/hooks.js.map +1 -1
  3. package/dist/admin/constants/hooks.mjs +5 -0
  4. package/dist/admin/constants/hooks.mjs.map +1 -1
  5. package/dist/admin/content-manager.js +26 -2
  6. package/dist/admin/content-manager.js.map +1 -1
  7. package/dist/admin/content-manager.mjs +26 -2
  8. package/dist/admin/content-manager.mjs.map +1 -1
  9. package/dist/admin/history/components/VersionInputRenderer.js +1 -1
  10. package/dist/admin/history/components/VersionInputRenderer.js.map +1 -1
  11. package/dist/admin/history/components/VersionInputRenderer.mjs +1 -1
  12. package/dist/admin/history/components/VersionInputRenderer.mjs.map +1 -1
  13. package/dist/admin/hooks/usePersistentQueryParams.js +4 -1
  14. package/dist/admin/hooks/usePersistentQueryParams.js.map +1 -1
  15. package/dist/admin/hooks/usePersistentQueryParams.mjs +4 -1
  16. package/dist/admin/hooks/usePersistentQueryParams.mjs.map +1 -1
  17. package/dist/admin/pages/ComponentConfigurationPage.js +2 -45
  18. package/dist/admin/pages/ComponentConfigurationPage.js.map +1 -1
  19. package/dist/admin/pages/ComponentConfigurationPage.mjs +3 -46
  20. package/dist/admin/pages/ComponentConfigurationPage.mjs.map +1 -1
  21. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.js +21 -4
  22. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.js.map +1 -1
  23. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.mjs +19 -2
  24. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.mjs.map +1 -1
  25. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.mjs +1 -1
  26. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.js +9 -6
  27. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.js.map +1 -1
  28. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.mjs +10 -7
  29. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.mjs.map +1 -1
  30. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.js +1 -34
  31. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.js.map +1 -1
  32. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.mjs +3 -35
  33. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.mjs.map +1 -1
  34. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.js +33 -18
  35. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.js.map +1 -1
  36. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.mjs +34 -19
  37. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.mjs.map +1 -1
  38. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/DefaultBlocksStore.js +22 -0
  39. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/DefaultBlocksStore.js.map +1 -0
  40. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/DefaultBlocksStore.mjs +20 -0
  41. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/DefaultBlocksStore.mjs.map +1 -0
  42. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.js +15 -4
  43. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.js.map +1 -1
  44. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.mjs +16 -5
  45. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.mjs.map +1 -1
  46. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js +26 -4
  47. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js.map +1 -1
  48. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs +26 -4
  49. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs.map +1 -1
  50. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js +31 -0
  51. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js.map +1 -1
  52. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs +31 -0
  53. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs.map +1 -1
  54. package/dist/admin/pages/ListConfiguration/ListConfigurationPage.js +11 -3
  55. package/dist/admin/pages/ListConfiguration/ListConfigurationPage.js.map +1 -1
  56. package/dist/admin/pages/ListConfiguration/ListConfigurationPage.mjs +11 -3
  57. package/dist/admin/pages/ListConfiguration/ListConfigurationPage.mjs.map +1 -1
  58. package/dist/admin/pages/ListView/ListViewPage.js +1 -0
  59. package/dist/admin/pages/ListView/ListViewPage.js.map +1 -1
  60. package/dist/admin/pages/ListView/ListViewPage.mjs +1 -0
  61. package/dist/admin/pages/ListView/ListViewPage.mjs.map +1 -1
  62. package/dist/admin/pages/ListView/components/Filters.js +38 -4
  63. package/dist/admin/pages/ListView/components/Filters.js.map +1 -1
  64. package/dist/admin/pages/ListView/components/Filters.mjs +39 -5
  65. package/dist/admin/pages/ListView/components/Filters.mjs.map +1 -1
  66. package/dist/admin/pages/formatComponentConfigurationEditLayout.js +58 -0
  67. package/dist/admin/pages/formatComponentConfigurationEditLayout.js.map +1 -0
  68. package/dist/admin/pages/formatComponentConfigurationEditLayout.mjs +56 -0
  69. package/dist/admin/pages/formatComponentConfigurationEditLayout.mjs.map +1 -0
  70. package/dist/admin/preview/components/InputPopover.js +3 -0
  71. package/dist/admin/preview/components/InputPopover.js.map +1 -1
  72. package/dist/admin/preview/components/InputPopover.mjs +3 -0
  73. package/dist/admin/preview/components/InputPopover.mjs.map +1 -1
  74. package/dist/admin/preview/hooks/usePreviewInputManager.js +24 -0
  75. package/dist/admin/preview/hooks/usePreviewInputManager.js.map +1 -1
  76. package/dist/admin/preview/hooks/usePreviewInputManager.mjs +24 -0
  77. package/dist/admin/preview/hooks/usePreviewInputManager.mjs.map +1 -1
  78. package/dist/admin/preview/utils/previewScript.js +616 -78
  79. package/dist/admin/preview/utils/previewScript.js.map +1 -1
  80. package/dist/admin/preview/utils/previewScript.mjs +616 -78
  81. package/dist/admin/preview/utils/previewScript.mjs.map +1 -1
  82. package/dist/admin/src/constants/hooks.d.ts +23 -0
  83. package/dist/admin/src/content-manager.d.ts +26 -0
  84. package/dist/admin/src/exports.d.ts +2 -0
  85. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.d.ts +14 -8
  86. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/DefaultBlocksStore.d.ts +3 -0
  87. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/ComponentCard.d.ts +1 -1
  88. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +11 -1
  89. package/dist/admin/src/pages/EditView/components/FormInputs/Relations/Relations.d.ts +9 -5
  90. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +4 -2
  91. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +38 -6
  92. package/dist/admin/src/pages/EditView/components/FormLayout.d.ts +27 -5
  93. package/dist/admin/src/pages/ListView/components/Filters.d.ts +3 -4
  94. package/dist/admin/src/pages/formatComponentConfigurationEditLayout.d.ts +15 -0
  95. package/dist/admin/translations/cs.json.js +0 -1
  96. package/dist/admin/translations/cs.json.js.map +1 -1
  97. package/dist/admin/translations/cs.json.mjs +0 -1
  98. package/dist/admin/translations/cs.json.mjs.map +1 -1
  99. package/dist/admin/translations/de.json.js +0 -1
  100. package/dist/admin/translations/de.json.js.map +1 -1
  101. package/dist/admin/translations/de.json.mjs +0 -1
  102. package/dist/admin/translations/de.json.mjs.map +1 -1
  103. package/dist/admin/translations/en.json.js +0 -1
  104. package/dist/admin/translations/en.json.js.map +1 -1
  105. package/dist/admin/translations/en.json.mjs +0 -1
  106. package/dist/admin/translations/en.json.mjs.map +1 -1
  107. package/dist/admin/translations/es.json.js +0 -1
  108. package/dist/admin/translations/es.json.js.map +1 -1
  109. package/dist/admin/translations/es.json.mjs +0 -1
  110. package/dist/admin/translations/es.json.mjs.map +1 -1
  111. package/dist/admin/translations/fr.json.js +0 -1
  112. package/dist/admin/translations/fr.json.js.map +1 -1
  113. package/dist/admin/translations/fr.json.mjs +0 -1
  114. package/dist/admin/translations/fr.json.mjs.map +1 -1
  115. package/dist/admin/translations/nl.json.js +0 -1
  116. package/dist/admin/translations/nl.json.js.map +1 -1
  117. package/dist/admin/translations/nl.json.mjs +0 -1
  118. package/dist/admin/translations/nl.json.mjs.map +1 -1
  119. package/dist/admin/translations/pl.json.js +0 -1
  120. package/dist/admin/translations/pl.json.js.map +1 -1
  121. package/dist/admin/translations/pl.json.mjs +0 -1
  122. package/dist/admin/translations/pl.json.mjs.map +1 -1
  123. package/dist/admin/translations/ru.json.js +0 -1
  124. package/dist/admin/translations/ru.json.js.map +1 -1
  125. package/dist/admin/translations/ru.json.mjs +0 -1
  126. package/dist/admin/translations/ru.json.mjs.map +1 -1
  127. package/dist/admin/translations/uk.json.js +0 -1
  128. package/dist/admin/translations/uk.json.js.map +1 -1
  129. package/dist/admin/translations/uk.json.mjs +0 -1
  130. package/dist/admin/translations/uk.json.mjs.map +1 -1
  131. package/dist/admin/translations/zh-Hans.json.js +0 -1
  132. package/dist/admin/translations/zh-Hans.json.js.map +1 -1
  133. package/dist/admin/translations/zh-Hans.json.mjs +0 -1
  134. package/dist/admin/translations/zh-Hans.json.mjs.map +1 -1
  135. package/dist/server/homepage/services/homepage.js +12 -8
  136. package/dist/server/homepage/services/homepage.js.map +1 -1
  137. package/dist/server/homepage/services/homepage.mjs +12 -8
  138. package/dist/server/homepage/services/homepage.mjs.map +1 -1
  139. package/dist/server/services/metrics.js +1 -5
  140. package/dist/server/services/metrics.js.map +1 -1
  141. package/dist/server/services/metrics.mjs +1 -5
  142. package/dist/server/services/metrics.mjs.map +1 -1
  143. package/dist/server/src/homepage/services/homepage.d.ts.map +1 -1
  144. package/dist/server/src/services/metrics.d.ts.map +1 -1
  145. package/package.json +7 -7
@@ -7,6 +7,11 @@ const HOOKS = {
7
7
  * @type {string}
8
8
  */ INJECT_COLUMN_IN_TABLE: 'Admin/CM/pages/ListView/inject-column-in-table',
9
9
  /**
10
+ * Hook that allows to mutate the displayed filters of the list view
11
+ * @constant
12
+ * @type {string}
13
+ */ INJECT_LIST_VIEW_FILTERS: 'Admin/CM/pages/ListView/inject-in-filters',
14
+ /**
10
15
  * Hook that allows to mutate the CM's collection types links pre-set filters
11
16
  * @constant
12
17
  * @type {string}
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sources":["../../../admin/src/constants/hooks.ts"],"sourcesContent":["export const HOOKS = {\n /**\n * Hook that allows to mutate the displayed headers of the list view table\n * @constant\n * @type {string}\n */\n INJECT_COLUMN_IN_TABLE: 'Admin/CM/pages/ListView/inject-column-in-table',\n\n /**\n * Hook that allows to mutate the CM's collection types links pre-set filters\n * @constant\n * @type {string}\n */\n MUTATE_COLLECTION_TYPES_LINKS: 'Admin/CM/pages/App/mutate-collection-types-links',\n\n /**\n * Hook that allows to mutate the CM's edit view layout\n * @constant\n * @type {string}\n */\n MUTATE_EDIT_VIEW_LAYOUT: 'Admin/CM/pages/EditView/mutate-edit-view-layout',\n\n /**\n * Hook that allows to mutate the CM's single types links pre-set filters\n * @constant\n * @type {string}\n */\n MUTATE_SINGLE_TYPES_LINKS: 'Admin/CM/pages/App/mutate-single-types-links',\n};\n"],"names":["HOOKS","INJECT_COLUMN_IN_TABLE","MUTATE_COLLECTION_TYPES_LINKS","MUTATE_EDIT_VIEW_LAYOUT","MUTATE_SINGLE_TYPES_LINKS"],"mappings":";;MAAaA,KAAAA,GAAQ;AACnB;;;;AAIC,MACDC,sBAAAA,EAAwB,gDAAA;AAExB;;;;AAIC,MACDC,6BAAAA,EAA+B,kDAAA;AAE/B;;;;AAIC,MACDC,uBAAAA,EAAyB,iDAAA;AAEzB;;;;AAIC,MACDC,yBAAAA,EAA2B;AAC7B;;;;"}
1
+ {"version":3,"file":"hooks.js","sources":["../../../admin/src/constants/hooks.ts"],"sourcesContent":["import type { Filters } from '@strapi/admin/strapi-admin';\nimport type { MessageDescriptor } from 'react-intl';\n\n/**\n * Shape of a filter passed through the `INJECT_LIST_VIEW_FILTERS` hook.\n *\n * Plugin-injected filters may use react-intl `MessageDescriptor` labels so\n * they carry their own translations. The list view consumer resolves them to\n * plain strings (which is what the underlying `Filters.Filter` contract\n * expects) before rendering.\n */\nexport type InjectableListViewFilter = Omit<Filters.Filter, 'label' | 'operators'> & {\n label: string | MessageDescriptor;\n operators?: Array<{ value: string; label: string | MessageDescriptor }>;\n};\n\nexport const HOOKS = {\n /**\n * Hook that allows to mutate the displayed headers of the list view table\n * @constant\n * @type {string}\n */\n INJECT_COLUMN_IN_TABLE: 'Admin/CM/pages/ListView/inject-column-in-table',\n\n /**\n * Hook that allows to mutate the displayed filters of the list view\n * @constant\n * @type {string}\n */\n INJECT_LIST_VIEW_FILTERS: 'Admin/CM/pages/ListView/inject-in-filters',\n\n /**\n * Hook that allows to mutate the CM's collection types links pre-set filters\n * @constant\n * @type {string}\n */\n MUTATE_COLLECTION_TYPES_LINKS: 'Admin/CM/pages/App/mutate-collection-types-links',\n\n /**\n * Hook that allows to mutate the CM's edit view layout\n * @constant\n * @type {string}\n */\n MUTATE_EDIT_VIEW_LAYOUT: 'Admin/CM/pages/EditView/mutate-edit-view-layout',\n\n /**\n * Hook that allows to mutate the CM's single types links pre-set filters\n * @constant\n * @type {string}\n */\n MUTATE_SINGLE_TYPES_LINKS: 'Admin/CM/pages/App/mutate-single-types-links',\n};\n"],"names":["HOOKS","INJECT_COLUMN_IN_TABLE","INJECT_LIST_VIEW_FILTERS","MUTATE_COLLECTION_TYPES_LINKS","MUTATE_EDIT_VIEW_LAYOUT","MUTATE_SINGLE_TYPES_LINKS"],"mappings":";;MAgBaA,KAAAA,GAAQ;AACnB;;;;AAIC,MACDC,sBAAAA,EAAwB,gDAAA;AAExB;;;;AAIC,MACDC,wBAAAA,EAA0B,2CAAA;AAE1B;;;;AAIC,MACDC,6BAAAA,EAA+B,kDAAA;AAE/B;;;;AAIC,MACDC,uBAAAA,EAAyB,iDAAA;AAEzB;;;;AAIC,MACDC,yBAAAA,EAA2B;AAC7B;;;;"}
@@ -5,6 +5,11 @@ const HOOKS = {
5
5
  * @type {string}
6
6
  */ INJECT_COLUMN_IN_TABLE: 'Admin/CM/pages/ListView/inject-column-in-table',
7
7
  /**
8
+ * Hook that allows to mutate the displayed filters of the list view
9
+ * @constant
10
+ * @type {string}
11
+ */ INJECT_LIST_VIEW_FILTERS: 'Admin/CM/pages/ListView/inject-in-filters',
12
+ /**
8
13
  * Hook that allows to mutate the CM's collection types links pre-set filters
9
14
  * @constant
10
15
  * @type {string}
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.mjs","sources":["../../../admin/src/constants/hooks.ts"],"sourcesContent":["export const HOOKS = {\n /**\n * Hook that allows to mutate the displayed headers of the list view table\n * @constant\n * @type {string}\n */\n INJECT_COLUMN_IN_TABLE: 'Admin/CM/pages/ListView/inject-column-in-table',\n\n /**\n * Hook that allows to mutate the CM's collection types links pre-set filters\n * @constant\n * @type {string}\n */\n MUTATE_COLLECTION_TYPES_LINKS: 'Admin/CM/pages/App/mutate-collection-types-links',\n\n /**\n * Hook that allows to mutate the CM's edit view layout\n * @constant\n * @type {string}\n */\n MUTATE_EDIT_VIEW_LAYOUT: 'Admin/CM/pages/EditView/mutate-edit-view-layout',\n\n /**\n * Hook that allows to mutate the CM's single types links pre-set filters\n * @constant\n * @type {string}\n */\n MUTATE_SINGLE_TYPES_LINKS: 'Admin/CM/pages/App/mutate-single-types-links',\n};\n"],"names":["HOOKS","INJECT_COLUMN_IN_TABLE","MUTATE_COLLECTION_TYPES_LINKS","MUTATE_EDIT_VIEW_LAYOUT","MUTATE_SINGLE_TYPES_LINKS"],"mappings":"MAAaA,KAAAA,GAAQ;AACnB;;;;AAIC,MACDC,sBAAAA,EAAwB,gDAAA;AAExB;;;;AAIC,MACDC,6BAAAA,EAA+B,kDAAA;AAE/B;;;;AAIC,MACDC,uBAAAA,EAAyB,iDAAA;AAEzB;;;;AAIC,MACDC,yBAAAA,EAA2B;AAC7B;;;;"}
1
+ {"version":3,"file":"hooks.mjs","sources":["../../../admin/src/constants/hooks.ts"],"sourcesContent":["import type { Filters } from '@strapi/admin/strapi-admin';\nimport type { MessageDescriptor } from 'react-intl';\n\n/**\n * Shape of a filter passed through the `INJECT_LIST_VIEW_FILTERS` hook.\n *\n * Plugin-injected filters may use react-intl `MessageDescriptor` labels so\n * they carry their own translations. The list view consumer resolves them to\n * plain strings (which is what the underlying `Filters.Filter` contract\n * expects) before rendering.\n */\nexport type InjectableListViewFilter = Omit<Filters.Filter, 'label' | 'operators'> & {\n label: string | MessageDescriptor;\n operators?: Array<{ value: string; label: string | MessageDescriptor }>;\n};\n\nexport const HOOKS = {\n /**\n * Hook that allows to mutate the displayed headers of the list view table\n * @constant\n * @type {string}\n */\n INJECT_COLUMN_IN_TABLE: 'Admin/CM/pages/ListView/inject-column-in-table',\n\n /**\n * Hook that allows to mutate the displayed filters of the list view\n * @constant\n * @type {string}\n */\n INJECT_LIST_VIEW_FILTERS: 'Admin/CM/pages/ListView/inject-in-filters',\n\n /**\n * Hook that allows to mutate the CM's collection types links pre-set filters\n * @constant\n * @type {string}\n */\n MUTATE_COLLECTION_TYPES_LINKS: 'Admin/CM/pages/App/mutate-collection-types-links',\n\n /**\n * Hook that allows to mutate the CM's edit view layout\n * @constant\n * @type {string}\n */\n MUTATE_EDIT_VIEW_LAYOUT: 'Admin/CM/pages/EditView/mutate-edit-view-layout',\n\n /**\n * Hook that allows to mutate the CM's single types links pre-set filters\n * @constant\n * @type {string}\n */\n MUTATE_SINGLE_TYPES_LINKS: 'Admin/CM/pages/App/mutate-single-types-links',\n};\n"],"names":["HOOKS","INJECT_COLUMN_IN_TABLE","INJECT_LIST_VIEW_FILTERS","MUTATE_COLLECTION_TYPES_LINKS","MUTATE_EDIT_VIEW_LAYOUT","MUTATE_SINGLE_TYPES_LINKS"],"mappings":"MAgBaA,KAAAA,GAAQ;AACnB;;;;AAIC,MACDC,sBAAAA,EAAwB,gDAAA;AAExB;;;;AAIC,MACDC,wBAAAA,EAA0B,2CAAA;AAE1B;;;;AAIC,MACDC,6BAAAA,EAA+B,kDAAA;AAE/B;;;;AAIC,MACDC,uBAAAA,EAAyB,iDAAA;AAEzB;;;;AAIC,MACDC,yBAAAA,EAA2B;AAC7B;;;;"}
@@ -3,6 +3,7 @@
3
3
  var InjectionZone = require('./components/InjectionZone.js');
4
4
  var plugin = require('./constants/plugin.js');
5
5
  var DocumentActions = require('./pages/EditView/components/DocumentActions.js');
6
+ var DefaultBlocksStore = require('./pages/EditView/components/FormInputs/BlocksInput/DefaultBlocksStore.js');
6
7
  var Header = require('./pages/EditView/components/Header.js');
7
8
  var Panels = require('./pages/EditView/components/Panels.js');
8
9
  var Actions = require('./pages/ListView/components/BulkActions/Actions.js');
@@ -11,6 +12,22 @@ var TableActions = require('./pages/ListView/components/TableActions.js');
11
12
  /* -------------------------------------------------------------------------------------------------
12
13
  * ContentManager plugin
13
14
  * -----------------------------------------------------------------------------------------------*/ class ContentManagerPlugin {
15
+ addRichTextBlocks(blocks) {
16
+ if (typeof blocks === 'function') {
17
+ const result = blocks(this.richTextBlocksStore);
18
+ if (typeof result !== 'object' || result === null) {
19
+ throw new Error(`Expected the \`blocks\` passed to \`addRichTextBlocks\` to be an object or a function, but received ${getPrintableType(result)}`);
20
+ }
21
+ this.richTextBlocksStore = result;
22
+ } else if (typeof blocks === 'object') {
23
+ this.richTextBlocksStore = {
24
+ ...this.richTextBlocksStore,
25
+ ...blocks
26
+ };
27
+ } else {
28
+ throw new Error(`Expected the \`blocks\` passed to \`addRichTextBlocks\` to be an object or a function, but received ${getPrintableType(blocks)}`);
29
+ }
30
+ }
14
31
  addEditViewSidePanel(panels) {
15
32
  if (Array.isArray(panels)) {
16
33
  this.editViewSidePanels = [
@@ -69,6 +86,7 @@ var TableActions = require('./pages/ListView/components/TableActions.js');
69
86
  addDocumentAction: this.addDocumentAction.bind(this),
70
87
  addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
71
88
  addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
89
+ addRichTextBlocks: this.addRichTextBlocks.bind(this),
72
90
  getBulkActions: ()=>this.bulkActions,
73
91
  getDocumentActions: (position)=>{
74
92
  /**
@@ -87,7 +105,10 @@ var TableActions = require('./pages/ListView/components/TableActions.js');
87
105
  return this.documentActions;
88
106
  },
89
107
  getEditViewSidePanels: ()=>this.editViewSidePanels,
90
- getHeaderActions: ()=>this.headerActions
108
+ getHeaderActions: ()=>this.headerActions,
109
+ getRichTextBlocks: ()=>({
110
+ ...this.richTextBlocksStore
111
+ })
91
112
  }
92
113
  };
93
114
  }
@@ -97,7 +118,10 @@ var TableActions = require('./pages/ListView/components/TableActions.js');
97
118
  * the content-manager. The function calls however, need to be called at runtime in the
98
119
  * application, so instead we collate them and run them later with the complete list incl.
99
120
  * ones already registered & the context of the view.
100
- */ this.bulkActions = [
121
+ */ this.richTextBlocksStore = {
122
+ ...DefaultBlocksStore.defaultBlocksStore
123
+ };
124
+ this.bulkActions = [
101
125
  ...Actions.DEFAULT_BULK_ACTIONS
102
126
  ];
103
127
  this.documentActions = [
@@ -1 +1 @@
1
- {"version":3,"file":"content-manager.js","sources":["../../admin/src/content-manager.ts"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { INJECTION_ZONES } from './components/InjectionZone';\nimport { PLUGIN_ID } from './constants/plugin';\nimport {\n DEFAULT_ACTIONS,\n type DocumentActionPosition,\n type DocumentActionDescription,\n} from './pages/EditView/components/DocumentActions';\nimport {\n DEFAULT_HEADER_ACTIONS,\n type HeaderActionDescription,\n} from './pages/EditView/components/Header';\nimport { ActionsPanel, type PanelDescription } from './pages/EditView/components/Panels';\nimport {\n DEFAULT_BULK_ACTIONS,\n type BulkActionDescription,\n} from './pages/ListView/components/BulkActions/Actions';\nimport { DEFAULT_TABLE_ROW_ACTIONS } from './pages/ListView/components/TableActions';\n\nimport type { Document } from './hooks/useDocument';\nimport type { DocumentMetadata } from '../../shared/contracts/collection-types';\nimport type { DescriptionComponent, PluginConfig } from '@strapi/admin/strapi-admin';\n\n/* -------------------------------------------------------------------------------------------------\n * Configuration Types\n * -----------------------------------------------------------------------------------------------*/\n\ntype DescriptionReducer<Config extends object> = (prev: Config[]) => Config[];\n\ninterface EditViewContext {\n /**\n * This will ONLY be null, if the content-type\n * does not have draft & published enabled.\n */\n activeTab: 'draft' | 'published' | null;\n /**\n * Will be either 'single-types' | 'collection-types'\n */\n collectionType: string;\n /**\n * this will be undefined if someone is creating an entry.\n */\n document?: Document;\n /**\n * this will be undefined if someone is creating an entry.\n */\n documentId?: string;\n /**\n * this will be undefined if someone is creating an entry.\n */\n meta?: DocumentMetadata;\n /**\n * The current content-type's model.\n */\n model: string;\n}\n\ninterface ListViewContext {\n /**\n * Will be either 'single-types' | 'collection-types'\n */\n collectionType: string;\n /**\n * The current selected documents in the table\n */\n documents: Document[];\n /**\n * The current content-type's model.\n */\n model: string;\n}\n\ninterface PanelComponentProps extends EditViewContext {}\n\ninterface PanelComponent extends DescriptionComponent<PanelComponentProps, PanelDescription> {\n /**\n * The defaults are added by Strapi only, if you're providing your own component,\n * you do not need to provide this.\n */\n type?: 'actions' | 'releases';\n}\n\ninterface DocumentActionProps extends EditViewContext {}\n\ninterface DocumentActionComponent\n extends DescriptionComponent<DocumentActionProps, DocumentActionDescription> {\n type?:\n | 'clone'\n | 'configure-the-view'\n | 'delete'\n | 'discard'\n | 'edit'\n | 'edit-the-model'\n | 'history'\n | 'publish'\n | 'unpublish'\n | 'update';\n position?: DocumentActionDescription['position'];\n}\n\ninterface HeaderActionProps extends EditViewContext {}\n\ninterface HeaderActionComponent\n extends DescriptionComponent<HeaderActionProps, HeaderActionDescription> {}\n\ninterface BulkActionComponentProps extends ListViewContext {}\n\ninterface BulkActionComponent\n extends DescriptionComponent<BulkActionComponentProps, BulkActionDescription> {\n type?: 'delete' | 'publish' | 'unpublish';\n}\n\n/* -------------------------------------------------------------------------------------------------\n * ContentManager plugin\n * -----------------------------------------------------------------------------------------------*/\n\nclass ContentManagerPlugin {\n /**\n * The following properties are the stored ones provided by any plugins registering with\n * the content-manager. The function calls however, need to be called at runtime in the\n * application, so instead we collate them and run them later with the complete list incl.\n * ones already registered & the context of the view.\n */\n bulkActions: BulkActionComponent[] = [...DEFAULT_BULK_ACTIONS];\n documentActions: DocumentActionComponent[] = [\n ...DEFAULT_ACTIONS,\n ...DEFAULT_TABLE_ROW_ACTIONS,\n ...DEFAULT_HEADER_ACTIONS,\n ];\n editViewSidePanels: PanelComponent[] = [ActionsPanel];\n headerActions: HeaderActionComponent[] = [];\n\n constructor() {}\n\n addEditViewSidePanel(panels: DescriptionReducer<PanelComponent>): void;\n addEditViewSidePanel(panels: PanelComponent[]): void;\n addEditViewSidePanel(panels: DescriptionReducer<PanelComponent> | PanelComponent[]) {\n if (Array.isArray(panels)) {\n this.editViewSidePanels = [...this.editViewSidePanels, ...panels];\n } else if (typeof panels === 'function') {\n this.editViewSidePanels = panels(this.editViewSidePanels);\n } else {\n throw new Error(\n `Expected the \\`panels\\` passed to \\`addEditViewSidePanel\\` to be an array or a function, but received ${getPrintableType(\n panels\n )}`\n );\n }\n }\n\n addDocumentAction(actions: DescriptionReducer<DocumentActionComponent>): void;\n addDocumentAction(actions: DocumentActionComponent[]): void;\n addDocumentAction(\n actions: DescriptionReducer<DocumentActionComponent> | DocumentActionComponent[]\n ) {\n if (Array.isArray(actions)) {\n this.documentActions = [...this.documentActions, ...actions];\n } else if (typeof actions === 'function') {\n this.documentActions = actions(this.documentActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addDocumentAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n addDocumentHeaderAction(actions: DescriptionReducer<HeaderActionComponent>): void;\n addDocumentHeaderAction(actions: HeaderActionComponent[]): void;\n addDocumentHeaderAction(\n actions: DescriptionReducer<HeaderActionComponent> | HeaderActionComponent[]\n ) {\n if (Array.isArray(actions)) {\n this.headerActions = [...this.headerActions, ...actions];\n } else if (typeof actions === 'function') {\n this.headerActions = actions(this.headerActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addDocumentHeaderAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n addBulkAction(actions: DescriptionReducer<BulkActionComponent>): void;\n addBulkAction(actions: BulkActionComponent[]): void;\n addBulkAction(actions: DescriptionReducer<BulkActionComponent> | BulkActionComponent[]) {\n if (Array.isArray(actions)) {\n this.bulkActions = [...this.bulkActions, ...actions];\n } else if (typeof actions === 'function') {\n this.bulkActions = actions(this.bulkActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addBulkAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n get config() {\n return {\n id: PLUGIN_ID,\n name: 'Content Manager',\n injectionZones: INJECTION_ZONES,\n apis: {\n addBulkAction: this.addBulkAction.bind(this),\n addDocumentAction: this.addDocumentAction.bind(this),\n addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),\n addEditViewSidePanel: this.addEditViewSidePanel.bind(this),\n getBulkActions: () => this.bulkActions,\n getDocumentActions: (position?: DocumentActionPosition) => {\n /**\n * When possible, pre-filter the actions by the components static position property.\n * This avoids rendering the actions in multiple places where they weren't displayed,\n * which wasn't visible but created issues with useEffect for instance.\n * The response should still be filtered by the position, as the static property is new\n * and not mandatory to avoid a breaking change.\n */\n if (position) {\n return this.documentActions.filter((action) => {\n return action.position == undefined || [action.position].flat().includes(position);\n });\n }\n\n return this.documentActions;\n },\n getEditViewSidePanels: () => this.editViewSidePanels,\n getHeaderActions: () => this.headerActions,\n },\n } satisfies PluginConfig;\n }\n}\n\n/* -------------------------------------------------------------------------------------------------\n * getPrintableType\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description Gets the human-friendly printable type name for the given value, for instance it will yield\n * `array` instead of `object`, as the native `typeof` operator would do.\n */\nconst getPrintableType = (value: unknown): string => {\n const nativeType = typeof value;\n\n if (nativeType === 'object') {\n if (value === null) return 'null';\n if (Array.isArray(value)) return 'array';\n if (value instanceof Object && value.constructor.name !== 'Object') {\n return value.constructor.name;\n }\n }\n\n return nativeType;\n};\n\nexport { ContentManagerPlugin };\nexport type {\n EditViewContext,\n ListViewContext,\n BulkActionComponent,\n BulkActionComponentProps,\n BulkActionDescription,\n DescriptionComponent,\n DescriptionReducer,\n PanelComponentProps,\n PanelComponent,\n PanelDescription,\n DocumentActionComponent,\n DocumentActionDescription,\n DocumentActionProps,\n HeaderActionComponent,\n HeaderActionDescription,\n HeaderActionProps,\n};\n"],"names":["ContentManagerPlugin","addEditViewSidePanel","panels","Array","isArray","editViewSidePanels","Error","getPrintableType","addDocumentAction","actions","documentActions","addDocumentHeaderAction","headerActions","addBulkAction","bulkActions","config","id","PLUGIN_ID","name","injectionZones","INJECTION_ZONES","apis","bind","getBulkActions","getDocumentActions","position","filter","action","undefined","flat","includes","getEditViewSidePanels","getHeaderActions","DEFAULT_BULK_ACTIONS","DEFAULT_ACTIONS","DEFAULT_TABLE_ROW_ACTIONS","DEFAULT_HEADER_ACTIONS","ActionsPanel","value","nativeType","Object"],"mappings":";;;;;;;;;;AAgHA;;AAEkG,qGAElG,MAAMA,oBAAAA,CAAAA;AAoBJC,IAAAA,oBAAAA,CAAqBC,MAA6D,EAAE;QAClF,IAAIC,KAAAA,CAAMC,OAAO,CAACF,MAAAA,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;"}
1
+ {"version":3,"file":"content-manager.js","sources":["../../admin/src/content-manager.ts"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\n\nimport { INJECTION_ZONES } from './components/InjectionZone';\nimport { PLUGIN_ID } from './constants/plugin';\nimport {\n DEFAULT_ACTIONS,\n type DocumentActionPosition,\n type DocumentActionDescription,\n} from './pages/EditView/components/DocumentActions';\nimport { RichTextBlocksStore } from './pages/EditView/components/FormInputs/BlocksInput/BlocksEditor';\nimport { defaultBlocksStore } from './pages/EditView/components/FormInputs/BlocksInput/DefaultBlocksStore';\nimport {\n DEFAULT_HEADER_ACTIONS,\n type HeaderActionDescription,\n} from './pages/EditView/components/Header';\nimport { ActionsPanel, type PanelDescription } from './pages/EditView/components/Panels';\nimport {\n DEFAULT_BULK_ACTIONS,\n type BulkActionDescription,\n} from './pages/ListView/components/BulkActions/Actions';\nimport { DEFAULT_TABLE_ROW_ACTIONS } from './pages/ListView/components/TableActions';\n\nimport type { Document } from './hooks/useDocument';\nimport type { DocumentMetadata } from '../../shared/contracts/collection-types';\nimport type { DescriptionComponent, PluginConfig } from '@strapi/admin/strapi-admin';\n\n/* -------------------------------------------------------------------------------------------------\n * Configuration Types\n * -----------------------------------------------------------------------------------------------*/\n\ntype DescriptionReducer<Config extends object> = (prev: Config[]) => Config[];\ntype DescriptionObjReducer<Config extends object> = (prev: Config) => Config;\n\ninterface EditViewContext {\n /**\n * This will ONLY be null, if the content-type\n * does not have draft & published enabled.\n */\n activeTab: 'draft' | 'published' | null;\n /**\n * Will be either 'single-types' | 'collection-types'\n */\n collectionType: string;\n /**\n * this will be undefined if someone is creating an entry.\n */\n document?: Document;\n /**\n * this will be undefined if someone is creating an entry.\n */\n documentId?: string;\n /**\n * this will be undefined if someone is creating an entry.\n */\n meta?: DocumentMetadata;\n /**\n * The current content-type's model.\n */\n model: string;\n}\n\ninterface ListViewContext {\n /**\n * Will be either 'single-types' | 'collection-types'\n */\n collectionType: string;\n /**\n * The current selected documents in the table\n */\n documents: Document[];\n /**\n * The current content-type's model.\n */\n model: string;\n}\n\ninterface PanelComponentProps extends EditViewContext {}\n\ninterface PanelComponent extends DescriptionComponent<PanelComponentProps, PanelDescription> {\n /**\n * The defaults are added by Strapi only, if you're providing your own component,\n * you do not need to provide this.\n */\n type?: 'actions' | 'releases';\n}\n\ninterface DocumentActionProps extends EditViewContext {}\n\ninterface DocumentActionComponent\n extends DescriptionComponent<DocumentActionProps, DocumentActionDescription> {\n type?:\n | 'clone'\n | 'configure-the-view'\n | 'delete'\n | 'discard'\n | 'edit'\n | 'edit-the-model'\n | 'history'\n | 'publish'\n | 'unpublish'\n | 'update';\n position?: DocumentActionDescription['position'];\n}\n\ninterface HeaderActionProps extends EditViewContext {}\n\ninterface HeaderActionComponent\n extends DescriptionComponent<HeaderActionProps, HeaderActionDescription> {}\n\ninterface BulkActionComponentProps extends ListViewContext {}\n\ninterface BulkActionComponent\n extends DescriptionComponent<BulkActionComponentProps, BulkActionDescription> {\n type?: 'delete' | 'publish' | 'unpublish';\n}\n\n/* -------------------------------------------------------------------------------------------------\n * ContentManager plugin\n * -----------------------------------------------------------------------------------------------*/\n\nclass ContentManagerPlugin {\n /**\n * The following properties are the stored ones provided by any plugins registering with\n * the content-manager. The function calls however, need to be called at runtime in the\n * application, so instead we collate them and run them later with the complete list incl.\n * ones already registered & the context of the view.\n */\n richTextBlocksStore: RichTextBlocksStore = { ...defaultBlocksStore };\n bulkActions: BulkActionComponent[] = [...DEFAULT_BULK_ACTIONS];\n documentActions: DocumentActionComponent[] = [\n ...DEFAULT_ACTIONS,\n ...DEFAULT_TABLE_ROW_ACTIONS,\n ...DEFAULT_HEADER_ACTIONS,\n ];\n editViewSidePanels: PanelComponent[] = [ActionsPanel];\n headerActions: HeaderActionComponent[] = [];\n\n constructor() {}\n\n addRichTextBlocks(blocks: RichTextBlocksStore): void;\n addRichTextBlocks(blocks: DescriptionObjReducer<RichTextBlocksStore>): void;\n addRichTextBlocks(blocks: RichTextBlocksStore | DescriptionObjReducer<RichTextBlocksStore>) {\n if (typeof blocks === 'function') {\n const result = blocks(this.richTextBlocksStore);\n if (typeof result !== 'object' || result === null) {\n throw new Error(\n `Expected the \\`blocks\\` passed to \\`addRichTextBlocks\\` to be an object or a function, but received ${getPrintableType(result)}`\n );\n }\n this.richTextBlocksStore = result;\n } else if (typeof blocks === 'object') {\n this.richTextBlocksStore = { ...this.richTextBlocksStore, ...blocks };\n } else {\n throw new Error(\n `Expected the \\`blocks\\` passed to \\`addRichTextBlocks\\` to be an object or a function, but received ${getPrintableType(\n blocks\n )}`\n );\n }\n }\n\n addEditViewSidePanel(panels: DescriptionReducer<PanelComponent>): void;\n addEditViewSidePanel(panels: PanelComponent[]): void;\n addEditViewSidePanel(panels: DescriptionReducer<PanelComponent> | PanelComponent[]) {\n if (Array.isArray(panels)) {\n this.editViewSidePanels = [...this.editViewSidePanels, ...panels];\n } else if (typeof panels === 'function') {\n this.editViewSidePanels = panels(this.editViewSidePanels);\n } else {\n throw new Error(\n `Expected the \\`panels\\` passed to \\`addEditViewSidePanel\\` to be an array or a function, but received ${getPrintableType(\n panels\n )}`\n );\n }\n }\n\n addDocumentAction(actions: DescriptionReducer<DocumentActionComponent>): void;\n addDocumentAction(actions: DocumentActionComponent[]): void;\n addDocumentAction(\n actions: DescriptionReducer<DocumentActionComponent> | DocumentActionComponent[]\n ) {\n if (Array.isArray(actions)) {\n this.documentActions = [...this.documentActions, ...actions];\n } else if (typeof actions === 'function') {\n this.documentActions = actions(this.documentActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addDocumentAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n addDocumentHeaderAction(actions: DescriptionReducer<HeaderActionComponent>): void;\n addDocumentHeaderAction(actions: HeaderActionComponent[]): void;\n addDocumentHeaderAction(\n actions: DescriptionReducer<HeaderActionComponent> | HeaderActionComponent[]\n ) {\n if (Array.isArray(actions)) {\n this.headerActions = [...this.headerActions, ...actions];\n } else if (typeof actions === 'function') {\n this.headerActions = actions(this.headerActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addDocumentHeaderAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n addBulkAction(actions: DescriptionReducer<BulkActionComponent>): void;\n addBulkAction(actions: BulkActionComponent[]): void;\n addBulkAction(actions: DescriptionReducer<BulkActionComponent> | BulkActionComponent[]) {\n if (Array.isArray(actions)) {\n this.bulkActions = [...this.bulkActions, ...actions];\n } else if (typeof actions === 'function') {\n this.bulkActions = actions(this.bulkActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addBulkAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n get config() {\n return {\n id: PLUGIN_ID,\n name: 'Content Manager',\n injectionZones: INJECTION_ZONES,\n apis: {\n addBulkAction: this.addBulkAction.bind(this),\n addDocumentAction: this.addDocumentAction.bind(this),\n addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),\n addEditViewSidePanel: this.addEditViewSidePanel.bind(this),\n addRichTextBlocks: this.addRichTextBlocks.bind(this),\n getBulkActions: () => this.bulkActions,\n getDocumentActions: (position?: DocumentActionPosition) => {\n /**\n * When possible, pre-filter the actions by the components static position property.\n * This avoids rendering the actions in multiple places where they weren't displayed,\n * which wasn't visible but created issues with useEffect for instance.\n * The response should still be filtered by the position, as the static property is new\n * and not mandatory to avoid a breaking change.\n */\n if (position) {\n return this.documentActions.filter((action) => {\n return action.position == undefined || [action.position].flat().includes(position);\n });\n }\n\n return this.documentActions;\n },\n getEditViewSidePanels: () => this.editViewSidePanels,\n getHeaderActions: () => this.headerActions,\n getRichTextBlocks: () => ({ ...this.richTextBlocksStore }),\n },\n } satisfies PluginConfig;\n }\n}\n\n/* -------------------------------------------------------------------------------------------------\n * getPrintableType\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description Gets the human-friendly printable type name for the given value, for instance it will yield\n * `array` instead of `object`, as the native `typeof` operator would do.\n */\nconst getPrintableType = (value: unknown): string => {\n const nativeType = typeof value;\n\n if (nativeType === 'object') {\n if (value === null) return 'null';\n if (Array.isArray(value)) return 'array';\n if (value instanceof Object && value.constructor.name !== 'Object') {\n return value.constructor.name;\n }\n }\n\n return nativeType;\n};\n\nexport { ContentManagerPlugin };\nexport type {\n EditViewContext,\n ListViewContext,\n BulkActionComponent,\n BulkActionComponentProps,\n BulkActionDescription,\n DescriptionComponent,\n DescriptionReducer,\n PanelComponentProps,\n PanelComponent,\n PanelDescription,\n DocumentActionComponent,\n DocumentActionDescription,\n DocumentActionProps,\n HeaderActionComponent,\n HeaderActionDescription,\n HeaderActionProps,\n};\n"],"names":["ContentManagerPlugin","addRichTextBlocks","blocks","result","richTextBlocksStore","Error","getPrintableType","addEditViewSidePanel","panels","Array","isArray","editViewSidePanels","addDocumentAction","actions","documentActions","addDocumentHeaderAction","headerActions","addBulkAction","bulkActions","config","id","PLUGIN_ID","name","injectionZones","INJECTION_ZONES","apis","bind","getBulkActions","getDocumentActions","position","filter","action","undefined","flat","includes","getEditViewSidePanels","getHeaderActions","getRichTextBlocks","defaultBlocksStore","DEFAULT_BULK_ACTIONS","DEFAULT_ACTIONS","DEFAULT_TABLE_ROW_ACTIONS","DEFAULT_HEADER_ACTIONS","ActionsPanel","value","nativeType","Object"],"mappings":";;;;;;;;;;;AAoHA;;AAEkG,qGAElG,MAAMA,oBAAAA,CAAAA;AAqBJC,IAAAA,iBAAAA,CAAkBC,MAAwE,EAAE;QAC1F,IAAI,OAAOA,WAAW,UAAA,EAAY;AAChC,YAAA,MAAMC,MAAAA,GAASD,MAAAA,CAAO,IAAI,CAACE,mBAAmB,CAAA;AAC9C,YAAA,IAAI,OAAOD,MAAAA,KAAW,QAAA,IAAYA,MAAAA,KAAW,IAAA,EAAM;AACjD,gBAAA,MAAM,IAAIE,KAAAA,CACR,CAAC,oGAAoG,EAAEC,iBAAiBH,MAAAA,CAAAA,CAAAA,CAAS,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;AACxC0B,YAAAA,GAAAA,+BAAAA;AACAC,YAAAA,GAAAA,sCAAAA;AACAC,YAAAA,GAAAA;AACJ,SAAA;aACD/B,kBAAAA,GAAuC;AAACgC,YAAAA;AAAa,SAAA;AACrD3B,QAAAA,IAAAA,CAAAA,aAAAA,GAAyC,EAAE;AAE5B,IAAA;AA8HjB;AAEA;;;;;;IASA,MAAMV,mBAAmB,CAACsC,KAAAA,GAAAA;AACxB,IAAA,MAAMC,aAAa,OAAOD,KAAAA;AAE1B,IAAA,IAAIC,eAAe,QAAA,EAAU;QAC3B,IAAID,KAAAA,KAAU,MAAM,OAAO,MAAA;AAC3B,QAAA,IAAInC,KAAAA,CAAMC,OAAO,CAACkC,KAAAA,CAAAA,EAAQ,OAAO,OAAA;AACjC,QAAA,IAAIA,iBAAiBE,MAAAA,IAAUF,KAAAA,CAAM,WAAW,CAACtB,IAAI,KAAK,QAAA,EAAU;YAClE,OAAOsB,KAAAA,CAAM,WAAW,CAACtB,IAAI;AAC/B,QAAA;AACF,IAAA;IAEA,OAAOuB,UAAAA;AACT,CAAA;;;;"}
@@ -1,6 +1,7 @@
1
1
  import { INJECTION_ZONES } from './components/InjectionZone.mjs';
2
2
  import { PLUGIN_ID } from './constants/plugin.mjs';
3
3
  import { DEFAULT_ACTIONS } from './pages/EditView/components/DocumentActions.mjs';
4
+ import { defaultBlocksStore } from './pages/EditView/components/FormInputs/BlocksInput/DefaultBlocksStore.mjs';
4
5
  import { DEFAULT_HEADER_ACTIONS } from './pages/EditView/components/Header.mjs';
5
6
  import { ActionsPanel } from './pages/EditView/components/Panels.mjs';
6
7
  import { DEFAULT_BULK_ACTIONS } from './pages/ListView/components/BulkActions/Actions.mjs';
@@ -9,6 +10,22 @@ import { DEFAULT_TABLE_ROW_ACTIONS } from './pages/ListView/components/TableActi
9
10
  /* -------------------------------------------------------------------------------------------------
10
11
  * ContentManager plugin
11
12
  * -----------------------------------------------------------------------------------------------*/ class ContentManagerPlugin {
13
+ addRichTextBlocks(blocks) {
14
+ if (typeof blocks === 'function') {
15
+ const result = blocks(this.richTextBlocksStore);
16
+ if (typeof result !== 'object' || result === null) {
17
+ throw new Error(`Expected the \`blocks\` passed to \`addRichTextBlocks\` to be an object or a function, but received ${getPrintableType(result)}`);
18
+ }
19
+ this.richTextBlocksStore = result;
20
+ } else if (typeof blocks === 'object') {
21
+ this.richTextBlocksStore = {
22
+ ...this.richTextBlocksStore,
23
+ ...blocks
24
+ };
25
+ } else {
26
+ throw new Error(`Expected the \`blocks\` passed to \`addRichTextBlocks\` to be an object or a function, but received ${getPrintableType(blocks)}`);
27
+ }
28
+ }
12
29
  addEditViewSidePanel(panels) {
13
30
  if (Array.isArray(panels)) {
14
31
  this.editViewSidePanels = [
@@ -67,6 +84,7 @@ import { DEFAULT_TABLE_ROW_ACTIONS } from './pages/ListView/components/TableActi
67
84
  addDocumentAction: this.addDocumentAction.bind(this),
68
85
  addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
69
86
  addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
87
+ addRichTextBlocks: this.addRichTextBlocks.bind(this),
70
88
  getBulkActions: ()=>this.bulkActions,
71
89
  getDocumentActions: (position)=>{
72
90
  /**
@@ -85,7 +103,10 @@ import { DEFAULT_TABLE_ROW_ACTIONS } from './pages/ListView/components/TableActi
85
103
  return this.documentActions;
86
104
  },
87
105
  getEditViewSidePanels: ()=>this.editViewSidePanels,
88
- getHeaderActions: ()=>this.headerActions
106
+ getHeaderActions: ()=>this.headerActions,
107
+ getRichTextBlocks: ()=>({
108
+ ...this.richTextBlocksStore
109
+ })
89
110
  }
90
111
  };
91
112
  }
@@ -95,7 +116,10 @@ import { DEFAULT_TABLE_ROW_ACTIONS } from './pages/ListView/components/TableActi
95
116
  * the content-manager. The function calls however, need to be called at runtime in the
96
117
  * application, so instead we collate them and run them later with the complete list incl.
97
118
  * ones already registered & the context of the view.
98
- */ this.bulkActions = [
119
+ */ this.richTextBlocksStore = {
120
+ ...defaultBlocksStore
121
+ };
122
+ this.bulkActions = [
99
123
  ...DEFAULT_BULK_ACTIONS
100
124
  ];
101
125
  this.documentActions = [
@@ -1 +1 @@
1
- {"version":3,"file":"content-manager.mjs","sources":["../../admin/src/content-manager.ts"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { INJECTION_ZONES } from './components/InjectionZone';\nimport { PLUGIN_ID } from './constants/plugin';\nimport {\n DEFAULT_ACTIONS,\n type DocumentActionPosition,\n type DocumentActionDescription,\n} from './pages/EditView/components/DocumentActions';\nimport {\n DEFAULT_HEADER_ACTIONS,\n type HeaderActionDescription,\n} from './pages/EditView/components/Header';\nimport { ActionsPanel, type PanelDescription } from './pages/EditView/components/Panels';\nimport {\n DEFAULT_BULK_ACTIONS,\n type BulkActionDescription,\n} from './pages/ListView/components/BulkActions/Actions';\nimport { DEFAULT_TABLE_ROW_ACTIONS } from './pages/ListView/components/TableActions';\n\nimport type { Document } from './hooks/useDocument';\nimport type { DocumentMetadata } from '../../shared/contracts/collection-types';\nimport type { DescriptionComponent, PluginConfig } from '@strapi/admin/strapi-admin';\n\n/* -------------------------------------------------------------------------------------------------\n * Configuration Types\n * -----------------------------------------------------------------------------------------------*/\n\ntype DescriptionReducer<Config extends object> = (prev: Config[]) => Config[];\n\ninterface EditViewContext {\n /**\n * This will ONLY be null, if the content-type\n * does not have draft & published enabled.\n */\n activeTab: 'draft' | 'published' | null;\n /**\n * Will be either 'single-types' | 'collection-types'\n */\n collectionType: string;\n /**\n * this will be undefined if someone is creating an entry.\n */\n document?: Document;\n /**\n * this will be undefined if someone is creating an entry.\n */\n documentId?: string;\n /**\n * this will be undefined if someone is creating an entry.\n */\n meta?: DocumentMetadata;\n /**\n * The current content-type's model.\n */\n model: string;\n}\n\ninterface ListViewContext {\n /**\n * Will be either 'single-types' | 'collection-types'\n */\n collectionType: string;\n /**\n * The current selected documents in the table\n */\n documents: Document[];\n /**\n * The current content-type's model.\n */\n model: string;\n}\n\ninterface PanelComponentProps extends EditViewContext {}\n\ninterface PanelComponent extends DescriptionComponent<PanelComponentProps, PanelDescription> {\n /**\n * The defaults are added by Strapi only, if you're providing your own component,\n * you do not need to provide this.\n */\n type?: 'actions' | 'releases';\n}\n\ninterface DocumentActionProps extends EditViewContext {}\n\ninterface DocumentActionComponent\n extends DescriptionComponent<DocumentActionProps, DocumentActionDescription> {\n type?:\n | 'clone'\n | 'configure-the-view'\n | 'delete'\n | 'discard'\n | 'edit'\n | 'edit-the-model'\n | 'history'\n | 'publish'\n | 'unpublish'\n | 'update';\n position?: DocumentActionDescription['position'];\n}\n\ninterface HeaderActionProps extends EditViewContext {}\n\ninterface HeaderActionComponent\n extends DescriptionComponent<HeaderActionProps, HeaderActionDescription> {}\n\ninterface BulkActionComponentProps extends ListViewContext {}\n\ninterface BulkActionComponent\n extends DescriptionComponent<BulkActionComponentProps, BulkActionDescription> {\n type?: 'delete' | 'publish' | 'unpublish';\n}\n\n/* -------------------------------------------------------------------------------------------------\n * ContentManager plugin\n * -----------------------------------------------------------------------------------------------*/\n\nclass ContentManagerPlugin {\n /**\n * The following properties are the stored ones provided by any plugins registering with\n * the content-manager. The function calls however, need to be called at runtime in the\n * application, so instead we collate them and run them later with the complete list incl.\n * ones already registered & the context of the view.\n */\n bulkActions: BulkActionComponent[] = [...DEFAULT_BULK_ACTIONS];\n documentActions: DocumentActionComponent[] = [\n ...DEFAULT_ACTIONS,\n ...DEFAULT_TABLE_ROW_ACTIONS,\n ...DEFAULT_HEADER_ACTIONS,\n ];\n editViewSidePanels: PanelComponent[] = [ActionsPanel];\n headerActions: HeaderActionComponent[] = [];\n\n constructor() {}\n\n addEditViewSidePanel(panels: DescriptionReducer<PanelComponent>): void;\n addEditViewSidePanel(panels: PanelComponent[]): void;\n addEditViewSidePanel(panels: DescriptionReducer<PanelComponent> | PanelComponent[]) {\n if (Array.isArray(panels)) {\n this.editViewSidePanels = [...this.editViewSidePanels, ...panels];\n } else if (typeof panels === 'function') {\n this.editViewSidePanels = panels(this.editViewSidePanels);\n } else {\n throw new Error(\n `Expected the \\`panels\\` passed to \\`addEditViewSidePanel\\` to be an array or a function, but received ${getPrintableType(\n panels\n )}`\n );\n }\n }\n\n addDocumentAction(actions: DescriptionReducer<DocumentActionComponent>): void;\n addDocumentAction(actions: DocumentActionComponent[]): void;\n addDocumentAction(\n actions: DescriptionReducer<DocumentActionComponent> | DocumentActionComponent[]\n ) {\n if (Array.isArray(actions)) {\n this.documentActions = [...this.documentActions, ...actions];\n } else if (typeof actions === 'function') {\n this.documentActions = actions(this.documentActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addDocumentAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n addDocumentHeaderAction(actions: DescriptionReducer<HeaderActionComponent>): void;\n addDocumentHeaderAction(actions: HeaderActionComponent[]): void;\n addDocumentHeaderAction(\n actions: DescriptionReducer<HeaderActionComponent> | HeaderActionComponent[]\n ) {\n if (Array.isArray(actions)) {\n this.headerActions = [...this.headerActions, ...actions];\n } else if (typeof actions === 'function') {\n this.headerActions = actions(this.headerActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addDocumentHeaderAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n addBulkAction(actions: DescriptionReducer<BulkActionComponent>): void;\n addBulkAction(actions: BulkActionComponent[]): void;\n addBulkAction(actions: DescriptionReducer<BulkActionComponent> | BulkActionComponent[]) {\n if (Array.isArray(actions)) {\n this.bulkActions = [...this.bulkActions, ...actions];\n } else if (typeof actions === 'function') {\n this.bulkActions = actions(this.bulkActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addBulkAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n get config() {\n return {\n id: PLUGIN_ID,\n name: 'Content Manager',\n injectionZones: INJECTION_ZONES,\n apis: {\n addBulkAction: this.addBulkAction.bind(this),\n addDocumentAction: this.addDocumentAction.bind(this),\n addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),\n addEditViewSidePanel: this.addEditViewSidePanel.bind(this),\n getBulkActions: () => this.bulkActions,\n getDocumentActions: (position?: DocumentActionPosition) => {\n /**\n * When possible, pre-filter the actions by the components static position property.\n * This avoids rendering the actions in multiple places where they weren't displayed,\n * which wasn't visible but created issues with useEffect for instance.\n * The response should still be filtered by the position, as the static property is new\n * and not mandatory to avoid a breaking change.\n */\n if (position) {\n return this.documentActions.filter((action) => {\n return action.position == undefined || [action.position].flat().includes(position);\n });\n }\n\n return this.documentActions;\n },\n getEditViewSidePanels: () => this.editViewSidePanels,\n getHeaderActions: () => this.headerActions,\n },\n } satisfies PluginConfig;\n }\n}\n\n/* -------------------------------------------------------------------------------------------------\n * getPrintableType\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description Gets the human-friendly printable type name for the given value, for instance it will yield\n * `array` instead of `object`, as the native `typeof` operator would do.\n */\nconst getPrintableType = (value: unknown): string => {\n const nativeType = typeof value;\n\n if (nativeType === 'object') {\n if (value === null) return 'null';\n if (Array.isArray(value)) return 'array';\n if (value instanceof Object && value.constructor.name !== 'Object') {\n return value.constructor.name;\n }\n }\n\n return nativeType;\n};\n\nexport { ContentManagerPlugin };\nexport type {\n EditViewContext,\n ListViewContext,\n BulkActionComponent,\n BulkActionComponentProps,\n BulkActionDescription,\n DescriptionComponent,\n DescriptionReducer,\n PanelComponentProps,\n PanelComponent,\n PanelDescription,\n DocumentActionComponent,\n DocumentActionDescription,\n DocumentActionProps,\n HeaderActionComponent,\n HeaderActionDescription,\n HeaderActionProps,\n};\n"],"names":["ContentManagerPlugin","addEditViewSidePanel","panels","Array","isArray","editViewSidePanels","Error","getPrintableType","addDocumentAction","actions","documentActions","addDocumentHeaderAction","headerActions","addBulkAction","bulkActions","config","id","PLUGIN_ID","name","injectionZones","INJECTION_ZONES","apis","bind","getBulkActions","getDocumentActions","position","filter","action","undefined","flat","includes","getEditViewSidePanels","getHeaderActions","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,KAAAA,CAAMC,OAAO,CAACkC,KAAAA,CAAAA,EAAQ,OAAO,OAAA;AACjC,QAAA,IAAIA,iBAAiBE,MAAAA,IAAUF,KAAAA,CAAM,WAAW,CAACpB,IAAI,KAAK,QAAA,EAAU;YAClE,OAAOoB,KAAAA,CAAM,WAAW,CAACpB,IAAI;AAC/B,QAAA;AACF,IAAA;IAEA,OAAOqB,UAAAA;AACT,CAAA;;;;"}
1
+ {"version":3,"file":"content-manager.mjs","sources":["../../admin/src/content-manager.ts"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\n\nimport { INJECTION_ZONES } from './components/InjectionZone';\nimport { PLUGIN_ID } from './constants/plugin';\nimport {\n DEFAULT_ACTIONS,\n type DocumentActionPosition,\n type DocumentActionDescription,\n} from './pages/EditView/components/DocumentActions';\nimport { RichTextBlocksStore } from './pages/EditView/components/FormInputs/BlocksInput/BlocksEditor';\nimport { defaultBlocksStore } from './pages/EditView/components/FormInputs/BlocksInput/DefaultBlocksStore';\nimport {\n DEFAULT_HEADER_ACTIONS,\n type HeaderActionDescription,\n} from './pages/EditView/components/Header';\nimport { ActionsPanel, type PanelDescription } from './pages/EditView/components/Panels';\nimport {\n DEFAULT_BULK_ACTIONS,\n type BulkActionDescription,\n} from './pages/ListView/components/BulkActions/Actions';\nimport { DEFAULT_TABLE_ROW_ACTIONS } from './pages/ListView/components/TableActions';\n\nimport type { Document } from './hooks/useDocument';\nimport type { DocumentMetadata } from '../../shared/contracts/collection-types';\nimport type { DescriptionComponent, PluginConfig } from '@strapi/admin/strapi-admin';\n\n/* -------------------------------------------------------------------------------------------------\n * Configuration Types\n * -----------------------------------------------------------------------------------------------*/\n\ntype DescriptionReducer<Config extends object> = (prev: Config[]) => Config[];\ntype DescriptionObjReducer<Config extends object> = (prev: Config) => Config;\n\ninterface EditViewContext {\n /**\n * This will ONLY be null, if the content-type\n * does not have draft & published enabled.\n */\n activeTab: 'draft' | 'published' | null;\n /**\n * Will be either 'single-types' | 'collection-types'\n */\n collectionType: string;\n /**\n * this will be undefined if someone is creating an entry.\n */\n document?: Document;\n /**\n * this will be undefined if someone is creating an entry.\n */\n documentId?: string;\n /**\n * this will be undefined if someone is creating an entry.\n */\n meta?: DocumentMetadata;\n /**\n * The current content-type's model.\n */\n model: string;\n}\n\ninterface ListViewContext {\n /**\n * Will be either 'single-types' | 'collection-types'\n */\n collectionType: string;\n /**\n * The current selected documents in the table\n */\n documents: Document[];\n /**\n * The current content-type's model.\n */\n model: string;\n}\n\ninterface PanelComponentProps extends EditViewContext {}\n\ninterface PanelComponent extends DescriptionComponent<PanelComponentProps, PanelDescription> {\n /**\n * The defaults are added by Strapi only, if you're providing your own component,\n * you do not need to provide this.\n */\n type?: 'actions' | 'releases';\n}\n\ninterface DocumentActionProps extends EditViewContext {}\n\ninterface DocumentActionComponent\n extends DescriptionComponent<DocumentActionProps, DocumentActionDescription> {\n type?:\n | 'clone'\n | 'configure-the-view'\n | 'delete'\n | 'discard'\n | 'edit'\n | 'edit-the-model'\n | 'history'\n | 'publish'\n | 'unpublish'\n | 'update';\n position?: DocumentActionDescription['position'];\n}\n\ninterface HeaderActionProps extends EditViewContext {}\n\ninterface HeaderActionComponent\n extends DescriptionComponent<HeaderActionProps, HeaderActionDescription> {}\n\ninterface BulkActionComponentProps extends ListViewContext {}\n\ninterface BulkActionComponent\n extends DescriptionComponent<BulkActionComponentProps, BulkActionDescription> {\n type?: 'delete' | 'publish' | 'unpublish';\n}\n\n/* -------------------------------------------------------------------------------------------------\n * ContentManager plugin\n * -----------------------------------------------------------------------------------------------*/\n\nclass ContentManagerPlugin {\n /**\n * The following properties are the stored ones provided by any plugins registering with\n * the content-manager. The function calls however, need to be called at runtime in the\n * application, so instead we collate them and run them later with the complete list incl.\n * ones already registered & the context of the view.\n */\n richTextBlocksStore: RichTextBlocksStore = { ...defaultBlocksStore };\n bulkActions: BulkActionComponent[] = [...DEFAULT_BULK_ACTIONS];\n documentActions: DocumentActionComponent[] = [\n ...DEFAULT_ACTIONS,\n ...DEFAULT_TABLE_ROW_ACTIONS,\n ...DEFAULT_HEADER_ACTIONS,\n ];\n editViewSidePanels: PanelComponent[] = [ActionsPanel];\n headerActions: HeaderActionComponent[] = [];\n\n constructor() {}\n\n addRichTextBlocks(blocks: RichTextBlocksStore): void;\n addRichTextBlocks(blocks: DescriptionObjReducer<RichTextBlocksStore>): void;\n addRichTextBlocks(blocks: RichTextBlocksStore | DescriptionObjReducer<RichTextBlocksStore>) {\n if (typeof blocks === 'function') {\n const result = blocks(this.richTextBlocksStore);\n if (typeof result !== 'object' || result === null) {\n throw new Error(\n `Expected the \\`blocks\\` passed to \\`addRichTextBlocks\\` to be an object or a function, but received ${getPrintableType(result)}`\n );\n }\n this.richTextBlocksStore = result;\n } else if (typeof blocks === 'object') {\n this.richTextBlocksStore = { ...this.richTextBlocksStore, ...blocks };\n } else {\n throw new Error(\n `Expected the \\`blocks\\` passed to \\`addRichTextBlocks\\` to be an object or a function, but received ${getPrintableType(\n blocks\n )}`\n );\n }\n }\n\n addEditViewSidePanel(panels: DescriptionReducer<PanelComponent>): void;\n addEditViewSidePanel(panels: PanelComponent[]): void;\n addEditViewSidePanel(panels: DescriptionReducer<PanelComponent> | PanelComponent[]) {\n if (Array.isArray(panels)) {\n this.editViewSidePanels = [...this.editViewSidePanels, ...panels];\n } else if (typeof panels === 'function') {\n this.editViewSidePanels = panels(this.editViewSidePanels);\n } else {\n throw new Error(\n `Expected the \\`panels\\` passed to \\`addEditViewSidePanel\\` to be an array or a function, but received ${getPrintableType(\n panels\n )}`\n );\n }\n }\n\n addDocumentAction(actions: DescriptionReducer<DocumentActionComponent>): void;\n addDocumentAction(actions: DocumentActionComponent[]): void;\n addDocumentAction(\n actions: DescriptionReducer<DocumentActionComponent> | DocumentActionComponent[]\n ) {\n if (Array.isArray(actions)) {\n this.documentActions = [...this.documentActions, ...actions];\n } else if (typeof actions === 'function') {\n this.documentActions = actions(this.documentActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addDocumentAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n addDocumentHeaderAction(actions: DescriptionReducer<HeaderActionComponent>): void;\n addDocumentHeaderAction(actions: HeaderActionComponent[]): void;\n addDocumentHeaderAction(\n actions: DescriptionReducer<HeaderActionComponent> | HeaderActionComponent[]\n ) {\n if (Array.isArray(actions)) {\n this.headerActions = [...this.headerActions, ...actions];\n } else if (typeof actions === 'function') {\n this.headerActions = actions(this.headerActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addDocumentHeaderAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n addBulkAction(actions: DescriptionReducer<BulkActionComponent>): void;\n addBulkAction(actions: BulkActionComponent[]): void;\n addBulkAction(actions: DescriptionReducer<BulkActionComponent> | BulkActionComponent[]) {\n if (Array.isArray(actions)) {\n this.bulkActions = [...this.bulkActions, ...actions];\n } else if (typeof actions === 'function') {\n this.bulkActions = actions(this.bulkActions);\n } else {\n throw new Error(\n `Expected the \\`actions\\` passed to \\`addBulkAction\\` to be an array or a function, but received ${getPrintableType(\n actions\n )}`\n );\n }\n }\n\n get config() {\n return {\n id: PLUGIN_ID,\n name: 'Content Manager',\n injectionZones: INJECTION_ZONES,\n apis: {\n addBulkAction: this.addBulkAction.bind(this),\n addDocumentAction: this.addDocumentAction.bind(this),\n addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),\n addEditViewSidePanel: this.addEditViewSidePanel.bind(this),\n addRichTextBlocks: this.addRichTextBlocks.bind(this),\n getBulkActions: () => this.bulkActions,\n getDocumentActions: (position?: DocumentActionPosition) => {\n /**\n * When possible, pre-filter the actions by the components static position property.\n * This avoids rendering the actions in multiple places where they weren't displayed,\n * which wasn't visible but created issues with useEffect for instance.\n * The response should still be filtered by the position, as the static property is new\n * and not mandatory to avoid a breaking change.\n */\n if (position) {\n return this.documentActions.filter((action) => {\n return action.position == undefined || [action.position].flat().includes(position);\n });\n }\n\n return this.documentActions;\n },\n getEditViewSidePanels: () => this.editViewSidePanels,\n getHeaderActions: () => this.headerActions,\n getRichTextBlocks: () => ({ ...this.richTextBlocksStore }),\n },\n } satisfies PluginConfig;\n }\n}\n\n/* -------------------------------------------------------------------------------------------------\n * getPrintableType\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description Gets the human-friendly printable type name for the given value, for instance it will yield\n * `array` instead of `object`, as the native `typeof` operator would do.\n */\nconst getPrintableType = (value: unknown): string => {\n const nativeType = typeof value;\n\n if (nativeType === 'object') {\n if (value === null) return 'null';\n if (Array.isArray(value)) return 'array';\n if (value instanceof Object && value.constructor.name !== 'Object') {\n return value.constructor.name;\n }\n }\n\n return nativeType;\n};\n\nexport { ContentManagerPlugin };\nexport type {\n EditViewContext,\n ListViewContext,\n BulkActionComponent,\n BulkActionComponentProps,\n BulkActionDescription,\n DescriptionComponent,\n DescriptionReducer,\n PanelComponentProps,\n PanelComponent,\n PanelDescription,\n DocumentActionComponent,\n DocumentActionDescription,\n DocumentActionProps,\n HeaderActionComponent,\n HeaderActionDescription,\n HeaderActionProps,\n};\n"],"names":["ContentManagerPlugin","addRichTextBlocks","blocks","result","richTextBlocksStore","Error","getPrintableType","addEditViewSidePanel","panels","Array","isArray","editViewSidePanels","addDocumentAction","actions","documentActions","addDocumentHeaderAction","headerActions","addBulkAction","bulkActions","config","id","PLUGIN_ID","name","injectionZones","INJECTION_ZONES","apis","bind","getBulkActions","getDocumentActions","position","filter","action","undefined","flat","includes","getEditViewSidePanels","getHeaderActions","getRichTextBlocks","defaultBlocksStore","DEFAULT_BULK_ACTIONS","DEFAULT_ACTIONS","DEFAULT_TABLE_ROW_ACTIONS","DEFAULT_HEADER_ACTIONS","ActionsPanel","value","nativeType","Object"],"mappings":";;;;;;;;;AAoHA;;AAEkG,qGAElG,MAAMA,oBAAAA,CAAAA;AAqBJC,IAAAA,iBAAAA,CAAkBC,MAAwE,EAAE;QAC1F,IAAI,OAAOA,WAA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mB,KAAO;wBAAE,GAAG,IAAI,CAACjC;qBAAoB;AAC1D;AACF,SAAA;AACF,IAAA;IA7HA,WAAA,EAAc;AAhBd;;;;;AAKC,MAAA,IAAA,CACDA,mBAAAA,GAA2C;AAAE,YAAA,GAAGkC;AAAmB,SAAA;aACnEpB,WAAAA,GAAqC;AAAIqB,YAAAA,GAAAA;AAAqB,SAAA;aAC9DzB,eAAAA,GAA6C;AACxC0B,YAAAA,GAAAA,eAAAA;AACAC,YAAAA,GAAAA,yBAAAA;AACAC,YAAAA,GAAAA;AACJ,SAAA;aACD/B,kBAAAA,GAAuC;AAACgC,YAAAA;AAAa,SAAA;AACrD3B,QAAAA,IAAAA,CAAAA,aAAAA,GAAyC,EAAE;AAE5B,IAAA;AA8HjB;AAEA;;;;;;IASA,MAAMV,mBAAmB,CAACsC,KAAAA,GAAAA;AACxB,IAAA,MAAMC,aAAa,OAAOD,KAAAA;AAE1B,IAAA,IAAIC,eAAe,QAAA,EAAU;QAC3B,IAAID,KAAAA,KAAU,MAAM,OAAO,MAAA;AAC3B,QAAA,IAAInC,KAAAA,CAAMC,OAAO,CAACkC,KAAAA,CAAAA,EAAQ,OAAO,OAAA;AACjC,QAAA,IAAIA,iBAAiBE,MAAAA,IAAUF,KAAAA,CAAM,WAAW,CAACtB,IAAI,KAAK,QAAA,EAAU;YAClE,OAAOsB,KAAAA,CAAM,WAAW,CAACtB,IAAI;AAC/B,QAAA;AACF,IAAA;IAEA,OAAOuB,UAAAA;AACT,CAAA;;;;"}
@@ -150,7 +150,7 @@ const CustomRelationInput = (props)=>{
150
150
  }, relationData.documentId ?? relationData.id);
151
151
  })
152
152
  }),
153
- meta.missingCount > 0 && /* @ts-expect-error – we dont need closeLabel */ /*#__PURE__*/ jsxRuntime.jsx(StyledAlert, {
153
+ meta.missingCount > 0 && /*#__PURE__*/ jsxRuntime.jsx(StyledAlert, {
154
154
  marginTop: 1,
155
155
  variant: "warning",
156
156
  title: formatMessage({
@@ -1 +1 @@
1
- {"version":3,"file":"VersionInputRenderer.js","sources":["../../../../admin/src/history/components/VersionInputRenderer.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n useStrapiApp,\n useForm,\n InputRenderer as FormInputRenderer,\n useField,\n Form,\n} from '@strapi/admin/strapi-admin';\nimport { Alert, Box, Field, Flex, Link, Tooltip, Typography } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport { NavLink } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { HistoryVersionDataResponse } from '../../../../shared/contracts/history-versions';\nimport { COLLECTION_TYPES } from '../../constants/collections';\nimport { useDocumentRBAC } from '../../features/DocumentRBAC';\nimport { useDoc } from '../../hooks/useDocument';\nimport { useDocLayout } from '../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../hooks/useLazyComponents';\nimport { useTypedSelector } from '../../modules/hooks';\nimport { DocumentStatus } from '../../pages/EditView/components/DocumentStatus';\nimport { BlocksInput } from '../../pages/EditView/components/FormInputs/BlocksInput/BlocksInput';\nimport { ComponentInput } from '../../pages/EditView/components/FormInputs/Component/Input';\nimport {\n DynamicZone,\n useDynamicZone,\n} from '../../pages/EditView/components/FormInputs/DynamicZone/Field';\nimport { NotAllowedInput } from '../../pages/EditView/components/FormInputs/NotAllowed';\nimport { UIDInput } from '../../pages/EditView/components/FormInputs/UID';\nimport { Wysiwyg } from '../../pages/EditView/components/FormInputs/Wysiwyg/Field';\nimport { useFieldHint } from '../../pages/EditView/components/InputRenderer';\nimport { getRelationLabel } from '../../utils/relations';\nimport { useHistoryContext } from '../pages/History';\n\nimport { getRemaingFieldsLayout } from './VersionContent';\n\nimport type { EditFieldLayout } from '../../hooks/useDocumentLayout';\nimport type { RelationsFieldProps } from '../../pages/EditView/components/FormInputs/Relations/Relations';\nimport type { RelationResult } from '../../services/relations';\nimport type { Schema } from '@strapi/types';\nimport type { DistributiveOmit } from 'react-redux';\n\nconst StyledAlert = styled(Alert).attrs({ closeLabel: 'Close', onClose: () => {}, shadow: 'none' })`\n button {\n display: none;\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * CustomRelationInput\n * -----------------------------------------------------------------------------------------------*/\n\nconst LinkEllipsis = styled(Link)`\n display: block;\n\n & > span {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: block;\n }\n`;\n\nconst CustomRelationInput = (props: RelationsFieldProps) => {\n const { formatMessage } = useIntl();\n const field = useField<\n { results: RelationResult[]; meta: { missingCount: number } } | RelationResult[]\n >(props.name);\n\n /**\n * Ideally the server would return the correct shape, however, for admin user relations\n * it sanitizes everything out when it finds an object for the relation value.\n */\n let formattedFieldValue;\n if (field) {\n formattedFieldValue = Array.isArray(field.value)\n ? { results: field.value, meta: { missingCount: 0 } }\n : field.value;\n }\n\n if (\n !formattedFieldValue ||\n (formattedFieldValue.results.length === 0 && formattedFieldValue.meta.missingCount === 0)\n ) {\n return (\n <>\n <Field.Label action={props.labelAction}>{props.label}</Field.Label>\n <Box marginTop={1}>\n {/* @ts-expect-error – we dont need closeLabel */}\n <StyledAlert variant=\"default\">\n {formatMessage({\n id: 'content-manager.history.content.no-relations',\n defaultMessage: 'No relations.',\n })}\n </StyledAlert>\n </Box>\n </>\n );\n }\n\n const { results, meta } = formattedFieldValue;\n\n return (\n <Box>\n <Field.Label>{props.label}</Field.Label>\n {results.length > 0 && (\n <Flex direction=\"column\" gap={2} marginTop={1} alignItems=\"stretch\">\n {results.map((relationData) => {\n // @ts-expect-error - targetModel does exist on the attribute. But it's not typed.\n const { targetModel } = props.attribute;\n const href = `../${COLLECTION_TYPES}/${targetModel}/${relationData.documentId}`;\n const label = getRelationLabel(relationData, props.mainField);\n const isAdminUserRelation = targetModel === 'admin::user';\n\n return (\n <Flex\n key={relationData.documentId ?? relationData.id}\n paddingTop={2}\n paddingBottom={2}\n paddingLeft={4}\n paddingRight={4}\n hasRadius\n borderColor=\"neutral200\"\n background=\"neutral150\"\n justifyContent=\"space-between\"\n >\n <Box minWidth={0} paddingTop={1} paddingBottom={1} paddingRight={4}>\n <Tooltip label={label}>\n {isAdminUserRelation ? (\n <Typography>{label}</Typography>\n ) : (\n <LinkEllipsis tag={NavLink} to={href}>\n {label}\n </LinkEllipsis>\n )}\n </Tooltip>\n </Box>\n <DocumentStatus status={relationData.status as string} />\n </Flex>\n );\n })}\n </Flex>\n )}\n {meta.missingCount > 0 && (\n /* @ts-expect-error – we dont need closeLabel */\n <StyledAlert\n marginTop={1}\n variant=\"warning\"\n title={formatMessage(\n {\n id: 'content-manager.history.content.missing-relations.title',\n defaultMessage:\n '{number, plural, =1 {Missing relation} other {{number} missing relations}}',\n },\n { number: meta.missingCount }\n )}\n >\n {formatMessage(\n {\n id: 'content-manager.history.content.missing-relations.message',\n defaultMessage:\n \"{number, plural, =1 {It has} other {They have}} been deleted and can't be restored.\",\n },\n { number: meta.missingCount }\n )}\n </StyledAlert>\n )}\n </Box>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * CustomMediaInput\n * -----------------------------------------------------------------------------------------------*/\n\n// Create an object with value at key path (i.e. 'a.b.c')\nconst createInitialValuesForPath = (keyPath: string, value: any) => {\n const keys = keyPath.split('.');\n // The root level object\n const root: Record<string, any> = {};\n\n // Make the first node the root\n let node = root;\n keys.forEach((key, index) => {\n // Skip prototype pollution keys\n if (key === '__proto__' || key === 'constructor') return;\n // If it's the last key, set the node value\n if (index === keys.length - 1) {\n node[key] = value;\n } else {\n // Ensure the key exists and is an object\n node[key] = node[key] || {};\n }\n\n // Traverse down the tree\n node = node[key];\n });\n\n return root;\n};\n\nconst CustomMediaInput = (props: VersionInputRendererProps) => {\n const { value } = useField(props.name);\n const results = value?.results ?? [];\n const meta = value?.meta ?? { missingCount: 0 };\n\n const { formatMessage } = useIntl();\n\n const fields = useStrapiApp('CustomMediaInput', (state) => state.fields);\n const MediaLibrary = fields.media as React.ComponentType<\n VersionInputRendererProps & { multiple: boolean }\n >;\n\n return (\n <Flex direction=\"column\" gap={2} alignItems=\"stretch\">\n <Form\n method=\"PUT\"\n disabled={true}\n initialValues={createInitialValuesForPath(props.name, results)}\n >\n <MediaLibrary {...props} disabled={true} multiple={results.length > 1} />\n </Form>\n {meta.missingCount > 0 && (\n <StyledAlert\n variant=\"warning\"\n closeLabel=\"Close\"\n onClose={() => {}}\n title={formatMessage(\n {\n id: 'content-manager.history.content.missing-assets.title',\n defaultMessage:\n '{number, plural, =1 {Missing asset} other {{number} missing assets}}',\n },\n { number: meta.missingCount }\n )}\n >\n {formatMessage(\n {\n id: 'content-manager.history.content.missing-assets.message',\n defaultMessage:\n \"{number, plural, =1 {It has} other {They have}} been deleted in the Media Library and can't be restored.\",\n },\n { number: meta.missingCount }\n )}\n </StyledAlert>\n )}\n </Flex>\n );\n};\n\ntype VersionInputRendererProps = DistributiveOmit<EditFieldLayout, 'size'> & {\n /**\n * In the context of content history, deleted fields need to ignore RBAC\n * @default false\n */\n shouldIgnoreRBAC?: boolean;\n};\n\n/**\n * Checks if the i18n plugin added a label action to the field and modifies it\n * to adapt the wording for the history page.\n */\nconst getLabelAction = (labelAction: VersionInputRendererProps['labelAction']) => {\n if (!React.isValidElement(labelAction)) {\n return labelAction;\n }\n\n // TODO: find a better way to do this rather than access internals\n const labelActionTitleId = labelAction.props.title.id;\n\n if (labelActionTitleId === 'i18n.Field.localized') {\n return React.cloneElement(labelAction, {\n ...labelAction.props,\n title: {\n id: 'history.content.localized',\n defaultMessage:\n 'This value is specific to this locale. If you restore this version, the content will not be replaced for other locales.',\n },\n });\n }\n\n if (labelActionTitleId === 'i18n.Field.not-localized') {\n return React.cloneElement(labelAction, {\n ...labelAction.props,\n title: {\n id: 'history.content.not-localized',\n defaultMessage:\n 'This value is common to all locales. If you restore this version and save the changes, the content will be replaced for all locales.',\n },\n });\n }\n\n // Label action is unrelated to i18n, don't touch it.\n return labelAction;\n};\n\n/**\n * @internal\n *\n * @description An abstraction around the regular form input renderer designed specifically\n * to be used on the History page in the content-manager. It understands how to render specific\n * inputs within the context of a history version (i.e. relations, media, ignored RBAC, etc...)\n */\nconst VersionInputRenderer = ({\n visible,\n hint: providedHint,\n shouldIgnoreRBAC = false,\n labelAction,\n ...props\n}: VersionInputRendererProps) => {\n const customLabelAction = getLabelAction(labelAction);\n\n const { formatMessage } = useIntl();\n const version = useHistoryContext('VersionContent', (state) => state.selectedVersion);\n const configuration = useHistoryContext('VersionContent', (state) => state.configuration);\n const fieldSizes = useTypedSelector((state) => state['content-manager'].app.fieldSizes);\n\n const { id, components } = useDoc();\n const isFormDisabled = useForm('InputRenderer', (state) => state.disabled);\n\n const isInDynamicZone = useDynamicZone('isInDynamicZone', (state) => state.isInDynamicZone);\n\n const canCreateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canCreateFields);\n const canReadFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canReadFields);\n const canUpdateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUpdateFields);\n const canUserAction = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUserAction);\n\n const editableFields = id ? canUpdateFields : canCreateFields;\n const readableFields = id ? canReadFields : canCreateFields;\n /**\n * Component fields are always readable and editable,\n * however the fields within them may not be.\n */\n const canUserReadField = canUserAction(props.name, readableFields, props.type);\n const canUserEditField = canUserAction(props.name, editableFields, props.type);\n\n const fields = useStrapiApp('InputRenderer', (app) => app.fields);\n const { lazyComponentStore } = useLazyComponents(\n attributeHasCustomFieldProperty(props.attribute) ? [props.attribute.customField] : undefined\n );\n\n const hint = useFieldHint(providedHint, props.attribute);\n const {\n edit: { components: componentsLayout },\n } = useDocLayout();\n\n if (!visible) {\n return null;\n }\n\n /**\n * Don't render the field if the user can't read it.\n */\n if (!shouldIgnoreRBAC && !canUserReadField && !isInDynamicZone) {\n return <NotAllowedInput hint={hint} {...props} />;\n }\n\n const fieldIsDisabled =\n (!canUserEditField && !isInDynamicZone) || props.disabled || isFormDisabled;\n\n /**\n * Attributes found on the current content-type schema cannot be restored. We handle\n * this by displaying a warning alert to the user instead of the input for that field type.\n */\n const addedAttributes = version.meta.unknownAttributes.added;\n if (Object.keys(addedAttributes).includes(props.name)) {\n return (\n <Flex direction=\"column\" alignItems=\"flex-start\" gap={1}>\n <Field.Label>{props.label}</Field.Label>\n <StyledAlert\n width=\"100%\"\n closeLabel=\"Close\"\n onClose={() => {}}\n variant=\"warning\"\n title={formatMessage({\n id: 'content-manager.history.content.new-field.title',\n defaultMessage: 'New field',\n })}\n >\n {formatMessage({\n id: 'content-manager.history.content.new-field.message',\n defaultMessage:\n \"This field didn't exist when this version was saved. If you restore this version, it will be empty.\",\n })}\n </StyledAlert>\n </Flex>\n );\n }\n\n /**\n * Because a custom field has a unique prop but the type could be confused with either\n * the useField hook or the type of the field we need to handle it separately and first.\n */\n if (attributeHasCustomFieldProperty(props.attribute)) {\n const CustomInput = lazyComponentStore[props.attribute.customField];\n\n if (CustomInput) {\n return (\n <CustomInput\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n return (\n <FormInputRenderer\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n // @ts-expect-error – this workaround lets us display that the custom field is missing.\n type={props.attribute.customField}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * Since media fields use a custom input via the upload plugin provided by the useLibrary hook,\n * we need to handle the them before other custom inputs coming from the useLibrary hook.\n */\n if (props.type === 'media') {\n return (\n <CustomMediaInput {...props} labelAction={customLabelAction} disabled={fieldIsDisabled} />\n );\n }\n /**\n * This is where we handle ONLY the fields from the `useLibrary` hook.\n */\n const addedInputTypes = Object.keys(fields);\n if (!attributeHasCustomFieldProperty(props.attribute) && addedInputTypes.includes(props.type)) {\n const CustomInput = fields[props.type];\n return (\n <CustomInput\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLibrary hook.\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * These include the content-manager specific fields, failing that we fall back\n * to the more generic form input renderer.\n */\n switch (props.type) {\n case 'blocks':\n return <BlocksInput {...props} hint={hint} type={props.type} disabled={fieldIsDisabled} />;\n case 'component':\n const { layout } = componentsLayout[props.attribute.component];\n // Components can only have one panel, so only save the first layout item\n const [remainingFieldsLayout] = getRemaingFieldsLayout({\n layout: [layout],\n metadatas: configuration.components[props.attribute.component].metadatas,\n fieldSizes,\n schemaAttributes: components[props.attribute.component].attributes,\n });\n\n return (\n <ComponentInput\n {...props}\n layout={[...layout, ...(remainingFieldsLayout || [])]}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n >\n {(inputProps) => <VersionInputRenderer {...inputProps} shouldIgnoreRBAC={true} />}\n </ComponentInput>\n );\n case 'dynamiczone':\n return (\n <DynamicZone\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n >\n {(inputProps) => <VersionInputRenderer {...inputProps} shouldIgnoreRBAC={true} />}\n </DynamicZone>\n );\n case 'relation':\n return (\n <CustomRelationInput\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n case 'richtext':\n return (\n <Wysiwyg\n {...props}\n hint={hint}\n type={props.type}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n case 'uid':\n return (\n <UIDInput\n {...props}\n hint={hint}\n type={props.type}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n /**\n * Enumerations are a special case because they require options.\n */\n case 'enumeration':\n return (\n <FormInputRenderer\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n options={props.attribute.enum.map((value) => ({ value }))}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n default:\n // These props are not needed for the generic form input renderer.\n const { unique: _unique, mainField: _mainField, ...restProps } = props;\n return (\n <FormInputRenderer\n {...restProps}\n hint={hint}\n labelAction={customLabelAction}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n }\n};\n\nconst attributeHasCustomFieldProperty = (\n attribute: Schema.Attribute.AnyAttribute\n): attribute is Schema.Attribute.AnyAttribute & Schema.Attribute.CustomField<string> =>\n 'customField' in attribute && typeof attribute.customField === 'string';\n\nexport type { VersionInputRendererProps };\nexport { VersionInputRenderer };\n"],"names":["StyledAlert","styled","Alert","attrs","closeLabel","onClose","shadow","LinkEllipsis","Link","CustomRelationInput","props","formatMessage","useIntl","field","useField","name","formattedFieldValue","Array","isArray","value","results","meta","missingCount","length","_jsxs","_Fragment","_jsx","Field","Label","action","labelAction","label","Box","marginTop","variant","id","defaultMessage","Flex","direction","gap","alignItems","map","relationData","targetModel","attribute","href","COLLECTION_TYPES","documentId","getRelationLabel","mainField","isAdminUserRelation","paddingTop","paddingBottom","paddingLeft","paddingRight","hasRadius","borderColor","background","justifyContent","minWidth","Tooltip","Typography","tag","NavLink","to","DocumentStatus","status","title","number","createInitialValuesForPath","keyPath","keys","split","root","node","forEach","key","index","CustomMediaInput","fields","useStrapiApp","state","MediaLibrary","media","Form","method","disabled","initialValues","multiple","getLabelAction","React","isValidElement","labelActionTitleId","cloneElement","VersionInputRenderer","visible","hint","providedHint","shouldIgnoreRBAC","customLabelAction","version","useHistoryContext","selectedVersion","configuration","fieldSizes","useTypedSelector","app","components","useDoc","isFormDisabled","useForm","isInDynamicZone","useDynamicZone","canCreateFields","useDocumentRBAC","rbac","canReadFields","canUpdateFields","canUserAction","editableFields","readableFields","canUserReadField","type","canUserEditField","lazyComponentStore","useLazyComponents","attributeHasCustomFieldProperty","customField","undefined","useFieldHint","edit","componentsLayout","useDocLayout","NotAllowedInput","fieldIsDisabled","addedAttributes","unknownAttributes","added","Object","includes","width","CustomInput","FormInputRenderer","addedInputTypes","BlocksInput","layout","component","remainingFieldsLayout","getRemaingFieldsLayout","metadatas","schemaAttributes","attributes","ComponentInput","inputProps","DynamicZone","W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,QAAQC,OAAO,EAAE/G,WAAWgH,UAAU,EAAE,GAAGC,SAAAA,EAAW,GAAGxJ,KAAAA;AACjE,YAAA,qBACEgB,cAAA,CAACoH,yBAAAA,EAAAA;AACE,gBAAA,GAAGoB,SAAS;gBACblE,IAAAA,EAAMA,IAAAA;gBACNlE,WAAAA,EAAaqE,iBAAAA;;AAEbuB,gBAAAA,IAAAA,EAAMhH,KAAAA,CAAMqH,WAAW,GAAG,cAAA,GAAiBrH,MAAMgH,IAAI;gBACrDpC,QAAAA,EAAUgD;;AAGlB;AACF;AAEA,MAAMR,+BAAAA,GAAkC,CACtClF,SAAAA,GAEA,aAAA,IAAiBA,aAAa,OAAOA,SAAAA,CAAUmF,WAAW,KAAK,QAAA;;;;"}
1
+ {"version":3,"file":"VersionInputRenderer.js","sources":["../../../../admin/src/history/components/VersionInputRenderer.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n useStrapiApp,\n useForm,\n InputRenderer as FormInputRenderer,\n useField,\n Form,\n} from '@strapi/admin/strapi-admin';\nimport { Alert, Box, Field, Flex, Link, Tooltip, Typography } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport { NavLink } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { HistoryVersionDataResponse } from '../../../../shared/contracts/history-versions';\nimport { COLLECTION_TYPES } from '../../constants/collections';\nimport { useDocumentRBAC } from '../../features/DocumentRBAC';\nimport { useDoc } from '../../hooks/useDocument';\nimport { useDocLayout } from '../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../hooks/useLazyComponents';\nimport { useTypedSelector } from '../../modules/hooks';\nimport { DocumentStatus } from '../../pages/EditView/components/DocumentStatus';\nimport { BlocksInput } from '../../pages/EditView/components/FormInputs/BlocksInput/BlocksInput';\nimport { ComponentInput } from '../../pages/EditView/components/FormInputs/Component/Input';\nimport {\n DynamicZone,\n useDynamicZone,\n} from '../../pages/EditView/components/FormInputs/DynamicZone/Field';\nimport { NotAllowedInput } from '../../pages/EditView/components/FormInputs/NotAllowed';\nimport { UIDInput } from '../../pages/EditView/components/FormInputs/UID';\nimport { Wysiwyg } from '../../pages/EditView/components/FormInputs/Wysiwyg/Field';\nimport { useFieldHint } from '../../pages/EditView/components/InputRenderer';\nimport { getRelationLabel } from '../../utils/relations';\nimport { useHistoryContext } from '../pages/History';\n\nimport { getRemaingFieldsLayout } from './VersionContent';\n\nimport type { EditFieldLayout } from '../../hooks/useDocumentLayout';\nimport type { RelationsFieldProps } from '../../pages/EditView/components/FormInputs/Relations/Relations';\nimport type { RelationResult } from '../../services/relations';\nimport type { Schema } from '@strapi/types';\nimport type { DistributiveOmit } from 'react-redux';\n\nconst StyledAlert = styled(Alert).attrs({ closeLabel: 'Close', onClose: () => {}, shadow: 'none' })`\n button {\n display: none;\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * CustomRelationInput\n * -----------------------------------------------------------------------------------------------*/\n\nconst LinkEllipsis = styled(Link)`\n display: block;\n\n & > span {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: block;\n }\n`;\n\nconst CustomRelationInput = (props: RelationsFieldProps) => {\n const { formatMessage } = useIntl();\n const field = useField<\n { results: RelationResult[]; meta: { missingCount: number } } | RelationResult[]\n >(props.name);\n\n /**\n * Ideally the server would return the correct shape, however, for admin user relations\n * it sanitizes everything out when it finds an object for the relation value.\n */\n let formattedFieldValue;\n if (field) {\n formattedFieldValue = Array.isArray(field.value)\n ? { results: field.value, meta: { missingCount: 0 } }\n : field.value;\n }\n\n if (\n !formattedFieldValue ||\n (formattedFieldValue.results.length === 0 && formattedFieldValue.meta.missingCount === 0)\n ) {\n return (\n <>\n <Field.Label action={props.labelAction}>{props.label}</Field.Label>\n <Box marginTop={1}>\n <StyledAlert variant=\"default\">\n {formatMessage({\n id: 'content-manager.history.content.no-relations',\n defaultMessage: 'No relations.',\n })}\n </StyledAlert>\n </Box>\n </>\n );\n }\n\n const { results, meta } = formattedFieldValue;\n\n return (\n <Box>\n <Field.Label>{props.label}</Field.Label>\n {results.length > 0 && (\n <Flex direction=\"column\" gap={2} marginTop={1} alignItems=\"stretch\">\n {results.map((relationData) => {\n // @ts-expect-error - targetModel does exist on the attribute. But it's not typed.\n const { targetModel } = props.attribute;\n const href = `../${COLLECTION_TYPES}/${targetModel}/${relationData.documentId}`;\n const label = getRelationLabel(relationData, props.mainField);\n const isAdminUserRelation = targetModel === 'admin::user';\n\n return (\n <Flex\n key={relationData.documentId ?? relationData.id}\n paddingTop={2}\n paddingBottom={2}\n paddingLeft={4}\n paddingRight={4}\n hasRadius\n borderColor=\"neutral200\"\n background=\"neutral150\"\n justifyContent=\"space-between\"\n >\n <Box minWidth={0} paddingTop={1} paddingBottom={1} paddingRight={4}>\n <Tooltip label={label}>\n {isAdminUserRelation ? (\n <Typography>{label}</Typography>\n ) : (\n <LinkEllipsis tag={NavLink} to={href}>\n {label}\n </LinkEllipsis>\n )}\n </Tooltip>\n </Box>\n <DocumentStatus status={relationData.status as string} />\n </Flex>\n );\n })}\n </Flex>\n )}\n {meta.missingCount > 0 && (\n <StyledAlert\n marginTop={1}\n variant=\"warning\"\n title={formatMessage(\n {\n id: 'content-manager.history.content.missing-relations.title',\n defaultMessage:\n '{number, plural, =1 {Missing relation} other {{number} missing relations}}',\n },\n { number: meta.missingCount }\n )}\n >\n {formatMessage(\n {\n id: 'content-manager.history.content.missing-relations.message',\n defaultMessage:\n \"{number, plural, =1 {It has} other {They have}} been deleted and can't be restored.\",\n },\n { number: meta.missingCount }\n )}\n </StyledAlert>\n )}\n </Box>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * CustomMediaInput\n * -----------------------------------------------------------------------------------------------*/\n\n// Create an object with value at key path (i.e. 'a.b.c')\nconst createInitialValuesForPath = (keyPath: string, value: any) => {\n const keys = keyPath.split('.');\n // The root level object\n const root: Record<string, any> = {};\n\n // Make the first node the root\n let node = root;\n keys.forEach((key, index) => {\n // Skip prototype pollution keys\n if (key === '__proto__' || key === 'constructor') return;\n // If it's the last key, set the node value\n if (index === keys.length - 1) {\n node[key] = value;\n } else {\n // Ensure the key exists and is an object\n node[key] = node[key] || {};\n }\n\n // Traverse down the tree\n node = node[key];\n });\n\n return root;\n};\n\nconst CustomMediaInput = (props: VersionInputRendererProps) => {\n const { value } = useField(props.name);\n const results = value?.results ?? [];\n const meta = value?.meta ?? { missingCount: 0 };\n\n const { formatMessage } = useIntl();\n\n const fields = useStrapiApp('CustomMediaInput', (state) => state.fields);\n const MediaLibrary = fields.media as React.ComponentType<\n VersionInputRendererProps & { multiple: boolean }\n >;\n\n return (\n <Flex direction=\"column\" gap={2} alignItems=\"stretch\">\n <Form\n method=\"PUT\"\n disabled={true}\n initialValues={createInitialValuesForPath(props.name, results)}\n >\n <MediaLibrary {...props} disabled={true} multiple={results.length > 1} />\n </Form>\n {meta.missingCount > 0 && (\n <StyledAlert\n variant=\"warning\"\n closeLabel=\"Close\"\n onClose={() => {}}\n title={formatMessage(\n {\n id: 'content-manager.history.content.missing-assets.title',\n defaultMessage:\n '{number, plural, =1 {Missing asset} other {{number} missing assets}}',\n },\n { number: meta.missingCount }\n )}\n >\n {formatMessage(\n {\n id: 'content-manager.history.content.missing-assets.message',\n defaultMessage:\n \"{number, plural, =1 {It has} other {They have}} been deleted in the Media Library and can't be restored.\",\n },\n { number: meta.missingCount }\n )}\n </StyledAlert>\n )}\n </Flex>\n );\n};\n\ntype VersionInputRendererProps = DistributiveOmit<EditFieldLayout, 'size'> & {\n /**\n * In the context of content history, deleted fields need to ignore RBAC\n * @default false\n */\n shouldIgnoreRBAC?: boolean;\n};\n\n/**\n * Checks if the i18n plugin added a label action to the field and modifies it\n * to adapt the wording for the history page.\n */\nconst getLabelAction = (labelAction: VersionInputRendererProps['labelAction']) => {\n if (!React.isValidElement(labelAction)) {\n return labelAction;\n }\n\n // TODO: find a better way to do this rather than access internals\n const labelActionTitleId = labelAction.props.title.id;\n\n if (labelActionTitleId === 'i18n.Field.localized') {\n return React.cloneElement(labelAction, {\n ...labelAction.props,\n title: {\n id: 'history.content.localized',\n defaultMessage:\n 'This value is specific to this locale. If you restore this version, the content will not be replaced for other locales.',\n },\n });\n }\n\n if (labelActionTitleId === 'i18n.Field.not-localized') {\n return React.cloneElement(labelAction, {\n ...labelAction.props,\n title: {\n id: 'history.content.not-localized',\n defaultMessage:\n 'This value is common to all locales. If you restore this version and save the changes, the content will be replaced for all locales.',\n },\n });\n }\n\n // Label action is unrelated to i18n, don't touch it.\n return labelAction;\n};\n\n/**\n * @internal\n *\n * @description An abstraction around the regular form input renderer designed specifically\n * to be used on the History page in the content-manager. It understands how to render specific\n * inputs within the context of a history version (i.e. relations, media, ignored RBAC, etc...)\n */\nconst VersionInputRenderer = ({\n visible,\n hint: providedHint,\n shouldIgnoreRBAC = false,\n labelAction,\n ...props\n}: VersionInputRendererProps) => {\n const customLabelAction = getLabelAction(labelAction);\n\n const { formatMessage } = useIntl();\n const version = useHistoryContext('VersionContent', (state) => state.selectedVersion);\n const configuration = useHistoryContext('VersionContent', (state) => state.configuration);\n const fieldSizes = useTypedSelector((state) => state['content-manager'].app.fieldSizes);\n\n const { id, components } = useDoc();\n const isFormDisabled = useForm('InputRenderer', (state) => state.disabled);\n\n const isInDynamicZone = useDynamicZone('isInDynamicZone', (state) => state.isInDynamicZone);\n\n const canCreateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canCreateFields);\n const canReadFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canReadFields);\n const canUpdateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUpdateFields);\n const canUserAction = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUserAction);\n\n const editableFields = id ? canUpdateFields : canCreateFields;\n const readableFields = id ? canReadFields : canCreateFields;\n /**\n * Component fields are always readable and editable,\n * however the fields within them may not be.\n */\n const canUserReadField = canUserAction(props.name, readableFields, props.type);\n const canUserEditField = canUserAction(props.name, editableFields, props.type);\n\n const fields = useStrapiApp('InputRenderer', (app) => app.fields);\n const { lazyComponentStore } = useLazyComponents(\n attributeHasCustomFieldProperty(props.attribute) ? [props.attribute.customField] : undefined\n );\n\n const hint = useFieldHint(providedHint, props.attribute);\n const {\n edit: { components: componentsLayout },\n } = useDocLayout();\n\n if (!visible) {\n return null;\n }\n\n /**\n * Don't render the field if the user can't read it.\n */\n if (!shouldIgnoreRBAC && !canUserReadField && !isInDynamicZone) {\n return <NotAllowedInput hint={hint} {...props} />;\n }\n\n const fieldIsDisabled =\n (!canUserEditField && !isInDynamicZone) || props.disabled || isFormDisabled;\n\n /**\n * Attributes found on the current content-type schema cannot be restored. We handle\n * this by displaying a warning alert to the user instead of the input for that field type.\n */\n const addedAttributes = version.meta.unknownAttributes.added;\n if (Object.keys(addedAttributes).includes(props.name)) {\n return (\n <Flex direction=\"column\" alignItems=\"flex-start\" gap={1}>\n <Field.Label>{props.label}</Field.Label>\n <StyledAlert\n width=\"100%\"\n closeLabel=\"Close\"\n onClose={() => {}}\n variant=\"warning\"\n title={formatMessage({\n id: 'content-manager.history.content.new-field.title',\n defaultMessage: 'New field',\n })}\n >\n {formatMessage({\n id: 'content-manager.history.content.new-field.message',\n defaultMessage:\n \"This field didn't exist when this version was saved. If you restore this version, it will be empty.\",\n })}\n </StyledAlert>\n </Flex>\n );\n }\n\n /**\n * Because a custom field has a unique prop but the type could be confused with either\n * the useField hook or the type of the field we need to handle it separately and first.\n */\n if (attributeHasCustomFieldProperty(props.attribute)) {\n const CustomInput = lazyComponentStore[props.attribute.customField];\n\n if (CustomInput) {\n return (\n <CustomInput\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n return (\n <FormInputRenderer\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n // @ts-expect-error – this workaround lets us display that the custom field is missing.\n type={props.attribute.customField}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * Since media fields use a custom input via the upload plugin provided by the useLibrary hook,\n * we need to handle the them before other custom inputs coming from the useLibrary hook.\n */\n if (props.type === 'media') {\n return (\n <CustomMediaInput {...props} labelAction={customLabelAction} disabled={fieldIsDisabled} />\n );\n }\n /**\n * This is where we handle ONLY the fields from the `useLibrary` hook.\n */\n const addedInputTypes = Object.keys(fields);\n if (!attributeHasCustomFieldProperty(props.attribute) && addedInputTypes.includes(props.type)) {\n const CustomInput = fields[props.type];\n return (\n <CustomInput\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLibrary hook.\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * These include the content-manager specific fields, failing that we fall back\n * to the more generic form input renderer.\n */\n switch (props.type) {\n case 'blocks':\n return <BlocksInput {...props} hint={hint} type={props.type} disabled={fieldIsDisabled} />;\n case 'component':\n const { layout } = componentsLayout[props.attribute.component];\n // Components can only have one panel, so only save the first layout item\n const [remainingFieldsLayout] = getRemaingFieldsLayout({\n layout: [layout],\n metadatas: configuration.components[props.attribute.component].metadatas,\n fieldSizes,\n schemaAttributes: components[props.attribute.component].attributes,\n });\n\n return (\n <ComponentInput\n {...props}\n layout={[...layout, ...(remainingFieldsLayout || [])]}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n >\n {(inputProps) => <VersionInputRenderer {...inputProps} shouldIgnoreRBAC={true} />}\n </ComponentInput>\n );\n case 'dynamiczone':\n return (\n <DynamicZone\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n >\n {(inputProps) => <VersionInputRenderer {...inputProps} shouldIgnoreRBAC={true} />}\n </DynamicZone>\n );\n case 'relation':\n return (\n <CustomRelationInput\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n case 'richtext':\n return (\n <Wysiwyg\n {...props}\n hint={hint}\n type={props.type}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n case 'uid':\n return (\n <UIDInput\n {...props}\n hint={hint}\n type={props.type}\n labelAction={customLabelAction}\n disabled={fieldIsDisabled}\n />\n );\n /**\n * Enumerations are a special case because they require options.\n */\n case 'enumeration':\n return (\n <FormInputRenderer\n {...props}\n hint={hint}\n labelAction={customLabelAction}\n options={props.attribute.enum.map((value) => ({ value }))}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n default:\n // These props are not needed for the generic form input renderer.\n const { unique: _unique, mainField: _mainField, ...restProps } = props;\n return (\n <FormInputRenderer\n {...restProps}\n hint={hint}\n labelAction={customLabelAction}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n }\n};\n\nconst attributeHasCustomFieldProperty = (\n attribute: Schema.Attribute.AnyAttribute\n): attribute is Schema.Attribute.AnyAttribute & Schema.Attribute.CustomField<string> =>\n 'customField' in attribute && typeof attribute.customField === 'string';\n\nexport type { VersionInputRendererProps };\nexport { VersionInputRenderer };\n"],"names":["StyledAlert","styled","Alert","attrs","closeLabel","onClose","shadow","LinkEllipsis","Link","CustomRelationInput","props","formatMessage","useIntl","field","useField","name","formattedFieldValue","Array","isArray","value","results","meta","missingCount","length","_jsxs","_Fragment","_jsx","Field","Label","action","labelAction","label","Box","marginTop","variant","id","defaultMessage","Flex","direction","gap","alignItems","map","relationData","targetModel","attribute","href","COLLECTION_TYPES","documentId","getRelationLabel","mainField","isAdminUserRelation","paddingTop","paddingBottom","paddingLeft","paddingRight","hasRadius","borderColor","background","justifyContent","minWidth","Tooltip","Typography","tag","NavLink","to","DocumentStatus","status","title","number","createInitialValuesForPath","keyPath","keys","split","root","node","forEach","key","index","CustomMediaInput","fields","useStrapiApp","state","MediaLibrary","media","Form","method","disabled","initialValues","multiple","getLabelAction","React","isValidElement","labelActionTitleId","cloneElement","VersionInputRenderer","visible","hint","providedHint","shouldIgnoreRBAC","customLabelAction","version","useHistoryContext","selectedVersion","configuration","fieldSizes","useTypedSelector","app","components","useDoc","isFormDisabled","useForm","isInDynamicZone","useDynamicZone","canCreateFields","useDocumentRBAC","rbac","canReadFields","canUpdateFields","canUserAction","editableFields","readableFields","canUserReadField","type","canUserEditField","lazyComponentStore","useLazyComponents","attributeHasCustomFieldProperty","customField","undefined","useFieldHint","edit","componentsLayout","useDocLayout","NotAllowedInput","fieldIsDisabled","addedAttributes","unknownAttributes","added","Object","includes","width","CustomInput","FormInputRenderer","addedInputTypes","BlocksInput","layout","component","remainingFieldsLayout","getRemaingFieldsLayout","metadatas","schemaAttributes","attributes","ComponentInput","inputProps","DynamicZone","Wysiwyg","UIDInput","options","enum","unique","_unique","_mainField","restProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAMA,WAAAA,GAAcC,uBAAAA,CAAOC,kBAAAA,CAAAA,CAAOC,KAAK,CAAC;IAAEC,UAAAA,EAAY,OAAA;AAASC,IAAAA,OAAAA,EAAS,IAAA,CAAO,CAAA;IAAGC,MAAAA,EAAQ;AAAO,CAAA,CAAE;;;;AAInG,CAAC;AAED;;AAEkG,qGAElG,MAAMC,YAAAA,GAAeN,uBAAAA,CAAOO,iBAAAA,CAAK;;;;;;;;;AASjC,CAAC;AAED,MAAMC,sBAAsB,CAACC,KAAAA,GAAAA;IAC3B,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;IAC1B,MAAMC,KAAAA,GAAQC,oBAAAA,CAEZJ,KAAAA,CAAMK,IAAI,CAAA;AAEZ;;;AAGC,MACD,IAAIC,mBAAAA;AACJ,IAAA,IAAIH,KAAAA,EAAO;AACTG,QAAAA,mBAAAA,GAAsBC,KAAAA,CAAMC,OAAO,CAACL,KAAAA,CAAMM,KAAK,CAAA,GAC3C;AAAEC,YAAAA,OAAAA,EAASP,MAAMM,KAAK;YAAEE,IAAAA,EAAM;gBAAEC,YAAAA,EAAc;AAAE;A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AAA,CAACoH,yBAAAA,EAAAA;AACE,gBAAA,GAAGpI,KAAK;gBACTsF,IAAAA,EAAMA,IAAAA;gBACNlE,WAAAA,EAAaqE,iBAAAA;gBACb0D,OAAAA,EAASnJ,KAAAA,CAAMkC,SAAS,CAACkH,IAAI,CAACrH,GAAG,CAAC,CAACtB,KAAAA,IAAW;AAAEA,wBAAAA;qBAAM,CAAA,CAAA;;AAEtDuG,gBAAAA,IAAAA,EAAMhH,KAAAA,CAAMqH,WAAW,GAAG,cAAA,GAAiBrH,MAAMgH,IAAI;gBACrDpC,QAAAA,EAAUgD;;AAGhB,QAAA;;YAEE,MAAM,EAAEyB,QAAQC,OAAO,EAAE/G,WAAWgH,UAAU,EAAE,GAAGC,SAAAA,EAAW,GAAGxJ,KAAAA;AACjE,YAAA,qBACEgB,cAAA,CAACoH,yBAAAA,EAAAA;AACE,gBAAA,GAAGoB,SAAS;gBACblE,IAAAA,EAAMA,IAAAA;gBACNlE,WAAAA,EAAaqE,iBAAAA;;AAEbuB,gBAAAA,IAAAA,EAAMhH,KAAAA,CAAMqH,WAAW,GAAG,cAAA,GAAiBrH,MAAMgH,IAAI;gBACrDpC,QAAAA,EAAUgD;;AAGlB;AACF;AAEA,MAAMR,+BAAAA,GAAkC,CACtClF,SAAAA,GAEA,aAAA,IAAiBA,aAAa,OAAOA,SAAAA,CAAUmF,WAAW,KAAK,QAAA;;;;"}
@@ -129,7 +129,7 @@ const CustomRelationInput = (props)=>{
129
129
  }, relationData.documentId ?? relationData.id);
130
130
  })
131
131
  }),
132
- meta.missingCount > 0 && /* @ts-expect-error – we dont need closeLabel */ /*#__PURE__*/ jsx(StyledAlert, {
132
+ meta.missingCount > 0 && /*#__PURE__*/ jsx(StyledAlert, {
133
133
  marginTop: 1,
134
134
  variant: "warning",
135
135
  title: formatMessage({