@iobroker/adapter-react-v5 7.2.4 → 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 +6 -6
- 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 +2 -2
- package/{Components → build/Components}/FileBrowser.js +229 -236
- 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 +4 -4
- package/{Components → build/Components}/ObjectBrowser.js +1152 -1116
- 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 +2 -2
- package/{Components → build/Components}/Schedule.js +242 -257
- 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 -58
- 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 -48
- 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 -2560
- 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 -8947
- package/src/Components/Router.tsx +0 -90
- package/src/Components/SaveCloseButtons.tsx +0 -117
- package/src/Components/Schedule.tsx +0 -1998
- 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,66 +1,37 @@
|
|
|
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
37
|
root: {
|
|
@@ -108,7 +79,7 @@ const styles = {
|
|
|
108
79
|
borderRadius: '4px',
|
|
109
80
|
'&:hover': {
|
|
110
81
|
background: theme.palette.secondary.light,
|
|
111
|
-
color:
|
|
82
|
+
color: Utils.invertColor(theme.palette.secondary.main, true),
|
|
112
83
|
},
|
|
113
84
|
}),
|
|
114
85
|
itemNameFolderTile: {
|
|
@@ -159,7 +130,7 @@ const styles = {
|
|
|
159
130
|
},
|
|
160
131
|
itemSelected: (theme) => ({
|
|
161
132
|
background: theme.palette.primary.main,
|
|
162
|
-
color:
|
|
133
|
+
color: Utils.invertColor(theme.palette.primary.main, true),
|
|
163
134
|
}),
|
|
164
135
|
itemTable: (theme) => ({
|
|
165
136
|
userSelect: 'none',
|
|
@@ -169,7 +140,7 @@ const styles = {
|
|
|
169
140
|
lineHeight: `${ROW_HEIGHT}px`,
|
|
170
141
|
'&:hover': {
|
|
171
142
|
background: theme.palette.secondary.light,
|
|
172
|
-
color:
|
|
143
|
+
color: Utils.invertColor(theme.palette.secondary.main, true),
|
|
173
144
|
},
|
|
174
145
|
}),
|
|
175
146
|
itemNameTable: {
|
|
@@ -388,8 +359,8 @@ function getParentDir(dir) {
|
|
|
388
359
|
return parts.join('/');
|
|
389
360
|
}
|
|
390
361
|
function isFile(path) {
|
|
391
|
-
const ext =
|
|
392
|
-
return !!(
|
|
362
|
+
const ext = Utils.getFileExtension(path);
|
|
363
|
+
return !!(ext?.toLowerCase().match(/[a-z]+/) && ext.length < 5);
|
|
393
364
|
}
|
|
394
365
|
const TABLE = 'Table';
|
|
395
366
|
const TILE = 'Tile';
|
|
@@ -405,61 +376,26 @@ function sortFolders(a, b) {
|
|
|
405
376
|
}
|
|
406
377
|
return a.name > b.name ? 1 : a.name < b.name ? -1 : 0;
|
|
407
378
|
}
|
|
408
|
-
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;
|
|
409
397
|
constructor(props) {
|
|
410
398
|
super(props);
|
|
411
|
-
this.limitToObjectID = null;
|
|
412
|
-
this.limitToPath = null;
|
|
413
|
-
this.lastSelect = null;
|
|
414
|
-
this.setOpacityTimer = null;
|
|
415
|
-
this.cacheFoldersTimeout = null;
|
|
416
|
-
this.foldersLoading = null;
|
|
417
|
-
this.cacheFolders = null;
|
|
418
|
-
this.onFileChange = (id, fileName, size) => {
|
|
419
|
-
const key = `${id}/${fileName}`;
|
|
420
|
-
const pos = key.lastIndexOf('/');
|
|
421
|
-
const folder = key.substring(0, pos);
|
|
422
|
-
console.log(`File changed ${key}[${size}]`);
|
|
423
|
-
if (this.state.folders[folder]) {
|
|
424
|
-
if (this._tempTimeout[folder]) {
|
|
425
|
-
clearTimeout(this._tempTimeout[folder]);
|
|
426
|
-
}
|
|
427
|
-
this._tempTimeout[folder] = setTimeout(() => {
|
|
428
|
-
delete this._tempTimeout[folder];
|
|
429
|
-
this.browseFolder(folder, null, false, true)
|
|
430
|
-
.then(folders => this.setState({ folders }))
|
|
431
|
-
.catch(e => console.error(`Cannot read folder: ${e.message}`));
|
|
432
|
-
}, 300);
|
|
433
|
-
}
|
|
434
|
-
};
|
|
435
|
-
this.setStateBackgroundImage = () => {
|
|
436
|
-
const array = ['light', 'dark', 'colored', 'delete'];
|
|
437
|
-
this.setState(({ backgroundImage }) => {
|
|
438
|
-
if (backgroundImage &&
|
|
439
|
-
array.indexOf(backgroundImage) !== -1 &&
|
|
440
|
-
array.length - 1 !== array.indexOf(backgroundImage)) {
|
|
441
|
-
this.localStorage.setItem('files.backgroundImage', array[array.indexOf(backgroundImage) + 1]);
|
|
442
|
-
return { backgroundImage: array[array.indexOf(backgroundImage) + 1] };
|
|
443
|
-
}
|
|
444
|
-
this.localStorage.setItem('files.backgroundImage', array[0]);
|
|
445
|
-
return { backgroundImage: array[0] };
|
|
446
|
-
});
|
|
447
|
-
};
|
|
448
|
-
this.getStyleBackgroundImage = () => {
|
|
449
|
-
// ['light', 'dark', 'colored', 'delete']
|
|
450
|
-
switch (this.state.backgroundImage) {
|
|
451
|
-
case 'light':
|
|
452
|
-
return styles.backgroundImageLight;
|
|
453
|
-
case 'dark':
|
|
454
|
-
return styles.backgroundImageDark;
|
|
455
|
-
case 'colored':
|
|
456
|
-
return styles.backgroundImageColored;
|
|
457
|
-
case 'delete':
|
|
458
|
-
return null;
|
|
459
|
-
default:
|
|
460
|
-
return null;
|
|
461
|
-
}
|
|
462
|
-
};
|
|
463
399
|
this.localStorage = window._localStorage || window.localStorage;
|
|
464
400
|
const expandedStr = this.localStorage.getItem('files.expanded') || '[]';
|
|
465
401
|
if (this.props.limitPath) {
|
|
@@ -474,15 +410,12 @@ class FileBrowserClass extends react_1.Component {
|
|
|
474
410
|
try {
|
|
475
411
|
expanded = JSON.parse(expandedStr);
|
|
476
412
|
if (this.limitToPath) {
|
|
477
|
-
expanded = expanded.filter(id => {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
id === this.limitToPath ||
|
|
481
|
-
((_a = this.limitToPath) === null || _a === void 0 ? void 0 : _a.startsWith(`${id}/`));
|
|
482
|
-
});
|
|
413
|
+
expanded = expanded.filter(id => id.startsWith(`${this.limitToPath}/`) ||
|
|
414
|
+
id === this.limitToPath ||
|
|
415
|
+
this.limitToPath?.startsWith(`${id}/`));
|
|
483
416
|
}
|
|
484
417
|
}
|
|
485
|
-
catch
|
|
418
|
+
catch {
|
|
486
419
|
expanded = [];
|
|
487
420
|
}
|
|
488
421
|
let viewType;
|
|
@@ -596,7 +529,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
596
529
|
scrollToSelected() {
|
|
597
530
|
if (this.mounted) {
|
|
598
531
|
const el = document.getElementById(this.state.selected);
|
|
599
|
-
el
|
|
532
|
+
el?.scrollIntoView();
|
|
600
533
|
}
|
|
601
534
|
}
|
|
602
535
|
async componentDidMount() {
|
|
@@ -618,7 +551,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
618
551
|
this._tempTimeout = {};
|
|
619
552
|
}
|
|
620
553
|
browseFoldersCb(foldersList, newFoldersNotNull, cb) {
|
|
621
|
-
if (!
|
|
554
|
+
if (!foldersList?.length) {
|
|
622
555
|
cb(newFoldersNotNull);
|
|
623
556
|
}
|
|
624
557
|
else {
|
|
@@ -644,7 +577,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
644
577
|
else {
|
|
645
578
|
newFoldersNotNull = _newFolders;
|
|
646
579
|
}
|
|
647
|
-
if (!
|
|
580
|
+
if (!foldersList?.length) {
|
|
648
581
|
return Promise.resolve(newFoldersNotNull);
|
|
649
582
|
}
|
|
650
583
|
return new Promise(resolve => {
|
|
@@ -855,13 +788,12 @@ class FileBrowserClass extends react_1.Component {
|
|
|
855
788
|
try {
|
|
856
789
|
const _folders = [];
|
|
857
790
|
files.forEach(file => {
|
|
858
|
-
var _a;
|
|
859
791
|
const item = {
|
|
860
792
|
id: `${folderId}/${file.file}`,
|
|
861
|
-
ext:
|
|
793
|
+
ext: Utils.getFileExtension(file.file),
|
|
862
794
|
folder: file.isDir,
|
|
863
795
|
name: file.file,
|
|
864
|
-
size:
|
|
796
|
+
size: file.stats?.size,
|
|
865
797
|
modified: file.modifiedAt,
|
|
866
798
|
acl: file.acl,
|
|
867
799
|
level,
|
|
@@ -903,14 +835,14 @@ class FileBrowserClass extends react_1.Component {
|
|
|
903
835
|
catch (e) {
|
|
904
836
|
const knownError = e;
|
|
905
837
|
if (this.initialReadFinished) {
|
|
906
|
-
window.alert(`Cannot read ${adapter}${relPath ? `/${relPath}` : ''}: ${knownError
|
|
838
|
+
window.alert(`Cannot read ${adapter}${relPath ? `/${relPath}` : ''}: ${knownError?.message}`);
|
|
907
839
|
}
|
|
908
840
|
newFoldersNotNull[folderId] = [];
|
|
909
841
|
}
|
|
910
842
|
return newFoldersNotNull;
|
|
911
843
|
}
|
|
912
844
|
toggleFolder(item, e) {
|
|
913
|
-
e
|
|
845
|
+
e?.stopPropagation();
|
|
914
846
|
const expanded = [...this.state.expanded];
|
|
915
847
|
const pos = expanded.indexOf(item.id);
|
|
916
848
|
if (pos === -1) {
|
|
@@ -934,8 +866,25 @@ class FileBrowserClass extends react_1.Component {
|
|
|
934
866
|
this.setState({ expanded });
|
|
935
867
|
}
|
|
936
868
|
}
|
|
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);
|
|
884
|
+
}
|
|
885
|
+
};
|
|
937
886
|
changeFolder(e, folder) {
|
|
938
|
-
e
|
|
887
|
+
e?.stopPropagation();
|
|
939
888
|
this.lastSelect = Date.now();
|
|
940
889
|
let _folder = folder || getParentDir(this.state.currentDir);
|
|
941
890
|
if (_folder === '/') {
|
|
@@ -974,10 +923,10 @@ class FileBrowserClass extends react_1.Component {
|
|
|
974
923
|
this.localStorage.setItem('files.selected', id);
|
|
975
924
|
this.setState({ selected: id, path: id, pathFocus: false }, () => {
|
|
976
925
|
if (this.props.onSelect) {
|
|
977
|
-
const ext =
|
|
926
|
+
const ext = Utils.getFileExtension(id);
|
|
978
927
|
if ((!this.props.filterFiles || (ext && this.props.filterFiles.includes(ext))) &&
|
|
979
928
|
(!this.state.filterByType ||
|
|
980
|
-
(ext &&
|
|
929
|
+
(ext && EXTENSIONS[this.state.filterByType].includes(ext)))) {
|
|
981
930
|
this.props.onSelect(id, false, !!this.state.folders[id]);
|
|
982
931
|
}
|
|
983
932
|
else {
|
|
@@ -1006,24 +955,24 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1006
955
|
!item.temp) {
|
|
1007
956
|
return null;
|
|
1008
957
|
}
|
|
1009
|
-
const IconEl = expanded ?
|
|
958
|
+
const IconEl = expanded ? IconOpen : IconClosed;
|
|
1010
959
|
const padding = this.state.viewType === TABLE ? item.level * this.levelPadding : 0;
|
|
1011
960
|
const isUserData = item.name === USER_DATA;
|
|
1012
961
|
const isSpecialData = isUserData || item.name === 'vis.0' || item.name === 'vis-2.0';
|
|
1013
|
-
const iconStyle =
|
|
1014
|
-
return (
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
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]
|
|
1018
967
|
? this.state.folders[item.id].length
|
|
1019
968
|
: ''),
|
|
1020
|
-
|
|
1021
|
-
this.state.viewType === TABLE && this.props.expertMode ? (
|
|
1022
|
-
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,
|
|
1023
972
|
this.state.viewType === TABLE &&
|
|
1024
973
|
this.props.allowDelete &&
|
|
1025
974
|
this.state.folders[item.id] &&
|
|
1026
|
-
this.state.folders[item.id].length ? (
|
|
975
|
+
this.state.folders[item.id].length ? (React.createElement(IconButton, { "aria-label": "delete", onClick: e => {
|
|
1027
976
|
e.stopPropagation();
|
|
1028
977
|
if (this.suppressDeleteConfirm > Date.now()) {
|
|
1029
978
|
this.deleteItem(item.id);
|
|
@@ -1032,16 +981,16 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1032
981
|
this.setState({ deleteItem: item.id });
|
|
1033
982
|
}
|
|
1034
983
|
}, sx: styles[`itemDeleteButton${this.state.viewType}`], size: "large" },
|
|
1035
|
-
|
|
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));
|
|
1036
985
|
}
|
|
1037
986
|
renderBackFolder() {
|
|
1038
|
-
return (
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
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}`]) }, "..")));
|
|
1042
991
|
}
|
|
1043
992
|
formatSize(size) {
|
|
1044
|
-
return (
|
|
993
|
+
return (React.createElement("div", { style: styles[`itemSize${this.state.viewType}`] }, size || size === 0 ? Utils.formatBytes(size) : ''));
|
|
1045
994
|
}
|
|
1046
995
|
formatAcl(acl) {
|
|
1047
996
|
const access = acl ? acl.permissions || acl.file : 0;
|
|
@@ -1052,30 +1001,30 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1052
1001
|
else {
|
|
1053
1002
|
accessStr = '';
|
|
1054
1003
|
}
|
|
1055
|
-
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 || '---')));
|
|
1056
1005
|
}
|
|
1057
1006
|
getFileIcon(ext) {
|
|
1058
1007
|
switch (ext) {
|
|
1059
1008
|
case 'json':
|
|
1060
1009
|
case 'json5':
|
|
1061
|
-
return
|
|
1010
|
+
return React.createElement(JsonIcon, { style: styles[`itemIcon${this.state.viewType}`] });
|
|
1062
1011
|
case 'css':
|
|
1063
|
-
return
|
|
1012
|
+
return React.createElement(CssIcon, { style: styles[`itemIcon${this.state.viewType}`] });
|
|
1064
1013
|
case 'js':
|
|
1065
1014
|
case 'ts':
|
|
1066
|
-
return
|
|
1015
|
+
return React.createElement(JSIcon, { style: styles[`itemIcon${this.state.viewType}`] });
|
|
1067
1016
|
case 'html':
|
|
1068
1017
|
case 'md':
|
|
1069
|
-
return
|
|
1018
|
+
return React.createElement(HtmlIcon, { style: styles[`itemIcon${this.state.viewType}`] });
|
|
1070
1019
|
case 'mp3':
|
|
1071
1020
|
case 'ogg':
|
|
1072
1021
|
case 'wav':
|
|
1073
1022
|
case 'm4a':
|
|
1074
1023
|
case 'mp4':
|
|
1075
1024
|
case 'flac':
|
|
1076
|
-
return
|
|
1025
|
+
return React.createElement(MusicIcon, { style: styles[`itemIcon${this.state.viewType}`] });
|
|
1077
1026
|
default:
|
|
1078
|
-
return
|
|
1027
|
+
return React.createElement(FileIcon, { style: styles[`itemIcon${this.state.viewType}`] });
|
|
1079
1028
|
}
|
|
1080
1029
|
}
|
|
1081
1030
|
static getEditFile(ext) {
|
|
@@ -1092,10 +1041,38 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1092
1041
|
return false;
|
|
1093
1042
|
}
|
|
1094
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
|
+
};
|
|
1095
1072
|
renderFile(item) {
|
|
1096
1073
|
const padding = this.state.viewType === TABLE ? item.level * this.levelPadding : 0;
|
|
1097
|
-
const ext =
|
|
1098
|
-
return (
|
|
1074
|
+
const ext = Utils.getFileExtension(item.name);
|
|
1075
|
+
return (React.createElement(Box, { component: "div", key: item.id, id: item.id, onDoubleClick: e => {
|
|
1099
1076
|
e.stopPropagation();
|
|
1100
1077
|
if (!this.props.onSelect) {
|
|
1101
1078
|
this.setState({ viewer: this.imagePrefix + item.id, formatEditFile: ext });
|
|
@@ -1103,22 +1080,26 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1103
1080
|
else if ((!this.props.filterFiles || (item.ext && this.props.filterFiles.includes(item.ext))) &&
|
|
1104
1081
|
(!this.state.filterByType ||
|
|
1105
1082
|
(item.ext &&
|
|
1106
|
-
|
|
1083
|
+
EXTENSIONS[this.state.filterByType].includes(item.ext)))) {
|
|
1107
1084
|
this.props.onSelect(item.id, true, !!this.state.folders[item.id]);
|
|
1108
1085
|
}
|
|
1109
|
-
}, onClick: e => this.select(item.id, e), style: this.state.viewType === TABLE ? { marginLeft: padding, width: `calc(100% - ${padding}px)` } : {}, className: "browserItem", sx:
|
|
1110
|
-
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 => {
|
|
1111
1092
|
e.target.onerror = null;
|
|
1112
1093
|
const fileErrors = [...this.state.fileErrors];
|
|
1113
1094
|
if (!fileErrors.includes(item.id)) {
|
|
1114
1095
|
fileErrors.push(item.id);
|
|
1115
1096
|
this.setState({ fileErrors });
|
|
1116
1097
|
}
|
|
1117
|
-
}, style:
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
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 => {
|
|
1122
1103
|
e.stopPropagation();
|
|
1123
1104
|
if (!this.props.onSelect) {
|
|
1124
1105
|
this.setState({ viewer: this.imagePrefix + item.id, formatEditFile: ext });
|
|
@@ -1127,18 +1108,18 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1127
1108
|
(item.ext && this.props.filterFiles.includes(item.ext))) &&
|
|
1128
1109
|
(!this.state.filterByType ||
|
|
1129
1110
|
(item.ext &&
|
|
1130
|
-
|
|
1111
|
+
EXTENSIONS[this.state.filterByType].includes(item.ext)))) {
|
|
1131
1112
|
this.props.onSelect(item.id, true, !!this.state.folders[item.id]);
|
|
1132
1113
|
}
|
|
1133
1114
|
}, sx: styles.itemDeleteButtonTable, size: "large" },
|
|
1134
|
-
|
|
1135
|
-
this.state.viewType === TABLE && this.props.allowDownload ? (
|
|
1136
|
-
|
|
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,
|
|
1137
1118
|
this.state.viewType === TABLE &&
|
|
1138
1119
|
this.props.allowDelete &&
|
|
1139
1120
|
item.id !== 'vis.0/' &&
|
|
1140
1121
|
item.id !== 'vis-2.0/' &&
|
|
1141
|
-
item.id !== USER_DATA ? (
|
|
1122
|
+
item.id !== USER_DATA ? (React.createElement(IconButton, { "aria-label": "delete", onClick: e => {
|
|
1142
1123
|
e.stopPropagation();
|
|
1143
1124
|
if (this.suppressDeleteConfirm > Date.now()) {
|
|
1144
1125
|
this.deleteItem(item.id);
|
|
@@ -1147,7 +1128,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1147
1128
|
this.setState({ deleteItem: item.id });
|
|
1148
1129
|
}
|
|
1149
1130
|
}, sx: styles[`itemDeleteButton${this.state.viewType}`], size: "large" },
|
|
1150
|
-
|
|
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));
|
|
1151
1132
|
}
|
|
1152
1133
|
renderItems(folderId) {
|
|
1153
1134
|
if (this.state.folders && this.state.folders[folderId]) {
|
|
@@ -1164,7 +1145,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1164
1145
|
else if ((!this.props.filterFiles || (item.ext && this.props.filterFiles.includes(item.ext))) &&
|
|
1165
1146
|
(!this.state.filterByType ||
|
|
1166
1147
|
(item.ext &&
|
|
1167
|
-
|
|
1148
|
+
EXTENSIONS[this.state.filterByType].includes(item.ext)))) {
|
|
1168
1149
|
res.push(this.renderFile(item));
|
|
1169
1150
|
}
|
|
1170
1151
|
});
|
|
@@ -1194,15 +1175,15 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1194
1175
|
else if ((!this.props.filterFiles || (item.ext && this.props.filterFiles.includes(item.ext))) &&
|
|
1195
1176
|
(!this.state.filterByType ||
|
|
1196
1177
|
(item.ext &&
|
|
1197
|
-
|
|
1178
|
+
EXTENSIONS[this.state.filterByType].includes(item.ext)))) {
|
|
1198
1179
|
totalResult.push(this.renderFile(item));
|
|
1199
1180
|
}
|
|
1200
1181
|
});
|
|
1201
1182
|
return totalResult;
|
|
1202
1183
|
}
|
|
1203
|
-
return (
|
|
1204
|
-
|
|
1205
|
-
|
|
1184
|
+
return (React.createElement("div", { style: { position: 'relative' } },
|
|
1185
|
+
React.createElement(CircularProgress, { key: folderId, color: "secondary", size: 24 }),
|
|
1186
|
+
React.createElement("div", { style: {
|
|
1206
1187
|
position: 'absolute',
|
|
1207
1188
|
zIndex: 2,
|
|
1208
1189
|
top: 4,
|
|
@@ -1215,17 +1196,23 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1215
1196
|
? FILE_TYPE_ICONS[this.state.filterByType || 'all'] || FILE_TYPE_ICONS.all
|
|
1216
1197
|
: null;
|
|
1217
1198
|
const isInFolder = this.findFirstFolder(this.state.selected);
|
|
1218
|
-
return (
|
|
1219
|
-
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
|
|
1220
1201
|
? this.props.t('ra_Show all folders')
|
|
1221
|
-
: 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({
|
|
1222
1206
|
restrictToFolder: (this.state.restrictToFolder ? '' : this.props.restrictToFolder) || '',
|
|
1223
1207
|
loadAllFolders: true,
|
|
1224
1208
|
}), size: "small" },
|
|
1225
|
-
|
|
1226
|
-
this.props.showExpertButton ? (
|
|
1227
|
-
|
|
1228
|
-
|
|
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: () => {
|
|
1229
1216
|
const viewType = this.state.viewType === TABLE ? TILE : TABLE;
|
|
1230
1217
|
this.localStorage.setItem('files.viewType', viewType);
|
|
1231
1218
|
let currentDir = this.state.selected;
|
|
@@ -1237,32 +1224,32 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1237
1224
|
this.scrollToSelected();
|
|
1238
1225
|
}
|
|
1239
1226
|
});
|
|
1240
|
-
}, size: "small" }, this.state.viewType !== TABLE ?
|
|
1241
|
-
|
|
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: () => {
|
|
1242
1229
|
this.localStorage.setItem('file.empty', this.state.filterEmpty ? 'false' : 'true');
|
|
1243
1230
|
this.setState({ filterEmpty: !this.state.filterEmpty });
|
|
1244
1231
|
}, size: "small" },
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
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 ||
|
|
1249
1236
|
!isInFolder ||
|
|
1250
1237
|
(!!this.limitToPath &&
|
|
1251
1238
|
!this.state.selected.startsWith(`${this.limitToPath}/`) &&
|
|
1252
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" },
|
|
1253
|
-
|
|
1254
|
-
this.props.allowUpload ? (
|
|
1240
|
+
React.createElement(AddFolderIcon, { fontSize: "small" }))) : null,
|
|
1241
|
+
this.props.allowUpload ? (React.createElement(IconButton, { edge: "start", disabled: !this.state.selected ||
|
|
1255
1242
|
!isInFolder ||
|
|
1256
1243
|
(!!this.limitToPath &&
|
|
1257
1244
|
!this.state.selected.startsWith(`${this.limitToPath}/`) &&
|
|
1258
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" },
|
|
1259
|
-
|
|
1260
|
-
this.props.showTypeSelector && IconType ? (
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
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 => {
|
|
1264
1251
|
const MyIcon = FILE_TYPE_ICONS[type];
|
|
1265
|
-
return (
|
|
1252
|
+
return (React.createElement(MenuItem, { key: type, selected: this.state.filterByType === type, onClick: () => {
|
|
1266
1253
|
if (type === 'all') {
|
|
1267
1254
|
this.localStorage.removeItem('files.filterByType');
|
|
1268
1255
|
this.setState({ filterByType: '', showTypesMenu: null });
|
|
@@ -1272,16 +1259,16 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1272
1259
|
this.setState({ filterByType: type, showTypesMenu: null });
|
|
1273
1260
|
}
|
|
1274
1261
|
} },
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1262
|
+
React.createElement(ListItemIcon, null,
|
|
1263
|
+
React.createElement(MyIcon, { fontSize: "small" })),
|
|
1264
|
+
React.createElement(ListItemText, null, this.props.t(`ra_fileType_${type}`))));
|
|
1278
1265
|
}))) : null,
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
this.state.viewType !== TABLE && this.props.allowDelete ? (
|
|
1283
|
-
|
|
1284
|
-
|
|
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 ||
|
|
1285
1272
|
this.state.selected === 'vis.0/' ||
|
|
1286
1273
|
this.state.selected === 'vis-2.0/' ||
|
|
1287
1274
|
this.state.selected === USER_DATA, color: "inherit", edge: "start", style: styles.menuButton, onClick: e => {
|
|
@@ -1293,7 +1280,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1293
1280
|
this.setState({ deleteItem: this.state.selected });
|
|
1294
1281
|
}
|
|
1295
1282
|
}, size: "small" },
|
|
1296
|
-
|
|
1283
|
+
React.createElement(DeleteIcon, { fontSize: "small" }))))) : null));
|
|
1297
1284
|
}
|
|
1298
1285
|
findItem(id, folders) {
|
|
1299
1286
|
folders = folders || this.state.folders;
|
|
@@ -1315,7 +1302,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1315
1302
|
window.alert(this.props.t('ra_Invalid parent folder!'));
|
|
1316
1303
|
return null;
|
|
1317
1304
|
}
|
|
1318
|
-
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)
|
|
1319
1306
|
? ''
|
|
1320
1307
|
: this.props.t('ra_Duplicate name'), onClose: (name) => {
|
|
1321
1308
|
if (name) {
|
|
@@ -1325,7 +1312,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1325
1312
|
const id = `${parentFolder}/${name}`;
|
|
1326
1313
|
folders[parentFolder].push({
|
|
1327
1314
|
id,
|
|
1328
|
-
level: (
|
|
1315
|
+
level: (parent?.level || 0) + 1,
|
|
1329
1316
|
name,
|
|
1330
1317
|
folder: true,
|
|
1331
1318
|
temp: true,
|
|
@@ -1369,7 +1356,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1369
1356
|
parentFolder = '';
|
|
1370
1357
|
while (parts.length) {
|
|
1371
1358
|
const _item = this.findItem(parts.join('/'));
|
|
1372
|
-
if (_item
|
|
1359
|
+
if (_item?.folder) {
|
|
1373
1360
|
parentFolder = parts.join('/');
|
|
1374
1361
|
break;
|
|
1375
1362
|
}
|
|
@@ -1389,15 +1376,15 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1389
1376
|
}
|
|
1390
1377
|
catch (e) {
|
|
1391
1378
|
const knownError = e;
|
|
1392
|
-
window.alert(`Cannot write file: ${knownError
|
|
1379
|
+
window.alert(`Cannot write file: ${knownError?.message}`);
|
|
1393
1380
|
}
|
|
1394
1381
|
}
|
|
1395
1382
|
renderUpload() {
|
|
1396
1383
|
if (this.state.uploadFile) {
|
|
1397
1384
|
return [
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
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 => {
|
|
1401
1388
|
let count = acceptedFiles.length;
|
|
1402
1389
|
acceptedFiles.forEach(file => {
|
|
1403
1390
|
const reader = new FileReader();
|
|
@@ -1442,12 +1429,15 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1442
1429
|
};
|
|
1443
1430
|
reader.readAsArrayBuffer(file);
|
|
1444
1431
|
});
|
|
1445
|
-
} }, ({ getRootProps, getInputProps }) => (
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
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'
|
|
1451
1441
|
? this.props.t('ra_Drop file here')
|
|
1452
1442
|
: this.props.t('ra_Place your files here or click here to open the browse dialog'))))))),
|
|
1453
1443
|
];
|
|
@@ -1456,7 +1446,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1456
1446
|
}
|
|
1457
1447
|
deleteRecursive(id) {
|
|
1458
1448
|
const item = this.findItem(id);
|
|
1459
|
-
if (item
|
|
1449
|
+
if (item?.folder) {
|
|
1460
1450
|
return (this.state.folders[id]
|
|
1461
1451
|
? Promise.all(this.state.folders[id].map(_item => this.deleteRecursive(_item.id)))
|
|
1462
1452
|
: Promise.resolve()).then(() => {
|
|
@@ -1529,26 +1519,26 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1529
1519
|
}
|
|
1530
1520
|
renderDeleteDialog() {
|
|
1531
1521
|
if (this.state.deleteItem) {
|
|
1532
|
-
return (
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
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: () => {
|
|
1538
1528
|
this.suppressDeleteConfirm = Date.now() + 60000 * 5;
|
|
1539
1529
|
this.deleteItem('');
|
|
1540
1530
|
} }, this.props.t('ra_Delete (no confirm for 5 mins)')),
|
|
1541
|
-
|
|
1542
|
-
|
|
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')))));
|
|
1543
1533
|
}
|
|
1544
1534
|
return null;
|
|
1545
1535
|
}
|
|
1546
1536
|
renderViewDialog() {
|
|
1547
|
-
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;
|
|
1548
1538
|
}
|
|
1549
1539
|
renderError() {
|
|
1550
1540
|
if (this.state.errorText) {
|
|
1551
|
-
return (
|
|
1541
|
+
return (React.createElement(DialogError, { key: "errorDialog", text: this.state.errorText, onClose: () => this.setState({ errorText: '' }) }));
|
|
1552
1542
|
}
|
|
1553
1543
|
return null;
|
|
1554
1544
|
}
|
|
@@ -1611,31 +1601,31 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1611
1601
|
? this.state.currentDir.split('/')
|
|
1612
1602
|
: `/${this.state.currentDir}`.split('/');
|
|
1613
1603
|
const p = [];
|
|
1614
|
-
return (
|
|
1604
|
+
return (React.createElement(Breadcrumbs, { style: { paddingLeft: 8 } }, parts.map((part, i) => {
|
|
1615
1605
|
if (part) {
|
|
1616
1606
|
p.push(part);
|
|
1617
1607
|
}
|
|
1618
1608
|
const path = p.join('/');
|
|
1619
1609
|
if (i < parts.length - 1) {
|
|
1620
|
-
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')));
|
|
1621
1611
|
}
|
|
1622
|
-
return (
|
|
1612
|
+
return (React.createElement("div", { style: styles.pathDivBreadcrumbSelected, key: `${this.state.selected}_${i}`, onClick: () => this.setState({ pathFocus: true }) }, part));
|
|
1623
1613
|
})));
|
|
1624
1614
|
}
|
|
1625
1615
|
renderPath() {
|
|
1626
|
-
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 => {
|
|
1627
1617
|
if (e.key === 'Enter') {
|
|
1628
1618
|
this.changeToPath();
|
|
1629
1619
|
}
|
|
1630
1620
|
else if (e.key === 'Escape') {
|
|
1631
1621
|
this.setState({ pathFocus: false });
|
|
1632
1622
|
}
|
|
1633
|
-
}, endAdornment:
|
|
1634
|
-
|
|
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())));
|
|
1635
1625
|
}
|
|
1636
1626
|
render() {
|
|
1637
1627
|
if (!this.props.ready) {
|
|
1638
|
-
return
|
|
1628
|
+
return React.createElement(LinearProgress, null);
|
|
1639
1629
|
}
|
|
1640
1630
|
if (this.state.loadAllFolders && !this.foldersLoading) {
|
|
1641
1631
|
this.foldersLoading = true;
|
|
@@ -1646,10 +1636,13 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1646
1636
|
});
|
|
1647
1637
|
}, 300);
|
|
1648
1638
|
}
|
|
1649
|
-
return (
|
|
1639
|
+
return (React.createElement("div", { style: { ...styles.root, ...this.props.style }, className: this.props.className },
|
|
1650
1640
|
this.props.showToolbar ? this.renderToolbar() : null,
|
|
1651
1641
|
this.state.viewType === TILE ? this.renderPath() : null,
|
|
1652
|
-
|
|
1642
|
+
React.createElement("div", { style: {
|
|
1643
|
+
...styles.filesDiv,
|
|
1644
|
+
...styles[`filesDiv${this.state.viewType}`],
|
|
1645
|
+
}, onClick: e => {
|
|
1653
1646
|
if (this.state.viewType !== TABLE) {
|
|
1654
1647
|
if (this.state.selected !== (this.state.currentDir || '/')) {
|
|
1655
1648
|
this.changeFolder(e, this.state.currentDir || '/');
|
|
@@ -1662,7 +1655,7 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1662
1655
|
this.state.viewType === TABLE
|
|
1663
1656
|
? this.renderItems('/')
|
|
1664
1657
|
: this.renderItems(this.state.currentDir || '/'),
|
|
1665
|
-
this.state.viewType !== TABLE ? (
|
|
1658
|
+
this.state.viewType !== TABLE ? (React.createElement("div", { style: styles.filesDivHint }, this.props.t('ra_select_folder_hint'))) : null),
|
|
1666
1659
|
this.props.allowUpload ? this.renderInputDialog() : null,
|
|
1667
1660
|
this.props.allowUpload ? this.renderUpload() : null,
|
|
1668
1661
|
this.props.allowDelete ? this.renderDeleteDialog() : null,
|
|
@@ -1673,5 +1666,5 @@ class FileBrowserClass extends react_1.Component {
|
|
|
1673
1666
|
this.renderError()));
|
|
1674
1667
|
}
|
|
1675
1668
|
}
|
|
1676
|
-
|
|
1677
|
-
|
|
1669
|
+
export const FileBrowser = withWidth()(FileBrowserClass);
|
|
1670
|
+
//# sourceMappingURL=FileBrowser.js.map
|