@webiny/app-file-manager 6.4.5 → 6.6.0-alpha.0
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 +13 -2
- package/app.js.map +1 -1
- package/domain/tagsHelpers.d.ts +2 -2
- package/domain/types.d.ts +0 -8
- package/features/permissions/abstractions.d.ts +2 -2
- package/features/permissions/feature.d.ts +3 -3
- package/modules/AiEnrichment/AiImageEnrichmentEventHandler.d.ts +18 -0
- package/modules/AiEnrichment/AiImageEnrichmentEventHandler.js +33 -0
- package/modules/AiEnrichment/AiImageEnrichmentEventHandler.js.map +1 -0
- package/modules/AiEnrichment/feature.d.ts +1 -0
- package/modules/AiEnrichment/feature.js +11 -0
- package/modules/AiEnrichment/feature.js.map +1 -0
- package/modules/AiEnrichment/index.d.ts +2 -0
- package/modules/AiEnrichment/index.js +9 -0
- package/modules/AiEnrichment/index.js.map +1 -0
- package/modules/HeadlessCms/fieldType/FileFieldSettingsModifier.d.ts +16 -0
- package/modules/HeadlessCms/fieldType/FileFieldSettingsModifier.js +33 -0
- package/modules/HeadlessCms/fieldType/FileFieldSettingsModifier.js.map +1 -0
- package/modules/HeadlessCms/fieldType/FileFieldType.d.ts +24 -0
- package/modules/HeadlessCms/fieldType/FileFieldType.js +37 -0
- package/modules/HeadlessCms/fieldType/FileFieldType.js.map +1 -0
- package/modules/HeadlessCms/fieldType/FileInputRenderer.d.ts +15 -0
- package/modules/HeadlessCms/fieldType/FileInputRenderer.js +19 -0
- package/modules/HeadlessCms/fieldType/FileInputRenderer.js.map +1 -0
- package/modules/HeadlessCms/fieldType/FileInputsRenderer.d.ts +15 -0
- package/modules/HeadlessCms/fieldType/FileInputsRenderer.js +19 -0
- package/modules/HeadlessCms/fieldType/FileInputsRenderer.js.map +1 -0
- package/modules/HeadlessCms/fieldType/feature.d.ts +1 -0
- package/modules/HeadlessCms/fieldType/feature.js +17 -0
- package/modules/HeadlessCms/fieldType/feature.js.map +1 -0
- package/package.json +19 -29
- package/presentation/FileDetails/FileDetailsPresenter.test.js +1 -0
- package/presentation/FileDetails/FileDetailsPresenter.test.js.map +1 -1
- package/presentation/FileDetails/components/Content.d.ts +5 -4
- package/presentation/FileList/FileListDataSource.d.ts +8 -12
- package/presentation/FileList/FileListDataSource.js +15 -88
- package/presentation/FileList/FileListDataSource.js.map +1 -1
- package/presentation/FileList/FileListPresenter.test.js +7 -2
- package/presentation/FileList/FileListPresenter.test.js.map +1 -1
- package/presentation/FileList/FileManagerPresenter.d.ts +1 -0
- package/presentation/FileList/FileManagerPresenter.js +9 -1
- package/presentation/FileList/FileManagerPresenter.js.map +1 -1
- package/presentation/FileList/abstractions.d.ts +2 -0
- package/presentation/FileList/abstractions.js.map +1 -1
- package/presentation/FileList/components/BulkActions/index.d.ts +0 -1
- package/presentation/FileList/components/BulkActions/index.js +0 -1
- package/presentation/FileList/components/BulkActions/useBulkActionWorker.d.ts +9 -8
- package/presentation/FileList/components/BulkActions/useBulkActionWorker.js +3 -9
- package/presentation/FileList/components/BulkActions/useBulkActionWorker.js.map +1 -1
- package/presentation/FileList/components/Grid/FileGrid.js +1 -1
- package/presentation/FileList/components/Grid/FileGrid.js.map +1 -1
- package/presentation/FileList/components/Grid/FileGrid.test.js +18 -7
- package/presentation/FileList/components/Grid/FileGrid.test.js.map +1 -1
- package/presentation/FileList/components/Table/FileTable.js +1 -1
- package/presentation/FileList/components/Table/FileTable.js.map +1 -1
- package/presentation/FileList/components/Table/FileTable.test.js +9 -4
- package/presentation/FileList/components/Table/FileTable.test.js.map +1 -1
- package/presentation/FileManager/FileManagerView.js +8 -6
- package/presentation/FileManager/FileManagerView.js.map +1 -1
- package/presentation/FileManager/RouteParamsSync.d.ts +2 -0
- package/presentation/FileManager/RouteParamsSync.js +30 -0
- package/presentation/FileManager/RouteParamsSync.js.map +1 -0
- package/presentation/config/DefaultFileManagerConfig.js +1 -4
- package/presentation/config/DefaultFileManagerConfig.js.map +1 -1
- package/presentation/config/FileManagerViewConfig.d.ts +19 -25
- package/presentation/config/configComponents/Browser/BulkAction.d.ts +10 -8
- package/presentation/config/configComponents/Browser/BulkAction.js +3 -9
- package/presentation/config/configComponents/Browser/BulkAction.js.map +1 -1
- package/presentation/config/configComponents/Browser/FileAction.d.ts +2 -1
- package/presentation/config/configComponents/Browser/FolderAction.d.ts +2 -1
- package/presentation/config/configComponents/Browser/Table/Column.d.ts +9 -8
- package/presentation/config/configComponents/Browser/Table/index.d.ts +9 -9
- package/presentation/config/configComponents/Browser/index.d.ts +20 -20
- package/presentation/config/configComponents/Browser/index.js +0 -8
- package/presentation/config/configComponents/Browser/index.js.map +1 -1
- package/presentation/config/configComponents/FileDetails/index.d.ts +4 -2
- package/presentation/fieldRenderers/CmsFilePickerRenderer.d.ts +13 -0
- package/presentation/fieldRenderers/CmsFilePickerRenderer.js +29 -0
- package/presentation/fieldRenderers/CmsFilePickerRenderer.js.map +1 -0
- package/presentation/fieldRenderers/CmsMultiFilePickerRenderer.d.ts +13 -0
- package/presentation/fieldRenderers/CmsMultiFilePickerRenderer.js +51 -0
- package/presentation/fieldRenderers/CmsMultiFilePickerRenderer.js.map +1 -0
- package/routes.d.ts +1 -0
- package/routes.js +2 -1
- package/routes.js.map +1 -1
- package/modules/HeadlessCms/fileField.d.ts +0 -2
- package/modules/HeadlessCms/fileField.js +0 -44
- package/modules/HeadlessCms/fileField.js.map +0 -1
- package/modules/HeadlessCms/fileRenderer/fileField.d.ts +0 -2
- package/modules/HeadlessCms/fileRenderer/fileField.js +0 -53
- package/modules/HeadlessCms/fileRenderer/fileField.js.map +0 -1
- package/modules/HeadlessCms/fileRenderer/fileFields.d.ts +0 -2
- package/modules/HeadlessCms/fileRenderer/fileFields.js +0 -73
- package/modules/HeadlessCms/fileRenderer/fileFields.js.map +0 -1
- package/modules/HeadlessCms/fileRenderer/utils.d.ts +0 -2
- package/modules/HeadlessCms/fileRenderer/utils.js +0 -15
- package/modules/HeadlessCms/fileRenderer/utils.js.map +0 -1
- package/modules/HeadlessCms/index.d.ts +0 -1
- package/modules/HeadlessCms/index.js +0 -14
- package/modules/HeadlessCms/index.js.map +0 -1
- package/modules/Settings/graphql.d.ts +0 -12
- package/modules/Settings/graphql.js +0 -36
- package/modules/Settings/graphql.js.map +0 -1
- package/modules/Settings/views/FileManagerSettings.d.ts +0 -2
- package/modules/Settings/views/FileManagerSettings.js +0 -134
- package/modules/Settings/views/FileManagerSettings.js.map +0 -1
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/AddOperation.d.ts +0 -7
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/AddOperation.js +0 -15
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/AddOperation.js.map +0 -1
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditor.d.ts +0 -15
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditor.js +0 -44
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditor.js.map +0 -1
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialog.d.ts +0 -15
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialog.js +0 -52
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialog.js.map +0 -1
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialogPresenter.d.ts +0 -61
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialogPresenter.js +0 -111
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialogPresenter.js.map +0 -1
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialogPresenter.test.d.ts +0 -1
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialogPresenter.test.js +0 -372
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/BatchEditorDialogPresenter.test.js.map +0 -1
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/FieldRenderer.d.ts +0 -8
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/FieldRenderer.js +0 -31
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/FieldRenderer.js.map +0 -1
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/Operation.d.ts +0 -11
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/Operation.js +0 -33
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/Operation.js.map +0 -1
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/index.d.ts +0 -1
- package/presentation/FileList/components/BulkActions/BatchEditorDialog/index.js +0 -1
- package/presentation/FileList/components/BulkActions/BulkActionEdit.d.ts +0 -4
- package/presentation/FileList/components/BulkActions/BulkActionEdit.js +0 -105
- package/presentation/FileList/components/BulkActions/BulkActionEdit.js.map +0 -1
- package/presentation/config/configComponents/Browser/FolderFieldDecorator.d.ts +0 -7
- package/presentation/config/configComponents/Browser/FolderFieldDecorator.js +0 -11
- package/presentation/config/configComponents/Browser/FolderFieldDecorator.js.map +0 -1
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { AcoConfig, type FolderActionConfig } from "@webiny/app-aco";
|
|
3
3
|
export type { FolderActionConfig };
|
|
4
4
|
type FolderActionProps = React.ComponentProps<typeof AcoConfig.Folder.Action>;
|
|
5
|
-
|
|
5
|
+
declare const BaseFolderAction: (props: FolderActionProps) => React.JSX.Element;
|
|
6
|
+
export declare const FolderAction: typeof BaseFolderAction & {
|
|
6
7
|
OptionsMenuItem: (props: import("@webiny/app-admin/components").OptionsMenuItemProps) => React.JSX.Element;
|
|
7
8
|
};
|
|
@@ -3,28 +3,29 @@ import { AcoConfig, type TableColumnConfig as ColumnConfig } from "@webiny/app-a
|
|
|
3
3
|
import type { TableItem } from "../../../../../domain/types.js";
|
|
4
4
|
export type { ColumnConfig };
|
|
5
5
|
type ColumnProps = React.ComponentProps<typeof AcoConfig.Table.Column>;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
declare const BaseColumnComponent: (props: ColumnProps) => React.JSX.Element;
|
|
7
|
+
export declare const Column: typeof BaseColumnComponent & {
|
|
8
|
+
original: typeof BaseColumnComponent;
|
|
8
9
|
originalName: string;
|
|
9
10
|
displayName: string;
|
|
10
11
|
} & {
|
|
11
|
-
original:
|
|
12
|
-
original:
|
|
12
|
+
original: typeof BaseColumnComponent & {
|
|
13
|
+
original: typeof BaseColumnComponent;
|
|
13
14
|
originalName: string;
|
|
14
15
|
displayName: string;
|
|
15
16
|
};
|
|
16
17
|
originalName: string;
|
|
17
18
|
displayName: string;
|
|
18
19
|
} & {
|
|
19
|
-
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<
|
|
20
|
-
original:
|
|
20
|
+
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<typeof BaseColumnComponent & {
|
|
21
|
+
original: typeof BaseColumnComponent;
|
|
21
22
|
originalName: string;
|
|
22
23
|
displayName: string;
|
|
23
24
|
}>) => (props: unknown) => React.JSX.Element;
|
|
24
25
|
} & {
|
|
25
26
|
useTableRow: {
|
|
26
|
-
(): import("@webiny/app-
|
|
27
|
-
<TUserRow>(): import("@webiny/app-
|
|
27
|
+
(): import("@webiny/app-admin/components").TableRowContextData<TableItem>;
|
|
28
|
+
<TUserRow>(): import("@webiny/app-admin/components").TableRowContextData<TableItem & {
|
|
28
29
|
data: TUserRow;
|
|
29
30
|
}>;
|
|
30
31
|
};
|
|
@@ -5,32 +5,32 @@ export interface TableConfig {
|
|
|
5
5
|
cellThumbnails: ThumbnailConfig[];
|
|
6
6
|
}
|
|
7
7
|
export declare const Table: {
|
|
8
|
-
Column: ((props: import("@webiny/app-
|
|
9
|
-
original: (props: import("@webiny/app-
|
|
8
|
+
Column: ((props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
|
|
9
|
+
original: (props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
|
|
10
10
|
originalName: string;
|
|
11
11
|
displayName: string;
|
|
12
12
|
} & {
|
|
13
|
-
original: ((props: import("@webiny/app-
|
|
14
|
-
original: (props: import("@webiny/app-
|
|
13
|
+
original: ((props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
|
|
14
|
+
original: (props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
|
|
15
15
|
originalName: string;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
originalName: string;
|
|
19
19
|
displayName: string;
|
|
20
20
|
} & {
|
|
21
|
-
createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<((props: import("@webiny/app-
|
|
22
|
-
original: (props: import("@webiny/app-
|
|
21
|
+
createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<((props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
|
|
22
|
+
original: (props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
|
|
23
23
|
originalName: string;
|
|
24
24
|
displayName: string;
|
|
25
25
|
}>) => (props: unknown) => React.JSX.Element;
|
|
26
26
|
} & {
|
|
27
27
|
useTableRow: {
|
|
28
|
-
(): import("@webiny/app-
|
|
29
|
-
<TUserRow>(): import("@webiny/app-
|
|
28
|
+
(): import("@webiny/app-admin/index.js").TableRowContextData<import("../../../../../domain/types.js").TableItem>;
|
|
29
|
+
<TUserRow>(): import("@webiny/app-admin/index.js").TableRowContextData<import("../../../../../domain/types.js").TableItem & {
|
|
30
30
|
data: TUserRow;
|
|
31
31
|
}>;
|
|
32
32
|
};
|
|
33
|
-
isFolderRow: (row: import("@webiny/app-
|
|
33
|
+
isFolderRow: (row: import("@webiny/app-admin/index.js").TableRow) => row is import("@webiny/app-aco/table.types.js").FolderTableRow;
|
|
34
34
|
};
|
|
35
35
|
Cell: {
|
|
36
36
|
Thumbnail: (({ type, element }: import("./Thumbnail.js").RendererProps) => import("react").JSX.Element) & {
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { BulkActionConfig } from "./BulkAction.js";
|
|
2
2
|
import type { FilterConfig } from "./Filter.js";
|
|
3
3
|
import type { FiltersToWhereConverter } from "./FiltersToWhere.js";
|
|
4
|
+
import { FiltersToWhere } from "./FiltersToWhere.js";
|
|
5
|
+
import { FilterByTags } from "./FilterByTags.js";
|
|
4
6
|
import type { TableConfig } from "./Table/index.js";
|
|
5
7
|
import type { BulkEditFieldConfig } from "./BulkEditField.js";
|
|
8
|
+
import { BulkEditField } from "./BulkEditField.js";
|
|
6
9
|
import type { GridConfig } from "./Grid/index.js";
|
|
10
|
+
import { ActionButton } from "../../../../presentation/FileList/components/Grid/ActionButton.js";
|
|
11
|
+
import { FolderDropConfirmation } from "./FolderDropConfirmation.js";
|
|
7
12
|
import { RecordConfig } from "@webiny/app-aco/config/record";
|
|
8
13
|
export interface BrowserConfig {
|
|
9
14
|
bulkActions: BulkActionConfig[];
|
|
@@ -74,11 +79,11 @@ export declare const Browser: {
|
|
|
74
79
|
displayName: string;
|
|
75
80
|
}>) => (props: unknown) => React.JSX.Element;
|
|
76
81
|
} & {
|
|
77
|
-
IconButton:
|
|
82
|
+
IconButton: typeof ActionButton;
|
|
78
83
|
};
|
|
79
84
|
};
|
|
80
85
|
};
|
|
81
|
-
BulkAction:
|
|
86
|
+
BulkAction: typeof import("./BulkAction.js").BaseBulkAction & {
|
|
82
87
|
useButtons: () => import("@webiny/app-admin/components/Buttons/useButtons.js").ButtonsProviderContext;
|
|
83
88
|
useWorker: () => {
|
|
84
89
|
items: import("@webiny/sdk/index.js").FmFile[];
|
|
@@ -89,7 +94,7 @@ export declare const Browser: {
|
|
|
89
94
|
};
|
|
90
95
|
useDialog: () => import("@webiny/app-admin/index.js").UseDialogWithReportResponse;
|
|
91
96
|
};
|
|
92
|
-
BulkEditField:
|
|
97
|
+
BulkEditField: typeof BulkEditField;
|
|
93
98
|
Filter: (({ name, element, after, before, remove }: import("./Filter.js").FilterProps) => import("react").JSX.Element) & {
|
|
94
99
|
original: ({ name, element, after, before, remove }: import("./Filter.js").FilterProps) => import("react").JSX.Element;
|
|
95
100
|
originalName: string;
|
|
@@ -117,18 +122,13 @@ export declare const Browser: {
|
|
|
117
122
|
name: string;
|
|
118
123
|
}) => React.JSX.Element;
|
|
119
124
|
};
|
|
120
|
-
FiltersToWhere:
|
|
121
|
-
|
|
122
|
-
}) => import("react").JSX.Element;
|
|
123
|
-
FilterByTags: ({ remove }: import("./FilterByTags.js").FilterByTagProps) => import("react").JSX.Element;
|
|
125
|
+
FiltersToWhere: typeof FiltersToWhere;
|
|
126
|
+
FilterByTags: typeof FilterByTags;
|
|
124
127
|
Folder: {
|
|
125
|
-
ExtensionField: {
|
|
126
|
-
createDecorator: (decorator: import("@webiny/react-composition/types.js").Decorator<import("@webiny/react-composition/types.js").GenericComponent<import("@webiny/app-aco").FieldProps>>) => (props: import("@webiny/app-aco").FieldDecoratorProps) => React.JSX.Element;
|
|
127
|
-
};
|
|
128
128
|
Action: ((props: import("@webiny/app-aco/config/folder/Action.js").ActionProps) => import("react").JSX.Element) & {
|
|
129
129
|
OptionsMenuItem: (props: import("@webiny/app-admin/index.js").OptionsMenuItemProps) => React.JSX.Element;
|
|
130
130
|
};
|
|
131
|
-
DropConfirmation:
|
|
131
|
+
DropConfirmation: typeof FolderDropConfirmation;
|
|
132
132
|
};
|
|
133
133
|
File: {
|
|
134
134
|
Action: ((props: import("@webiny/app-aco/config/record/Action.js").ActionProps) => import("react").JSX.Element) & {
|
|
@@ -137,32 +137,32 @@ export declare const Browser: {
|
|
|
137
137
|
};
|
|
138
138
|
};
|
|
139
139
|
Table: {
|
|
140
|
-
Column: ((props: import("@webiny/app-
|
|
141
|
-
original: (props: import("@webiny/app-
|
|
140
|
+
Column: ((props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
|
|
141
|
+
original: (props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
|
|
142
142
|
originalName: string;
|
|
143
143
|
displayName: string;
|
|
144
144
|
} & {
|
|
145
|
-
original: ((props: import("@webiny/app-
|
|
146
|
-
original: (props: import("@webiny/app-
|
|
145
|
+
original: ((props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
|
|
146
|
+
original: (props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
|
|
147
147
|
originalName: string;
|
|
148
148
|
displayName: string;
|
|
149
149
|
};
|
|
150
150
|
originalName: string;
|
|
151
151
|
displayName: string;
|
|
152
152
|
} & {
|
|
153
|
-
createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<((props: import("@webiny/app-
|
|
154
|
-
original: (props: import("@webiny/app-
|
|
153
|
+
createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<((props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element) & {
|
|
154
|
+
original: (props: import("@webiny/app-admin/config/table/Column.js").ColumnProps) => import("react").JSX.Element;
|
|
155
155
|
originalName: string;
|
|
156
156
|
displayName: string;
|
|
157
157
|
}>) => (props: unknown) => React.JSX.Element;
|
|
158
158
|
} & {
|
|
159
159
|
useTableRow: {
|
|
160
|
-
(): import("@webiny/app-
|
|
161
|
-
<TUserRow>(): import("@webiny/app-
|
|
160
|
+
(): import("@webiny/app-admin/index.js").TableRowContextData<import("../../../../domain/types.js").TableItem>;
|
|
161
|
+
<TUserRow>(): import("@webiny/app-admin/index.js").TableRowContextData<import("../../../../domain/types.js").TableItem & {
|
|
162
162
|
data: TUserRow;
|
|
163
163
|
}>;
|
|
164
164
|
};
|
|
165
|
-
isFolderRow: (row: import("@webiny/app-
|
|
165
|
+
isFolderRow: (row: import("@webiny/app-admin/index.js").TableRow) => row is import("@webiny/app-aco/table.types.js").FolderTableRow;
|
|
166
166
|
};
|
|
167
167
|
Cell: {
|
|
168
168
|
Thumbnail: (({ type, element }: import("./Table/Thumbnail.js").RendererProps) => import("react").JSX.Element) & {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createFolderFieldDecoratorFactory } from "@webiny/app-aco";
|
|
2
1
|
import { BulkAction } from "./BulkAction.js";
|
|
3
2
|
import { Filter } from "./Filter.js";
|
|
4
3
|
import { FiltersToWhere } from "./FiltersToWhere.js";
|
|
@@ -11,7 +10,6 @@ import { Action } from "./Grid/Action.js";
|
|
|
11
10
|
import { Thumbnail } from "./Grid/Thumbnail.js";
|
|
12
11
|
import { ActionButton } from "../../../FileList/components/Grid/ActionButton.js";
|
|
13
12
|
import { File } from "../../../FileList/components/Grid/File.js";
|
|
14
|
-
import { shouldDecorateFolderField } from "./FolderFieldDecorator.js";
|
|
15
13
|
import { FolderDropConfirmation } from "./FolderDropConfirmation.js";
|
|
16
14
|
const Browser = {
|
|
17
15
|
Grid: {
|
|
@@ -28,12 +26,6 @@ const Browser = {
|
|
|
28
26
|
FiltersToWhere: FiltersToWhere,
|
|
29
27
|
FilterByTags: FilterByTags,
|
|
30
28
|
Folder: {
|
|
31
|
-
ExtensionField: {
|
|
32
|
-
createDecorator: createFolderFieldDecoratorFactory({
|
|
33
|
-
scope: "fm",
|
|
34
|
-
shouldDecorate: shouldDecorateFolderField
|
|
35
|
-
})
|
|
36
|
-
},
|
|
37
29
|
Action: FolderAction,
|
|
38
30
|
DropConfirmation: FolderDropConfirmation
|
|
39
31
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation/config/configComponents/Browser/index.js","sources":["../../../../../src/presentation/config/configComponents/Browser/index.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"presentation/config/configComponents/Browser/index.js","sources":["../../../../../src/presentation/config/configComponents/Browser/index.ts"],"sourcesContent":["import type { BulkActionConfig } from \"./BulkAction.js\";\nimport { BulkAction } from \"./BulkAction.js\";\nimport type { FilterConfig } from \"./Filter.js\";\nimport { Filter } from \"./Filter.js\";\nimport type { FiltersToWhereConverter } from \"./FiltersToWhere.js\";\nimport { FiltersToWhere } from \"./FiltersToWhere.js\";\nimport { FilterByTags } from \"./FilterByTags.js\";\nimport { FolderAction } from \"./FolderAction.js\";\nimport { FileAction } from \"./FileAction.js\";\nimport type { TableConfig } from \"./Table/index.js\";\nimport { Table } from \"./Table/index.js\";\nimport type { BulkEditFieldConfig } from \"./BulkEditField.js\";\nimport { BulkEditField } from \"./BulkEditField.js\";\nimport { Action } from \"./Grid/Action.js\";\nimport { Thumbnail } from \"./Grid/Thumbnail.js\";\nimport type { GridConfig } from \"./Grid/index.js\";\nimport { ActionButton } from \"~/presentation/FileList/components/Grid/ActionButton.js\";\nimport { File } from \"~/presentation/FileList/components/Grid/File.js\";\nimport { FolderDropConfirmation } from \"./FolderDropConfirmation.js\";\nimport { RecordConfig } from \"@webiny/app-aco/config/record\";\n\nexport interface BrowserConfig {\n bulkActions: BulkActionConfig[];\n bulkEditFields: BulkEditFieldConfig[];\n filters: FilterConfig[];\n filtersToWhere: FiltersToWhereConverter[];\n filterByTags: boolean;\n table: TableConfig;\n grid: GridConfig;\n file: RecordConfig;\n}\n\nexport const Browser = {\n Grid: {\n Item: Object.assign(File, {\n Thumbnail,\n Action: Object.assign(Action, { IconButton: ActionButton })\n })\n },\n BulkAction,\n BulkEditField,\n Filter,\n FiltersToWhere,\n FilterByTags,\n Folder: {\n Action: FolderAction,\n DropConfirmation: FolderDropConfirmation\n },\n File: {\n Action: FileAction\n },\n Table\n};\n"],"names":["Browser","Object","File","Thumbnail","Action","ActionButton","BulkAction","BulkEditField","Filter","FiltersToWhere","FilterByTags","FolderAction","FolderDropConfirmation","FileAction","Table"],"mappings":";;;;;;;;;;;;;AAgCO,MAAMA,UAAU;IACnB,MAAM;QACF,MAAMC,OAAO,MAAM,CAACC,MAAM;YACtBC,WAASA;YACT,QAAQF,OAAO,MAAM,CAACG,QAAQ;gBAAE,YAAYC;YAAa;QAC7D;IACJ;IACAC,YAAUA;IACVC,eAAaA;IACbC,QAAMA;IACNC,gBAAcA;IACdC,cAAYA;IACZ,QAAQ;QACJ,QAAQC;QACR,kBAAkBC;IACtB;IACA,MAAM;QACF,QAAQC;IACZ;IACAC,OAAKA;AACT"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { Width } from "./Width.js";
|
|
1
2
|
import type { ActionConfig } from "./Action.js";
|
|
3
|
+
import { ActionButton } from "../../../../presentation/FileDetails/components/ActionButton.js";
|
|
2
4
|
import type { ThumbnailConfig } from "./Thumbnail.js";
|
|
3
5
|
export interface FileDetailsConfig {
|
|
4
6
|
actions: ActionConfig[];
|
|
@@ -25,7 +27,7 @@ export declare const FileDetails: {
|
|
|
25
27
|
displayName: string;
|
|
26
28
|
}>) => (props: unknown) => React.JSX.Element;
|
|
27
29
|
} & {
|
|
28
|
-
Button:
|
|
30
|
+
Button: typeof ActionButton;
|
|
29
31
|
};
|
|
30
32
|
Preview: {
|
|
31
33
|
Thumbnail: (({ type, element }: import("./Thumbnail.js").RendererProps) => import("react").JSX.Element) & {
|
|
@@ -48,5 +50,5 @@ export declare const FileDetails: {
|
|
|
48
50
|
}>) => (props: unknown) => React.JSX.Element;
|
|
49
51
|
};
|
|
50
52
|
};
|
|
51
|
-
Width:
|
|
53
|
+
Width: typeof Width;
|
|
52
54
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { FileFieldSettings } from "@webiny/app-admin/features/formModel/fieldTypes/FileFieldType.js";
|
|
3
|
+
declare module "@webiny/app-admin/features/formModel/abstractions.js" {
|
|
4
|
+
interface IFieldRendererRegistry {
|
|
5
|
+
cmsFilePicker: {
|
|
6
|
+
fieldType: "file";
|
|
7
|
+
settings: FileFieldSettings;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare const CmsFilePickerRenderer: React.ComponentType<{
|
|
12
|
+
field: import("@webiny/app-admin/index").IFieldVM;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { createFieldRenderer } from "@webiny/app-admin/features/formModel/createFieldRenderer.js";
|
|
3
|
+
import { FileManager } from "@webiny/app-admin/base/ui/FileManager.js";
|
|
4
|
+
import { FilePicker } from "@webiny/admin-ui";
|
|
5
|
+
const CmsFilePickerRenderer = createFieldRenderer(({ field })=>{
|
|
6
|
+
const settings = field.rendererSettings;
|
|
7
|
+
return /*#__PURE__*/ react.createElement(FileManager, {
|
|
8
|
+
images: settings?.images,
|
|
9
|
+
accept: settings?.accept,
|
|
10
|
+
own: settings?.own,
|
|
11
|
+
scope: settings?.scope,
|
|
12
|
+
render: ({ showFileManager })=>/*#__PURE__*/ react.createElement(FilePicker, {
|
|
13
|
+
label: field.label,
|
|
14
|
+
description: field.description,
|
|
15
|
+
note: field.note,
|
|
16
|
+
hint: field.help,
|
|
17
|
+
type: "compact",
|
|
18
|
+
value: field.value,
|
|
19
|
+
validation: field.validation,
|
|
20
|
+
onSelectItem: ()=>showFileManager((file)=>{
|
|
21
|
+
field.onChange(file.src || "");
|
|
22
|
+
}),
|
|
23
|
+
onRemoveItem: ()=>field.onChange(null)
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
export { CmsFilePickerRenderer };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=CmsFilePickerRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/fieldRenderers/CmsFilePickerRenderer.js","sources":["../../../src/presentation/fieldRenderers/CmsFilePickerRenderer.tsx"],"sourcesContent":["import React from \"react\";\nimport { createFieldRenderer } from \"@webiny/app-admin/features/formModel/createFieldRenderer.js\";\nimport { FileManager } from \"@webiny/app-admin/base/ui/FileManager.js\";\nimport { FilePicker } from \"@webiny/admin-ui\";\nimport type { FileManagerFileItem } from \"@webiny/app-admin/base/ui/FileManager.js\";\nimport type { FileFieldSettings } from \"@webiny/app-admin/features/formModel/fieldTypes/FileFieldType.js\";\n\ndeclare module \"@webiny/app-admin/features/formModel/abstractions.js\" {\n interface IFieldRendererRegistry {\n cmsFilePicker: { fieldType: \"file\"; settings: FileFieldSettings };\n }\n}\n\nexport const CmsFilePickerRenderer = createFieldRenderer<\"cmsFilePicker\">(({ field }) => {\n const settings = field.rendererSettings as FileFieldSettings | undefined;\n\n return (\n <FileManager\n images={settings?.images}\n accept={settings?.accept}\n own={settings?.own}\n scope={settings?.scope}\n render={({ showFileManager }) => (\n <FilePicker\n label={field.label}\n description={field.description}\n note={field.note}\n hint={field.help}\n type=\"compact\"\n value={field.value as string | undefined}\n validation={field.validation}\n onSelectItem={() =>\n showFileManager((file: FileManagerFileItem) => {\n field.onChange(file.src || \"\");\n })\n }\n onRemoveItem={() => field.onChange(null)}\n />\n )}\n />\n );\n});\n"],"names":["CmsFilePickerRenderer","createFieldRenderer","field","settings","FileManager","showFileManager","FilePicker","file"],"mappings":";;;;AAaO,MAAMA,wBAAwBC,oBAAqC,CAAC,EAAEC,KAAK,EAAE;IAChF,MAAMC,WAAWD,MAAM,gBAAgB;IAEvC,OAAO,WAAP,GACI,oBAACE,aAAWA;QACR,QAAQD,UAAU;QAClB,QAAQA,UAAU;QAClB,KAAKA,UAAU;QACf,OAAOA,UAAU;QACjB,QAAQ,CAAC,EAAEE,eAAe,EAAE,iBACxB,oBAACC,YAAUA;gBACP,OAAOJ,MAAM,KAAK;gBAClB,aAAaA,MAAM,WAAW;gBAC9B,MAAMA,MAAM,IAAI;gBAChB,MAAMA,MAAM,IAAI;gBAChB,MAAK;gBACL,OAAOA,MAAM,KAAK;gBAClB,YAAYA,MAAM,UAAU;gBAC5B,cAAc,IACVG,gBAAgB,CAACE;wBACbL,MAAM,QAAQ,CAACK,KAAK,GAAG,IAAI;oBAC/B;gBAEJ,cAAc,IAAML,MAAM,QAAQ,CAAC;;;AAKvD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { FileFieldSettings } from "@webiny/app-admin/features/formModel/fieldTypes/FileFieldType.js";
|
|
3
|
+
declare module "@webiny/app-admin/features/formModel/abstractions.js" {
|
|
4
|
+
interface IFieldRendererRegistry {
|
|
5
|
+
cmsMultiFilePicker: {
|
|
6
|
+
fieldType: "file";
|
|
7
|
+
settings: FileFieldSettings;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare const CmsMultiFilePickerRenderer: React.ComponentType<{
|
|
12
|
+
field: import("@webiny/app-admin/index").IFieldVM;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { createFieldRenderer } from "@webiny/app-admin/features/formModel/createFieldRenderer.js";
|
|
3
|
+
import { FileManager } from "@webiny/app-admin/base/ui/FileManager.js";
|
|
4
|
+
import { MultiFilePicker } from "@webiny/admin-ui";
|
|
5
|
+
const CmsMultiFilePickerRenderer = createFieldRenderer(({ field })=>{
|
|
6
|
+
const value = field.value;
|
|
7
|
+
const settings = field.rendererSettings;
|
|
8
|
+
const currentValues = Array.isArray(value) ? value : [];
|
|
9
|
+
return /*#__PURE__*/ react.createElement(FileManager, {
|
|
10
|
+
multiple: true,
|
|
11
|
+
images: settings?.images,
|
|
12
|
+
accept: settings?.accept,
|
|
13
|
+
own: settings?.own,
|
|
14
|
+
scope: settings?.scope,
|
|
15
|
+
render: ({ showFileManager })=>{
|
|
16
|
+
const selectFiles = (replaceIndex = -1)=>{
|
|
17
|
+
showFileManager((files)=>{
|
|
18
|
+
const newSrcs = files.map((f)=>f.src || "");
|
|
19
|
+
if (-1 === replaceIndex) field.onChange([
|
|
20
|
+
...currentValues,
|
|
21
|
+
...newSrcs
|
|
22
|
+
]);
|
|
23
|
+
else field.onChange([
|
|
24
|
+
...currentValues.slice(0, replaceIndex),
|
|
25
|
+
...newSrcs,
|
|
26
|
+
...currentValues.slice(replaceIndex + 1)
|
|
27
|
+
]);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
return /*#__PURE__*/ react.createElement(MultiFilePicker, {
|
|
31
|
+
label: field.label,
|
|
32
|
+
description: field.description,
|
|
33
|
+
note: field.note,
|
|
34
|
+
hint: field.help,
|
|
35
|
+
values: currentValues,
|
|
36
|
+
type: "compact",
|
|
37
|
+
onSelectItem: ()=>selectFiles(),
|
|
38
|
+
onReplaceItem: (_, index)=>selectFiles(index),
|
|
39
|
+
onRemoveItem: (_, index)=>{
|
|
40
|
+
field.onChange([
|
|
41
|
+
...currentValues.slice(0, index),
|
|
42
|
+
...currentValues.slice(index + 1)
|
|
43
|
+
]);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
export { CmsMultiFilePickerRenderer };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=CmsMultiFilePickerRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/fieldRenderers/CmsMultiFilePickerRenderer.js","sources":["../../../src/presentation/fieldRenderers/CmsMultiFilePickerRenderer.tsx"],"sourcesContent":["import React from \"react\";\nimport { createFieldRenderer } from \"@webiny/app-admin/features/formModel/createFieldRenderer.js\";\nimport { FileManager } from \"@webiny/app-admin/base/ui/FileManager.js\";\nimport type { FileManagerFileItem } from \"@webiny/app-admin/base/ui/FileManager.js\";\nimport { MultiFilePicker } from \"@webiny/admin-ui\";\nimport type { FileFieldSettings } from \"@webiny/app-admin/features/formModel/fieldTypes/FileFieldType.js\";\n\ndeclare module \"@webiny/app-admin/features/formModel/abstractions.js\" {\n interface IFieldRendererRegistry {\n cmsMultiFilePicker: { fieldType: \"file\"; settings: FileFieldSettings };\n }\n}\n\nexport const CmsMultiFilePickerRenderer = createFieldRenderer<\"cmsMultiFilePicker\">(({ field }) => {\n const value = field.value as string[] | undefined;\n const settings = field.rendererSettings as FileFieldSettings | undefined;\n const currentValues = Array.isArray(value) ? value : [];\n\n return (\n <FileManager\n multiple\n images={settings?.images}\n accept={settings?.accept}\n own={settings?.own}\n scope={settings?.scope}\n render={({ showFileManager }) => {\n const selectFiles = (replaceIndex = -1) => {\n showFileManager((files: FileManagerFileItem[]) => {\n const newSrcs = files.map(f => f.src || \"\");\n if (replaceIndex === -1) {\n field.onChange([...currentValues, ...newSrcs]);\n } else {\n field.onChange([\n ...currentValues.slice(0, replaceIndex),\n ...newSrcs,\n ...currentValues.slice(replaceIndex + 1)\n ]);\n }\n });\n };\n\n return (\n <MultiFilePicker\n label={field.label}\n description={field.description}\n note={field.note}\n hint={field.help}\n values={currentValues}\n type=\"compact\"\n onSelectItem={() => selectFiles()}\n onReplaceItem={(_, index) => selectFiles(index)}\n onRemoveItem={(_, index) => {\n field.onChange([\n ...currentValues.slice(0, index),\n ...currentValues.slice(index + 1)\n ]);\n }}\n />\n );\n }}\n />\n );\n});\n"],"names":["CmsMultiFilePickerRenderer","createFieldRenderer","field","value","settings","currentValues","Array","FileManager","showFileManager","selectFiles","replaceIndex","files","newSrcs","f","MultiFilePicker","_","index"],"mappings":";;;;AAaO,MAAMA,6BAA6BC,oBAA0C,CAAC,EAAEC,KAAK,EAAE;IAC1F,MAAMC,QAAQD,MAAM,KAAK;IACzB,MAAME,WAAWF,MAAM,gBAAgB;IACvC,MAAMG,gBAAgBC,MAAM,OAAO,CAACH,SAASA,QAAQ,EAAE;IAEvD,OAAO,WAAP,GACI,oBAACI,aAAWA;QACR;QACA,QAAQH,UAAU;QAClB,QAAQA,UAAU;QAClB,KAAKA,UAAU;QACf,OAAOA,UAAU;QACjB,QAAQ,CAAC,EAAEI,eAAe,EAAE;YACxB,MAAMC,cAAc,CAACC,eAAe,EAAE;gBAClCF,gBAAgB,CAACG;oBACb,MAAMC,UAAUD,MAAM,GAAG,CAACE,CAAAA,IAAKA,EAAE,GAAG,IAAI;oBACxC,IAAIH,AAAiB,OAAjBA,cACAR,MAAM,QAAQ,CAAC;2BAAIG;2BAAkBO;qBAAQ;yBAE7CV,MAAM,QAAQ,CAAC;2BACRG,cAAc,KAAK,CAAC,GAAGK;2BACvBE;2BACAP,cAAc,KAAK,CAACK,eAAe;qBACzC;gBAET;YACJ;YAEA,OAAO,WAAP,GACI,oBAACI,iBAAeA;gBACZ,OAAOZ,MAAM,KAAK;gBAClB,aAAaA,MAAM,WAAW;gBAC9B,MAAMA,MAAM,IAAI;gBAChB,MAAMA,MAAM,IAAI;gBAChB,QAAQG;gBACR,MAAK;gBACL,cAAc,IAAMI;gBACpB,eAAe,CAACM,GAAGC,QAAUP,YAAYO;gBACzC,cAAc,CAACD,GAAGC;oBACdd,MAAM,QAAQ,CAAC;2BACRG,cAAc,KAAK,CAAC,GAAGW;2BACvBX,cAAc,KAAK,CAACW,QAAQ;qBAClC;gBACL;;QAGZ;;AAGZ"}
|
package/routes.d.ts
CHANGED
package/routes.js
CHANGED
package/routes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sources":["../src/routes.ts"],"sourcesContent":["import { Route } from \"@webiny/app-admin\";\n\nexport const Routes = {\n List: new Route({\n name: \"FileManager/List\",\n path: \"/file-manager\",\n params: zod => {\n return {\n folderId: zod.string().optional()\n };\n }\n }),\n Settings: new Route({\n name: \"FileManager/Settings\",\n path: \"/settings/file-manager/general\"\n })\n};\n"],"names":["Routes","Route","zod"],"mappings":";AAEO,MAAMA,SAAS;IAClB,MAAM,IAAIC,MAAM;QACZ,MAAM;QACN,MAAM;QACN,QAAQC,CAAAA,MACG;gBACH,UAAUA,IAAI,MAAM,GAAG,QAAQ;
|
|
1
|
+
{"version":3,"file":"routes.js","sources":["../src/routes.ts"],"sourcesContent":["import { Route } from \"@webiny/app-admin\";\n\nexport const Routes = {\n List: new Route({\n name: \"FileManager/List\",\n path: \"/file-manager\",\n params: zod => {\n return {\n folderId: zod.string().optional(),\n search: zod.string().optional()\n };\n }\n }),\n Settings: new Route({\n name: \"FileManager/Settings\",\n path: \"/settings/file-manager/general\"\n })\n};\n"],"names":["Routes","Route","zod"],"mappings":";AAEO,MAAMA,SAAS;IAClB,MAAM,IAAIC,MAAM;QACZ,MAAM;QACN,MAAM;QACN,QAAQC,CAAAA,MACG;gBACH,UAAUA,IAAI,MAAM,GAAG,QAAQ;gBAC/B,QAAQA,IAAI,MAAM,GAAG,QAAQ;YACjC;IAER;IACA,UAAU,IAAID,MAAM;QAChB,MAAM;QACN,MAAM;IACV;AACJ"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import react from "react";
|
|
2
|
-
import { ReactComponent } from "@webiny/icons/file_present.svg";
|
|
3
|
-
import { Grid, Switch } from "@webiny/admin-ui";
|
|
4
|
-
import { Bind } from "@webiny/form";
|
|
5
|
-
const fileField = {
|
|
6
|
-
type: "cms-editor-field-type",
|
|
7
|
-
name: "cms-editor-field-type-file",
|
|
8
|
-
field: {
|
|
9
|
-
type: "file",
|
|
10
|
-
label: "Files",
|
|
11
|
-
description: "Images, videos and other files.",
|
|
12
|
-
icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
|
|
13
|
-
validators: [
|
|
14
|
-
"required"
|
|
15
|
-
],
|
|
16
|
-
listValidators: [
|
|
17
|
-
"minLength",
|
|
18
|
-
"maxLength"
|
|
19
|
-
],
|
|
20
|
-
allowList: true,
|
|
21
|
-
allowPredefinedValues: false,
|
|
22
|
-
listLabel: "Use as a list of files or an image gallery",
|
|
23
|
-
createField () {
|
|
24
|
-
return {
|
|
25
|
-
type: this.type,
|
|
26
|
-
validation: [],
|
|
27
|
-
renderer: {
|
|
28
|
-
name: ""
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
renderSettings: ()=>/*#__PURE__*/ react.createElement(Grid, null, /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
33
|
-
span: 12
|
|
34
|
-
}, /*#__PURE__*/ react.createElement(Bind, {
|
|
35
|
-
name: "settings.imagesOnly"
|
|
36
|
-
}, /*#__PURE__*/ react.createElement(Switch, {
|
|
37
|
-
label: "Images only",
|
|
38
|
-
description: "Allow only images to be selected"
|
|
39
|
-
}))))
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
export { fileField };
|
|
43
|
-
|
|
44
|
-
//# sourceMappingURL=fileField.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modules/HeadlessCms/fileField.js","sources":["../../../src/modules/HeadlessCms/fileField.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as FileIcon } from \"@webiny/icons/file_present.svg\";\nimport type { CmsModelFieldTypePlugin } from \"@webiny/app-headless-cms/types.js\";\nimport { Grid, Switch } from \"@webiny/admin-ui\";\nimport { Bind } from \"@webiny/form\";\n\nexport const fileField: CmsModelFieldTypePlugin = {\n type: \"cms-editor-field-type\",\n name: \"cms-editor-field-type-file\",\n field: {\n type: \"file\",\n label: \"Files\",\n description: \"Images, videos and other files.\",\n icon: <FileIcon />,\n validators: [\"required\"],\n listValidators: [\"minLength\", \"maxLength\"],\n allowList: true,\n allowPredefinedValues: false,\n listLabel: \"Use as a list of files or an image gallery\",\n createField() {\n return {\n type: this.type,\n validation: [],\n renderer: {\n name: \"\"\n }\n };\n },\n renderSettings: () => {\n return (\n <Grid>\n <Grid.Column span={12}>\n <Bind name={\"settings.imagesOnly\"}>\n <Switch\n label={\"Images only\"}\n description={\"Allow only images to be selected\"}\n />\n </Bind>\n </Grid.Column>\n </Grid>\n );\n }\n }\n};\n"],"names":["fileField","FileIcon","Grid","Bind","Switch"],"mappings":";;;;AAMO,MAAMA,YAAqC;IAC9C,MAAM;IACN,MAAM;IACN,OAAO;QACH,MAAM;QACN,OAAO;QACP,aAAa;QACb,MAAM,WAAN,GAAM,oBAACC,gBAAQA;QACf,YAAY;YAAC;SAAW;QACxB,gBAAgB;YAAC;YAAa;SAAY;QAC1C,WAAW;QACX,uBAAuB;QACvB,WAAW;QACX;YACI,OAAO;gBACH,MAAM,IAAI,CAAC,IAAI;gBACf,YAAY,EAAE;gBACd,UAAU;oBACN,MAAM;gBACV;YACJ;QACJ;QACA,gBAAgB,IACL,WAAP,GACI,oBAACC,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;gBAAC,MAAM;6BACf,oBAACC,MAAIA;gBAAC,MAAM;6BACR,oBAACC,QAAMA;gBACH,OAAO;gBACP,aAAa;;IAOzC;AACJ"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import react from "react";
|
|
2
|
-
import { FileManager } from "@webiny/app-admin";
|
|
3
|
-
import { useFieldEffectiveRules, useModelField } from "@webiny/app-headless-cms-common";
|
|
4
|
-
import { FilePicker } from "@webiny/admin-ui";
|
|
5
|
-
import { getSupportedExtensionsLabelHint } from "./utils.js";
|
|
6
|
-
const FieldRenderer = ({ getBind })=>{
|
|
7
|
-
const { field } = useModelField();
|
|
8
|
-
const rules = useFieldEffectiveRules(field);
|
|
9
|
-
const disabled = !rules.canEdit || rules.disabled;
|
|
10
|
-
const Bind = getBind();
|
|
11
|
-
const imagesOnly = field.settings && field.settings.imagesOnly;
|
|
12
|
-
return /*#__PURE__*/ react.createElement(Bind, null, (bind)=>{
|
|
13
|
-
const { value, onChange, validation } = bind;
|
|
14
|
-
return /*#__PURE__*/ react.createElement(Bind.ValidationContainer, null, /*#__PURE__*/ react.createElement(FileManager, {
|
|
15
|
-
images: imagesOnly,
|
|
16
|
-
render: ({ showFileManager })=>/*#__PURE__*/ react.createElement(FilePicker, {
|
|
17
|
-
...bind,
|
|
18
|
-
disabled: disabled,
|
|
19
|
-
label: field.label,
|
|
20
|
-
validation: validation,
|
|
21
|
-
description: field.description,
|
|
22
|
-
hint: field.help,
|
|
23
|
-
note: getSupportedExtensionsLabelHint(imagesOnly),
|
|
24
|
-
value: value,
|
|
25
|
-
onSelectItem: ()=>{
|
|
26
|
-
showFileManager((file)=>onChange(file.src));
|
|
27
|
-
},
|
|
28
|
-
onRemoveItem: ()=>onChange(null),
|
|
29
|
-
placeholder: field.placeholder,
|
|
30
|
-
type: "compact",
|
|
31
|
-
"data-testid": `fr.input.filefield.${field.label}`
|
|
32
|
-
})
|
|
33
|
-
}));
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
const singleFile = {
|
|
37
|
-
type: "cms-editor-field-renderer",
|
|
38
|
-
name: "cms-editor-field-renderer-file",
|
|
39
|
-
renderer: {
|
|
40
|
-
rendererName: "file-input",
|
|
41
|
-
name: "File Input",
|
|
42
|
-
description: "Enables selecting a single file via File Manager.",
|
|
43
|
-
canUse ({ field }) {
|
|
44
|
-
return "file" === field.type && !field.list;
|
|
45
|
-
},
|
|
46
|
-
render (params) {
|
|
47
|
-
return /*#__PURE__*/ react.createElement(FieldRenderer, params);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
export { singleFile };
|
|
52
|
-
|
|
53
|
-
//# sourceMappingURL=fileField.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modules/HeadlessCms/fileRenderer/fileField.js","sources":["../../../../src/modules/HeadlessCms/fileRenderer/fileField.tsx"],"sourcesContent":["import React from \"react\";\nimport type {\n CmsModelFieldRendererPlugin,\n CmsModelFieldRendererProps\n} from \"@webiny/app-headless-cms/types.js\";\nimport { FileManager } from \"@webiny/app-admin\";\nimport { useFieldEffectiveRules, useModelField } from \"@webiny/app-headless-cms-common\";\nimport { FilePicker } from \"@webiny/admin-ui\";\nimport { getSupportedExtensionsLabelHint } from \"~/modules/HeadlessCms/fileRenderer/utils.js\";\n\nconst FieldRenderer = ({ getBind }: CmsModelFieldRendererProps) => {\n const { field } = useModelField();\n const rules = useFieldEffectiveRules(field);\n const disabled = !rules.canEdit || rules.disabled;\n const Bind = getBind();\n\n const imagesOnly = field.settings && field.settings.imagesOnly;\n\n return (\n <Bind>\n {bind => {\n const { value, onChange, validation } = bind;\n\n return (\n <Bind.ValidationContainer>\n <FileManager\n images={imagesOnly}\n render={({ showFileManager }) => {\n return (\n <FilePicker\n {...bind}\n disabled={disabled}\n label={field.label}\n validation={validation}\n description={field.description}\n hint={field.help}\n note={getSupportedExtensionsLabelHint(imagesOnly)}\n value={value}\n onSelectItem={() => {\n showFileManager(file => onChange(file.src));\n }}\n onRemoveItem={() => onChange(null)}\n placeholder={field.placeholder}\n type={\"compact\"}\n data-testid={`fr.input.filefield.${field.label}`}\n />\n );\n }}\n />\n </Bind.ValidationContainer>\n );\n }}\n </Bind>\n );\n};\n\nexport const singleFile: CmsModelFieldRendererPlugin = {\n type: \"cms-editor-field-renderer\",\n name: \"cms-editor-field-renderer-file\",\n renderer: {\n rendererName: \"file-input\",\n name: \"File Input\",\n description: \"Enables selecting a single file via File Manager.\",\n canUse({ field }) {\n return field.type === \"file\" && !field.list;\n },\n render(params) {\n return <FieldRenderer {...params} />;\n }\n }\n};\n"],"names":["FieldRenderer","getBind","field","useModelField","rules","useFieldEffectiveRules","disabled","Bind","imagesOnly","bind","value","onChange","validation","FileManager","showFileManager","FilePicker","getSupportedExtensionsLabelHint","file","singleFile","params"],"mappings":";;;;;AAUA,MAAMA,gBAAgB,CAAC,EAAEC,OAAO,EAA8B;IAC1D,MAAM,EAAEC,KAAK,EAAE,GAAGC;IAClB,MAAMC,QAAQC,uBAAuBH;IACrC,MAAMI,WAAW,CAACF,MAAM,OAAO,IAAIA,MAAM,QAAQ;IACjD,MAAMG,OAAON;IAEb,MAAMO,aAAaN,MAAM,QAAQ,IAAIA,MAAM,QAAQ,CAAC,UAAU;IAE9D,OAAO,WAAP,GACI,oBAACK,MAAAA,MACIE,CAAAA;QACG,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGH;QAExC,OAAO,WAAP,GACI,oBAACF,KAAK,mBAAmB,sBACrB,oBAACM,aAAWA;YACR,QAAQL;YACR,QAAQ,CAAC,EAAEM,eAAe,EAAE,GACjB,WAAP,GACI,oBAACC,YAAUA;oBACN,GAAGN,IAAI;oBACR,UAAUH;oBACV,OAAOJ,MAAM,KAAK;oBAClB,YAAYU;oBACZ,aAAaV,MAAM,WAAW;oBAC9B,MAAMA,MAAM,IAAI;oBAChB,MAAMc,gCAAgCR;oBACtC,OAAOE;oBACP,cAAc;wBACVI,gBAAgBG,CAAAA,OAAQN,SAASM,KAAK,GAAG;oBAC7C;oBACA,cAAc,IAAMN,SAAS;oBAC7B,aAAaT,MAAM,WAAW;oBAC9B,MAAM;oBACN,eAAa,CAAC,mBAAmB,EAAEA,MAAM,KAAK,EAAE;;;IAO5E;AAGZ;AAEO,MAAMgB,aAA0C;IACnD,MAAM;IACN,MAAM;IACN,UAAU;QACN,cAAc;QACd,MAAM;QACN,aAAa;QACb,QAAO,EAAEhB,KAAK,EAAE;YACZ,OAAOA,AAAe,WAAfA,MAAM,IAAI,IAAe,CAACA,MAAM,IAAI;QAC/C;QACA,QAAOiB,MAAM;YACT,OAAO,WAAP,GAAO,oBAACnB,eAAkBmB;QAC9B;IACJ;AACJ"}
|