@iobroker/adapter-react-v5 7.2.3 → 7.2.6
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/README.md +3 -3
- package/build/AdminConnection.d.ts +1 -0
- package/build/AdminConnection.js +2 -0
- package/build/AdminConnection.js.map +1 -0
- package/{src/Components/404.tsx → build/Components/404.js} +14 -39
- package/build/Components/404.js.map +1 -0
- package/{Components → build/Components}/ColorPicker.d.ts +2 -2
- package/{Components → build/Components}/ColorPicker.js +50 -65
- package/build/Components/ColorPicker.js.map +1 -0
- package/{Components → build/Components}/ComplexCron.d.ts +2 -2
- package/{Components → build/Components}/ComplexCron.js +43 -71
- package/build/Components/ComplexCron.js.map +1 -0
- package/{Components → build/Components}/CopyToClipboard.d.ts +1 -2
- package/{src/Components/CopyToClipboard.tsx → build/Components/CopyToClipboard.js} +20 -38
- package/build/Components/CopyToClipboard.js.map +1 -0
- package/{Components → build/Components}/CustomModal.d.ts +3 -3
- package/build/Components/CustomModal.js +60 -0
- package/build/Components/CustomModal.js.map +1 -0
- package/{Components → build/Components}/FileBrowser.d.ts +21 -21
- package/{Components → build/Components}/FileBrowser.js +253 -248
- package/build/Components/FileBrowser.js.map +1 -0
- package/build/Components/FileViewer.d.ts +48 -0
- package/build/Components/FileViewer.js +277 -0
- package/build/Components/FileViewer.js.map +1 -0
- package/{Components → build/Components}/Icon.d.ts +1 -1
- package/build/Components/Icon.js +140 -0
- package/build/Components/Icon.js.map +1 -0
- package/{Components → build/Components}/IconPicker.d.ts +2 -2
- package/build/Components/IconPicker.js +73 -0
- package/build/Components/IconPicker.js.map +1 -0
- package/{Components → build/Components}/IconSelector.d.ts +3 -3
- package/{Components → build/Components}/IconSelector.js +29 -57
- package/build/Components/IconSelector.js.map +1 -0
- package/{Components → build/Components}/Image.d.ts +2 -2
- package/{Components → build/Components}/Image.js +16 -22
- package/build/Components/Image.js.map +1 -0
- package/{Components → build/Components}/Loader.d.ts +2 -2
- package/{Components → build/Components}/Loader.js +15 -40
- package/build/Components/Loader.js.map +1 -0
- package/{Components → build/Components}/Loaders/MV.d.ts +2 -2
- package/build/Components/Loaders/MV.js +61 -0
- package/build/Components/Loaders/MV.js.map +1 -0
- package/{Components → build/Components}/Loaders/PT.d.ts +2 -2
- package/{Components → build/Components}/Loaders/PT.js +10 -35
- package/build/Components/Loaders/PT.js.map +1 -0
- package/{Components → build/Components}/Loaders/Vendor.d.ts +2 -2
- package/build/Components/Loaders/Vendor.js +52 -0
- package/build/Components/Loaders/Vendor.js.map +1 -0
- package/{Components → build/Components}/Logo.d.ts +2 -2
- package/build/Components/Logo.js +108 -0
- package/build/Components/Logo.js.map +1 -0
- package/{Components → build/Components}/MDUtils.d.ts +1 -2
- package/{Components → build/Components}/MDUtils.js +4 -9
- package/build/Components/MDUtils.js.map +1 -0
- package/{Components → build/Components}/ObjectBrowser.d.ts +7 -4
- package/{Components → build/Components}/ObjectBrowser.js +1183 -1133
- package/build/Components/ObjectBrowser.js.map +1 -0
- package/{Components → build/Components}/Router.d.ts +1 -2
- package/{Components → build/Components}/Router.js +6 -7
- package/build/Components/Router.js.map +1 -0
- package/{Components → build/Components}/SaveCloseButtons.d.ts +2 -2
- package/build/Components/SaveCloseButtons.js +65 -0
- package/build/Components/SaveCloseButtons.js.map +1 -0
- package/{Components → build/Components}/Schedule.d.ts +3 -3
- package/{Components → build/Components}/Schedule.js +246 -261
- package/build/Components/Schedule.js.map +1 -0
- package/{Components → build/Components}/SelectWithIcon.d.ts +2 -2
- package/build/Components/SelectWithIcon.js +135 -0
- package/build/Components/SelectWithIcon.js.map +1 -0
- package/build/Components/SimpleCron/cronText.js +15 -0
- package/build/Components/SimpleCron/cronText.js.map +1 -0
- package/{Components → build/Components}/SimpleCron/index.d.ts +2 -2
- package/{Components → build/Components}/SimpleCron/index.js +55 -56
- package/build/Components/SimpleCron/index.js.map +1 -0
- package/{Components → build/Components}/TabContainer.d.ts +2 -2
- package/build/Components/TabContainer.js +23 -0
- package/build/Components/TabContainer.js.map +1 -0
- package/{Components → build/Components}/TabContent.d.ts +3 -2
- package/build/Components/TabContent.js +20 -0
- package/build/Components/TabContent.js.map +1 -0
- package/build/Components/TabHeader.d.ts +6 -0
- package/build/Components/TabHeader.js +6 -0
- package/build/Components/TabHeader.js.map +1 -0
- package/{Components → build/Components}/TableResize.d.ts +2 -2
- package/{src/Components/TableResize.tsx → build/Components/TableResize.js} +64 -134
- package/build/Components/TableResize.js.map +1 -0
- package/{Components → build/Components}/TextWithIcon.d.ts +2 -2
- package/{src/Components/TextWithIcon.tsx → build/Components/TextWithIcon.js} +30 -75
- package/build/Components/TextWithIcon.js.map +1 -0
- package/{Components → build/Components}/ToggleThemeMenu.d.ts +1 -1
- package/build/Components/ToggleThemeMenu.js +13 -0
- package/build/Components/ToggleThemeMenu.js.map +1 -0
- package/{Components → build/Components}/TreeTable.d.ts +3 -3
- package/{Components → build/Components}/TreeTable.js +87 -99
- package/build/Components/TreeTable.js.map +1 -0
- package/{Components → build/Components}/UploadImage.d.ts +2 -2
- package/{Components → build/Components}/UploadImage.js +46 -69
- package/build/Components/UploadImage.js.map +1 -0
- package/{Components → build/Components}/Utils.d.ts +2 -2
- package/{Components → build/Components}/Utils.js +47 -60
- package/build/Components/Utils.js.map +1 -0
- package/build/Components/withWidth.d.ts +2 -0
- package/build/Components/withWidth.js +22 -0
- package/build/Components/withWidth.js.map +1 -0
- package/build/Connection.d.ts +1 -0
- package/build/Connection.js +2 -0
- package/build/Connection.js.map +1 -0
- package/{Dialogs → build/Dialogs}/ComplexCron.d.ts +2 -2
- package/build/Dialogs/ComplexCron.js +85 -0
- package/build/Dialogs/ComplexCron.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Confirm.d.ts +2 -2
- package/build/Dialogs/Confirm.js +83 -0
- package/build/Dialogs/Confirm.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Cron.d.ts +2 -2
- package/build/Dialogs/Cron.js +72 -0
- package/build/Dialogs/Cron.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Error.d.ts +2 -2
- package/build/Dialogs/Error.js +27 -0
- package/build/Dialogs/Error.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Message.d.ts +2 -2
- package/build/Dialogs/Message.js +29 -0
- package/build/Dialogs/Message.js.map +1 -0
- package/{Dialogs → build/Dialogs}/SelectFile.d.ts +2 -2
- package/build/Dialogs/SelectFile.js +116 -0
- package/build/Dialogs/SelectFile.js.map +1 -0
- package/{Dialogs → build/Dialogs}/SelectID.d.ts +3 -3
- package/{Dialogs → build/Dialogs}/SelectID.js +28 -53
- package/build/Dialogs/SelectID.js.map +1 -0
- package/{Dialogs → build/Dialogs}/SimpleCron.d.ts +2 -2
- package/build/Dialogs/SimpleCron.js +46 -0
- package/build/Dialogs/SimpleCron.js.map +1 -0
- package/build/Dialogs/TextInput.d.ts +2 -0
- package/build/Dialogs/TextInput.js +31 -0
- package/build/Dialogs/TextInput.js.map +1 -0
- package/{GenericApp.d.ts → build/GenericApp.d.ts} +2 -3
- package/{GenericApp.js → build/GenericApp.js} +162 -176
- package/build/GenericApp.js.map +1 -0
- package/{LegacyConnection.d.ts → build/LegacyConnection.d.ts} +69 -4
- package/{LegacyConnection.js → build/LegacyConnection.js} +106 -99
- package/build/LegacyConnection.js.map +1 -0
- package/{Prompt.d.ts → build/Prompt.d.ts} +1 -1
- package/{Prompt.js → build/Prompt.js} +3 -4
- package/build/Prompt.js.map +1 -0
- package/build/Theme.d.ts +5 -0
- package/{Theme.js → build/Theme.js} +37 -32
- package/build/Theme.js.map +1 -0
- package/build/assets/devices/parseNames.d.ts +0 -0
- package/build/assets/devices/parseNames.js +35 -0
- package/build/assets/devices/parseNames.js.map +1 -0
- package/build/assets/rooms/parseNames.d.ts +0 -0
- package/build/assets/rooms/parseNames.js +35 -0
- package/build/assets/rooms/parseNames.js.map +1 -0
- package/build/dictionary.d.ts +1 -0
- package/build/dictionary.js +25 -0
- package/build/dictionary.js.map +1 -0
- package/build/i18n/de.json +449 -0
- package/build/i18n/en.json +449 -0
- package/build/i18n/es.json +449 -0
- package/build/i18n/fr.json +449 -0
- package/build/i18n/it.json +449 -0
- package/build/i18n/nl.json +449 -0
- package/build/i18n/pl.json +449 -0
- package/build/i18n/pt.json +449 -0
- package/build/i18n/ru.json +449 -0
- package/build/i18n/uk.json +449 -0
- package/build/i18n/zh-cn.json +449 -0
- package/{i18n.d.ts → build/i18n.d.ts} +2 -2
- package/{i18n.js → build/i18n.js} +9 -11
- package/build/i18n.js.map +1 -0
- package/build/icons/IconAdapter.d.ts +3 -0
- package/build/icons/IconAdapter.js +6 -0
- package/build/icons/IconAdapter.js.map +1 -0
- package/build/icons/IconAlias.d.ts +3 -0
- package/build/icons/IconAlias.js +6 -0
- package/build/icons/IconAlias.js.map +1 -0
- package/build/icons/IconChannel.d.ts +3 -0
- package/build/icons/IconChannel.js +9 -0
- package/build/icons/IconChannel.js.map +1 -0
- package/build/icons/IconClearFilter.d.ts +3 -0
- package/build/icons/IconClearFilter.js +7 -0
- package/build/icons/IconClearFilter.js.map +1 -0
- package/build/icons/IconClosed.d.ts +3 -0
- package/build/icons/IconClosed.js +6 -0
- package/build/icons/IconClosed.js.map +1 -0
- package/build/icons/IconCopy.d.ts +3 -0
- package/build/icons/IconCopy.js +5 -0
- package/build/icons/IconCopy.js.map +1 -0
- package/build/icons/IconDevice.d.ts +3 -0
- package/build/icons/IconDevice.js +15 -0
- package/build/icons/IconDevice.js.map +1 -0
- package/build/icons/IconDocument.d.ts +3 -0
- package/build/icons/IconDocument.js +6 -0
- package/build/icons/IconDocument.js.map +1 -0
- package/build/icons/IconDocumentReadOnly.d.ts +3 -0
- package/build/icons/IconDocumentReadOnly.js +7 -0
- package/build/icons/IconDocumentReadOnly.js.map +1 -0
- package/build/icons/IconExpert.d.ts +3 -0
- package/build/icons/IconExpert.js +6 -0
- package/build/icons/IconExpert.js.map +1 -0
- package/build/icons/IconFx.d.ts +3 -0
- package/build/icons/IconFx.js +5 -0
- package/build/icons/IconFx.js.map +1 -0
- package/build/icons/IconInstance.d.ts +3 -0
- package/build/icons/IconInstance.js +6 -0
- package/build/icons/IconInstance.js.map +1 -0
- package/build/icons/IconLogout.d.ts +3 -0
- package/build/icons/IconLogout.js +6 -0
- package/build/icons/IconLogout.js.map +1 -0
- package/build/icons/IconNoIcon.d.ts +3 -0
- package/build/icons/IconNoIcon.js +5 -0
- package/build/icons/IconNoIcon.js.map +1 -0
- package/build/icons/IconOpen.d.ts +3 -0
- package/build/icons/IconOpen.js +6 -0
- package/build/icons/IconOpen.js.map +1 -0
- package/{icons → build/icons}/IconProps.d.ts +1 -1
- package/build/icons/IconProps.js +2 -0
- package/build/icons/IconProps.js.map +1 -0
- package/build/icons/IconState.d.ts +3 -0
- package/build/icons/IconState.js +6 -0
- package/build/icons/IconState.js.map +1 -0
- package/build/index.d.ts +67 -0
- package/build/index.js +67 -0
- package/build/index.js.map +1 -0
- package/{types.d.ts → build/types.d.ts} +1 -1
- package/package.json +84 -47
- package/AdminConnection.d.ts +0 -2
- package/AdminConnection.js +0 -4
- package/Components/404.js +0 -101
- package/Components/CopyToClipboard.js +0 -163
- package/Components/CustomModal.js +0 -88
- package/Components/FileViewer.d.ts +0 -10
- package/Components/FileViewer.js +0 -305
- package/Components/Icon.js +0 -148
- package/Components/IconPicker.js +0 -98
- package/Components/Loaders/MV.js +0 -66
- package/Components/Loaders/Vendor.js +0 -77
- package/Components/Logo.js +0 -117
- package/Components/SaveCloseButtons.js +0 -69
- package/Components/SelectWithIcon.js +0 -168
- package/Components/SimpleCron/cronText.js +0 -19
- package/Components/TabContainer.js +0 -25
- package/Components/TabContent.js +0 -21
- package/Components/TabHeader.d.ts +0 -6
- package/Components/TabHeader.js +0 -11
- package/Components/TableResize.js +0 -226
- package/Components/TextWithIcon.js +0 -119
- package/Components/ToggleThemeMenu.js +0 -18
- package/Components/withWidth.d.ts +0 -3
- package/Components/withWidth.js +0 -27
- package/Connection.d.ts +0 -3
- package/Connection.js +0 -8
- package/Dialogs/ComplexCron.js +0 -90
- package/Dialogs/Confirm.js +0 -111
- package/Dialogs/Cron.js +0 -100
- package/Dialogs/Error.js +0 -55
- package/Dialogs/Message.js +0 -57
- package/Dialogs/SelectFile.js +0 -119
- package/Dialogs/SimpleCron.js +0 -51
- package/Dialogs/TextInput.d.ts +0 -3
- package/Dialogs/TextInput.js +0 -35
- package/Theme.d.ts +0 -6
- package/i18n/de.json +0 -449
- package/i18n/en.json +0 -449
- package/i18n/es.json +0 -449
- package/i18n/fr.json +0 -449
- package/i18n/it.json +0 -449
- package/i18n/nl.json +0 -449
- package/i18n/pl.json +0 -449
- package/i18n/pt.json +0 -449
- package/i18n/ru.json +0 -449
- package/i18n/uk.json +0 -449
- package/i18n/zh-cn.json +0 -449
- package/icons/IconAdapter.d.ts +0 -4
- package/icons/IconAdapter.js +0 -10
- package/icons/IconAlias.d.ts +0 -4
- package/icons/IconAlias.js +0 -10
- package/icons/IconChannel.d.ts +0 -4
- package/icons/IconChannel.js +0 -13
- package/icons/IconClearFilter.d.ts +0 -4
- package/icons/IconClearFilter.js +0 -11
- package/icons/IconClosed.d.ts +0 -4
- package/icons/IconClosed.js +0 -10
- package/icons/IconCopy.d.ts +0 -4
- package/icons/IconCopy.js +0 -9
- package/icons/IconDevice.d.ts +0 -4
- package/icons/IconDevice.js +0 -19
- package/icons/IconDocument.d.ts +0 -4
- package/icons/IconDocument.js +0 -10
- package/icons/IconDocumentReadOnly.d.ts +0 -4
- package/icons/IconDocumentReadOnly.js +0 -11
- package/icons/IconExpert.d.ts +0 -4
- package/icons/IconExpert.js +0 -10
- package/icons/IconFx.d.ts +0 -4
- package/icons/IconFx.js +0 -9
- package/icons/IconInstance.d.ts +0 -4
- package/icons/IconInstance.js +0 -10
- package/icons/IconLogout.d.ts +0 -4
- package/icons/IconLogout.js +0 -10
- package/icons/IconNoIcon.d.ts +0 -4
- package/icons/IconNoIcon.js +0 -9
- package/icons/IconOpen.d.ts +0 -4
- package/icons/IconOpen.js +0 -10
- package/icons/IconProps.js +0 -2
- package/icons/IconState.d.ts +0 -4
- package/icons/IconState.js +0 -10
- package/index.d.ts +0 -128
- package/index.js +0 -215
- package/src/AdminConnection.tsx +0 -3
- package/src/Components/ColorPicker.tsx +0 -343
- package/src/Components/ComplexCron.tsx +0 -561
- package/src/Components/CustomModal.tsx +0 -170
- package/src/Components/FileBrowser.tsx +0 -2550
- package/src/Components/FileViewer.tsx +0 -412
- package/src/Components/Icon.tsx +0 -238
- package/src/Components/IconPicker.tsx +0 -165
- package/src/Components/IconSelector.tsx +0 -2220
- package/src/Components/Image.tsx +0 -193
- package/src/Components/Loader.tsx +0 -328
- package/src/Components/Logo.tsx +0 -176
- package/src/Components/MDUtils.tsx +0 -104
- package/src/Components/ObjectBrowser.tsx +0 -8935
- package/src/Components/Router.tsx +0 -90
- package/src/Components/SaveCloseButtons.tsx +0 -117
- package/src/Components/Schedule.tsx +0 -1995
- package/src/Components/SelectWithIcon.tsx +0 -239
- package/src/Components/TabContainer.tsx +0 -57
- package/src/Components/TabContent.tsx +0 -38
- package/src/Components/TabHeader.tsx +0 -20
- package/src/Components/ToggleThemeMenu.tsx +0 -52
- package/src/Components/TreeTable.tsx +0 -1002
- package/src/Components/UploadImage.tsx +0 -643
- package/src/Components/Utils.tsx +0 -1802
- package/src/Components/loader.css +0 -231
- package/src/Components/withWidth.tsx +0 -32
- package/src/Connection.tsx +0 -5
- package/src/Dialogs/ComplexCron.tsx +0 -163
- package/src/Dialogs/Confirm.tsx +0 -185
- package/src/Dialogs/Cron.tsx +0 -192
- package/src/Dialogs/Error.tsx +0 -67
- package/src/Dialogs/Message.tsx +0 -73
- package/src/Dialogs/SelectFile.tsx +0 -280
- package/src/Dialogs/SelectID.tsx +0 -310
- package/src/Dialogs/SimpleCron.tsx +0 -101
- package/src/Dialogs/TextInput.tsx +0 -99
- package/src/GenericApp.tsx +0 -1076
- package/src/LegacyConnection.tsx +0 -3720
- package/src/Prompt.tsx +0 -22
- package/src/Theme.tsx +0 -472
- package/src/icons/IconAdapter.tsx +0 -22
- package/src/icons/IconAlias.tsx +0 -22
- package/src/icons/IconChannel.tsx +0 -60
- package/src/icons/IconClearFilter.tsx +0 -24
- package/src/icons/IconClosed.tsx +0 -22
- package/src/icons/IconCopy.tsx +0 -21
- package/src/icons/IconDevice.tsx +0 -126
- package/src/icons/IconDocument.tsx +0 -22
- package/src/icons/IconDocumentReadOnly.tsx +0 -27
- package/src/icons/IconExpert.tsx +0 -26
- package/src/icons/IconFx.tsx +0 -38
- package/src/icons/IconInstance.tsx +0 -22
- package/src/icons/IconLogout.tsx +0 -32
- package/src/icons/IconNoIcon.tsx +0 -21
- package/src/icons/IconOpen.tsx +0 -22
- package/src/icons/IconProps.tsx +0 -16
- package/src/icons/IconState.tsx +0 -38
- package/src/index.css +0 -56
- /package/{Components → build/Components}/404.d.ts +0 -0
- /package/{Components → build/Components}/SimpleCron/cronText.d.ts +0 -0
- /package/{assets → build/assets}/devices.json +0 -0
- /package/{assets → build/assets}/lamp_ceiling.svg +0 -0
- /package/{assets → build/assets}/lamp_table.svg +0 -0
- /package/{assets → build/assets}/no_icon.svg +0 -0
- /package/{assets → build/assets}/rooms.json +0 -0
- /package/{index.css → build/index.css} +0 -0
- /package/{tasks.js → tasksExample.js} +0 -0
|
@@ -1,71 +1,39 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.FileBrowserClass = void 0;
|
|
30
1
|
/**
|
|
31
2
|
* Copyright 2020-2024, Denis Haev <dogafox@gmail.com>
|
|
32
3
|
*
|
|
33
4
|
* MIT License
|
|
34
5
|
*
|
|
35
6
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
7
|
+
import React, { Component } from 'react';
|
|
8
|
+
import Dropzone from 'react-dropzone';
|
|
9
|
+
import { LinearProgress, ListItemIcon, ListItemText, Menu, MenuItem, Tooltip, CircularProgress, Toolbar, IconButton, Fab, Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions, Button, Input, Breadcrumbs, Box, } from '@mui/material';
|
|
39
10
|
// MUI Icons
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
11
|
+
import { Refresh as RefreshIcon, Close as CloseIcon, Bookmark as JsonIcon, BookmarkBorder as CssIcon, Description as HtmlIcon, Edit as EditIcon, Code as JSIcon, InsertDriveFile as FileIcon, Publish as UploadIcon, MusicNote as MusicIcon, SaveAlt as DownloadIcon, CreateNewFolder as AddFolderIcon, FolderOpen as EmptyFilterIcon, List as IconList, ViewModule as IconTile, ArrowBack as IconBack, Delete as DeleteIcon, Brightness6 as Brightness5Icon, Image as TypeIconImages, FontDownload as TypeIconTxt, AudioFile as TypeIconAudio, Videocam as TypeIconVideo, KeyboardReturn as EnterIcon, FolderSpecial as RestrictedIcon, } from '@mui/icons-material';
|
|
12
|
+
import { DialogError } from '../Dialogs/Error';
|
|
13
|
+
import { Utils } from './Utils';
|
|
14
|
+
import { DialogTextInput } from '../Dialogs/TextInput';
|
|
44
15
|
// Custom Icons
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
16
|
+
import { IconExpert } from '../icons/IconExpert';
|
|
17
|
+
import { IconClosed } from '../icons/IconClosed';
|
|
18
|
+
import { IconOpen } from '../icons/IconOpen';
|
|
19
|
+
import { IconNoIcon } from '../icons/IconNoIcon';
|
|
20
|
+
import { Icon } from './Icon';
|
|
21
|
+
import { withWidth } from './withWidth';
|
|
22
|
+
import { FileViewer, EXTENSIONS } from './FileViewer';
|
|
52
23
|
const ROW_HEIGHT = 32;
|
|
53
24
|
const BUTTON_WIDTH = 32;
|
|
54
25
|
const TILE_HEIGHT = 120;
|
|
55
26
|
const TILE_WIDTH = 64;
|
|
56
27
|
const NOT_FOUND = 'Not found';
|
|
57
28
|
const FILE_TYPE_ICONS = {
|
|
58
|
-
all:
|
|
59
|
-
images:
|
|
60
|
-
code:
|
|
61
|
-
txt:
|
|
62
|
-
audio:
|
|
63
|
-
video:
|
|
29
|
+
all: FileIcon,
|
|
30
|
+
images: TypeIconImages,
|
|
31
|
+
code: JSIcon,
|
|
32
|
+
txt: TypeIconTxt,
|
|
33
|
+
audio: TypeIconAudio,
|
|
34
|
+
video: TypeIconVideo,
|
|
64
35
|
};
|
|
65
36
|
const styles = {
|
|
66
|
-
dialog: (theme) => ({
|
|
67
|
-
height: `calc(100% - ${theme.mixins.toolbar.minHeight}px)`,
|
|
68
|
-
}),
|
|
69
37
|
root: {
|
|
70
38
|
width: '100%',
|
|
71
39
|
overflow: 'hidden',
|
|
@@ -107,10 +75,11 @@ const styles = {
|
|
|
107
75
|
textAlign: 'center',
|
|
108
76
|
opacity: 0.1,
|
|
109
77
|
transition: 'opacity 1s',
|
|
110
|
-
margin:
|
|
78
|
+
margin: '4px',
|
|
79
|
+
borderRadius: '4px',
|
|
111
80
|
'&:hover': {
|
|
112
81
|
background: theme.palette.secondary.light,
|
|
113
|
-
color:
|
|
82
|
+
color: Utils.invertColor(theme.palette.secondary.main, true),
|
|
114
83
|
},
|
|
115
84
|
}),
|
|
116
85
|
itemNameFolderTile: {
|
|
@@ -161,7 +130,7 @@ const styles = {
|
|
|
161
130
|
},
|
|
162
131
|
itemSelected: (theme) => ({
|
|
163
132
|
background: theme.palette.primary.main,
|
|
164
|
-
color:
|
|
133
|
+
color: Utils.invertColor(theme.palette.primary.main, true),
|
|
165
134
|
}),
|
|
166
135
|
itemTable: (theme) => ({
|
|
167
136
|
userSelect: 'none',
|
|
@@ -171,7 +140,7 @@ const styles = {
|
|
|
171
140
|
lineHeight: `${ROW_HEIGHT}px`,
|
|
172
141
|
'&:hover': {
|
|
173
142
|
background: theme.palette.secondary.light,
|
|
174
|
-
color:
|
|
143
|
+
color: Utils.invertColor(theme.palette.secondary.main, true),
|
|
175
144
|
},
|
|
176
145
|
}),
|
|
177
146
|
itemNameTable: {
|
|
@@ -228,8 +197,8 @@ const styles = {
|
|
|
228
197
|
opacity: 0.4,
|
|
229
198
|
},
|
|
230
199
|
itemFolderIconTable: (theme) => ({
|
|
231
|
-
marginTop:
|
|
232
|
-
marginLeft:
|
|
200
|
+
marginTop: '1px',
|
|
201
|
+
marginLeft: '8px',
|
|
233
202
|
display: 'inline-block',
|
|
234
203
|
width: 30,
|
|
235
204
|
height: 30,
|
|
@@ -362,6 +331,9 @@ const styles = {
|
|
|
362
331
|
background: theme.palette.primary.main,
|
|
363
332
|
},
|
|
364
333
|
}),
|
|
334
|
+
pathDivBreadcrumbSelected: {
|
|
335
|
+
// todo: add style
|
|
336
|
+
},
|
|
365
337
|
backgroundImageLight: {
|
|
366
338
|
background: 'white',
|
|
367
339
|
},
|
|
@@ -387,8 +359,8 @@ function getParentDir(dir) {
|
|
|
387
359
|
return parts.join('/');
|
|
388
360
|
}
|
|
389
361
|
function isFile(path) {
|
|
390
|
-
const ext =
|
|
391
|
-
return !!(
|
|
362
|
+
const ext = Utils.getFileExtension(path);
|
|
363
|
+
return !!(ext?.toLowerCase().match(/[a-z]+/) && ext.length < 5);
|
|
392
364
|
}
|
|
393
365
|
const TABLE = 'Table';
|
|
394
366
|
const TILE = 'Tile';
|
|
@@ -404,61 +376,26 @@ function sortFolders(a, b) {
|
|
|
404
376
|
}
|
|
405
377
|
return a.name > b.name ? 1 : a.name < b.name ? -1 : 0;
|
|
406
378
|
}
|
|
407
|
-
class FileBrowserClass extends
|
|
379
|
+
export class FileBrowserClass extends Component {
|
|
380
|
+
imagePrefix;
|
|
381
|
+
levelPadding;
|
|
382
|
+
mounted;
|
|
383
|
+
suppressDeleteConfirm;
|
|
384
|
+
browseList;
|
|
385
|
+
browseListRunning;
|
|
386
|
+
initialReadFinished;
|
|
387
|
+
supportSubscribes;
|
|
388
|
+
_tempTimeout;
|
|
389
|
+
limitToObjectID = null;
|
|
390
|
+
limitToPath = null;
|
|
391
|
+
lastSelect = null;
|
|
392
|
+
setOpacityTimer = null;
|
|
393
|
+
cacheFoldersTimeout = null;
|
|
394
|
+
foldersLoading = null;
|
|
395
|
+
cacheFolders = null;
|
|
396
|
+
localStorage;
|
|
408
397
|
constructor(props) {
|
|
409
398
|
super(props);
|
|
410
|
-
this.limitToObjectID = null;
|
|
411
|
-
this.limitToPath = null;
|
|
412
|
-
this.lastSelect = null;
|
|
413
|
-
this.setOpacityTimer = null;
|
|
414
|
-
this.cacheFoldersTimeout = null;
|
|
415
|
-
this.foldersLoading = null;
|
|
416
|
-
this.cacheFolders = null;
|
|
417
|
-
this.onFileChange = (id, fileName, size) => {
|
|
418
|
-
const key = `${id}/${fileName}`;
|
|
419
|
-
const pos = key.lastIndexOf('/');
|
|
420
|
-
const folder = key.substring(0, pos);
|
|
421
|
-
console.log(`File changed ${key}[${size}]`);
|
|
422
|
-
if (this.state.folders[folder]) {
|
|
423
|
-
if (this._tempTimeout[folder]) {
|
|
424
|
-
clearTimeout(this._tempTimeout[folder]);
|
|
425
|
-
}
|
|
426
|
-
this._tempTimeout[folder] = setTimeout(() => {
|
|
427
|
-
delete this._tempTimeout[folder];
|
|
428
|
-
this.browseFolder(folder, null, false, true)
|
|
429
|
-
.then(folders => this.setState({ folders }))
|
|
430
|
-
.catch(e => console.error(`Cannot read folder: ${e.message}`));
|
|
431
|
-
}, 300);
|
|
432
|
-
}
|
|
433
|
-
};
|
|
434
|
-
this.setStateBackgroundImage = () => {
|
|
435
|
-
const array = ['light', 'dark', 'colored', 'delete'];
|
|
436
|
-
this.setState(({ backgroundImage }) => {
|
|
437
|
-
if (backgroundImage &&
|
|
438
|
-
array.indexOf(backgroundImage) !== -1 &&
|
|
439
|
-
array.length - 1 !== array.indexOf(backgroundImage)) {
|
|
440
|
-
this.localStorage.setItem('files.backgroundImage', array[array.indexOf(backgroundImage) + 1]);
|
|
441
|
-
return { backgroundImage: array[array.indexOf(backgroundImage) + 1] };
|
|
442
|
-
}
|
|
443
|
-
this.localStorage.setItem('files.backgroundImage', array[0]);
|
|
444
|
-
return { backgroundImage: array[0] };
|
|
445
|
-
});
|
|
446
|
-
};
|
|
447
|
-
this.getStyleBackgroundImage = () => {
|
|
448
|
-
// ['light', 'dark', 'colored', 'delete']
|
|
449
|
-
switch (this.state.backgroundImage) {
|
|
450
|
-
case 'light':
|
|
451
|
-
return styles.backgroundImageLight;
|
|
452
|
-
case 'dark':
|
|
453
|
-
return styles.backgroundImageDark;
|
|
454
|
-
case 'colored':
|
|
455
|
-
return styles.backgroundImageColored;
|
|
456
|
-
case 'delete':
|
|
457
|
-
return null;
|
|
458
|
-
default:
|
|
459
|
-
return null;
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
399
|
this.localStorage = window._localStorage || window.localStorage;
|
|
463
400
|
const expandedStr = this.localStorage.getItem('files.expanded') || '[]';
|
|
464
401
|
if (this.props.limitPath) {
|
|
@@ -473,15 +410,12 @@ class FileBrowserClass extends react_1.Component {
|
|
|
473
410
|
try {
|
|
474
411
|
expanded = JSON.parse(expandedStr);
|
|
475
412
|
if (this.limitToPath) {
|
|
476
|
-
expanded = expanded.filter(id => {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
id === this.limitToPath ||
|
|
480
|
-
((_a = this.limitToPath) === null || _a === void 0 ? void 0 : _a.startsWith(`${id}/`));
|
|
481
|
-
});
|
|
413
|
+
expanded = expanded.filter(id => id.startsWith(`${this.limitToPath}/`) ||
|
|
414
|
+
id === this.limitToPath ||
|
|
415
|
+
this.limitToPath?.startsWith(`${id}/`));
|
|
482
416
|
}
|
|
483
417
|
}
|
|
484
|
-
catch
|
|
418
|
+
catch {
|
|
485
419
|
expanded = [];
|
|
486
420
|
}
|
|
487
421
|
let viewType;
|
|
@@ -595,7 +529,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
595
529
|
scrollToSelected() {
|
|
596
530
|
if (this.mounted) {
|
|
597
531
|
const el = document.getElementById(this.state.selected);
|
|
598
|
-
el
|
|
532
|
+
el?.scrollIntoView();
|
|
599
533
|
}
|
|
600
534
|
}
|
|
601
535
|
async componentDidMount() {
|
|
@@ -617,7 +551,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
617
551
|
this._tempTimeout = {};
|
|
618
552
|
}
|
|
619
553
|
browseFoldersCb(foldersList, newFoldersNotNull, cb) {
|
|
620
|
-
if (!
|
|
554
|
+
if (!foldersList?.length) {
|
|
621
555
|
cb(newFoldersNotNull);
|
|
622
556
|
}
|
|
623
557
|
else {
|
|
@@ -643,7 +577,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
643
577
|
else {
|
|
644
578
|
newFoldersNotNull = _newFolders;
|
|
645
579
|
}
|
|
646
|
-
if (!
|
|
580
|
+
if (!foldersList?.length) {
|
|
647
581
|
return Promise.resolve(newFoldersNotNull);
|
|
648
582
|
}
|
|
649
583
|
return new Promise(resolve => {
|
|
@@ -838,17 +772,28 @@ class FileBrowserClass extends react_1.Component {
|
|
|
838
772
|
const adapter = parts.shift();
|
|
839
773
|
const relPath = parts.join('/');
|
|
840
774
|
// make all requests here serial
|
|
841
|
-
|
|
775
|
+
let files;
|
|
776
|
+
try {
|
|
777
|
+
files = await this.readDirSerial(adapter || '', relPath);
|
|
778
|
+
}
|
|
779
|
+
catch (error) {
|
|
780
|
+
// work around: 0_userdata.0 is a special folder, that should exist event when other folders and itself do not exit, as the browser shows it anyway.
|
|
781
|
+
if (error === 'Not exists' && adapter === '0_userdata.0') {
|
|
782
|
+
files = [];
|
|
783
|
+
}
|
|
784
|
+
else {
|
|
785
|
+
throw error;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
842
788
|
try {
|
|
843
789
|
const _folders = [];
|
|
844
790
|
files.forEach(file => {
|
|
845
|
-
var _a;
|
|
846
791
|
const item = {
|
|
847
792
|
id: `${folderId}/${file.file}`,
|
|
848
|
-
ext:
|
|
793
|
+
ext: Utils.getFileExtension(file.file),
|
|
849
794
|
folder: file.isDir,
|
|
850
795
|
name: file.file,
|
|
851
|
-
size:
|
|
796
|
+
size: file.stats?.size,
|
|
852
797
|
modified: file.modifiedAt,
|
|
853
798
|
acl: file.acl,
|
|
854
799
|
level,
|
|
@@ -890,14 +835,14 @@ class FileBrowserClass extends react_1.Component {
|
|
|
890
835
|
catch (e) {
|
|
891
836
|
const knownError = e;
|
|
892
837
|
if (this.initialReadFinished) {
|
|
893
|
-
window.alert(`Cannot read ${adapter}${relPath ? `/${relPath}` : ''}: ${knownError
|
|
838
|
+
window.alert(`Cannot read ${adapter}${relPath ? `/${relPath}` : ''}: ${knownError?.message}`);
|
|
894
839
|
}
|
|
895
840
|
newFoldersNotNull[folderId] = [];
|
|
896
841
|
}
|
|
897
842
|
return newFoldersNotNull;
|
|
898
843
|
}
|
|
899
844
|
toggleFolder(item, e) {
|
|
900
|
-
e
|
|
845
|
+
e?.stopPropagation();
|
|
901
846
|
const expanded = [...this.state.expanded];
|
|
902
847
|
const pos = expanded.indexOf(item.id);
|
|
903
848
|
if (pos === -1) {
|
|
@@ -921,10 +866,25 @@ class FileBrowserClass extends react_1.Component {
|
|
|
921
866
|
this.setState({ expanded });
|
|
922
867
|
}
|
|
923
868
|
}
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
869
|
+
onFileChange = (id, fileName, size) => {
|
|
870
|
+
const key = `${id}/${fileName}`;
|
|
871
|
+
const pos = key.lastIndexOf('/');
|
|
872
|
+
const folder = key.substring(0, pos);
|
|
873
|
+
console.log(`File changed ${key}[${size}]`);
|
|
874
|
+
if (this.state.folders[folder]) {
|
|
875
|
+
if (this._tempTimeout[folder]) {
|
|
876
|
+
clearTimeout(this._tempTimeout[folder]);
|
|
877
|
+
}
|
|
878
|
+
this._tempTimeout[folder] = setTimeout(() => {
|
|
879
|
+
delete this._tempTimeout[folder];
|
|
880
|
+
this.browseFolder(folder, null, false, true)
|
|
881
|
+
.then(folders => this.setState({ folders }))
|
|
882
|
+
.catch(e => console.error(`Cannot read folder: ${e.message}`));
|
|
883
|
+
}, 300);
|
|
927
884
|
}
|
|
885
|
+
};
|
|
886
|
+
changeFolder(e, folder) {
|
|
887
|
+
e?.stopPropagation();
|
|
928
888
|
this.lastSelect = Date.now();
|
|
929
889
|
let _folder = folder || getParentDir(this.state.currentDir);
|
|
930
890
|
if (_folder === '/') {
|
|
@@ -932,8 +892,10 @@ class FileBrowserClass extends react_1.Component {
|
|
|
932
892
|
}
|
|
933
893
|
this.localStorage.setItem('files.currentDir', _folder);
|
|
934
894
|
if (folder && e && (e.altKey || e.shiftKey || e.ctrlKey || e.metaKey)) {
|
|
935
|
-
|
|
895
|
+
this.setState({ selected: _folder });
|
|
896
|
+
return;
|
|
936
897
|
}
|
|
898
|
+
// If desired folder is not yet loaded
|
|
937
899
|
if (_folder && !this.state.folders[_folder]) {
|
|
938
900
|
this.browseFolder(_folder)
|
|
939
901
|
.then(folders => this.setState({
|
|
@@ -946,7 +908,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
946
908
|
.catch(_e => console.error(`Cannot read folder: ${_e.message}`));
|
|
947
909
|
return;
|
|
948
910
|
}
|
|
949
|
-
|
|
911
|
+
this.setState({
|
|
950
912
|
currentDir: _folder,
|
|
951
913
|
selected: _folder,
|
|
952
914
|
path: _folder,
|
|
@@ -961,10 +923,10 @@ class FileBrowserClass extends react_1.Component {
|
|
|
961
923
|
this.localStorage.setItem('files.selected', id);
|
|
962
924
|
this.setState({ selected: id, path: id, pathFocus: false }, () => {
|
|
963
925
|
if (this.props.onSelect) {
|
|
964
|
-
const ext =
|
|
926
|
+
const ext = Utils.getFileExtension(id);
|
|
965
927
|
if ((!this.props.filterFiles || (ext && this.props.filterFiles.includes(ext))) &&
|
|
966
928
|
(!this.state.filterByType ||
|
|
967
|
-
(ext &&
|
|
929
|
+
(ext && EXTENSIONS[this.state.filterByType].includes(ext)))) {
|
|
968
930
|
this.props.onSelect(id, false, !!this.state.folders[id]);
|
|
969
931
|
}
|
|
970
932
|
else {
|
|
@@ -993,25 +955,24 @@ class FileBrowserClass extends react_1.Component {
|
|
|
993
955
|
!item.temp) {
|
|
994
956
|
return null;
|
|
995
957
|
}
|
|
996
|
-
const IconEl = expanded ?
|
|
958
|
+
const IconEl = expanded ? IconOpen : IconClosed;
|
|
997
959
|
const padding = this.state.viewType === TABLE ? item.level * this.levelPadding : 0;
|
|
998
960
|
const isUserData = item.name === USER_DATA;
|
|
999
961
|
const isSpecialData = isUserData || item.name === 'vis.0' || item.name === 'vis-2.0';
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
react_1.default.createElement(material_1.Box, { component: "div", style: styles[`itemSize${this.state.viewType}`], sx: { display: { md: 'inline-block', sm: 'none' } } }, this.state.viewType === TABLE && this.state.folders[item.id]
|
|
962
|
+
const iconStyle = Utils.getStyle(this.props.theme, styles[`itemFolderIcon${this.state.viewType}`], isSpecialData && styles.specialFolder);
|
|
963
|
+
return (React.createElement(Box, { component: "div", key: item.id, id: item.id, style: this.state.viewType === TABLE ? { marginLeft: padding, width: `calc(100% - ${padding}px` } : {}, onClick: e => (this.state.viewType === TABLE ? this.select(item.id, e) : this.changeFolder(e, item.id)), onDoubleClick: e => this.state.viewType === TABLE && this.toggleFolder(item, e), title: this.getText(item.title), className: "browserItem", sx: Utils.getStyle(this.props.theme, styles[`item${this.state.viewType}`], styles[`itemFolder${this.state.viewType}`], this.state.selected === item.id ? styles.itemSelected : {}, item.temp ? styles.itemFolderTemp : {}) },
|
|
964
|
+
React.createElement(IconEl, { style: iconStyle, onClick: this.state.viewType === TABLE ? (e) => this.toggleFolder(item, e) : undefined }),
|
|
965
|
+
React.createElement(Box, { component: "div", sx: Utils.getStyle(this.props.theme, styles[`itemName${this.state.viewType}`], styles[`itemNameFolder${this.state.viewType}`]) }, isUserData ? this.props.t('ra_User files') : item.name),
|
|
966
|
+
React.createElement(Box, { component: "div", style: styles[`itemSize${this.state.viewType}`], sx: { display: { md: 'inline-block', sm: 'none' } } }, this.state.viewType === TABLE && this.state.folders[item.id]
|
|
1006
967
|
? this.state.folders[item.id].length
|
|
1007
968
|
: ''),
|
|
1008
|
-
|
|
1009
|
-
this.state.viewType === TABLE && this.props.expertMode ? (
|
|
1010
|
-
this.state.viewType === TABLE && this.props.allowDownload ? (
|
|
969
|
+
React.createElement(Box, { component: "div", sx: { display: { md: 'inline-block', sm: 'none' } } }, this.state.viewType === TABLE && this.props.expertMode ? this.formatAcl(item.acl) : null),
|
|
970
|
+
this.state.viewType === TABLE && this.props.expertMode ? (React.createElement(Box, { component: "div", sx: { ...styles.itemDeleteButtonTable, display: { md: 'inline-block', sm: 'none' } } })) : null,
|
|
971
|
+
this.state.viewType === TABLE && this.props.allowDownload ? (React.createElement("div", { style: styles[`itemDownloadEmpty${this.state.viewType}`] })) : null,
|
|
1011
972
|
this.state.viewType === TABLE &&
|
|
1012
973
|
this.props.allowDelete &&
|
|
1013
974
|
this.state.folders[item.id] &&
|
|
1014
|
-
this.state.folders[item.id].length ? (
|
|
975
|
+
this.state.folders[item.id].length ? (React.createElement(IconButton, { "aria-label": "delete", onClick: e => {
|
|
1015
976
|
e.stopPropagation();
|
|
1016
977
|
if (this.suppressDeleteConfirm > Date.now()) {
|
|
1017
978
|
this.deleteItem(item.id);
|
|
@@ -1020,16 +981,16 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1020
981
|
this.setState({ deleteItem: item.id });
|
|
1021
982
|
}
|
|
1022
983
|
}, sx: styles[`itemDeleteButton${this.state.viewType}`], size: "large" },
|
|
1023
|
-
|
|
984
|
+
React.createElement(DeleteIcon, { fontSize: "small" }))) : this.state.viewType === TABLE && this.props.allowDelete ? (React.createElement(Box, { component: "div", sx: styles[`itemDeleteButton${this.state.viewType}`] })) : null));
|
|
1024
985
|
}
|
|
1025
986
|
renderBackFolder() {
|
|
1026
|
-
return (
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
987
|
+
return (React.createElement(Box, { component: "div", key: this.state.currentDir, id: this.state.currentDir, onClick: e => this.changeFolder(e), title: this.props.t('ra_Back to %s', getParentDir(this.state.currentDir)), className: "browserItem", sx: Utils.getStyle(this.props.theme, styles[`item${this.state.viewType}`], styles[`itemFolder${this.state.viewType}`]) },
|
|
988
|
+
React.createElement(IconClosed, { style: Utils.getStyle(this.props.theme, styles[`itemFolderIcon${this.state.viewType}`]) }),
|
|
989
|
+
React.createElement(IconBack, { sx: styles.itemFolderIconBack }),
|
|
990
|
+
React.createElement(Box, { component: "div", sx: Utils.getStyle(this.props.theme, styles[`itemName${this.state.viewType}`], styles[`itemNameFolder${this.state.viewType}`]) }, "..")));
|
|
1030
991
|
}
|
|
1031
992
|
formatSize(size) {
|
|
1032
|
-
return (
|
|
993
|
+
return (React.createElement("div", { style: styles[`itemSize${this.state.viewType}`] }, size || size === 0 ? Utils.formatBytes(size) : ''));
|
|
1033
994
|
}
|
|
1034
995
|
formatAcl(acl) {
|
|
1035
996
|
const access = acl ? acl.permissions || acl.file : 0;
|
|
@@ -1040,30 +1001,30 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1040
1001
|
else {
|
|
1041
1002
|
accessStr = '';
|
|
1042
1003
|
}
|
|
1043
|
-
return (
|
|
1004
|
+
return (React.createElement("div", { style: styles[`itemAccess${this.state.viewType}`] }, this.props.modalEditOfAccessControl ? (React.createElement(IconButton, { size: "large", onClick: () => this.setState({ modalEditOfAccess: true }), sx: styles[`itemAclButton${this.state.viewType}`] }, accessStr || '---')) : (accessStr || '---')));
|
|
1044
1005
|
}
|
|
1045
1006
|
getFileIcon(ext) {
|
|
1046
1007
|
switch (ext) {
|
|
1047
1008
|
case 'json':
|
|
1048
1009
|
case 'json5':
|
|
1049
|
-
return
|
|
1010
|
+
return React.createElement(JsonIcon, { style: styles[`itemIcon${this.state.viewType}`] });
|
|
1050
1011
|
case 'css':
|
|
1051
|
-
return
|
|
1012
|
+
return React.createElement(CssIcon, { style: styles[`itemIcon${this.state.viewType}`] });
|
|
1052
1013
|
case 'js':
|
|
1053
1014
|
case 'ts':
|
|
1054
|
-
return
|
|
1015
|
+
return React.createElement(JSIcon, { style: styles[`itemIcon${this.state.viewType}`] });
|
|
1055
1016
|
case 'html':
|
|
1056
1017
|
case 'md':
|
|
1057
|
-
return
|
|
1018
|
+
return React.createElement(HtmlIcon, { style: styles[`itemIcon${this.state.viewType}`] });
|
|
1058
1019
|
case 'mp3':
|
|
1059
1020
|
case 'ogg':
|
|
1060
1021
|
case 'wav':
|
|
1061
1022
|
case 'm4a':
|
|
1062
1023
|
case 'mp4':
|
|
1063
1024
|
case 'flac':
|
|
1064
|
-
return
|
|
1025
|
+
return React.createElement(MusicIcon, { style: styles[`itemIcon${this.state.viewType}`] });
|
|
1065
1026
|
default:
|
|
1066
|
-
return
|
|
1027
|
+
return React.createElement(FileIcon, { style: styles[`itemIcon${this.state.viewType}`] });
|
|
1067
1028
|
}
|
|
1068
1029
|
}
|
|
1069
1030
|
static getEditFile(ext) {
|
|
@@ -1080,10 +1041,38 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1080
1041
|
return false;
|
|
1081
1042
|
}
|
|
1082
1043
|
}
|
|
1044
|
+
setStateBackgroundImage = () => {
|
|
1045
|
+
const array = ['light', 'dark', 'colored', 'delete'];
|
|
1046
|
+
this.setState(({ backgroundImage }) => {
|
|
1047
|
+
if (backgroundImage &&
|
|
1048
|
+
array.indexOf(backgroundImage) !== -1 &&
|
|
1049
|
+
array.length - 1 !== array.indexOf(backgroundImage)) {
|
|
1050
|
+
this.localStorage.setItem('files.backgroundImage', array[array.indexOf(backgroundImage) + 1]);
|
|
1051
|
+
return { backgroundImage: array[array.indexOf(backgroundImage) + 1] };
|
|
1052
|
+
}
|
|
1053
|
+
this.localStorage.setItem('files.backgroundImage', array[0]);
|
|
1054
|
+
return { backgroundImage: array[0] };
|
|
1055
|
+
});
|
|
1056
|
+
};
|
|
1057
|
+
getStyleBackgroundImage = () => {
|
|
1058
|
+
// ['light', 'dark', 'colored', 'delete']
|
|
1059
|
+
switch (this.state.backgroundImage) {
|
|
1060
|
+
case 'light':
|
|
1061
|
+
return styles.backgroundImageLight;
|
|
1062
|
+
case 'dark':
|
|
1063
|
+
return styles.backgroundImageDark;
|
|
1064
|
+
case 'colored':
|
|
1065
|
+
return styles.backgroundImageColored;
|
|
1066
|
+
case 'delete':
|
|
1067
|
+
return null;
|
|
1068
|
+
default:
|
|
1069
|
+
return null;
|
|
1070
|
+
}
|
|
1071
|
+
};
|
|
1083
1072
|
renderFile(item) {
|
|
1084
1073
|
const padding = this.state.viewType === TABLE ? item.level * this.levelPadding : 0;
|
|
1085
|
-
const ext =
|
|
1086
|
-
return (
|
|
1074
|
+
const ext = Utils.getFileExtension(item.name);
|
|
1075
|
+
return (React.createElement(Box, { component: "div", key: item.id, id: item.id, onDoubleClick: e => {
|
|
1087
1076
|
e.stopPropagation();
|
|
1088
1077
|
if (!this.props.onSelect) {
|
|
1089
1078
|
this.setState({ viewer: this.imagePrefix + item.id, formatEditFile: ext });
|
|
@@ -1091,22 +1080,26 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1091
1080
|
else if ((!this.props.filterFiles || (item.ext && this.props.filterFiles.includes(item.ext))) &&
|
|
1092
1081
|
(!this.state.filterByType ||
|
|
1093
1082
|
(item.ext &&
|
|
1094
|
-
|
|
1083
|
+
EXTENSIONS[this.state.filterByType].includes(item.ext)))) {
|
|
1095
1084
|
this.props.onSelect(item.id, true, !!this.state.folders[item.id]);
|
|
1096
1085
|
}
|
|
1097
|
-
}, onClick: e => this.select(item.id, e), style: this.state.viewType === TABLE ? { marginLeft: padding, width: `calc(100% - ${padding}px)` } : {}, className: "browserItem", sx:
|
|
1098
|
-
ext &&
|
|
1086
|
+
}, onClick: e => this.select(item.id, e), style: this.state.viewType === TABLE ? { marginLeft: padding, width: `calc(100% - ${padding}px)` } : {}, className: "browserItem", sx: Utils.getStyle(this.props.theme, styles[`item${this.state.viewType}`], styles[`itemFile${this.state.viewType}`], this.state.selected === item.id ? styles.itemSelected : undefined) },
|
|
1087
|
+
ext && EXTENSIONS.images.includes(ext) ? (this.state.fileErrors.includes(item.id) ? (React.createElement(IconNoIcon, { style: {
|
|
1088
|
+
...styles[`itemImage${this.state.viewType}`],
|
|
1089
|
+
...this.getStyleBackgroundImage(),
|
|
1090
|
+
...styles[`itemNoImage${this.state.viewType}`],
|
|
1091
|
+
} })) : (React.createElement(Icon, { onError: e => {
|
|
1099
1092
|
e.target.onerror = null;
|
|
1100
1093
|
const fileErrors = [...this.state.fileErrors];
|
|
1101
1094
|
if (!fileErrors.includes(item.id)) {
|
|
1102
1095
|
fileErrors.push(item.id);
|
|
1103
1096
|
this.setState({ fileErrors });
|
|
1104
1097
|
}
|
|
1105
|
-
}, style:
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1098
|
+
}, style: { ...styles[`itemImage${this.state.viewType}`], ...this.getStyleBackgroundImage() }, src: this.imagePrefix + item.id, alt: item.name }))) : (this.getFileIcon(ext)),
|
|
1099
|
+
React.createElement(Box, { component: "div", sx: styles[`itemName${this.state.viewType}`] }, item.name),
|
|
1100
|
+
React.createElement(Box, { component: "div", sx: { display: { md: 'inline-block', sm: 'none' } } }, this.formatSize(item.size)),
|
|
1101
|
+
React.createElement(Box, { component: "div", sx: { display: { md: 'inline-block', sm: 'none' } } }, this.state.viewType === TABLE && this.props.expertMode ? this.formatAcl(item.acl) : null),
|
|
1102
|
+
React.createElement(Box, { component: "div", sx: { display: { md: 'inline-block', sm: 'none' } } }, this.state.viewType === TABLE && this.props.expertMode && FileBrowserClass.getEditFile(ext) ? (React.createElement(IconButton, { "aria-label": "edit", onClick: e => {
|
|
1110
1103
|
e.stopPropagation();
|
|
1111
1104
|
if (!this.props.onSelect) {
|
|
1112
1105
|
this.setState({ viewer: this.imagePrefix + item.id, formatEditFile: ext });
|
|
@@ -1115,18 +1108,18 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1115
1108
|
(item.ext && this.props.filterFiles.includes(item.ext))) &&
|
|
1116
1109
|
(!this.state.filterByType ||
|
|
1117
1110
|
(item.ext &&
|
|
1118
|
-
|
|
1111
|
+
EXTENSIONS[this.state.filterByType].includes(item.ext)))) {
|
|
1119
1112
|
this.props.onSelect(item.id, true, !!this.state.folders[item.id]);
|
|
1120
1113
|
}
|
|
1121
1114
|
}, sx: styles.itemDeleteButtonTable, size: "large" },
|
|
1122
|
-
|
|
1123
|
-
this.state.viewType === TABLE && this.props.allowDownload ? (
|
|
1124
|
-
|
|
1115
|
+
React.createElement(EditIcon, { fontSize: "small" }))) : (React.createElement(Box, { component: "div", sx: styles[`itemDeleteButton${this.state.viewType}`] }))),
|
|
1116
|
+
this.state.viewType === TABLE && this.props.allowDownload ? (React.createElement(Box, { component: "a", className: "MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeLarge", sx: styles.itemDownloadButtonTable, tabIndex: 0, download: item.id, href: this.imagePrefix + item.id, onClick: e => e.stopPropagation() },
|
|
1117
|
+
React.createElement(DownloadIcon, null))) : null,
|
|
1125
1118
|
this.state.viewType === TABLE &&
|
|
1126
1119
|
this.props.allowDelete &&
|
|
1127
1120
|
item.id !== 'vis.0/' &&
|
|
1128
1121
|
item.id !== 'vis-2.0/' &&
|
|
1129
|
-
item.id !== USER_DATA ? (
|
|
1122
|
+
item.id !== USER_DATA ? (React.createElement(IconButton, { "aria-label": "delete", onClick: e => {
|
|
1130
1123
|
e.stopPropagation();
|
|
1131
1124
|
if (this.suppressDeleteConfirm > Date.now()) {
|
|
1132
1125
|
this.deleteItem(item.id);
|
|
@@ -1135,7 +1128,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1135
1128
|
this.setState({ deleteItem: item.id });
|
|
1136
1129
|
}
|
|
1137
1130
|
}, sx: styles[`itemDeleteButton${this.state.viewType}`], size: "large" },
|
|
1138
|
-
|
|
1131
|
+
React.createElement(DeleteIcon, { fontSize: "small" }))) : this.state.viewType === TABLE && this.props.allowDelete ? (React.createElement(Box, { component: "div", sx: styles[`itemDeleteButton${this.state.viewType}`] })) : null));
|
|
1139
1132
|
}
|
|
1140
1133
|
renderItems(folderId) {
|
|
1141
1134
|
if (this.state.folders && this.state.folders[folderId]) {
|
|
@@ -1152,7 +1145,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1152
1145
|
else if ((!this.props.filterFiles || (item.ext && this.props.filterFiles.includes(item.ext))) &&
|
|
1153
1146
|
(!this.state.filterByType ||
|
|
1154
1147
|
(item.ext &&
|
|
1155
|
-
|
|
1148
|
+
EXTENSIONS[this.state.filterByType].includes(item.ext)))) {
|
|
1156
1149
|
res.push(this.renderFile(item));
|
|
1157
1150
|
}
|
|
1158
1151
|
});
|
|
@@ -1182,15 +1175,15 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1182
1175
|
else if ((!this.props.filterFiles || (item.ext && this.props.filterFiles.includes(item.ext))) &&
|
|
1183
1176
|
(!this.state.filterByType ||
|
|
1184
1177
|
(item.ext &&
|
|
1185
|
-
|
|
1178
|
+
EXTENSIONS[this.state.filterByType].includes(item.ext)))) {
|
|
1186
1179
|
totalResult.push(this.renderFile(item));
|
|
1187
1180
|
}
|
|
1188
1181
|
});
|
|
1189
1182
|
return totalResult;
|
|
1190
1183
|
}
|
|
1191
|
-
return (
|
|
1192
|
-
|
|
1193
|
-
|
|
1184
|
+
return (React.createElement("div", { style: { position: 'relative' } },
|
|
1185
|
+
React.createElement(CircularProgress, { key: folderId, color: "secondary", size: 24 }),
|
|
1186
|
+
React.createElement("div", { style: {
|
|
1194
1187
|
position: 'absolute',
|
|
1195
1188
|
zIndex: 2,
|
|
1196
1189
|
top: 4,
|
|
@@ -1203,17 +1196,23 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1203
1196
|
? FILE_TYPE_ICONS[this.state.filterByType || 'all'] || FILE_TYPE_ICONS.all
|
|
1204
1197
|
: null;
|
|
1205
1198
|
const isInFolder = this.findFirstFolder(this.state.selected);
|
|
1206
|
-
return (
|
|
1207
|
-
this.props.allowNonRestricted && this.props.restrictToFolder ? (
|
|
1199
|
+
return (React.createElement(Toolbar, { key: "toolbar", variant: "dense" },
|
|
1200
|
+
this.props.allowNonRestricted && this.props.restrictToFolder ? (React.createElement(IconButton, { edge: "start", title: this.state.restrictToFolder
|
|
1208
1201
|
? this.props.t('ra_Show all folders')
|
|
1209
|
-
: this.props.t('ra_Restrict to folder'), style:
|
|
1202
|
+
: this.props.t('ra_Restrict to folder'), style: {
|
|
1203
|
+
...styles.menuButton,
|
|
1204
|
+
...(this.state.restrictToFolder ? styles.menuButtonRestrictActive : undefined),
|
|
1205
|
+
}, "aria-label": "restricted to folder", onClick: () => this.setState({
|
|
1210
1206
|
restrictToFolder: (this.state.restrictToFolder ? '' : this.props.restrictToFolder) || '',
|
|
1211
1207
|
loadAllFolders: true,
|
|
1212
1208
|
}), size: "small" },
|
|
1213
|
-
|
|
1214
|
-
this.props.showExpertButton ? (
|
|
1215
|
-
|
|
1216
|
-
|
|
1209
|
+
React.createElement(RestrictedIcon, { fontSize: "small" }))) : null,
|
|
1210
|
+
this.props.showExpertButton ? (React.createElement(IconButton, { edge: "start", title: this.props.t('ra_Toggle expert mode'), style: {
|
|
1211
|
+
...styles.menuButton,
|
|
1212
|
+
...(this.state.expertMode ? styles.menuButtonExpertActive : undefined),
|
|
1213
|
+
}, "aria-label": "expert mode", onClick: () => this.setState({ expertMode: !this.state.expertMode }), size: "small" },
|
|
1214
|
+
React.createElement(IconExpert, null))) : null,
|
|
1215
|
+
this.props.showViewTypeButton ? (React.createElement(IconButton, { edge: "start", title: this.props.t('ra_Toggle view mode'), style: styles.menuButton, "aria-label": "view mode", onClick: () => {
|
|
1217
1216
|
const viewType = this.state.viewType === TABLE ? TILE : TABLE;
|
|
1218
1217
|
this.localStorage.setItem('files.viewType', viewType);
|
|
1219
1218
|
let currentDir = this.state.selected;
|
|
@@ -1225,32 +1224,32 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1225
1224
|
this.scrollToSelected();
|
|
1226
1225
|
}
|
|
1227
1226
|
});
|
|
1228
|
-
}, size: "small" }, this.state.viewType !== TABLE ?
|
|
1229
|
-
|
|
1227
|
+
}, size: "small" }, this.state.viewType !== TABLE ? React.createElement(IconList, { fontSize: "small" }) : React.createElement(IconTile, { fontSize: "small" }))) : null,
|
|
1228
|
+
React.createElement(IconButton, { edge: "start", title: this.props.t('ra_Hide empty folders'), style: styles.menuButton, color: this.state.filterEmpty ? 'secondary' : 'inherit', "aria-label": "filter empty", onClick: () => {
|
|
1230
1229
|
this.localStorage.setItem('file.empty', this.state.filterEmpty ? 'false' : 'true');
|
|
1231
1230
|
this.setState({ filterEmpty: !this.state.filterEmpty });
|
|
1232
1231
|
}, size: "small" },
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
this.props.allowCreateFolder ? (
|
|
1232
|
+
React.createElement(EmptyFilterIcon, { fontSize: "small" })),
|
|
1233
|
+
React.createElement(IconButton, { edge: "start", title: this.props.t('ra_Reload files'), style: styles.menuButton, color: "inherit", "aria-label": "reload files", onClick: () => this.setState({ folders: {} }, () => this.loadFolders()), size: "small" },
|
|
1234
|
+
React.createElement(RefreshIcon, { fontSize: "small" })),
|
|
1235
|
+
this.props.allowCreateFolder ? (React.createElement(IconButton, { edge: "start", disabled: !this.state.selected ||
|
|
1237
1236
|
!isInFolder ||
|
|
1238
1237
|
(!!this.limitToPath &&
|
|
1239
1238
|
!this.state.selected.startsWith(`${this.limitToPath}/`) &&
|
|
1240
1239
|
this.limitToPath !== this.state.selected), title: this.props.t('ra_Create folder'), style: styles.menuButton, color: "inherit", "aria-label": "add folder", onClick: () => this.setState({ addFolder: true }), size: "small" },
|
|
1241
|
-
|
|
1242
|
-
this.props.allowUpload ? (
|
|
1240
|
+
React.createElement(AddFolderIcon, { fontSize: "small" }))) : null,
|
|
1241
|
+
this.props.allowUpload ? (React.createElement(IconButton, { edge: "start", disabled: !this.state.selected ||
|
|
1243
1242
|
!isInFolder ||
|
|
1244
1243
|
(!!this.limitToPath &&
|
|
1245
1244
|
!this.state.selected.startsWith(`${this.limitToPath}/`) &&
|
|
1246
1245
|
this.limitToPath !== this.state.selected), title: this.props.t('ra_Upload file'), style: styles.menuButton, color: "inherit", "aria-label": "upload file", onClick: () => this.setState({ uploadFile: true }), size: "small" },
|
|
1247
|
-
|
|
1248
|
-
this.props.showTypeSelector && IconType ? (
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
this.state.showTypesMenu ? (
|
|
1246
|
+
React.createElement(UploadIcon, { fontSize: "small" }))) : null,
|
|
1247
|
+
this.props.showTypeSelector && IconType ? (React.createElement(Tooltip, { title: this.props.t('ra_Filter files'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
1248
|
+
React.createElement(IconButton, { size: "small", onClick: e => this.setState({ showTypesMenu: e.target }) },
|
|
1249
|
+
React.createElement(IconType, { fontSize: "small" })))) : null,
|
|
1250
|
+
this.state.showTypesMenu ? (React.createElement(Menu, { open: !0, anchorEl: this.state.showTypesMenu, onClose: () => this.setState({ showTypesMenu: null }) }, Object.keys(FILE_TYPE_ICONS).map(type => {
|
|
1252
1251
|
const MyIcon = FILE_TYPE_ICONS[type];
|
|
1253
|
-
return (
|
|
1252
|
+
return (React.createElement(MenuItem, { key: type, selected: this.state.filterByType === type, onClick: () => {
|
|
1254
1253
|
if (type === 'all') {
|
|
1255
1254
|
this.localStorage.removeItem('files.filterByType');
|
|
1256
1255
|
this.setState({ filterByType: '', showTypesMenu: null });
|
|
@@ -1260,16 +1259,16 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1260
1259
|
this.setState({ filterByType: type, showTypesMenu: null });
|
|
1261
1260
|
}
|
|
1262
1261
|
} },
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1262
|
+
React.createElement(ListItemIcon, null,
|
|
1263
|
+
React.createElement(MyIcon, { fontSize: "small" })),
|
|
1264
|
+
React.createElement(ListItemText, null, this.props.t(`ra_fileType_${type}`))));
|
|
1266
1265
|
}))) : null,
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
this.state.viewType !== TABLE && this.props.allowDelete ? (
|
|
1271
|
-
|
|
1272
|
-
|
|
1266
|
+
React.createElement(Tooltip, { title: this.props.t('ra_Background image'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
1267
|
+
React.createElement(IconButton, { color: "inherit", edge: "start", style: styles.menuButton, onClick: this.setStateBackgroundImage, size: "small" },
|
|
1268
|
+
React.createElement(Brightness5Icon, { fontSize: "small" }))),
|
|
1269
|
+
this.state.viewType !== TABLE && this.props.allowDelete ? (React.createElement(Tooltip, { title: this.props.t('ra_Delete'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
1270
|
+
React.createElement("span", null,
|
|
1271
|
+
React.createElement(IconButton, { "aria-label": "delete", disabled: !this.state.selected ||
|
|
1273
1272
|
this.state.selected === 'vis.0/' ||
|
|
1274
1273
|
this.state.selected === 'vis-2.0/' ||
|
|
1275
1274
|
this.state.selected === USER_DATA, color: "inherit", edge: "start", style: styles.menuButton, onClick: e => {
|
|
@@ -1281,7 +1280,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1281
1280
|
this.setState({ deleteItem: this.state.selected });
|
|
1282
1281
|
}
|
|
1283
1282
|
}, size: "small" },
|
|
1284
|
-
|
|
1283
|
+
React.createElement(DeleteIcon, { fontSize: "small" }))))) : null));
|
|
1285
1284
|
}
|
|
1286
1285
|
findItem(id, folders) {
|
|
1287
1286
|
folders = folders || this.state.folders;
|
|
@@ -1303,7 +1302,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1303
1302
|
window.alert(this.props.t('ra_Invalid parent folder!'));
|
|
1304
1303
|
return null;
|
|
1305
1304
|
}
|
|
1306
|
-
return (
|
|
1305
|
+
return (React.createElement(DialogTextInput, { key: "inputDialog", applyText: this.props.t('ra_Create'), cancelText: this.props.t('ra_Cancel'), titleText: this.props.t('ra_Create new folder in %s', this.state.selected), promptText: this.props.t('ra_If no file will be created in the folder, it will disappear after the browser closed'), labelText: this.props.t('ra_Folder name'), verify: (text) => this.state.folders[parentFolder].find(item => item.name === text)
|
|
1307
1306
|
? ''
|
|
1308
1307
|
: this.props.t('ra_Duplicate name'), onClose: (name) => {
|
|
1309
1308
|
if (name) {
|
|
@@ -1313,7 +1312,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1313
1312
|
const id = `${parentFolder}/${name}`;
|
|
1314
1313
|
folders[parentFolder].push({
|
|
1315
1314
|
id,
|
|
1316
|
-
level: (
|
|
1315
|
+
level: (parent?.level || 0) + 1,
|
|
1317
1316
|
name,
|
|
1318
1317
|
folder: true,
|
|
1319
1318
|
temp: true,
|
|
@@ -1357,7 +1356,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1357
1356
|
parentFolder = '';
|
|
1358
1357
|
while (parts.length) {
|
|
1359
1358
|
const _item = this.findItem(parts.join('/'));
|
|
1360
|
-
if (_item
|
|
1359
|
+
if (_item?.folder) {
|
|
1361
1360
|
parentFolder = parts.join('/');
|
|
1362
1361
|
break;
|
|
1363
1362
|
}
|
|
@@ -1377,15 +1376,15 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1377
1376
|
}
|
|
1378
1377
|
catch (e) {
|
|
1379
1378
|
const knownError = e;
|
|
1380
|
-
window.alert(`Cannot write file: ${knownError
|
|
1379
|
+
window.alert(`Cannot write file: ${knownError?.message}`);
|
|
1381
1380
|
}
|
|
1382
1381
|
}
|
|
1383
1382
|
renderUpload() {
|
|
1384
1383
|
if (this.state.uploadFile) {
|
|
1385
1384
|
return [
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1385
|
+
React.createElement(Fab, { key: "close", color: "primary", "aria-label": "close", style: styles.uploadCloseButton, onClick: () => this.setState({ uploadFile: false }) },
|
|
1386
|
+
React.createElement(CloseIcon, null)),
|
|
1387
|
+
React.createElement(Dropzone, { key: "dropzone", onDragEnter: () => this.setState({ uploadFile: 'dragging' }), onDragLeave: () => this.setState({ uploadFile: true }), onDrop: acceptedFiles => {
|
|
1389
1388
|
let count = acceptedFiles.length;
|
|
1390
1389
|
acceptedFiles.forEach(file => {
|
|
1391
1390
|
const reader = new FileReader();
|
|
@@ -1430,12 +1429,15 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1430
1429
|
};
|
|
1431
1430
|
reader.readAsArrayBuffer(file);
|
|
1432
1431
|
});
|
|
1433
|
-
} }, ({ getRootProps, getInputProps }) => (
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1432
|
+
} }, ({ getRootProps, getInputProps }) => (React.createElement("div", { style: {
|
|
1433
|
+
...styles.uploadDiv,
|
|
1434
|
+
...(this.state.uploadFile === 'dragging' ? styles.uploadDivDragging : undefined),
|
|
1435
|
+
}, ...getRootProps() },
|
|
1436
|
+
React.createElement("input", { ...getInputProps() }),
|
|
1437
|
+
React.createElement(Box, { component: "div", sx: styles.uploadCenterDiv },
|
|
1438
|
+
React.createElement("div", { style: styles.uploadCenterTextAndIcon },
|
|
1439
|
+
React.createElement(UploadIcon, { style: styles.uploadCenterIcon }),
|
|
1440
|
+
React.createElement("div", { style: styles.uploadCenterText }, this.state.uploadFile === 'dragging'
|
|
1439
1441
|
? this.props.t('ra_Drop file here')
|
|
1440
1442
|
: this.props.t('ra_Place your files here or click here to open the browse dialog'))))))),
|
|
1441
1443
|
];
|
|
@@ -1444,7 +1446,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1444
1446
|
}
|
|
1445
1447
|
deleteRecursive(id) {
|
|
1446
1448
|
const item = this.findItem(id);
|
|
1447
|
-
if (item
|
|
1449
|
+
if (item?.folder) {
|
|
1448
1450
|
return (this.state.folders[id]
|
|
1449
1451
|
? Promise.all(this.state.folders[id].map(_item => this.deleteRecursive(_item.id)))
|
|
1450
1452
|
: Promise.resolve()).then(() => {
|
|
@@ -1517,26 +1519,26 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1517
1519
|
}
|
|
1518
1520
|
renderDeleteDialog() {
|
|
1519
1521
|
if (this.state.deleteItem) {
|
|
1520
|
-
return (
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1522
|
+
return (React.createElement(Dialog, { key: "deleteDialog", open: !0, onClose: () => this.setState({ deleteItem: '' }), "aria-labelledby": "ar_dialog_file_delete_title" },
|
|
1523
|
+
React.createElement(DialogTitle, { id: "ar_dialog_file_delete_title" }, this.props.t('ra_Confirm deletion of %s', this.state.deleteItem.split('/').pop())),
|
|
1524
|
+
React.createElement(DialogContent, null,
|
|
1525
|
+
React.createElement(DialogContentText, null, this.props.t('ra_Are you sure?'))),
|
|
1526
|
+
React.createElement(DialogActions, null,
|
|
1527
|
+
React.createElement(Button, { color: "grey", variant: "contained", onClick: () => {
|
|
1526
1528
|
this.suppressDeleteConfirm = Date.now() + 60000 * 5;
|
|
1527
1529
|
this.deleteItem('');
|
|
1528
1530
|
} }, this.props.t('ra_Delete (no confirm for 5 mins)')),
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
+
React.createElement(Button, { variant: "contained", onClick: () => this.deleteItem(''), color: "primary", autoFocus: true }, this.props.t('ra_Delete')),
|
|
1532
|
+
React.createElement(Button, { variant: "contained", onClick: () => this.setState({ deleteItem: '' }), color: "grey" }, this.props.t('ra_Cancel')))));
|
|
1531
1533
|
}
|
|
1532
1534
|
return null;
|
|
1533
1535
|
}
|
|
1534
1536
|
renderViewDialog() {
|
|
1535
|
-
return this.state.viewer ? (
|
|
1537
|
+
return this.state.viewer ? (React.createElement(FileViewer, { supportSubscribes: this.supportSubscribes, key: this.state.viewer, href: this.state.viewer, formatEditFile: this.state.formatEditFile, themeType: this.props.themeType, setStateBackgroundImage: this.setStateBackgroundImage, getStyleBackgroundImage: this.getStyleBackgroundImage, t: this.props.t, socket: this.props.socket, lang: this.props.lang, expertMode: this.state.expertMode, onClose: () => this.setState({ viewer: '', formatEditFile: '' }) })) : null;
|
|
1536
1538
|
}
|
|
1537
1539
|
renderError() {
|
|
1538
1540
|
if (this.state.errorText) {
|
|
1539
|
-
return (
|
|
1541
|
+
return (React.createElement(DialogError, { key: "errorDialog", text: this.state.errorText, onClose: () => this.setState({ errorText: '' }) }));
|
|
1540
1542
|
}
|
|
1541
1543
|
return null;
|
|
1542
1544
|
}
|
|
@@ -1599,31 +1601,31 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1599
1601
|
? this.state.currentDir.split('/')
|
|
1600
1602
|
: `/${this.state.currentDir}`.split('/');
|
|
1601
1603
|
const p = [];
|
|
1602
|
-
return (
|
|
1604
|
+
return (React.createElement(Breadcrumbs, { style: { paddingLeft: 8 } }, parts.map((part, i) => {
|
|
1603
1605
|
if (part) {
|
|
1604
1606
|
p.push(part);
|
|
1605
1607
|
}
|
|
1606
1608
|
const path = p.join('/');
|
|
1607
1609
|
if (i < parts.length - 1) {
|
|
1608
|
-
return (
|
|
1610
|
+
return (React.createElement(Box, { component: "div", key: `${this.state.selected}_${i}`, sx: styles.pathDivBreadcrumbDir, onClick: e => this.changeFolder(e, path || '/') }, part || this.props.t('ra_Root')));
|
|
1609
1611
|
}
|
|
1610
|
-
return (
|
|
1612
|
+
return (React.createElement("div", { style: styles.pathDivBreadcrumbSelected, key: `${this.state.selected}_${i}`, onClick: () => this.setState({ pathFocus: true }) }, part));
|
|
1611
1613
|
})));
|
|
1612
1614
|
}
|
|
1613
1615
|
renderPath() {
|
|
1614
|
-
return (
|
|
1616
|
+
return (React.createElement(Box, { component: "div", key: "path", sx: styles.pathDiv }, this.state.pathFocus ? (React.createElement(Input, { value: this.state.path, onKeyDown: e => {
|
|
1615
1617
|
if (e.key === 'Enter') {
|
|
1616
1618
|
this.changeToPath();
|
|
1617
1619
|
}
|
|
1618
1620
|
else if (e.key === 'Escape') {
|
|
1619
1621
|
this.setState({ pathFocus: false });
|
|
1620
1622
|
}
|
|
1621
|
-
}, endAdornment:
|
|
1622
|
-
|
|
1623
|
+
}, endAdornment: React.createElement(IconButton, { size: "small", onClick: () => this.changeToPath() },
|
|
1624
|
+
React.createElement(EnterIcon, null)), onBlur: () => this.changeToPath(), onChange: e => this.setState({ path: e.target.value }), style: styles.pathDivInput })) : (this.renderBreadcrumb())));
|
|
1623
1625
|
}
|
|
1624
1626
|
render() {
|
|
1625
1627
|
if (!this.props.ready) {
|
|
1626
|
-
return
|
|
1628
|
+
return React.createElement(LinearProgress, null);
|
|
1627
1629
|
}
|
|
1628
1630
|
if (this.state.loadAllFolders && !this.foldersLoading) {
|
|
1629
1631
|
this.foldersLoading = true;
|
|
@@ -1634,10 +1636,13 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1634
1636
|
});
|
|
1635
1637
|
}, 300);
|
|
1636
1638
|
}
|
|
1637
|
-
return (
|
|
1639
|
+
return (React.createElement("div", { style: { ...styles.root, ...this.props.style }, className: this.props.className },
|
|
1638
1640
|
this.props.showToolbar ? this.renderToolbar() : null,
|
|
1639
1641
|
this.state.viewType === TILE ? this.renderPath() : null,
|
|
1640
|
-
|
|
1642
|
+
React.createElement("div", { style: {
|
|
1643
|
+
...styles.filesDiv,
|
|
1644
|
+
...styles[`filesDiv${this.state.viewType}`],
|
|
1645
|
+
}, onClick: e => {
|
|
1641
1646
|
if (this.state.viewType !== TABLE) {
|
|
1642
1647
|
if (this.state.selected !== (this.state.currentDir || '/')) {
|
|
1643
1648
|
this.changeFolder(e, this.state.currentDir || '/');
|
|
@@ -1650,7 +1655,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1650
1655
|
this.state.viewType === TABLE
|
|
1651
1656
|
? this.renderItems('/')
|
|
1652
1657
|
: this.renderItems(this.state.currentDir || '/'),
|
|
1653
|
-
this.state.viewType !== TABLE ? (
|
|
1658
|
+
this.state.viewType !== TABLE ? (React.createElement("div", { style: styles.filesDivHint }, this.props.t('ra_select_folder_hint'))) : null),
|
|
1654
1659
|
this.props.allowUpload ? this.renderInputDialog() : null,
|
|
1655
1660
|
this.props.allowUpload ? this.renderUpload() : null,
|
|
1656
1661
|
this.props.allowDelete ? this.renderDeleteDialog() : null,
|
|
@@ -1661,5 +1666,5 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1661
1666
|
this.renderError()));
|
|
1662
1667
|
}
|
|
1663
1668
|
}
|
|
1664
|
-
|
|
1665
|
-
|
|
1669
|
+
export const FileBrowser = withWidth()(FileBrowserClass);
|
|
1670
|
+
//# sourceMappingURL=FileBrowser.js.map
|