@webiny/app-file-manager 6.6.0-alpha.0 → 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 (132) hide show
  1. package/app.js +8 -0
  2. package/app.js.map +1 -1
  3. package/features/shared/FILE_FIELDS.js +4 -0
  4. package/features/shared/FILE_FIELDS.js.map +1 -1
  5. package/features/shared/FileFieldsProviderWithWcp.d.ts +5 -5
  6. package/features/shared/FileFieldsProviderWithWcp.js +7 -7
  7. package/features/shared/FileFieldsProviderWithWcp.js.map +1 -1
  8. package/modules/AiEnrichment/ReenrichFileGateway.d.ts +12 -0
  9. package/modules/AiEnrichment/ReenrichFileGateway.js +23 -0
  10. package/modules/AiEnrichment/ReenrichFileGateway.js.map +1 -0
  11. package/modules/AiEnrichment/ReenrichWithAi.d.ts +11 -0
  12. package/modules/AiEnrichment/ReenrichWithAi.js +57 -0
  13. package/modules/AiEnrichment/ReenrichWithAi.js.map +1 -0
  14. package/modules/AiEnrichment/ReenrichWithAiPresenter.d.ts +50 -0
  15. package/modules/AiEnrichment/ReenrichWithAiPresenter.js +114 -0
  16. package/modules/AiEnrichment/ReenrichWithAiPresenter.js.map +1 -0
  17. package/modules/AiEnrichment/StreamingPlaceholder.d.ts +15 -0
  18. package/modules/AiEnrichment/StreamingPlaceholder.js +32 -0
  19. package/modules/AiEnrichment/StreamingPlaceholder.js.map +1 -0
  20. package/modules/AiEnrichment/abstractions.d.ts +70 -0
  21. package/modules/AiEnrichment/abstractions.js +6 -0
  22. package/modules/AiEnrichment/abstractions.js.map +1 -0
  23. package/modules/AiEnrichment/feature.d.ts +3 -1
  24. package/modules/AiEnrichment/feature.js +10 -0
  25. package/modules/AiEnrichment/feature.js.map +1 -1
  26. package/modules/Enterprise/index.js +3 -3
  27. package/modules/Enterprise/index.js.map +1 -1
  28. package/modules/HeadlessCms/fieldType/AssetFieldSettingsModifier.d.ts +26 -0
  29. package/modules/HeadlessCms/fieldType/AssetFieldSettingsModifier.js +39 -0
  30. package/modules/HeadlessCms/fieldType/AssetFieldSettingsModifier.js.map +1 -0
  31. package/modules/HeadlessCms/fieldType/AssetFieldType.d.ts +34 -0
  32. package/modules/HeadlessCms/fieldType/AssetFieldType.js +42 -0
  33. package/modules/HeadlessCms/fieldType/AssetFieldType.js.map +1 -0
  34. package/modules/HeadlessCms/fieldType/AssetFormFieldType.d.ts +21 -0
  35. package/modules/HeadlessCms/fieldType/AssetFormFieldType.js +42 -0
  36. package/modules/HeadlessCms/fieldType/AssetFormFieldType.js.map +1 -0
  37. package/modules/HeadlessCms/fieldType/AssetInputRenderer.d.ts +15 -0
  38. package/modules/HeadlessCms/fieldType/AssetInputRenderer.js +20 -0
  39. package/modules/HeadlessCms/fieldType/AssetInputRenderer.js.map +1 -0
  40. package/modules/HeadlessCms/fieldType/AssetInputsRenderer.d.ts +15 -0
  41. package/modules/HeadlessCms/fieldType/AssetInputsRenderer.js +20 -0
  42. package/modules/HeadlessCms/fieldType/AssetInputsRenderer.js.map +1 -0
  43. package/modules/HeadlessCms/fieldType/FileFieldType.d.ts +1 -0
  44. package/modules/HeadlessCms/fieldType/FileFieldType.js +1 -0
  45. package/modules/HeadlessCms/fieldType/FileFieldType.js.map +1 -1
  46. package/modules/HeadlessCms/fieldType/feature.js +10 -0
  47. package/modules/HeadlessCms/fieldType/feature.js.map +1 -1
  48. package/modules/HeadlessCms/fieldType/isAssetField.d.ts +2 -0
  49. package/modules/HeadlessCms/fieldType/isAssetField.js +4 -0
  50. package/modules/HeadlessCms/fieldType/isAssetField.js.map +1 -0
  51. package/package.json +22 -22
  52. package/presentation/FileActions/FileDetails/EditImage.d.ts +2 -0
  53. package/presentation/FileActions/FileDetails/EditImage.js +39 -0
  54. package/presentation/FileActions/FileDetails/EditImage.js.map +1 -0
  55. package/presentation/FileActions/index.js +8 -0
  56. package/presentation/FileActions/index.js.map +1 -1
  57. package/presentation/FileDetails/FileDetailsPresenter.d.ts +2 -0
  58. package/presentation/FileDetails/FileDetailsPresenter.js +5 -0
  59. package/presentation/FileDetails/FileDetailsPresenter.js.map +1 -1
  60. package/presentation/FileDetails/FileDetailsPresenter.test.js +37 -4
  61. package/presentation/FileDetails/FileDetailsPresenter.test.js.map +1 -1
  62. package/presentation/FileDetails/abstractions.d.ts +2 -0
  63. package/presentation/FileDetails/abstractions.js.map +1 -1
  64. package/presentation/FileDetails/components/Content.d.ts +2 -1
  65. package/presentation/FileDetails/components/Content.js +2 -2
  66. package/presentation/FileDetails/components/Content.js.map +1 -1
  67. package/presentation/FileDetails/components/FileDetailsDrawer.d.ts +2 -2
  68. package/presentation/FileDetails/components/FileDetailsDrawer.js +11 -5
  69. package/presentation/FileDetails/components/FileDetailsDrawer.js.map +1 -1
  70. package/presentation/FileList/FileListDataSource.js +34 -1
  71. package/presentation/FileList/FileListDataSource.js.map +1 -1
  72. package/presentation/FileList/FileListPresenter.test.js +2 -1
  73. package/presentation/FileList/FileListPresenter.test.js.map +1 -1
  74. package/presentation/FileList/FileManagerPresenter.js +6 -4
  75. package/presentation/FileList/FileManagerPresenter.js.map +1 -1
  76. package/presentation/FileList/abstractions.d.ts +1 -0
  77. package/presentation/FileList/abstractions.js.map +1 -1
  78. package/presentation/FileList/components/BulkActions/BulkActionBar.d.ts +2 -2
  79. package/presentation/FileList/components/BulkActions/BulkActionDelete.d.ts +2 -2
  80. package/presentation/FileList/components/BulkActions/BulkActionMove.d.ts +2 -2
  81. package/presentation/FileList/components/Filters/SubFoldersToggle.d.ts +2 -2
  82. package/presentation/FileList/components/Filters/TagsFilter.d.ts +2 -2
  83. package/presentation/FileList/components/Filters/TypeFilter.d.ts +2 -2
  84. package/presentation/FileList/components/Grid/FileGrid.d.ts +2 -2
  85. package/presentation/FileList/components/Header/FileManagerHeader.d.ts +2 -2
  86. package/presentation/FileList/components/Search/SearchBar.d.ts +2 -2
  87. package/presentation/FileList/components/Table/FileTable.d.ts +2 -2
  88. package/presentation/FileList/components/Upload/UploadProgress.d.ts +2 -2
  89. package/presentation/FileManager/FileManagerBreadcrumbs.d.ts +12 -0
  90. package/presentation/FileManager/FileManagerBreadcrumbs.js +37 -0
  91. package/presentation/FileManager/FileManagerBreadcrumbs.js.map +1 -0
  92. package/presentation/FileManager/FileManagerView.js +40 -8
  93. package/presentation/FileManager/FileManagerView.js.map +1 -1
  94. package/presentation/Settings/components/SettingsView.d.ts +2 -2
  95. package/presentation/config/DefaultFileManagerConfig.js +12 -7
  96. package/presentation/config/DefaultFileManagerConfig.js.map +1 -1
  97. package/presentation/config/thumbnailRenderers/CroppedFileImage.d.ts +18 -0
  98. package/presentation/config/thumbnailRenderers/CroppedFileImage.js +66 -0
  99. package/presentation/config/thumbnailRenderers/CroppedFileImage.js.map +1 -0
  100. package/presentation/config/thumbnailRenderers/FilePreviewImageRenderer.js +6 -9
  101. package/presentation/config/thumbnailRenderers/FilePreviewImageRenderer.js.map +1 -1
  102. package/presentation/config/thumbnailRenderers/GridItemImageRenderer.js +6 -9
  103. package/presentation/config/thumbnailRenderers/GridItemImageRenderer.js.map +1 -1
  104. package/presentation/config/thumbnailRenderers/TableItemImageRenderer.js +6 -9
  105. package/presentation/config/thumbnailRenderers/TableItemImageRenderer.js.map +1 -1
  106. package/presentation/fieldRenderers/CmsAssetPickerRenderer.d.ts +22 -0
  107. package/presentation/fieldRenderers/CmsAssetPickerRenderer.js +56 -0
  108. package/presentation/fieldRenderers/CmsAssetPickerRenderer.js.map +1 -0
  109. package/presentation/fieldRenderers/CmsFilePickerRenderer.d.ts +1 -1
  110. package/presentation/fieldRenderers/CmsFilePickerRenderer.js +11 -4
  111. package/presentation/fieldRenderers/CmsFilePickerRenderer.js.map +1 -1
  112. package/presentation/fieldRenderers/CmsImageEditorDialog.d.ts +7 -0
  113. package/presentation/fieldRenderers/CmsImageEditorDialog.js +32 -0
  114. package/presentation/fieldRenderers/CmsImageEditorDialog.js.map +1 -0
  115. package/presentation/fieldRenderers/CmsMultiAssetPickerRenderer.d.ts +18 -0
  116. package/presentation/fieldRenderers/CmsMultiAssetPickerRenderer.js +88 -0
  117. package/presentation/fieldRenderers/CmsMultiAssetPickerRenderer.js.map +1 -0
  118. package/presentation/fieldRenderers/CmsMultiFilePickerRenderer.d.ts +1 -1
  119. package/presentation/fieldRenderers/CmsMultiFilePickerRenderer.js +11 -2
  120. package/presentation/fieldRenderers/CmsMultiFilePickerRenderer.js.map +1 -1
  121. package/presentation/fieldRenderers/CroppedAssetThumb.d.ts +15 -0
  122. package/presentation/fieldRenderers/CroppedAssetThumb.js +25 -0
  123. package/presentation/fieldRenderers/CroppedAssetThumb.js.map +1 -0
  124. package/presentation/fieldRenderers/assetValue.d.ts +10 -0
  125. package/presentation/fieldRenderers/assetValue.js +88 -0
  126. package/presentation/fieldRenderers/assetValue.js.map +1 -0
  127. package/presentation/hooks/useCmsImageEditor.d.ts +10 -0
  128. package/presentation/hooks/useCmsImageEditor.js +76 -0
  129. package/presentation/hooks/useCmsImageEditor.js.map +1 -0
  130. package/presentation/hooks/useEditImage.d.ts +14 -0
  131. package/presentation/hooks/useEditImage.js +67 -0
  132. package/presentation/hooks/useEditImage.js.map +1 -0
