@webiny/app-admin 0.0.0-unstable.40876133bb → 0.0.0-unstable.496cf268ac
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/Admin.js +7 -21
- package/base/Admin.js.map +1 -1
- package/base/Base.js +8 -46
- package/base/Base.js.map +1 -1
- package/base/plugins/AddGraphQLQuerySelection.js +5 -9
- package/base/plugins/AddGraphQLQuerySelection.js.map +1 -1
- package/base/providers/ApolloProvider.js +0 -5
- package/base/providers/ApolloProvider.js.map +1 -1
- package/base/providers/TelemetryProvider.js +1 -7
- package/base/providers/TelemetryProvider.js.map +1 -1
- package/base/providers/UiStateProvider.js +0 -5
- package/base/providers/UiStateProvider.js.map +1 -1
- package/base/providers/ViewCompositionProvider.js +3 -16
- package/base/providers/ViewCompositionProvider.js.map +1 -1
- package/base/ui/Brand.d.ts +2 -2
- package/base/ui/Brand.js +3 -7
- package/base/ui/Brand.js.map +1 -1
- package/base/ui/CenteredView.js +2 -7
- package/base/ui/CenteredView.js.map +1 -1
- package/base/ui/Dashboard.d.ts +2 -2
- package/base/ui/Dashboard.js +3 -7
- package/base/ui/Dashboard.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/base/ui/Layout.d.ts +2 -2
- package/base/ui/Layout.js +4 -9
- package/base/ui/Layout.js.map +1 -1
- package/base/ui/LocaleSelector.d.ts +2 -2
- package/base/ui/LocaleSelector.js +3 -7
- package/base/ui/LocaleSelector.js.map +1 -1
- package/base/ui/LoginScreen.d.ts +1 -1
- package/base/ui/LoginScreen.js +2 -8
- package/base/ui/LoginScreen.js.map +1 -1
- package/base/ui/Logo.d.ts +2 -2
- package/base/ui/Logo.js +4 -10
- package/base/ui/Logo.js.map +1 -1
- package/base/ui/Menu.js +2 -31
- package/base/ui/Menu.js.map +1 -1
- package/base/ui/Navigation.d.ts +3 -3
- package/base/ui/Navigation.js +16 -49
- package/base/ui/Navigation.js.map +1 -1
- package/base/ui/NotFound.d.ts +2 -2
- package/base/ui/NotFound.js +3 -7
- package/base/ui/NotFound.js.map +1 -1
- package/base/ui/Search.d.ts +2 -2
- package/base/ui/Search.js +8 -26
- package/base/ui/Search.js.map +1 -1
- package/base/ui/Tags.js +1 -8
- package/base/ui/Tags.js.map +1 -1
- package/base/ui/UserMenu.d.ts +7 -7
- package/base/ui/UserMenu.js +13 -37
- package/base/ui/UserMenu.js.map +1 -1
- package/components/AdminLayout.js +1 -6
- package/components/AdminLayout.js.map +1 -1
- package/components/AppInstaller/AppInstaller.js +18 -84
- package/components/AppInstaller/AppInstaller.js.map +1 -1
- package/components/AppInstaller/Sidebar.js +11 -44
- package/components/AppInstaller/Sidebar.js.map +1 -1
- package/components/AppInstaller/index.js +0 -7
- package/components/AppInstaller/index.js.map +1 -1
- package/components/AppInstaller/styled.d.ts +17 -5
- package/components/AppInstaller/styled.js +0 -4
- package/components/AppInstaller/styled.js.map +1 -1
- package/components/AppInstaller/useInstaller.d.ts +1 -7
- package/components/AppInstaller/useInstaller.js +72 -183
- package/components/AppInstaller/useInstaller.js.map +1 -1
- package/components/EmptyView.js +4 -12
- package/components/EmptyView.js.map +1 -1
- package/components/FileManager/BottomInfoBar/SupportedFileTypes.js.map +1 -1
- package/components/FileManager/BottomInfoBar/UploadStatus.js.map +1 -1
- package/components/FileManager/DropFilesHere.js.map +1 -1
- package/components/FileManager/FileDetails/Tags.js.map +1 -1
- package/components/FileManager/FileManagerView.js +4 -11
- package/components/FileManager/FileManagerView.js.map +1 -1
- package/components/FileManager/LeftSidebar.js.map +1 -1
- package/components/FileManager/NoResults.js.map +1 -1
- package/components/FloatingActionButton.js +2 -8
- package/components/FloatingActionButton.js.map +1 -1
- package/components/MultiImageUpload.js +1 -10
- package/components/MultiImageUpload.js.map +1 -1
- package/components/OverlayLayout/OverlayLayout.js +8 -37
- package/components/OverlayLayout/OverlayLayout.js.map +1 -1
- package/components/OverlayLayout/index.js +0 -2
- package/components/OverlayLayout/index.js.map +1 -1
- package/components/Permissions/Permissions.d.ts +2 -0
- package/components/Permissions/Permissions.js +25 -27
- package/components/Permissions/Permissions.js.map +1 -1
- package/components/Permissions/StyledComponents.js +0 -7
- package/components/Permissions/StyledComponents.js.map +1 -1
- package/components/Permissions/index.js +0 -3
- package/components/Permissions/index.js.map +1 -1
- package/components/RichTextEditor/RichTextEditor.js +0 -7
- package/components/RichTextEditor/RichTextEditor.js.map +1 -1
- package/components/RichTextEditor/index.js +0 -2
- package/components/RichTextEditor/index.js.map +1 -1
- package/components/RichTextEditor/tools/header/index.js +62 -102
- package/components/RichTextEditor/tools/header/index.js.map +1 -1
- package/components/RichTextEditor/tools/image/index.js +15 -36
- package/components/RichTextEditor/tools/image/index.js.map +1 -1
- package/components/RichTextEditor/tools/image/svgs.js.map +1 -1
- package/components/RichTextEditor/tools/image/tunes.js +5 -22
- package/components/RichTextEditor/tools/image/tunes.js.map +1 -1
- package/components/RichTextEditor/tools/image/ui.js +16 -39
- package/components/RichTextEditor/tools/image/ui.js.map +1 -1
- package/components/RichTextEditor/tools/paragraph/index.js +55 -81
- package/components/RichTextEditor/tools/paragraph/index.js.map +1 -1
- package/components/RichTextEditor/tools/textColor/index.js +15 -41
- package/components/RichTextEditor/tools/textColor/index.js.map +1 -1
- package/components/RichTextEditor/tools/utils.js +0 -2
- package/components/RichTextEditor/tools/utils.js.map +1 -1
- package/components/Routes.js +6 -13
- package/components/Routes.js.map +1 -1
- package/components/SearchUI.d.ts +1 -0
- package/components/SearchUI.js +14 -14
- package/components/SearchUI.js.map +1 -1
- package/components/SimpleForm/SimpleForm.js +3 -32
- package/components/SimpleForm/SimpleForm.js.map +1 -1
- package/components/SimpleForm/index.js +0 -1
- package/components/SimpleForm/index.js.map +1 -1
- package/components/SimpleUI/InputField.d.ts +2 -0
- package/components/SimpleUI/InputField.js +16 -30
- package/components/SimpleUI/InputField.js.map +1 -1
- package/components/SingleImageUpload.d.ts +1 -1
- package/components/SingleImageUpload.js +14 -30
- package/components/SingleImageUpload.js.map +1 -1
- package/components/SplitView/SplitView.js +1 -20
- package/components/SplitView/SplitView.js.map +1 -1
- package/components/SplitView/index.js +0 -1
- package/components/SplitView/index.js.map +1 -1
- package/components/index.d.ts +1 -1
- package/components/index.js +1 -2
- package/components/index.js.map +1 -1
- package/hooks/useConfirmationDialog.d.ts +3 -1
- package/hooks/useConfirmationDialog.js +12 -20
- package/hooks/useConfirmationDialog.js.map +1 -1
- package/hooks/useDialog.js +0 -5
- package/hooks/useDialog.js.map +1 -1
- package/hooks/useSnackbar.js +0 -5
- package/hooks/useSnackbar.js.map +1 -1
- package/index.d.ts +4 -5
- package/index.js +5 -65
- package/index.js.map +1 -1
- package/package.json +22 -33
- package/plugins/MenuPlugin.js +0 -15
- package/plugins/MenuPlugin.js.map +1 -1
- package/plugins/PermissionRendererPlugin.js +0 -15
- package/plugins/PermissionRendererPlugin.js.map +1 -1
- package/plugins/fileManager/fileImage/DeleteAction.js.map +1 -1
- package/plugins/fileManager/fileImage/EditAction.js.map +1 -1
- package/plugins/globalSearch/SearchBar.js +5 -53
- package/plugins/globalSearch/SearchBar.js.map +1 -1
- package/plugins/globalSearch/SearchBarDropdown.js +15 -33
- package/plugins/globalSearch/SearchBarDropdown.js.map +1 -1
- package/plugins/globalSearch/index.js.map +1 -1
- package/plugins/globalSearch/styled.d.ts +13 -4
- package/plugins/globalSearch/styled.js +1 -5
- package/plugins/globalSearch/styled.js.map +1 -1
- package/plugins/uiLayoutRenderer/index.js +2 -16
- package/plugins/uiLayoutRenderer/index.js.map +1 -1
- package/styles/material-theme-assignments.scss +4 -0
- package/styles/theme.scss +31 -1
- package/types.d.ts +23 -27
- package/types.js.map +1 -1
- package/ui/UIElement.js +0 -1
- package/ui/UIElement.js.map +1 -1
- package/ui/UILayout.js +0 -1
- package/ui/UILayout.js.map +1 -1
- package/ui/UIRenderer.js +0 -1
- package/ui/UIRenderer.js.map +1 -1
- package/ui/UIView.js +0 -1
- package/ui/UIView.js.map +1 -1
- package/ui/elements/AccordionElement.js +2 -28
- package/ui/elements/AccordionElement.js.map +1 -1
- package/ui/elements/ButtonElement.js +0 -19
- package/ui/elements/ButtonElement.js.map +1 -1
- package/ui/elements/ButtonGroupElement.js +0 -19
- package/ui/elements/ButtonGroupElement.js.map +1 -1
- package/ui/elements/GenericElement.js +0 -2
- package/ui/elements/GenericElement.js.map +1 -1
- package/ui/elements/LabelElement.js +0 -14
- package/ui/elements/LabelElement.js.map +1 -1
- package/ui/elements/NavigationMenuElement.js +3 -36
- package/ui/elements/NavigationMenuElement.js.map +1 -1
- package/ui/elements/PanelElement.js +0 -11
- package/ui/elements/PanelElement.js.map +1 -1
- package/ui/elements/PlaceholderElement.js +0 -11
- package/ui/elements/PlaceholderElement.js.map +1 -1
- package/ui/elements/SmallButtonElement.js +0 -19
- package/ui/elements/SmallButtonElement.js.map +1 -1
- package/ui/elements/TypographyElement.js +0 -19
- package/ui/elements/TypographyElement.js.map +1 -1
- package/ui/elements/ViewElement.js +0 -2
- package/ui/elements/ViewElement.js.map +1 -1
- package/ui/elements/form/DynamicFieldsetElement/DynamicFieldsetRowElement.js +0 -16
- package/ui/elements/form/DynamicFieldsetElement/DynamicFieldsetRowElement.js.map +1 -1
- package/ui/elements/form/DynamicFieldsetElement.js +11 -34
- package/ui/elements/form/DynamicFieldsetElement.js.map +1 -1
- package/ui/elements/form/FileManagerElement/EmptyStateElement.js +0 -15
- package/ui/elements/form/FileManagerElement/EmptyStateElement.js.map +1 -1
- package/ui/elements/form/FileManagerElement/EmptyStateElementRenderer.js +5 -27
- package/ui/elements/form/FileManagerElement/EmptyStateElementRenderer.js.map +1 -1
- package/ui/elements/form/FileManagerElement/FileManagerElementRenderer.js +4 -23
- package/ui/elements/form/FileManagerElement/FileManagerElementRenderer.js.map +1 -1
- package/ui/elements/form/FileManagerElement/styled.d.ts +23 -16
- package/ui/elements/form/FileManagerElement/styled.js +0 -5
- package/ui/elements/form/FileManagerElement/styled.js.map +1 -1
- package/ui/elements/form/FileManagerElement.js +0 -20
- package/ui/elements/form/FileManagerElement.js.map +1 -1
- package/ui/elements/form/FormElement.js +0 -21
- package/ui/elements/form/FormElement.js.map +1 -1
- package/ui/elements/form/FormFieldElement.js +0 -33
- package/ui/elements/form/FormFieldElement.js.map +1 -1
- package/ui/elements/form/HiddenElement.js +0 -17
- package/ui/elements/form/HiddenElement.js.map +1 -1
- package/ui/elements/form/InputElement.js +0 -18
- package/ui/elements/form/InputElement.js.map +1 -1
- package/ui/elements/form/PasswordElement.js +0 -15
- package/ui/elements/form/PasswordElement.js.map +1 -1
- package/ui/elements/form/SelectElement.js +1 -19
- package/ui/elements/form/SelectElement.js.map +1 -1
- package/ui/elements/form/TextareaElement.js +0 -17
- package/ui/elements/form/TextareaElement.js.map +1 -1
- package/ui/views/AdminView/ContentElement.js +1 -25
- package/ui/views/AdminView/ContentElement.js.map +1 -1
- package/ui/views/AdminView/HeaderElement.js +0 -40
- package/ui/views/AdminView/HeaderElement.js.map +1 -1
- package/ui/views/AdminView/HeaderSectionCenterElement.js +0 -20
- package/ui/views/AdminView/HeaderSectionCenterElement.js.map +1 -1
- package/ui/views/AdminView/HeaderSectionLeftElement.js +0 -20
- package/ui/views/AdminView/HeaderSectionLeftElement.js.map +1 -1
- package/ui/views/AdminView/HeaderSectionRightElement.js +0 -20
- package/ui/views/AdminView/HeaderSectionRightElement.js.map +1 -1
- package/ui/views/AdminView/components/Dialog.js +10 -21
- package/ui/views/AdminView/components/Dialog.js.map +1 -1
- package/ui/views/AdminView/components/Hamburger.js +2 -10
- package/ui/views/AdminView/components/Hamburger.js.map +1 -1
- package/ui/views/AdminView/components/Snackbar.js +0 -9
- package/ui/views/AdminView/components/Snackbar.js.map +1 -1
- package/ui/views/FormView/FormContainerElement.js +0 -21
- package/ui/views/FormView/FormContainerElement.js.map +1 -1
- package/ui/views/FormView/FormContentElement.js +0 -11
- package/ui/views/FormView/FormContentElement.js.map +1 -1
- package/ui/views/FormView/FormFooterElement.js +0 -19
- package/ui/views/FormView/FormFooterElement.js.map +1 -1
- package/ui/views/FormView/FormHeaderElement.js +2 -24
- package/ui/views/FormView/FormHeaderElement.js.map +1 -1
- package/ui/views/FormView.js +0 -41
- package/ui/views/FormView.js.map +1 -1
- package/ui/views/OverlayView/ContentElement.js +0 -19
- package/ui/views/OverlayView/ContentElement.js.map +1 -1
- package/ui/views/OverlayView/HeaderElement.js +4 -26
- package/ui/views/OverlayView/HeaderElement.js.map +1 -1
- package/ui/views/OverlayView/HeaderTitleElement.js +0 -22
- package/ui/views/OverlayView/HeaderTitleElement.js.map +1 -1
- package/ui/views/OverlayView/useOverlayView.js +3 -13
- package/ui/views/OverlayView/useOverlayView.js.map +1 -1
- package/ui/views/OverlayView.js +3 -37
- package/ui/views/OverlayView.js.map +1 -1
- package/ui/views/SplitView/SplitViewPanelElement.js +2 -22
- package/ui/views/SplitView/SplitViewPanelElement.js.map +1 -1
- package/ui/views/SplitView.js +0 -40
- package/ui/views/SplitView.js.map +1 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "@webiny/app
|
|
2
|
-
export type { HigherOrderComponent, ProviderProps, ComposeProps } from "@webiny/app
|
|
1
|
+
export * from "@webiny/app";
|
|
2
|
+
export type { HigherOrderComponent, ProviderProps, ComposeProps } from "@webiny/app";
|
|
3
3
|
export * from "./base/ui/Tags";
|
|
4
4
|
export * from "./base/ui/Menu";
|
|
5
5
|
export * from "./base/ui/Layout";
|
|
@@ -22,13 +22,12 @@ export type { AdminProps } from "./base/Admin";
|
|
|
22
22
|
export { useViewComposition } from "./base/providers/ViewCompositionProvider";
|
|
23
23
|
export type { ViewCompositionContext, ViewElement } from "./base/providers/ViewCompositionProvider";
|
|
24
24
|
export * from "./base/plugins/AddGraphQLQuerySelection";
|
|
25
|
-
export * from "./plugins/FileManagerFileTypePlugin";
|
|
26
25
|
export * from "./plugins/PermissionRendererPlugin";
|
|
27
26
|
export { AppInstaller } from "./components/AppInstaller";
|
|
28
27
|
export { OverlayLayout, OverlayLayoutProps } from "./components/OverlayLayout";
|
|
29
28
|
export { default as SingleImageUpload, SingleImageUploadProps } from "./components/SingleImageUpload";
|
|
30
|
-
export { FileManager, FileManagerRenderer } from "./
|
|
31
|
-
export type { FileManagerProps, FileManagerRendererProps, FileManagerFileItem } from "./
|
|
29
|
+
export { FileManager, FileManagerRenderer } from "./base/ui/FileManager";
|
|
30
|
+
export type { FileManagerProps, FileManagerRendererProps, FileManagerFileItem, FileManagerOnChange } from "./base/ui/FileManager";
|
|
32
31
|
export * from "./hooks/useSnackbar";
|
|
33
32
|
export * from "./hooks/useConfirmationDialog";
|
|
34
33
|
export * from "./hooks/useDialog";
|
package/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -77,23 +76,19 @@ Object.defineProperty(exports, "useWcp", {
|
|
|
77
76
|
return _appWcp.useWcp;
|
|
78
77
|
}
|
|
79
78
|
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
Object.keys(_appAdminCore).forEach(function (key) {
|
|
79
|
+
var _app = require("@webiny/app");
|
|
80
|
+
Object.keys(_app).forEach(function (key) {
|
|
84
81
|
if (key === "default" || key === "__esModule") return;
|
|
85
82
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
86
|
-
if (key in exports && exports[key] ===
|
|
83
|
+
if (key in exports && exports[key] === _app[key]) return;
|
|
87
84
|
Object.defineProperty(exports, key, {
|
|
88
85
|
enumerable: true,
|
|
89
86
|
get: function get() {
|
|
90
|
-
return
|
|
87
|
+
return _app[key];
|
|
91
88
|
}
|
|
92
89
|
});
|
|
93
90
|
});
|
|
94
|
-
|
|
95
91
|
var _Tags = require("./base/ui/Tags");
|
|
96
|
-
|
|
97
92
|
Object.keys(_Tags).forEach(function (key) {
|
|
98
93
|
if (key === "default" || key === "__esModule") return;
|
|
99
94
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -105,9 +100,7 @@ Object.keys(_Tags).forEach(function (key) {
|
|
|
105
100
|
}
|
|
106
101
|
});
|
|
107
102
|
});
|
|
108
|
-
|
|
109
103
|
var _Menu = require("./base/ui/Menu");
|
|
110
|
-
|
|
111
104
|
Object.keys(_Menu).forEach(function (key) {
|
|
112
105
|
if (key === "default" || key === "__esModule") return;
|
|
113
106
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -119,9 +112,7 @@ Object.keys(_Menu).forEach(function (key) {
|
|
|
119
112
|
}
|
|
120
113
|
});
|
|
121
114
|
});
|
|
122
|
-
|
|
123
115
|
var _Layout = require("./base/ui/Layout");
|
|
124
|
-
|
|
125
116
|
Object.keys(_Layout).forEach(function (key) {
|
|
126
117
|
if (key === "default" || key === "__esModule") return;
|
|
127
118
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -133,9 +124,7 @@ Object.keys(_Layout).forEach(function (key) {
|
|
|
133
124
|
}
|
|
134
125
|
});
|
|
135
126
|
});
|
|
136
|
-
|
|
137
127
|
var _LocaleSelector = require("./base/ui/LocaleSelector");
|
|
138
|
-
|
|
139
128
|
Object.keys(_LocaleSelector).forEach(function (key) {
|
|
140
129
|
if (key === "default" || key === "__esModule") return;
|
|
141
130
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -147,9 +136,7 @@ Object.keys(_LocaleSelector).forEach(function (key) {
|
|
|
147
136
|
}
|
|
148
137
|
});
|
|
149
138
|
});
|
|
150
|
-
|
|
151
139
|
var _Navigation = require("./base/ui/Navigation");
|
|
152
|
-
|
|
153
140
|
Object.keys(_Navigation).forEach(function (key) {
|
|
154
141
|
if (key === "default" || key === "__esModule") return;
|
|
155
142
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -161,9 +148,7 @@ Object.keys(_Navigation).forEach(function (key) {
|
|
|
161
148
|
}
|
|
162
149
|
});
|
|
163
150
|
});
|
|
164
|
-
|
|
165
151
|
var _Brand = require("./base/ui/Brand");
|
|
166
|
-
|
|
167
152
|
Object.keys(_Brand).forEach(function (key) {
|
|
168
153
|
if (key === "default" || key === "__esModule") return;
|
|
169
154
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -175,9 +160,7 @@ Object.keys(_Brand).forEach(function (key) {
|
|
|
175
160
|
}
|
|
176
161
|
});
|
|
177
162
|
});
|
|
178
|
-
|
|
179
163
|
var _Logo = require("./base/ui/Logo");
|
|
180
|
-
|
|
181
164
|
Object.keys(_Logo).forEach(function (key) {
|
|
182
165
|
if (key === "default" || key === "__esModule") return;
|
|
183
166
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -189,9 +172,7 @@ Object.keys(_Logo).forEach(function (key) {
|
|
|
189
172
|
}
|
|
190
173
|
});
|
|
191
174
|
});
|
|
192
|
-
|
|
193
175
|
var _Search = require("./base/ui/Search");
|
|
194
|
-
|
|
195
176
|
Object.keys(_Search).forEach(function (key) {
|
|
196
177
|
if (key === "default" || key === "__esModule") return;
|
|
197
178
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -203,9 +184,7 @@ Object.keys(_Search).forEach(function (key) {
|
|
|
203
184
|
}
|
|
204
185
|
});
|
|
205
186
|
});
|
|
206
|
-
|
|
207
187
|
var _UserMenu = require("./base/ui/UserMenu");
|
|
208
|
-
|
|
209
188
|
Object.keys(_UserMenu).forEach(function (key) {
|
|
210
189
|
if (key === "default" || key === "__esModule") return;
|
|
211
190
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -217,9 +196,7 @@ Object.keys(_UserMenu).forEach(function (key) {
|
|
|
217
196
|
}
|
|
218
197
|
});
|
|
219
198
|
});
|
|
220
|
-
|
|
221
199
|
var _LoginScreen = require("./base/ui/LoginScreen");
|
|
222
|
-
|
|
223
200
|
Object.keys(_LoginScreen).forEach(function (key) {
|
|
224
201
|
if (key === "default" || key === "__esModule") return;
|
|
225
202
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -231,9 +208,7 @@ Object.keys(_LoginScreen).forEach(function (key) {
|
|
|
231
208
|
}
|
|
232
209
|
});
|
|
233
210
|
});
|
|
234
|
-
|
|
235
211
|
var _CenteredView = require("./base/ui/CenteredView");
|
|
236
|
-
|
|
237
212
|
Object.keys(_CenteredView).forEach(function (key) {
|
|
238
213
|
if (key === "default" || key === "__esModule") return;
|
|
239
214
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -245,9 +220,7 @@ Object.keys(_CenteredView).forEach(function (key) {
|
|
|
245
220
|
}
|
|
246
221
|
});
|
|
247
222
|
});
|
|
248
|
-
|
|
249
223
|
var _Dashboard = require("./base/ui/Dashboard");
|
|
250
|
-
|
|
251
224
|
Object.keys(_Dashboard).forEach(function (key) {
|
|
252
225
|
if (key === "default" || key === "__esModule") return;
|
|
253
226
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -259,9 +232,7 @@ Object.keys(_Dashboard).forEach(function (key) {
|
|
|
259
232
|
}
|
|
260
233
|
});
|
|
261
234
|
});
|
|
262
|
-
|
|
263
235
|
var _NotFound = require("./base/ui/NotFound");
|
|
264
|
-
|
|
265
236
|
Object.keys(_NotFound).forEach(function (key) {
|
|
266
237
|
if (key === "default" || key === "__esModule") return;
|
|
267
238
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -273,13 +244,9 @@ Object.keys(_NotFound).forEach(function (key) {
|
|
|
273
244
|
}
|
|
274
245
|
});
|
|
275
246
|
});
|
|
276
|
-
|
|
277
247
|
var _Admin = require("./base/Admin");
|
|
278
|
-
|
|
279
248
|
var _ViewCompositionProvider = require("./base/providers/ViewCompositionProvider");
|
|
280
|
-
|
|
281
249
|
var _AddGraphQLQuerySelection = require("./base/plugins/AddGraphQLQuerySelection");
|
|
282
|
-
|
|
283
250
|
Object.keys(_AddGraphQLQuerySelection).forEach(function (key) {
|
|
284
251
|
if (key === "default" || key === "__esModule") return;
|
|
285
252
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -291,23 +258,7 @@ Object.keys(_AddGraphQLQuerySelection).forEach(function (key) {
|
|
|
291
258
|
}
|
|
292
259
|
});
|
|
293
260
|
});
|
|
294
|
-
|
|
295
|
-
var _FileManagerFileTypePlugin = require("./plugins/FileManagerFileTypePlugin");
|
|
296
|
-
|
|
297
|
-
Object.keys(_FileManagerFileTypePlugin).forEach(function (key) {
|
|
298
|
-
if (key === "default" || key === "__esModule") return;
|
|
299
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
300
|
-
if (key in exports && exports[key] === _FileManagerFileTypePlugin[key]) return;
|
|
301
|
-
Object.defineProperty(exports, key, {
|
|
302
|
-
enumerable: true,
|
|
303
|
-
get: function get() {
|
|
304
|
-
return _FileManagerFileTypePlugin[key];
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
});
|
|
308
|
-
|
|
309
261
|
var _PermissionRendererPlugin = require("./plugins/PermissionRendererPlugin");
|
|
310
|
-
|
|
311
262
|
Object.keys(_PermissionRendererPlugin).forEach(function (key) {
|
|
312
263
|
if (key === "default" || key === "__esModule") return;
|
|
313
264
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -319,17 +270,11 @@ Object.keys(_PermissionRendererPlugin).forEach(function (key) {
|
|
|
319
270
|
}
|
|
320
271
|
});
|
|
321
272
|
});
|
|
322
|
-
|
|
323
273
|
var _AppInstaller = require("./components/AppInstaller");
|
|
324
|
-
|
|
325
274
|
var _OverlayLayout = require("./components/OverlayLayout");
|
|
326
|
-
|
|
327
275
|
var _SingleImageUpload = _interopRequireWildcard(require("./components/SingleImageUpload"));
|
|
328
|
-
|
|
329
|
-
var _FileManager = require("./components/FileManager");
|
|
330
|
-
|
|
276
|
+
var _FileManager = require("./base/ui/FileManager");
|
|
331
277
|
var _useSnackbar = require("./hooks/useSnackbar");
|
|
332
|
-
|
|
333
278
|
Object.keys(_useSnackbar).forEach(function (key) {
|
|
334
279
|
if (key === "default" || key === "__esModule") return;
|
|
335
280
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -341,9 +286,7 @@ Object.keys(_useSnackbar).forEach(function (key) {
|
|
|
341
286
|
}
|
|
342
287
|
});
|
|
343
288
|
});
|
|
344
|
-
|
|
345
289
|
var _useConfirmationDialog = require("./hooks/useConfirmationDialog");
|
|
346
|
-
|
|
347
290
|
Object.keys(_useConfirmationDialog).forEach(function (key) {
|
|
348
291
|
if (key === "default" || key === "__esModule") return;
|
|
349
292
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -355,9 +298,7 @@ Object.keys(_useConfirmationDialog).forEach(function (key) {
|
|
|
355
298
|
}
|
|
356
299
|
});
|
|
357
300
|
});
|
|
358
|
-
|
|
359
301
|
var _useDialog = require("./hooks/useDialog");
|
|
360
|
-
|
|
361
302
|
Object.keys(_useDialog).forEach(function (key) {
|
|
362
303
|
if (key === "default" || key === "__esModule") return;
|
|
363
304
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -369,5 +310,4 @@ Object.keys(_useDialog).forEach(function (key) {
|
|
|
369
310
|
}
|
|
370
311
|
});
|
|
371
312
|
});
|
|
372
|
-
|
|
373
313
|
var _appWcp = require("@webiny/app-wcp");
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"@webiny/app
|
|
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.496cf268ac",
|
|
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,55 +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
|
-
"@babel/runtime": "7.
|
|
17
|
-
"@editorjs/editorjs": "2.
|
|
18
|
-
"@emotion/
|
|
19
|
-
"@emotion/styled": "10.
|
|
20
|
-
"@
|
|
15
|
+
"@babel/runtime": "7.20.13",
|
|
16
|
+
"@editorjs/editorjs": "2.26.5",
|
|
17
|
+
"@emotion/react": "11.10.6",
|
|
18
|
+
"@emotion/styled": "11.10.6",
|
|
19
|
+
"@material-design-icons/svg": "0.14.3",
|
|
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-
|
|
25
|
-
"@webiny/app-
|
|
26
|
-
"@webiny/
|
|
27
|
-
"@webiny/
|
|
28
|
-
"@webiny/
|
|
29
|
-
"@webiny/react-
|
|
30
|
-
"@webiny/
|
|
31
|
-
"@webiny/
|
|
32
|
-
"@webiny/ui": "0.0.0-unstable.
|
|
33
|
-
"@webiny/
|
|
34
|
-
"@webiny/validation": "0.0.0-unstable.40876133bb",
|
|
23
|
+
"@webiny/app": "0.0.0-unstable.496cf268ac",
|
|
24
|
+
"@webiny/app-security": "0.0.0-unstable.496cf268ac",
|
|
25
|
+
"@webiny/app-wcp": "0.0.0-unstable.496cf268ac",
|
|
26
|
+
"@webiny/form": "0.0.0-unstable.496cf268ac",
|
|
27
|
+
"@webiny/plugins": "0.0.0-unstable.496cf268ac",
|
|
28
|
+
"@webiny/react-composition": "0.0.0-unstable.496cf268ac",
|
|
29
|
+
"@webiny/react-router": "0.0.0-unstable.496cf268ac",
|
|
30
|
+
"@webiny/telemetry": "0.0.0-unstable.496cf268ac",
|
|
31
|
+
"@webiny/ui": "0.0.0-unstable.496cf268ac",
|
|
32
|
+
"@webiny/ui-composer": "0.0.0-unstable.496cf268ac",
|
|
33
|
+
"@webiny/validation": "0.0.0-unstable.496cf268ac",
|
|
35
34
|
"apollo-cache": "1.3.5",
|
|
36
35
|
"apollo-client": "2.6.10",
|
|
37
36
|
"apollo-link": "1.2.14",
|
|
38
37
|
"apollo-utilities": "1.3.4",
|
|
39
|
-
"bytes": "3.1.2",
|
|
40
38
|
"classnames": "2.3.2",
|
|
41
|
-
"dataurl-to-blob": "0.0.1",
|
|
42
|
-
"dayjs": "1.11.5",
|
|
43
39
|
"dot-prop-immutable": "2.1.1",
|
|
44
40
|
"downshift": "3.4.8",
|
|
45
41
|
"emotion": "10.0.27",
|
|
46
42
|
"graphlib": "2.1.8",
|
|
47
43
|
"graphql": "15.8.0",
|
|
48
|
-
"graphql-tag": "2.12.6",
|
|
49
|
-
"invariant": "2.2.4",
|
|
50
44
|
"lodash": "4.17.21",
|
|
51
|
-
"mime": "2.6.0",
|
|
52
|
-
"minimatch": "3.1.2",
|
|
53
45
|
"nanoid": "3.3.4",
|
|
54
46
|
"prop-types": "15.8.1",
|
|
55
47
|
"react": "17.0.2",
|
|
56
|
-
"react-butterfiles": "1.3.3",
|
|
57
48
|
"react-dom": "17.0.2",
|
|
58
49
|
"react-hotkeyz": "1.0.4",
|
|
59
|
-
"react-lazy-load": "3.1.14",
|
|
60
50
|
"react-transition-group": "4.4.5",
|
|
61
|
-
"semver": "7.3.8",
|
|
62
51
|
"store": "2.0.12"
|
|
63
52
|
},
|
|
64
53
|
"devDependencies": {
|
|
@@ -71,8 +60,8 @@
|
|
|
71
60
|
"@types/bytes": "^3.1.1",
|
|
72
61
|
"@types/graphlib": "^2.1.8",
|
|
73
62
|
"@types/store": "^2.0.2",
|
|
74
|
-
"@webiny/cli": "^0.0.0-unstable.
|
|
75
|
-
"@webiny/project-utils": "^0.0.0-unstable.
|
|
63
|
+
"@webiny/cli": "^0.0.0-unstable.496cf268ac",
|
|
64
|
+
"@webiny/project-utils": "^0.0.0-unstable.496cf268ac",
|
|
76
65
|
"babel-plugin-emotion": "^9.2.8",
|
|
77
66
|
"babel-plugin-lodash": "^3.3.4",
|
|
78
67
|
"rimraf": "^3.0.2",
|
|
@@ -91,7 +80,7 @@
|
|
|
91
80
|
"ignore": {
|
|
92
81
|
"dependencies": [
|
|
93
82
|
"@svgr/webpack",
|
|
94
|
-
"@emotion/
|
|
83
|
+
"@emotion/react",
|
|
95
84
|
"@types/mime"
|
|
96
85
|
],
|
|
97
86
|
"peerDependencies": [
|
|
@@ -99,5 +88,5 @@
|
|
|
99
88
|
]
|
|
100
89
|
}
|
|
101
90
|
},
|
|
102
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "496cf268acd5b092c860b62d75c7d765c9472043"
|
|
103
92
|
}
|
package/plugins/MenuPlugin.js
CHANGED
|
@@ -1,41 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.MenuPlugin = void 0;
|
|
9
|
-
|
|
10
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
10
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
-
|
|
16
11
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
12
|
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
19
|
-
|
|
20
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
-
|
|
22
14
|
var _plugins = require("@webiny/plugins");
|
|
23
|
-
|
|
24
15
|
var MenuPlugin = /*#__PURE__*/function (_Plugin) {
|
|
25
16
|
(0, _inherits2.default)(MenuPlugin, _Plugin);
|
|
26
|
-
|
|
27
17
|
var _super = (0, _createSuper2.default)(MenuPlugin);
|
|
28
|
-
|
|
29
18
|
function MenuPlugin(config) {
|
|
30
19
|
var _this;
|
|
31
|
-
|
|
32
20
|
(0, _classCallCheck2.default)(this, MenuPlugin);
|
|
33
21
|
_this = _super.call(this);
|
|
34
22
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_config", void 0);
|
|
35
23
|
_this._config = config || {};
|
|
36
24
|
return _this;
|
|
37
25
|
}
|
|
38
|
-
|
|
39
26
|
(0, _createClass2.default)(MenuPlugin, [{
|
|
40
27
|
key: "order",
|
|
41
28
|
get: function get() {
|
|
@@ -47,12 +34,10 @@ var MenuPlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
47
34
|
if (!this._config.render) {
|
|
48
35
|
return null;
|
|
49
36
|
}
|
|
50
|
-
|
|
51
37
|
return this._config.render(props);
|
|
52
38
|
}
|
|
53
39
|
}]);
|
|
54
40
|
return MenuPlugin;
|
|
55
41
|
}(_plugins.Plugin);
|
|
56
|
-
|
|
57
42
|
exports.MenuPlugin = MenuPlugin;
|
|
58
43
|
(0, _defineProperty2.default)(MenuPlugin, "type", "admin-menu");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MenuPlugin","config","_config","order","props","render","Plugin"],"sources":["MenuPlugin.ts"],"sourcesContent":["import * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins\";\n\nexport interface MenuProps {\n name: string;\n label: React.ReactNode;\n icon: React.ReactElement;\n children: React.ReactNode;\n onClick?: (toggleSection: () => void) => void;\n}\n\nexport interface SectionProps {\n label: React.ReactNode;\n children: React.ReactNode;\n icon?: React.ReactElement;\n}\n\nexport interface ItemProps {\n label: React.ReactNode;\n path: string;\n style?: React.CSSProperties;\n onClick?: () => any;\n}\n\ninterface Props {\n Menu: React.ComponentType<MenuProps>;\n Section: React.ComponentType<SectionProps>;\n Item: React.ComponentType<ItemProps>;\n}\n\ninterface Config {\n render(props: Props): React.ReactNode;\n order?: number;\n}\n\nexport class MenuPlugin extends Plugin {\n public static override readonly type: string = \"admin-menu\";\n private readonly _config: Partial<Config>;\n\n public constructor(config?: Config) {\n super();\n this._config = config || {};\n }\n\n get order() {\n return this._config.order;\n }\n\n public render(props: Props): React.ReactNode {\n if (!this._config.render) {\n return null;\n }\n return this._config.render(props);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["MenuPlugin","config","_config","order","props","render","Plugin"],"sources":["MenuPlugin.ts"],"sourcesContent":["import * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins\";\n\nexport interface MenuProps {\n name: string;\n label: React.ReactNode;\n icon: React.ReactElement;\n children: React.ReactNode;\n onClick?: (toggleSection: () => void) => void;\n}\n\nexport interface SectionProps {\n label: React.ReactNode;\n children: React.ReactNode;\n icon?: React.ReactElement;\n}\n\nexport interface ItemProps {\n label: React.ReactNode;\n path: string;\n style?: React.CSSProperties;\n onClick?: () => any;\n}\n\ninterface Props {\n Menu: React.ComponentType<MenuProps>;\n Section: React.ComponentType<SectionProps>;\n Item: React.ComponentType<ItemProps>;\n}\n\ninterface Config {\n render(props: Props): React.ReactNode;\n order?: number;\n}\n\nexport class MenuPlugin extends Plugin {\n public static override readonly type: string = \"admin-menu\";\n private readonly _config: Partial<Config>;\n\n public constructor(config?: Config) {\n super();\n this._config = config || {};\n }\n\n get order() {\n return this._config.order;\n }\n\n public render(props: Props): React.ReactNode {\n if (!this._config.render) {\n return null;\n }\n return this._config.render(props);\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA;AAAyC,IAkC5BA,UAAU;EAAA;EAAA;EAInB,oBAAmBC,MAAe,EAAE;IAAA;IAAA;IAChC;IAAQ;IACR,MAAKC,OAAO,GAAGD,MAAM,IAAI,CAAC,CAAC;IAAC;EAChC;EAAC;IAAA;IAAA,KAED,eAAY;MACR,OAAO,IAAI,CAACC,OAAO,CAACC,KAAK;IAC7B;EAAC;IAAA;IAAA,OAED,gBAAcC,KAAY,EAAmB;MACzC,IAAI,CAAC,IAAI,CAACF,OAAO,CAACG,MAAM,EAAE;QACtB,OAAO,IAAI;MACf;MACA,OAAO,IAAI,CAACH,OAAO,CAACG,MAAM,CAACD,KAAK,CAAC;IACrC;EAAC;EAAA;AAAA,EAlB2BE,eAAM;AAAA;AAAA,8BAAzBN,UAAU,UAC4B,YAAY"}
|
|
@@ -1,41 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.PermissionRendererPlugin = void 0;
|
|
9
|
-
|
|
10
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
10
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
-
|
|
16
11
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
12
|
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
19
|
-
|
|
20
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
-
|
|
22
14
|
var _plugins = require("@webiny/plugins");
|
|
23
|
-
|
|
24
15
|
var PermissionRendererPlugin = /*#__PURE__*/function (_Plugin) {
|
|
25
16
|
(0, _inherits2.default)(PermissionRendererPlugin, _Plugin);
|
|
26
|
-
|
|
27
17
|
var _super = (0, _createSuper2.default)(PermissionRendererPlugin);
|
|
28
|
-
|
|
29
18
|
function PermissionRendererPlugin(config) {
|
|
30
19
|
var _this;
|
|
31
|
-
|
|
32
20
|
(0, _classCallCheck2.default)(this, PermissionRendererPlugin);
|
|
33
21
|
_this = _super.call(this);
|
|
34
22
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_config", void 0);
|
|
35
23
|
_this._config = config || {};
|
|
36
24
|
return _this;
|
|
37
25
|
}
|
|
38
|
-
|
|
39
26
|
(0, _createClass2.default)(PermissionRendererPlugin, [{
|
|
40
27
|
key: "system",
|
|
41
28
|
get: function get() {
|
|
@@ -47,12 +34,10 @@ var PermissionRendererPlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
47
34
|
if (!this._config.render) {
|
|
48
35
|
return null;
|
|
49
36
|
}
|
|
50
|
-
|
|
51
37
|
return this._config.render(props);
|
|
52
38
|
}
|
|
53
39
|
}]);
|
|
54
40
|
return PermissionRendererPlugin;
|
|
55
41
|
}(_plugins.Plugin);
|
|
56
|
-
|
|
57
42
|
exports.PermissionRendererPlugin = PermissionRendererPlugin;
|
|
58
43
|
(0, _defineProperty2.default)(PermissionRendererPlugin, "type", "admin-app-permissions-renderer");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PermissionRendererPlugin","config","_config","Boolean","system","props","render","Plugin"],"sources":["PermissionRendererPlugin.ts"],"sourcesContent":["import React from \"react\";\nimport { Plugin } from \"@webiny/plugins\";\n\ninterface Permission {\n name: string;\n [key: string]: any;\n}\n\ninterface RenderParams {\n value: Permission[];\n onChange: (value: Permission[]) => void;\n}\n\ninterface Config {\n render(props: RenderParams): React.ReactElement;\n system?: boolean;\n}\n\nexport class PermissionRendererPlugin extends Plugin {\n public static override readonly type: string = \"admin-app-permissions-renderer\";\n private readonly _config: Partial<Config>;\n\n public constructor(config?: Config) {\n super();\n this._config = config || {};\n }\n\n get system(): boolean {\n return Boolean(this._config.system);\n }\n\n public render(props: RenderParams): React.ReactElement | null {\n if (!this._config.render) {\n return null;\n }\n return this._config.render(props);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["PermissionRendererPlugin","config","_config","Boolean","system","props","render","Plugin"],"sources":["PermissionRendererPlugin.ts"],"sourcesContent":["import React from \"react\";\nimport { Plugin } from \"@webiny/plugins\";\n\ninterface Permission {\n name: string;\n [key: string]: any;\n}\n\ninterface RenderParams {\n value: Permission[];\n onChange: (value: Permission[]) => void;\n}\n\ninterface Config {\n render(props: RenderParams): React.ReactElement;\n system?: boolean;\n}\n\nexport class PermissionRendererPlugin extends Plugin {\n public static override readonly type: string = \"admin-app-permissions-renderer\";\n private readonly _config: Partial<Config>;\n\n public constructor(config?: Config) {\n super();\n this._config = config || {};\n }\n\n get system(): boolean {\n return Boolean(this._config.system);\n }\n\n public render(props: RenderParams): React.ReactElement | null {\n if (!this._config.render) {\n return null;\n }\n return this._config.render(props);\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA;AAAyC,IAiB5BA,wBAAwB;EAAA;EAAA;EAIjC,kCAAmBC,MAAe,EAAE;IAAA;IAAA;IAChC;IAAQ;IACR,MAAKC,OAAO,GAAGD,MAAM,IAAI,CAAC,CAAC;IAAC;EAChC;EAAC;IAAA;IAAA,KAED,eAAsB;MAClB,OAAOE,OAAO,CAAC,IAAI,CAACD,OAAO,CAACE,MAAM,CAAC;IACvC;EAAC;IAAA;IAAA,OAED,gBAAcC,KAAmB,EAA6B;MAC1D,IAAI,CAAC,IAAI,CAACH,OAAO,CAACI,MAAM,EAAE;QACtB,OAAO,IAAI;MACf;MACA,OAAO,IAAI,CAACJ,OAAO,CAACI,MAAM,CAACD,KAAK,CAAC;IACrC;EAAC;EAAA;AAAA,EAlByCE,eAAM;AAAA;AAAA,8BAAvCP,wBAAwB,UACc,gCAAgC"}
|
|
@@ -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":";;;;;;;;;;;;;;;;;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,
|
|
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 +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":";;;;;;;;;;;;;;;;;;;AAAA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAfA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AAUA,SAASA,SAAT,CAAmBC,GAAnB,EAAiD;EAC7C,OAAO,IAAIC,OAAJ,CAAY,UAACC,OAAD,EAAsC;IACrD,IAAMC,GAAG,GAAG,IAAIC,MAAM,CAACC,cAAX,EAAZ;;IACAF,GAAG,CAACG,MAAJ,GAAa,YAAY;MACrB,IAAMC,MAAM,GAAG,IAAIH,MAAM,CAACI,UAAX,EAAf;;MACAD,MAAM,CAACE,SAAP,GAAmB,YAAY;QAC3BP,OAAO,CAACK,MAAM,CAACG,MAAR,CAAP;MACH,CAFD;;MAGAH,MAAM,CAACI,aAAP,CAAqBR,GAAG,CAACS,QAAzB;IACH,CAND;;IAOAT,GAAG,CAACU,IAAJ,CAAS,KAAT,EAAgBb,GAAhB;IACAG,GAAG,CAACW,YAAJ,GAAmB,MAAnB;IACAX,GAAG,CAACY,IAAJ;EACH,CAZM,CAAP;AAaH;;AASD,IAAMC,YAAmB,GAAG;EACxBC,eAAe,EAAE,KADO;EAExBC,OAAO,EAAE;AAFe,CAA5B;;AAIA,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,KAAD,EAAeC,MAAf,EAAyC;EACrD,IAAMC,IAAW,mCAAQF,KAAR,CAAjB;;EAEA,QAAQC,MAAM,CAACE,IAAf;IACI,KAAK,YAAL;MACID,IAAI,CAACJ,OAAL,GAAeG,MAAM,CAACH,OAAtB;MACAI,IAAI,CAACL,eAAL,GAAuB,IAAvB;MACA;;IACJ,KAAK,iBAAL;MACIK,IAAI,CAACJ,OAAL,GAAe,IAAf;MACAI,IAAI,CAACL,eAAL,GAAuB,KAAvB;MACA;EARR;;EAWA,OAAOK,IAAP;AACH,CAfD;;AAwBA,IAAME,UAAqC,GAAG,SAAxCA,UAAwC,CAAAC,KAAK,EAAI;EACnD,IAAQC,IAAR,GAAqDD,KAArD,CAAQC,IAAR;EAAA,IAAcC,UAAd,GAAqDF,KAArD,CAAcE,UAAd;EAAA,IAA0BC,aAA1B,GAAqDH,KAArD,CAA0BG,aAA1B;EAAA,IAAyCC,OAAzC,GAAqDJ,KAArD,CAAyCI,OAAzC;;EACA,wBAA0BC,KAAK,CAACC,UAAN,CAAiBZ,OAAjB,EAA0BH,YAA1B,CAA1B;EAAA;EAAA,IAAOI,KAAP;EAAA,IAAcY,QAAd;;EACA,mBAAyB,IAAAC,yBAAA,GAAzB;EAAA,IAAQC,YAAR,gBAAQA,YAAR,CAHmD,CAInD;;;EACA,IAAI,CAACL,OAAO,CAACH,IAAD,CAAZ,EAAoB;IAChB,OAAO,IAAP;EACH;;EAED,oBACI,uDACI,oBAAC,gBAAD;IAAS,OAAO,eAAE
|
|
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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"}
|