@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
@@ -1,44 +0,0 @@
1
- import react from "react";
2
- import { ReactComponent } from "@webiny/icons/file_present.svg";
3
- import { Grid, Switch } from "@webiny/admin-ui";
4
- import { Bind } from "@webiny/form";
5
- const fileField = {
6
- type: "cms-editor-field-type",
7
- name: "cms-editor-field-type-file",
8
- field: {
9
- type: "file",
10
- label: "Files",
11
- description: "Images, videos and other files.",
12
- icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
13
- validators: [
14
- "required"
15
- ],
16
- listValidators: [
17
- "minLength",
18
- "maxLength"
19
- ],
20
- allowList: true,
21
- allowPredefinedValues: false,
22
- listLabel: "Use as a list of files or an image gallery",
23
- createField () {
24
- return {
25
- type: this.type,
26
- validation: [],
27
- renderer: {
28
- name: ""
29
- }
30
- };
31
- },
32
- renderSettings: ()=>/*#__PURE__*/ react.createElement(Grid, null, /*#__PURE__*/ react.createElement(Grid.Column, {
33
- span: 12
34
- }, /*#__PURE__*/ react.createElement(Bind, {
35
- name: "settings.imagesOnly"
36
- }, /*#__PURE__*/ react.createElement(Switch, {
37
- label: "Images only",
38
- description: "Allow only images to be selected"
39
- }))))
40
- }
41
- };
42
- export { fileField };
43
-
44
- //# sourceMappingURL=fileField.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modules/HeadlessCms/fileField.js","sources":["../../../src/modules/HeadlessCms/fileField.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as FileIcon } from \"@webiny/icons/file_present.svg\";\nimport type { CmsModelFieldTypePlugin } from \"@webiny/app-headless-cms/types.js\";\nimport { Grid, Switch } from \"@webiny/admin-ui\";\nimport { Bind } from \"@webiny/form\";\n\nexport const fileField: CmsModelFieldTypePlugin = {\n type: \"cms-editor-field-type\",\n name: \"cms-editor-field-type-file\",\n field: {\n type: \"file\",\n label: \"Files\",\n description: \"Images, videos and other files.\",\n icon: <FileIcon />,\n validators: [\"required\"],\n listValidators: [\"minLength\", \"maxLength\"],\n allowList: true,\n allowPredefinedValues: false,\n listLabel: \"Use as a list of files or an image gallery\",\n createField() {\n return {\n type: this.type,\n validation: [],\n renderer: {\n name: \"\"\n }\n };\n },\n renderSettings: () => {\n return (\n <Grid>\n <Grid.Column span={12}>\n <Bind name={\"settings.imagesOnly\"}>\n <Switch\n label={\"Images only\"}\n description={\"Allow only images to be selected\"}\n />\n </Bind>\n </Grid.Column>\n </Grid>\n );\n }\n }\n};\n"],"names":["fileField","FileIcon","Grid","Bind","Switch"],"mappings":";;;;AAMO,MAAMA,YAAqC;IAC9C,MAAM;IACN,MAAM;IACN,OAAO;QACH,MAAM;QACN,OAAO;QACP,aAAa;QACb,MAAM,WAAN,GAAM,oBAACC,gBAAQA;QACf,YAAY;YAAC;SAAW;QACxB,gBAAgB;YAAC;YAAa;SAAY;QAC1C,WAAW;QACX,uBAAuB;QACvB,WAAW;QACX;YACI,OAAO;gBACH,MAAM,IAAI,CAAC,IAAI;gBACf,YAAY,EAAE;gBACd,UAAU;oBACN,MAAM;gBACV;YACJ;QACJ;QACA,gBAAgB,IACL,WAAP,GACI,oBAACC,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;gBAAC,MAAM;6BACf,oBAACC,MAAIA;gBAAC,MAAM;6BACR,oBAACC,QAAMA;gBACH,OAAO;gBACP,aAAa;;IAOzC;AACJ"}
@@ -1,2 +0,0 @@
1
- import type { CmsModelFieldRendererPlugin } from "@webiny/app-headless-cms/types.js";
2
- export declare const singleFile: CmsModelFieldRendererPlugin;
@@ -1,53 +0,0 @@
1
- import react from "react";
2
- import { FileManager } from "@webiny/app-admin";
3
- import { useFieldEffectiveRules, useModelField } from "@webiny/app-headless-cms-common";
4
- import { FilePicker } from "@webiny/admin-ui";
5
- import { getSupportedExtensionsLabelHint } from "./utils.js";
6
- const FieldRenderer = ({ getBind })=>{
7
- const { field } = useModelField();
8
- const rules = useFieldEffectiveRules(field);
9
- const disabled = !rules.canEdit || rules.disabled;
10
- const Bind = getBind();
11
- const imagesOnly = field.settings && field.settings.imagesOnly;
12
- return /*#__PURE__*/ react.createElement(Bind, null, (bind)=>{
13
- const { value, onChange, validation } = bind;
14
- return /*#__PURE__*/ react.createElement(Bind.ValidationContainer, null, /*#__PURE__*/ react.createElement(FileManager, {
15
- images: imagesOnly,
16
- render: ({ showFileManager })=>/*#__PURE__*/ react.createElement(FilePicker, {
17
- ...bind,
18
- disabled: disabled,
19
- label: field.label,
20
- validation: validation,
21
- description: field.description,
22
- hint: field.help,
23
- note: getSupportedExtensionsLabelHint(imagesOnly),
24
- value: value,
25
- onSelectItem: ()=>{
26
- showFileManager((file)=>onChange(file.src));
27
- },
28
- onRemoveItem: ()=>onChange(null),
29
- placeholder: field.placeholder,
30
- type: "compact",
31
- "data-testid": `fr.input.filefield.${field.label}`
32
- })
33
- }));
34
- });
35
- };
36
- const singleFile = {
37
- type: "cms-editor-field-renderer",
38
- name: "cms-editor-field-renderer-file",
39
- renderer: {
40
- rendererName: "file-input",
41
- name: "File Input",
42
- description: "Enables selecting a single file via File Manager.",
43
- canUse ({ field }) {
44
- return "file" === field.type && !field.list;
45
- },
46
- render (params) {
47
- return /*#__PURE__*/ react.createElement(FieldRenderer, params);
48
- }
49
- }
50
- };
51
- export { singleFile };
52
-
53
- //# sourceMappingURL=fileField.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modules/HeadlessCms/fileRenderer/fileField.js","sources":["../../../../src/modules/HeadlessCms/fileRenderer/fileField.tsx"],"sourcesContent":["import React from \"react\";\nimport type {\n CmsModelFieldRendererPlugin,\n CmsModelFieldRendererProps\n} from \"@webiny/app-headless-cms/types.js\";\nimport { FileManager } from \"@webiny/app-admin\";\nimport { useFieldEffectiveRules, useModelField } from \"@webiny/app-headless-cms-common\";\nimport { FilePicker } from \"@webiny/admin-ui\";\nimport { getSupportedExtensionsLabelHint } from \"~/modules/HeadlessCms/fileRenderer/utils.js\";\n\nconst FieldRenderer = ({ getBind }: CmsModelFieldRendererProps) => {\n const { field } = useModelField();\n const rules = useFieldEffectiveRules(field);\n const disabled = !rules.canEdit || rules.disabled;\n const Bind = getBind();\n\n const imagesOnly = field.settings && field.settings.imagesOnly;\n\n return (\n <Bind>\n {bind => {\n const { value, onChange, validation } = bind;\n\n return (\n <Bind.ValidationContainer>\n <FileManager\n images={imagesOnly}\n render={({ showFileManager }) => {\n return (\n <FilePicker\n {...bind}\n disabled={disabled}\n label={field.label}\n validation={validation}\n description={field.description}\n hint={field.help}\n note={getSupportedExtensionsLabelHint(imagesOnly)}\n value={value}\n onSelectItem={() => {\n showFileManager(file => onChange(file.src));\n }}\n onRemoveItem={() => onChange(null)}\n placeholder={field.placeholder}\n type={\"compact\"}\n data-testid={`fr.input.filefield.${field.label}`}\n />\n );\n }}\n />\n </Bind.ValidationContainer>\n );\n }}\n </Bind>\n );\n};\n\nexport const singleFile: CmsModelFieldRendererPlugin = {\n type: \"cms-editor-field-renderer\",\n name: \"cms-editor-field-renderer-file\",\n renderer: {\n rendererName: \"file-input\",\n name: \"File Input\",\n description: \"Enables selecting a single file via File Manager.\",\n canUse({ field }) {\n return field.type === \"file\" && !field.list;\n },\n render(params) {\n return <FieldRenderer {...params} />;\n }\n }\n};\n"],"names":["FieldRenderer","getBind","field","useModelField","rules","useFieldEffectiveRules","disabled","Bind","imagesOnly","bind","value","onChange","validation","FileManager","showFileManager","FilePicker","getSupportedExtensionsLabelHint","file","singleFile","params"],"mappings":";;;;;AAUA,MAAMA,gBAAgB,CAAC,EAAEC,OAAO,EAA8B;IAC1D,MAAM,EAAEC,KAAK,EAAE,GAAGC;IAClB,MAAMC,QAAQC,uBAAuBH;IACrC,MAAMI,WAAW,CAACF,MAAM,OAAO,IAAIA,MAAM,QAAQ;IACjD,MAAMG,OAAON;IAEb,MAAMO,aAAaN,MAAM,QAAQ,IAAIA,MAAM,QAAQ,CAAC,UAAU;IAE9D,OAAO,WAAP,GACI,oBAACK,MAAAA,MACIE,CAAAA;QACG,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGH;QAExC,OAAO,WAAP,GACI,oBAACF,KAAK,mBAAmB,sBACrB,oBAACM,aAAWA;YACR,QAAQL;YACR,QAAQ,CAAC,EAAEM,eAAe,EAAE,GACjB,WAAP,GACI,oBAACC,YAAUA;oBACN,GAAGN,IAAI;oBACR,UAAUH;oBACV,OAAOJ,MAAM,KAAK;oBAClB,YAAYU;oBACZ,aAAaV,MAAM,WAAW;oBAC9B,MAAMA,MAAM,IAAI;oBAChB,MAAMc,gCAAgCR;oBACtC,OAAOE;oBACP,cAAc;wBACVI,gBAAgBG,CAAAA,OAAQN,SAASM,KAAK,GAAG;oBAC7C;oBACA,cAAc,IAAMN,SAAS;oBAC7B,aAAaT,MAAM,WAAW;oBAC9B,MAAM;oBACN,eAAa,CAAC,mBAAmB,EAAEA,MAAM,KAAK,EAAE;;;IAO5E;AAGZ;AAEO,MAAMgB,aAA0C;IACnD,MAAM;IACN,MAAM;IACN,UAAU;QACN,cAAc;QACd,MAAM;QACN,aAAa;QACb,QAAO,EAAEhB,KAAK,EAAE;YACZ,OAAOA,AAAe,WAAfA,MAAM,IAAI,IAAe,CAACA,MAAM,IAAI;QAC/C;QACA,QAAOiB,MAAM;YACT,OAAO,WAAP,GAAO,oBAACnB,eAAkBmB;QAC9B;IACJ;AACJ"}
@@ -1,2 +0,0 @@
1
- import type { CmsModelFieldRendererPlugin } from "@webiny/app-headless-cms/types.js";
2
- export declare const multipleFiles: CmsModelFieldRendererPlugin;
@@ -1,73 +0,0 @@
1
- import react from "react";
2
- import dot_prop_immutable from "dot-prop-immutable";
3
- import { i18n } from "@webiny/app/i18n/index.js";
4
- import { FileManager } from "@webiny/app-admin";
5
- import { getSupportedExtensionsLabelHint } from "./utils.js";
6
- import { MultiFilePicker } from "@webiny/admin-ui";
7
- import { useFieldEffectiveRules, useModelField } from "@webiny/app-headless-cms-common";
8
- const t = i18n.ns("app-headless-cms/admin/fields/file");
9
- const FieldRenderer = ({ getBind })=>{
10
- const { field } = useModelField();
11
- const rules = useFieldEffectiveRules(field);
12
- const disabled = !rules.canEdit || rules.disabled;
13
- const Bind = getBind();
14
- const imagesOnly = field.settings && field.settings.imagesOnly;
15
- return /*#__PURE__*/ react.createElement(Bind, null, (bind)=>{
16
- const { onChange, validation } = bind;
17
- const values = (Array.isArray(bind.value) ? bind.value : [
18
- bind.value
19
- ]).filter(Boolean);
20
- return /*#__PURE__*/ react.createElement(Bind.ValidationContainer, null, /*#__PURE__*/ react.createElement(FileManager, {
21
- multiple: true,
22
- images: imagesOnly,
23
- render: ({ showFileManager })=>{
24
- const selectFiles = (index = -1)=>{
25
- showFileManager((files)=>{
26
- const urls = files.map((f)=>f.src);
27
- -1 === index ? onChange([
28
- ...values,
29
- ...urls
30
- ]) : onChange([
31
- ...values.slice(0, index),
32
- ...urls,
33
- ...values.slice(index + 1)
34
- ]);
35
- });
36
- };
37
- return /*#__PURE__*/ react.createElement(MultiFilePicker, {
38
- ...bind,
39
- disabled: disabled,
40
- label: field.label,
41
- validation: validation,
42
- description: field.description,
43
- note: getSupportedExtensionsLabelHint(imagesOnly),
44
- values: values,
45
- onSelectItem: ()=>selectFiles(),
46
- onReplaceItem: (_, index)=>selectFiles(index),
47
- onRemoveItem: (_, index)=>onChange(dot_prop_immutable["delete"](values, index)),
48
- placeholder: field.placeholder,
49
- type: "compact",
50
- "data-testid": `fr.input.filefields.${field.label}`
51
- });
52
- }
53
- }));
54
- });
55
- };
56
- const multipleFiles = {
57
- type: "cms-editor-field-renderer",
58
- name: "cms-editor-field-renderer-files",
59
- renderer: {
60
- rendererName: "file-inputs",
61
- name: t`File Inputs`,
62
- description: t`Enables selecting multiple files via File Manager.`,
63
- canUse ({ field }) {
64
- return "file" === field.type && !!field.list;
65
- },
66
- render (props) {
67
- return /*#__PURE__*/ react.createElement(FieldRenderer, props);
68
- }
69
- }
70
- };
71
- export { multipleFiles };
72
-
73
- //# sourceMappingURL=fileFields.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modules/HeadlessCms/fileRenderer/fileFields.js","sources":["../../../../src/modules/HeadlessCms/fileRenderer/fileFields.tsx"],"sourcesContent":["import React from \"react\";\nimport dotProp from \"dot-prop-immutable\";\nimport type {\n CmsModelFieldRendererPlugin,\n CmsModelFieldRendererProps\n} from \"@webiny/app-headless-cms/types.js\";\nimport { i18n } from \"@webiny/app/i18n/index.js\";\nimport { FileManager } from \"@webiny/app-admin\";\nimport { getSupportedExtensionsLabelHint } from \"./utils.js\";\nimport { MultiFilePicker } from \"@webiny/admin-ui\";\nimport { useFieldEffectiveRules, useModelField } from \"@webiny/app-headless-cms-common\";\n\nconst t = i18n.ns(\"app-headless-cms/admin/fields/file\");\n\nconst FieldRenderer = ({ getBind }: CmsModelFieldRendererProps) => {\n const { field } = useModelField();\n const rules = useFieldEffectiveRules(field);\n const disabled = !rules.canEdit || rules.disabled;\n const Bind = getBind();\n\n const imagesOnly = field.settings && field.settings.imagesOnly;\n\n return (\n <Bind>\n {bind => {\n const { onChange, validation } = bind;\n\n const values: string[] = (\n Array.isArray(bind.value) ? bind.value : [bind.value]\n ).filter(Boolean);\n\n return (\n <Bind.ValidationContainer>\n <FileManager\n multiple\n images={imagesOnly}\n render={({ showFileManager }) => {\n const selectFiles = (index = -1) => {\n showFileManager(files => {\n const urls = files.map(f => f.src);\n if (index === -1) {\n onChange([...values, ...urls]);\n } else {\n onChange([\n ...values.slice(0, index),\n ...urls,\n ...values.slice(index + 1)\n ]);\n }\n });\n };\n return (\n <MultiFilePicker\n {...bind}\n disabled={disabled}\n label={field.label}\n validation={validation}\n description={field.description}\n note={getSupportedExtensionsLabelHint(imagesOnly)}\n values={values}\n onSelectItem={() => selectFiles()}\n onReplaceItem={(_, index) => selectFiles(index)}\n onRemoveItem={(_, index) =>\n onChange(dotProp.delete(values, index))\n }\n placeholder={field.placeholder}\n type={\"compact\"}\n data-testid={`fr.input.filefields.${field.label}`}\n />\n );\n }}\n />\n </Bind.ValidationContainer>\n );\n }}\n </Bind>\n );\n};\n\nexport const multipleFiles: CmsModelFieldRendererPlugin = {\n type: \"cms-editor-field-renderer\",\n name: \"cms-editor-field-renderer-files\",\n renderer: {\n rendererName: \"file-inputs\",\n name: t`File Inputs`,\n description: t`Enables selecting multiple files via File Manager.`,\n canUse({ field }) {\n return field.type === \"file\" && !!field.list;\n },\n render(props) {\n return <FieldRenderer {...props} />;\n }\n }\n};\n"],"names":["t","i18n","FieldRenderer","getBind","field","useModelField","rules","useFieldEffectiveRules","disabled","Bind","imagesOnly","bind","onChange","validation","values","Array","Boolean","FileManager","showFileManager","selectFiles","index","files","urls","f","MultiFilePicker","getSupportedExtensionsLabelHint","_","dotProp","multipleFiles","props"],"mappings":";;;;;;;AAYA,MAAMA,IAAIC,KAAK,EAAE,CAAC;AAElB,MAAMC,gBAAgB,CAAC,EAAEC,OAAO,EAA8B;IAC1D,MAAM,EAAEC,KAAK,EAAE,GAAGC;IAClB,MAAMC,QAAQC,uBAAuBH;IACrC,MAAMI,WAAW,CAACF,MAAM,OAAO,IAAIA,MAAM,QAAQ;IACjD,MAAMG,OAAON;IAEb,MAAMO,aAAaN,MAAM,QAAQ,IAAIA,MAAM,QAAQ,CAAC,UAAU;IAE9D,OAAO,WAAP,GACI,oBAACK,MAAAA,MACIE,CAAAA;QACG,MAAM,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGF;QAEjC,MAAMG,SACFC,AAAAA,CAAAA,MAAM,OAAO,CAACJ,KAAK,KAAK,IAAIA,KAAK,KAAK,GAAG;YAACA,KAAK,KAAK;SAAA,A,EACtD,MAAM,CAACK;QAET,OAAO,WAAP,GACI,oBAACP,KAAK,mBAAmB,sBACrB,oBAACQ,aAAWA;YACR;YACA,QAAQP;YACR,QAAQ,CAAC,EAAEQ,eAAe,EAAE;gBACxB,MAAMC,cAAc,CAACC,QAAQ,EAAE;oBAC3BF,gBAAgBG,CAAAA;wBACZ,MAAMC,OAAOD,MAAM,GAAG,CAACE,CAAAA,IAAKA,EAAE,GAAG;wBACnB,OAAVH,QACAR,SAAS;+BAAIE;+BAAWQ;yBAAK,IAE7BV,SAAS;+BACFE,OAAO,KAAK,CAAC,GAAGM;+BAChBE;+BACAR,OAAO,KAAK,CAACM,QAAQ;yBAC3B;oBAET;gBACJ;gBACA,OAAO,WAAP,GACI,oBAACI,iBAAeA;oBACX,GAAGb,IAAI;oBACR,UAAUH;oBACV,OAAOJ,MAAM,KAAK;oBAClB,YAAYS;oBACZ,aAAaT,MAAM,WAAW;oBAC9B,MAAMqB,gCAAgCf;oBACtC,QAAQI;oBACR,cAAc,IAAMK;oBACpB,eAAe,CAACO,GAAGN,QAAUD,YAAYC;oBACzC,cAAc,CAACM,GAAGN,QACdR,SAASe,kBAAAA,CAAAA,SAAc,CAACb,QAAQM;oBAEpC,aAAahB,MAAM,WAAW;oBAC9B,MAAM;oBACN,eAAa,CAAC,oBAAoB,EAAEA,MAAM,KAAK,EAAE;;YAG7D;;IAIhB;AAGZ;AAEO,MAAMwB,gBAA6C;IACtD,MAAM;IACN,MAAM;IACN,UAAU;QACN,cAAc;QACd,MAAM5B,CAAC,CAAC,WAAW,CAAC;QACpB,aAAaA,CAAC,CAAC,kDAAkD,CAAC;QAClE,QAAO,EAAEI,KAAK,EAAE;YACZ,OAAOA,AAAe,WAAfA,MAAM,IAAI,IAAe,CAAC,CAACA,MAAM,IAAI;QAChD;QACA,QAAOyB,KAAK;YACR,OAAO,WAAP,GAAO,oBAAC3B,eAAkB2B;QAC9B;IACJ;AACJ"}
@@ -1,2 +0,0 @@
1
- export declare const imagePlugins: string[];
2
- export declare const getSupportedExtensionsLabelHint: (imagesOnly?: boolean) => string | null;
@@ -1,15 +0,0 @@
1
- const imagePlugins = [
2
- ".jpg",
3
- ".jpeg",
4
- ".tif",
5
- ".gif",
6
- ".png",
7
- ".svg",
8
- ".webp",
9
- "bmp",
10
- "svg"
11
- ];
12
- const getSupportedExtensionsLabelHint = (imagesOnly)=>imagesOnly ? `Supported files extensions: ${imagePlugins.filter(Boolean).join(", ")}.` : null;
13
- export { getSupportedExtensionsLabelHint, imagePlugins };
14
-
15
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modules/HeadlessCms/fileRenderer/utils.js","sources":["../../../../src/modules/HeadlessCms/fileRenderer/utils.ts"],"sourcesContent":["export const imagePlugins = [\n \".jpg\",\n \".jpeg\",\n \".tif\",\n \".gif\",\n \".png\",\n \".svg\",\n \".webp\",\n \"bmp\",\n \"svg\"\n];\n\nexport const getSupportedExtensionsLabelHint = (imagesOnly?: boolean) => {\n return imagesOnly\n ? `Supported files extensions: ${imagePlugins.filter(Boolean).join(\", \")}.`\n : null;\n};\n"],"names":["imagePlugins","getSupportedExtensionsLabelHint","imagesOnly","Boolean"],"mappings":"AAAO,MAAMA,eAAe;IACxB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACH;AAEM,MAAMC,kCAAkC,CAACC,aACrCA,aACD,CAAC,4BAA4B,EAAEF,aAAa,MAAM,CAACG,SAAS,IAAI,CAAC,MAAM,CAAC,CAAC,GACzE"}
@@ -1 +0,0 @@
1
- export declare const HeadlessCmsModule: () => null;
@@ -1,14 +0,0 @@
1
- import { useEffect } from "react";
2
- import { plugins } from "@webiny/plugins";
3
- import { fileField } from "./fileField.js";
4
- import { singleFile } from "./fileRenderer/fileField.js";
5
- import { multipleFiles } from "./fileRenderer/fileFields.js";
6
- const HeadlessCmsModule = ()=>{
7
- useEffect(()=>{
8
- plugins.register(fileField, singleFile, multipleFiles);
9
- });
10
- return null;
11
- };
12
- export { HeadlessCmsModule };
13
-
14
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modules/HeadlessCms/index.js","sources":["../../../src/modules/HeadlessCms/index.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { fileField } from \"./fileField.js\";\nimport { singleFile } from \"./fileRenderer/fileField.js\";\nimport { multipleFiles } from \"./fileRenderer/fileFields.js\";\n\nexport const HeadlessCmsModule = () => {\n useEffect(() => {\n plugins.register(fileField, singleFile, multipleFiles);\n });\n\n return null;\n};\n"],"names":["HeadlessCmsModule","useEffect","plugins","fileField","singleFile","multipleFiles"],"mappings":";;;;;AAMO,MAAMA,oBAAoB;IAC7BC,UAAU;QACNC,QAAQ,QAAQ,CAACC,WAAWC,YAAYC;IAC5C;IAEA,OAAO;AACX"}
@@ -1,12 +0,0 @@
1
- export interface GetSettingsResponse {
2
- fileManager: {
3
- getSettings: {
4
- data: Record<string, any>;
5
- };
6
- };
7
- }
8
- declare const graphql: {
9
- GET_SETTINGS: import("graphql").DocumentNode;
10
- UPDATE_SETTINGS: import("graphql").DocumentNode;
11
- };
12
- export default graphql;
@@ -1,36 +0,0 @@
1
- import graphql_tag from "graphql-tag";
2
- const fields = `
3
- {
4
- data {
5
- uploadMinFileSize
6
- uploadMaxFileSize
7
- srcPrefix
8
- }
9
- error {
10
- message
11
- data
12
- code
13
- stack
14
- }
15
- }
16
- `;
17
- const graphql = {
18
- GET_SETTINGS: graphql_tag`
19
- query GetFileManagerSettings {
20
- fileManager {
21
- getSettings${fields}
22
- }
23
- }
24
- `,
25
- UPDATE_SETTINGS: graphql_tag`
26
- mutation UpdateFileManagerSettings($data: FmSettingsInput) {
27
- fileManager {
28
- updateSettings(data: $data) ${fields}
29
- }
30
- }
31
- `
32
- };
33
- const Settings_graphql = graphql;
34
- export default Settings_graphql;
35
-
36
- //# sourceMappingURL=graphql.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modules/Settings/graphql.js","sources":["../../../src/modules/Settings/graphql.ts"],"sourcesContent":["import gql from \"graphql-tag\";\n\nconst fields = /* GraphQL */ `\n {\n data {\n uploadMinFileSize\n uploadMaxFileSize\n srcPrefix\n }\n error {\n message\n data\n code\n stack\n }\n }\n`;\n\nexport interface GetSettingsResponse {\n fileManager: {\n getSettings: {\n data: Record<string, any>;\n };\n };\n}\n\nconst graphql = {\n GET_SETTINGS: gql`\n query GetFileManagerSettings {\n fileManager {\n getSettings${fields}\n }\n }\n `,\n UPDATE_SETTINGS: gql`\n mutation UpdateFileManagerSettings($data: FmSettingsInput) {\n fileManager {\n updateSettings(data: $data) ${fields}\n }\n }\n `\n};\n\nexport default graphql;\n"],"names":["fields","graphql","gql"],"mappings":";AAEA,MAAMA,SAAuB,CAAC;;;;;;;;;;;;;;AAc9B,CAAC;AAUD,MAAMC,UAAU;IACZ,cAAcC,WAAG,CAAC;;;+BAGS,EAAEF,OAAO;;;QAGhC,CAAC;IACL,iBAAiBE,WAAG,CAAC;;;4CAGmB,EAAEF,OAAO;;;IAGjD,CAAC;AACL;AAEA,yBAAeC"}
@@ -1,2 +0,0 @@
1
- import * as React from "react";
2
- export declare const FileManagerSettings: () => React.JSX.Element;
@@ -1,134 +0,0 @@
1
- import { Button, Grid, Heading, Input, Link, OverlayLoader, Text } from "@webiny/admin-ui";
2
- import { Form, useBind } from "@webiny/form";
3
- import { Mutation, Query } from "@apollo/react-components";
4
- import { CenteredView, SimpleForm, SimpleFormContent, SimpleFormFooter, SimpleFormHeader, useDialogs, useSnackbar } from "@webiny/app-admin";
5
- import graphql from "../graphql.js";
6
- import get from "lodash/get.js";
7
- import { validation } from "@webiny/validation";
8
- import * as __rspack_external_react from "react";
9
- const Code = ({ children })=>/*#__PURE__*/ __rspack_external_react.createElement("code", {
10
- className: "text-md font-bold"
11
- }, children);
12
- const textClassName = "mb-md";
13
- const headingLevel = 5;
14
- const FileManagerSettings = ()=>{
15
- const { showSnackbar } = useSnackbar();
16
- const { showDialog } = useDialogs();
17
- const learnMore = ()=>{
18
- showDialog({
19
- title: "How to configure file delivery URL?",
20
- content: /*#__PURE__*/ __rspack_external_react.createElement("div", null, /*#__PURE__*/ __rspack_external_react.createElement(Text, {
21
- as: "div",
22
- className: textClassName
23
- }, "The file delivery URL must include the ", /*#__PURE__*/ __rspack_external_react.createElement(Code, null, "/files/"), " path to reach Webiny Asset Delivery through AWS CloudFront. When configuring a custom domain, you have two options:"), /*#__PURE__*/ __rspack_external_react.createElement(Heading, {
24
- level: headingLevel,
25
- className: "mb-xs"
26
- }, "Option 1: Custom domain directly on CloudFront"), /*#__PURE__*/ __rspack_external_react.createElement(Text, {
27
- as: "div",
28
- className: textClassName
29
- }, "Keep the ", /*#__PURE__*/ __rspack_external_react.createElement(Code, null, "/files/"), " path in your URL.", /*#__PURE__*/ __rspack_external_react.createElement("br", null), "Example: ", /*#__PURE__*/ __rspack_external_react.createElement(Code, null, "https://mydomain.com/files/"), "."), /*#__PURE__*/ __rspack_external_react.createElement(Heading, {
30
- level: headingLevel,
31
- className: "mb-xs"
32
- }, "Option 2: Additional CDN in front of CloudFront"), /*#__PURE__*/ __rspack_external_react.createElement(Text, {
33
- as: "div",
34
- className: textClassName
35
- }, "Configure your CDN to forward requests to CloudFront's /files/ path. This lets you use a clean URL for users while maintaining the required path on the backend.", /*#__PURE__*/ __rspack_external_react.createElement("ul", {
36
- className: "list-disc my-sm ml-md"
37
- }, /*#__PURE__*/ __rspack_external_react.createElement("li", null, "User-facing URL: ", /*#__PURE__*/ __rspack_external_react.createElement(Code, null, "https://mydomain.com/")), /*#__PURE__*/ __rspack_external_react.createElement("li", null, "Your CDN forwards to: ", /*#__PURE__*/ __rspack_external_react.createElement(Code, null, "https://api.cloudfront.net/files/"))))),
38
- acceptLabel: "Got it!",
39
- cancelLabel: null
40
- });
41
- };
42
- return /*#__PURE__*/ __rspack_external_react.createElement(Query, {
43
- query: graphql.GET_SETTINGS
44
- }, ({ data, loading: queryInProgress })=>/*#__PURE__*/ __rspack_external_react.createElement(Mutation, {
45
- mutation: graphql.UPDATE_SETTINGS
46
- }, (update, result)=>{
47
- const settings = get(data, "fileManager.getSettings.data") || {};
48
- const { loading: mutationInProgress } = result;
49
- const onSubmit = async (data)=>{
50
- await update({
51
- variables: {
52
- data: {
53
- uploadMinFileSize: parseFloat(data.uploadMinFileSize),
54
- uploadMaxFileSize: parseFloat(data.uploadMaxFileSize),
55
- srcPrefix: data.srcPrefix
56
- }
57
- },
58
- update: (cache, result)=>{
59
- const data = structuredClone(cache.readQuery({
60
- query: graphql.GET_SETTINGS
61
- }));
62
- if (!data) return;
63
- const error = result.data.fileManager.updateSettings.error;
64
- if (error) {
65
- showSnackbar(`Error updating settings: ${error.message}`);
66
- console.error(error);
67
- return;
68
- }
69
- data.fileManager.getSettings.data = {
70
- ...data.fileManager.getSettings.data,
71
- ...result.data.fileManager.updateSettings.data
72
- };
73
- cache.writeQuery({
74
- query: graphql.GET_SETTINGS,
75
- data
76
- });
77
- showSnackbar("Settings updated successfully.");
78
- }
79
- });
80
- };
81
- return /*#__PURE__*/ __rspack_external_react.createElement(CenteredView, null, /*#__PURE__*/ __rspack_external_react.createElement(Form, {
82
- data: settings,
83
- onSubmit: (data)=>{
84
- onSubmit(data);
85
- }
86
- }, ({ Bind, form })=>/*#__PURE__*/ __rspack_external_react.createElement(SimpleForm, null, (queryInProgress || mutationInProgress) && /*#__PURE__*/ __rspack_external_react.createElement(OverlayLoader, null), /*#__PURE__*/ __rspack_external_react.createElement(SimpleFormHeader, {
87
- title: "General Settings"
88
- }), /*#__PURE__*/ __rspack_external_react.createElement(SimpleFormContent, null, /*#__PURE__*/ __rspack_external_react.createElement(Grid, null, /*#__PURE__*/ __rspack_external_react.createElement(Grid.Column, {
89
- span: 12
90
- }, /*#__PURE__*/ __rspack_external_react.createElement(Bind, {
91
- name: "uploadMinFileSize"
92
- }, /*#__PURE__*/ __rspack_external_react.createElement(Input, {
93
- type: "number",
94
- label: "Minimum file upload size",
95
- description: "The smallest file size in bytes."
96
- }))), /*#__PURE__*/ __rspack_external_react.createElement(Grid.Column, {
97
- span: 12
98
- }, /*#__PURE__*/ __rspack_external_react.createElement(Bind, {
99
- name: "uploadMaxFileSize"
100
- }, /*#__PURE__*/ __rspack_external_react.createElement(Input, {
101
- type: "number",
102
- label: "Maximum file upload size",
103
- description: "The largest file size in bytes."
104
- }))), /*#__PURE__*/ __rspack_external_react.createElement(Grid.Column, {
105
- span: 12
106
- }, /*#__PURE__*/ __rspack_external_react.createElement(Bind, {
107
- name: "srcPrefix",
108
- validators: [
109
- validation.create("required,url")
110
- ]
111
- }, /*#__PURE__*/ __rspack_external_react.createElement(Input, {
112
- label: "File delivery URL",
113
- note: /*#__PURE__*/ __rspack_external_react.createElement(UrlPreview, null),
114
- description: /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external_react.Fragment, null, "This URL will be prepended to the file key.\xa0", /*#__PURE__*/ __rspack_external_react.createElement(Link, {
115
- to: "#",
116
- onClick: learnMore
117
- }, "How to configure?"))
118
- }))))), /*#__PURE__*/ __rspack_external_react.createElement(SimpleFormFooter, null, /*#__PURE__*/ __rspack_external_react.createElement(Button, {
119
- text: "Save settings",
120
- onClick: form.submit
121
- })))));
122
- }));
123
- };
124
- const UrlPreview = ()=>{
125
- const deliveryUrl = useBind({
126
- name: "srcPrefix"
127
- });
128
- let prefix = deliveryUrl.value ?? "";
129
- prefix = prefix.endsWith("/") ? prefix : `${prefix}/`;
130
- return /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external_react.Fragment, null, "Example URL: ", /*#__PURE__*/ __rspack_external_react.createElement("strong", null, prefix, "768bed3e544f/image.jpg"));
131
- };
132
- export { FileManagerSettings };
133
-
134
- //# sourceMappingURL=FileManagerSettings.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modules/Settings/views/FileManagerSettings.js","sources":["../../../../src/modules/Settings/views/FileManagerSettings.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Button, Grid, Input, Link, OverlayLoader, Text, Heading } from \"@webiny/admin-ui\";\nimport { Form, useBind } from \"@webiny/form\";\nimport { Mutation, Query } from \"@apollo/react-components\";\nimport {\n CenteredView,\n SimpleForm,\n SimpleFormContent,\n SimpleFormFooter,\n SimpleFormHeader,\n useDialogs,\n useSnackbar\n} from \"@webiny/app-admin\";\nimport type { GetSettingsResponse } from \"../graphql.js\";\nimport graphql from \"../graphql.js\";\nimport get from \"lodash/get.js\";\nimport { validation } from \"@webiny/validation\";\nimport type { QueryGetSettingsResult, Settings } from \"~/domain/types.js\";\nimport type { MutationFunction, MutationResult } from \"@apollo/react-common\";\n\nconst Code = ({ children }: { children: React.ReactNode }) => {\n return <code className={\"text-md font-bold\"}>{children}</code>;\n};\n\nconst textClassName = \"mb-md\";\nconst headingLevel = 5;\n\nexport const FileManagerSettings = () => {\n const { showSnackbar } = useSnackbar();\n\n const { showDialog } = useDialogs();\n\n const learnMore = () => {\n showDialog({\n title: \"How to configure file delivery URL?\",\n content: (\n <div>\n <Text as={\"div\"} className={textClassName}>\n The file delivery URL must include the <Code>/files/</Code> path to reach\n Webiny Asset Delivery through AWS CloudFront. When configuring a custom\n domain, you have two options:\n </Text>\n <Heading level={headingLevel} className={\"mb-xs\"}>\n Option 1: Custom domain directly on CloudFront\n </Heading>\n <Text as={\"div\"} className={textClassName}>\n Keep the <Code>/files/</Code> path in your URL.\n <br />\n Example: <Code>https://mydomain.com/files/</Code>.\n </Text>\n <Heading level={headingLevel} className={\"mb-xs\"}>\n Option 2: Additional CDN in front of CloudFront\n </Heading>\n <Text as={\"div\"} className={textClassName}>\n Configure your CDN to forward requests to CloudFront&apos;s /files/ path.\n This lets you use a clean URL for users while maintaining the required path\n on the backend.\n <ul className={\"list-disc my-sm ml-md\"}>\n <li>\n User-facing URL: <Code>https://mydomain.com/</Code>\n </li>\n <li>\n Your CDN forwards to: <Code>https://api.cloudfront.net/files/</Code>\n </li>\n </ul>\n </Text>\n </div>\n ),\n acceptLabel: \"Got it!\",\n cancelLabel: null\n });\n };\n\n return (\n <Query query={graphql.GET_SETTINGS}>\n {({ data, loading: queryInProgress }: MutationResult<QueryGetSettingsResult>) => (\n <Mutation mutation={graphql.UPDATE_SETTINGS}>\n {(update: MutationFunction, result: MutationResult) => {\n const settings = (get(data, \"fileManager.getSettings.data\") ||\n {}) as Settings;\n const { loading: mutationInProgress } = result;\n\n const onSubmit = async (data: Settings): Promise<void> => {\n await update({\n variables: {\n data: {\n uploadMinFileSize: parseFloat(data.uploadMinFileSize),\n uploadMaxFileSize: parseFloat(data.uploadMaxFileSize),\n srcPrefix: data.srcPrefix\n }\n },\n update: (cache, result) => {\n const data = structuredClone(\n cache.readQuery<GetSettingsResponse>({\n query: graphql.GET_SETTINGS\n })\n );\n if (!data) {\n return;\n }\n const error = result.data.fileManager.updateSettings.error;\n if (error) {\n showSnackbar(`Error updating settings: ${error.message}`);\n console.error(error);\n return;\n }\n\n data.fileManager.getSettings.data = {\n ...data.fileManager.getSettings.data,\n ...result.data.fileManager.updateSettings.data\n };\n\n cache.writeQuery({\n query: graphql.GET_SETTINGS,\n data\n });\n showSnackbar(\"Settings updated successfully.\");\n }\n });\n };\n return (\n <CenteredView>\n <Form\n data={settings}\n onSubmit={data => {\n /**\n * We are positive that data is Settings.\n */\n onSubmit(data as unknown as Settings);\n }}\n >\n {({ Bind, form }) => (\n <SimpleForm>\n {(queryInProgress || mutationInProgress) && (\n <OverlayLoader />\n )}\n <SimpleFormHeader title=\"General Settings\" />\n <SimpleFormContent>\n <Grid>\n <Grid.Column span={12}>\n <Bind name={\"uploadMinFileSize\"}>\n <Input\n type=\"number\"\n label=\"Minimum file upload size\"\n description=\"The smallest file size in bytes.\"\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind name={\"uploadMaxFileSize\"}>\n <Input\n type=\"number\"\n label=\"Maximum file upload size\"\n description=\"The largest file size in bytes.\"\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind\n name={\"srcPrefix\"}\n validators={[\n validation.create(\"required,url\")\n ]}\n >\n <Input\n label=\"File delivery URL\"\n note={<UrlPreview />}\n description={\n <>\n This URL will be prepended\n to the file key.&nbsp;\n <Link\n to=\"#\"\n onClick={learnMore}\n >\n How to configure?\n </Link>\n </>\n }\n />\n </Bind>\n </Grid.Column>\n </Grid>\n </SimpleFormContent>\n <SimpleFormFooter>\n <Button\n text={\"Save settings\"}\n onClick={form.submit}\n />\n </SimpleFormFooter>\n </SimpleForm>\n )}\n </Form>\n </CenteredView>\n );\n }}\n </Mutation>\n )}\n </Query>\n );\n};\n\nconst UrlPreview = () => {\n const deliveryUrl = useBind({\n name: \"srcPrefix\"\n });\n\n let prefix = deliveryUrl.value ?? \"\";\n\n prefix = prefix.endsWith(\"/\") ? prefix : `${prefix}/`;\n\n return (\n <>\n Example URL: <strong>{prefix}768bed3e544f/image.jpg</strong>\n </>\n );\n};\n"],"names":["Code","children","textClassName","headingLevel","FileManagerSettings","showSnackbar","useSnackbar","showDialog","useDialogs","learnMore","Text","Heading","Query","graphql","data","queryInProgress","Mutation","update","result","settings","get","mutationInProgress","onSubmit","parseFloat","cache","structuredClone","error","console","CenteredView","Form","Bind","form","SimpleForm","OverlayLoader","SimpleFormHeader","SimpleFormContent","Grid","Input","validation","UrlPreview","Link","SimpleFormFooter","Button","deliveryUrl","useBind","prefix"],"mappings":"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"}
@@ -1,7 +0,0 @@
1
- import React from "react";
2
- interface AddOperationProps {
3
- disabled: boolean;
4
- onClick: () => void;
5
- }
6
- export declare const AddOperation: ({ disabled, onClick }: AddOperationProps) => React.JSX.Element;
7
- export {};
@@ -1,15 +0,0 @@
1
- import react from "react";
2
- import { Button } from "@webiny/admin-ui";
3
- import { ReactComponent } from "@webiny/icons/add.svg";
4
- const AddOperation = ({ disabled, onClick })=>/*#__PURE__*/ react.createElement("div", {
5
- className: "wby-mt-lg wby-text-center"
6
- }, /*#__PURE__*/ react.createElement(Button, {
7
- onClick: onClick,
8
- text: "Add new operation",
9
- icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
10
- variant: "secondary",
11
- disabled: disabled
12
- }));
13
- export { AddOperation };
14
-
15
- //# sourceMappingURL=AddOperation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"presentation/FileList/components/BulkActions/BatchEditorDialog/AddOperation.js","sources":["../../../../../../src/presentation/FileList/components/BulkActions/BatchEditorDialog/AddOperation.tsx"],"sourcesContent":["import React from \"react\";\nimport { Button } from \"@webiny/admin-ui\";\nimport { ReactComponent as AddIcon } from \"@webiny/icons/add.svg\";\n\ninterface AddOperationProps {\n disabled: boolean;\n onClick: () => void;\n}\n\nexport const AddOperation = ({ disabled, onClick }: AddOperationProps) => {\n return (\n <div className={\"wby-mt-lg wby-text-center\"}>\n <Button\n onClick={onClick}\n text={\"Add new operation\"}\n icon={<AddIcon />}\n variant={\"secondary\"}\n disabled={disabled}\n />\n </div>\n );\n};\n"],"names":["AddOperation","disabled","onClick","Button","AddIcon"],"mappings":";;;AASO,MAAMA,eAAe,CAAC,EAAEC,QAAQ,EAAEC,OAAO,EAAqB,GAC1D,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAACC,QAAMA;QACH,SAASD;QACT,MAAM;QACN,oBAAM,oBAACE,gBAAOA;QACd,SAAS;QACT,UAAUH"}
@@ -1,15 +0,0 @@
1
- import React from "react";
2
- import type { FormAPI, FormOnSubmit } from "@webiny/form";
3
- import type { BatchEditorDialogViewModel, BatchEditorFormData } from "../../../../../presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialogPresenter.js";
4
- export interface BatchEditorProps {
5
- onForm: (form: FormAPI) => void;
6
- onAdd: () => void;
7
- onDelete: (operationIndex: number) => void;
8
- onChange: (data: BatchEditorFormData) => void;
9
- onSetOperationFieldData: (operationIndex: number, data: string) => void;
10
- onSubmit: FormOnSubmit<BatchEditorFormData>;
11
- vm: BatchEditorDialogViewModel;
12
- }
13
- export declare const BatchEditor: ((props: BatchEditorProps) => React.JSX.Element) & {
14
- displayName: string;
15
- };
@@ -1,44 +0,0 @@
1
- import react, { useEffect } from "react";
2
- import { observer } from "mobx-react-lite";
3
- import { ReactComponent } from "@webiny/icons/delete_outline.svg";
4
- import { Form } from "@webiny/form";
5
- import { AddOperation } from "./AddOperation.js";
6
- import { Operation } from "./Operation.js";
7
- import { Accordion } from "@webiny/admin-ui";
8
- const BatchEditor = observer((props)=>{
9
- const formRef = /*#__PURE__*/ react.createRef();
10
- useEffect(()=>{
11
- if (formRef.current) props.onForm(formRef.current);
12
- }, []);
13
- return /*#__PURE__*/ react.createElement("div", {
14
- className: "wby-py-lg"
15
- }, /*#__PURE__*/ react.createElement(Form, {
16
- ref: formRef,
17
- data: props.vm.data,
18
- onChange: props.onChange,
19
- invalidFields: props.vm.invalidFields
20
- }, ()=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Accordion, {
21
- variant: "container",
22
- background: "light"
23
- }, props.vm.data.operations.map((operation, operationIndex)=>/*#__PURE__*/ react.createElement(Accordion.Item, {
24
- key: `operation-${operationIndex}`,
25
- title: operation.title,
26
- defaultOpen: operation.open,
27
- actions: /*#__PURE__*/ react.createElement(Accordion.Item.Action, {
28
- icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
29
- onClick: ()=>props.onDelete(operationIndex),
30
- disabled: !operation.canDelete
31
- })
32
- }, /*#__PURE__*/ react.createElement(Operation, {
33
- name: `operations.${operationIndex}`,
34
- operation: operation,
35
- onDelete: ()=>props.onDelete(operationIndex),
36
- onSetOperationFieldData: (data)=>props.onSetOperationFieldData(operationIndex, data)
37
- })))), /*#__PURE__*/ react.createElement(AddOperation, {
38
- disabled: !props.vm.canAddOperation,
39
- onClick: ()=>props.onAdd()
40
- }))));
41
- });
42
- export { BatchEditor };
43
-
44
- //# sourceMappingURL=BatchEditor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditor.js","sources":["../../../../../../src/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditor.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\n\nimport { observer } from \"mobx-react-lite\";\nimport { ReactComponent as DeleteIcon } from \"@webiny/icons/delete_outline.svg\";\nimport type { FormAPI, FormOnSubmit } from \"@webiny/form\";\nimport { Form } from \"@webiny/form\";\n\nimport { AddOperation } from \"~/presentation/FileList/components/BulkActions/BatchEditorDialog/AddOperation.js\";\nimport { Operation } from \"~/presentation/FileList/components/BulkActions/BatchEditorDialog/Operation.js\";\nimport type {\n BatchEditorDialogViewModel,\n BatchEditorFormData\n} from \"~/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialogPresenter.js\";\nimport { Accordion } from \"@webiny/admin-ui\";\n\nexport interface BatchEditorProps {\n onForm: (form: FormAPI) => void;\n onAdd: () => void;\n onDelete: (operationIndex: number) => void;\n onChange: (data: BatchEditorFormData) => void;\n onSetOperationFieldData: (operationIndex: number, data: string) => void;\n onSubmit: FormOnSubmit<BatchEditorFormData>;\n vm: BatchEditorDialogViewModel;\n}\n\nexport const BatchEditor = observer((props: BatchEditorProps) => {\n const formRef = React.createRef<FormAPI>();\n\n useEffect(() => {\n if (formRef.current) {\n props.onForm(formRef.current);\n }\n }, []);\n\n return (\n <div className={\"wby-py-lg\"}>\n <Form\n ref={formRef}\n data={props.vm.data}\n onChange={props.onChange}\n invalidFields={props.vm.invalidFields}\n >\n {() => (\n <>\n <Accordion variant={\"container\"} background={\"light\"}>\n {props.vm.data.operations.map((operation, operationIndex) => (\n <Accordion.Item\n key={`operation-${operationIndex}`}\n title={operation.title}\n defaultOpen={operation.open}\n actions={\n <Accordion.Item.Action\n icon={<DeleteIcon />}\n onClick={() => props.onDelete(operationIndex)}\n disabled={!operation.canDelete}\n />\n }\n >\n <Operation\n name={`operations.${operationIndex}`}\n operation={operation}\n onDelete={() => props.onDelete(operationIndex)}\n onSetOperationFieldData={data =>\n props.onSetOperationFieldData(operationIndex, data)\n }\n />\n </Accordion.Item>\n ))}\n </Accordion>\n <AddOperation\n disabled={!props.vm.canAddOperation}\n onClick={() => props.onAdd()}\n />\n </>\n )}\n </Form>\n </div>\n );\n});\n"],"names":["BatchEditor","observer","props","formRef","React","useEffect","Form","Accordion","operation","operationIndex","DeleteIcon","Operation","data","AddOperation"],"mappings":";;;;;;;AAyBO,MAAMA,cAAcC,SAAS,CAACC;IACjC,MAAMC,UAAU,WAAVA,GAAUC,MAAAA,SAAe;IAE/BC,UAAU;QACN,IAAIF,QAAQ,OAAO,EACfD,MAAM,MAAM,CAACC,QAAQ,OAAO;IAEpC,GAAG,EAAE;IAEL,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAACG,MAAIA;QACD,KAAKH;QACL,MAAMD,MAAM,EAAE,CAAC,IAAI;QACnB,UAAUA,MAAM,QAAQ;QACxB,eAAeA,MAAM,EAAE,CAAC,aAAa;OAEpC,kBACG,wDACI,oBAACK,WAASA;YAAC,SAAS;YAAa,YAAY;WACxCL,MAAM,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAACM,WAAWC,iBAAAA,WAAAA,GACtC,oBAACF,UAAU,IAAI;gBACX,KAAK,CAAC,UAAU,EAAEE,gBAAgB;gBAClC,OAAOD,UAAU,KAAK;gBACtB,aAAaA,UAAU,IAAI;gBAC3B,uBACI,oBAACD,UAAU,IAAI,CAAC,MAAM;oBAClB,oBAAM,oBAACG,gBAAUA;oBACjB,SAAS,IAAMR,MAAM,QAAQ,CAACO;oBAC9B,UAAU,CAACD,UAAU,SAAS;;6BAItC,oBAACG,WAASA;gBACN,MAAM,CAAC,WAAW,EAAEF,gBAAgB;gBACpC,WAAWD;gBACX,UAAU,IAAMN,MAAM,QAAQ,CAACO;gBAC/B,yBAAyBG,CAAAA,OACrBV,MAAM,uBAAuB,CAACO,gBAAgBG;iCAMlE,oBAACC,cAAYA;YACT,UAAU,CAACX,MAAM,EAAE,CAAC,eAAe;YACnC,SAAS,IAAMA,MAAM,KAAK;;AAOtD"}
@@ -1,15 +0,0 @@
1
- import React from "react";
2
- import type { BatchDTO, FieldDTO } from "../../../../../presentation/FileList/components/BulkActions/domain/index.js";
3
- interface BatchEditorDialogProps {
4
- fields: FieldDTO[];
5
- batch: BatchDTO;
6
- vm: {
7
- isOpen: boolean;
8
- };
9
- onApply: (batch: BatchDTO) => void;
10
- onClose: () => void;
11
- }
12
- export declare const BatchEditorDialog: ((props: BatchEditorDialogProps) => React.JSX.Element) & {
13
- displayName: string;
14
- };
15
- export {};