@iobroker/adapter-react-v5 7.4.17 → 7.4.19

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.
@@ -103,6 +103,7 @@ interface FileBrowserState {
103
103
  addFolder: boolean;
104
104
  uploadFile: boolean | 'dragging';
105
105
  deleteItem: string;
106
+ suppressDeleteConfirm: boolean;
106
107
  viewer: string;
107
108
  formatEditFile: string | null;
108
109
  path: string;
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import React, { Component } from 'react';
8
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';
9
+ import { LinearProgress, ListItemIcon, ListItemText, Menu, MenuItem, Tooltip, CircularProgress, Toolbar, IconButton, Fab, Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions, Button, Input, Breadcrumbs, Box, Checkbox, FormControlLabel, } from '@mui/material';
10
10
  // MUI Icons
11
11
  import { ArrowBack as IconBack, AudioFile as TypeIconAudio, Bookmark as JsonIcon, BookmarkBorder as CssIcon, Brightness6 as Brightness5Icon, Close as CloseIcon, Code as JSIcon, CreateNewFolder as AddFolderIcon, Delete as DeleteIcon, Description as HtmlIcon, Edit as EditIcon, FolderOpen as EmptyFilterIcon, FolderSpecial as RestrictedIcon, FontDownload as TypeIconTxt, Image as TypeIconImages, InsertDriveFile as FileIcon, KeyboardReturn as EnterIcon, List as IconList, MusicNote as MusicIcon, Publish as UploadIcon, Refresh as RefreshIcon, SaveAlt as DownloadIcon, Videocam as TypeIconVideo, ViewModule as IconTile, } from '@mui/icons-material';
12
12
  import { DialogError } from '../Dialogs/Error';
@@ -485,6 +485,7 @@ export class FileBrowserClass extends Component {
485
485
  showTypesMenu: null,
486
486
  restrictToFolder: props.restrictToFolder || '',
487
487
  pathFocus: false,
488
+ suppressDeleteConfirm: false,
488
489
  };
489
490
  this.imagePrefix = this.props.imagePrefix || './files/';
490
491
  this.levelPadding = this.props.levelPadding || 20;
@@ -1513,7 +1514,10 @@ export class FileBrowserClass extends Component {
1513
1514
  }
1514
1515
  deleteItem(deleteItem) {
1515
1516
  deleteItem = deleteItem || this.state.deleteItem;
1516
- this.setState({ deleteItem: '' }, () => this.deleteRecursive(deleteItem).then(() => {
1517
+ if (this.state.suppressDeleteConfirm) {
1518
+ this.suppressDeleteConfirm = Date.now() + 60000 * 5;
1519
+ }
1520
+ this.setState({ deleteItem: '', suppressDeleteConfirm: false }, () => this.deleteRecursive(deleteItem).then(() => {
1517
1521
  const newState = {};
1518
1522
  const pos = this.state.expanded.indexOf(deleteItem);
1519
1523
  if (pos !== -1) {
@@ -1552,12 +1556,11 @@ export class FileBrowserClass extends Component {
1552
1556
  return (React.createElement(Dialog, { key: "deleteDialog", open: !0, onClose: () => this.setState({ deleteItem: '' }), "aria-labelledby": "ar_dialog_file_delete_title" },
1553
1557
  React.createElement(DialogTitle, { id: "ar_dialog_file_delete_title" }, this.props.t('ra_Confirm deletion of %s', this.state.deleteItem.split('/').pop())),
1554
1558
  React.createElement(DialogContent, null,
1555
- React.createElement(DialogContentText, null, this.props.t('ra_Are you sure?'))),
1559
+ React.createElement(DialogContentText, null, this.props.t('ra_Are you sure?')),
1560
+ React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { checked: this.state.suppressDeleteConfirm, onChange: () => {
1561
+ this.setState({ suppressDeleteConfirm: !this.state.suppressDeleteConfirm });
1562
+ } }), label: this.props.t('ra_no confirm for 5 mins') })),
1556
1563
  React.createElement(DialogActions, null,
1557
- React.createElement(Button, { color: "grey", variant: "contained", onClick: () => {
1558
- this.suppressDeleteConfirm = Date.now() + 60000 * 5;
1559
- this.deleteItem('');
1560
- } }, this.props.t('ra_Delete (no confirm for 5 mins)')),
1561
1564
  React.createElement(Button, { variant: "contained", onClick: () => this.deleteItem(''), color: "primary", autoFocus: true }, this.props.t('ra_Delete')),
1562
1565
  React.createElement(Button, { variant: "contained", onClick: () => this.setState({ deleteItem: '' }), color: "grey" }, this.props.t('ra_Cancel')))));
1563
1566
  }