@@ -1,9 +1,19 @@
1
1
  import { createFeature } from "@webiny/feature/admin";
2
2
  import { AiImageEnrichmentEventHandler } from "./AiImageEnrichmentEventHandler.js";
3
+ import { ReenrichFileGateway } from "./ReenrichFileGateway.js";
4
+ import { ReenrichWithAiPresenter } from "./ReenrichWithAiPresenter.js";
5
+ import { ReenrichWithAiPresenter as external_abstractions_js_ReenrichWithAiPresenter } from "./abstractions.js";
3
6
  const AiEnrichmentFeature = createFeature({
4
7
  name: "FileManager/AiEnrichment",
5
8
  register (container) {
6
9
  container.register(AiImageEnrichmentEventHandler);
10
+ container.register(ReenrichFileGateway).inSingletonScope();
11
+ container.register(ReenrichWithAiPresenter).inSingletonScope();
12
+ },
13
+ resolve (container) {
14
+ return {
15
+ presenter: container.resolve(external_abstractions_js_ReenrichWithAiPresenter)
16
+ };
7
17
  }
8
18
  });
9
19
  export { AiEnrichmentFeature };
@@ -1 +1 @@
1
- {"version":3,"file":"modules/AiEnrichment/feature.js","sources":["../../../src/modules/AiEnrichment/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { AiImageEnrichmentEventHandler } from \"./AiImageEnrichmentEventHandler.js\";\n\nexport const AiEnrichmentFeature = createFeature({\n name: \"FileManager/AiEnrichment\",\n register(container) {\n container.register(AiImageEnrichmentEventHandler);\n }\n});\n"],"names":["AiEnrichmentFeature","createFeature","container","AiImageEnrichmentEventHandler"],"mappings":";;AAGO,MAAMA,sBAAsBC,cAAc;IAC7C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
1
+ {"version":3,"file":"modules/AiEnrichment/feature.js","sources":["../../../src/modules/AiEnrichment/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { AiImageEnrichmentEventHandler } from \"./AiImageEnrichmentEventHandler.js\";\nimport { ReenrichFileGateway } from \"./ReenrichFileGateway.js\";\nimport { ReenrichWithAiPresenter } from \"./ReenrichWithAiPresenter.js\";\nimport { ReenrichWithAiPresenter as PresenterAbstraction } from \"./abstractions.js\";\n\nexport const AiEnrichmentFeature = createFeature({\n name: \"FileManager/AiEnrichment\",\n register(container) {\n container.register(AiImageEnrichmentEventHandler);\n container.register(ReenrichFileGateway).inSingletonScope();\n // Singleton so the dialog's state survives re-renders of the view that reads it.\n container.register(ReenrichWithAiPresenter).inSingletonScope();\n },\n resolve(container) {\n return {\n presenter: container.resolve(PresenterAbstraction)\n };\n }\n});\n"],"names":["AiEnrichmentFeature","createFeature","container","AiImageEnrichmentEventHandler","ReenrichFileGateway","ReenrichWithAiPresenter","PresenterAbstraction"],"mappings":";;;;;AAMO,MAAMA,sBAAsBC,cAAc;IAC7C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE,qBAAqB,gBAAgB;QAExDF,UAAU,QAAQ,CAACG,yBAAyB,gBAAgB;IAChE;IACA,SAAQH,SAAS;QACb,OAAO;YACH,WAAWA,UAAU,OAAO,CAACI;QACjC;IACJ;AACJ"}
@@ -1,4 +1,4 @@
1
- import { useWcp } from "@webiny/app-admin";
1
+ import { useFeatureFlags } from "@webiny/app-admin";
2
2
  import react from "react";
3
3
  import { FileManagerViewConfig } from "../../index.js";
4
4
  import { THREAT_SCAN } from "./constants.js";
@@ -21,8 +21,8 @@ const DisableTableCellWhileThreatScanInProgress = Table.Column.createDecorator((
21
21
  return /*#__PURE__*/ react.createElement(Original, props);
22
22
  });
23
23
  const EnterpriseModule = ()=>{
24
- const wcp = useWcp();
25
- if (!wcp.canUseFileManagerThreatDetection()) return null;
24
+ const featureFlags = useFeatureFlags();
25
+ if (!featureFlags.isEnabled("fileManager.threatDetection")) return null;
26
26
  return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(DisableFileWhileThreatScanInProgress, null), /*#__PURE__*/ react.createElement(DisableTableCellWhileThreatScanInProgress, null), /*#__PURE__*/ react.createElement(FileManagerViewConfig, null, /*#__PURE__*/ react.createElement(HandleWebsocketMessages, null)));
27
27
  };
28
28
  export { EnterpriseModule };
