@iobroker/adapter-react-v5 7.2.4 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -15
- 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 +5 -3
- package/{Components → build/Components}/FileBrowser.js +230 -236
- package/build/Components/FileBrowser.js.map +1 -0
- package/build/Components/FileViewer.d.ts +49 -0
- package/build/Components/FileViewer.js +247 -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 +1159 -1122
- 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 +45 -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} +36 -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 +5 -0
- package/build/icons/IconAdapter.js.map +1 -0
- package/build/icons/IconAlias.d.ts +3 -0
- package/build/icons/IconAlias.js +5 -0
- package/build/icons/IconAlias.js.map +1 -0
- package/build/icons/IconChannel.d.ts +3 -0
- package/build/icons/IconChannel.js +8 -0
- package/build/icons/IconChannel.js.map +1 -0
- package/build/icons/IconClearFilter.d.ts +3 -0
- package/build/icons/IconClearFilter.js +6 -0
- package/build/icons/IconClearFilter.js.map +1 -0
- package/build/icons/IconClosed.d.ts +3 -0
- package/build/icons/IconClosed.js +5 -0
- package/build/icons/IconClosed.js.map +1 -0
- package/build/icons/IconCopy.d.ts +3 -0
- package/build/icons/IconCopy.js +4 -0
- package/build/icons/IconCopy.js.map +1 -0
- package/build/icons/IconDevice.d.ts +3 -0
- package/build/icons/IconDevice.js +14 -0
- package/build/icons/IconDevice.js.map +1 -0
- package/build/icons/IconDocument.d.ts +3 -0
- package/build/icons/IconDocument.js +5 -0
- package/build/icons/IconDocument.js.map +1 -0
- package/build/icons/IconDocumentReadOnly.d.ts +3 -0
- package/build/icons/IconDocumentReadOnly.js +6 -0
- package/build/icons/IconDocumentReadOnly.js.map +1 -0
- package/build/icons/IconExpert.d.ts +3 -0
- package/build/icons/IconExpert.js +5 -0
- package/build/icons/IconExpert.js.map +1 -0
- package/build/icons/IconFx.d.ts +3 -0
- package/build/icons/IconFx.js +4 -0
- package/build/icons/IconFx.js.map +1 -0
- package/build/icons/IconInstance.d.ts +3 -0
- package/build/icons/IconInstance.js +5 -0
- package/build/icons/IconInstance.js.map +1 -0
- package/build/icons/IconLogout.d.ts +3 -0
- package/build/icons/IconLogout.js +5 -0
- package/build/icons/IconLogout.js.map +1 -0
- package/build/icons/IconNoIcon.d.ts +3 -0
- package/build/icons/IconNoIcon.js +4 -0
- package/build/icons/IconNoIcon.js.map +1 -0
- package/build/icons/IconOpen.d.ts +3 -0
- package/build/icons/IconOpen.js +5 -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 +5 -0
- package/build/icons/IconState.js.map +1 -0
- package/build/index.d.ts +76 -0
- package/build/index.js +75 -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,643 +0,0 @@
|
|
|
1
|
-
import React, { Component, createRef, type JSX } from 'react';
|
|
2
|
-
import Dropzone from 'react-dropzone';
|
|
3
|
-
import { Cropper, type ReactCropperElement } from 'react-cropper';
|
|
4
|
-
|
|
5
|
-
import { Menu, MenuItem, Tooltip, IconButton } from '@mui/material';
|
|
6
|
-
|
|
7
|
-
import { Close as IconClose, Crop as CropIcon } from '@mui/icons-material';
|
|
8
|
-
import { FaFileUpload as UploadIcon } from 'react-icons/fa';
|
|
9
|
-
|
|
10
|
-
import I18n from '../i18n';
|
|
11
|
-
import Icon from './Icon';
|
|
12
|
-
|
|
13
|
-
// import 'cropperjs/dist/cropper.css';
|
|
14
|
-
const cropperStyles = `
|
|
15
|
-
/*!
|
|
16
|
-
* Cropper.js v1.5.12
|
|
17
|
-
* https://fengyuanchen.github.io/cropperjs
|
|
18
|
-
*
|
|
19
|
-
* Copyright 2015-present Chen Fengyuan
|
|
20
|
-
* Released under the MIT license
|
|
21
|
-
*
|
|
22
|
-
* Date: 2021-06-12T08:00:11.623Z
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
.cropper-container {
|
|
26
|
-
direction: ltr;
|
|
27
|
-
font-size: 0;
|
|
28
|
-
line-height: 0;
|
|
29
|
-
position: relative;
|
|
30
|
-
-ms-touch-action: none;
|
|
31
|
-
touch-action: none;
|
|
32
|
-
-webkit-user-select: none;
|
|
33
|
-
-moz-user-select: none;
|
|
34
|
-
-ms-user-select: none;
|
|
35
|
-
user-select: none;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.cropper-container img {
|
|
39
|
-
display: block;
|
|
40
|
-
height: 100%;
|
|
41
|
-
image-orientation: 0deg;
|
|
42
|
-
max-height: none !important;
|
|
43
|
-
max-width: none !important;
|
|
44
|
-
min-height: 0 !important;
|
|
45
|
-
min-width: 0 !important;
|
|
46
|
-
width: 100%;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.cropper-wrap-box,
|
|
50
|
-
.cropper-canvas,
|
|
51
|
-
.cropper-drag-box,
|
|
52
|
-
.cropper-crop-box,
|
|
53
|
-
.cropper-modal {
|
|
54
|
-
bottom: 0;
|
|
55
|
-
left: 0;
|
|
56
|
-
position: absolute;
|
|
57
|
-
right: 0;
|
|
58
|
-
top: 0;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.cropper-wrap-box,
|
|
62
|
-
.cropper-canvas {
|
|
63
|
-
overflow: hidden;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.cropper-drag-box {
|
|
67
|
-
background-color: #fff;
|
|
68
|
-
opacity: 0;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.cropper-modal {
|
|
72
|
-
background-color: #000;
|
|
73
|
-
opacity: 0.5;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.cropper-view-box {
|
|
77
|
-
display: block;
|
|
78
|
-
height: 100%;
|
|
79
|
-
outline: 1px solid #39f;
|
|
80
|
-
outline-color: rgba(51, 153, 255, 0.75);
|
|
81
|
-
overflow: hidden;
|
|
82
|
-
width: 100%;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.cropper-dashed {
|
|
86
|
-
border: 0 dashed #eee;
|
|
87
|
-
display: block;
|
|
88
|
-
opacity: 0.5;
|
|
89
|
-
position: absolute;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.cropper-dashed.dashed-h {
|
|
93
|
-
border-bottom-width: 1px;
|
|
94
|
-
border-top-width: 1px;
|
|
95
|
-
height: calc(100% / 3);
|
|
96
|
-
left: 0;
|
|
97
|
-
top: calc(100% / 3);
|
|
98
|
-
width: 100%;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.cropper-dashed.dashed-v {
|
|
102
|
-
border-left-width: 1px;
|
|
103
|
-
border-right-width: 1px;
|
|
104
|
-
height: 100%;
|
|
105
|
-
left: calc(100% / 3);
|
|
106
|
-
top: 0;
|
|
107
|
-
width: calc(100% / 3);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.cropper-center {
|
|
111
|
-
display: block;
|
|
112
|
-
height: 0;
|
|
113
|
-
left: 50%;
|
|
114
|
-
opacity: 0.75;
|
|
115
|
-
position: absolute;
|
|
116
|
-
top: 50%;
|
|
117
|
-
width: 0;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.cropper-center::before,
|
|
121
|
-
.cropper-center::after {
|
|
122
|
-
background-color: #eee;
|
|
123
|
-
content: ' ';
|
|
124
|
-
display: block;
|
|
125
|
-
position: absolute;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.cropper-center::before {
|
|
129
|
-
height: 1px;
|
|
130
|
-
left: -3px;
|
|
131
|
-
top: 0;
|
|
132
|
-
width: 7px;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.cropper-center::after {
|
|
136
|
-
height: 7px;
|
|
137
|
-
left: 0;
|
|
138
|
-
top: -3px;
|
|
139
|
-
width: 1px;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.cropper-face,
|
|
143
|
-
.cropper-line,
|
|
144
|
-
.cropper-point {
|
|
145
|
-
display: block;
|
|
146
|
-
height: 100%;
|
|
147
|
-
opacity: 0.1;
|
|
148
|
-
position: absolute;
|
|
149
|
-
width: 100%;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.cropper-face {
|
|
153
|
-
background-color: #fff;
|
|
154
|
-
left: 0;
|
|
155
|
-
top: 0;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.cropper-line {
|
|
159
|
-
background-color: #39f;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.cropper-line.line-e {
|
|
163
|
-
cursor: ew-resize;
|
|
164
|
-
right: -3px;
|
|
165
|
-
top: 0;
|
|
166
|
-
width: 5px;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.cropper-line.line-n {
|
|
170
|
-
cursor: ns-resize;
|
|
171
|
-
height: 5px;
|
|
172
|
-
left: 0;
|
|
173
|
-
top: -3px;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.cropper-line.line-w {
|
|
177
|
-
cursor: ew-resize;
|
|
178
|
-
left: -3px;
|
|
179
|
-
top: 0;
|
|
180
|
-
width: 5px;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.cropper-line.line-s {
|
|
184
|
-
bottom: -3px;
|
|
185
|
-
cursor: ns-resize;
|
|
186
|
-
height: 5px;
|
|
187
|
-
left: 0;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.cropper-point {
|
|
191
|
-
background-color: #39f;
|
|
192
|
-
height: 5px;
|
|
193
|
-
opacity: 0.75;
|
|
194
|
-
width: 5px;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.cropper-point.point-e {
|
|
198
|
-
cursor: ew-resize;
|
|
199
|
-
margin-top: -3px;
|
|
200
|
-
right: -3px;
|
|
201
|
-
top: 50%;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.cropper-point.point-n {
|
|
205
|
-
cursor: ns-resize;
|
|
206
|
-
left: 50%;
|
|
207
|
-
margin-left: -3px;
|
|
208
|
-
top: -3px;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.cropper-point.point-w {
|
|
212
|
-
cursor: ew-resize;
|
|
213
|
-
left: -3px;
|
|
214
|
-
margin-top: -3px;
|
|
215
|
-
top: 50%;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
.cropper-point.point-s {
|
|
219
|
-
bottom: -3px;
|
|
220
|
-
cursor: s-resize;
|
|
221
|
-
left: 50%;
|
|
222
|
-
margin-left: -3px;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.cropper-point.point-ne {
|
|
226
|
-
cursor: nesw-resize;
|
|
227
|
-
right: -3px;
|
|
228
|
-
top: -3px;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.cropper-point.point-nw {
|
|
232
|
-
cursor: nwse-resize;
|
|
233
|
-
left: -3px;
|
|
234
|
-
top: -3px;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.cropper-point.point-sw {
|
|
238
|
-
bottom: -3px;
|
|
239
|
-
cursor: nesw-resize;
|
|
240
|
-
left: -3px;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.cropper-point.point-se {
|
|
244
|
-
bottom: -3px;
|
|
245
|
-
cursor: nwse-resize;
|
|
246
|
-
height: 20px;
|
|
247
|
-
opacity: 1;
|
|
248
|
-
right: -3px;
|
|
249
|
-
width: 20px;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
@media (min-width: 768px) {
|
|
253
|
-
.cropper-point.point-se {
|
|
254
|
-
height: 15px;
|
|
255
|
-
width: 15px;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
@media (min-width: 992px) {
|
|
260
|
-
.cropper-point.point-se {
|
|
261
|
-
height: 10px;
|
|
262
|
-
width: 10px;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
@media (min-width: 1200px) {
|
|
267
|
-
.cropper-point.point-se {
|
|
268
|
-
height: 5px;
|
|
269
|
-
opacity: 0.75;
|
|
270
|
-
width: 5px;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
.cropper-point.point-se::before {
|
|
275
|
-
background-color: #39f;
|
|
276
|
-
bottom: -50%;
|
|
277
|
-
content: ' ';
|
|
278
|
-
display: block;
|
|
279
|
-
height: 200%;
|
|
280
|
-
opacity: 0;
|
|
281
|
-
position: absolute;
|
|
282
|
-
right: -50%;
|
|
283
|
-
width: 200%;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
.cropper-invisible {
|
|
287
|
-
opacity: 0;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
.cropper-bg {
|
|
291
|
-
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC');
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
.cropper-hide {
|
|
295
|
-
display: block;
|
|
296
|
-
height: 0;
|
|
297
|
-
position: absolute;
|
|
298
|
-
width: 0;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
.cropper-hidden {
|
|
302
|
-
display: none !important;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
.cropper-move {
|
|
306
|
-
cursor: move;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
.cropper-crop {
|
|
310
|
-
cursor: crosshair;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.cropper-disabled .cropper-drag-box,
|
|
314
|
-
.cropper-disabled .cropper-face,
|
|
315
|
-
.cropper-disabled .cropper-line,
|
|
316
|
-
.cropper-disabled .cropper-point {
|
|
317
|
-
cursor: not-allowed;
|
|
318
|
-
}
|
|
319
|
-
`;
|
|
320
|
-
|
|
321
|
-
const styles: Record<string, React.CSSProperties> = {
|
|
322
|
-
dropZone: {
|
|
323
|
-
width: '100%',
|
|
324
|
-
height: 100,
|
|
325
|
-
position: 'relative',
|
|
326
|
-
},
|
|
327
|
-
dropZoneEmpty: {},
|
|
328
|
-
image: {
|
|
329
|
-
objectFit: 'contain',
|
|
330
|
-
margin: 'auto',
|
|
331
|
-
display: 'flex',
|
|
332
|
-
width: '100%',
|
|
333
|
-
height: '100%',
|
|
334
|
-
},
|
|
335
|
-
|
|
336
|
-
uploadDiv: {
|
|
337
|
-
position: 'relative',
|
|
338
|
-
width: '100%',
|
|
339
|
-
height: 300,
|
|
340
|
-
opacity: 0.9,
|
|
341
|
-
marginTop: 30,
|
|
342
|
-
cursor: 'pointer',
|
|
343
|
-
outline: 'none',
|
|
344
|
-
},
|
|
345
|
-
uploadDivDragging: {
|
|
346
|
-
opacity: 1,
|
|
347
|
-
background: 'rgba(128,255,128,0.1)',
|
|
348
|
-
},
|
|
349
|
-
|
|
350
|
-
uploadCenterDiv: {
|
|
351
|
-
margin: 5,
|
|
352
|
-
border: '3px dashed grey',
|
|
353
|
-
borderRadius: 5,
|
|
354
|
-
width: 'calc(100% - 10px)',
|
|
355
|
-
height: 'calc(100% - 10px)',
|
|
356
|
-
position: 'relative',
|
|
357
|
-
display: 'flex',
|
|
358
|
-
},
|
|
359
|
-
uploadCenterIcon: {
|
|
360
|
-
paddingTop: 10,
|
|
361
|
-
width: 48,
|
|
362
|
-
height: 48,
|
|
363
|
-
},
|
|
364
|
-
uploadCenterText: {
|
|
365
|
-
fontSize: 16,
|
|
366
|
-
},
|
|
367
|
-
uploadCenterTextAndIcon: {
|
|
368
|
-
textAlign: 'center',
|
|
369
|
-
position: 'absolute',
|
|
370
|
-
top: 0,
|
|
371
|
-
bottom: 0,
|
|
372
|
-
left: 0,
|
|
373
|
-
right: 0,
|
|
374
|
-
display: 'flex',
|
|
375
|
-
flexDirection: 'column',
|
|
376
|
-
alignItems: 'center',
|
|
377
|
-
justifyContent: 'center',
|
|
378
|
-
},
|
|
379
|
-
disabledOpacity: {
|
|
380
|
-
opacity: 0.3,
|
|
381
|
-
cursor: 'default',
|
|
382
|
-
},
|
|
383
|
-
buttonRemoveWrapper: {
|
|
384
|
-
position: 'absolute',
|
|
385
|
-
zIndex: 222,
|
|
386
|
-
right: 0,
|
|
387
|
-
},
|
|
388
|
-
buttonCropWrapper: {
|
|
389
|
-
position: 'absolute',
|
|
390
|
-
zIndex: 222,
|
|
391
|
-
right: 0,
|
|
392
|
-
top: 50,
|
|
393
|
-
},
|
|
394
|
-
error: {
|
|
395
|
-
border: '2px solid red',
|
|
396
|
-
boxSizing: 'border-box',
|
|
397
|
-
},
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
interface UploadImageProps {
|
|
401
|
-
maxSize?: number;
|
|
402
|
-
disabled?: boolean;
|
|
403
|
-
crop?: boolean;
|
|
404
|
-
error?: boolean;
|
|
405
|
-
onChange: (base64: string) => void | undefined;
|
|
406
|
-
icon: string | null;
|
|
407
|
-
removeIconFunc: () => void | null;
|
|
408
|
-
accept?: Record<string, string[]>;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
interface UploadImageState {
|
|
412
|
-
uploadFile: boolean | 'dragging';
|
|
413
|
-
anchorEl: HTMLElement | null;
|
|
414
|
-
cropHandler: boolean;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
class UploadImage extends Component<UploadImageProps, UploadImageState> {
|
|
418
|
-
private readonly cropperRef: React.RefObject<ReactCropperElement>;
|
|
419
|
-
|
|
420
|
-
constructor(props: UploadImageProps) {
|
|
421
|
-
super(props);
|
|
422
|
-
|
|
423
|
-
this.state = {
|
|
424
|
-
uploadFile: false,
|
|
425
|
-
anchorEl: null,
|
|
426
|
-
cropHandler: false,
|
|
427
|
-
};
|
|
428
|
-
this.cropperRef = createRef();
|
|
429
|
-
|
|
430
|
-
if (!window.document.getElementById('cropper-style-json-component')) {
|
|
431
|
-
const style = window.document.createElement('style');
|
|
432
|
-
style.setAttribute('id', 'cropper-style-json-component');
|
|
433
|
-
style.innerHTML = cropperStyles;
|
|
434
|
-
window.document.head.appendChild(style);
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
onDrop(acceptedFiles: File[]): void {
|
|
439
|
-
const onChange = this.props.onChange;
|
|
440
|
-
const maxSize = this.props.maxSize || 10 * 1024;
|
|
441
|
-
|
|
442
|
-
const file = acceptedFiles[0];
|
|
443
|
-
const reader = new FileReader();
|
|
444
|
-
|
|
445
|
-
reader.onabort = () => console.log('file reading was aborted');
|
|
446
|
-
reader.onerror = () => console.log('file reading has failed');
|
|
447
|
-
reader.onload = () => {
|
|
448
|
-
if (!file || !file.name) {
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
const parts = file.name?.split('.');
|
|
452
|
-
let ext = parts?.length ? `image/${parts.pop()?.toLowerCase()}` : 'image/jpeg';
|
|
453
|
-
if (ext === 'image/jpg') {
|
|
454
|
-
ext = 'image/jpeg';
|
|
455
|
-
} else if (ext.includes('svg')) {
|
|
456
|
-
ext = 'image/svg+xml';
|
|
457
|
-
}
|
|
458
|
-
if (file.size > maxSize) {
|
|
459
|
-
window.alert(I18n.t('ra_File is too big. Max %sk allowed. Try use SVG.', Math.round(maxSize / 1024)));
|
|
460
|
-
} else {
|
|
461
|
-
const base64 = `data:${ext};base64,${btoa(
|
|
462
|
-
new Uint8Array(reader.result as ArrayBufferLike).reduce(
|
|
463
|
-
(data, byte) => data + String.fromCharCode(byte),
|
|
464
|
-
'',
|
|
465
|
-
),
|
|
466
|
-
)}`;
|
|
467
|
-
|
|
468
|
-
if (onChange) {
|
|
469
|
-
onChange(base64);
|
|
470
|
-
} else {
|
|
471
|
-
console.log(base64);
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
};
|
|
475
|
-
reader.readAsArrayBuffer(file);
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
render(): JSX.Element {
|
|
479
|
-
const { disabled, icon, removeIconFunc, error, crop, onChange } = this.props;
|
|
480
|
-
const maxSize = this.props.maxSize || 10 * 1024;
|
|
481
|
-
let accept = this.props.accept || { 'image/*': [] };
|
|
482
|
-
const { uploadFile, anchorEl, cropHandler } = this.state;
|
|
483
|
-
|
|
484
|
-
// covert '"image/png"' to { 'image/*': [] }
|
|
485
|
-
if (typeof accept === 'string') {
|
|
486
|
-
accept = { [accept]: [] };
|
|
487
|
-
} else if (Array.isArray(accept)) {
|
|
488
|
-
const result: Record<string, string[]> = {};
|
|
489
|
-
accept.forEach(item => {
|
|
490
|
-
result[item] = [];
|
|
491
|
-
});
|
|
492
|
-
accept = result;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
return (
|
|
496
|
-
<Dropzone
|
|
497
|
-
disabled={!!disabled || cropHandler}
|
|
498
|
-
key="dropzone"
|
|
499
|
-
multiple={false}
|
|
500
|
-
accept={accept}
|
|
501
|
-
maxSize={maxSize}
|
|
502
|
-
onDragEnter={() => this.setState({ uploadFile: 'dragging' })}
|
|
503
|
-
onDragLeave={() => this.setState({ uploadFile: true })}
|
|
504
|
-
onDrop={(acceptedFiles: File[], errors) => {
|
|
505
|
-
this.setState({ uploadFile: false });
|
|
506
|
-
if (!acceptedFiles.length) {
|
|
507
|
-
window.alert(
|
|
508
|
-
(errors &&
|
|
509
|
-
errors[0] &&
|
|
510
|
-
errors[0].errors &&
|
|
511
|
-
errors[0].errors[0] &&
|
|
512
|
-
errors[0].errors[0].message) ||
|
|
513
|
-
I18n.t('ra_Cannot upload'),
|
|
514
|
-
);
|
|
515
|
-
} else {
|
|
516
|
-
this.onDrop(acceptedFiles);
|
|
517
|
-
}
|
|
518
|
-
}}
|
|
519
|
-
>
|
|
520
|
-
{({ getRootProps, getInputProps }) => (
|
|
521
|
-
<div
|
|
522
|
-
style={{
|
|
523
|
-
...styles.uploadDiv,
|
|
524
|
-
...(uploadFile === 'dragging' ? styles.uploadDivDragging : undefined),
|
|
525
|
-
...styles.dropZone,
|
|
526
|
-
...(disabled ? styles.disabledOpacity : undefined),
|
|
527
|
-
...(!icon ? styles.dropZoneEmpty : undefined),
|
|
528
|
-
}}
|
|
529
|
-
{...getRootProps()}
|
|
530
|
-
>
|
|
531
|
-
<input {...getInputProps()} />
|
|
532
|
-
<div style={{ ...styles.uploadCenterDiv, ...(error ? styles.error : undefined) }}>
|
|
533
|
-
{!icon ? (
|
|
534
|
-
<div style={styles.uploadCenterTextAndIcon}>
|
|
535
|
-
<UploadIcon style={styles.uploadCenterIcon} />
|
|
536
|
-
<div style={styles.uploadCenterText}>
|
|
537
|
-
{uploadFile === 'dragging'
|
|
538
|
-
? I18n.t('ra_Drop file here')
|
|
539
|
-
: I18n.t(
|
|
540
|
-
'ra_Place your files here or click here to open the browse dialog',
|
|
541
|
-
)}
|
|
542
|
-
</div>
|
|
543
|
-
</div>
|
|
544
|
-
) : (
|
|
545
|
-
removeIconFunc &&
|
|
546
|
-
!cropHandler && (
|
|
547
|
-
<div style={styles.buttonRemoveWrapper}>
|
|
548
|
-
<Tooltip
|
|
549
|
-
title={I18n.t('ra_Clear')}
|
|
550
|
-
slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}
|
|
551
|
-
>
|
|
552
|
-
<IconButton
|
|
553
|
-
size="large"
|
|
554
|
-
onClick={e => {
|
|
555
|
-
removeIconFunc && removeIconFunc();
|
|
556
|
-
e.stopPropagation();
|
|
557
|
-
}}
|
|
558
|
-
>
|
|
559
|
-
<IconClose />
|
|
560
|
-
</IconButton>
|
|
561
|
-
</Tooltip>
|
|
562
|
-
</div>
|
|
563
|
-
)
|
|
564
|
-
)}
|
|
565
|
-
{icon && crop && (
|
|
566
|
-
<div style={styles.buttonCropWrapper}>
|
|
567
|
-
<Tooltip
|
|
568
|
-
title={I18n.t('ra_Crop')}
|
|
569
|
-
slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}
|
|
570
|
-
>
|
|
571
|
-
<IconButton
|
|
572
|
-
size="large"
|
|
573
|
-
onClick={e => {
|
|
574
|
-
if (!cropHandler) {
|
|
575
|
-
this.setState({ cropHandler: true });
|
|
576
|
-
} else {
|
|
577
|
-
this.setState({ anchorEl: e.currentTarget });
|
|
578
|
-
}
|
|
579
|
-
e.stopPropagation();
|
|
580
|
-
}}
|
|
581
|
-
>
|
|
582
|
-
<CropIcon color={cropHandler ? 'primary' : 'inherit'} />
|
|
583
|
-
</IconButton>
|
|
584
|
-
</Tooltip>
|
|
585
|
-
<Menu
|
|
586
|
-
anchorEl={anchorEl}
|
|
587
|
-
keepMounted
|
|
588
|
-
open={Boolean(anchorEl)}
|
|
589
|
-
onClose={() => this.setState({ anchorEl: null })}
|
|
590
|
-
>
|
|
591
|
-
<MenuItem
|
|
592
|
-
onClick={() =>
|
|
593
|
-
this.setState({ anchorEl: null, cropHandler: false }, () => {
|
|
594
|
-
const imageElement = this.cropperRef?.current?.cropper;
|
|
595
|
-
if (imageElement) {
|
|
596
|
-
if (onChange) {
|
|
597
|
-
onChange(imageElement.getCroppedCanvas().toDataURL());
|
|
598
|
-
} else {
|
|
599
|
-
console.log(imageElement.getCroppedCanvas().toDataURL());
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
})
|
|
603
|
-
}
|
|
604
|
-
>
|
|
605
|
-
{I18n.t('ra_Save')}
|
|
606
|
-
</MenuItem>
|
|
607
|
-
<MenuItem onClick={() => this.setState({ anchorEl: null, cropHandler: false })}>
|
|
608
|
-
{I18n.t('ra_Close')}
|
|
609
|
-
</MenuItem>
|
|
610
|
-
</Menu>
|
|
611
|
-
</div>
|
|
612
|
-
)}
|
|
613
|
-
{icon && !cropHandler ? (
|
|
614
|
-
<Icon
|
|
615
|
-
src={icon}
|
|
616
|
-
style={styles.image}
|
|
617
|
-
alt="icon"
|
|
618
|
-
/>
|
|
619
|
-
) : null}
|
|
620
|
-
|
|
621
|
-
{icon && crop && cropHandler ? (
|
|
622
|
-
<Cropper
|
|
623
|
-
ref={this.cropperRef}
|
|
624
|
-
style={styles.image}
|
|
625
|
-
src={icon}
|
|
626
|
-
initialAspectRatio={1}
|
|
627
|
-
viewMode={1}
|
|
628
|
-
guides={false}
|
|
629
|
-
minCropBoxHeight={10}
|
|
630
|
-
minCropBoxWidth={10}
|
|
631
|
-
background={false}
|
|
632
|
-
checkOrientation={false}
|
|
633
|
-
/>
|
|
634
|
-
) : null}
|
|
635
|
-
</div>
|
|
636
|
-
</div>
|
|
637
|
-
)}
|
|
638
|
-
</Dropzone>
|
|
639
|
-
);
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
export default UploadImage;
|