@webiny/app-file-manager 6.6.0-alpha.0 → 6.6.0-alpha.10
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.
- package/app.js +8 -0
- package/app.js.map +1 -1
- package/exports/admin/file-manager.d.ts +9 -0
- package/exports/admin/file-manager.js +4 -0
- package/features/deleteFile/DeleteFile.test.js.map +1 -1
- package/features/fileUploader/FileUploader.test.js.map +1 -1
- package/features/listFiles/ListFiles.test.js.map +1 -1
- package/features/settings/GetSettings.test.js +1 -0
- package/features/settings/GetSettings.test.js.map +1 -1
- package/features/settings/GetSettingsGateway.js +1 -0
- package/features/settings/GetSettingsGateway.js.map +1 -1
- package/features/settings/GetSettingsRepository.d.ts +2 -1
- package/features/settings/GetSettingsRepository.js.map +1 -1
- package/features/settings/SaveSettingsGateway.d.ts +2 -1
- package/features/settings/SaveSettingsGateway.js +1 -0
- package/features/settings/SaveSettingsGateway.js.map +1 -1
- package/features/settings/abstractions.d.ts +3 -2
- package/features/settings/abstractions.js.map +1 -1
- package/features/shared/FILE_FIELDS.js +4 -0
- package/features/shared/FILE_FIELDS.js.map +1 -1
- package/features/shared/FileFieldsProviderWithWcp.d.ts +5 -5
- package/features/shared/FileFieldsProviderWithWcp.js +7 -7
- package/features/shared/FileFieldsProviderWithWcp.js.map +1 -1
- package/features/shared/feature.d.ts +1 -1
- package/features/shared/types.d.ts +8 -1
- package/features/tags/ListTags.test.js.map +1 -1
- package/features/updateFile/UpdateFile.test.js.map +1 -1
- package/modules/AiEnrichment/AiImageEnrichmentFailedEventHandler.d.ts +19 -0
- package/modules/AiEnrichment/AiImageEnrichmentFailedEventHandler.js +26 -0
- package/modules/AiEnrichment/AiImageEnrichmentFailedEventHandler.js.map +1 -0
- package/modules/AiEnrichment/ReenrichFileGateway.d.ts +12 -0
- package/modules/AiEnrichment/ReenrichFileGateway.js +23 -0
- package/modules/AiEnrichment/ReenrichFileGateway.js.map +1 -0
- package/modules/AiEnrichment/ReenrichWithAi.d.ts +11 -0
- package/modules/AiEnrichment/ReenrichWithAi.js +57 -0
- package/modules/AiEnrichment/ReenrichWithAi.js.map +1 -0
- package/modules/AiEnrichment/ReenrichWithAiPresenter.d.ts +50 -0
- package/modules/AiEnrichment/ReenrichWithAiPresenter.js +114 -0
- package/modules/AiEnrichment/ReenrichWithAiPresenter.js.map +1 -0
- package/modules/AiEnrichment/StreamingPlaceholder.d.ts +15 -0
- package/modules/AiEnrichment/StreamingPlaceholder.js +32 -0
- package/modules/AiEnrichment/StreamingPlaceholder.js.map +1 -0
- package/modules/AiEnrichment/abstractions.d.ts +70 -0
- package/modules/AiEnrichment/abstractions.js +6 -0
- package/modules/AiEnrichment/abstractions.js.map +1 -0
- package/modules/AiEnrichment/feature.d.ts +3 -1
- package/modules/AiEnrichment/feature.js +12 -0
- package/modules/AiEnrichment/feature.js.map +1 -1
- package/modules/Enterprise/index.js +3 -3
- package/modules/Enterprise/index.js.map +1 -1
- package/modules/HeadlessCms/fieldType/AssetFieldSettingsModifier.d.ts +26 -0
- package/modules/HeadlessCms/fieldType/AssetFieldSettingsModifier.js +39 -0
- package/modules/HeadlessCms/fieldType/AssetFieldSettingsModifier.js.map +1 -0
- package/modules/HeadlessCms/fieldType/AssetFieldType.d.ts +34 -0
- package/modules/HeadlessCms/fieldType/AssetFieldType.js +42 -0
- package/modules/HeadlessCms/fieldType/AssetFieldType.js.map +1 -0
- package/modules/HeadlessCms/fieldType/AssetFormFieldType.d.ts +21 -0
- package/modules/HeadlessCms/fieldType/AssetFormFieldType.js +42 -0
- package/modules/HeadlessCms/fieldType/AssetFormFieldType.js.map +1 -0
- package/modules/HeadlessCms/fieldType/AssetInputRenderer.d.ts +15 -0
- package/modules/HeadlessCms/fieldType/AssetInputRenderer.js +20 -0
- package/modules/HeadlessCms/fieldType/AssetInputRenderer.js.map +1 -0
- package/modules/HeadlessCms/fieldType/AssetInputsRenderer.d.ts +15 -0
- package/modules/HeadlessCms/fieldType/AssetInputsRenderer.js +20 -0
- package/modules/HeadlessCms/fieldType/AssetInputsRenderer.js.map +1 -0
- package/modules/HeadlessCms/fieldType/FileFieldType.d.ts +1 -0
- package/modules/HeadlessCms/fieldType/FileFieldType.js +1 -0
- package/modules/HeadlessCms/fieldType/FileFieldType.js.map +1 -1
- package/modules/HeadlessCms/fieldType/feature.js +10 -0
- package/modules/HeadlessCms/fieldType/feature.js.map +1 -1
- package/modules/HeadlessCms/fieldType/isAssetField.d.ts +2 -0
- package/modules/HeadlessCms/fieldType/isAssetField.js +4 -0
- package/modules/HeadlessCms/fieldType/isAssetField.js.map +1 -0
- package/package.json +28 -28
- package/presentation/FileActions/FileDetails/EditImage.d.ts +2 -0
- package/presentation/FileActions/FileDetails/EditImage.js +39 -0
- package/presentation/FileActions/FileDetails/EditImage.js.map +1 -0
- package/presentation/FileActions/index.js +8 -0
- package/presentation/FileActions/index.js.map +1 -1
- package/presentation/FileDetails/FileDetailsPresenter.d.ts +6 -3
- package/presentation/FileDetails/FileDetailsPresenter.js +51 -35
- package/presentation/FileDetails/FileDetailsPresenter.js.map +1 -1
- package/presentation/FileDetails/FileDetailsPresenter.test.js +90 -7
- package/presentation/FileDetails/FileDetailsPresenter.test.js.map +1 -1
- package/presentation/FileDetails/abstractions.d.ts +2 -0
- package/presentation/FileDetails/abstractions.js.map +1 -1
- package/presentation/FileDetails/components/Content.d.ts +2 -1
- package/presentation/FileDetails/components/Content.js +2 -2
- package/presentation/FileDetails/components/Content.js.map +1 -1
- package/presentation/FileDetails/components/FileDetailsDrawer.d.ts +2 -2
- package/presentation/FileDetails/components/FileDetailsDrawer.js +11 -5
- package/presentation/FileDetails/components/FileDetailsDrawer.js.map +1 -1
- package/presentation/FileList/FileListDataSource.js +34 -1
- package/presentation/FileList/FileListDataSource.js.map +1 -1
- package/presentation/FileList/FileListPresenter.test.js +30 -1
- package/presentation/FileList/FileListPresenter.test.js.map +1 -1
- package/presentation/FileList/FileManagerPresenter.d.ts +1 -0
- package/presentation/FileList/FileManagerPresenter.js +13 -4
- package/presentation/FileList/FileManagerPresenter.js.map +1 -1
- package/presentation/FileList/abstractions.d.ts +1 -0
- package/presentation/FileList/abstractions.js.map +1 -1
- package/presentation/FileList/components/BulkActions/BulkActionBar.d.ts +2 -2
- package/presentation/FileList/components/BulkActions/BulkActionDelete.d.ts +2 -2
- package/presentation/FileList/components/BulkActions/BulkActionMove.d.ts +2 -2
- package/presentation/FileList/components/Filters/SubFoldersToggle.d.ts +2 -2
- package/presentation/FileList/components/Filters/TagsFilter.d.ts +2 -2
- package/presentation/FileList/components/Filters/TypeFilter.d.ts +2 -2
- package/presentation/FileList/components/Grid/ActionButton.d.ts +1 -1
- package/presentation/FileList/components/Grid/ActionButton.js.map +1 -1
- package/presentation/FileList/components/Grid/File.d.ts +1 -1
- package/presentation/FileList/components/Grid/File.js.map +1 -1
- package/presentation/FileList/components/Grid/FileGrid.d.ts +2 -2
- package/presentation/FileList/components/Header/FileManagerHeader.d.ts +2 -2
- package/presentation/FileList/components/Search/SearchBar.d.ts +2 -2
- package/presentation/FileList/components/Table/FileTable.d.ts +2 -2
- package/presentation/FileList/components/Upload/UploadProgress.d.ts +2 -2
- package/presentation/FileManager/FileManagerBreadcrumbs.d.ts +12 -0
- package/presentation/FileManager/FileManagerBreadcrumbs.js +37 -0
- package/presentation/FileManager/FileManagerBreadcrumbs.js.map +1 -0
- package/presentation/FileManager/FileManagerView.js +40 -8
- package/presentation/FileManager/FileManagerView.js.map +1 -1
- package/presentation/Settings/SettingsPresenter.js +20 -9
- package/presentation/Settings/SettingsPresenter.js.map +1 -1
- package/presentation/Settings/SettingsPresenter.test.d.ts +1 -0
- package/presentation/Settings/SettingsPresenter.test.js +67 -0
- package/presentation/Settings/SettingsPresenter.test.js.map +1 -0
- package/presentation/Settings/components/SettingsView.d.ts +2 -2
- package/presentation/config/DefaultFileManagerConfig.js +12 -7
- package/presentation/config/DefaultFileManagerConfig.js.map +1 -1
- package/presentation/config/getThumbnailRenderer.js +1 -1
- package/presentation/config/getThumbnailRenderer.js.map +1 -1
- package/presentation/config/thumbnailRenderers/CroppedFileImage.d.ts +18 -0
- package/presentation/config/thumbnailRenderers/CroppedFileImage.js +66 -0
- package/presentation/config/thumbnailRenderers/CroppedFileImage.js.map +1 -0
- package/presentation/config/thumbnailRenderers/FilePreviewImageRenderer.js +6 -9
- package/presentation/config/thumbnailRenderers/FilePreviewImageRenderer.js.map +1 -1
- package/presentation/config/thumbnailRenderers/GridItemImageRenderer.js +6 -9
- package/presentation/config/thumbnailRenderers/GridItemImageRenderer.js.map +1 -1
- package/presentation/config/thumbnailRenderers/TableItemImageRenderer.js +6 -9
- package/presentation/config/thumbnailRenderers/TableItemImageRenderer.js.map +1 -1
- package/presentation/fieldRenderers/CmsAssetPickerRenderer.d.ts +22 -0
- package/presentation/fieldRenderers/CmsAssetPickerRenderer.js +56 -0
- package/presentation/fieldRenderers/CmsAssetPickerRenderer.js.map +1 -0
- package/presentation/fieldRenderers/CmsFilePickerRenderer.d.ts +1 -1
- package/presentation/fieldRenderers/CmsFilePickerRenderer.js +11 -4
- package/presentation/fieldRenderers/CmsFilePickerRenderer.js.map +1 -1
- package/presentation/fieldRenderers/CmsImageEditorDialog.d.ts +7 -0
- package/presentation/fieldRenderers/CmsImageEditorDialog.js +32 -0
- package/presentation/fieldRenderers/CmsImageEditorDialog.js.map +1 -0
- package/presentation/fieldRenderers/CmsMultiAssetPickerRenderer.d.ts +18 -0
- package/presentation/fieldRenderers/CmsMultiAssetPickerRenderer.js +88 -0
- package/presentation/fieldRenderers/CmsMultiAssetPickerRenderer.js.map +1 -0
- package/presentation/fieldRenderers/CmsMultiFilePickerRenderer.d.ts +1 -1
- package/presentation/fieldRenderers/CmsMultiFilePickerRenderer.js +11 -2
- package/presentation/fieldRenderers/CmsMultiFilePickerRenderer.js.map +1 -1
- package/presentation/fieldRenderers/CroppedAssetThumb.d.ts +15 -0
- package/presentation/fieldRenderers/CroppedAssetThumb.js +25 -0
- package/presentation/fieldRenderers/CroppedAssetThumb.js.map +1 -0
- package/presentation/fieldRenderers/assetValue.d.ts +10 -0
- package/presentation/fieldRenderers/assetValue.js +94 -0
- package/presentation/fieldRenderers/assetValue.js.map +1 -0
- package/presentation/fieldRenderers/assetValue.test.d.ts +1 -0
- package/presentation/fieldRenderers/assetValue.test.js +54 -0
- package/presentation/fieldRenderers/assetValue.test.js.map +1 -0
- package/presentation/hooks/useCmsImageEditor.d.ts +10 -0
- package/presentation/hooks/useCmsImageEditor.js +76 -0
- package/presentation/hooks/useCmsImageEditor.js.map +1 -0
- package/presentation/hooks/useEditImage.d.ts +14 -0
- package/presentation/hooks/useEditImage.js +67 -0
- package/presentation/hooks/useEditImage.js.map +1 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mirrors the server-sent event payloads emitted by the api-side `AiImageEnrichmentStreamRoute`
|
|
3
|
+
* (see `streamEvents.ts` in `@webiny/ai-powerups`). Duplicated rather than imported: the admin app
|
|
4
|
+
* must not depend on an api-side package. Keep the two in sync.
|
|
5
|
+
*/
|
|
6
|
+
export interface EnrichmentStreamStartEvent {
|
|
7
|
+
type: "start";
|
|
8
|
+
fileId: string;
|
|
9
|
+
model: string;
|
|
10
|
+
}
|
|
11
|
+
export interface EnrichmentStreamPartialEvent {
|
|
12
|
+
type: "partial";
|
|
13
|
+
tags: string[];
|
|
14
|
+
description: string;
|
|
15
|
+
}
|
|
16
|
+
export interface EnrichmentStreamDoneEvent {
|
|
17
|
+
type: "done";
|
|
18
|
+
fileId: string;
|
|
19
|
+
tags: string[];
|
|
20
|
+
description: string;
|
|
21
|
+
}
|
|
22
|
+
export interface EnrichmentStreamErrorEvent {
|
|
23
|
+
type: "error";
|
|
24
|
+
message: string;
|
|
25
|
+
}
|
|
26
|
+
export type EnrichmentStreamEvent = EnrichmentStreamStartEvent | EnrichmentStreamPartialEvent | EnrichmentStreamDoneEvent | EnrichmentStreamErrorEvent;
|
|
27
|
+
export interface IReenrichFileOptions {
|
|
28
|
+
signal?: AbortSignal;
|
|
29
|
+
}
|
|
30
|
+
export interface IReenrichFileGateway {
|
|
31
|
+
/**
|
|
32
|
+
* Re-runs AI enrichment for a file, yielding progress events as they arrive.
|
|
33
|
+
*
|
|
34
|
+
* Failures the server detects before streaming starts (unknown file, non-image, no provider,
|
|
35
|
+
* license) reject instead of yielding an `error` event — they come back as HTTP status codes.
|
|
36
|
+
*/
|
|
37
|
+
execute(fileId: string, options?: IReenrichFileOptions): AsyncGenerator<EnrichmentStreamEvent>;
|
|
38
|
+
}
|
|
39
|
+
export declare const ReenrichFileGateway: import("@webiny/di").Abstraction<IReenrichFileGateway>;
|
|
40
|
+
export declare namespace ReenrichFileGateway {
|
|
41
|
+
type Interface = IReenrichFileGateway;
|
|
42
|
+
type Event = EnrichmentStreamEvent;
|
|
43
|
+
}
|
|
44
|
+
export interface IReenrichWithAiViewModel {
|
|
45
|
+
open: boolean;
|
|
46
|
+
/** What the dialog says under its title: the error when there is one, else the status. */
|
|
47
|
+
message: string;
|
|
48
|
+
tags: string[];
|
|
49
|
+
description: string;
|
|
50
|
+
/** The proposal is complete, so it can be accepted. */
|
|
51
|
+
canSave: boolean;
|
|
52
|
+
/** The model is still producing output, so empty fields are pending rather than absent. */
|
|
53
|
+
loading: boolean;
|
|
54
|
+
}
|
|
55
|
+
export interface IReenrichWithAiPresenter {
|
|
56
|
+
readonly vm: IReenrichWithAiViewModel;
|
|
57
|
+
start(fileId: string): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Accept the proposal: drop the values into the file details form and close. Nothing is written
|
|
60
|
+
* — the user saves the file with Update, the same as for a hand-typed edit.
|
|
61
|
+
*/
|
|
62
|
+
accept(): void;
|
|
63
|
+
setOpen(open: boolean): void;
|
|
64
|
+
dispose(): void;
|
|
65
|
+
}
|
|
66
|
+
export declare const ReenrichWithAiPresenter: import("@webiny/di").Abstraction<IReenrichWithAiPresenter>;
|
|
67
|
+
export declare namespace ReenrichWithAiPresenter {
|
|
68
|
+
type Interface = IReenrichWithAiPresenter;
|
|
69
|
+
type ViewModel = IReenrichWithAiViewModel;
|
|
70
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/admin";
|
|
2
|
+
const ReenrichFileGateway = createAbstraction("ReenrichFileGateway");
|
|
3
|
+
const ReenrichWithAiPresenter = createAbstraction("FileManager/ReenrichWithAiPresenter");
|
|
4
|
+
export { ReenrichFileGateway, ReenrichWithAiPresenter };
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modules/AiEnrichment/abstractions.js","sources":["../../../src/modules/AiEnrichment/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\n\n/**\n * Mirrors the server-sent event payloads emitted by the api-side `AiImageEnrichmentStreamRoute`\n * (see `streamEvents.ts` in `@webiny/ai-powerups`). Duplicated rather than imported: the admin app\n * must not depend on an api-side package. Keep the two in sync.\n */\nexport interface EnrichmentStreamStartEvent {\n type: \"start\";\n fileId: string;\n model: string;\n}\n\nexport interface EnrichmentStreamPartialEvent {\n type: \"partial\";\n tags: string[];\n description: string;\n}\n\nexport interface EnrichmentStreamDoneEvent {\n type: \"done\";\n fileId: string;\n tags: string[];\n description: string;\n}\n\nexport interface EnrichmentStreamErrorEvent {\n type: \"error\";\n message: string;\n}\n\nexport type EnrichmentStreamEvent =\n | EnrichmentStreamStartEvent\n | EnrichmentStreamPartialEvent\n | EnrichmentStreamDoneEvent\n | EnrichmentStreamErrorEvent;\n\nexport interface IReenrichFileOptions {\n signal?: AbortSignal;\n}\n\nexport interface IReenrichFileGateway {\n /**\n * Re-runs AI enrichment for a file, yielding progress events as they arrive.\n *\n * Failures the server detects before streaming starts (unknown file, non-image, no provider,\n * license) reject instead of yielding an `error` event — they come back as HTTP status codes.\n */\n execute(fileId: string, options?: IReenrichFileOptions): AsyncGenerator<EnrichmentStreamEvent>;\n}\n\nexport const ReenrichFileGateway = createAbstraction<IReenrichFileGateway>(\"ReenrichFileGateway\");\n\nexport namespace ReenrichFileGateway {\n export type Interface = IReenrichFileGateway;\n export type Event = EnrichmentStreamEvent;\n}\n\nexport interface IReenrichWithAiViewModel {\n open: boolean;\n /** What the dialog says under its title: the error when there is one, else the status. */\n message: string;\n tags: string[];\n description: string;\n /** The proposal is complete, so it can be accepted. */\n canSave: boolean;\n /** The model is still producing output, so empty fields are pending rather than absent. */\n loading: boolean;\n}\n\nexport interface IReenrichWithAiPresenter {\n readonly vm: IReenrichWithAiViewModel;\n start(fileId: string): Promise<void>;\n /**\n * Accept the proposal: drop the values into the file details form and close. Nothing is written\n * — the user saves the file with Update, the same as for a hand-typed edit.\n */\n accept(): void;\n setOpen(open: boolean): void;\n dispose(): void;\n}\n\nexport const ReenrichWithAiPresenter = createAbstraction<IReenrichWithAiPresenter>(\n \"FileManager/ReenrichWithAiPresenter\"\n);\n\nexport namespace ReenrichWithAiPresenter {\n export type Interface = IReenrichWithAiPresenter;\n export type ViewModel = IReenrichWithAiViewModel;\n}\n"],"names":["ReenrichFileGateway","createAbstraction","ReenrichWithAiPresenter"],"mappings":";AAmDO,MAAMA,sBAAsBC,kBAAwC;AA+BpE,MAAMC,0BAA0BD,kBACnC"}
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import { createFeature } from "@webiny/feature/admin";
|
|
2
2
|
import { AiImageEnrichmentEventHandler } from "./AiImageEnrichmentEventHandler.js";
|
|
3
|
+
import { AiImageEnrichmentFailedEventHandler } from "./AiImageEnrichmentFailedEventHandler.js";
|
|
4
|
+
import { ReenrichFileGateway } from "./ReenrichFileGateway.js";
|
|
5
|
+
import { ReenrichWithAiPresenter } from "./ReenrichWithAiPresenter.js";
|
|
6
|
+
import { ReenrichWithAiPresenter as external_abstractions_js_ReenrichWithAiPresenter } from "./abstractions.js";
|
|
3
7
|
const AiEnrichmentFeature = createFeature({
|
|
4
8
|
name: "FileManager/AiEnrichment",
|
|
5
9
|
register (container) {
|
|
6
10
|
container.register(AiImageEnrichmentEventHandler);
|
|
11
|
+
container.register(AiImageEnrichmentFailedEventHandler);
|
|
12
|
+
container.register(ReenrichFileGateway).inSingletonScope();
|
|
13
|
+
container.register(ReenrichWithAiPresenter).inContainerScope();
|
|
14
|
+
},
|
|
15
|
+
resolve (container) {
|
|
16
|
+
return {
|
|
17
|
+
presenter: container.resolve(external_abstractions_js_ReenrichWithAiPresenter)
|
|
18
|
+
};
|
|
7
19
|
}
|
|
8
20
|
});
|
|
9
21
|
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":"
|
|
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 { AiImageEnrichmentFailedEventHandler } from \"./AiImageEnrichmentFailedEventHandler.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(AiImageEnrichmentFailedEventHandler);\n container.register(ReenrichFileGateway).inSingletonScope();\n // One per container, so the dialog's state survives re-renders of the view that reads it. Not\n // a singleton: the presenter reads FileDetailsPresenter, which only the File Manager view's\n // child container registers, and a container-scoped instance is built from that child.\n container.register(ReenrichWithAiPresenter).inContainerScope();\n },\n resolve(container) {\n return {\n presenter: container.resolve(PresenterAbstraction)\n };\n }\n});\n"],"names":["AiEnrichmentFeature","createFeature","container","AiImageEnrichmentEventHandler","AiImageEnrichmentFailedEventHandler","ReenrichFileGateway","ReenrichWithAiPresenter","PresenterAbstraction"],"mappings":";;;;;;AAOO,MAAMA,sBAAsBC,cAAc;IAC7C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG,qBAAqB,gBAAgB;QAIxDH,UAAU,QAAQ,CAACI,yBAAyB,gBAAgB;IAChE;IACA,SAAQJ,SAAS;QACb,OAAO;YACH,WAAWA,UAAU,OAAO,CAACK;QACjC;IACJ;AACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
25
|
-
if (!
|
|
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 {
|
|
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"}
|
|
@@ -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;
|
|
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":"
|
|
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 @@
|
|
|
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"}
|