@@ -1 +1 @@
1
- {"version":3,"file":"modules/Enterprise/index.js","sources":["../../../src/modules/Enterprise/index.tsx"],"sourcesContent":["import { useWcp } from \"@webiny/app-admin\";\nimport React from \"react\";\nimport { FileManagerViewConfig } from \"~/index.js\";\nimport { THREAT_SCAN } from \"~/modules/Enterprise/constants.js\";\nimport { ThreatScanInProgressFileBody } from \"./components/ThreatScanInProgressFileBody.js\";\nimport { ThreatScanInProgressTableCell } from \"./components/ThreatScanInProgressTableCell.js\";\nimport { HandleWebsocketMessages } from \"./HandleWebsocketMessages.js\";\n\nconst { Grid, Table } = FileManagerViewConfig.Browser;\n\nconst DisableFileWhileThreatScanInProgress = Grid.Item.createDecorator(Original => {\n return function Item(props) {\n if (props.file.tags.includes(THREAT_SCAN.IN_PROGRESS)) {\n return <Original {...props} fileBody={<ThreatScanInProgressFileBody />} />;\n }\n return <Original {...props} />;\n };\n});\n\nconst DisableTableCellWhileThreatScanInProgress = Table.Column.createDecorator(Original => {\n return function TableCellActionsWhileThreatScanInProgress(props) {\n if (props.cell) {\n return (\n <Original\n {...props}\n cell={\n <ThreatScanInProgressTableCell>{props.cell}</ThreatScanInProgressTableCell>\n }\n />\n );\n }\n\n return <Original {...props} />;\n };\n});\n\nexport const EnterpriseModule = () => {\n const wcp = useWcp();\n\n if (!wcp.canUseFileManagerThreatDetection()) {\n return null;\n }\n\n return (\n <>\n <DisableFileWhileThreatScanInProgress />\n <DisableTableCellWhileThreatScanInProgress />\n <FileManagerViewConfig>\n <HandleWebsocketMessages />\n </FileManagerViewConfig>\n </>\n );\n};\n"],"names":["Grid","Table","FileManagerViewConfig","DisableFileWhileThreatScanInProgress","Original","props","THREAT_SCAN","ThreatScanInProgressFileBody","DisableTableCellWhileThreatScanInProgress","ThreatScanInProgressTableCell","EnterpriseModule","wcp","useWcp","HandleWebsocketMessages"],"mappings":";;;;;;;AAQA,MAAM,EAAEA,MAAAA,IAAI,EAAEC,OAAAA,KAAK,EAAE,GAAGC,sBAAsB,OAAO;AAErD,MAAMC,uCAAuCH,KAAK,IAAI,CAAC,eAAe,CAACI,CAAAA,WAC5D,SAAcC,KAAK;QACtB,IAAIA,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAACC,YAAY,WAAW,GAChD,OAAO,WAAP,GAAO,oBAACF,UAAAA;YAAU,GAAGC,KAAK;YAAE,wBAAU,oBAACE,8BAA4BA;;QAEvE,OAAO,WAAP,GAAO,oBAACH,UAAaC;IACzB;AAGJ,MAAMG,4CAA4CP,MAAM,MAAM,CAAC,eAAe,CAACG,CAAAA,WACpE,SAAmDC,KAAK;QAC3D,IAAIA,MAAM,IAAI,EACV,OAAO,WAAP,GACI,oBAACD,UAAAA;YACI,GAAGC,KAAK;YACT,oBACI,oBAACI,+BAA6BA,MAAEJ,MAAM,IAAI;;QAM1D,OAAO,WAAP,GAAO,oBAACD,UAAaC;IACzB;AAGG,MAAMK,mBAAmB;IAC5B,MAAMC,MAAMC;IAEZ,IAAI,CAACD,IAAI,gCAAgC,IACrC,OAAO;IAGX,OAAO,WAAP,GACI,wDACI,oBAACR,sCAAoCA,OAAAA,WAAAA,GACrC,oBAACK,2CAAyCA,OAAAA,WAAAA,GAC1C,oBAACN,uBAAqBA,MAAAA,WAAAA,GAClB,oBAACW,yBAAuBA;AAIxC"}
1
+ {"version":3,"file":"modules/Enterprise/index.js","sources":["../../../src/modules/Enterprise/index.tsx"],"sourcesContent":["import { useFeatureFlags } from \"@webiny/app-admin\";\nimport React from \"react\";\nimport { FileManagerViewConfig } from \"~/index.js\";\nimport { THREAT_SCAN } from \"~/modules/Enterprise/constants.js\";\nimport { ThreatScanInProgressFileBody } from \"./components/ThreatScanInProgressFileBody.js\";\nimport { ThreatScanInProgressTableCell } from \"./components/ThreatScanInProgressTableCell.js\";\nimport { HandleWebsocketMessages } from \"./HandleWebsocketMessages.js\";\n\nconst { Grid, Table } = FileManagerViewConfig.Browser;\n\nconst DisableFileWhileThreatScanInProgress = Grid.Item.createDecorator(Original => {\n return function Item(props) {\n if (props.file.tags.includes(THREAT_SCAN.IN_PROGRESS)) {\n return <Original {...props} fileBody={<ThreatScanInProgressFileBody />} />;\n }\n return <Original {...props} />;\n };\n});\n\nconst DisableTableCellWhileThreatScanInProgress = Table.Column.createDecorator(Original => {\n return function TableCellActionsWhileThreatScanInProgress(props) {\n if (props.cell) {\n return (\n <Original\n {...props}\n cell={\n <ThreatScanInProgressTableCell>{props.cell}</ThreatScanInProgressTableCell>\n }\n />\n );\n }\n\n return <Original {...props} />;\n };\n});\n\nexport const EnterpriseModule = () => {\n const featureFlags = useFeatureFlags();\n\n if (!featureFlags.isEnabled(\"fileManager.threatDetection\")) {\n return null;\n }\n\n return (\n <>\n <DisableFileWhileThreatScanInProgress />\n <DisableTableCellWhileThreatScanInProgress />\n <FileManagerViewConfig>\n <HandleWebsocketMessages />\n </FileManagerViewConfig>\n </>\n );\n};\n"],"names":["Grid","Table","FileManagerViewConfig","DisableFileWhileThreatScanInProgress","Original","props","THREAT_SCAN","ThreatScanInProgressFileBody","DisableTableCellWhileThreatScanInProgress","ThreatScanInProgressTableCell","EnterpriseModule","featureFlags","useFeatureFlags","HandleWebsocketMessages"],"mappings":";;;;;;;AAQA,MAAM,EAAEA,MAAAA,IAAI,EAAEC,OAAAA,KAAK,EAAE,GAAGC,sBAAsB,OAAO;AAErD,MAAMC,uCAAuCH,KAAK,IAAI,CAAC,eAAe,CAACI,CAAAA,WAC5D,SAAcC,KAAK;QACtB,IAAIA,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAACC,YAAY,WAAW,GAChD,OAAO,WAAP,GAAO,oBAACF,UAAAA;YAAU,GAAGC,KAAK;YAAE,wBAAU,oBAACE,8BAA4BA;;QAEvE,OAAO,WAAP,GAAO,oBAACH,UAAaC;IACzB;AAGJ,MAAMG,4CAA4CP,MAAM,MAAM,CAAC,eAAe,CAACG,CAAAA,WACpE,SAAmDC,KAAK;QAC3D,IAAIA,MAAM,IAAI,EACV,OAAO,WAAP,GACI,oBAACD,UAAAA;YACI,GAAGC,KAAK;YACT,oBACI,oBAACI,+BAA6BA,MAAEJ,MAAM,IAAI;;QAM1D,OAAO,WAAP,GAAO,oBAACD,UAAaC;IACzB;AAGG,MAAMK,mBAAmB;IAC5B,MAAMC,eAAeC;IAErB,IAAI,CAACD,aAAa,SAAS,CAAC,gCACxB,OAAO;IAGX,OAAO,WAAP,GACI,wDACI,oBAACR,sCAAoCA,OAAAA,WAAAA,GACrC,oBAACK,2CAAyCA,OAAAA,WAAAA,GAC1C,oBAACN,uBAAqBA,MAAAA,WAAAA,GAClB,oBAACW,yBAAuBA;AAIxC"}
@@ -0,0 +1,26 @@
1
+ import { CmsFieldEditorGroupModifier } from "@webiny/app-headless-cms/presentation/fieldEditor/abstractions.js";
2
+ import type { ICmsFieldEditorFormBuilder, ICmsFieldEditorContext } from "@webiny/app-headless-cms/presentation/fieldEditor/abstractions.js";
3
+ import type { CmsModelField } from "@webiny/app-headless-cms-common/types/index.js";
4
+ /**
5
+ * Adds Asset-specific options to the field settings form in the content-model
6
+ * editor: an "Images only" toggle (parity with the File field) and an optional
7
+ * "Accepted file types" list. Both are honored by the asset picker renderers
8
+ * (`settings.imagesOnly` / `settings.accept`).
9
+ *
10
+ * Applies to the Asset field, which the editor resolves to the `"asset"` field
11
+ * type via `matches()` even though it is stored as an `object`.
12
+ */
13
+ declare class AssetFieldSettingsModifierImpl implements CmsFieldEditorGroupModifier.Interface {
14
+ group: string;
15
+ shouldApply(context: ICmsFieldEditorContext): boolean;
16
+ modifyForm(form: ICmsFieldEditorFormBuilder): void;
17
+ mapToForm(field: CmsModelField): {
18
+ imagesOnly: boolean;
19
+ accept: any;
20
+ };
21
+ mapFromForm(formData: Record<string, any>, field: CmsModelField): void;
22
+ }
23
+ export declare const AssetFieldSettingsModifier: typeof AssetFieldSettingsModifierImpl & {
24
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/app-headless-cms/presentation/fieldEditor/abstractions.js").ICmsFieldEditorGroupModifier>;
25
+ };
26
+ export {};
@@ -0,0 +1,39 @@
1
+ import { CmsFieldEditorGroupModifier } from "@webiny/app-headless-cms/presentation/fieldEditor/abstractions.js";
2
+ class AssetFieldSettingsModifierImpl {
3
+ shouldApply(context) {
4
+ return "asset" === context.fieldType.type;
5
+ }
6
+ modifyForm(form) {
7
+ form.fields((fields)=>({
8
+ imagesOnly: fields.boolean().label("Images only").description("Allow only images to be selected").renderer("switch").defaultValue(false),
9
+ accept: fields.text().list().label("Accepted file types").description("MIME types or extensions to allow (e.g. image/png, application/pdf). Leave empty to allow all.").renderer("tags").defaultValue([])
10
+ }));
11
+ form.layout((layout)=>[
12
+ layout.row("imagesOnly"),
13
+ layout.row("accept")
14
+ ]);
15
+ }
16
+ mapToForm(field) {
17
+ return {
18
+ imagesOnly: field.settings?.imagesOnly ?? false,
19
+ accept: field.settings?.accept ?? []
20
+ };
21
+ }
22
+ mapFromForm(formData, field) {
23
+ if (!field.settings) field.settings = {};
24
+ field.settings.imagesOnly = formData.imagesOnly;
25
+ const accept = Array.isArray(formData.accept) ? formData.accept.filter((t)=>"string" == typeof t && t.trim().length > 0) : [];
26
+ if (accept.length > 0) field.settings.accept = accept;
27
+ else delete field.settings.accept;
28
+ }
29
+ constructor(){
30
+ this.group = "general";
31
+ }
32
+ }
33
+ const AssetFieldSettingsModifier = CmsFieldEditorGroupModifier.createImplementation({
34
+ implementation: AssetFieldSettingsModifierImpl,
35
+ dependencies: []
36
+ });
37
+ export { AssetFieldSettingsModifier };
38
+
39
+ //# sourceMappingURL=AssetFieldSettingsModifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modules/HeadlessCms/fieldType/AssetFieldSettingsModifier.js","sources":["../../../../src/modules/HeadlessCms/fieldType/AssetFieldSettingsModifier.ts"],"sourcesContent":["import { CmsFieldEditorGroupModifier } from \"@webiny/app-headless-cms/presentation/fieldEditor/abstractions.js\";\nimport type {\n ICmsFieldEditorFormBuilder,\n ICmsFieldEditorContext\n} from \"@webiny/app-headless-cms/presentation/fieldEditor/abstractions.js\";\nimport type { CmsModelField } from \"@webiny/app-headless-cms-common/types/index.js\";\n\n/**\n * Adds Asset-specific options to the field settings form in the content-model\n * editor: an \"Images only\" toggle (parity with the File field) and an optional\n * \"Accepted file types\" list. Both are honored by the asset picker renderers\n * (`settings.imagesOnly` / `settings.accept`).\n *\n * Applies to the Asset field, which the editor resolves to the `\"asset\"` field\n * type via `matches()` even though it is stored as an `object`.\n */\nclass AssetFieldSettingsModifierImpl implements CmsFieldEditorGroupModifier.Interface {\n group = \"general\";\n\n shouldApply(context: ICmsFieldEditorContext) {\n return context.fieldType.type === \"asset\";\n }\n\n modifyForm(form: ICmsFieldEditorFormBuilder) {\n form.fields(fields => ({\n imagesOnly: fields\n .boolean()\n .label(\"Images only\")\n .description(\"Allow only images to be selected\")\n .renderer(\"switch\")\n .defaultValue(false),\n accept: fields\n .text()\n .list()\n .label(\"Accepted file types\")\n .description(\n \"MIME types or extensions to allow (e.g. image/png, application/pdf). Leave empty to allow all.\"\n )\n .renderer(\"tags\")\n .defaultValue([])\n }));\n form.layout(layout => [layout.row(\"imagesOnly\"), layout.row(\"accept\")]);\n }\n\n mapToForm(field: CmsModelField) {\n return {\n imagesOnly: field.settings?.imagesOnly ?? false,\n accept: field.settings?.accept ?? []\n };\n }\n\n mapFromForm(formData: Record<string, any>, field: CmsModelField) {\n if (!field.settings) {\n field.settings = {};\n }\n field.settings.imagesOnly = formData.imagesOnly;\n const accept = Array.isArray(formData.accept)\n ? formData.accept.filter((t: unknown) => typeof t === \"string\" && t.trim().length > 0)\n : [];\n if (accept.length > 0) {\n field.settings.accept = accept;\n } else {\n delete field.settings.accept;\n }\n }\n}\n\nexport const AssetFieldSettingsModifier = CmsFieldEditorGroupModifier.createImplementation({\n implementation: AssetFieldSettingsModifierImpl,\n dependencies: []\n});\n"],"names":["AssetFieldSettingsModifierImpl","context","form","fields","layout","field","formData","accept","Array","t","AssetFieldSettingsModifier","CmsFieldEditorGroupModifier"],"mappings":";AAgBA,MAAMA;IAGF,YAAYC,OAA+B,EAAE;QACzC,OAAOA,AAA2B,YAA3BA,QAAQ,SAAS,CAAC,IAAI;IACjC;IAEA,WAAWC,IAAgC,EAAE;QACzCA,KAAK,MAAM,CAACC,CAAAA,SAAW;gBACnB,YAAYA,OACP,OAAO,GACP,KAAK,CAAC,eACN,WAAW,CAAC,oCACZ,QAAQ,CAAC,UACT,YAAY,CAAC;gBAClB,QAAQA,OACH,IAAI,GACJ,IAAI,GACJ,KAAK,CAAC,uBACN,WAAW,CACR,kGAEH,QAAQ,CAAC,QACT,YAAY,CAAC,EAAE;YACxB;QACAD,KAAK,MAAM,CAACE,CAAAA,SAAU;gBAACA,OAAO,GAAG,CAAC;gBAAeA,OAAO,GAAG,CAAC;aAAU;IAC1E;IAEA,UAAUC,KAAoB,EAAE;QAC5B,OAAO;YACH,YAAYA,MAAM,QAAQ,EAAE,cAAc;YAC1C,QAAQA,MAAM,QAAQ,EAAE,UAAU,EAAE;QACxC;IACJ;IAEA,YAAYC,QAA6B,EAAED,KAAoB,EAAE;QAC7D,IAAI,CAACA,MAAM,QAAQ,EACfA,MAAM,QAAQ,GAAG,CAAC;QAEtBA,MAAM,QAAQ,CAAC,UAAU,GAAGC,SAAS,UAAU;QAC/C,MAAMC,SAASC,MAAM,OAAO,CAACF,SAAS,MAAM,IACtCA,SAAS,MAAM,CAAC,MAAM,CAAC,CAACG,IAAe,AAAa,YAAb,OAAOA,KAAkBA,EAAE,IAAI,GAAG,MAAM,GAAG,KAClF,EAAE;QACR,IAAIF,OAAO,MAAM,GAAG,GAChBF,MAAM,QAAQ,CAAC,MAAM,GAAGE;aAExB,OAAOF,MAAM,QAAQ,CAAC,MAAM;IAEpC;;aA/CA,KAAK,GAAG;;AAgDZ;AAEO,MAAMK,6BAA6BC,4BAA4B,oBAAoB,CAAC;IACvF,gBAAgBX;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,34 @@
1
+ import React from "react";
2
+ import { CmsFieldType } from "@webiny/app-headless-cms/presentation/fieldTypes/abstractions.js";
3
+ import type { CmsModelField } from "@webiny/app-headless-cms-common/types/index.js";
4
+ /**
5
+ * Palette entry for the Asset field. It is stored as an `object` field (so it reuses
6
+ * the object GraphQL/storage machinery); `createField()` therefore emits `type:
7
+ * "object"` with the asset renderer, and the API normalizer stamps the canonical
8
+ * nested schema on save. `matches()` lets the field editor resolve this descriptor
9
+ * for an asset field even though its stored type is `object`.
10
+ */
11
+ declare class AssetFieldTypeImpl implements CmsFieldType.Interface {
12
+ type: string;
13
+ label: string;
14
+ description: string;
15
+ icon: React.JSX.Element;
16
+ allowList: boolean;
17
+ listLabel: string;
18
+ allowPredefinedValues: boolean;
19
+ validators: string[];
20
+ listValidators: string[];
21
+ matches(field: CmsModelField): boolean;
22
+ createField(): {
23
+ type: string;
24
+ validation: never[];
25
+ renderer: {
26
+ name: string;
27
+ };
28
+ settings: {};
29
+ };
30
+ }
31
+ export declare const AssetFieldType: typeof AssetFieldTypeImpl & {
32
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/app-headless-cms/presentation/fieldTypes/abstractions.js").ICmsFieldType>;
33
+ };
34
+ export {};
@@ -0,0 +1,42 @@
1
+ import react from "react";
2
+ import { ReactComponent } from "@webiny/icons/collections.svg";
3
+ import { CmsFieldType } from "@webiny/app-headless-cms/presentation/fieldTypes/abstractions.js";
4
+ import { isAssetField } from "./isAssetField.js";
5
+ class AssetFieldTypeImpl {
6
+ matches(field) {
7
+ return isAssetField(field);
8
+ }
9
+ createField() {
10
+ return {
11
+ type: "asset",
12
+ validation: [],
13
+ renderer: {
14
+ name: "asset-input"
15
+ },
16
+ settings: {}
17
+ };
18
+ }
19
+ constructor(){
20
+ this.type = "asset";
21
+ this.label = "Asset";
22
+ this.description = "Images, videos, and documents — with per-usage cropping and focal point.";
23
+ this.icon = /*#__PURE__*/ react.createElement(ReactComponent, null);
24
+ this.allowList = true;
25
+ this.listLabel = "Use as a list of assets or a gallery";
26
+ this.allowPredefinedValues = false;
27
+ this.validators = [
28
+ "required"
29
+ ];
30
+ this.listValidators = [
31
+ "minLength",
32
+ "maxLength"
33
+ ];
34
+ }
35
+ }
36
+ const AssetFieldType = CmsFieldType.createImplementation({
37
+ implementation: AssetFieldTypeImpl,
38
+ dependencies: []
39
+ });
40
+ export { AssetFieldType };
41
+
42
+ //# sourceMappingURL=AssetFieldType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modules/HeadlessCms/fieldType/AssetFieldType.js","sources":["../../../../src/modules/HeadlessCms/fieldType/AssetFieldType.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as AssetIcon } from \"@webiny/icons/collections.svg\";\nimport { CmsFieldType } from \"@webiny/app-headless-cms/presentation/fieldTypes/abstractions.js\";\nimport type { CmsModelField } from \"@webiny/app-headless-cms-common/types/index.js\";\nimport { isAssetField } from \"./isAssetField.js\";\n\n/**\n * Palette entry for the Asset field. It is stored as an `object` field (so it reuses\n * the object GraphQL/storage machinery); `createField()` therefore emits `type:\n * \"object\"` with the asset renderer, and the API normalizer stamps the canonical\n * nested schema on save. `matches()` lets the field editor resolve this descriptor\n * for an asset field even though its stored type is `object`.\n */\nclass AssetFieldTypeImpl implements CmsFieldType.Interface {\n type = \"asset\";\n label = \"Asset\";\n description = \"Images, videos, and documents — with per-usage cropping and focal point.\";\n icon = <AssetIcon />;\n allowList = true;\n listLabel = \"Use as a list of assets or a gallery\";\n allowPredefinedValues = false;\n validators = [\"required\"];\n listValidators = [\"minLength\", \"maxLength\"];\n\n matches(field: CmsModelField) {\n return isAssetField(field);\n }\n\n createField() {\n return {\n type: \"asset\",\n validation: [],\n renderer: { name: \"asset-input\" },\n settings: {}\n };\n }\n}\n\nexport const AssetFieldType = CmsFieldType.createImplementation({\n implementation: AssetFieldTypeImpl,\n dependencies: []\n});\n"],"names":["AssetFieldTypeImpl","field","isAssetField","AssetIcon","AssetFieldType","CmsFieldType"],"mappings":";;;;AAaA,MAAMA;IAWF,QAAQC,KAAoB,EAAE;QAC1B,OAAOC,aAAaD;IACxB;IAEA,cAAc;QACV,OAAO;YACH,MAAM;YACN,YAAY,EAAE;YACd,UAAU;gBAAE,MAAM;YAAc;YAChC,UAAU,CAAC;QACf;IACJ;;aArBA,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAAG;aACd,IAAI,GAAG,WAAP,GAAO,oBAACE,gBAASA;aACjB,SAAS,GAAG;aACZ,SAAS,GAAG;aACZ,qBAAqB,GAAG;aACxB,UAAU,GAAG;YAAC;SAAW;aACzB,cAAc,GAAG;YAAC;YAAa;SAAY;;AAc/C;AAEO,MAAMC,iBAAiBC,aAAa,oBAAoB,CAAC;IAC5D,gBAAgBL;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,21 @@
1
+ import { type IFieldTypeFactory } from "@webiny/app-admin/features/formModel/abstractions.js";
2
+ import { FieldBuilder } from "@webiny/app-admin/features/formModel/FieldBuilder.js";
3
+ export declare class AssetFieldBuilder extends FieldBuilder<"asset"> {
4
+ constructor();
5
+ list(): this;
6
+ imagesOnly(): this;
7
+ accept(mimeTypes: string[]): this;
8
+ }
9
+ declare class AssetFieldTypeFactory implements IFieldTypeFactory {
10
+ readonly type = "asset";
11
+ create(): AssetFieldBuilder;
12
+ }
13
+ export declare const AssetFormFieldType: typeof AssetFieldTypeFactory & {
14
+ __abstraction: import("@webiny/di").Abstraction<IFieldTypeFactory>;
15
+ };
16
+ declare module "@webiny/app-admin/features/formModel/abstractions.js" {
17
+ interface IFieldBuilderRegistry {
18
+ asset(): AssetFieldBuilder;
19
+ }
20
+ }
21
+ export {};
@@ -0,0 +1,42 @@
1
+ import { FieldType } from "@webiny/app-admin/features/formModel/abstractions.js";
2
+ import { FieldBuilder } from "@webiny/app-admin/features/formModel/FieldBuilder.js";
3
+ class AssetFieldBuilder extends FieldBuilder {
4
+ constructor(){
5
+ super("asset");
6
+ this._config.renderer = "cmsAssetPicker";
7
+ }
8
+ list() {
9
+ super.list();
10
+ if ("cmsAssetPicker" === this._config.renderer) this._config.renderer = "cmsMultiAssetPicker";
11
+ return this;
12
+ }
13
+ imagesOnly() {
14
+ this._config.rendererSettings = {
15
+ ...this._config.rendererSettings,
16
+ imagesOnly: true
17
+ };
18
+ return this;
19
+ }
20
+ accept(mimeTypes) {
21
+ this._config.rendererSettings = {
22
+ ...this._config.rendererSettings,
23
+ accept: mimeTypes
24
+ };
25
+ return this;
26
+ }
27
+ }
28
+ class AssetFieldTypeFactory {
29
+ create() {
30
+ return new AssetFieldBuilder();
31
+ }
32
+ constructor(){
33
+ this.type = "asset";
34
+ }
35
+ }
36
+ const AssetFormFieldType = FieldType.createImplementation({
37
+ implementation: AssetFieldTypeFactory,
38
+ dependencies: []
39
+ });
40
+ export { AssetFieldBuilder, AssetFormFieldType };
41
+
42
+ //# sourceMappingURL=AssetFormFieldType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modules/HeadlessCms/fieldType/AssetFormFieldType.js","sources":["../../../../src/modules/HeadlessCms/fieldType/AssetFormFieldType.ts"],"sourcesContent":["import {\n FieldType,\n type IFieldTypeFactory\n} from \"@webiny/app-admin/features/formModel/abstractions.js\";\nimport { FieldBuilder } from \"@webiny/app-admin/features/formModel/FieldBuilder.js\";\n\nexport class AssetFieldBuilder extends FieldBuilder<\"asset\"> {\n constructor() {\n super(\"asset\");\n this._config.renderer = \"cmsAssetPicker\";\n }\n\n override list(): this {\n super.list();\n if (this._config.renderer === \"cmsAssetPicker\") {\n this._config.renderer = \"cmsMultiAssetPicker\";\n }\n return this;\n }\n\n imagesOnly(): this {\n this._config.rendererSettings = { ...this._config.rendererSettings, imagesOnly: true };\n return this;\n }\n\n accept(mimeTypes: string[]): this {\n this._config.rendererSettings = { ...this._config.rendererSettings, accept: mimeTypes };\n return this;\n }\n}\n\nclass AssetFieldTypeFactory implements IFieldTypeFactory {\n readonly type = \"asset\";\n create() {\n return new AssetFieldBuilder();\n }\n}\n\nexport const AssetFormFieldType = FieldType.createImplementation({\n implementation: AssetFieldTypeFactory,\n dependencies: []\n});\n\ndeclare module \"@webiny/app-admin/features/formModel/abstractions.js\" {\n interface IFieldBuilderRegistry {\n asset(): AssetFieldBuilder;\n }\n}\n"],"names":["AssetFieldBuilder","FieldBuilder","mimeTypes","AssetFieldTypeFactory","AssetFormFieldType","FieldType"],"mappings":";;AAMO,MAAMA,0BAA0BC;IACnC,aAAc;QACV,KAAK,CAAC;QACN,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG;IAC5B;IAES,OAAa;QAClB,KAAK,CAAC;QACN,IAAI,AAA0B,qBAA1B,IAAI,CAAC,OAAO,CAAC,QAAQ,EACrB,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG;QAE5B,OAAO,IAAI;IACf;IAEA,aAAmB;QACf,IAAI,CAAC,OAAO,CAAC,gBAAgB,GAAG;YAAE,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB;YAAE,YAAY;QAAK;QACrF,OAAO,IAAI;IACf;IAEA,OAAOC,SAAmB,EAAQ;QAC9B,IAAI,CAAC,OAAO,CAAC,gBAAgB,GAAG;YAAE,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB;YAAE,QAAQA;QAAU;QACtF,OAAO,IAAI;IACf;AACJ;AAEA,MAAMC;IAEF,SAAS;QACL,OAAO,IAAIH;IACf;;aAHS,IAAI,GAAG;;AAIpB;AAEO,MAAMI,qBAAqBC,UAAU,oBAAoB,CAAC;IAC7D,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,15 @@
1
+ import { CmsFieldRenderer } from "@webiny/app-headless-cms/presentation/fieldRenderers/abstractions.js";
2
+ import type { CmsModelField } from "@webiny/app-headless-cms-common/types/index.js";
3
+ declare class AssetInputRendererImpl implements CmsFieldRenderer.Interface {
4
+ rendererName: string;
5
+ formRenderer: string;
6
+ name: string;
7
+ description: string;
8
+ canUse({ field }: {
9
+ field: CmsModelField;
10
+ }): boolean;
11
+ }
12
+ export declare const AssetInputRenderer: typeof AssetInputRendererImpl & {
13
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/app-headless-cms/presentation/fieldRenderers/abstractions.js").ICmsFieldRenderer>;
14
+ };
15
+ export {};
@@ -0,0 +1,20 @@
1
+ import { CmsFieldRenderer } from "@webiny/app-headless-cms/presentation/fieldRenderers/abstractions.js";
2
+ import { isAssetField } from "./isAssetField.js";
3
+ class AssetInputRendererImpl {
4
+ canUse({ field }) {
5
+ return isAssetField(field) && !field.list;
6
+ }
7
+ constructor(){
8
+ this.rendererName = "asset-input";
9
+ this.formRenderer = "cmsAssetPicker";
10
+ this.name = "Asset Input";
11
+ this.description = "Enables selecting a single asset (image, document, or video) via File Manager.";
12
+ }
13
+ }
14
+ const AssetInputRenderer = CmsFieldRenderer.createImplementation({
15
+ implementation: AssetInputRendererImpl,
16
+ dependencies: []
17
+ });
18
+ export { AssetInputRenderer };
19
+
20
+ //# sourceMappingURL=AssetInputRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modules/HeadlessCms/fieldType/AssetInputRenderer.js","sources":["../../../../src/modules/HeadlessCms/fieldType/AssetInputRenderer.ts"],"sourcesContent":["import { CmsFieldRenderer } from \"@webiny/app-headless-cms/presentation/fieldRenderers/abstractions.js\";\nimport type { CmsModelField } from \"@webiny/app-headless-cms-common/types/index.js\";\nimport { isAssetField } from \"./isAssetField.js\";\n\nclass AssetInputRendererImpl implements CmsFieldRenderer.Interface {\n rendererName = \"asset-input\";\n formRenderer = \"cmsAssetPicker\";\n name = \"Asset Input\";\n description = \"Enables selecting a single asset (image, document, or video) via File Manager.\";\n\n canUse({ field }: { field: CmsModelField }) {\n return isAssetField(field) && !field.list;\n }\n}\n\nexport const AssetInputRenderer = CmsFieldRenderer.createImplementation({\n implementation: AssetInputRendererImpl,\n dependencies: []\n});\n"],"names":["AssetInputRendererImpl","field","isAssetField","AssetInputRenderer","CmsFieldRenderer"],"mappings":";;AAIA,MAAMA;IAMF,OAAO,EAAEC,KAAK,EAA4B,EAAE;QACxC,OAAOC,aAAaD,UAAU,CAACA,MAAM,IAAI;IAC7C;;aAPA,YAAY,GAAG;aACf,YAAY,GAAG;aACf,IAAI,GAAG;aACP,WAAW,GAAG;;AAKlB;AAEO,MAAME,qBAAqBC,iBAAiB,oBAAoB,CAAC;IACpE,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,15 @@
1
+ import { CmsFieldRenderer } from "@webiny/app-headless-cms/presentation/fieldRenderers/abstractions.js";
2
+ import type { CmsModelField } from "@webiny/app-headless-cms-common/types/index.js";
3
+ declare class AssetInputsRendererImpl implements CmsFieldRenderer.Interface {
4
+ rendererName: string;
5
+ formRenderer: string;
6
+ name: string;
7
+ description: string;
8
+ canUse({ field }: {
9
+ field: CmsModelField;
10
+ }): boolean;
11
+ }
12
+ export declare const AssetInputsRenderer: typeof AssetInputsRendererImpl & {
13
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/app-headless-cms/presentation/fieldRenderers/abstractions.js").ICmsFieldRenderer>;
14
+ };
15
+ export {};
@@ -0,0 +1,20 @@
1
+ import { CmsFieldRenderer } from "@webiny/app-headless-cms/presentation/fieldRenderers/abstractions.js";
2
+ import { isAssetField } from "./isAssetField.js";
3
+ class AssetInputsRendererImpl {
4
+ canUse({ field }) {
5
+ return isAssetField(field) && !!field.list;
6
+ }
7
+ constructor(){
8
+ this.rendererName = "asset-inputs";
9
+ this.formRenderer = "cmsMultiAssetPicker";
10
+ this.name = "Asset Inputs";
11
+ this.description = "Enables selecting multiple assets via File Manager.";
12
+ }
13
+ }
14
+ const AssetInputsRenderer = CmsFieldRenderer.createImplementation({
15
+ implementation: AssetInputsRendererImpl,
16
+ dependencies: []
17
+ });
18
+ export { AssetInputsRenderer };
19
+
20
+ //# sourceMappingURL=AssetInputsRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modules/HeadlessCms/fieldType/AssetInputsRenderer.js","sources":["../../../../src/modules/HeadlessCms/fieldType/AssetInputsRenderer.ts"],"sourcesContent":["import { CmsFieldRenderer } from \"@webiny/app-headless-cms/presentation/fieldRenderers/abstractions.js\";\nimport type { CmsModelField } from \"@webiny/app-headless-cms-common/types/index.js\";\nimport { isAssetField } from \"./isAssetField.js\";\n\nclass AssetInputsRendererImpl implements CmsFieldRenderer.Interface {\n rendererName = \"asset-inputs\";\n formRenderer = \"cmsMultiAssetPicker\";\n name = \"Asset Inputs\";\n description = \"Enables selecting multiple assets via File Manager.\";\n\n canUse({ field }: { field: CmsModelField }) {\n return isAssetField(field) && !!field.list;\n }\n}\n\nexport const AssetInputsRenderer = CmsFieldRenderer.createImplementation({\n implementation: AssetInputsRendererImpl,\n dependencies: []\n});\n"],"names":["AssetInputsRendererImpl","field","isAssetField","AssetInputsRenderer","CmsFieldRenderer"],"mappings":";;AAIA,MAAMA;IAMF,OAAO,EAAEC,KAAK,EAA4B,EAAE;QACxC,OAAOC,aAAaD,UAAU,CAAC,CAACA,MAAM,IAAI;IAC9C;;aAPA,YAAY,GAAG;aACf,YAAY,GAAG;aACf,IAAI,GAAG;aACP,WAAW,GAAG;;AAKlB;AAEO,MAAME,sBAAsBC,iBAAiB,oBAAoB,CAAC;IACrE,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
@@ -10,6 +10,7 @@ declare class FileFieldTypeImpl implements CmsFieldType.Interface {
10
10
  allowPredefinedValues: boolean;
11
11
  validators: string[];
12
12
  listValidators: string[];
13
+ deprecated: boolean;
13
14
  createField(): {
14
15
  type: string;
15
16
  validation: never[];
@@ -26,6 +26,7 @@ class FileFieldTypeImpl {
26
26
  "minLength",
27
27
  "maxLength"
28
28
  ];
29
+ this.deprecated = true;
29
30
  }
30
31
  }
