@webiny/app-admin 0.0.0-unstable.d65ec29d44 → 0.0.0-unstable.df6d94b531
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/assets/icons/add-18px.svg +1 -1
- package/assets/icons/arrow_drop_down-24px.svg +1 -1
- package/assets/icons/filter-24px.svg +1 -1
- package/assets/icons/highlight-24px.svg +1 -1
- package/assets/icons/info.svg +1 -1
- package/assets/icons/insert_drive_file-24px.svg +1 -1
- package/assets/icons/insert_photo-24px.svg +1 -1
- package/assets/icons/label-24px.svg +1 -1
- package/assets/icons/round-account_circle-24px.svg +1 -1
- package/assets/icons/round-arrow_drop_down-24px.svg +1 -1
- package/assets/icons/round-help-24px.svg +1 -1
- package/assets/icons/round-settings-24px.svg +1 -1
- package/assets/icons/today-24px.svg +1 -1
- package/assets/icons/touch_app.svg +1 -1
- package/base/Base.js +6 -25
- package/base/Base.js.map +1 -1
- package/base/plugins/AddGraphQLQuerySelection.js +5 -1
- package/base/plugins/AddGraphQLQuerySelection.js.map +1 -1
- package/base/ui/FileManager.d.ts +67 -0
- package/base/ui/FileManager.js +61 -0
- package/base/ui/FileManager.js.map +1 -0
- package/components/AppInstaller/AppInstaller.js +2 -34
- package/components/AppInstaller/AppInstaller.js.map +1 -1
- package/components/AppInstaller/Sidebar.js +2 -12
- package/components/AppInstaller/Sidebar.js.map +1 -1
- package/components/AppInstaller/styled.d.ts +17 -5
- package/components/AppInstaller/useInstaller.d.ts +1 -7
- package/components/AppInstaller/useInstaller.js +16 -71
- package/components/AppInstaller/useInstaller.js.map +1 -1
- package/components/EmptyView.js +1 -1
- package/components/EmptyView.js.map +1 -1
- package/components/FileManager/BottomInfoBar/SupportedFileTypes.js +14 -0
- package/components/FileManager/BottomInfoBar/SupportedFileTypes.js.map +1 -1
- package/components/FileManager/BottomInfoBar/UploadStatus.js +9 -0
- package/components/FileManager/BottomInfoBar/UploadStatus.js.map +1 -1
- package/components/FileManager/BottomInfoBar.js +12 -0
- package/components/FileManager/BottomInfoBar.js.map +1 -1
- package/components/FileManager/DropFilesHere.js +12 -3
- package/components/FileManager/DropFilesHere.js.map +1 -1
- package/components/FileManager/File.js +18 -5
- package/components/FileManager/File.js.map +1 -1
- package/components/FileManager/FileDetails/Name.js +75 -45
- package/components/FileManager/FileDetails/Name.js.map +1 -1
- package/components/FileManager/FileDetails/Tags.js +138 -85
- package/components/FileManager/FileDetails/Tags.js.map +1 -1
- package/components/FileManager/FileDetails.js +161 -94
- package/components/FileManager/FileDetails.js.map +1 -1
- package/components/FileManager/FileManagerContext.js +45 -12
- package/components/FileManager/FileManagerContext.js.map +1 -1
- package/components/FileManager/FileManagerView.js +295 -185
- package/components/FileManager/FileManagerView.js.map +1 -1
- package/components/FileManager/LeftSidebar.js +29 -10
- package/components/FileManager/LeftSidebar.js.map +1 -1
- package/components/FileManager/NoPermissionView.js +13 -0
- package/components/FileManager/NoPermissionView.js.map +1 -1
- package/components/FileManager/NoResults.js +6 -0
- package/components/FileManager/NoResults.js.map +1 -1
- package/components/FileManager/getFileTypePlugin.js +15 -9
- package/components/FileManager/getFileTypePlugin.js.map +1 -1
- package/components/FileManager/getFileUploader.js +5 -0
- package/components/FileManager/getFileUploader.js.map +1 -1
- package/components/FileManager/graphql.js +14 -3
- package/components/FileManager/graphql.js.map +1 -1
- package/components/FileManager/outputFileSelectionError.js +14 -0
- package/components/FileManager/outputFileSelectionError.js.map +1 -1
- package/components/FileManager.js +43 -17
- package/components/FileManager.js.map +1 -1
- package/components/FloatingActionButton.js +2 -2
- package/components/FloatingActionButton.js.map +1 -1
- package/components/OverlayLayout/OverlayLayout.js +1 -1
- package/components/OverlayLayout/OverlayLayout.js.map +1 -1
- package/components/SearchUI.js +2 -2
- package/components/SearchUI.js.map +1 -1
- package/components/SingleImageUpload.d.ts +1 -1
- package/components/SingleImageUpload.js +2 -2
- package/components/SingleImageUpload.js.map +1 -1
- package/components/SplitView/SplitView.js +1 -0
- package/components/SplitView/SplitView.js.map +1 -1
- package/components/index.d.ts +1 -1
- package/components/index.js +1 -1
- package/components/index.js.map +1 -1
- package/index.d.ts +2 -3
- package/index.js +1 -13
- package/index.js.map +1 -1
- package/package.json +19 -29
- package/plugins/FileManagerFileTypePlugin.js +15 -0
- package/plugins/FileManagerFileTypePlugin.js.map +1 -1
- package/plugins/fileManager/fileDefault.js +6 -0
- package/plugins/fileManager/fileDefault.js.map +1 -1
- package/plugins/fileManager/fileImage/DeleteAction.js +40 -16
- package/plugins/fileManager/fileImage/DeleteAction.js.map +1 -1
- package/plugins/fileManager/fileImage/EditAction.js +58 -22
- package/plugins/fileManager/fileImage/EditAction.js.map +1 -1
- package/plugins/fileManager/fileImage/index.js +8 -0
- package/plugins/fileManager/fileImage/index.js.map +1 -1
- package/plugins/fileManager/index.js +2 -0
- package/plugins/fileManager/index.js.map +1 -1
- package/plugins/globalSearch/SearchBar.js +2 -2
- package/plugins/globalSearch/SearchBar.js.map +1 -1
- package/plugins/globalSearch/SearchBarDropdown.js +2 -2
- package/plugins/globalSearch/SearchBarDropdown.js.map +1 -1
- package/plugins/globalSearch/styled.d.ts +13 -4
- package/types.d.ts +23 -27
- package/types.js.map +1 -1
- package/ui/elements/form/FileManagerElement/EmptyStateElementRenderer.js +5 -5
- package/ui/elements/form/FileManagerElement/EmptyStateElementRenderer.js.map +1 -1
- package/ui/elements/form/FileManagerElement/FileManagerElementRenderer.js +1 -1
- package/ui/elements/form/FileManagerElement/FileManagerElementRenderer.js.map +1 -1
- package/ui/elements/form/FileManagerElement/styled.d.ts +23 -16
- package/ui/views/AdminView/components/Hamburger.js +2 -2
- package/ui/views/AdminView/components/Hamburger.js.map +1 -1
- package/ui/views/OverlayView/HeaderElement.js +1 -1
- package/ui/views/OverlayView/HeaderElement.js.map +1 -1
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"@webiny/app\";\nexport type { HigherOrderComponent, ProviderProps, ComposeProps } from \"@webiny/app\";\n// UI components\nexport * from \"./base/ui/Tags\";\nexport * from \"./base/ui/Menu\";\nexport * from \"./base/ui/Layout\";\nexport * from \"./base/ui/LocaleSelector\";\nexport type { LayoutProps } from \"./base/ui/Layout\";\nexport * from \"./base/ui/Navigation\";\nexport type { MenuItemsProps } from \"./base/ui/Navigation\";\nexport * from \"./base/ui/Brand\";\nexport * from \"./base/ui/Logo\";\nexport * from \"./base/ui/Search\";\nexport type { SearchOptionData, SearchOptionProps } from \"./base/ui/Search\";\nexport * from \"./base/ui/UserMenu\";\nexport type { UserMenuItemProps } from \"./base/ui/UserMenu\";\nexport * from \"./base/ui/LoginScreen\";\nexport * from \"./base/ui/CenteredView\";\nexport * from \"./base/ui/Dashboard\";\nexport * from \"./base/ui/NotFound\";\n\n// Base admin app\nexport { Admin } from \"./base/Admin\";\nexport type { AdminProps } from \"./base/Admin\";\nexport { useViewComposition } from \"./base/providers/ViewCompositionProvider\";\nexport type { ViewCompositionContext, ViewElement } from \"./base/providers/ViewCompositionProvider\";\n\n// Plugins\nexport * from \"./base/plugins/AddGraphQLQuerySelection\";\nexport * from \"./plugins/
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"@webiny/app\";\nexport type { HigherOrderComponent, ProviderProps, ComposeProps } from \"@webiny/app\";\n// UI components\nexport * from \"./base/ui/Tags\";\nexport * from \"./base/ui/Menu\";\nexport * from \"./base/ui/Layout\";\nexport * from \"./base/ui/LocaleSelector\";\nexport type { LayoutProps } from \"./base/ui/Layout\";\nexport * from \"./base/ui/Navigation\";\nexport type { MenuItemsProps } from \"./base/ui/Navigation\";\nexport * from \"./base/ui/Brand\";\nexport * from \"./base/ui/Logo\";\nexport * from \"./base/ui/Search\";\nexport type { SearchOptionData, SearchOptionProps } from \"./base/ui/Search\";\nexport * from \"./base/ui/UserMenu\";\nexport type { UserMenuItemProps } from \"./base/ui/UserMenu\";\nexport * from \"./base/ui/LoginScreen\";\nexport * from \"./base/ui/CenteredView\";\nexport * from \"./base/ui/Dashboard\";\nexport * from \"./base/ui/NotFound\";\n\n// Base admin app\nexport { Admin } from \"./base/Admin\";\nexport type { AdminProps } from \"./base/Admin\";\nexport { useViewComposition } from \"./base/providers/ViewCompositionProvider\";\nexport type { ViewCompositionContext, ViewElement } from \"./base/providers/ViewCompositionProvider\";\n\n// Plugins\nexport * from \"./base/plugins/AddGraphQLQuerySelection\";\nexport * from \"./plugins/PermissionRendererPlugin\";\n\n// Components\nexport { AppInstaller } from \"./components/AppInstaller\";\nexport { OverlayLayout, OverlayLayoutProps } from \"./components/OverlayLayout\";\nexport {\n default as SingleImageUpload,\n SingleImageUploadProps\n} from \"./components/SingleImageUpload\";\n\nexport { FileManager, FileManagerRenderer } from \"./base/ui/FileManager\";\nexport type {\n FileManagerProps,\n FileManagerRendererProps,\n FileManagerFileItem,\n FileManagerOnChange\n} from \"./base/ui/FileManager\";\n\n// Hooks\nexport * from \"./hooks/useSnackbar\";\nexport * from \"./hooks/useConfirmationDialog\";\nexport * from \"./hooks/useDialog\";\nexport { useWcp } from \"@webiny/app-wcp\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAGA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAEA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAEA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAEA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAEA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAGA;AAEA;AAIA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAGA;AACA;AACA;AAKA;AASA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-admin",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.df6d94b531",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"description": "A collection of plugins that together form a complete admin interface, customizable and extensible with Webiny apps and plugins.",
|
|
6
6
|
"repository": {
|
|
@@ -10,54 +10,44 @@
|
|
|
10
10
|
"author": "Pavel Denisjuk",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@apollo/react-common": "3.1.4",
|
|
14
13
|
"@apollo/react-components": "3.1.5",
|
|
15
14
|
"@apollo/react-hooks": "3.1.5",
|
|
16
15
|
"@babel/runtime": "7.20.13",
|
|
17
16
|
"@editorjs/editorjs": "2.26.5",
|
|
18
|
-
"@emotion/
|
|
19
|
-
"@emotion/styled": "10.
|
|
17
|
+
"@emotion/react": "11.10.6",
|
|
18
|
+
"@emotion/styled": "11.10.6",
|
|
19
|
+
"@material-design-icons/svg": "0.14.3",
|
|
20
20
|
"@svgr/webpack": "6.5.1",
|
|
21
21
|
"@types/mime": "2.0.3",
|
|
22
22
|
"@types/react": "17.0.39",
|
|
23
|
-
"@webiny/app": "0.0.0-unstable.
|
|
24
|
-
"@webiny/app-security": "0.0.0-unstable.
|
|
25
|
-
"@webiny/app-wcp": "0.0.0-unstable.
|
|
26
|
-
"@webiny/form": "0.0.0-unstable.
|
|
27
|
-
"@webiny/plugins": "0.0.0-unstable.
|
|
28
|
-
"@webiny/react-composition": "0.0.0-unstable.
|
|
29
|
-
"@webiny/react-router": "0.0.0-unstable.
|
|
30
|
-
"@webiny/telemetry": "0.0.0-unstable.
|
|
31
|
-
"@webiny/ui": "0.0.0-unstable.
|
|
32
|
-
"@webiny/ui-composer": "0.0.0-unstable.
|
|
33
|
-
"@webiny/validation": "0.0.0-unstable.
|
|
23
|
+
"@webiny/app": "0.0.0-unstable.df6d94b531",
|
|
24
|
+
"@webiny/app-security": "0.0.0-unstable.df6d94b531",
|
|
25
|
+
"@webiny/app-wcp": "0.0.0-unstable.df6d94b531",
|
|
26
|
+
"@webiny/form": "0.0.0-unstable.df6d94b531",
|
|
27
|
+
"@webiny/plugins": "0.0.0-unstable.df6d94b531",
|
|
28
|
+
"@webiny/react-composition": "0.0.0-unstable.df6d94b531",
|
|
29
|
+
"@webiny/react-router": "0.0.0-unstable.df6d94b531",
|
|
30
|
+
"@webiny/telemetry": "0.0.0-unstable.df6d94b531",
|
|
31
|
+
"@webiny/ui": "0.0.0-unstable.df6d94b531",
|
|
32
|
+
"@webiny/ui-composer": "0.0.0-unstable.df6d94b531",
|
|
33
|
+
"@webiny/validation": "0.0.0-unstable.df6d94b531",
|
|
34
34
|
"apollo-cache": "1.3.5",
|
|
35
35
|
"apollo-client": "2.6.10",
|
|
36
36
|
"apollo-link": "1.2.14",
|
|
37
37
|
"apollo-utilities": "1.3.4",
|
|
38
|
-
"bytes": "3.1.2",
|
|
39
38
|
"classnames": "2.3.2",
|
|
40
|
-
"dataurl-to-blob": "0.0.1",
|
|
41
|
-
"dayjs": "1.11.7",
|
|
42
39
|
"dot-prop-immutable": "2.1.1",
|
|
43
40
|
"downshift": "3.4.8",
|
|
44
41
|
"emotion": "10.0.27",
|
|
45
42
|
"graphlib": "2.1.8",
|
|
46
43
|
"graphql": "15.8.0",
|
|
47
|
-
"graphql-tag": "2.12.6",
|
|
48
|
-
"invariant": "2.2.4",
|
|
49
44
|
"lodash": "4.17.21",
|
|
50
|
-
"mime": "2.6.0",
|
|
51
|
-
"minimatch": "5.1.6",
|
|
52
45
|
"nanoid": "3.3.4",
|
|
53
46
|
"prop-types": "15.8.1",
|
|
54
47
|
"react": "17.0.2",
|
|
55
|
-
"react-butterfiles": "1.3.3",
|
|
56
48
|
"react-dom": "17.0.2",
|
|
57
49
|
"react-hotkeyz": "1.0.4",
|
|
58
|
-
"react-lazy-load": "3.1.14",
|
|
59
50
|
"react-transition-group": "4.4.5",
|
|
60
|
-
"semver": "7.3.8",
|
|
61
51
|
"store": "2.0.12"
|
|
62
52
|
},
|
|
63
53
|
"devDependencies": {
|
|
@@ -70,8 +60,8 @@
|
|
|
70
60
|
"@types/bytes": "^3.1.1",
|
|
71
61
|
"@types/graphlib": "^2.1.8",
|
|
72
62
|
"@types/store": "^2.0.2",
|
|
73
|
-
"@webiny/cli": "^0.0.0-unstable.
|
|
74
|
-
"@webiny/project-utils": "^0.0.0-unstable.
|
|
63
|
+
"@webiny/cli": "^0.0.0-unstable.df6d94b531",
|
|
64
|
+
"@webiny/project-utils": "^0.0.0-unstable.df6d94b531",
|
|
75
65
|
"babel-plugin-emotion": "^9.2.8",
|
|
76
66
|
"babel-plugin-lodash": "^3.3.4",
|
|
77
67
|
"rimraf": "^3.0.2",
|
|
@@ -90,7 +80,7 @@
|
|
|
90
80
|
"ignore": {
|
|
91
81
|
"dependencies": [
|
|
92
82
|
"@svgr/webpack",
|
|
93
|
-
"@emotion/
|
|
83
|
+
"@emotion/react",
|
|
94
84
|
"@types/mime"
|
|
95
85
|
],
|
|
96
86
|
"peerDependencies": [
|
|
@@ -98,5 +88,5 @@
|
|
|
98
88
|
]
|
|
99
89
|
}
|
|
100
90
|
},
|
|
101
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "df6d94b531ed0453caef22c785d42be580c9df96"
|
|
102
92
|
}
|
|
@@ -1,28 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.FileManagerFileTypePlugin = void 0;
|
|
9
|
+
|
|
8
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
9
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
10
14
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
+
|
|
11
16
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
12
18
|
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
19
|
+
|
|
13
20
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
+
|
|
14
22
|
var _plugins = require("@webiny/plugins");
|
|
23
|
+
|
|
15
24
|
var FileManagerFileTypePlugin = /*#__PURE__*/function (_Plugin) {
|
|
16
25
|
(0, _inherits2.default)(FileManagerFileTypePlugin, _Plugin);
|
|
26
|
+
|
|
17
27
|
var _super = (0, _createSuper2.default)(FileManagerFileTypePlugin);
|
|
28
|
+
|
|
18
29
|
function FileManagerFileTypePlugin(config) {
|
|
19
30
|
var _this;
|
|
31
|
+
|
|
20
32
|
(0, _classCallCheck2.default)(this, FileManagerFileTypePlugin);
|
|
21
33
|
_this = _super.call(this);
|
|
22
34
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "config", void 0);
|
|
23
35
|
_this.config = config || {};
|
|
24
36
|
return _this;
|
|
25
37
|
}
|
|
38
|
+
|
|
26
39
|
(0, _createClass2.default)(FileManagerFileTypePlugin, [{
|
|
27
40
|
key: "types",
|
|
28
41
|
get: function get() {
|
|
@@ -39,10 +52,12 @@ var FileManagerFileTypePlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
39
52
|
if (!this.config.render) {
|
|
40
53
|
return null;
|
|
41
54
|
}
|
|
55
|
+
|
|
42
56
|
return this.config.render(params);
|
|
43
57
|
}
|
|
44
58
|
}]);
|
|
45
59
|
return FileManagerFileTypePlugin;
|
|
46
60
|
}(_plugins.Plugin);
|
|
61
|
+
|
|
47
62
|
exports.FileManagerFileTypePlugin = FileManagerFileTypePlugin;
|
|
48
63
|
(0, _defineProperty2.default)(FileManagerFileTypePlugin, "type", "admin-file-manager-file-type");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FileManagerFileTypePlugin","config","types","actions","params","render","Plugin"],"sources":["FileManagerFileTypePlugin.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins\";\n\ninterface File {\n id: string;\n name: string;\n key: string;\n src: string;\n size: number;\n type: string;\n tags: string[];\n createdOn: string;\n createdBy: {\n id: string;\n };\n [key: string]: any;\n}\n\nexport interface RenderParams {\n file: File;\n}\n\ninterface Config {\n types: string[];\n actions?: React.ComponentType<any>[];\n render(params: RenderParams): React.ReactNode;\n}\n\nexport class FileManagerFileTypePlugin extends Plugin {\n public static override readonly type: string = \"admin-file-manager-file-type\";\n private readonly config: Partial<Config>;\n\n public constructor(config?: Config) {\n super();\n this.config = config || {};\n }\n\n get types(): string[] {\n return this.config.types || [];\n }\n\n get actions(): React.ComponentType[] {\n return this.config.actions || [];\n }\n\n public render(params: RenderParams): React.ReactNode {\n if (!this.config.render) {\n return null;\n }\n return this.config.render(params);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["FileManagerFileTypePlugin","config","types","actions","params","render","Plugin"],"sources":["FileManagerFileTypePlugin.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins\";\n\ninterface File {\n id: string;\n name: string;\n key: string;\n src: string;\n size: number;\n type: string;\n tags: string[];\n createdOn: string;\n createdBy: {\n id: string;\n };\n [key: string]: any;\n}\n\nexport interface RenderParams {\n file: File;\n}\n\ninterface Config {\n types: string[];\n actions?: React.ComponentType<any>[];\n render(params: RenderParams): React.ReactNode;\n}\n\nexport class FileManagerFileTypePlugin extends Plugin {\n public static override readonly type: string = \"admin-file-manager-file-type\";\n private readonly config: Partial<Config>;\n\n public constructor(config?: Config) {\n super();\n this.config = config || {};\n }\n\n get types(): string[] {\n return this.config.types || [];\n }\n\n get actions(): React.ComponentType[] {\n return this.config.actions || [];\n }\n\n public render(params: RenderParams): React.ReactNode {\n if (!this.config.render) {\n return null;\n }\n return this.config.render(params);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA;;IA2BaA,yB;;;;;EAIT,mCAAmBC,MAAnB,EAAoC;IAAA;;IAAA;IAChC;IADgC;IAEhC,MAAKA,MAAL,GAAcA,MAAM,IAAI,EAAxB;IAFgC;EAGnC;;;;SAED,eAAsB;MAClB,OAAO,KAAKA,MAAL,CAAYC,KAAZ,IAAqB,EAA5B;IACH;;;SAED,eAAqC;MACjC,OAAO,KAAKD,MAAL,CAAYE,OAAZ,IAAuB,EAA9B;IACH;;;WAED,gBAAcC,MAAd,EAAqD;MACjD,IAAI,CAAC,KAAKH,MAAL,CAAYI,MAAjB,EAAyB;QACrB,OAAO,IAAP;MACH;;MACD,OAAO,KAAKJ,MAAL,CAAYI,MAAZ,CAAmBD,MAAnB,CAAP;IACH;;;EAtB0CE,e;;;8BAAlCN,yB,UACsC,8B"}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.defaultFileTypePlugin = void 0;
|
|
9
|
+
|
|
8
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
var _roundDescription24px = require("./icons/round-description-24px.svg");
|
|
13
|
+
|
|
10
14
|
var _emotion = require("emotion");
|
|
15
|
+
|
|
11
16
|
var _FileManagerFileTypePlugin = require("../FileManagerFileTypePlugin");
|
|
17
|
+
|
|
12
18
|
var style = {
|
|
13
19
|
centering: /*#__PURE__*/(0, _emotion.css)({
|
|
14
20
|
display: "flex",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["style","centering","css","display","justifyContent","alignItems","height","defaultFileTypePlugin","FileManagerFileTypePlugin","types","render"],"sources":["fileDefault.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { ReactComponent as FileIcon } from \"./icons/round-description-24px.svg\";\nimport { css } from \"emotion\";\nimport { FileManagerFileTypePlugin } from \"~/plugins/FileManagerFileTypePlugin\";\n\nconst style = {\n centering: css({\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n height: 200\n })\n};\n\nexport const defaultFileTypePlugin = new FileManagerFileTypePlugin({\n types: [\"*/*\"],\n render(): React.ReactNode {\n return (\n <div className={style.centering}>\n <FileIcon />\n </div>\n );\n }\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["style","centering","css","display","justifyContent","alignItems","height","defaultFileTypePlugin","FileManagerFileTypePlugin","types","render"],"sources":["fileDefault.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { ReactComponent as FileIcon } from \"./icons/round-description-24px.svg\";\nimport { css } from \"emotion\";\nimport { FileManagerFileTypePlugin } from \"~/plugins/FileManagerFileTypePlugin\";\n\nconst style = {\n centering: css({\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n height: 200\n })\n};\n\nexport const defaultFileTypePlugin = new FileManagerFileTypePlugin({\n types: [\"*/*\"],\n render(): React.ReactNode {\n return (\n <div className={style.centering}>\n <FileIcon />\n </div>\n );\n }\n});\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA,IAAMA,KAAK,GAAG;EACVC,SAAS,eAAE,IAAAC,YAAA,EAAI;IACXC,OAAO,EAAE,MADE;IAEXC,cAAc,EAAE,QAFL;IAGXC,UAAU,EAAE,QAHD;IAIXC,MAAM,EAAE;EAJG,CAAJ;AADD,CAAd;AASO,IAAMC,qBAAqB,GAAG,IAAIC,oDAAJ,CAA8B;EAC/DC,KAAK,EAAE,CAAC,KAAD,CADwD;EAE/DC,MAF+D,oBAErC;IACtB,oBACI;MAAK,SAAS,EAAEV,KAAK,CAACC;IAAtB,gBACI,oBAAC,oCAAD,OADJ,CADJ;EAKH;AAR8D,CAA9B,CAA9B"}
|
|
@@ -1,35 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
9
|
+
|
|
8
10
|
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
11
|
+
|
|
9
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
10
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
+
|
|
11
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
+
|
|
12
18
|
var _react = _interopRequireDefault(require("react"));
|
|
19
|
+
|
|
13
20
|
var _Tooltip = require("@webiny/ui/Tooltip");
|
|
21
|
+
|
|
14
22
|
var _Button = require("@webiny/ui/Button");
|
|
23
|
+
|
|
15
24
|
var _useSnackbar2 = require("../../../hooks/useSnackbar");
|
|
25
|
+
|
|
16
26
|
var _reactHooks = require("@apollo/react-hooks");
|
|
27
|
+
|
|
17
28
|
var _i18n = require("@webiny/app/i18n");
|
|
29
|
+
|
|
18
30
|
var _delete = require("../../../components/FileManager/icons/delete.svg");
|
|
31
|
+
|
|
19
32
|
var _graphql = require("../../../components/FileManager/graphql");
|
|
33
|
+
|
|
20
34
|
var _templateObject;
|
|
35
|
+
|
|
21
36
|
var t = _i18n.i18n.ns("app-admin/file-manager/files/delete-action");
|
|
37
|
+
|
|
22
38
|
var DeleteAction = function DeleteAction(props) {
|
|
23
39
|
var file = props.file;
|
|
40
|
+
|
|
24
41
|
var _useSnackbar = (0, _useSnackbar2.useSnackbar)(),
|
|
25
|
-
|
|
42
|
+
showSnackbar = _useSnackbar.showSnackbar;
|
|
43
|
+
|
|
26
44
|
var _useMutation = (0, _reactHooks.useMutation)(_graphql.DELETE_FILE, {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
45
|
+
variables: {
|
|
46
|
+
id: file.id
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
_useMutation2 = (0, _slicedToArray2.default)(_useMutation, 1),
|
|
50
|
+
deleteFile = _useMutation2[0];
|
|
51
|
+
|
|
33
52
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
34
53
|
content: /*#__PURE__*/_react.default.createElement("span", null, "Edit image"),
|
|
35
54
|
placement: "bottom"
|
|
@@ -41,19 +60,24 @@ var DeleteAction = function DeleteAction(props) {
|
|
|
41
60
|
}),
|
|
42
61
|
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
|
43
62
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
44
|
-
while (1)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
63
|
+
while (1) {
|
|
64
|
+
switch (_context.prev = _context.next) {
|
|
65
|
+
case 0:
|
|
66
|
+
_context.next = 2;
|
|
67
|
+
return deleteFile();
|
|
68
|
+
|
|
69
|
+
case 2:
|
|
70
|
+
showSnackbar(t(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["File deleted."]))));
|
|
71
|
+
|
|
72
|
+
case 3:
|
|
73
|
+
case "end":
|
|
74
|
+
return _context.stop();
|
|
75
|
+
}
|
|
53
76
|
}
|
|
54
77
|
}, _callee);
|
|
55
78
|
}))
|
|
56
79
|
})));
|
|
57
80
|
};
|
|
81
|
+
|
|
58
82
|
var _default = DeleteAction;
|
|
59
83
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["t","i18n","ns","DeleteAction","props","file","useSnackbar","showSnackbar","useMutation","DELETE_FILE","variables","id","deleteFile","margin"],"sources":["DeleteAction.tsx"],"sourcesContent":["import React from \"react\";\nimport { Tooltip } from \"@webiny/ui/Tooltip\";\nimport { IconButton } from \"@webiny/ui/Button\";\nimport { useSnackbar } from \"~/hooks/useSnackbar\";\nimport { useMutation } from \"@apollo/react-hooks\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { FileManagerFileItem } from \"~/components/FileManager\";\nconst t = i18n.ns(\"app-admin/file-manager/files/delete-action\");\n\nimport { ReactComponent as DeleteIcon } from \"../../../components/FileManager/icons/delete.svg\";\nimport { DELETE_FILE } from \"~/components/FileManager/graphql\";\n\ninterface DeleteActionProps {\n file: FileManagerFileItem;\n}\nconst DeleteAction: React.FC<DeleteActionProps> = props => {\n const { file } = props;\n const { showSnackbar } = useSnackbar();\n const [deleteFile] = useMutation(DELETE_FILE, {\n variables: {\n id: file.id\n }\n });\n\n return (\n <>\n <Tooltip content={<span>Edit image</span>} placement={\"bottom\"}>\n <IconButton\n icon={<DeleteIcon style={{ margin: \"0 8px 0 0\" }} />}\n onClick={async () => {\n await deleteFile();\n showSnackbar(t`File deleted.`);\n }}\n />\n </Tooltip>\n </>\n );\n};\n\nexport default DeleteAction;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["t","i18n","ns","DeleteAction","props","file","useSnackbar","showSnackbar","useMutation","DELETE_FILE","variables","id","deleteFile","margin"],"sources":["DeleteAction.tsx"],"sourcesContent":["import React from \"react\";\nimport { Tooltip } from \"@webiny/ui/Tooltip\";\nimport { IconButton } from \"@webiny/ui/Button\";\nimport { useSnackbar } from \"~/hooks/useSnackbar\";\nimport { useMutation } from \"@apollo/react-hooks\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { FileManagerFileItem } from \"~/components/FileManager\";\nconst t = i18n.ns(\"app-admin/file-manager/files/delete-action\");\n\nimport { ReactComponent as DeleteIcon } from \"../../../components/FileManager/icons/delete.svg\";\nimport { DELETE_FILE } from \"~/components/FileManager/graphql\";\n\ninterface DeleteActionProps {\n file: FileManagerFileItem;\n}\nconst DeleteAction: React.FC<DeleteActionProps> = props => {\n const { file } = props;\n const { showSnackbar } = useSnackbar();\n const [deleteFile] = useMutation(DELETE_FILE, {\n variables: {\n id: file.id\n }\n });\n\n return (\n <>\n <Tooltip content={<span>Edit image</span>} placement={\"bottom\"}>\n <IconButton\n icon={<DeleteIcon style={{ margin: \"0 8px 0 0\" }} />}\n onClick={async () => {\n await deleteFile();\n showSnackbar(t`File deleted.`);\n }}\n />\n </Tooltip>\n </>\n );\n};\n\nexport default DeleteAction;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;;;AAHA,IAAMA,CAAC,GAAGC,UAAA,CAAKC,EAAL,CAAQ,4CAAR,CAAV;;AAQA,IAAMC,YAAyC,GAAG,SAA5CA,YAA4C,CAAAC,KAAK,EAAI;EACvD,IAAQC,IAAR,GAAiBD,KAAjB,CAAQC,IAAR;;EACA,mBAAyB,IAAAC,yBAAA,GAAzB;EAAA,IAAQC,YAAR,gBAAQA,YAAR;;EACA,mBAAqB,IAAAC,uBAAA,EAAYC,oBAAZ,EAAyB;IAC1CC,SAAS,EAAE;MACPC,EAAE,EAAEN,IAAI,CAACM;IADF;EAD+B,CAAzB,CAArB;EAAA;EAAA,IAAOC,UAAP;;EAMA,oBACI,yEACI,6BAAC,gBAAD;IAAS,OAAO,eAAE,2CAAM,YAAN,CAAlB;IAA2C,SAAS,EAAE;EAAtD,gBACI,6BAAC,kBAAD;IACI,IAAI,eAAE,6BAAC,sBAAD;MAAY,KAAK,EAAE;QAAEC,MAAM,EAAE;MAAV;IAAnB,EADV;IAEI,OAAO,sGAAE;MAAA;QAAA;UAAA;YAAA;cAAA;cAAA,OACCD,UAAU,EADX;;YAAA;cAELL,YAAY,CAACP,CAAD,iGAAZ;;YAFK;YAAA;cAAA;UAAA;QAAA;MAAA;IAAA,CAAF;EAFX,EADJ,CADJ,CADJ;AAaH,CAtBD;;eAwBeG,Y"}
|
|
@@ -1,24 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
|
|
4
5
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
10
|
exports.default = void 0;
|
|
11
|
+
|
|
9
12
|
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
13
|
+
|
|
10
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
+
|
|
11
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
+
|
|
12
18
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
19
|
+
|
|
13
20
|
var React = _interopRequireWildcard(require("react"));
|
|
21
|
+
|
|
14
22
|
var _reactHotkeyz = require("react-hotkeyz");
|
|
23
|
+
|
|
15
24
|
var _dataurlToBlob = _interopRequireDefault(require("dataurl-to-blob"));
|
|
25
|
+
|
|
16
26
|
var _ImageUpload = require("@webiny/ui/ImageUpload");
|
|
27
|
+
|
|
17
28
|
var _Tooltip = require("@webiny/ui/Tooltip");
|
|
29
|
+
|
|
18
30
|
var _Button = require("@webiny/ui/Button");
|
|
31
|
+
|
|
19
32
|
var _outputFileSelectionError = require("../../../components/FileManager/outputFileSelectionError");
|
|
33
|
+
|
|
20
34
|
var _useSnackbar2 = require("../../../hooks/useSnackbar");
|
|
35
|
+
|
|
21
36
|
var _edit = require("../icons/edit.svg");
|
|
37
|
+
|
|
22
38
|
/**
|
|
23
39
|
* Package react-hotkeyz has no types.
|
|
24
40
|
*/
|
|
@@ -28,55 +44,68 @@ var _edit = require("../icons/edit.svg");
|
|
|
28
44
|
* Package dataurl-to-blob has no types.
|
|
29
45
|
*/
|
|
30
46
|
// @ts-ignore
|
|
31
|
-
|
|
32
47
|
function toDataUrl(url) {
|
|
33
48
|
return new Promise(function (resolve) {
|
|
34
49
|
var xhr = new window.XMLHttpRequest();
|
|
50
|
+
|
|
35
51
|
xhr.onload = function () {
|
|
36
52
|
var reader = new window.FileReader();
|
|
53
|
+
|
|
37
54
|
reader.onloadend = function () {
|
|
38
55
|
resolve(reader.result);
|
|
39
56
|
};
|
|
57
|
+
|
|
40
58
|
reader.readAsDataURL(xhr.response);
|
|
41
59
|
};
|
|
60
|
+
|
|
42
61
|
xhr.open("GET", url);
|
|
43
62
|
xhr.responseType = "blob";
|
|
44
63
|
xhr.send();
|
|
45
64
|
});
|
|
46
65
|
}
|
|
66
|
+
|
|
47
67
|
var initialState = {
|
|
48
68
|
showImageEditor: false,
|
|
49
69
|
dataUrl: null
|
|
50
70
|
};
|
|
71
|
+
|
|
51
72
|
var reducer = function reducer(state, action) {
|
|
52
73
|
var next = (0, _objectSpread2.default)({}, state);
|
|
74
|
+
|
|
53
75
|
switch (action.type) {
|
|
54
76
|
case "setDataUrl":
|
|
55
77
|
next.dataUrl = action.dataUrl;
|
|
56
78
|
next.showImageEditor = true;
|
|
57
79
|
break;
|
|
80
|
+
|
|
58
81
|
case "hideImageEditor":
|
|
59
82
|
next.dataUrl = null;
|
|
60
83
|
next.showImageEditor = false;
|
|
61
84
|
break;
|
|
62
85
|
}
|
|
86
|
+
|
|
63
87
|
return next;
|
|
64
88
|
};
|
|
89
|
+
|
|
65
90
|
var EditAction = function EditAction(props) {
|
|
66
91
|
var file = props.file,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
92
|
+
uploadFile = props.uploadFile,
|
|
93
|
+
validateFiles = props.validateFiles,
|
|
94
|
+
canEdit = props.canEdit;
|
|
95
|
+
|
|
70
96
|
var _React$useReducer = React.useReducer(reducer, initialState),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
97
|
+
_React$useReducer2 = (0, _slicedToArray2.default)(_React$useReducer, 2),
|
|
98
|
+
state = _React$useReducer2[0],
|
|
99
|
+
dispatch = _React$useReducer2[1];
|
|
100
|
+
|
|
74
101
|
var _useSnackbar = (0, _useSnackbar2.useSnackbar)(),
|
|
75
|
-
|
|
76
|
-
|
|
102
|
+
showSnackbar = _useSnackbar.showSnackbar; // Render nothing if the user don't have required permission for "edit".
|
|
103
|
+
|
|
104
|
+
|
|
77
105
|
if (!canEdit(file)) {
|
|
78
106
|
return null;
|
|
79
107
|
}
|
|
108
|
+
|
|
80
109
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Tooltip.Tooltip, {
|
|
81
110
|
content: /*#__PURE__*/React.createElement("span", null, "Edit image"),
|
|
82
111
|
placement: "bottom"
|
|
@@ -90,19 +119,23 @@ var EditAction = function EditAction(props) {
|
|
|
90
119
|
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
|
91
120
|
var dataUrl;
|
|
92
121
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
93
|
-
while (1)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
122
|
+
while (1) {
|
|
123
|
+
switch (_context.prev = _context.next) {
|
|
124
|
+
case 0:
|
|
125
|
+
_context.next = 2;
|
|
126
|
+
return toDataUrl(file.src);
|
|
127
|
+
|
|
128
|
+
case 2:
|
|
129
|
+
dataUrl = _context.sent;
|
|
130
|
+
dispatch({
|
|
131
|
+
type: "setDataUrl",
|
|
132
|
+
dataUrl: dataUrl
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
case 4:
|
|
136
|
+
case "end":
|
|
137
|
+
return _context.stop();
|
|
138
|
+
}
|
|
106
139
|
}
|
|
107
140
|
}, _callee);
|
|
108
141
|
}))
|
|
@@ -122,6 +155,7 @@ var EditAction = function EditAction(props) {
|
|
|
122
155
|
onAccept: function onAccept(src) {
|
|
123
156
|
var blob = (0, _dataurlToBlob.default)(src);
|
|
124
157
|
var errors = validateFiles([blob]);
|
|
158
|
+
|
|
125
159
|
if (errors.length) {
|
|
126
160
|
/**
|
|
127
161
|
* TODO @ts-refactor
|
|
@@ -133,11 +167,13 @@ var EditAction = function EditAction(props) {
|
|
|
133
167
|
blob.name = file.name;
|
|
134
168
|
uploadFile(blob);
|
|
135
169
|
}
|
|
170
|
+
|
|
136
171
|
dispatch({
|
|
137
172
|
type: "hideImageEditor"
|
|
138
173
|
});
|
|
139
174
|
}
|
|
140
175
|
})));
|
|
141
176
|
};
|
|
177
|
+
|
|
142
178
|
var _default = EditAction;
|
|
143
179
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["toDataUrl","url","Promise","resolve","xhr","window","XMLHttpRequest","onload","reader","FileReader","onloadend","result","readAsDataURL","response","open","responseType","send","initialState","showImageEditor","dataUrl","reducer","state","action","next","type","EditAction","props","file","uploadFile","validateFiles","canEdit","React","useReducer","dispatch","useSnackbar","showSnackbar","margin","src","blob","dataURLtoBlob","errors","length","outputFileSelectionError","name"],"sources":["EditAction.tsx"],"sourcesContent":["import * as React from \"react\";\n/**\n * Package react-hotkeyz has no types.\n */\n// @ts-ignore\nimport { Hotkeys } from \"react-hotkeyz\";\n/**\n * Package dataurl-to-blob has no types.\n */\n// @ts-ignore\nimport dataURLtoBlob from \"dataurl-to-blob\";\nimport { ImageEditorDialog } from \"@webiny/ui/ImageUpload\";\nimport { Tooltip } from \"@webiny/ui/Tooltip\";\nimport { IconButton } from \"@webiny/ui/Button\";\nimport { outputFileSelectionError } from \"~/components/FileManager/outputFileSelectionError\";\nimport { useSnackbar } from \"~/hooks/useSnackbar\";\nimport { ReactComponent as EditIcon } from \"../icons/edit.svg\";\nimport { FileItem } from \"~/components/FileManager/types\";\n\nfunction toDataUrl(url: string): Promise<string> {\n return new Promise((resolve: (value: string) => void) => {\n const xhr = new window.XMLHttpRequest();\n xhr.onload = function () {\n const reader = new window.FileReader();\n reader.onloadend = function () {\n resolve(reader.result as string);\n };\n reader.readAsDataURL(xhr.response);\n };\n xhr.open(\"GET\", url);\n xhr.responseType = \"blob\";\n xhr.send();\n });\n}\ninterface State {\n showImageEditor: boolean;\n dataUrl: string | null;\n}\ninterface Action {\n type: \"setDataUrl\" | \"hideImageEditor\";\n dataUrl?: string | null;\n}\nconst initialState: State = {\n showImageEditor: false,\n dataUrl: null\n};\nconst reducer = (state: State, action: Action): State => {\n const next: State = { ...state };\n\n switch (action.type) {\n case \"setDataUrl\":\n next.dataUrl = action.dataUrl as string;\n next.showImageEditor = true;\n break;\n case \"hideImageEditor\":\n next.dataUrl = null;\n next.showImageEditor = false;\n break;\n }\n\n return next;\n};\n\ninterface EditActionProps {\n file: FileItem;\n uploadFile: (file: FileItem) => void;\n validateFiles: (blobs: any[]) => Error[];\n canEdit: (file: FileItem) => boolean;\n}\n\nconst EditAction: React.FC<EditActionProps> = props => {\n const { file, uploadFile, validateFiles, canEdit } = props;\n const [state, dispatch] = React.useReducer(reducer, initialState);\n const { showSnackbar } = useSnackbar();\n // Render nothing if the user don't have required permission for \"edit\".\n if (!canEdit(file)) {\n return null;\n }\n\n return (\n <>\n <Tooltip content={<span>Edit image</span>} placement={\"bottom\"}>\n <IconButton\n data-testid={\"fm-edit-image-button\"}\n icon={<EditIcon style={{ margin: \"0 8px 0 0\" }} />}\n onClick={async () => {\n const dataUrl = await toDataUrl(file.src);\n dispatch({ type: \"setDataUrl\", dataUrl });\n }}\n />\n </Tooltip>\n <Hotkeys zIndex={60} disabled={!state.dataUrl}>\n <ImageEditorDialog\n data-testid={\"fm-image-editor-dialog\"}\n dialogZIndex={100}\n open={state.showImageEditor}\n src={state.dataUrl as string}\n onClose={() => dispatch({ type: \"hideImageEditor\" })}\n onAccept={src => {\n const blob = dataURLtoBlob(src);\n const errors = validateFiles([blob]);\n\n if (errors.length) {\n /**\n * TODO @ts-refactor\n * Figure out if incoming errors var is wrong or the one in the outputFileSelectionError\n */\n // @ts-ignore\n showSnackbar(outputFileSelectionError(errors));\n } else {\n blob.name = file.name;\n uploadFile(blob);\n }\n\n dispatch({ type: \"hideImageEditor\" });\n }}\n />\n </Hotkeys>\n </>\n );\n};\n\nexport default EditAction;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["toDataUrl","url","Promise","resolve","xhr","window","XMLHttpRequest","onload","reader","FileReader","onloadend","result","readAsDataURL","response","open","responseType","send","initialState","showImageEditor","dataUrl","reducer","state","action","next","type","EditAction","props","file","uploadFile","validateFiles","canEdit","React","useReducer","dispatch","useSnackbar","showSnackbar","margin","src","blob","dataURLtoBlob","errors","length","outputFileSelectionError","name"],"sources":["EditAction.tsx"],"sourcesContent":["import * as React from \"react\";\n/**\n * Package react-hotkeyz has no types.\n */\n// @ts-ignore\nimport { Hotkeys } from \"react-hotkeyz\";\n/**\n * Package dataurl-to-blob has no types.\n */\n// @ts-ignore\nimport dataURLtoBlob from \"dataurl-to-blob\";\nimport { ImageEditorDialog } from \"@webiny/ui/ImageUpload\";\nimport { Tooltip } from \"@webiny/ui/Tooltip\";\nimport { IconButton } from \"@webiny/ui/Button\";\nimport { outputFileSelectionError } from \"~/components/FileManager/outputFileSelectionError\";\nimport { useSnackbar } from \"~/hooks/useSnackbar\";\nimport { ReactComponent as EditIcon } from \"../icons/edit.svg\";\nimport { FileItem } from \"~/components/FileManager/types\";\n\nfunction toDataUrl(url: string): Promise<string> {\n return new Promise((resolve: (value: string) => void) => {\n const xhr = new window.XMLHttpRequest();\n xhr.onload = function () {\n const reader = new window.FileReader();\n reader.onloadend = function () {\n resolve(reader.result as string);\n };\n reader.readAsDataURL(xhr.response);\n };\n xhr.open(\"GET\", url);\n xhr.responseType = \"blob\";\n xhr.send();\n });\n}\ninterface State {\n showImageEditor: boolean;\n dataUrl: string | null;\n}\ninterface Action {\n type: \"setDataUrl\" | \"hideImageEditor\";\n dataUrl?: string | null;\n}\nconst initialState: State = {\n showImageEditor: false,\n dataUrl: null\n};\nconst reducer = (state: State, action: Action): State => {\n const next: State = { ...state };\n\n switch (action.type) {\n case \"setDataUrl\":\n next.dataUrl = action.dataUrl as string;\n next.showImageEditor = true;\n break;\n case \"hideImageEditor\":\n next.dataUrl = null;\n next.showImageEditor = false;\n break;\n }\n\n return next;\n};\n\ninterface EditActionProps {\n file: FileItem;\n uploadFile: (file: FileItem) => void;\n validateFiles: (blobs: any[]) => Error[];\n canEdit: (file: FileItem) => boolean;\n}\n\nconst EditAction: React.FC<EditActionProps> = props => {\n const { file, uploadFile, validateFiles, canEdit } = props;\n const [state, dispatch] = React.useReducer(reducer, initialState);\n const { showSnackbar } = useSnackbar();\n // Render nothing if the user don't have required permission for \"edit\".\n if (!canEdit(file)) {\n return null;\n }\n\n return (\n <>\n <Tooltip content={<span>Edit image</span>} placement={\"bottom\"}>\n <IconButton\n data-testid={\"fm-edit-image-button\"}\n icon={<EditIcon style={{ margin: \"0 8px 0 0\" }} />}\n onClick={async () => {\n const dataUrl = await toDataUrl(file.src);\n dispatch({ type: \"setDataUrl\", dataUrl });\n }}\n />\n </Tooltip>\n <Hotkeys zIndex={60} disabled={!state.dataUrl}>\n <ImageEditorDialog\n data-testid={\"fm-image-editor-dialog\"}\n dialogZIndex={100}\n open={state.showImageEditor}\n src={state.dataUrl as string}\n onClose={() => dispatch({ type: \"hideImageEditor\" })}\n onAccept={src => {\n const blob = dataURLtoBlob(src);\n const errors = validateFiles([blob]);\n\n if (errors.length) {\n /**\n * TODO @ts-refactor\n * Figure out if incoming errors var is wrong or the one in the outputFileSelectionError\n */\n // @ts-ignore\n showSnackbar(outputFileSelectionError(errors));\n } else {\n blob.name = file.name;\n uploadFile(blob);\n }\n\n dispatch({ type: \"hideImageEditor\" });\n }}\n />\n </Hotkeys>\n </>\n );\n};\n\nexport default EditAction;\n"],"mappings":"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"}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
4
5
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
10
|
exports.imageFileTypePlugin = void 0;
|
|
11
|
+
|
|
9
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
|
|
10
14
|
var _emotion = require("emotion");
|
|
15
|
+
|
|
11
16
|
var _components = require("@webiny/app/components");
|
|
17
|
+
|
|
12
18
|
var _EditAction = _interopRequireDefault(require("./EditAction"));
|
|
19
|
+
|
|
13
20
|
var _FileManagerFileTypePlugin = require("../../FileManagerFileTypePlugin");
|
|
21
|
+
|
|
14
22
|
var styles = /*#__PURE__*/(0, _emotion.css)({
|
|
15
23
|
maxHeight: 200,
|
|
16
24
|
maxWidth: 200,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["styles","css","maxHeight","maxWidth","width","position","top","left","transform","imageFileTypePlugin","FileManagerFileTypePlugin","types","actions","EditAction","render","file","src","name"],"sources":["index.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { css } from \"emotion\";\nimport { Image } from \"@webiny/app/components\";\n\nimport EditAction from \"./EditAction\";\nimport { FileManagerFileTypePlugin } from \"~/plugins/FileManagerFileTypePlugin\";\n\nconst styles = css({\n maxHeight: 200,\n maxWidth: 200,\n width: \"auto\",\n position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n transform: \"translateX(-50%) translateY(-50%)\"\n});\n\nexport const imageFileTypePlugin = new FileManagerFileTypePlugin({\n types: [\"image/*\"],\n actions: [EditAction],\n render({ file }) {\n return (\n <Image className={styles} src={file.src} alt={file.name} transform={{ width: 300 }} />\n );\n }\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["styles","css","maxHeight","maxWidth","width","position","top","left","transform","imageFileTypePlugin","FileManagerFileTypePlugin","types","actions","EditAction","render","file","src","name"],"sources":["index.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { css } from \"emotion\";\nimport { Image } from \"@webiny/app/components\";\n\nimport EditAction from \"./EditAction\";\nimport { FileManagerFileTypePlugin } from \"~/plugins/FileManagerFileTypePlugin\";\n\nconst styles = css({\n maxHeight: 200,\n maxWidth: 200,\n width: \"auto\",\n position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n transform: \"translateX(-50%) translateY(-50%)\"\n});\n\nexport const imageFileTypePlugin = new FileManagerFileTypePlugin({\n types: [\"image/*\"],\n actions: [EditAction],\n render({ file }) {\n return (\n <Image className={styles} src={file.src} alt={file.name} transform={{ width: 300 }} />\n );\n }\n});\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AAEA,IAAMA,MAAM,gBAAG,IAAAC,YAAA,EAAI;EACfC,SAAS,EAAE,GADI;EAEfC,QAAQ,EAAE,GAFK;EAGfC,KAAK,EAAE,MAHQ;EAIfC,QAAQ,EAAE,UAJK;EAKfC,GAAG,EAAE,KALU;EAMfC,IAAI,EAAE,KANS;EAOfC,SAAS,EAAE;AAPI,CAAJ,kBAAf;AAUO,IAAMC,mBAAmB,GAAG,IAAIC,oDAAJ,CAA8B;EAC7DC,KAAK,EAAE,CAAC,SAAD,CADsD;EAE7DC,OAAO,EAAE,CAACC,mBAAD,CAFoD;EAG7DC,MAH6D,wBAG5C;IAAA,IAARC,IAAQ,QAARA,IAAQ;IACb,oBACI,oBAAC,iBAAD;MAAO,SAAS,EAAEf,MAAlB;MAA0B,GAAG,EAAEe,IAAI,CAACC,GAApC;MAAyC,GAAG,EAAED,IAAI,CAACE,IAAnD;MAAyD,SAAS,EAAE;QAAEb,KAAK,EAAE;MAAT;IAApE,EADJ;EAGH;AAP4D,CAA9B,CAA5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { defaultFileTypePlugin } from \"./fileDefault\";\nexport { imageFileTypePlugin } from \"./fileImage\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { defaultFileTypePlugin } from \"./fileDefault\";\nexport { imageFileTypePlugin } from \"./fileImage\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA"}
|