@webiny/app-admin 5.23.0 → 5.24.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/base/Admin.d.ts +1 -8
- package/base/Base.d.ts +1 -1
- package/base/plugins/AddGraphQLQuerySelection.d.ts +2 -2
- package/base/providers/ApolloProvider.d.ts +9 -3
- package/base/providers/TelemetryProvider.d.ts +2 -4
- package/base/providers/TelemetryProvider.js +5 -0
- package/base/providers/UiStateProvider.d.ts +1 -3
- package/base/providers/ViewCompositionProvider.d.ts +2 -4
- package/base/ui/Menu.d.ts +6 -1
- package/base/ui/Menu.js +87 -25
- package/base/ui/Navigation.d.ts +3 -5
- package/base/ui/Navigation.js +9 -26
- package/base/ui/Search.d.ts +2 -5
- package/base/ui/Tags.d.ts +1 -1
- package/base/ui/UserMenu.d.ts +2 -5
- package/components/AdminLayout.d.ts +1 -2
- package/components/AppInstaller/AppInstaller.d.ts +2 -4
- package/components/AppInstaller/Sidebar.d.ts +8 -6
- package/components/AppInstaller/Sidebar.js +9 -9
- package/components/AppInstaller/styled.d.ts +4 -4
- package/components/AppInstaller/useInstaller.d.ts +26 -9
- package/components/AppInstaller/useInstaller.js +42 -34
- package/components/EmptyView.d.ts +4 -4
- package/components/FileManager/BottomInfoBar/SupportedFileTypes.d.ts +5 -4
- package/components/FileManager/BottomInfoBar/SupportedFileTypes.js +2 -1
- package/components/FileManager/BottomInfoBar/UploadStatus.d.ts +5 -4
- package/components/FileManager/BottomInfoBar.d.ts +4 -2
- package/components/FileManager/DropFilesHere.d.ts +4 -3
- package/components/FileManager/DropFilesHere.js +5 -2
- package/components/FileManager/File.d.ts +7 -8
- package/components/FileManager/File.js +11 -5
- package/components/FileManager/FileDetails/Name.d.ts +7 -5
- package/components/FileManager/FileDetails/Name.js +2 -2
- package/components/FileManager/FileDetails/Tags.d.ts +7 -5
- package/components/FileManager/FileDetails/Tags.js +4 -2
- package/components/FileManager/FileDetails.d.ts +6 -8
- package/components/FileManager/FileDetails.js +14 -2
- package/components/FileManager/FileManagerContext.d.ts +12 -9
- package/components/FileManager/FileManagerContext.js +9 -7
- package/components/FileManager/FileManagerView.d.ts +2 -10
- package/components/FileManager/FileManagerView.js +19 -8
- package/components/FileManager/LeftSidebar.d.ts +6 -5
- package/components/FileManager/LeftSidebar.js +4 -4
- package/components/FileManager/NoPermissionView.d.ts +2 -2
- package/components/FileManager/NoResults.d.ts +3 -2
- package/components/FileManager/NoResults.js +5 -2
- package/components/FileManager/getFileTypePlugin.d.ts +4 -1
- package/components/FileManager/getFileTypePlugin.js +5 -0
- package/components/FileManager/getFileUploader.d.ts +2 -1
- package/components/FileManager/outputFileSelectionError.d.ts +4 -1
- package/components/FileManager/outputFileSelectionError.js +5 -0
- package/components/FileManager/types.d.ts +49 -0
- package/components/FileManager/types.js +1 -0
- package/components/FileManager.d.ts +15 -10
- package/components/FileManager.js +15 -12
- package/components/FloatingActionButton.d.ts +2 -2
- package/components/MultiImageUpload.d.ts +13 -4
- package/components/MultiImageUpload.js +15 -4
- package/components/OverlayLayout/OverlayLayout.d.ts +9 -12
- package/components/Permissions/StyledComponents.d.ts +6 -4
- package/components/RichTextEditor/RichTextEditor.d.ts +2 -2
- package/components/RichTextEditor/tools/header/index.d.ts +33 -34
- package/components/RichTextEditor/tools/header/index.js +2 -3
- package/components/RichTextEditor/tools/image/index.d.ts +36 -13
- package/components/RichTextEditor/tools/image/index.js +4 -2
- package/components/RichTextEditor/tools/image/tunes.d.ts +12 -15
- package/components/RichTextEditor/tools/image/tunes.js +2 -1
- package/components/RichTextEditor/tools/image/types.d.ts +29 -0
- package/components/RichTextEditor/tools/image/types.js +1 -0
- package/components/RichTextEditor/tools/image/ui.d.ts +33 -26
- package/components/RichTextEditor/tools/image/ui.js +24 -11
- package/components/RichTextEditor/tools/paragraph/index.d.ts +31 -31
- package/components/RichTextEditor/tools/paragraph/index.js +11 -15
- package/components/RichTextEditor/tools/textColor/index.d.ts +22 -21
- package/components/RichTextEditor/tools/textColor/index.js +3 -1
- package/components/Routes.d.ts +2 -2
- package/components/SearchUI.d.ts +4 -4
- package/components/SimpleForm/SimpleForm.d.ts +7 -9
- package/components/SimpleUI/InputField.d.ts +3 -3
- package/components/SimpleUI/InputField.js +18 -18
- package/components/SingleImageUpload.d.ts +4 -9
- package/components/SingleImageUpload.js +2 -1
- package/components/SplitView/SplitView.d.ts +5 -5
- package/hooks/useConfirmationDialog.d.ts +6 -5
- package/hooks/useConfirmationDialog.js +1 -2
- package/hooks/useDialog.d.ts +8 -3
- package/hooks/useDialog.js +1 -1
- package/hooks/useSnackbar.d.ts +6 -3
- package/package.json +17 -14
- package/plugins/FileManagerFileTypePlugin.d.ts +1 -1
- package/plugins/MenuPlugin.d.ts +3 -3
- package/plugins/fileManager/fileImage/DeleteAction.d.ts +6 -2
- package/plugins/fileManager/fileImage/EditAction.d.ts +7 -6
- package/plugins/fileManager/fileImage/EditAction.js +18 -9
- package/plugins/globalSearch/SearchBar.d.ts +13 -0
- package/plugins/globalSearch/SearchBar.js +5 -0
- package/plugins/globalSearch/SearchBarDropdown.d.ts +16 -1
- package/plugins/globalSearch/index.d.ts +2 -1
- package/plugins/globalSearch/styled.d.ts +3 -3
- package/plugins/index.d.ts +2 -1
- package/types.d.ts +8 -6
- package/ui/UIElement.d.ts +1 -1
- package/ui/UIView.d.ts +1 -1
- package/ui/elements/AccordionElement.d.ts +5 -5
- package/ui/elements/AccordionElement.js +4 -0
- package/ui/elements/ButtonElement.d.ts +3 -3
- package/ui/elements/ButtonGroupElement.d.ts +2 -2
- package/ui/elements/NavigationMenuElement.d.ts +5 -1
- package/ui/elements/NavigationMenuElement.js +3 -2
- package/ui/elements/PlaceholderElement.d.ts +2 -1
- package/ui/elements/SmallButtonElement.d.ts +1 -1
- package/ui/elements/TypographyElement.d.ts +1 -1
- package/ui/elements/form/FileManagerElement/styled.d.ts +9 -9
- package/ui/elements/form/FileManagerElement.d.ts +4 -3
- package/ui/elements/form/FormElement.d.ts +5 -5
- package/ui/elements/form/FormFieldElement.d.ts +6 -5
- package/ui/elements/form/FormFieldElement.js +5 -5
- package/ui/elements/form/InputElement.d.ts +1 -0
- package/ui/views/AdminView/HeaderSectionCenterElement.d.ts +2 -2
- package/ui/views/AdminView/HeaderSectionLeftElement.d.ts +2 -2
- package/ui/views/AdminView/HeaderSectionRightElement.d.ts +2 -2
- package/ui/views/AdminView/components/Hamburger.d.ts +2 -2
- package/ui/views/AdminView/components/Snackbar.d.ts +2 -2
- package/ui/views/FormView/FormContainerElement.d.ts +2 -2
- package/ui/views/FormView/FormFooterElement.d.ts +3 -3
- package/ui/views/FormView/FormHeaderElement.d.ts +2 -2
- package/ui/views/FormView.d.ts +1 -1
- package/ui/views/FormView.js +4 -2
- package/ui/views/OverlayView/ContentElement.d.ts +2 -2
- package/ui/views/OverlayView/HeaderElement.d.ts +5 -5
- package/ui/views/OverlayView/useOverlayView.d.ts +4 -5
- package/ui/views/OverlayView/useOverlayView.js +2 -2
- package/ui/views/OverlayView.d.ts +4 -6
- package/ui/views/SplitView/SplitViewPanelElement.d.ts +3 -3
- package/ui/views/SplitView.d.ts +1 -1
|
@@ -1,11 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { AdminInstallationPlugin } from "../../types";
|
|
2
|
+
interface UseInstallerParams {
|
|
3
|
+
isInstalled: boolean;
|
|
4
|
+
}
|
|
5
|
+
interface SkippingVersionState {
|
|
6
|
+
current: string;
|
|
7
|
+
latest: string;
|
|
8
|
+
availableUpgrades: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface Installer {
|
|
11
|
+
type: "install" | "upgrade";
|
|
12
|
+
name: string;
|
|
13
|
+
title: string;
|
|
14
|
+
render: AdminInstallationPlugin["render"];
|
|
15
|
+
installed: string | null;
|
|
16
|
+
secure?: boolean;
|
|
17
|
+
plugin: AdminInstallationPlugin;
|
|
18
|
+
}
|
|
19
|
+
export declare const useInstaller: (params: UseInstallerParams) => {
|
|
20
|
+
loading: boolean;
|
|
21
|
+
installers: Installer[];
|
|
22
|
+
installer: Installer;
|
|
23
|
+
showNextInstaller: () => any;
|
|
24
|
+
showLogin: boolean;
|
|
9
25
|
onUser: () => void;
|
|
10
|
-
skippingVersions:
|
|
26
|
+
skippingVersions: SkippingVersionState;
|
|
11
27
|
};
|
|
28
|
+
export {};
|
|
@@ -24,8 +24,8 @@ var Loader = function Loader(_ref) {
|
|
|
24
24
|
}, /*#__PURE__*/React.cloneElement(children, props));
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
export var useInstaller = function useInstaller(
|
|
28
|
-
var isInstalled =
|
|
27
|
+
export var useInstaller = function useInstaller(params) {
|
|
28
|
+
var isInstalled = params.isInstalled;
|
|
29
29
|
|
|
30
30
|
var _useReducer = useReducer(function (prev, next) {
|
|
31
31
|
return _objectSpread(_objectSpread({}, prev), next);
|
|
@@ -34,45 +34,47 @@ export var useInstaller = function useInstaller(_ref2) {
|
|
|
34
34
|
installers: [],
|
|
35
35
|
installerIndex: -1,
|
|
36
36
|
showLogin: false,
|
|
37
|
-
skippingVersions:
|
|
37
|
+
skippingVersions: null
|
|
38
38
|
}),
|
|
39
39
|
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
40
|
-
|
|
41
|
-
loading = _useReducer2$.loading,
|
|
42
|
-
installers = _useReducer2$.installers,
|
|
43
|
-
installerIndex = _useReducer2$.installerIndex,
|
|
44
|
-
showLogin = _useReducer2$.showLogin,
|
|
45
|
-
skippingVersions = _useReducer2$.skippingVersions,
|
|
40
|
+
state = _useReducer2[0],
|
|
46
41
|
setState = _useReducer2[1];
|
|
47
42
|
|
|
43
|
+
var loading = state.loading,
|
|
44
|
+
installers = state.installers,
|
|
45
|
+
installerIndex = state.installerIndex,
|
|
46
|
+
showLogin = state.showLogin,
|
|
47
|
+
skippingVersions = state.skippingVersions;
|
|
48
48
|
var client = useApolloClient();
|
|
49
49
|
|
|
50
50
|
var validateGraph = function validateGraph(graph) {
|
|
51
51
|
var isAcyclic = alg.isAcyclic(graph);
|
|
52
52
|
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
var msg = ["Your installers have circular dependencies:"];
|
|
56
|
-
cycles.forEach(function (cycle, index) {
|
|
57
|
-
var fromAToB = cycle.join(" --> ");
|
|
58
|
-
fromAToB = "".concat(index + 1, ". ").concat(fromAToB);
|
|
59
|
-
var fromBToA = cycle.reverse().join(" <-- ");
|
|
60
|
-
var padLength = fromAToB.length + 4;
|
|
61
|
-
msg.push(fromAToB.padStart(padLength));
|
|
62
|
-
msg.push(fromBToA.padStart(padLength));
|
|
63
|
-
}, cycles);
|
|
64
|
-
throw new Error(msg.join("\n"));
|
|
53
|
+
if (isAcyclic) {
|
|
54
|
+
return;
|
|
65
55
|
}
|
|
56
|
+
|
|
57
|
+
var cycles = alg.findCycles(graph);
|
|
58
|
+
var msg = ["Your installers have circular dependencies:"];
|
|
59
|
+
cycles.forEach(function (cycle, index) {
|
|
60
|
+
var fromAToB = cycle.join(" --> ");
|
|
61
|
+
fromAToB = "".concat(index + 1, ". ").concat(fromAToB);
|
|
62
|
+
var fromBToA = cycle.reverse().join(" <-- ");
|
|
63
|
+
var padLength = fromAToB.length + 4;
|
|
64
|
+
msg.push(fromAToB.padStart(padLength));
|
|
65
|
+
msg.push(fromBToA.padStart(padLength));
|
|
66
|
+
}, cycles);
|
|
67
|
+
throw new Error(msg.join("\n"));
|
|
66
68
|
};
|
|
67
69
|
|
|
68
70
|
var createGraph = function createGraph(installers) {
|
|
69
71
|
var graph = new Graph();
|
|
70
|
-
installers.forEach(function (
|
|
71
|
-
var plugin =
|
|
72
|
+
installers.forEach(function (_ref2) {
|
|
73
|
+
var plugin = _ref2.plugin;
|
|
72
74
|
graph.setNode(plugin.name, plugin);
|
|
73
75
|
});
|
|
74
|
-
installers.forEach(function (
|
|
75
|
-
var pl =
|
|
76
|
+
installers.forEach(function (_ref3) {
|
|
77
|
+
var pl = _ref3.plugin;
|
|
76
78
|
|
|
77
79
|
if (Array.isArray(pl.dependencies)) {
|
|
78
80
|
pl.dependencies.forEach(function (dep) {
|
|
@@ -107,12 +109,13 @@ export var useInstaller = function useInstaller(_ref2) {
|
|
|
107
109
|
title: installer.plugin.title,
|
|
108
110
|
render: installer.plugin.render,
|
|
109
111
|
secure: installer.plugin.secure,
|
|
110
|
-
installed:
|
|
112
|
+
installed: null,
|
|
113
|
+
plugin: installer.plugin
|
|
111
114
|
});
|
|
112
115
|
} else {
|
|
113
116
|
var wbyVersion = appConfig.getKey("WEBINY_VERSION", process.env.REACT_APP_WEBINY_VERSION);
|
|
114
|
-
var upgrades = (installer.plugin.upgrades || []).filter(function (
|
|
115
|
-
var version =
|
|
117
|
+
var upgrades = (installer.plugin.upgrades || []).filter(function (_ref4) {
|
|
118
|
+
var version = _ref4.version;
|
|
116
119
|
// TODO use coerce
|
|
117
120
|
return lte(version, wbyVersion) && gt(version, installer.installed);
|
|
118
121
|
});
|
|
@@ -135,9 +138,10 @@ export var useInstaller = function useInstaller(_ref2) {
|
|
|
135
138
|
name: "".concat(installer.plugin.name, "-upgrade"),
|
|
136
139
|
title: installer.plugin.title,
|
|
137
140
|
secure: true,
|
|
138
|
-
installed:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
installed: null,
|
|
142
|
+
plugin: installer.plugin,
|
|
143
|
+
render: function render(_ref5) {
|
|
144
|
+
var onInstalled = _ref5.onInstalled;
|
|
141
145
|
var Component = upgrades[0].getComponent();
|
|
142
146
|
return /*#__PURE__*/React.createElement(Loader, null, /*#__PURE__*/React.createElement(Component, {
|
|
143
147
|
onInstalled: onInstalled
|
|
@@ -170,10 +174,14 @@ export var useInstaller = function useInstaller(_ref2) {
|
|
|
170
174
|
showLogin: false
|
|
171
175
|
});
|
|
172
176
|
};
|
|
177
|
+
/**
|
|
178
|
+
* If set to anything else, it breaks in AppInstaller.tsx
|
|
179
|
+
*/
|
|
180
|
+
|
|
173
181
|
|
|
174
182
|
var showNextInstaller = function showNextInstaller() {
|
|
175
183
|
var prevInstaller = installers[installerIndex];
|
|
176
|
-
installers[installerIndex].installed =
|
|
184
|
+
installers[installerIndex].installed = appConfig.getKey("WEBINY_VERSION", process.env.REACT_APP_WEBINY_VERSION);
|
|
177
185
|
setState({
|
|
178
186
|
installers: installers
|
|
179
187
|
});
|
|
@@ -220,7 +228,7 @@ export var useInstaller = function useInstaller(_ref2) {
|
|
|
220
228
|
allInstallers = [];
|
|
221
229
|
_context2.next = 5;
|
|
222
230
|
return Promise.all(plugins.byType("admin-installation").map( /*#__PURE__*/function () {
|
|
223
|
-
var
|
|
231
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(pl) {
|
|
224
232
|
var installed;
|
|
225
233
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
226
234
|
while (1) {
|
|
@@ -247,7 +255,7 @@ export var useInstaller = function useInstaller(_ref2) {
|
|
|
247
255
|
}));
|
|
248
256
|
|
|
249
257
|
return function (_x) {
|
|
250
|
-
return
|
|
258
|
+
return _ref7.apply(this, arguments);
|
|
251
259
|
};
|
|
252
260
|
}()));
|
|
253
261
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ReactElement } from "react";
|
|
2
|
-
export
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
|
+
export interface EmptyViewProps {
|
|
3
3
|
icon?: ReactElement;
|
|
4
4
|
title: string;
|
|
5
5
|
action: ReactElement;
|
|
6
|
-
}
|
|
7
|
-
declare const EmptyView:
|
|
6
|
+
}
|
|
7
|
+
declare const EmptyView: React.FC<EmptyViewProps>;
|
|
8
8
|
export default EmptyView;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
accept:
|
|
4
|
-
}
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface SupportedFileTypesProps {
|
|
3
|
+
accept: string[];
|
|
4
|
+
}
|
|
5
|
+
declare const SupportedFileTypes: React.FC<SupportedFileTypesProps>;
|
|
5
6
|
export default SupportedFileTypes;
|
|
@@ -13,7 +13,8 @@ mime.define({
|
|
|
13
13
|
var getUniqueFilePlugins = function getUniqueFilePlugins(accept) {
|
|
14
14
|
var exts = {};
|
|
15
15
|
accept.forEach(function (item) {
|
|
16
|
-
|
|
16
|
+
var ext = mime.getExtension(item);
|
|
17
|
+
exts[ext] = true;
|
|
17
18
|
});
|
|
18
19
|
return Object.keys(exts);
|
|
19
20
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
uploading:
|
|
4
|
-
}
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface UploadStatusProps {
|
|
3
|
+
uploading: boolean;
|
|
4
|
+
}
|
|
5
|
+
declare const UploadStatus: React.FC<UploadStatusProps>;
|
|
5
6
|
export default UploadStatus;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SupportedFileTypesProps } from "./BottomInfoBar/SupportedFileTypes";
|
|
3
|
+
import { UploadStatusProps } from "./BottomInfoBar/UploadStatus";
|
|
4
|
+
declare const BottomInfoBar: React.FC<SupportedFileTypesProps & UploadStatusProps>;
|
|
3
5
|
export default BottomInfoBar;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export
|
|
2
|
+
export interface DropFilesHereProps {
|
|
3
3
|
onDragLeave?: (event?: React.DragEvent<HTMLElement>) => void;
|
|
4
4
|
onDrop?: (event?: React.DragEvent<HTMLElement>) => void;
|
|
5
5
|
empty?: boolean;
|
|
6
6
|
onClick?: (event?: React.MouseEvent<HTMLElement>) => void;
|
|
7
|
-
}
|
|
8
|
-
|
|
7
|
+
}
|
|
8
|
+
declare const DropFilesHere: React.FC<DropFilesHereProps>;
|
|
9
|
+
export default DropFilesHere;
|
|
@@ -40,7 +40,8 @@ var styles = /*#__PURE__*/css({
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}, "label:styles;");
|
|
43
|
-
|
|
43
|
+
|
|
44
|
+
var DropFilesHere = function DropFilesHere(_ref) {
|
|
44
45
|
var onDrop = _ref.onDrop,
|
|
45
46
|
onDragLeave = _ref.onDragLeave,
|
|
46
47
|
empty = _ref.empty,
|
|
@@ -55,4 +56,6 @@ export default function DropFilesHere(_ref) {
|
|
|
55
56
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Icon, {
|
|
56
57
|
icon: /*#__PURE__*/React.createElement(UploadIcon, null)
|
|
57
58
|
}), /*#__PURE__*/React.createElement("div", null, "Drop files here"))));
|
|
58
|
-
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export default DropFilesHere;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
+
/// <reference types="react-butterfiles" />
|
|
1
2
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
file:
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
};
|
|
3
|
+
export interface FileProps {
|
|
4
|
+
file: FileItem;
|
|
6
5
|
selected: boolean;
|
|
7
|
-
uploadFile:
|
|
6
|
+
uploadFile: (item: FileItem[] | FileItem) => Promise<number | null>;
|
|
8
7
|
onSelect: (event?: React.MouseEvent) => void;
|
|
9
|
-
onClick
|
|
8
|
+
onClick?: (event?: React.MouseEvent) => void;
|
|
10
9
|
options?: Array<{
|
|
11
10
|
label: string;
|
|
12
11
|
onClick: (file: Object) => void;
|
|
13
12
|
}>;
|
|
14
13
|
children: React.ReactNode;
|
|
15
14
|
showFileDetails: (event?: React.MouseEvent) => void;
|
|
16
|
-
}
|
|
17
|
-
declare const _default: React.NamedExoticComponent<
|
|
15
|
+
}
|
|
16
|
+
declare const _default: React.NamedExoticComponent<FileProps>;
|
|
18
17
|
export default _default;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Package react-lazy-load has no types.
|
|
4
|
+
*/
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
|
|
2
7
|
import LazyLoad from "react-lazy-load";
|
|
3
8
|
import classNames from "classnames";
|
|
4
9
|
import { css, keyframes } from "emotion";
|
|
@@ -82,7 +87,8 @@ var styles = /*#__PURE__*/css({
|
|
|
82
87
|
cursor: "auto"
|
|
83
88
|
}
|
|
84
89
|
}, "label:styles;");
|
|
85
|
-
|
|
90
|
+
|
|
91
|
+
var File = function File(props) {
|
|
86
92
|
var file = props.file,
|
|
87
93
|
selected = props.selected,
|
|
88
94
|
onSelect = props.onSelect,
|
|
@@ -116,12 +122,12 @@ export default /*#__PURE__*/React.memo(function File(props) {
|
|
|
116
122
|
className: "label",
|
|
117
123
|
onClick: onSelect
|
|
118
124
|
}, file.name));
|
|
119
|
-
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export default /*#__PURE__*/React.memo(File, function (prev, next) {
|
|
120
128
|
if (prev.selected !== next.selected) {
|
|
121
129
|
return false;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (prev.file.name !== next.file.name) {
|
|
130
|
+
} else if (prev.file.name !== next.file.name) {
|
|
125
131
|
return false;
|
|
126
132
|
}
|
|
127
133
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FileItem } from "../types";
|
|
3
|
+
interface NameProps {
|
|
4
|
+
file: FileItem;
|
|
5
|
+
canEdit: (file: FileItem) => boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const Name: React.FC<NameProps>;
|
|
6
8
|
export default Name;
|
|
@@ -11,7 +11,7 @@ import { useSnackbar } from "../../../hooks/useSnackbar";
|
|
|
11
11
|
import { UPDATE_FILE, LIST_FILES } from "./../graphql";
|
|
12
12
|
import { useFileManager } from "./../FileManagerContext";
|
|
13
13
|
|
|
14
|
-
function Name(_ref) {
|
|
14
|
+
var Name = function Name(_ref) {
|
|
15
15
|
var file = _ref.file,
|
|
16
16
|
canEdit = _ref.canEdit;
|
|
17
17
|
var name = file.name || "";
|
|
@@ -108,6 +108,6 @@ function Name(_ref) {
|
|
|
108
108
|
});
|
|
109
109
|
}, [name, file.name, canEdit]);
|
|
110
110
|
return /*#__PURE__*/React.createElement("li-content", null, editContent);
|
|
111
|
-
}
|
|
111
|
+
};
|
|
112
112
|
|
|
113
113
|
export default Name;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FileItem } from "../types";
|
|
3
|
+
interface TagsProps {
|
|
4
|
+
file: FileItem;
|
|
5
|
+
canEdit: (file: FileItem) => boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const Tags: React.FC<TagsProps>;
|
|
6
8
|
export default Tags;
|
|
@@ -49,7 +49,7 @@ var actionWrapperStyle = /*#__PURE__*/css({
|
|
|
49
49
|
}
|
|
50
50
|
}, "label:actionWrapperStyle;");
|
|
51
51
|
|
|
52
|
-
function Tags(_ref) {
|
|
52
|
+
var Tags = function Tags(_ref) {
|
|
53
53
|
var file = _ref.file,
|
|
54
54
|
canEdit = _ref.canEdit;
|
|
55
55
|
var client = useApolloClient();
|
|
@@ -205,6 +205,8 @@ function Tags(_ref) {
|
|
|
205
205
|
className: "list-item__icon",
|
|
206
206
|
icon: /*#__PURE__*/React.createElement(LabelIcon, null)
|
|
207
207
|
}), renderHeaderContent({
|
|
208
|
+
// TODO @ts-refactor
|
|
209
|
+
// @ts-ignore
|
|
208
210
|
data: data
|
|
209
211
|
})), editing && /*#__PURE__*/React.createElement("li-content", null, /*#__PURE__*/React.createElement(Bind, {
|
|
210
212
|
name: "tags",
|
|
@@ -236,6 +238,6 @@ function Tags(_ref) {
|
|
|
236
238
|
}
|
|
237
239
|
}, "Cancel"))));
|
|
238
240
|
});
|
|
239
|
-
}
|
|
241
|
+
};
|
|
240
242
|
|
|
241
243
|
export default Tags;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { FileItem } from "./types";
|
|
2
3
|
declare global {
|
|
3
4
|
namespace JSX {
|
|
4
5
|
interface IntrinsicElements {
|
|
@@ -11,13 +12,10 @@ declare global {
|
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
+
interface FileDetailsProps {
|
|
15
16
|
canEdit: (item: any) => boolean;
|
|
16
|
-
file:
|
|
17
|
-
name: string;
|
|
18
|
-
[key: string]: any;
|
|
19
|
-
};
|
|
17
|
+
file: FileItem;
|
|
20
18
|
[key: string]: any;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export
|
|
19
|
+
}
|
|
20
|
+
declare const FileDetails: React.FC<FileDetailsProps>;
|
|
21
|
+
export default FileDetails;
|
|
@@ -21,6 +21,11 @@ import Name from "./FileDetails/Name";
|
|
|
21
21
|
import { Tooltip } from "@webiny/ui/Tooltip";
|
|
22
22
|
import { Icon } from "@webiny/ui/Icon";
|
|
23
23
|
import { Typography } from "@webiny/ui/Typography";
|
|
24
|
+
/**
|
|
25
|
+
* Package react-hotkeyz has no types.
|
|
26
|
+
*/
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
|
|
24
29
|
import { useHotkeys } from "react-hotkeyz";
|
|
25
30
|
import { ReactComponent as CopyContentIcon } from "./icons/content_copy-black-24px.svg";
|
|
26
31
|
import { ReactComponent as DeleteIcon } from "./icons/delete.svg";
|
|
@@ -140,7 +145,7 @@ var isImage = function isImage(file) {
|
|
|
140
145
|
return false;
|
|
141
146
|
};
|
|
142
147
|
|
|
143
|
-
|
|
148
|
+
var FileDetails = function FileDetails(props) {
|
|
144
149
|
var file = props.file,
|
|
145
150
|
uploadFile = props.uploadFile,
|
|
146
151
|
validateFiles = props.validateFiles;
|
|
@@ -334,6 +339,11 @@ export default function FileDetails(props) {
|
|
|
334
339
|
dark: darkImageBackground
|
|
335
340
|
})
|
|
336
341
|
}, filePlugin.render({
|
|
342
|
+
/**
|
|
343
|
+
* TODO: @ts-refactor
|
|
344
|
+
* Figure out which type is the file
|
|
345
|
+
*/
|
|
346
|
+
// @ts-ignore
|
|
337
347
|
file: file,
|
|
338
348
|
uploadFile: uploadFile,
|
|
339
349
|
validateFiles: validateFiles
|
|
@@ -389,4 +399,6 @@ export default function FileDetails(props) {
|
|
|
389
399
|
}, dayjs(file.createdOn).format("DD MMM YYYY [at] HH:mm"))))), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Tags, Object.assign({
|
|
390
400
|
key: props.file.id
|
|
391
401
|
}, props)))))));
|
|
392
|
-
}
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
export default FileDetails;
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FileItem } from "./types";
|
|
3
|
+
interface StateQueryParams {
|
|
4
|
+
types: string[];
|
|
5
|
+
limit: number;
|
|
6
|
+
sort: number;
|
|
7
|
+
}
|
|
8
|
+
declare const FileManagerProvider: React.FC;
|
|
6
9
|
declare function useFileManager(): {
|
|
7
10
|
selected: any;
|
|
8
|
-
toggleSelected(file:
|
|
11
|
+
toggleSelected(file: FileItem): void;
|
|
9
12
|
hasPreviouslyUploadedFiles: any;
|
|
10
|
-
setHasPreviouslyUploadedFiles(hasPreviouslyUploadedFiles:
|
|
13
|
+
setHasPreviouslyUploadedFiles(hasPreviouslyUploadedFiles: boolean): void;
|
|
11
14
|
queryParams: any;
|
|
12
|
-
setQueryParams(queryParams:
|
|
15
|
+
setQueryParams(queryParams: StateQueryParams): void;
|
|
13
16
|
setDragging(state?: boolean): void;
|
|
14
17
|
dragging: any;
|
|
15
18
|
setUploading(state?: boolean): void;
|
|
16
19
|
uploading: any;
|
|
17
|
-
showFileDetails(src:
|
|
20
|
+
showFileDetails(src: string): void;
|
|
18
21
|
hideFileDetails(): void;
|
|
19
22
|
showingFileDetails: any;
|
|
20
23
|
state: any;
|
|
@@ -12,7 +12,7 @@ var ListFilesSort;
|
|
|
12
12
|
ListFilesSort[ListFilesSort["SIZE_DESC"] = 3] = "SIZE_DESC";
|
|
13
13
|
})(ListFilesSort || (ListFilesSort = {}));
|
|
14
14
|
|
|
15
|
-
function init(_ref) {
|
|
15
|
+
var init = function init(_ref) {
|
|
16
16
|
var accept = _ref.accept;
|
|
17
17
|
return {
|
|
18
18
|
showingFileDetails: null,
|
|
@@ -22,11 +22,13 @@ function init(_ref) {
|
|
|
22
22
|
types: accept,
|
|
23
23
|
limit: 50,
|
|
24
24
|
sort: ListFilesSort.CREATED_ON_DESC
|
|
25
|
-
}
|
|
25
|
+
},
|
|
26
|
+
dragging: false,
|
|
27
|
+
uploading: false
|
|
26
28
|
};
|
|
27
|
-
}
|
|
29
|
+
};
|
|
28
30
|
|
|
29
|
-
function fileManagerReducer(state, action) {
|
|
31
|
+
var fileManagerReducer = function fileManagerReducer(state, action) {
|
|
30
32
|
var next = _objectSpread({}, state);
|
|
31
33
|
|
|
32
34
|
switch (action.type) {
|
|
@@ -82,11 +84,11 @@ function fileManagerReducer(state, action) {
|
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
return next;
|
|
85
|
-
}
|
|
87
|
+
};
|
|
86
88
|
|
|
87
89
|
var FileManagerContext = /*#__PURE__*/React.createContext({});
|
|
88
90
|
|
|
89
|
-
function FileManagerProvider(_ref2) {
|
|
91
|
+
var FileManagerProvider = function FileManagerProvider(_ref2) {
|
|
90
92
|
var children = _ref2.children,
|
|
91
93
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
92
94
|
|
|
@@ -104,7 +106,7 @@ function FileManagerProvider(_ref2) {
|
|
|
104
106
|
return /*#__PURE__*/React.createElement(FileManagerContext.Provider, Object.assign({
|
|
105
107
|
value: value
|
|
106
108
|
}, props), children);
|
|
107
|
-
}
|
|
109
|
+
};
|
|
108
110
|
|
|
109
111
|
function useFileManager() {
|
|
110
112
|
var context = React.useContext(FileManagerContext);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { FilesRules } from "react-butterfiles";
|
|
3
3
|
declare type FileManagerViewProps = {
|
|
4
4
|
onChange: Function;
|
|
@@ -11,13 +11,5 @@ declare type FileManagerViewProps = {
|
|
|
11
11
|
multipleMaxSize: number | string;
|
|
12
12
|
onUploadCompletion?: Function;
|
|
13
13
|
};
|
|
14
|
-
declare
|
|
15
|
-
declare namespace FileManagerView {
|
|
16
|
-
var defaultProps: {
|
|
17
|
-
multiple: boolean;
|
|
18
|
-
maxSize: string;
|
|
19
|
-
multipleMaxSize: string;
|
|
20
|
-
multipleMaxCount: number;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
14
|
+
declare const FileManagerView: React.FC<FileManagerViewProps>;
|
|
23
15
|
export default FileManagerView;
|
|
@@ -32,6 +32,11 @@ import { Scrollbar } from "@webiny/ui/Scrollbar";
|
|
|
32
32
|
import { CircularProgress } from "@webiny/ui/Progress";
|
|
33
33
|
import { i18n } from "@webiny/app/i18n";
|
|
34
34
|
import { useSecurity } from "@webiny/app-security";
|
|
35
|
+
/**
|
|
36
|
+
* Package react-hotkeyz is missing types.
|
|
37
|
+
*/
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
|
|
35
40
|
import { useHotkeys } from "react-hotkeyz";
|
|
36
41
|
import { useFileManager } from "./FileManagerContext";
|
|
37
42
|
import { ReactComponent as SearchIcon } from "./icons/round-search-24px.svg";
|
|
@@ -111,15 +116,19 @@ var FileList = /*#__PURE__*/styled("div", {
|
|
|
111
116
|
marginBottom: 95
|
|
112
117
|
});
|
|
113
118
|
|
|
114
|
-
function renderFile(props) {
|
|
119
|
+
var renderFile = function renderFile(props) {
|
|
115
120
|
var file = props.file;
|
|
116
121
|
var plugin = getFileTypePlugin(file);
|
|
117
122
|
return /*#__PURE__*/React.createElement(File, Object.assign({}, props, {
|
|
118
123
|
key: file.id
|
|
119
124
|
}), plugin.render({
|
|
125
|
+
/**
|
|
126
|
+
* TODO @ts-refactor
|
|
127
|
+
*/
|
|
128
|
+
// @ts-ignore
|
|
120
129
|
file: file
|
|
121
130
|
}));
|
|
122
|
-
}
|
|
131
|
+
};
|
|
123
132
|
|
|
124
133
|
var renderEmpty = function renderEmpty(_ref) {
|
|
125
134
|
var hasPreviouslyUploadedFiles = _ref.hasPreviouslyUploadedFiles,
|
|
@@ -136,11 +145,13 @@ var renderEmpty = function renderEmpty(_ref) {
|
|
|
136
145
|
|
|
137
146
|
return /*#__PURE__*/React.createElement(DropFilesHere, {
|
|
138
147
|
empty: true,
|
|
139
|
-
onClick:
|
|
148
|
+
onClick: function onClick() {
|
|
149
|
+
return browseFiles();
|
|
150
|
+
}
|
|
140
151
|
});
|
|
141
152
|
};
|
|
142
153
|
|
|
143
|
-
function FileManagerView(props) {
|
|
154
|
+
var FileManagerView = function FileManagerView(props) {
|
|
144
155
|
var onClose = props.onClose,
|
|
145
156
|
onChange = props.onChange,
|
|
146
157
|
accept = props.accept,
|
|
@@ -284,7 +295,7 @@ function FileManagerView(props) {
|
|
|
284
295
|
});
|
|
285
296
|
};
|
|
286
297
|
|
|
287
|
-
var getFileDetailsFile = useCallback(function
|
|
298
|
+
var getFileDetailsFile = useCallback(function (_ref4) {
|
|
288
299
|
var src = _ref4.src,
|
|
289
300
|
list = _ref4.list;
|
|
290
301
|
return list.find(function (item) {
|
|
@@ -429,7 +440,7 @@ function FileManagerView(props) {
|
|
|
429
440
|
return /*#__PURE__*/React.createElement("li", {
|
|
430
441
|
key: file.name
|
|
431
442
|
}, /*#__PURE__*/React.createElement("strong", null, file.name), ": ", getFileUploadErrorMessage(e));
|
|
432
|
-
}))));
|
|
443
|
+
})))); // TODO @ts-refactor
|
|
433
444
|
}, 750));
|
|
434
445
|
|
|
435
446
|
case 10:
|
|
@@ -445,7 +456,7 @@ function FileManagerView(props) {
|
|
|
445
456
|
|
|
446
457
|
return _context3.abrupt("return", setTimeout(function () {
|
|
447
458
|
onUploadCompletion(uploadedFiles);
|
|
448
|
-
onClose();
|
|
459
|
+
onClose(); // TODO @ts-refactor
|
|
449
460
|
}, 750));
|
|
450
461
|
|
|
451
462
|
case 13:
|
|
@@ -626,7 +637,7 @@ function FileManagerView(props) {
|
|
|
626
637
|
uploading: uploading
|
|
627
638
|
}))));
|
|
628
639
|
});
|
|
629
|
-
}
|
|
640
|
+
};
|
|
630
641
|
|
|
631
642
|
FileManagerView.defaultProps = {
|
|
632
643
|
multiple: false,
|