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