@webiny/app-file-manager 6.4.11 → 6.6.0-alpha.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 (235) hide show
  1. package/app.js +21 -2
  2. package/app.js.map +1 -1
  3. package/domain/tagsHelpers.d.ts +2 -2
  4. package/domain/types.d.ts +0 -8
  5. package/features/permissions/abstractions.d.ts +2 -2
  6. package/features/permissions/feature.d.ts +3 -3
  7. package/features/shared/FILE_FIELDS.js +4 -0
  8. package/features/shared/FILE_FIELDS.js.map +1 -1
  9. package/features/shared/FileFieldsProviderWithWcp.d.ts +5 -5
  10. package/features/shared/FileFieldsProviderWithWcp.js +7 -7
  11. package/features/shared/FileFieldsProviderWithWcp.js.map +1 -1
  12. package/modules/AiEnrichment/AiImageEnrichmentEventHandler.d.ts +18 -0
  13. package/modules/AiEnrichment/AiImageEnrichmentEventHandler.js +33 -0
  14. package/modules/AiEnrichment/AiImageEnrichmentEventHandler.js.map +1 -0
  15. package/modules/AiEnrichment/ReenrichFileGateway.d.ts +12 -0
  16. package/modules/AiEnrichment/ReenrichFileGateway.js +23 -0
  17. package/modules/AiEnrichment/ReenrichFileGateway.js.map +1 -0
  18. package/modules/AiEnrichment/ReenrichWithAi.d.ts +11 -0
  19. package/modules/AiEnrichment/ReenrichWithAi.js +57 -0
  20. package/modules/AiEnrichment/ReenrichWithAi.js.map +1 -0
  21. package/modules/AiEnrichment/ReenrichWithAiPresenter.d.ts +50 -0
  22. package/modules/AiEnrichment/ReenrichWithAiPresenter.js +114 -0
  23. package/modules/AiEnrichment/ReenrichWithAiPresenter.js.map +1 -0
  24. package/modules/AiEnrichment/StreamingPlaceholder.d.ts +15 -0
  25. package/modules/AiEnrichment/StreamingPlaceholder.js +32 -0
  26. package/modules/AiEnrichment/StreamingPlaceholder.js.map +1 -0
  27. package/modules/AiEnrichment/abstractions.d.ts +70 -0
  28. package/modules/AiEnrichment/abstractions.js +6 -0
  29. package/modules/AiEnrichment/abstractions.js.map +1 -0
  30. package/modules/AiEnrichment/feature.d.ts +3 -0
  31. package/modules/AiEnrichment/feature.js +21 -0
  32. package/modules/AiEnrichment/feature.js.map +1 -0
  33. package/modules/AiEnrichment/index.d.ts +2 -0
  34. package/modules/AiEnrichment/index.js +9 -0
  35. package/modules/AiEnrichment/index.js.map +1 -0
  36. package/modules/Enterprise/index.js +3 -3
  37. package/modules/Enterprise/index.js.map +1 -1
  38. package/modules/HeadlessCms/fieldType/AssetFieldSettingsModifier.d.ts +26 -0
  39. package/modules/HeadlessCms/fieldType/AssetFieldSettingsModifier.js +39 -0
  40. package/modules/HeadlessCms/fieldType/AssetFieldSettingsModifier.js.map +1 -0
  41. package/modules/HeadlessCms/fieldType/AssetFieldType.d.ts +34 -0
  42. package/modules/HeadlessCms/fieldType/AssetFieldType.js +42 -0
  43. package/modules/HeadlessCms/fieldType/AssetFieldType.js.map +1 -0
  44. package/modules/HeadlessCms/fieldType/AssetFormFieldType.d.ts +21 -0
  45. package/modules/HeadlessCms/fieldType/AssetFormFieldType.js +42 -0
  46. package/modules/HeadlessCms/fieldType/AssetFormFieldType.js.map +1 -0
  47. package/modules/HeadlessCms/fieldType/AssetInputRenderer.d.ts +15 -0
  48. package/modules/HeadlessCms/fieldType/AssetInputRenderer.js +20 -0
  49. package/modules/HeadlessCms/fieldType/AssetInputRenderer.js.map +1 -0
  50. package/modules/HeadlessCms/fieldType/AssetInputsRenderer.d.ts +15 -0
  51. package/modules/HeadlessCms/fieldType/AssetInputsRenderer.js +20 -0
  52. package/modules/HeadlessCms/fieldType/AssetInputsRenderer.js.map +1 -0
  53. package/modules/HeadlessCms/fieldType/FileFieldSettingsModifier.d.ts +16 -0
  54. package/modules/HeadlessCms/fieldType/FileFieldSettingsModifier.js +33 -0
  55. package/modules/HeadlessCms/fieldType/FileFieldSettingsModifier.js.map +1 -0
  56. package/modules/HeadlessCms/fieldType/FileFieldType.d.ts +25 -0
  57. package/modules/HeadlessCms/fieldType/FileFieldType.js +38 -0
  58. package/modules/HeadlessCms/fieldType/FileFieldType.js.map +1 -0
  59. package/modules/HeadlessCms/fieldType/FileInputRenderer.d.ts +15 -0
  60. package/modules/HeadlessCms/fieldType/FileInputRenderer.js +19 -0
  61. package/modules/HeadlessCms/fieldType/FileInputRenderer.js.map +1 -0
  62. package/modules/HeadlessCms/fieldType/FileInputsRenderer.d.ts +15 -0
  63. package/modules/HeadlessCms/fieldType/FileInputsRenderer.js +19 -0
  64. package/modules/HeadlessCms/fieldType/FileInputsRenderer.js.map +1 -0
  65. package/modules/HeadlessCms/fieldType/feature.d.ts +1 -0
  66. package/modules/HeadlessCms/fieldType/feature.js +27 -0
  67. package/modules/HeadlessCms/fieldType/feature.js.map +1 -0
  68. package/modules/HeadlessCms/fieldType/isAssetField.d.ts +2 -0
  69. package/modules/HeadlessCms/fieldType/isAssetField.js +4 -0
  70. package/modules/HeadlessCms/fieldType/isAssetField.js.map +1 -0
  71. package/package.json +24 -34
  72. package/presentation/FileActions/FileDetails/EditImage.d.ts +2 -0
  73. package/presentation/FileActions/FileDetails/EditImage.js +39 -0
  74. package/presentation/FileActions/FileDetails/EditImage.js.map +1 -0
  75. package/presentation/FileActions/index.js +8 -0
  76. package/presentation/FileActions/index.js.map +1 -1
  77. package/presentation/FileDetails/FileDetailsPresenter.d.ts +5 -4
  78. package/presentation/FileDetails/FileDetailsPresenter.js +40 -46
  79. package/presentation/FileDetails/FileDetailsPresenter.js.map +1 -1
  80. package/presentation/FileDetails/FileDetailsPresenter.test.js +39 -56
  81. package/presentation/FileDetails/FileDetailsPresenter.test.js.map +1 -1
  82. package/presentation/FileDetails/abstractions.d.ts +2 -0
  83. package/presentation/FileDetails/abstractions.js.map +1 -1
  84. package/presentation/FileDetails/components/Content.d.ts +6 -4
  85. package/presentation/FileDetails/components/Content.js +2 -2
  86. package/presentation/FileDetails/components/Content.js.map +1 -1
  87. package/presentation/FileDetails/components/FileDetailsDrawer.d.ts +2 -2
  88. package/presentation/FileDetails/components/FileDetailsDrawer.js +11 -5
  89. package/presentation/FileDetails/components/FileDetailsDrawer.js.map +1 -1
  90. package/presentation/FileList/FileListDataSource.d.ts +8 -12
  91. package/presentation/FileList/FileListDataSource.js +47 -87
  92. package/presentation/FileList/FileListDataSource.js.map +1 -1
  93. package/presentation/FileList/FileListPresenter.test.js +9 -3
  94. package/presentation/FileList/FileListPresenter.test.js.map +1 -1
  95. package/presentation/FileList/FileManagerPresenter.d.ts +1 -0
  96. package/presentation/FileList/FileManagerPresenter.js +15 -5
  97. package/presentation/FileList/FileManagerPresenter.js.map +1 -1
  98. package/presentation/FileList/abstractions.d.ts +3 -0
  99. package/presentation/FileList/abstractions.js.map +1 -1
  100. package/presentation/FileList/components/BulkActions/BulkActionBar.d.ts +2 -2
  101. package/presentation/FileList/components/BulkActions/BulkActionDelete.d.ts +2 -2
  102. package/presentation/FileList/components/BulkActions/BulkActionMove.d.ts +2 -2
  103. package/presentation/FileList/components/BulkActions/index.d.ts +0 -1
  104. package/presentation/FileList/components/BulkActions/index.js +0 -1
  105. package/presentation/FileList/components/BulkActions/useBulkActionWorker.d.ts +9 -8
  106. package/presentation/FileList/components/BulkActions/useBulkActionWorker.js +3 -9
  107. package/presentation/FileList/components/BulkActions/useBulkActionWorker.js.map +1 -1
  108. package/presentation/FileList/components/Filters/SubFoldersToggle.d.ts +2 -2
  109. package/presentation/FileList/components/Filters/TagsFilter.d.ts +2 -2
  110. package/presentation/FileList/components/Filters/TypeFilter.d.ts +2 -2
  111. package/presentation/FileList/components/Grid/FileGrid.d.ts +2 -2
  112. package/presentation/FileList/components/Grid/FileGrid.js +1 -1
  113. package/presentation/FileList/components/Grid/FileGrid.js.map +1 -1
  114. package/presentation/FileList/components/Grid/FileGrid.test.js +18 -7
  115. package/presentation/FileList/components/Grid/FileGrid.test.js.map +1 -1
  116. package/presentation/FileList/components/Header/FileManagerHeader.d.ts +2 -2
  117. package/presentation/FileList/components/Search/SearchBar.d.ts +2 -2
  118. package/presentation/FileList/components/Table/FileTable.d.ts +2 -2
  119. package/presentation/FileList/components/Table/FileTable.js +1 -1
  120. package/presentation/FileList/components/Table/FileTable.js.map +1 -1
  121. package/presentation/FileList/components/Table/FileTable.test.js +9 -4
  122. package/presentation/FileList/components/Table/FileTable.test.js.map +1 -1
  123. package/presentation/FileList/components/Upload/UploadProgress.d.ts +2 -2
  124. package/presentation/FileManager/FileManagerBreadcrumbs.d.ts +12 -0
  125. package/presentation/FileManager/FileManagerBreadcrumbs.js +37 -0
  126. package/presentation/FileManager/FileManagerBreadcrumbs.js.map +1 -0
  127. package/presentation/FileManager/FileManagerView.js +36 -2
  128. package/presentation/FileManager/FileManagerView.js.map +1 -1
  129. package/presentation/FileManager/RouteParamsSync.d.ts +2 -0
  130. package/presentation/FileManager/RouteParamsSync.js +30 -0
  131. package/presentation/FileManager/RouteParamsSync.js.map +1 -0
  132. package/presentation/Settings/components/SettingsView.d.ts +2 -2
  133. package/presentation/config/DefaultFileManagerConfig.js +13 -11
  134. package/presentation/config/DefaultFileManagerConfig.js.map +1 -1
  135. package/presentation/config/FileManagerViewConfig.d.ts +19 -25
  136. package/presentation/config/configComponents/Browser/BulkAction.d.ts +10 -8
  137. package/presentation/config/configComponents/Browser/BulkAction.js +3 -9
  138. package/presentation/config/configComponents/Browser/BulkAction.js.map +1 -1
  139. package/presentation/config/configComponents/Browser/FileAction.d.ts +2 -1
  140. package/presentation/config/configComponents/Browser/FolderAction.d.ts +2 -1
  141. package/presentation/config/configComponents/Browser/Table/Column.d.ts +9 -8
  142. package/presentation/config/configComponents/Browser/Table/index.d.ts +9 -9
  143. package/presentation/config/configComponents/Browser/index.d.ts +20 -20
  144. package/presentation/config/configComponents/Browser/index.js +0 -8
  145. package/presentation/config/configComponents/Browser/index.js.map +1 -1
  146. package/presentation/config/configComponents/FileDetails/index.d.ts +4 -2
  147. package/presentation/config/thumbnailRenderers/CroppedFileImage.d.ts +18 -0
  148. package/presentation/config/thumbnailRenderers/CroppedFileImage.js +66 -0
  149. package/presentation/config/thumbnailRenderers/CroppedFileImage.js.map +1 -0
  150. package/presentation/config/thumbnailRenderers/FilePreviewImageRenderer.js +6 -9
  151. package/presentation/config/thumbnailRenderers/FilePreviewImageRenderer.js.map +1 -1
  152. package/presentation/config/thumbnailRenderers/GridItemImageRenderer.js +6 -9
  153. package/presentation/config/thumbnailRenderers/GridItemImageRenderer.js.map +1 -1
  154. package/presentation/config/thumbnailRenderers/TableItemImageRenderer.js +6 -9
  155. package/presentation/config/thumbnailRenderers/TableItemImageRenderer.js.map +1 -1
  156. package/presentation/fieldRenderers/CmsAssetPickerRenderer.d.ts +22 -0
  157. package/presentation/fieldRenderers/CmsAssetPickerRenderer.js +56 -0
  158. package/presentation/fieldRenderers/CmsAssetPickerRenderer.js.map +1 -0
  159. package/presentation/fieldRenderers/CmsFilePickerRenderer.d.ts +13 -0
  160. package/presentation/fieldRenderers/CmsFilePickerRenderer.js +36 -0
  161. package/presentation/fieldRenderers/CmsFilePickerRenderer.js.map +1 -0
  162. package/presentation/fieldRenderers/CmsImageEditorDialog.d.ts +7 -0
  163. package/presentation/fieldRenderers/CmsImageEditorDialog.js +32 -0
  164. package/presentation/fieldRenderers/CmsImageEditorDialog.js.map +1 -0
  165. package/presentation/fieldRenderers/CmsMultiAssetPickerRenderer.d.ts +18 -0
  166. package/presentation/fieldRenderers/CmsMultiAssetPickerRenderer.js +88 -0
  167. package/presentation/fieldRenderers/CmsMultiAssetPickerRenderer.js.map +1 -0
  168. package/presentation/fieldRenderers/CmsMultiFilePickerRenderer.d.ts +13 -0
  169. package/presentation/fieldRenderers/CmsMultiFilePickerRenderer.js +60 -0
  170. package/presentation/fieldRenderers/CmsMultiFilePickerRenderer.js.map +1 -0
  171. package/presentation/fieldRenderers/CroppedAssetThumb.d.ts +15 -0
  172. package/presentation/fieldRenderers/CroppedAssetThumb.js +25 -0
  173. package/presentation/fieldRenderers/CroppedAssetThumb.js.map +1 -0
  174. package/presentation/fieldRenderers/assetValue.d.ts +10 -0
  175. package/presentation/fieldRenderers/assetValue.js +88 -0
  176. package/presentation/fieldRenderers/assetValue.js.map +1 -0
  177. package/presentation/hooks/useCmsImageEditor.d.ts +10 -0
  178. package/presentation/hooks/useCmsImageEditor.js +76 -0
  179. package/presentation/hooks/useCmsImageEditor.js.map +1 -0
  180. package/presentation/hooks/useEditImage.d.ts +14 -0
  181. package/presentation/hooks/useEditImage.js +67 -0
  182. package/presentation/hooks/useEditImage.js.map +1 -0
  183. package/routes.d.ts +1 -0
  184. package/routes.js +2 -1
  185. package/routes.js.map +1 -1
  186. package/modules/HeadlessCms/fileField.d.ts +0 -2
  187. package/modules/HeadlessCms/fileField.js +0 -44
  188. package/modules/HeadlessCms/fileField.js.map +0 -1
  189. package/modules/HeadlessCms/fileRenderer/fileField.d.ts +0 -2
  190. package/modules/HeadlessCms/fileRenderer/fileField.js +0 -53
  191. package/modules/HeadlessCms/fileRenderer/fileField.js.map +0 -1
  192. package/modules/HeadlessCms/fileRenderer/fileFields.d.ts +0 -2
  193. package/modules/HeadlessCms/fileRenderer/fileFields.js +0 -73
  194. package/modules/HeadlessCms/fileRenderer/fileFields.js.map +0 -1
  195. package/modules/HeadlessCms/fileRenderer/utils.d.ts +0 -2
  196. package/modules/HeadlessCms/fileRenderer/utils.js +0 -15
  197. package/modules/HeadlessCms/fileRenderer/utils.js.map +0 -1
  198. package/modules/HeadlessCms/index.d.ts +0 -1
  199. package/modules/HeadlessCms/index.js +0 -14
  200. package/modules/HeadlessCms/index.js.map +0 -1
  201. package/modules/Settings/graphql.d.ts +0 -12
  202. package/modules/Settings/graphql.js +0 -36
  203. package/modules/Settings/graphql.js.map +0 -1
  204. package/modules/Settings/views/FileManagerSettings.d.ts +0 -2
  205. package/modules/Settings/views/FileManagerSettings.js +0 -134
  206. package/modules/Settings/views/FileManagerSettings.js.map +0 -1
  207. package/presentation/FileList/components/BulkActions/BatchEditorDialog/AddOperation.d.ts +0 -7
  208. package/presentation/FileList/components/BulkActions/BatchEditorDialog/AddOperation.js +0 -15
  209. package/presentation/FileList/components/BulkActions/BatchEditorDialog/AddOperation.js.map +0 -1
  210. package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditor.d.ts +0 -15
  211. package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditor.js +0 -44
  212. package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditor.js.map +0 -1
  213. package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialog.d.ts +0 -15
  214. package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialog.js +0 -52
  215. package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialog.js.map +0 -1
  216. package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialogPresenter.d.ts +0 -61
  217. package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialogPresenter.js +0 -111
  218. package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialogPresenter.js.map +0 -1
  219. package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialogPresenter.test.d.ts +0 -1
  220. package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialogPresenter.test.js +0 -372
  221. package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialogPresenter.test.js.map +0 -1
  222. package/presentation/FileList/components/BulkActions/BatchEditorDialog/FieldRenderer.d.ts +0 -8
  223. package/presentation/FileList/components/BulkActions/BatchEditorDialog/FieldRenderer.js +0 -31
  224. package/presentation/FileList/components/BulkActions/BatchEditorDialog/FieldRenderer.js.map +0 -1
  225. package/presentation/FileList/components/BulkActions/BatchEditorDialog/Operation.d.ts +0 -11
  226. package/presentation/FileList/components/BulkActions/BatchEditorDialog/Operation.js +0 -33
  227. package/presentation/FileList/components/BulkActions/BatchEditorDialog/Operation.js.map +0 -1
  228. package/presentation/FileList/components/BulkActions/BatchEditorDialog/index.d.ts +0 -1
  229. package/presentation/FileList/components/BulkActions/BatchEditorDialog/index.js +0 -1
  230. package/presentation/FileList/components/BulkActions/BulkActionEdit.d.ts +0 -4
  231. package/presentation/FileList/components/BulkActions/BulkActionEdit.js +0 -105
  232. package/presentation/FileList/components/BulkActions/BulkActionEdit.js.map +0 -1
  233. package/presentation/config/configComponents/Browser/FolderFieldDecorator.d.ts +0 -7
  234. package/presentation/config/configComponents/Browser/FolderFieldDecorator.js +0 -11
  235. package/presentation/config/configComponents/Browser/FolderFieldDecorator.js.map +0 -1