31
32
  const FileFieldType = CmsFieldType.createImplementation({
@@ -1 +1 @@
1
- {"version":3,"file":"modules/HeadlessCms/fieldType/FileFieldType.js","sources":["../../../../src/modules/HeadlessCms/fieldType/FileFieldType.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as FileIcon } from \"@webiny/icons/file_present.svg\";\nimport { CmsFieldType } from \"@webiny/app-headless-cms/presentation/fieldTypes/abstractions.js\";\n\nclass FileFieldTypeImpl implements CmsFieldType.Interface {\n type = \"file\";\n label = \"Files\";\n description = \"Images, videos and other files.\";\n icon = <FileIcon />;\n allowList = true;\n listLabel = \"Use as a list of files or an image gallery\";\n allowPredefinedValues = false;\n validators = [\"required\"];\n listValidators = [\"minLength\", \"maxLength\"];\n\n createField() {\n return {\n type: this.type,\n validation: [],\n renderer: { name: \"\" }\n };\n }\n}\n\nexport const FileFieldType = CmsFieldType.createImplementation({\n implementation: FileFieldTypeImpl,\n dependencies: []\n});\n"],"names":["FileFieldTypeImpl","FileIcon","FileFieldType","CmsFieldType"],"mappings":";;;AAIA,MAAMA;IAWF,cAAc;QACV,OAAO;YACH,MAAM,IAAI,CAAC,IAAI;YACf,YAAY,EAAE;YACd,UAAU;gBAAE,MAAM;YAAG;QACzB;IACJ;;aAhBA,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAAG;aACd,IAAI,GAAG,WAAP,GAAO,oBAACC,gBAAQA;aAChB,SAAS,GAAG;aACZ,SAAS,GAAG;aACZ,qBAAqB,GAAG;aACxB,UAAU,GAAG;YAAC;SAAW;aACzB,cAAc,GAAG;YAAC;YAAa;SAAY;;AAS/C;AAEO,MAAMC,gBAAgBC,aAAa,oBAAoB,CAAC;IAC3D,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
1
+ {"version":3,"file":"modules/HeadlessCms/fieldType/FileFieldType.js","sources":["../../../../src/modules/HeadlessCms/fieldType/FileFieldType.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as FileIcon } from \"@webiny/icons/file_present.svg\";\nimport { CmsFieldType } from \"@webiny/app-headless-cms/presentation/fieldTypes/abstractions.js\";\n\nclass FileFieldTypeImpl implements CmsFieldType.Interface {\n type = \"file\";\n label = \"Files\";\n description = \"Images, videos and other files.\";\n icon = <FileIcon />;\n allowList = true;\n listLabel = \"Use as a list of files or an image gallery\";\n allowPredefinedValues = false;\n validators = [\"required\"];\n listValidators = [\"minLength\", \"maxLength\"];\n // Superseded by the Asset field. Hidden from the palette unless a model already\n // uses a file field, so existing models remain editable (backwards compatible).\n deprecated = true;\n\n createField() {\n return {\n type: this.type,\n validation: [],\n renderer: { name: \"\" }\n };\n }\n}\n\nexport const FileFieldType = CmsFieldType.createImplementation({\n implementation: FileFieldTypeImpl,\n dependencies: []\n});\n"],"names":["FileFieldTypeImpl","FileIcon","FileFieldType","CmsFieldType"],"mappings":";;;AAIA,MAAMA;IAcF,cAAc;QACV,OAAO;YACH,MAAM,IAAI,CAAC,IAAI;YACf,YAAY,EAAE;YACd,UAAU;gBAAE,MAAM;YAAG;QACzB;IACJ;;aAnBA,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAAG;aACd,IAAI,GAAG,WAAP,GAAO,oBAACC,gBAAQA;aAChB,SAAS,GAAG;aACZ,SAAS,GAAG;aACZ,qBAAqB,GAAG;aACxB,UAAU,GAAG;YAAC;SAAW;aACzB,cAAc,GAAG;YAAC;YAAa;SAAY;aAG3C,UAAU,GAAG;;AASjB;AAEO,MAAMC,gBAAgBC,aAAa,oBAAoB,CAAC;IAC3D,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
@@ -1,15 +1,25 @@
1
1
  import { createFeature } from "@webiny/feature/admin";
2
2
  import { FileFieldType } from "./FileFieldType.js";
3
+ import { AssetFieldType } from "./AssetFieldType.js";
4
+ import { AssetFormFieldType } from "./AssetFormFieldType.js";
3
5
  import { FileFieldSettingsModifier } from "./FileFieldSettingsModifier.js";
6
+ import { AssetFieldSettingsModifier } from "./AssetFieldSettingsModifier.js";
4
7
  import { FileInputRenderer } from "./FileInputRenderer.js";
5
8
  import { FileInputsRenderer } from "./FileInputsRenderer.js";
9
+ import { AssetInputRenderer } from "./AssetInputRenderer.js";
10
+ import { AssetInputsRenderer } from "./AssetInputsRenderer.js";
6
11
  const FileFieldTypeFeature = createFeature({
7
12
  name: "FileFieldType",
8
13
  register (container) {
9
14
  container.register(FileFieldType);
15
+ container.register(AssetFieldType);
16
+ container.register(AssetFormFieldType);
10
17
  container.register(FileFieldSettingsModifier);
18
+ container.register(AssetFieldSettingsModifier);
11
19
  container.register(FileInputRenderer);
12
20
  container.register(FileInputsRenderer);
21
+ container.register(AssetInputRenderer);
22
+ container.register(AssetInputsRenderer);
13
23
  }
14
24
  });
15
25
  export { FileFieldTypeFeature };
@@ -1 +1 @@
1
- {"version":3,"file":"modules/HeadlessCms/fieldType/feature.js","sources":["../../../../src/modules/HeadlessCms/fieldType/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { FileFieldType } from \"./FileFieldType.js\";\nimport { FileFieldSettingsModifier } from \"./FileFieldSettingsModifier.js\";\nimport { FileInputRenderer } from \"./FileInputRenderer.js\";\nimport { FileInputsRenderer } from \"./FileInputsRenderer.js\";\n\nexport const FileFieldTypeFeature = createFeature({\n name: \"FileFieldType\",\n register(container) {\n container.register(FileFieldType);\n container.register(FileFieldSettingsModifier);\n container.register(FileInputRenderer);\n container.register(FileInputsRenderer);\n }\n});\n"],"names":["FileFieldTypeFeature","createFeature","container","FileFieldType","FileFieldSettingsModifier","FileInputRenderer","FileInputsRenderer"],"mappings":";;;;;AAMO,MAAMA,uBAAuBC,cAAc;IAC9C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;IACvB;AACJ"}
1
+ {"version":3,"file":"modules/HeadlessCms/fieldType/feature.js","sources":["../../../../src/modules/HeadlessCms/fieldType/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { FileFieldType } from \"./FileFieldType.js\";\nimport { AssetFieldType } from \"./AssetFieldType.js\";\nimport { AssetFormFieldType } from \"./AssetFormFieldType.js\";\nimport { FileFieldSettingsModifier } from \"./FileFieldSettingsModifier.js\";\nimport { AssetFieldSettingsModifier } from \"./AssetFieldSettingsModifier.js\";\nimport { FileInputRenderer } from \"./FileInputRenderer.js\";\nimport { FileInputsRenderer } from \"./FileInputsRenderer.js\";\nimport { AssetInputRenderer } from \"./AssetInputRenderer.js\";\nimport { AssetInputsRenderer } from \"./AssetInputsRenderer.js\";\n\nexport const FileFieldTypeFeature = createFeature({\n name: \"FileFieldType\",\n register(container) {\n container.register(FileFieldType);\n container.register(AssetFieldType);\n container.register(AssetFormFieldType);\n container.register(FileFieldSettingsModifier);\n container.register(AssetFieldSettingsModifier);\n container.register(FileInputRenderer);\n container.register(FileInputsRenderer);\n container.register(AssetInputRenderer);\n container.register(AssetInputsRenderer);\n }\n});\n"],"names":["FileFieldTypeFeature","createFeature","container","FileFieldType","AssetFieldType","AssetFormFieldType","FileFieldSettingsModifier","AssetFieldSettingsModifier","FileInputRenderer","FileInputsRenderer","AssetInputRenderer","AssetInputsRenderer"],"mappings":";;;;;;;;;;AAWO,MAAMA,uBAAuBC,cAAc;IAC9C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;QACnBL,UAAU,QAAQ,CAACM;QACnBN,UAAU,QAAQ,CAACO;QACnBP,UAAU,QAAQ,CAACQ;QACnBR,UAAU,QAAQ,CAACS;IACvB;AACJ"}
@@ -0,0 +1,2 @@
1
+ import type { CmsModelField } from "@webiny/app-headless-cms-common/types/index.js";
2
+ export declare const isAssetField: (field: Pick<CmsModelField, "type">) => boolean;
@@ -0,0 +1,4 @@
1
+ const isAssetField = (field)=>"asset" === field.type;
2
+ export { isAssetField };
3
+
4
+ //# sourceMappingURL=isAssetField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modules/HeadlessCms/fieldType/isAssetField.js","sources":["../../../../src/modules/HeadlessCms/fieldType/isAssetField.ts"],"sourcesContent":["import type { CmsModelField } from \"@webiny/app-headless-cms-common/types/index.js\";\n\nexport const isAssetField = (field: Pick<CmsModelField, \"type\">): boolean => {\n return field.type === \"asset\";\n};\n"],"names":["isAssetField","field"],"mappings":"AAEO,MAAMA,eAAe,CAACC,QAClBA,AAAe,YAAfA,MAAM,IAAI"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/app-file-manager",
3
- "version": "6.6.0-alpha.0",
3
+ "version": "6.6.0-alpha.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -14,39 +14,39 @@
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
16
  "@types/react": "18.3.31",
17
- "@webiny/admin-ui": "6.6.0-alpha.0",
18
- "@webiny/app": "6.6.0-alpha.0",
19
- "@webiny/app-aco": "6.6.0-alpha.0",
20
- "@webiny/app-admin": "6.6.0-alpha.0",
21
- "@webiny/app-headless-cms": "6.6.0-alpha.0",
22
- "@webiny/app-headless-cms-common": "6.6.0-alpha.0",
23
- "@webiny/app-websockets": "6.6.0-alpha.0",
24
- "@webiny/di": "1.0.2",
25
- "@webiny/feature": "6.6.0-alpha.0",
26
- "@webiny/form": "6.6.0-alpha.0",
27
- "@webiny/icons": "6.6.0-alpha.0",
28
- "@webiny/plugins": "6.6.0-alpha.0",
29
- "@webiny/react-composition": "6.6.0-alpha.0",
30
- "@webiny/react-properties": "6.6.0-alpha.0",
31
- "@webiny/sdk": "6.6.0-alpha.0",
32
- "@webiny/validation": "6.6.0-alpha.0",
17
+ "@webiny/admin-ui": "6.6.0-alpha.1",
18
+ "@webiny/app": "6.6.0-alpha.1",
19
+ "@webiny/app-aco": "6.6.0-alpha.1",
20
+ "@webiny/app-admin": "6.6.0-alpha.1",
21
+ "@webiny/app-headless-cms": "6.6.0-alpha.1",
22
+ "@webiny/app-headless-cms-common": "6.6.0-alpha.1",
23
+ "@webiny/app-websockets": "6.6.0-alpha.1",
24
+ "@webiny/di": "1.1.0",
25
+ "@webiny/feature": "6.6.0-alpha.1",
26
+ "@webiny/form": "6.6.0-alpha.1",
27
+ "@webiny/icons": "6.6.0-alpha.1",
28
+ "@webiny/plugins": "6.6.0-alpha.1",
29
+ "@webiny/react-composition": "6.6.0-alpha.1",
30
+ "@webiny/react-properties": "6.6.0-alpha.1",
31
+ "@webiny/sdk": "6.6.0-alpha.1",
32
+ "@webiny/validation": "6.6.0-alpha.1",
33
33
  "bytes": "3.1.2",
34
- "dayjs": "1.11.21",
34
+ "dayjs": "1.11.23",
35
35
  "lodash": "4.18.1",
36
36
  "mime": "4.1.0",
37
37
  "minimatch": "10.2.6",
38
- "mobx": "6.16.1",
39
- "mobx-react-lite": "4.1.1",
38
+ "mobx": "7.0.3",
39
+ "mobx-react-lite": "5.0.3",
40
40
  "react": "18.3.1",
41
41
  "react-dom": "18.3.1",
42
42
  "react-lazy-load": "4.0.1",
43
43
  "zod": "4.4.3"
44
44
  },
45
45
  "devDependencies": {
46
- "@webiny/build-tools": "6.6.0-alpha.0",
46
+ "@webiny/build-tools": "6.6.0-alpha.1",
47
47
  "rimraf": "6.1.3",
48
48
  "typescript": "7.0.2",
49
- "vitest": "4.1.10"
49
+ "vitest": "4.1.11"
50
50
  },
51
51
  "publishConfig": {
52
52
  "access": "public"
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const EditImage: () => React.JSX.Element | null;
@@ -0,0 +1,39 @@
1
+ import react, { useCallback } from "react";
2
+ import { ReactComponent } from "@webiny/icons/crop.svg";
3
+ import { ImageEditor } from "@webiny/admin-ui";
4
+ import { FileManagerViewConfig, useFile } from "../../../index.js";
5
+ import { useFileManagerPresenter } from "../../FileList/FileManagerPresenterProvider.js";
6
+ import { useEditImage } from "../../hooks/useEditImage.js";
7
+ const { FileDetails: FileDetails } = FileManagerViewConfig;
8
+ const EditImage = ()=>{
9
+ const { file } = useFile();
10
+ const { vm } = useFileManagerPresenter();
11
+ const fileDetails = vm.fileDetails;
12
+ const onSaved = useCallback((updated)=>{
13
+ fileDetails?.setFile(updated);
14
+ }, [
15
+ fileDetails
16
+ ]);
17
+ const { open, openEditor, closeEditor, value, save } = useEditImage(file, {
18
+ onSaved
19
+ });
20
+ if (!file.type?.startsWith("image/") || "image/svg+xml" === file.type) return null;
21
+ return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(FileDetails.Action.Button, {
22
+ label: "Edit image",
23
+ icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
24
+ onAction: openEditor
25
+ }), /*#__PURE__*/ react.createElement(ImageEditor, {
26
+ open: open,
27
+ onClose: closeEditor,
28
+ image: {
29
+ src: file.src,
30
+ width: file.metadata?.image?.width ?? 0,
31
+ height: file.metadata?.image?.height ?? 0
32
+ },
33
+ value: value,
34
+ onSave: save
35
+ }));
36
+ };
37
+ export { EditImage };
38
+
39
+ //# sourceMappingURL=EditImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation/FileActions/FileDetails/EditImage.js","sources":["../../../../src/presentation/FileActions/FileDetails/EditImage.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { ReactComponent as CropIcon } from \"@webiny/icons/crop.svg\";\nimport { ImageEditor } from \"@webiny/admin-ui\";\nimport { FileManagerViewConfig, useFile } from \"~/index.js\";\nimport { useFileManagerPresenter } from \"~/presentation/FileList/FileManagerPresenterProvider.js\";\nimport { useEditImage } from \"~/presentation/hooks/useEditImage.js\";\nimport type { FileItem } from \"~/domain/types.js\";\n\nconst { FileDetails } = FileManagerViewConfig;\n\nexport const EditImage = () => {\n const { file } = useFile();\n const { vm } = useFileManagerPresenter();\n const fileDetails = vm.fileDetails;\n\n // After saving, replace the file shown in the drawer so the preview updates\n // in place (without needing to close and reopen the drawer).\n const onSaved = useCallback(\n (updated: FileItem) => {\n fileDetails?.setFile(updated);\n },\n [fileDetails]\n );\n\n const { open, openEditor, closeEditor, value, save } = useEditImage(file, { onSaved });\n\n if (!file.type?.startsWith(\"image/\") || file.type === \"image/svg+xml\") {\n return null;\n }\n\n return (\n <>\n <FileDetails.Action.Button\n label={\"Edit image\"}\n icon={<CropIcon />}\n onAction={openEditor}\n />\n <ImageEditor\n open={open}\n onClose={closeEditor}\n image={{\n src: file.src,\n width: file.metadata?.image?.width ?? 0,\n height: file.metadata?.image?.height ?? 0\n }}\n value={value}\n onSave={save}\n />\n </>\n );\n};\n"],"names":["FileDetails","FileManagerViewConfig","EditImage","file","useFile","vm","useFileManagerPresenter","fileDetails","onSaved","useCallback","updated","open","openEditor","closeEditor","value","save","useEditImage","CropIcon","ImageEditor"],"mappings":";;;;;;AAQA,MAAM,EAAEA,aAAAA,WAAW,EAAE,GAAGC;AAEjB,MAAMC,YAAY;IACrB,MAAM,EAAEC,IAAI,EAAE,GAAGC;IACjB,MAAM,EAAEC,EAAE,EAAE,GAAGC;IACf,MAAMC,cAAcF,GAAG,WAAW;IAIlC,MAAMG,UAAUC,YACZ,CAACC;QACGH,aAAa,QAAQG;IACzB,GACA;QAACH;KAAY;IAGjB,MAAM,EAAEI,IAAI,EAAEC,UAAU,EAAEC,WAAW,EAAEC,KAAK,EAAEC,IAAI,EAAE,GAAGC,aAAab,MAAM;QAAEK;IAAQ;IAEpF,IAAI,CAACL,KAAK,IAAI,EAAE,WAAW,aAAaA,AAAc,oBAAdA,KAAK,IAAI,EAC7C,OAAO;IAGX,OAAO,WAAP,GACI,wDACI,oBAACH,YAAY,MAAM,CAAC,MAAM;QACtB,OAAO;QACP,oBAAM,oBAACiB,gBAAQA;QACf,UAAUL;sBAEd,oBAACM,aAAWA;QACR,MAAMP;QACN,SAASE;QACT,OAAO;YACH,KAAKV,KAAK,GAAG;YACb,OAAOA,KAAK,QAAQ,EAAE,OAAO,SAAS;YACtC,QAAQA,KAAK,QAAQ,EAAE,OAAO,UAAU;QAC5C;QACA,OAAOW;QACP,QAAQC;;AAIxB"}