@@ -5,32 +5,32 @@ export interface TableConfig {
5
5
  cellThumbnails: ThumbnailConfig[];
6
6
  }
7
7
  export declare const Table: {
8
- Column: ((props: import("@webiny/app-aco/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
9
- original: (props: import("@webiny/app-aco/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
8
+ Column: ((props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
9
+ original: (props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
10
10
  originalName: string;
11
11
  displayName: string;
12
12
  } & {
13
- original: ((props: import("@webiny/app-aco/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
14
- original: (props: import("@webiny/app-aco/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
13
+ original: ((props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
14
+ original: (props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
15
15
  originalName: string;
16
16
  displayName: string;
17
17
  };
18
18
  originalName: string;
19
19
  displayName: string;
20
20
  } & {
21
- createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<((props: import("@webiny/app-aco/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
22
- original: (props: import("@webiny/app-aco/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
21
+ createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<((props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
22
+ original: (props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
23
23
  originalName: string;
24
24
  displayName: string;
25
25
  }>) => (props: unknown) => React.JSX.Element;
26
26
  } & {
27
27
  useTableRow: {
28
- (): import("@webiny/app-aco/index.js").TableRowContextData<import("../../../../../domain/types.js").TableItem>;
29
- <TUserRow>(): import("@webiny/app-aco/index.js").TableRowContextData<import("../../../../../domain/types.js").TableItem & {
28
+ (): import("@webiny/app-admin/index.js").TableRowContextData<import("../../../../../domain/types.js").TableItem>;
29
+ <TUserRow>(): import("@webiny/app-admin/index.js").TableRowContextData<import("../../../../../domain/types.js").TableItem & {
30
30
  data: TUserRow;
31
31
  }>;
32
32
  };
33
- isFolderRow: (row: import("@webiny/app-aco/table.types.js").TableRow) => row is import("@webiny/app-aco/table.types.js").FolderTableRow;
33
+ isFolderRow: (row: import("@webiny/app-admin/index.js").TableRow) => row is import("@webiny/app-aco/table.types.js").FolderTableRow;
34
34
  };
35
35
  Cell: {
36
36
  Thumbnail: (({ type, element }: import("./Thumbnail.js").RendererProps) => import("react").JSX.Element) & {
@@ -1,9 +1,14 @@
1
1
  import type { BulkActionConfig } from "./BulkAction.js";
2
2
  import type { FilterConfig } from "./Filter.js";
3
3
  import type { FiltersToWhereConverter } from "./FiltersToWhere.js";
4
+ import { FiltersToWhere } from "./FiltersToWhere.js";
5
+ import { FilterByTags } from "./FilterByTags.js";
4
6
  import type { TableConfig } from "./Table/index.js";
5
7
  import type { BulkEditFieldConfig } from "./BulkEditField.js";
8
+ import { BulkEditField } from "./BulkEditField.js";
6
9
  import type { GridConfig } from "./Grid/index.js";
10
+ import { ActionButton } from "../../../../presentation/FileList/components/Grid/ActionButton.js";
11
+ import { FolderDropConfirmation } from "./FolderDropConfirmation.js";
7
12
  import { RecordConfig } from "@webiny/app-aco/config/record";
8
13
  export interface BrowserConfig {
9
14
  bulkActions: BulkActionConfig[];
@@ -74,11 +79,11 @@ export declare const Browser: {
74
79
  displayName: string;
75
80
  }>) => (props: unknown) => React.JSX.Element;
76
81
  } & {
77
- IconButton: ({ icon, label, onAction, disabled, ...props }: import("~/presentation/FileList/components/Grid/ActionButton.js").ActionButtonProps) => import("react").JSX.Element;
82
+ IconButton: typeof ActionButton;
78
83
  };
79
84
  };
80
85
  };
81
- BulkAction: (({ name, after, before, remove, element }: import("./BulkAction.js").BulkActionProps) => import("react").JSX.Element) & {
86
+ BulkAction: typeof import("./BulkAction.js").BaseBulkAction & {
82
87
  useButtons: () => import("@webiny/app-admin/components/Buttons/useButtons.js").ButtonsProviderContext;
83
88
  useWorker: () => {
84
89
  items: import("@webiny/sdk/index.js").FmFile[];
@@ -89,7 +94,7 @@ export declare const Browser: {
89
94
  };
90
95
  useDialog: () => import("@webiny/app-admin/index.js").UseDialogWithReportResponse;
91
96
  };
92
- BulkEditField: ({ name, element }: import("./BulkEditField.js").BulkEditFieldProps) => import("react").JSX.Element;
97
+ BulkEditField: typeof BulkEditField;
93
98
  Filter: (({ name, element, after, before, remove }: import("./Filter.js").FilterProps) => import("react").JSX.Element) & {
94
99
  original: ({ name, element, after, before, remove }: import("./Filter.js").FilterProps) => import("react").JSX.Element;
95
100
  originalName: string;
@@ -117,18 +122,13 @@ export declare const Browser: {
117
122
  name: string;
118
123
  }) => React.JSX.Element;
119
124
  };
120
- FiltersToWhere: ({ converter }: {
121
- converter: FiltersToWhereConverter;
122
- }) => import("react").JSX.Element;
123
- FilterByTags: ({ remove }: import("./FilterByTags.js").FilterByTagProps) => import("react").JSX.Element;
125
+ FiltersToWhere: typeof FiltersToWhere;
126
+ FilterByTags: typeof FilterByTags;
124
127
  Folder: {
125
- ExtensionField: {
126
- createDecorator: (decorator: import("@webiny/react-composition/types.js").Decorator<import("@webiny/react-composition/types.js").GenericComponent<import("@webiny/app-aco").FieldProps>>) => (props: import("@webiny/app-aco").FieldDecoratorProps) => React.JSX.Element;
127
- };
128
128
  Action: ((props: import("@webiny/app-aco/config/folder/Action.js").ActionProps) => import("react").JSX.Element) & {
129
129
  OptionsMenuItem: (props: import("@webiny/app-admin/index.js").OptionsMenuItemProps) => React.JSX.Element;
130
130
  };
131
- DropConfirmation: (props: import("@webiny/app-aco/config/folder/DropConfirmation.js").DropConfirmationProps) => import("react").JSX.Element;
131
+ DropConfirmation: typeof FolderDropConfirmation;
132
132
  };
133
133
  File: {
134
134
  Action: ((props: import("@webiny/app-aco/config/record/Action.js").ActionProps) => import("react").JSX.Element) & {
@@ -137,32 +137,32 @@ export declare const Browser: {
137
137
  };
138
138
  };
139
139
  Table: {
140
- Column: ((props: import("@webiny/app-aco/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
141
- original: (props: import("@webiny/app-aco/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
140
+ Column: ((props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
141
+ original: (props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
142
142
  originalName: string;
143
143
  displayName: string;
144
144
  } & {
145
- original: ((props: import("@webiny/app-aco/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
146
- original: (props: import("@webiny/app-aco/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
145
+ original: ((props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
146
+ original: (props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
147
147
  originalName: string;
148
148
  displayName: string;
149
149
  };
150
150
  originalName: string;
151
151
  displayName: string;
152
152
  } & {
153
- createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<((props: import("@webiny/app-aco/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
154
- original: (props: import("@webiny/app-aco/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
153
+ createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<((props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
154
+ original: (props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
155
155
  originalName: string;
156
156
  displayName: string;
157
157
  }>) => (props: unknown) => React.JSX.Element;
158
158
  } & {
159
159
  useTableRow: {
160
- (): import("@webiny/app-aco").TableRowContextData<import("../../../../domain/types.js").TableItem>;
161
- <TUserRow>(): import("@webiny/app-aco").TableRowContextData<import("../../../../domain/types.js").TableItem & {
160
+ (): import("@webiny/app-admin/index.js").TableRowContextData<import("../../../../domain/types.js").TableItem>;
161
+ <TUserRow>(): import("@webiny/app-admin/index.js").TableRowContextData<import("../../../../domain/types.js").TableItem & {
162
162
  data: TUserRow;
163
163
  }>;
164
164
  };
165
- isFolderRow: (row: import("@webiny/app-aco").TableRow) => row is import("@webiny/app-aco").FolderTableRow;
165
+ isFolderRow: (row: import("@webiny/app-admin/index.js").TableRow) => row is import("@webiny/app-aco/table.types.js").FolderTableRow;
166
166
  };
167
167
  Cell: {
168
168
  Thumbnail: (({ type, element }: import("./Table/Thumbnail.js").RendererProps) => import("react").JSX.Element) & {
@@ -1,4 +1,3 @@
1
- import { createFolderFieldDecoratorFactory } from "@webiny/app-aco";
2
1
  import { BulkAction } from "./BulkAction.js";
3
2
  import { Filter } from "./Filter.js";
4
3
  import { FiltersToWhere } from "./FiltersToWhere.js";
@@ -11,7 +10,6 @@ import { Action } from "./Grid/Action.js";
11
10
  import { Thumbnail } from "./Grid/Thumbnail.js";
12
11
  import { ActionButton } from "../../../FileList/components/Grid/ActionButton.js";
13
12
  import { File } from "../../../FileList/components/Grid/File.js";
14
- import { shouldDecorateFolderField } from "./FolderFieldDecorator.js";
15
13
  import { FolderDropConfirmation } from "./FolderDropConfirmation.js";
16
14
  const Browser = {
17
15
  Grid: {
@@ -28,12 +26,6 @@ const Browser = {
28
26
  FiltersToWhere: FiltersToWhere,
29
27
  FilterByTags: FilterByTags,
30
28
  Folder: {
31
- ExtensionField: {
32
- createDecorator: createFolderFieldDecoratorFactory({
33
- scope: "fm",
34
- shouldDecorate: shouldDecorateFolderField
35
- })
36
- },
37
29
  Action: FolderAction,
38
30
  DropConfirmation: FolderDropConfirmation
39
31
  },
@@ -1 +1 @@
1
- {"version":3,"file":"presentation/config/configComponents/Browser/index.js","sources":["../../../../../src/presentation/config/configComponents/Browser/index.ts"],"sourcesContent":["import { createFolderFieldDecoratorFactory } from \"@webiny/app-aco\";\nimport type { BulkActionConfig } from \"./BulkAction.js\";\nimport { BulkAction } from \"./BulkAction.js\";\nimport type { FilterConfig } from \"./Filter.js\";\nimport { Filter } from \"./Filter.js\";\nimport type { FiltersToWhereConverter } from \"./FiltersToWhere.js\";\nimport { FiltersToWhere } from \"./FiltersToWhere.js\";\nimport { FilterByTags } from \"./FilterByTags.js\";\nimport { FolderAction } from \"./FolderAction.js\";\nimport { FileAction } from \"./FileAction.js\";\nimport type { TableConfig } from \"./Table/index.js\";\nimport { Table } from \"./Table/index.js\";\nimport type { BulkEditFieldConfig } from \"./BulkEditField.js\";\nimport { BulkEditField } from \"./BulkEditField.js\";\nimport { Action } from \"./Grid/Action.js\";\nimport { Thumbnail } from \"./Grid/Thumbnail.js\";\nimport type { GridConfig } from \"./Grid/index.js\";\nimport { ActionButton } from \"~/presentation/FileList/components/Grid/ActionButton.js\";\nimport { File } from \"~/presentation/FileList/components/Grid/File.js\";\nimport { shouldDecorateFolderField } from \"./FolderFieldDecorator.js\";\nimport { FolderDropConfirmation } from \"./FolderDropConfirmation.js\";\nimport { RecordConfig } from \"@webiny/app-aco/config/record\";\n\nexport interface BrowserConfig {\n bulkActions: BulkActionConfig[];\n bulkEditFields: BulkEditFieldConfig[];\n filters: FilterConfig[];\n filtersToWhere: FiltersToWhereConverter[];\n filterByTags: boolean;\n table: TableConfig;\n grid: GridConfig;\n file: RecordConfig;\n}\n\nexport const Browser = {\n Grid: {\n Item: Object.assign(File, {\n Thumbnail,\n Action: Object.assign(Action, { IconButton: ActionButton })\n })\n },\n BulkAction,\n BulkEditField,\n Filter,\n FiltersToWhere,\n FilterByTags,\n Folder: {\n ExtensionField: {\n createDecorator: createFolderFieldDecoratorFactory({\n scope: \"fm\",\n shouldDecorate: shouldDecorateFolderField\n })\n },\n Action: FolderAction,\n DropConfirmation: FolderDropConfirmation\n },\n File: {\n Action: FileAction\n },\n Table\n};\n"],"names":["Browser","Object","File","Thumbnail","Action","ActionButton","BulkAction","BulkEditField","Filter","FiltersToWhere","FilterByTags","createFolderFieldDecoratorFactory","shouldDecorateFolderField","FolderAction","FolderDropConfirmation","FileAction","Table"],"mappings":";;;;;;;;;;;;;;;AAkCO,MAAMA,UAAU;IACnB,MAAM;QACF,MAAMC,OAAO,MAAM,CAACC,MAAM;YACtBC,WAASA;YACT,QAAQF,OAAO,MAAM,CAACG,QAAQ;gBAAE,YAAYC;YAAa;QAC7D;IACJ;IACAC,YAAUA;IACVC,eAAaA;IACbC,QAAMA;IACNC,gBAAcA;IACdC,cAAYA;IACZ,QAAQ;QACJ,gBAAgB;YACZ,iBAAiBC,kCAAkC;gBAC/C,OAAO;gBACP,gBAAgBC;YACpB;QACJ;QACA,QAAQC;QACR,kBAAkBC;IACtB;IACA,MAAM;QACF,QAAQC;IACZ;IACAC,OAAKA;AACT"}
1
+ {"version":3,"file":"presentation/config/configComponents/Browser/index.js","sources":["../../../../../src/presentation/config/configComponents/Browser/index.ts"],"sourcesContent":["import type { BulkActionConfig } from \"./BulkAction.js\";\nimport { BulkAction } from \"./BulkAction.js\";\nimport type { FilterConfig } from \"./Filter.js\";\nimport { Filter } from \"./Filter.js\";\nimport type { FiltersToWhereConverter } from \"./FiltersToWhere.js\";\nimport { FiltersToWhere } from \"./FiltersToWhere.js\";\nimport { FilterByTags } from \"./FilterByTags.js\";\nimport { FolderAction } from \"./FolderAction.js\";\nimport { FileAction } from \"./FileAction.js\";\nimport type { TableConfig } from \"./Table/index.js\";\nimport { Table } from \"./Table/index.js\";\nimport type { BulkEditFieldConfig } from \"./BulkEditField.js\";\nimport { BulkEditField } from \"./BulkEditField.js\";\nimport { Action } from \"./Grid/Action.js\";\nimport { Thumbnail } from \"./Grid/Thumbnail.js\";\nimport type { GridConfig } from \"./Grid/index.js\";\nimport { ActionButton } from \"~/presentation/FileList/components/Grid/ActionButton.js\";\nimport { File } from \"~/presentation/FileList/components/Grid/File.js\";\nimport { FolderDropConfirmation } from \"./FolderDropConfirmation.js\";\nimport { RecordConfig } from \"@webiny/app-aco/config/record\";\n\nexport interface BrowserConfig {\n bulkActions: BulkActionConfig[];\n bulkEditFields: BulkEditFieldConfig[];\n filters: FilterConfig[];\n filtersToWhere: FiltersToWhereConverter[];\n filterByTags: boolean;\n table: TableConfig;\n grid: GridConfig;\n file: RecordConfig;\n}\n\nexport const Browser = {\n Grid: {\n Item: Object.assign(File, {\n Thumbnail,\n Action: Object.assign(Action, { IconButton: ActionButton })\n })\n },\n BulkAction,\n BulkEditField,\n Filter,\n FiltersToWhere,\n FilterByTags,\n Folder: {\n Action: FolderAction,\n DropConfirmation: FolderDropConfirmation\n },\n File: {\n Action: FileAction\n },\n Table\n};\n"],"names":["Browser","Object","File","Thumbnail","Action","ActionButton","BulkAction","BulkEditField","Filter","FiltersToWhere","FilterByTags","FolderAction","FolderDropConfirmation","FileAction","Table"],"mappings":";;;;;;;;;;;;;AAgCO,MAAMA,UAAU;IACnB,MAAM;QACF,MAAMC,OAAO,MAAM,CAACC,MAAM;YACtBC,WAASA;YACT,QAAQF,OAAO,MAAM,CAACG,QAAQ;gBAAE,YAAYC;YAAa;QAC7D;IACJ;IACAC,YAAUA;IACVC,eAAaA;IACbC,QAAMA;IACNC,gBAAcA;IACdC,cAAYA;IACZ,QAAQ;QACJ,QAAQC;QACR,kBAAkBC;IACtB;IACA,MAAM;QACF,QAAQC;IACZ;IACAC,OAAKA;AACT"}
@@ -1,4 +1,6 @@
1
+ import { Width } from "./Width.js";
1
2
  import type { ActionConfig } from "./Action.js";
3
+ import { ActionButton } from "../../../../presentation/FileDetails/components/ActionButton.js";
2
4
  import type { ThumbnailConfig } from "./Thumbnail.js";
3
5
  export interface FileDetailsConfig {
4
6
  actions: ActionConfig[];
@@ -25,7 +27,7 @@ export declare const FileDetails: {
25
27
  displayName: string;
26
28
  }>) => (props: unknown) => React.JSX.Element;
27
29
  } & {
28
- Button: ({ label, icon, onAction, disabled, className, ...props }: import("~/presentation/FileDetails/components/ActionButton.js").ActionButtonProps) => import("react").JSX.Element;
30
+ Button: typeof ActionButton;
29
31
  };
30
32
  Preview: {
31
33
  Thumbnail: (({ type, element }: import("./Thumbnail.js").RendererProps) => import("react").JSX.Element) & {
@@ -48,5 +50,5 @@ export declare const FileDetails: {
48
50
  }>) => (props: unknown) => React.JSX.Element;
49
51
  };
50
52
  };
51
- Width: ({ value }: import("./Width.js").WidthProps) => import("react").JSX.Element;
53
+ Width: typeof Width;
52
54
  };
@@ -0,0 +1,18 @@
1
+ import * as React from "react";
2
+ import type { FileItem } from "../../../domain/types.js";
3
+ interface CroppedFileImageProps {
4
+ file: FileItem;
5
+ /** Width passed to the delivery transform (`?width=`). */
6
+ width: number;
7
+ /** How the (cropped) image fits its slot. */
8
+ fit: "cover" | "contain";
9
+ /** Class applied to the `<Image>` when there is no crop (original behavior). */
10
+ fallbackClassName?: string;
11
+ }
12
+ /**
13
+ * Renders a File Manager image thumbnail/preview honoring the saved crop (and, for
14
+ * `cover`, the hotspot). Falls back to the plain image when the file has no crop,
15
+ * so un-edited files render exactly as before.
16
+ */
17
+ export declare const CroppedFileImage: ({ file, width, fit, fallbackClassName }: CroppedFileImageProps) => React.JSX.Element;
18
+ export {};
@@ -0,0 +1,66 @@
1
+ import { Image } from "@webiny/app/components/index.js";
2
+ import { cn, getCroppedImageRenderStyles } from "@webiny/admin-ui";
3
+ import * as __rspack_external_react from "react";
4
+ const isFullCrop = (crop)=>!crop || 0 === crop.top && 0 === crop.left && 0 === crop.bottom && 0 === crop.right;
5
+ const CroppedFileImage = ({ file, width, fit, fallbackClassName })=>{
6
+ const ref = (0, __rspack_external_react.useRef)(null);
7
+ const [box, setBox] = (0, __rspack_external_react.useState)({
8
+ w: 0,
9
+ h: 0
10
+ });
11
+ (0, __rspack_external_react.useLayoutEffect)(()=>{
12
+ const el = ref.current;
13
+ if (!el) return;
14
+ const measure = ()=>{
15
+ const rect = el.getBoundingClientRect();
16
+ setBox({
17
+ w: rect.width,
18
+ h: rect.height
19
+ });
20
+ };
21
+ measure();
22
+ if ("u" < typeof ResizeObserver) return;
23
+ const ro = new ResizeObserver(measure);
24
+ ro.observe(el);
25
+ return ()=>ro.disconnect();
26
+ }, []);
27
+ const img = file.metadata?.image;
28
+ const imageWidth = img?.width ?? 0;
29
+ const imageHeight = img?.height ?? 0;
30
+ if (isFullCrop(img?.crop) || imageWidth <= 0 || imageHeight <= 0) return /*#__PURE__*/ __rspack_external_react.createElement(Image, {
31
+ src: file.src,
32
+ alt: file.name,
33
+ transform: {
34
+ width
35
+ },
36
+ className: fallbackClassName
37
+ });
38
+ const focalPoint = img?.focalPoint;
39
+ const hotspot = focalPoint ? {
40
+ x: focalPoint.x,
41
+ y: focalPoint.y,
42
+ width: 1,
43
+ height: 1
44
+ } : void 0;
45
+ const { wrapper, image } = getCroppedImageRenderStyles(imageWidth, imageHeight, img?.crop, hotspot, {
46
+ boxWidth: box.w,
47
+ boxHeight: box.h,
48
+ fit
49
+ });
50
+ return /*#__PURE__*/ __rspack_external_react.createElement("div", {
51
+ ref: ref,
52
+ className: cn("flex h-full w-full items-center justify-center overflow-hidden")
53
+ }, /*#__PURE__*/ __rspack_external_react.createElement("div", {
54
+ style: wrapper
55
+ }, /*#__PURE__*/ __rspack_external_react.createElement(Image, {
56
+ src: file.src,
57
+ alt: file.name,
58
+ transform: {
59
+ width
60
+ },
61
+ style: image
62
+ })));
63
+ };
64
+ export { CroppedFileImage };
65
+
66
+ //# sourceMappingURL=CroppedFileImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation/config/thumbnailRenderers/CroppedFileImage.js","sources":["../../../../src/presentation/config/thumbnailRenderers/CroppedFileImage.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useLayoutEffect, useRef, useState } from \"react\";\nimport { Image } from \"@webiny/app/components/index.js\";\nimport { cn, getCroppedImageRenderStyles } from \"@webiny/admin-ui\";\nimport type { FileItem } from \"~/domain/types.js\";\n\ninterface CroppedFileImageProps {\n file: FileItem;\n /** Width passed to the delivery transform (`?width=`). */\n width: number;\n /** How the (cropped) image fits its slot. */\n fit: \"cover\" | \"contain\";\n /** Class applied to the `<Image>` when there is no crop (original behavior). */\n fallbackClassName?: string;\n}\n\nconst isFullCrop = (crop: any): boolean => {\n return !crop || (crop.top === 0 && crop.left === 0 && crop.bottom === 0 && crop.right === 0);\n};\n\n/**\n * Renders a File Manager image thumbnail/preview honoring the saved crop (and, for\n * `cover`, the hotspot). Falls back to the plain image when the file has no crop,\n * so un-edited files render exactly as before.\n */\nexport const CroppedFileImage = ({\n file,\n width,\n fit,\n fallbackClassName\n}: CroppedFileImageProps) => {\n const ref = useRef<HTMLDivElement>(null);\n const [box, setBox] = useState({ w: 0, h: 0 });\n\n useLayoutEffect(() => {\n const el = ref.current;\n if (!el) {\n return;\n }\n const measure = () => {\n const rect = el.getBoundingClientRect();\n setBox({ w: rect.width, h: rect.height });\n };\n measure();\n if (typeof ResizeObserver === \"undefined\") {\n return;\n }\n const ro = new ResizeObserver(measure);\n ro.observe(el);\n return () => ro.disconnect();\n }, []);\n\n const img = file.metadata?.image;\n const imageWidth = img?.width ?? 0;\n const imageHeight = img?.height ?? 0;\n\n if (isFullCrop(img?.crop) || imageWidth <= 0 || imageHeight <= 0) {\n return (\n <Image\n src={file.src}\n alt={file.name}\n transform={{ width }}\n className={fallbackClassName}\n />\n );\n }\n\n const focalPoint = img?.focalPoint;\n const hotspot = focalPoint\n ? { x: focalPoint.x, y: focalPoint.y, width: 1, height: 1 }\n : undefined;\n\n const { wrapper, image } = getCroppedImageRenderStyles(\n imageWidth,\n imageHeight,\n img?.crop,\n hotspot,\n {\n boxWidth: box.w,\n boxHeight: box.h,\n fit\n }\n );\n\n return (\n <div\n ref={ref}\n className={cn(\"flex h-full w-full items-center justify-center overflow-hidden\")}\n >\n <div style={wrapper}>\n <Image src={file.src} alt={file.name} transform={{ width }} style={image} />\n </div>\n </div>\n );\n};\n"],"names":["isFullCrop","crop","CroppedFileImage","file","width","fit","fallbackClassName","ref","useRef","box","setBox","useState","useLayoutEffect","el","measure","rect","ResizeObserver","ro","img","imageWidth","imageHeight","Image","focalPoint","hotspot","undefined","wrapper","image","getCroppedImageRenderStyles","cn"],"mappings":";;;AAgBA,MAAMA,aAAa,CAACC,OACT,CAACA,QAASA,AAAa,MAAbA,KAAK,GAAG,IAAUA,AAAc,MAAdA,KAAK,IAAI,IAAUA,AAAgB,MAAhBA,KAAK,MAAM,IAAUA,AAAe,MAAfA,KAAK,KAAK;AAQlF,MAAMC,mBAAmB,CAAC,EAC7BC,IAAI,EACJC,KAAK,EACLC,GAAG,EACHC,iBAAiB,EACG;IACpB,MAAMC,MAAMC,AAAAA,IAAAA,wBAAAA,MAAAA,AAAAA,EAAuB;IACnC,MAAM,CAACC,KAAKC,OAAO,GAAGC,AAAAA,IAAAA,wBAAAA,QAAAA,AAAAA,EAAS;QAAE,GAAG;QAAG,GAAG;IAAE;IAE5CC,IAAAA,wBAAAA,eAAAA,AAAAA,EAAgB;QACZ,MAAMC,KAAKN,IAAI,OAAO;QACtB,IAAI,CAACM,IACD;QAEJ,MAAMC,UAAU;YACZ,MAAMC,OAAOF,GAAG,qBAAqB;YACrCH,OAAO;gBAAE,GAAGK,KAAK,KAAK;gBAAE,GAAGA,KAAK,MAAM;YAAC;QAC3C;QACAD;QACA,IAAI,AAA0B,MAA1B,OAAOE,gBACP;QAEJ,MAAMC,KAAK,IAAID,eAAeF;QAC9BG,GAAG,OAAO,CAACJ;QACX,OAAO,IAAMI,GAAG,UAAU;IAC9B,GAAG,EAAE;IAEL,MAAMC,MAAMf,KAAK,QAAQ,EAAE;IAC3B,MAAMgB,aAAaD,KAAK,SAAS;IACjC,MAAME,cAAcF,KAAK,UAAU;IAEnC,IAAIlB,WAAWkB,KAAK,SAASC,cAAc,KAAKC,eAAe,GAC3D,OAAO,WAAP,GACI,sCAACC,OAAKA;QACF,KAAKlB,KAAK,GAAG;QACb,KAAKA,KAAK,IAAI;QACd,WAAW;YAAEC;QAAM;QACnB,WAAWE;;IAKvB,MAAMgB,aAAaJ,KAAK;IACxB,MAAMK,UAAUD,aACV;QAAE,GAAGA,WAAW,CAAC;QAAE,GAAGA,WAAW,CAAC;QAAE,OAAO;QAAG,QAAQ;IAAE,IACxDE;IAEN,MAAM,EAAEC,OAAO,EAAEC,KAAK,EAAE,GAAGC,4BACvBR,YACAC,aACAF,KAAK,MACLK,SACA;QACI,UAAUd,IAAI,CAAC;QACf,WAAWA,IAAI,CAAC;QAChBJ;IACJ;IAGJ,OAAO,WAAP,GACI,sCAAC;QACG,KAAKE;QACL,WAAWqB,GAAG;qBAEd,sCAAC;QAAI,OAAOH;qBACR,sCAACJ,OAAKA;QAAC,KAAKlB,KAAK,GAAG;QAAE,KAAKA,KAAK,IAAI;QAAE,WAAW;YAAEC;QAAM;QAAG,OAAOsB;;AAInF"}
@@ -1,16 +1,13 @@
1
- import { Image } from "@webiny/app/components/index.js";
2
1
  import { useFile } from "../../hooks/useFile.js";
2
+ import { CroppedFileImage } from "./CroppedFileImage.js";
3
3
  import * as __rspack_external_react from "react";
4
- const width750 = {
5
- width: 750
6
- };
7
4
  const FilePreviewImageRenderer = ()=>{
8
5
  const { file } = useFile();
9
- return /*#__PURE__*/ __rspack_external_react.createElement(Image, {
10
- src: file.src,
11
- alt: file.name,
12
- transform: width750,
13
- className: "object-contain max-w-full max-h-full"
6
+ return /*#__PURE__*/ __rspack_external_react.createElement(CroppedFileImage, {
7
+ file: file,
8
+ width: 750,
9
+ fit: "contain",
10
+ fallbackClassName: "object-contain max-w-full max-h-full"
14
11
  });
15
12
  };
16
13
  export { FilePreviewImageRenderer };
@@ -1 +1 @@
1
- {"version":3,"file":"presentation/config/thumbnailRenderers/FilePreviewImageRenderer.js","sources":["../../../../src/presentation/config/thumbnailRenderers/FilePreviewImageRenderer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Image } from \"@webiny/app/components/index.js\";\nimport { useFile } from \"~/presentation/hooks/useFile.js\";\n\nconst width750 = { width: 750 };\n\nexport const FilePreviewImageRenderer = () => {\n const { file } = useFile();\n return (\n <Image\n src={file.src}\n alt={file.name}\n transform={width750}\n className={\"object-contain max-w-full max-h-full\"}\n />\n );\n};\n"],"names":["width750","FilePreviewImageRenderer","file","useFile","Image"],"mappings":";;;AAIA,MAAMA,WAAW;IAAE,OAAO;AAAI;AAEvB,MAAMC,2BAA2B;IACpC,MAAM,EAAEC,IAAI,EAAE,GAAGC;IACjB,OAAO,WAAP,GACI,sCAACC,OAAKA;QACF,KAAKF,KAAK,GAAG;QACb,KAAKA,KAAK,IAAI;QACd,WAAWF;QACX,WAAW;;AAGvB"}
1
+ {"version":3,"file":"presentation/config/thumbnailRenderers/FilePreviewImageRenderer.js","sources":["../../../../src/presentation/config/thumbnailRenderers/FilePreviewImageRenderer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useFile } from \"~/presentation/hooks/useFile.js\";\nimport { CroppedFileImage } from \"./CroppedFileImage.js\";\n\nexport const FilePreviewImageRenderer = () => {\n const { file } = useFile();\n return (\n <CroppedFileImage\n file={file}\n width={750}\n fit={\"contain\"}\n fallbackClassName={\"object-contain max-w-full max-h-full\"}\n />\n );\n};\n"],"names":["FilePreviewImageRenderer","file","useFile","CroppedFileImage"],"mappings":";;;AAIO,MAAMA,2BAA2B;IACpC,MAAM,EAAEC,IAAI,EAAE,GAAGC;IACjB,OAAO,WAAP,GACI,sCAACC,kBAAgBA;QACb,MAAMF;QACN,OAAO;QACP,KAAK;QACL,mBAAmB;;AAG/B"}
@@ -1,16 +1,13 @@
1
- import { Image } from "@webiny/app/components/index.js";
2
1
  import { useFile } from "../../hooks/useFile.js";
2
+ import { CroppedFileImage } from "./CroppedFileImage.js";
3
3
  import * as __rspack_external_react from "react";
4
- const width300 = {
5
- width: 300
6
- };
7
4
  const GridItemImageRenderer = ()=>{
8
5
  const { file } = useFile();
9
- return /*#__PURE__*/ __rspack_external_react.createElement(Image, {
10
- src: file.src,
11
- alt: file.name,
12
- transform: width300,
13
- className: "object-contain max-w-full max-h-full"
6
+ return /*#__PURE__*/ __rspack_external_react.createElement(CroppedFileImage, {
7
+ file: file,
8
+ width: 300,
9
+ fit: "contain",
10
+ fallbackClassName: "object-contain max-w-full max-h-full"
14
11
  });
15
12
  };
16
13
  export { GridItemImageRenderer };
@@ -1 +1 @@
1
- {"version":3,"file":"presentation/config/thumbnailRenderers/GridItemImageRenderer.js","sources":["../../../../src/presentation/config/thumbnailRenderers/GridItemImageRenderer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Image } from \"@webiny/app/components/index.js\";\nimport { useFile } from \"~/presentation/hooks/useFile.js\";\n\nconst width300 = { width: 300 };\n\nexport const GridItemImageRenderer = () => {\n const { file } = useFile();\n return (\n <Image\n src={file.src}\n alt={file.name}\n transform={width300}\n className={\"object-contain max-w-full max-h-full\"}\n />\n );\n};\n"],"names":["width300","GridItemImageRenderer","file","useFile","Image"],"mappings":";;;AAIA,MAAMA,WAAW;IAAE,OAAO;AAAI;AAEvB,MAAMC,wBAAwB;IACjC,MAAM,EAAEC,IAAI,EAAE,GAAGC;IACjB,OAAO,WAAP,GACI,sCAACC,OAAKA;QACF,KAAKF,KAAK,GAAG;QACb,KAAKA,KAAK,IAAI;QACd,WAAWF;QACX,WAAW;;AAGvB"}
1
+ {"version":3,"file":"presentation/config/thumbnailRenderers/GridItemImageRenderer.js","sources":["../../../../src/presentation/config/thumbnailRenderers/GridItemImageRenderer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useFile } from \"~/presentation/hooks/useFile.js\";\nimport { CroppedFileImage } from \"./CroppedFileImage.js\";\n\nexport const GridItemImageRenderer = () => {\n const { file } = useFile();\n return (\n <CroppedFileImage\n file={file}\n width={300}\n fit={\"contain\"}\n fallbackClassName={\"object-contain max-w-full max-h-full\"}\n />\n );\n};\n"],"names":["GridItemImageRenderer","file","useFile","CroppedFileImage"],"mappings":";;;AAIO,MAAMA,wBAAwB;IACjC,MAAM,EAAEC,IAAI,EAAE,GAAGC;IACjB,OAAO,WAAP,GACI,sCAACC,kBAAgBA;QACb,MAAMF;QACN,OAAO;QACP,KAAK;QACL,mBAAmB;;AAG/B"}
@@ -1,16 +1,13 @@
1
- import { Image } from "@webiny/app/components/index.js";
2
1
  import { useFile } from "../../hooks/useFile.js";
2
+ import { CroppedFileImage } from "./CroppedFileImage.js";
3
3
  import * as __rspack_external_react from "react";
4
- const width100 = {
5
- width: 100
6
- };
7
4
  const TableItemImageRenderer = ()=>{
8
5
  const { file } = useFile();
9
- return /*#__PURE__*/ __rspack_external_react.createElement(Image, {
10
- src: file.src,
11
- alt: file.name,
12
- transform: width100,
13
- className: "object-cover w-full h-full"
6
+ return /*#__PURE__*/ __rspack_external_react.createElement(CroppedFileImage, {
7
+ file: file,
8
+ width: 100,
9
+ fit: "cover",
10
+ fallbackClassName: "object-cover w-full h-full"
14
11
  });
15
12
  };
16
13
  export { TableItemImageRenderer };
@@ -1 +1 @@
1
- {"version":3,"file":"presentation/config/thumbnailRenderers/TableItemImageRenderer.js","sources":["../../../../src/presentation/config/thumbnailRenderers/TableItemImageRenderer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Image } from \"@webiny/app/components/index.js\";\nimport { useFile } from \"~/presentation/hooks/useFile.js\";\n\nconst width100 = { width: 100 };\n\nexport const TableItemImageRenderer = () => {\n const { file } = useFile();\n return (\n <Image\n src={file.src}\n alt={file.name}\n transform={width100}\n className={\"object-cover w-full h-full\"}\n />\n );\n};\n"],"names":["width100","TableItemImageRenderer","file","useFile","Image"],"mappings":";;;AAIA,MAAMA,WAAW;IAAE,OAAO;AAAI;AAEvB,MAAMC,yBAAyB;IAClC,MAAM,EAAEC,IAAI,EAAE,GAAGC;IACjB,OAAO,WAAP,GACI,sCAACC,OAAKA;QACF,KAAKF,KAAK,GAAG;QACb,KAAKA,KAAK,IAAI;QACd,WAAWF;QACX,WAAW;;AAGvB"}
1
+ {"version":3,"file":"presentation/config/thumbnailRenderers/TableItemImageRenderer.js","sources":["../../../../src/presentation/config/thumbnailRenderers/TableItemImageRenderer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useFile } from \"~/presentation/hooks/useFile.js\";\nimport { CroppedFileImage } from \"./CroppedFileImage.js\";\n\nexport const TableItemImageRenderer = () => {\n const { file } = useFile();\n return (\n <CroppedFileImage\n file={file}\n width={100}\n fit={\"cover\"}\n fallbackClassName={\"object-cover w-full h-full\"}\n />\n );\n};\n"],"names":["TableItemImageRenderer","file","useFile","CroppedFileImage"],"mappings":";;;AAIO,MAAMA,yBAAyB;IAClC,MAAM,EAAEC,IAAI,EAAE,GAAGC;IACjB,OAAO,WAAP,GACI,sCAACC,kBAAgBA;QACb,MAAMF;QACN,OAAO;QACP,KAAK;QACL,mBAAmB;;AAG/B"}
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ export interface AssetFieldRendererSettings extends Record<string, unknown> {
3
+ imagesOnly?: boolean;
4
+ accept?: string[];
5
+ }
6
+ declare module "@webiny/app-admin/features/formModel/abstractions.js" {
7
+ interface IFieldRendererRegistry {
8
+ cmsAssetPicker: {
9
+ fieldType: "asset";
10
+ settings: AssetFieldRendererSettings;
11
+ };
12
+ }
13
+ }
14
+ /**
15
+ * Single-asset picker for the CMS Asset field. The field value is the typed Asset
16
+ * object; the picker chrome shows the file's URL, while crop / focal point / alt
17
+ * are edited per-usage via the shared `ImageEditor` and written back onto
18
+ * `value.image`.
19
+ */
20
+ export declare const CmsAssetPickerRenderer: React.ComponentType<{
21
+ field: import("@webiny/app-admin/index.js").IFieldVM;
22
+ }>;
@@ -0,0 +1,56 @@
1
+ import react, { useState } from "react";
2
+ import { createFieldRenderer } from "@webiny/app-admin/features/formModel/createFieldRenderer.js";
3
+ import { FileManager } from "@webiny/app-admin/base/ui/FileManager.js";
4
+ import { FilePicker, ImageEditor, RichItemPreview } from "@webiny/admin-ui";
5
+ import { applyImageEditToAsset, assetImageToEditorValue, fileItemToAsset, hasAsset, hasImageEdit, isImageAsset } from "./assetValue.js";
6
+ import { CroppedAssetThumb } from "./CroppedAssetThumb.js";
7
+ const CmsAssetPickerRenderer = createFieldRenderer(({ field })=>{
8
+ const settings = field.rendererSettings;
9
+ const value = field.value ?? null;
10
+ const [editing, setEditing] = useState(false);
11
+ const src = value?.src ?? void 0;
12
+ const editable = isImageAsset(value) && hasAsset(value);
13
+ const showCroppedPreview = editable && hasImageEdit(value?.image);
14
+ return /*#__PURE__*/ react.createElement(FileManager, {
15
+ images: settings?.imagesOnly,
16
+ accept: settings?.accept,
17
+ render: ({ showFileManager })=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(FilePicker, {
18
+ label: field.label,
19
+ description: field.description,
20
+ note: field.note,
21
+ hint: field.help,
22
+ type: "compact",
23
+ value: src,
24
+ validation: field.validation,
25
+ renderFilePreview: showCroppedPreview && value?.src && value.image ? (previewProps)=>/*#__PURE__*/ react.createElement(RichItemPreview, {
26
+ ...previewProps,
27
+ renderImage: ({ name })=>/*#__PURE__*/ react.createElement(CroppedAssetThumb, {
28
+ src: value.src,
29
+ name: name,
30
+ image: value.image
31
+ })
32
+ }) : void 0,
33
+ onSelectItem: ()=>showFileManager((file)=>{
34
+ field.onChange(fileItemToAsset(file));
35
+ }),
36
+ onRemoveItem: ()=>field.onChange(null),
37
+ onEditItem: editable ? ()=>setEditing(true) : void 0
38
+ }), editable && value ? /*#__PURE__*/ react.createElement(ImageEditor, {
39
+ open: editing,
40
+ onClose: ()=>setEditing(false),
41
+ image: {
42
+ src: value.src ?? "",
43
+ width: value.image?.width ?? 0,
44
+ height: value.image?.height ?? 0
45
+ },
46
+ value: assetImageToEditorValue(value.image),
47
+ onSave: (edit)=>{
48
+ field.onChange(applyImageEditToAsset(value, edit));
49
+ setEditing(false);
50
+ }
51
+ }) : null)
52
+ });
53
+ });
54
+ export { CmsAssetPickerRenderer };
55
+
56
+ //# sourceMappingURL=CmsAssetPickerRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation/fieldRenderers/CmsAssetPickerRenderer.js","sources":["../../../src/presentation/fieldRenderers/CmsAssetPickerRenderer.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { createFieldRenderer } from \"@webiny/app-admin/features/formModel/createFieldRenderer.js\";\nimport { FileManager } from \"@webiny/app-admin/base/ui/FileManager.js\";\nimport type { FileManagerFileItem } from \"@webiny/app-admin/base/ui/FileManager.js\";\nimport { FilePicker, RichItemPreview, ImageEditor, type ImageEditorValue } from \"@webiny/admin-ui\";\nimport {\n applyImageEditToAsset,\n assetImageToEditorValue,\n fileItemToAsset,\n hasAsset,\n hasImageEdit,\n isImageAsset,\n type Asset\n} from \"./assetValue.js\";\nimport { CroppedAssetThumb } from \"./CroppedAssetThumb.js\";\n\nexport interface AssetFieldRendererSettings extends Record<string, unknown> {\n imagesOnly?: boolean;\n accept?: string[];\n}\n\ndeclare module \"@webiny/app-admin/features/formModel/abstractions.js\" {\n interface IFieldRendererRegistry {\n cmsAssetPicker: { fieldType: \"asset\"; settings: AssetFieldRendererSettings };\n }\n}\n\n/**\n * Single-asset picker for the CMS Asset field. The field value is the typed Asset\n * object; the picker chrome shows the file's URL, while crop / focal point / alt\n * are edited per-usage via the shared `ImageEditor` and written back onto\n * `value.image`.\n */\nexport const CmsAssetPickerRenderer = createFieldRenderer<\"cmsAssetPicker\">(({ field }) => {\n const settings = field.rendererSettings as AssetFieldRendererSettings | undefined;\n const value = (field.value as Asset | null) ?? null;\n const [editing, setEditing] = useState(false);\n\n const src = value?.src ?? undefined;\n const editable = isImageAsset(value) && hasAsset(value);\n const showCroppedPreview = editable && hasImageEdit(value?.image);\n\n return (\n <FileManager\n images={settings?.imagesOnly}\n accept={settings?.accept}\n render={({ showFileManager }) => (\n <>\n <FilePicker\n label={field.label}\n description={field.description}\n note={field.note}\n hint={field.help}\n type=\"compact\"\n value={src}\n validation={field.validation}\n // Reflect the per-usage crop + focal point in the thumbnail.\n renderFilePreview={\n showCroppedPreview && value?.src && value.image\n ? previewProps => (\n <RichItemPreview\n {...previewProps}\n renderImage={({ name }) => (\n <CroppedAssetThumb\n src={value.src as string}\n name={name}\n image={value.image!}\n />\n )}\n />\n )\n : undefined\n }\n onSelectItem={() =>\n showFileManager((file: FileManagerFileItem) => {\n field.onChange(fileItemToAsset(file));\n })\n }\n onRemoveItem={() => field.onChange(null)}\n onEditItem={editable ? () => setEditing(true) : undefined}\n />\n {editable && value ? (\n <ImageEditor\n open={editing}\n onClose={() => setEditing(false)}\n image={{\n src: value.src ?? \"\",\n width: value.image?.width ?? 0,\n height: value.image?.height ?? 0\n }}\n value={assetImageToEditorValue(value.image)}\n onSave={(edit: ImageEditorValue) => {\n field.onChange(applyImageEditToAsset(value, edit));\n setEditing(false);\n }}\n />\n ) : null}\n </>\n )}\n />\n );\n});\n"],"names":["CmsAssetPickerRenderer","createFieldRenderer","field","settings","value","editing","setEditing","useState","src","undefined","editable","isImageAsset","hasAsset","showCroppedPreview","hasImageEdit","FileManager","showFileManager","FilePicker","previewProps","RichItemPreview","name","CroppedAssetThumb","file","fileItemToAsset","ImageEditor","assetImageToEditorValue","edit","applyImageEditToAsset"],"mappings":";;;;;;AAiCO,MAAMA,yBAAyBC,oBAAsC,CAAC,EAAEC,KAAK,EAAE;IAClF,MAAMC,WAAWD,MAAM,gBAAgB;IACvC,MAAME,QAASF,MAAM,KAAK,IAAqB;IAC/C,MAAM,CAACG,SAASC,WAAW,GAAGC,SAAS;IAEvC,MAAMC,MAAMJ,OAAO,OAAOK;IAC1B,MAAMC,WAAWC,aAAaP,UAAUQ,SAASR;IACjD,MAAMS,qBAAqBH,YAAYI,aAAaV,OAAO;IAE3D,OAAO,WAAP,GACI,oBAACW,aAAWA;QACR,QAAQZ,UAAU;QAClB,QAAQA,UAAU;QAClB,QAAQ,CAAC,EAAEa,eAAe,EAAE,iBACxB,wDACI,oBAACC,YAAUA;gBACP,OAAOf,MAAM,KAAK;gBAClB,aAAaA,MAAM,WAAW;gBAC9B,MAAMA,MAAM,IAAI;gBAChB,MAAMA,MAAM,IAAI;gBAChB,MAAK;gBACL,OAAOM;gBACP,YAAYN,MAAM,UAAU;gBAE5B,mBACIW,sBAAsBT,OAAO,OAAOA,MAAM,KAAK,GACzCc,CAAAA,eAAAA,WAAAA,GACI,oBAACC,iBAAeA;wBACX,GAAGD,YAAY;wBAChB,aAAa,CAAC,EAAEE,IAAI,EAAE,iBAClB,oBAACC,mBAAiBA;gCACd,KAAKjB,MAAM,GAAG;gCACd,MAAMgB;gCACN,OAAOhB,MAAM,KAAK;;yBAKlCK;gBAEV,cAAc,IACVO,gBAAgB,CAACM;wBACbpB,MAAM,QAAQ,CAACqB,gBAAgBD;oBACnC;gBAEJ,cAAc,IAAMpB,MAAM,QAAQ,CAAC;gBACnC,YAAYQ,WAAW,IAAMJ,WAAW,QAAQG;gBAEnDC,YAAYN,QAAQ,WAARA,GACT,oBAACoB,aAAWA;gBACR,MAAMnB;gBACN,SAAS,IAAMC,WAAW;gBAC1B,OAAO;oBACH,KAAKF,MAAM,GAAG,IAAI;oBAClB,OAAOA,MAAM,KAAK,EAAE,SAAS;oBAC7B,QAAQA,MAAM,KAAK,EAAE,UAAU;gBACnC;gBACA,OAAOqB,wBAAwBrB,MAAM,KAAK;gBAC1C,QAAQ,CAACsB;oBACLxB,MAAM,QAAQ,CAACyB,sBAAsBvB,OAAOsB;oBAC5CpB,WAAW;gBACf;iBAEJ;;AAKxB"}
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import type { FileFieldSettings } from "@webiny/app-admin/features/formModel/fieldTypes/FileFieldType.js";
3
+ declare module "@webiny/app-admin/features/formModel/abstractions.js" {
4
+ interface IFieldRendererRegistry {
5
+ cmsFilePicker: {
6
+ fieldType: "file";
7
+ settings: FileFieldSettings;
8
+ };
9
+ }
10
+ }
11
+ export declare const CmsFilePickerRenderer: React.ComponentType<{
12
+ field: import("@webiny/app-admin/index.js").IFieldVM;
13
+ }>;
@@ -0,0 +1,36 @@
1
+ import react from "react";
2
+ import { createFieldRenderer } from "@webiny/app-admin/features/formModel/createFieldRenderer.js";
3
+ import { FileManager } from "@webiny/app-admin/base/ui/FileManager.js";
4
+ import { FilePicker } from "@webiny/admin-ui";
5
+ import { isEditableImageUrl, useCmsImageEditor } from "../hooks/useCmsImageEditor.js";
6
+ import { CmsImageEditorDialog } from "./CmsImageEditorDialog.js";
7
+ const CmsFilePickerRenderer = createFieldRenderer(({ field })=>{
8
+ const settings = field.rendererSettings;
9
+ const value = field.value;
10
+ const editor = useCmsImageEditor();
11
+ return /*#__PURE__*/ react.createElement(FileManager, {
12
+ images: settings?.images,
13
+ accept: settings?.accept,
14
+ own: settings?.own,
15
+ scope: settings?.scope,
16
+ render: ({ showFileManager })=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(FilePicker, {
17
+ label: field.label,
18
+ description: field.description,
19
+ note: field.note,
20
+ hint: field.help,
21
+ type: "compact",
22
+ value: value,
23
+ validation: field.validation,
24
+ onSelectItem: ()=>showFileManager((file)=>{
25
+ field.onChange(file.src || "");
26
+ }),
27
+ onRemoveItem: ()=>field.onChange(null),
28
+ onEditItem: isEditableImageUrl(value) ? ()=>editor.openFor(value) : void 0
29
+ }), /*#__PURE__*/ react.createElement(CmsImageEditorDialog, {
30
+ editor: editor
31
+ }))
32
+ });
33
+ });
34
+ export { CmsFilePickerRenderer };
35
+
36
+ //# sourceMappingURL=CmsFilePickerRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation/fieldRenderers/CmsFilePickerRenderer.js","sources":["../../../src/presentation/fieldRenderers/CmsFilePickerRenderer.tsx"],"sourcesContent":["import React from \"react\";\nimport { createFieldRenderer } from \"@webiny/app-admin/features/formModel/createFieldRenderer.js\";\nimport { FileManager } from \"@webiny/app-admin/base/ui/FileManager.js\";\nimport { FilePicker } from \"@webiny/admin-ui\";\nimport type { FileManagerFileItem } from \"@webiny/app-admin/base/ui/FileManager.js\";\nimport type { FileFieldSettings } from \"@webiny/app-admin/features/formModel/fieldTypes/FileFieldType.js\";\nimport { isEditableImageUrl, useCmsImageEditor } from \"~/presentation/hooks/useCmsImageEditor.js\";\nimport { CmsImageEditorDialog } from \"./CmsImageEditorDialog.js\";\n\ndeclare module \"@webiny/app-admin/features/formModel/abstractions.js\" {\n interface IFieldRendererRegistry {\n cmsFilePicker: { fieldType: \"file\"; settings: FileFieldSettings };\n }\n}\n\nexport const CmsFilePickerRenderer = createFieldRenderer<\"cmsFilePicker\">(({ field }) => {\n const settings = field.rendererSettings as FileFieldSettings | undefined;\n const value = field.value as string | undefined;\n const editor = useCmsImageEditor();\n\n return (\n <FileManager\n images={settings?.images}\n accept={settings?.accept}\n own={settings?.own}\n scope={settings?.scope}\n render={({ showFileManager }) => (\n <>\n <FilePicker\n label={field.label}\n description={field.description}\n note={field.note}\n hint={field.help}\n type=\"compact\"\n value={value}\n validation={field.validation}\n onSelectItem={() =>\n showFileManager((file: FileManagerFileItem) => {\n field.onChange(file.src || \"\");\n })\n }\n onRemoveItem={() => field.onChange(null)}\n // The \"Edit\" (pencil) action opens the crop / focal point /\n // alt editor for image values (edits the file's asset-level\n // settings). Hidden for non-images.\n onEditItem={\n isEditableImageUrl(value) ? () => editor.openFor(value) : undefined\n }\n />\n <CmsImageEditorDialog editor={editor} />\n </>\n )}\n />\n );\n});\n"],"names":["CmsFilePickerRenderer","createFieldRenderer","field","settings","value","editor","useCmsImageEditor","FileManager","showFileManager","FilePicker","file","isEditableImageUrl","undefined","CmsImageEditorDialog"],"mappings":";;;;;;AAeO,MAAMA,wBAAwBC,oBAAqC,CAAC,EAAEC,KAAK,EAAE;IAChF,MAAMC,WAAWD,MAAM,gBAAgB;IACvC,MAAME,QAAQF,MAAM,KAAK;IACzB,MAAMG,SAASC;IAEf,OAAO,WAAP,GACI,oBAACC,aAAWA;QACR,QAAQJ,UAAU;QAClB,QAAQA,UAAU;QAClB,KAAKA,UAAU;QACf,OAAOA,UAAU;QACjB,QAAQ,CAAC,EAAEK,eAAe,EAAE,iBACxB,wDACI,oBAACC,YAAUA;gBACP,OAAOP,MAAM,KAAK;gBAClB,aAAaA,MAAM,WAAW;gBAC9B,MAAMA,MAAM,IAAI;gBAChB,MAAMA,MAAM,IAAI;gBAChB,MAAK;gBACL,OAAOE;gBACP,YAAYF,MAAM,UAAU;gBAC5B,cAAc,IACVM,gBAAgB,CAACE;wBACbR,MAAM,QAAQ,CAACQ,KAAK,GAAG,IAAI;oBAC/B;gBAEJ,cAAc,IAAMR,MAAM,QAAQ,CAAC;gBAInC,YACIS,mBAAmBP,SAAS,IAAMC,OAAO,OAAO,CAACD,SAASQ;8BAGlE,oBAACC,sBAAoBA;gBAAC,QAAQR;;;AAKlD"}
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import type { useCmsImageEditor } from "../../presentation/hooks/useCmsImageEditor.js";
3
+ interface CmsImageEditorDialogProps {
4
+ editor: ReturnType<typeof useCmsImageEditor>;
5
+ }
6
+ export declare const CmsImageEditorDialog: ({ editor }: CmsImageEditorDialogProps) => React.JSX.Element | null;
7
+ export {};
@@ -0,0 +1,32 @@
1
+ import react from "react";
2
+ import { ImageEditor } from "@webiny/admin-ui";
3
+ const CmsImageEditorDialog = ({ editor })=>{
4
+ const { open, close, file, save } = editor;
5
+ if (!file) return null;
6
+ const img = file.metadata?.image;
7
+ const value = img?.crop || img?.focalPoint ? {
8
+ crop: img.crop ?? void 0,
9
+ hotspot: img.focalPoint ? {
10
+ x: img.focalPoint.x,
11
+ y: img.focalPoint.y,
12
+ width: 1,
13
+ height: 1
14
+ } : void 0,
15
+ alt: img.alt ?? void 0,
16
+ caption: img.caption ?? void 0
17
+ } : void 0;
18
+ return /*#__PURE__*/ react.createElement(ImageEditor, {
19
+ open: open,
20
+ onClose: close,
21
+ image: {
22
+ src: file.src,
23
+ width: img?.width ?? 0,
24
+ height: img?.height ?? 0
25
+ },
26
+ value: value,
27
+ onSave: save
28
+ });
29
+ };
30
+ export { CmsImageEditorDialog };
31
+
32
+ //# sourceMappingURL=CmsImageEditorDialog.js.map